Skip to content

feat: interactive Ink REPL as bare zcode-acp default (ADR-0007) - #76

Merged
william0wang merged 1 commit into
mainfrom
feat/unified-cli-repl
Aug 25, 2026
Merged

feat: interactive Ink REPL as bare zcode-acp default (ADR-0007)#76
william0wang merged 1 commit into
mainfrom
feat/unified-cli-repl

Conversation

@william0wang

Copy link
Copy Markdown
Owner

Summary

Every surface of the package now lives under one command — zcode-acp — with an interactive terminal chat as the bare default (ADR-0007).

Unified CLI + bin pruning

  • Bins pruned to zcode-acp and zcode-acp-server, both symlinks to dist/cli.js; dispatch keys off basename(argv[1]), so existing editor configs keep working unchanged.
  • Subcommands: quota (was the zcode-quota bin), hub (was zcode-acp-hub), server. Old bin files stay in dist/bin/ because bridges spawn the hub by absolute path.
  • README carries the 0.11 → 0.12 migration table.

Interactive REPL (bare zcode-acp)

  • Ink UI (same renderer as Claude Code / Gemini CLI) speaking ACP to a spawned bridge over stdio.
  • Streaming output with code-fence coloring, dim thinking lines, live tool rows, arrow-key permission picker, Ctrl-C turn cancel (idle: press twice to quit).
  • FIFO prompt queue: follow-ups submitted mid-turn run after the turn ends instead of clobbering live state.
  • Bulk-paste segmentation (splitBulkInput): every CR/LF-separated line submits; nothing silently dropped.
  • Sessions persist in the ZCode backend and remain available to editors.

Hardening

  • Entry points (index.ts, bin/hub.ts, bin/quota.ts) export main() behind invokedDirectly guards that normalize Windows backslash paths.
  • Bare invocation without a TTY falls back to the stdio server — Windows npm shims spawn node …\dist\cli.js, losing the bin name from argv; explicit zcode-acp repl still hard-fails without a TTY.
  • acpx dependency dropped before release (headless-only, superseded by the in-house REPL); engines stay >=22.0.0.

Test plan

  • pnpm build / pnpm typecheck / pnpm lint green
  • 721 tests pass (52 files), including 3 new splitBulkInput tests and updated dispatcher tests
  • Real TTY smoke (expect): session ready → prompt turn → streamed reply → /exit clean exit, zero stray processes
  • No-TTY behavior: bare zcode-acp < /dev/null runs the server and exits 0 on EOF; zcode-acp repl errors with exit 2
  • stdio server answers initialize with agent info through the unified entry
  • Full cross-review report (5 findings, all fixed): .zcode/reviews/2026-08-25-unified-cli-review.md (local)

Unified CLI (ADR-0007):
- bins pruned to zcode-acp + zcode-acp-server, both resolving to dist/cli.js;
  subcommands quota/hub/server, bare invocation opens the REPL
- zcode-acp-hub and zcode-quota bins removed (files stay, spawned by path);
  README carries the 0.11 migration table
- interactive Ink REPL: streaming output, tool rows, arrow-key permission
  picker, FIFO prompt queue, bulk-paste segmentation
- entry points export main() behind cross-platform invokedDirectly guards;
  bare no-TTY invocation falls back to the stdio server (Windows shims lose
  the bin name from argv)
- acpx dependency dropped before release; engines stay >=22.0.0
@william0wang
william0wang merged commit d60d077 into main Aug 25, 2026
1 check passed
@william0wang
william0wang deleted the feat/unified-cli-repl branch August 25, 2026 12:48
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.

1 participant