From d494eedb00d00484373ba1ae7af878e88a03dc23 Mon Sep 17 00:00:00 2001 From: Alex Dunmow Date: Sat, 4 Jul 2026 00:15:52 +0800 Subject: [PATCH] chore: repo hygiene for the wasm era (WO-WZ-015 fix round) Replace the retired .so Makefile with the wasm/.bnp convention (build / verify / archive-check / publish via ninja plugin build), add a .gitignore for *.so and *.bnp artifacts, and refresh the stale [compatibility] block_core constraint to the v0.15 era. Co-Authored-By: Claude Fable 5 --- .gitignore | 2 ++ Makefile | 89 +++++++++++++++++++++++++++--------------------------- plugin.mod | 2 +- 3 files changed, 47 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 4ae1cff..447bf73 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ terminal.so +*.so +*.bnp diff --git a/Makefile b/Makefile index 9f84a45..40729f7 100644 --- a/Makefile +++ b/Makefile @@ -1,60 +1,59 @@ -# Terminal — build helpers (.so plugin workflow) +# terminal — build & publish helpers (wasm .bnp workflow) # -# The plugin compiles to a .so shared object loaded by the CMS at runtime. +# The theme compiles to a wasip1 reactor-mode wasm module packed into a .bnp +# artifact (`ninja plugin build`). The legacy .so path is retired (WO-WZ-015): +# the CMS is wasm-native and can no longer load .so plugins. Distribution is +# publish-to-registry -> InstallFromRegistry (hot-load, no restart). # # Usage: -# make # Default: build terminal.so locally -# make clean # Remove built artefacts -# make templ # Regenerate *_templ.go +# make build # compile wasm + pack terminal-.bnp +# make verify # validate the built .bnp (layout/abi/name/size) +# make archive-check # prove a clean `git archive HEAD` compiles to wasm +# make publish # ninja plugin publish --bnp (to the active registry) +# make templ # regenerate templ Go files +# make clean # remove build artefacts -.PHONY: all clean templ help bump-patch bump-minor bump-major sync-version +.PHONY: build verify archive-check publish templ clean help PLUGIN_NAME := terminal -TEMPL := $(HOME)/go/bin/templ +NINJA := ninja +BNP := $(PLUGIN_NAME)-$(shell grep '^version' plugin.mod | sed 's/.*"\(.*\)"/\1/').bnp -# Default target: build the .so locally -all: $(PLUGIN_NAME).so +# Compile to wasm and pack the .bnp (GOOS=wasip1 GOARCH=wasm, DESCRIBE probe, +# tar.zst of plugin.wasm + plugin.mod + manifest.pb + schemas/ + assets/). +build: + $(NINJA) plugin build --dir . -# Local plugin build -$(PLUGIN_NAME).so: $(wildcard *.go) plugin.mod go.mod - CGO_ENABLED=1 go build -buildmode=plugin -ldflags="-s -w" -o $(PLUGIN_NAME).so . +# Validate the built .bnp exactly as the registry/loader will. +verify: + $(NINJA) plugin verify $(BNP) -# Regenerate templ Go files +# Prove a clean `git archive HEAD` (what publish ships) compiles to wasm. +archive-check: + @T=$$(mktemp -d /tmp/archive-check-$(PLUGIN_NAME).XXXXXX) && \ + trap 'rm -rf "$$T"' EXIT && \ + git archive HEAD | tar -x -C "$$T" && \ + cd "$$T" && GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o "$$T/check.wasm" . && \ + echo "archive-check OK" + +# Publish the prebuilt .bnp to the active registry. +# Pass --host https://my.localdev.blockninjacms.com for the dev orchestrator. +publish: build + $(NINJA) plugin publish --bnp $(BNP) + +# Regenerate templ Go files locally. templ: - $(TEMPL) generate + templ generate +# Remove build artefacts. clean: - rm -f $(PLUGIN_NAME).so + rm -f $(PLUGIN_NAME)-*.bnp $(PLUGIN_NAME).so plugin.wasm help: @echo "Targets:" - @echo " all Build $(PLUGIN_NAME).so locally (default)" - @echo " templ Regenerate templ Go files" - @echo " clean Remove built artefacts" - -# --- Version bump targets --- -CURRENT_VERSION := $(shell grep '^version' plugin.mod | sed 's/.*"\(.*\)"/\1/') - -bump-patch: - @NEW=$$(echo $(CURRENT_VERSION) | awk -F. '{printf "%d.%d.%d", $$1, $$2, $$3+1}'); \ - sed -i 's/version = "$(CURRENT_VERSION)"/version = "'$$NEW'"/' plugin.mod; \ - git add plugin.mod && git commit -m "chore: bump version to $$NEW" && git tag "v$$NEW"; \ - echo "Bumped to $$NEW and tagged v$$NEW" - -bump-minor: - @NEW=$$(echo $(CURRENT_VERSION) | awk -F. '{printf "%d.%d.0", $$1, $$2+1}'); \ - sed -i 's/version = "$(CURRENT_VERSION)"/version = "'$$NEW'"/' plugin.mod; \ - git add plugin.mod && git commit -m "chore: bump version to $$NEW" && git tag "v$$NEW"; \ - echo "Bumped to $$NEW and tagged v$$NEW" - -bump-major: - @NEW=$$(echo $(CURRENT_VERSION) | awk -F. '{printf "%d.0.0", $$1+1}'); \ - sed -i 's/version = "$(CURRENT_VERSION)"/version = "'$$NEW'"/' plugin.mod; \ - git add plugin.mod && git commit -m "chore: bump version to $$NEW" && git tag "v$$NEW"; \ - echo "Bumped to $$NEW and tagged v$$NEW" - -sync-version: - @TAG=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//'); \ - if [ -z "$$TAG" ]; then echo "No tags found"; exit 1; fi; \ - sed -i 's/version = "$(CURRENT_VERSION)"/version = "'$$TAG'"/' plugin.mod; \ - echo "Synced plugin.mod to $$TAG" + @echo " build Compile wasm + pack the .bnp" + @echo " verify Validate the built .bnp (loader-identical checks)" + @echo " archive-check Prove a clean git archive HEAD compiles to wasm" + @echo " publish Publish the .bnp to the active registry" + @echo " templ Regenerate templ Go files" + @echo " clean Remove build artefacts" diff --git a/plugin.mod b/plugin.mod index ec75a0d..06049f6 100644 --- a/plugin.mod +++ b/plugin.mod @@ -9,4 +9,4 @@ categories = ["templates"] tags = ["terminal", "hacker", "monospace", "dev", "ctf", "security", "docs", "indie"] [compatibility] -block_core = ">=0.11.0 <0.12.0" +block_core = ">=0.15.0 <0.16.0"