Skip to content

B1: generalize amico-run into the amico CLI (verb router) - #118

Merged
Rchari1 merged 1 commit into
mainfrom
b1-amico-cli-router
Jul 14, 2026
Merged

B1: generalize amico-run into the amico CLI (verb router)#118
Rchari1 merged 1 commit into
mainfrom
b1-amico-cli-router

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

What this does

Introduces the amico verb-router surface generalizing amico-run — the foundation slice of the depth-1 tool-spine (issue #108, spec-20260708-112732 §7.3, plan-20260708-214610 slice B1). Non-destructive: no package rename, no removed behavior, no bookkeeping migrated.

The seam

  • src/launch.ts — the amico-run launch body, extracted verbatim from cli.ts (mainlaunch, self-invocation removed). cli.ts is now a thin amico-run bin wrapper importing it. This is the single delegation point: both the amico-run bin and the new amico run verb call the SAME launch path, so there is no behavior fork and the existing amico-run suite still exercises the real bodies.
  • src/amico.ts — the verb router (new amico bin).
    • run / resolve / sandbox delegate verbatim: amico <verb> <args>amico-run <equivalent-args>.
    • amico --help lists the full verb surface; unknown verb → exit 64; bare amico → usage + exit 64.
  • src/verbs.ts — the shared-spine bookkeeping verbs (catalog, vault, device, note) as clearly-marked B1 stubs: each prints its intent, the real module it will generalize, and the slice that lands the body, then exits 0. No bookkeeping logic migrated — that is B2/B3/B5.
  • src/mcp_serve.ts — the optional MCP facade over the same verbs. Stub seam only: --list renders the verb↔tool mapping; the transport carries zero MCP SDK dependency, keeping it inside the test/s31.test.ts "no MCP in the orchestrator" guard. Landing the real transport will require an explicit, reviewed S31 amendment — exactly as spec C amended the S31 SolveSpec ban to name amico-run the launch gate.
  • Build/packaging: esbuild.config.mjs now emits both dist/amico-run.js and dist/amico.js; package.json adds the amico bin; launcher/amico mirrors launcher/amico-run.

Tests

test/amico.test.ts (14 new tests) covers the router seam: --help surface, unknown-verb → 64, verbatim run/resolve/sandbox delegation (reusing the existing fixtures), the four stub verbs, and the mcp-serve facade (--list + no-flag).

Test Files  17 passed (17)
     Tests  120 passed (120)     # 106 pre-existing + 14 new router tests

Full suite green; tsc --noEmit clean. (Julia-gated test/slow/** not run — needs AMICO_TEST_JULIA_PROJECT per AGENTS.md.)

Acceptance criteria (#108)

  • amico <verb> dispatch routes run/resolve/sandbox verbatim to existing amico-run behavior
  • spine-verb + mcp-serve seams present (stubs this slice)
  • existing amico-run test suite stays green

Notes for review

  • Stands on the depth-1 spec gate decisions just recorded on B0 (decision, Jack): ratify depth-1 redesign gates G-1/G-8/G-9 #107 (B0 ratification, G-9).
  • The fork's CI may be RED due to the pre-existing private-fork vendored-binary token issue (CI can't fetch the vendored opencode binary from the private fork). That is unrelated to this change — it touches only packages/amico-run (bun/pnpm TS), no opencode/vendor surface.

🤖 Generated with Claude Code

Introduce the `amico` verb-router surface over the existing amico-run
launch path, non-destructively. No package rename, no removed behavior.

- Extract the launch body of cli.ts verbatim into src/launch.ts
  (`main` → `launch`); cli.ts becomes a thin `amico-run` bin wrapper. This
  lets BOTH the `amico-run` bin and the new `amico run` verb call the SAME
  launch path with no behavior fork.
- Add src/amico.ts — the verb router. `run`/`resolve`/`sandbox` delegate
  verbatim to launch (`amico <verb> <args>` ≡ `amico-run <equiv-args>`).
  `--help` lists the full verb surface; unknown verb → exit 64.
- Add src/verbs.ts — spine bookkeeping verbs (catalog/vault/device/note) as
  B1 STUBS: print intent + the module/slice each will generalize, exit 0.
  Real bodies are B2/B3/B5.
- Add src/mcp_serve.ts — the optional MCP facade over the same verbs. STUB
  seam only: `--list` renders the verb↔tool mapping; the transport carries
  ZERO MCP SDK dependency so it stays within the S31 no-MCP guard (landing
  the real transport needs an explicit S31 amendment, as spec C did).
- esbuild builds both dist/amico-run.js and dist/amico.js; package.json adds
  the `amico` bin; launcher/amico mirrors launcher/amico-run.
- test/amico.test.ts covers router dispatch: --help surface, unknown-verb
  →64, verbatim run/resolve/sandbox delegation, stub verbs, mcp-serve facade.

All existing amico-run tests stay green (106 → 120 with the 14 new router
tests). Spec-20260708-112732 §7.3; plan-20260708-214610 slice B1.

Closes #108

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants