Skip to content

feat: add a human-facing CLI alongside the MCP server - #2

Open
warnes wants to merge 2 commits into
luohoa97:mainfrom
Warnes-Innovations:add-cli-command
Open

feat: add a human-facing CLI alongside the MCP server#2
warnes wants to merge 2 commits into
luohoa97:mainfrom
Warnes-Innovations:add-cli-command

Conversation

@warnes

@warnes warnes commented Jul 30, 2026

Copy link
Copy Markdown

Adds agent-locks status/list/check/claim/update/finish/serve — thin wrappers around the exact same lock/store.ts functions the 5 MCP tools already call. Useful for a human checking coordination state directly, or for any agent harness that can shell out but doesn't (yet) speak MCP.

index.js now dispatches on argv: no arguments (or the explicit serve alias) starts the MCP stdio server exactly as before, so every existing MCP client config keeps working unchanged. Any other first argument runs the CLI and exits with a real code instead of hanging on stdin.

No new dependency — argument parsing is hand-rolled to match this project's existing minimal footprint.

11 new tests: the full claim → status → list → check → update → finish lifecycle against a real temp git repo, every documented error path (missing required flags, both --done/--undone, bad --status, update on a nonexistent lock, non-matching task_text, running outside a git repo), and one test spawning the actual compiled dist/index.js with a CLI subcommand to prove the dispatch branch works end-to-end — complementing e2e.test.ts, which already covers the zero-argument/MCP-server branch. typecheck clean.

README gains a "CLI usage" section.

(Unrelated to this change: pnpm test on macOS shows one pre-existing failure in git.test.ts — already has a fix up in #1.)

warnes and others added 2 commits July 29, 2026 20:32
Not upstream-bound — this fork uses a worktree-per-PR workflow that the
original repo doesn't need.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds `agent-locks status/list/check/claim/update/finish/serve`, thin
wrappers around the exact same lock/store.ts functions the 5 MCP tools
already call — a human at a terminal, or any agent harness that shells
out rather than speaking MCP, gets the same coordination guarantees.

index.js now dispatches on argv: no arguments (or the explicit "serve"
alias) starts the MCP stdio server exactly as before, so every existing
MCP client config keeps working unchanged. Any other first argument runs
the CLI and exits with a real code instead of hanging on stdin.

No new dependency added — argument parsing is hand-rolled to match the
project's existing minimal footprint (only @modelcontextprotocol/sdk,
gray-matter, minimatch, zod).

11 new tests in src/__tests__/cli.test.ts: the full claim -> status ->
list -> check -> update -> finish lifecycle against a real temp git repo,
every documented error path (missing required flags, both --done and
--undone passed, bad --status value, update on a nonexistent lock id,
update with a non-matching task_text, running outside a git repo), and
one test that spawns the actual compiled dist/index.js as a real
subprocess with a CLI subcommand to prove the argv-dispatch branch works
end-to-end (complementing e2e.test.ts, which already proves the
zero-argument branch starts the MCP server). typecheck clean.

README gains a "CLI usage" section documenting all 7 subcommands.

Pre-existing note: `pnpm test` on macOS will show 1 unrelated failure in
git.test.ts (a symlink-canonicalization mismatch in resolveLocksRoot,
not touched by this change) — already has an open fix: PR #1.

Co-Authored-By: Claude Sonnet 5 <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.

1 participant