feat(mcp): add version command and clearer unknown-command guidance - #333
Conversation
JSONbored
left a comment
There was a problem hiding this comment.
@glorydavid03023 this is a good small CLI ergonomics improvement, but it needs validation evidence.
A few notes:
version,--version, and-vare conventional and useful.- The JSON output is appropriately parseable.
- The blocker is that the body lists intended validation rather than completed validation.
Required changes:
- Run the relevant MCP gate locally or clearly state the exact blocker for skipped checks.
- Keep README examples aligned with actual output.
Validation expected:
npm run build:mcpnpm run test:mcp-packnpm run typecheck- Focused
test/unit/mcp-cli.test.ts
Add a `version` command (with `--version` and `-v` aliases) to the gittensory-mcp CLI. It prints the installed package version, the targeted API version, and the Node.js runtime version, with a `--json` form for tooling and bug reports. Previously the version constant existed in the binary but had no command surface — the conventional `--version` flag was missing. Also point the unknown-command error at `gittensory-mcp --help` so a mistyped command guides the user to the command list instead of a bare "Unknown command" message. Tests cover the plain output for all three aliases, the machine-readable `--json` payload, and the unknown-command guidance. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address review feedback on JSONbored#333: - Include the targeted API version in the plain `version` output so it matches the README description (package version, API version, Node runtime). Output is now `name/version (api X, node vY)`. - Add concrete plain and --json output examples to the README. - Strengthen the test to assert the plain form reports all three fields. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1dd68f4 to
184a464
Compare
|
Thanks for the review. I've addressed both points and rebased onto the latest README alignmentThe plain The README now shows these literal examples, and the test asserts the plain form reports all three fields. Completed validationRun locally from the repo root (environment note: a portable Node v20.18.1; CI runs Node 22):
Two honest caveats about my local box (neither related to this change):
CI on this push should give the authoritative full-gate result on Node 22. Happy to adjust anything further. |
Summary
The
gittensory-mcpCLI defines apackageVersionconstant but exposes no way to query it — the conventional--versionflag was missing, so users and tooling had no quick way to confirm which CLI build is installed (e.g. for bug reports).This adds a
versioncommand with--versionand-valiases:It reports the installed package version, the targeted API version, and the Node.js runtime — useful context for diagnostics and issue reports. The
--jsonform keeps output parseable for tooling.As a tightly-related ergonomics touch, the unknown-command error now points at
gittensory-mcp --helpso a mistyped command guides the user to the command list.Why no linked issue
Low-risk, additive CLI ergonomics only. No public-behavior, auth/session, schema, deploy, or frontend-architecture change, so per CONTRIBUTING this does not require an issue first. Happy to file one if maintainers prefer.
Changes
packages/gittensory-mcp/bin/gittensory-mcp.js—version/--version/-vdispatch inrunCli, newprintVersion(), help-text usage line, and the improved unknown-command message.test/unit/mcp-cli.test.ts— cover all three aliases (plain output), the--jsonpayload shape, and the unknown-command guidance.packages/gittensory-mcp/README.md— document the new command and aliases.Contract notes
No MCP tool or HTTP/OpenAPI contract changes. This only adds a local CLI command surface; stable JSON output is preserved and the new
--jsonpayload is additive.Validation
Intended gate (CONTRIBUTING required checks):
Transparency note: my local authoring environment had no Node runtime available, so I could not execute the gate locally before opening this PR. The change was prepared against the existing CLI dispatch/test patterns and is intended to be validated by CI on this PR (and I will run the full gate locally as well). If any check needs adjustment I'll follow up promptly.
Security / privacy
No auth, cookie, CORS, GitHub App output, identity, or contributor-evidence changes. The
versionoutput contains only static package/API/runtime version strings — no tokens, paths, wallet/hotkey, or scoring context.