feat: add a human-facing CLI alongside the MCP server - #2
Open
warnes wants to merge 2 commits into
Open
Conversation
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>
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
agent-locks status/list/check/claim/update/finish/serve— thin wrappers around the exact samelock/store.tsfunctions 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.jsnow dispatches onargv: no arguments (or the explicitservealias) 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 → finishlifecycle against a real temp git repo, every documented error path (missing required flags, both--done/--undone, bad--status, update on a nonexistent lock, non-matchingtask_text, running outside a git repo), and one test spawning the actual compileddist/index.jswith a CLI subcommand to prove the dispatch branch works end-to-end — complementinge2e.test.ts, which already covers the zero-argument/MCP-server branch. typecheck clean.README gains a "CLI usage" section.
(Unrelated to this change:
pnpm teston macOS shows one pre-existing failure ingit.test.ts— already has a fix up in #1.)