Migrate program-shaped bash tools to Go #98

Closed
opened 2026-07-11 03:15:53 +01:00 by allod-agent · 6 comments
Member

User story: So that I can trust larger workspace tools without spending review time on shell edge cases, the program-shaped Bash CLIs should migrate to small Go programs while preserving their command contracts.

Part of the "Forge / workspace CLI tooling" arc.


The allod bash inventory has grown to roughly 10,600 lines of production bash plus 9,600 lines of bash tests across tools and nexus. The largest tools are no longer pipeline glue but full programs written in bash: forge (2,505 lines, a Forgejo REST client), allod (1,235 lines, change workflow plus a patch transfer protocol with manifest integrity checking), flake-update-cascade (486 lines, a three-mode mutation state machine), and flake-status (490 lines, parallel data aggregation through tempfile IPC). Git history shows the recurring bash tax on these: quoting and injection fixes, glob safety fixes, and review cycles spent on argument marshalling rather than behavior.

This issue tracks migrating the program-shaped tools in allod/tools to Go (standard library only, no third-party modules), while keeping pipeline-shaped tools in bash: pull-all, work-diff, setup-tracked-hooks, lib/workspace.sh, protected-refs-policy, and all nexus provisioning and vm/profiles glue scripts stay bash. The nexus rotation suite (rotate-token and key rotation scripts) is explicitly deferred until the Go pattern has proven itself on dev-VM tools.

Migration order: Phase 0 toolchain and scaffolding, Phase 1 forge, Phase 2 allod, Phase 3 flake tools, Phase 4 cleanup. CLI names, flags, exit codes, and output contracts are preserved; each cutover is a profiles/nexus wrapper switch with the bash source retained in-tree for rollback until Phase 4.

Dev plan: allod/strategy dev-plans/bash-to-go-migration.md (PR to follow).

Implementation PRs should use Refs allod/tools#<this> until the final Phase 4 cleanup PR in allod/tools, which carries the closing keyword.

**User story:** So that I can trust larger workspace tools without spending review time on shell edge cases, the program-shaped Bash CLIs should migrate to small Go programs while preserving their command contracts. _Part of the "Forge / workspace CLI tooling" arc._ --- The allod bash inventory has grown to roughly 10,600 lines of production bash plus 9,600 lines of bash tests across `tools` and `nexus`. The largest tools are no longer pipeline glue but full programs written in bash: `forge` (2,505 lines, a Forgejo REST client), `allod` (1,235 lines, change workflow plus a patch transfer protocol with manifest integrity checking), `flake-update-cascade` (486 lines, a three-mode mutation state machine), and `flake-status` (490 lines, parallel data aggregation through tempfile IPC). Git history shows the recurring bash tax on these: quoting and injection fixes, glob safety fixes, and review cycles spent on argument marshalling rather than behavior. This issue tracks migrating the program-shaped tools in `allod/tools` to Go (standard library only, no third-party modules), while keeping pipeline-shaped tools in bash: `pull-all`, `work-diff`, `setup-tracked-hooks`, `lib/workspace.sh`, `protected-refs-policy`, and all `nexus` provisioning and `vm`/`profiles` glue scripts stay bash. The nexus rotation suite (`rotate-token` and key rotation scripts) is explicitly deferred until the Go pattern has proven itself on dev-VM tools. Migration order: Phase 0 toolchain and scaffolding, Phase 1 `forge`, Phase 2 `allod`, Phase 3 flake tools, Phase 4 cleanup. CLI names, flags, exit codes, and output contracts are preserved; each cutover is a `profiles`/`nexus` wrapper switch with the bash source retained in-tree for rollback until Phase 4. Dev plan: `allod/strategy` `dev-plans/bash-to-go-migration.md` (PR to follow). Implementation PRs should use `Refs allod/tools#<this>` until the final Phase 4 cleanup PR in `allod/tools`, which carries the closing keyword.
Contributor

#142 adds a carve-off this issue predates: the pr-explain report validator (~2,400 lines of parse-shaped bash in pr-explain/lib.sh, the largest single program in the repo). Same boundary as here — the validator ports, the orchestration cage in pr-explain/explain stays bash. Sequenced after the #141 redesign slices land; independent of Phase 1 (forge).

