Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLIPublic
Assigneeszack

Relationships

#4591 Lazy loading L1: move VERSION and GIT_SHA out of the version command

Opened by zack · 11/10/2026· Shipped 11/10/2026

Second step of the lazy command loading plan (after the startup benchmark and parity scripts, #4590).

Why

src/cli/commands/version.ts holds both the version command and the build constants that about 28 modules import. Three of those are startup modules: main.ts, repo_context.ts and load_identity.ts.

  • The next step (route table) needs the rule that startup code imports no command module. That rule cannot hold while startup imports version.ts.
  • An edit to that file selects 33 of 35 commands in affectedCommands, and so nearly the whole UAT suite.

The speed gain is small (the command adds four modules to startup); the reason is the two points above.

Scope

  • A new module below the CLI layer (for example src/infrastructure/runtime/build_info.ts) exporting VERSION and GIT_SHA.
  • version.ts re-exports nothing; it imports the constants.
  • Update every importer. src/serve/connection.ts then no longer reaches into src/cli/, so delete its pinned exception in integration/ddd_layer_rules_test.ts.
  • Update scripts/compile.ts: VERSION_FILE and both stamp regexes.
  • Update AGENTS.md's note that deno run compile stamps src/cli/commands/version.ts.

Acceptance

  • deno run compile stamps and restores the new file.
  • swamp version and swamp version --json output are unchanged.
  • A compile.ts unit test fails if either stamp regex matches nothing.
  • affectedCommands for an edit to version.ts names only version.
  • The parity script passes against a binary built from the base commit; the PR quotes benchmark numbers before and after, with workflow run as the control.

Release impact

  • Edits scripts/compile.ts, so the attestation selects every command and the release UAT runs everything.
  • The new constants file is imported widely, but only the compile stamp changes it, and that never reaches git. Afterwards, selection for version.ts edits gets more precise.
  • AGENTS.md is a trust root, so this PR triggers claude-review-integrity.

Risk: low. The compile stamp is the only moving part, and the unit test above covers it.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 8 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

11/10/2026, 6:52:59 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/10/2026, 6:02:37 PM

Sign in to post a ripple.