Reviewed-on: #21 Co-authored-by: vickydotbat <vickydotbat@tutamail.com> Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
12 KiB
Crucible Command Surface Cleanup Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use
superpowers:subagent-driven-developmentorsuperpowers:executing-plansto implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.
Goal: Replace repetitive Crucible command names with a descriptive,
registry-driven public surface, retain long names as hidden aliases, and remove
the unused music conversion pipeline without affecting authored .bmu assets.
Architecture: internal/dispatch.Registry gains explicit command records
that drive lookup, help, and the interactive menu while translating to unchanged
internal/app implementation names. The unused music subsystem is removed
through its app, pipeline, project-config, validator, packaging, and consumer
boundaries. The two active sow-assets-manifest call sites are decoupled in the
same worktree session.
Tech Stack: Go 1.26, Go tests, Nix flakes, Dockerfile, Bash/Bats.
Global Constraints
- Never commit or push.
- Do not touch secrets or
.sopsdata. - Keep
internal/dispatch.Registrysynchronized withdocs/command-surface.md. - Preserve deterministic artifact behavior.
- Preserve every existing long command as a hidden alias except all music commands, which are removed.
- Preserve
.bmuas an ordinary HAK asset. - Do not retain generated binaries or build output.
Task 1: Registry-driven canonical commands and hidden aliases
Files:
- Modify:
internal/dispatch/dispatch.go - Modify:
internal/dispatch/dispatch_test.go
Interfaces:
-
Produces a
Commandrecord owned by eachBuilder. -
Produces lookup that returns the command record and exact app target.
-
Preserves
Builder.Legacyonly if required by migration tests; otherwise replaces it with command-derived compatibility metadata. -
Add failing tests covering the visible command table:
hak build/manifest,module build/extract/validate/compare/manifest,topdata validate/build/package/compare/convert, andwiki build/deploy. -
Add failing tests proving long aliases resolve to the same app target and that
module build-moduleresolves tobuild-module, notbuild. -
Add a failing test proving all music commands are rejected.
-
Run:
nix develop --command go test ./internal/dispatch -run 'TestCanonical|TestHidden|TestMusic' -vExpected: failures caused by the old registry shape and exposed music commands.
-
Introduce command records with fields equivalent to:
type Command struct { Name string Summary string AppCommand string Usage string Options []string HiddenAlias []string }Use the minimum final field names that keep lookup, menu, and help readable.
-
Replace builder-level subcommand acceptance with command lookup. Translate canonical and hidden aliases to
AppCommandbefore callingapp.Run. -
Define the approved command table and remove dispatcher music entries.
-
Re-run the focused dispatch tests and the full dispatch package:
nix develop --command go test ./internal/dispatch -vExpected: pass.
Task 2: Descriptive menu and command-specific help
Files:
- Modify:
internal/menu/menu.go - Modify:
internal/menu/menu_test.go - Modify:
internal/dispatch/dispatch.go - Modify:
internal/dispatch/dispatch_test.go
Interfaces:
-
menu.Itemcarries display label, summary, dispatcher args, usage, and option lines. -
menu.Selectreturns selected dispatcher args plus entered arguments. -
Dispatcher command help uses the same registry guidance as the menu.
-
Add failing menu tests proving descriptions start at one aligned column for labels of different lengths and hidden aliases never enter
menuItems(). -
Add a failing test selecting a command and asserting output contains its usage, option guidance, and
arguments (press Enter to use defaults):. -
Add failing dispatcher tests proving
crucible topdata build --helpreturns0, prints canonical usage/options, and does not delegate into project loading. -
Run:
nix develop --command go test ./internal/menu ./internal/dispatch -run 'Test.*Menu|Test.*Help' -vExpected: fail against the current fixed-width menu and builder-only help.
-
Compute menu label width from visible items and render descriptions with that width.
-
Print command guidance immediately after a selection and before reading optional arguments.
-
Add command-level help handling before app delegation.
-
Ensure builder help lists only canonical names and their summaries.
-
Run:
nix develop --command go test ./internal/menu ./internal/dispatch -vExpected: pass.
Task 3: Remove music from HAK app and pipeline
Files:
- Delete:
internal/pipeline/music.go - Modify:
internal/pipeline/build.go - Modify:
internal/pipeline/pipeline_test.go - Modify:
internal/app/app.go - Modify:
internal/app/app_test.go - Delete:
internal/music/config.go - Delete:
internal/music/credits.go - Delete:
internal/music/metadata.go - Delete:
internal/music/music.go - Delete:
internal/music/music_test.go - Delete:
internal/music/naming.go
Interfaces:
-
pipeline.BuildHAKOptionsretains only HAK selection, source-manifest, content-addressed-root, and progress controls. -
pipeline.BuildResultretains artifact fields unrelated to generated music credits. -
build-haksaccepts no music-specific flags. -
Replace music pipeline tests with a failing contract test that builds a HAK containing a pre-authored
.bmuand proves the file appears in the manifest/archive without conversion setup. -
Add failing parser tests proving
--skip-musicand--music-datasetreturn unknown-argument errors and help does not mention them. -
Run:
nix develop --command go test ./internal/app ./internal/pipeline -run 'Test.*Music|Test.*BMU|TestParseBuildHAK' -vExpected: at least the removed-flag assertions fail.
-
Remove the app
musiccommand, argument parser, emitters, music HAK options, and credits console output. -
Remove music fields from
BuildHAKOptionsandBuildResult. -
Remove preparation/cleanup calls from HAK builds so asset collection reads authored resources directly.
-
Delete the music implementation packages and obsolete conversion tests.
-
Keep
.bmuhandling in ordinary ERF/resource and asset collection paths. -
Run:
nix develop --command go test ./internal/app ./internal/pipeline -vExpected: pass.
Task 4: Remove music configuration and validation
Files:
- Modify:
internal/project/project.go - Modify:
internal/project/effective.go - Modify:
internal/project/project_test.go - Modify:
internal/validator/validator.go - Modify:
internal/validator/validator_test.go
Interfaces:
-
project.Configandproject.EffectiveConfigcontain no music section. -
Project scanning uses only configured inventory extensions.
-
.bmuand.wavremain default asset extensions;.mp3and.oggdo not. -
Add or adjust failing project tests asserting default extensions include
.bmuand.wavbut exclude.mp3and.ogg. -
Add a failing strict-decoder test proving a top-level
music:field is rejected as unknown. -
Run:
nix develop --command go test ./internal/project ./internal/validator -run 'Test.*Music|Test.*AssetExtension|Test.*BMU' -vExpected: fail while music config is still accepted.
-
Remove music config types, defaults, normalization, validation, accessors, effective config, provenance defaults, and environment overrides.
-
Simplify
Project.Scanto accept assets solely fromeffective.Inventory.AssetExtensions. -
Remove validator logic that exempts conversion source files.
-
Remove conversion-only
.mp3and.oggfrom default asset extensions; retain.bmuand.wav. -
Remove obsolete music-focused project and validator tests.
-
Run:
nix develop --command go test ./internal/project ./internal/validator -vExpected: pass.
Task 5: Remove ffmpeg packaging and stale documentation
Files:
- Modify:
flake.nix - Modify:
docker/Dockerfile - Modify:
wrappers/crucible.sh - Modify:
README.md - Modify:
AGENTS.md - Modify:
docs/command-surface.md - Modify:
docs/migration-from-nwn-tool.md
Interfaces:
-
Nix development shell and image no longer contain ffmpeg.
-
Docker runtime contains only certificates and the non-root runtime support needed by current builders.
-
User docs advertise canonical short commands.
-
Add a shell verification that fails while active packaging still mentions ffmpeg or removed command names:
! rg -n 'ffmpeg|ffprobe|skip-music|music-dataset|module music|hak music' \ flake.nix docker wrappers README.md AGENTS.md docs/command-surface.md -
Remove
pkgs.ffmpeg-headlessandffmpegfrom Nix image/dev-shell contents and update comments. -
Return the Docker runtime to a minimal base without ffmpeg while retaining CA certificates and non-root execution.
-
Remove the wrapper's
ffmpeg-freewording. -
Rewrite command-surface documentation around canonical names and a concise hidden-alias compatibility section.
-
Update README examples and ownership/status prose.
-
Re-run the search. Expected: no matches in active files.
Task 6: Decouple active consumer scripts
Files in ../sow-assets-manifest:
- Modify:
scripts/pack-haks.sh - Modify:
scripts/build-local-haks.sh - Modify:
tests/pack-haks.bats - Modify only directly related active comments/tests if a focused test proves they require adjustment.
Interfaces:
-
Both scripts call the hidden-compatible
hak build-haksor canonicalhak buildwithout--skip-music. -
Read
../sow-assets-manifest/AGENTS.mdbefore editing. -
Add or adjust a focused test to reject
--skip-musicin generated Crucible invocations. -
Run the focused test and confirm it fails while the flag is present.
-
Remove
--skip-musicand its lockstep comments from both scripts. -
Update the HAK parser test invocation to omit the removed flag.
-
Run:
cd ../sow-assets-manifest nix develop --command bats tests/pack-haks.batsExpected: pass.
Task 7: Full verification and scratchpad cleanup
Files:
-
Modify:
../SCRATCHPAD.md -
Do not retain:
bin/,.cache/go-build/, result symlinks, image tarballs, or other generated outputs. -
Run formatting:
nix develop --command gofmt -w internal/app internal/dispatch internal/menu internal/pipeline internal/project internal/validator -
Run full repository checks:
nix develop --command make check make build make smoke -
Run focused consumer verification from Task 6.
-
Verify deleted pipeline identifiers are absent from active code:
rg -n 'BuildMusic|CreditsSummary|MusicDataset|skip-music|music-dataset|ffmpeg|ffprobe' \ --glob '!docs/superpowers/**' .Expected: no matches.
-
Verify active command docs/examples do not advertise long names:
rg -n 'topdata (validate-topdata|build-topdata|build-top-package|compare-topdata|convert-topdata)|wiki (build-wiki|deploy-wiki)|hak (build-haks|apply-hak-manifest)' \ README.md docs/command-surface.mdExpected: matches only inside the explicitly labeled hidden-alias compatibility section.
-
Inspect
git diff --check,git status --short, and both repository diffs. Remove only generated files created by this work. -
Remove the completed “Simplify crucible commands” to-do and the full “Crucible commands issue” section from
../SCRATCHPAD.md; do not archive it. -
Record exact verification commands and outcomes in the final handoff.