#142 adds a carve-off this issue predates: the pr-explain report validator (~2,400 lines of parse-shaped bash in pr-explain/lib.sh, the largest single program in the repo). Same boundary as here — the validator ports, the orchestration cage in pr-explain/explain stays bash. Sequenced after the #141 redesign slices land; independent of Phase 1 (forge).
Author
Member

Phase 1 (forge) is code-complete but not deployed, and it has drifted: allod/tools#155 records the remaining work and now owns it. The drift is the load-bearing part — forge pr snapshot landed in bash after the Go port merged (commits 0e768fb, 44d9347, 9e4b157, plus a 126-line tests/forge/snapshot.sh) and was never mirrored, so merging the open cutover pull requests as they stand would remove that command from every dev VM and break allod pr explain, which consumes snapshots. This is the failure mode this issue's own sequencing rule was written to prevent.

Phase 1 (`forge`) is code-complete but not deployed, and it has drifted: allod/tools#155 records the remaining work and now owns it. The drift is the load-bearing part — `forge pr snapshot` landed in bash after the Go port merged (commits 0e768fb, 44d9347, 9e4b157, plus a 126-line `tests/forge/snapshot.sh`) and was never mirrored, so merging the open cutover pull requests as they stand would remove that command from every dev VM and break `allod pr explain`, which consumes snapshots. This is the failure mode this issue's own sequencing rule was written to prevent.
Author
Member

Phase 1 is complete. PR #156 added the missing pr snapshot contract to Go; the Go package was then deployed and verified on both allod-dev and nexus; and PR #157 retired the Bash implementation and duplicate shell suite. Both machines run the same versioned package and passed authentication, repository-inference, and live snapshot witnesses.

The umbrella remains open: Phase 2 (allod), Phase 3 (the flake tools), the pr-explain validator carve-off in #142, and later migration cleanup are still outstanding. The prior status comment saying Phase 1 was not deployed is now superseded.

Phase 1 is complete. PR #156 added the missing `pr snapshot` contract to Go; the Go package was then deployed and verified on both `allod-dev` and `nexus`; and PR #157 retired the Bash implementation and duplicate shell suite. Both machines run the same versioned package and passed authentication, repository-inference, and live snapshot witnesses. The umbrella remains open: Phase 2 (`allod`), Phase 3 (the flake tools), the `pr-explain` validator carve-off in #142, and later migration cleanup are still outstanding. The prior status comment saying Phase 1 was not deployed is now superseded.
Contributor

The allod/forge track of this umbrella is complete. Phase 4 (allod cleanup) landed on master as allod/tools@8c5188b: the root Bash allod oracle is deleted, the change/patch and pr-explain test defaults resolve the Go binary, and no deploy path references the bash source. go vet/go test, gofmt, nix flake check, and the Go-targeted parity plus the workspace and git-hooks bash suites all pass. pr-explain, pm, and lib/workspace.sh remain bash by design.

Still untracked if pursued later: Phase 3 (flake-status / flake-update-cascade) and the pr-explain validator carve-off (#142); each would need its own issue.

The allod/forge track of this umbrella is complete. Phase 4 (allod cleanup) landed on master as allod/tools@8c5188b: the root Bash allod oracle is deleted, the change/patch and pr-explain test defaults resolve the Go binary, and no deploy path references the bash source. go vet/go test, gofmt, nix flake check, and the Go-targeted parity plus the workspace and git-hooks bash suites all pass. pr-explain, pm, and lib/workspace.sh remain bash by design. Still untracked if pursued later: Phase 3 (flake-status / flake-update-cascade) and the pr-explain validator carve-off (#142); each would need its own issue.
Contributor

allod/forge track complete; see prior status. Phase 3 flake tools + #142 remain untracked in this issue.

allod/forge track complete; see prior status. Phase 3 flake tools + #142 remain untracked in this issue.
Owner

forge and allod migrations were completed. the remaining scope was split out into allod/tools#158, allod/tools#159, and allod/tools#142

`forge` and `allod` migrations were completed. the remaining scope was split out into allod/tools#158, allod/tools#159, and allod/tools#142
vnprc closed this issue 2026-08-26 03:08:26 +01:00
Sign in to join this conversation.
No description provided.