Skip to content

feat(mcp): add version command and clearer unknown-command guidance - #333

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
glorydavid03023:feat/mcp-version-command
Jun 4, 2026
Merged

feat(mcp): add version command and clearer unknown-command guidance#333
JSONbored merged 3 commits into
JSONbored:mainfrom
glorydavid03023:feat/mcp-version-command

Conversation

@glorydavid03023

Copy link
Copy Markdown
Contributor

Summary

The gittensory-mcp CLI defines a packageVersion constant but exposes no way to query it — the conventional --version flag 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 version command with --version and -v aliases:

$ gittensory-mcp version
@jsonbored/gittensory-mcp/0.4.0 (node v22.x.x)

$ gittensory-mcp version --json
{
  "name": "@jsonbored/gittensory-mcp",
  "version": "0.4.0",
  "apiVersion": "0.1.0",
  "node": "v22.x.x"
}

It reports the installed package version, the targeted API version, and the Node.js runtime — useful context for diagnostics and issue reports. The --json form keeps output parseable for tooling.

As a tightly-related ergonomics touch, the unknown-command error now points at gittensory-mcp --help so 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.jsversion/--version/-v dispatch in runCli, new printVersion(), help-text usage line, and the improved unknown-command message.
  • test/unit/mcp-cli.test.ts — cover all three aliases (plain output), the --json payload 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 --json payload is additive.

Validation

Intended gate (CONTRIBUTING required checks):

npm run build:mcp
npm run test:mcp-pack
npm run typecheck
npm run test:coverage
npm run test:ci

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 version output contains only static package/API/runtime version strings — no tokens, paths, wallet/hotkey, or scoring context.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glorydavid03023 this is a good small CLI ergonomics improvement, but it needs validation evidence.

A few notes:

  • version, --version, and -v are 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:mcp
  • npm run test:mcp-pack
  • npm run typecheck
  • Focused test/unit/mcp-cli.test.ts

glorydavid03023 and others added 2 commits June 3, 2026 20:27
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>
@glorydavid03023
glorydavid03023 force-pushed the feat/mcp-version-command branch from 1dd68f4 to 184a464 Compare June 4, 2026 01:29
@dosubot dosubot Bot added size:S and removed size:XS labels Jun 4, 2026
@glorydavid03023

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I've addressed both points and rebased onto the latest main.

README alignment

The plain version output now includes the targeted API version, so it matches the README's description (package version + API version + Node runtime). Actual output:

$ gittensory-mcp version
@jsonbored/gittensory-mcp/0.4.0 (api 0.1.0, node v20.18.1)

$ gittensory-mcp version --json
{
  "name": "@jsonbored/gittensory-mcp",
  "version": "0.4.0",
  "apiVersion": "0.1.0",
  "node": "v20.18.1"
}

$ gittensory-mcp -v
@jsonbored/gittensory-mcp/0.4.0 (api 0.1.0, node v20.18.1)

$ gittensory-mcp bogus
Error: Unknown command: bogus. Run `gittensory-mcp --help` to list commands.

The README now shows these literal examples, and the test asserts the plain form reports all three fields.

Completed validation

Run locally from the repo root (environment note: a portable Node v20.18.1; CI runs Node 22):

  • npm run build:mcppass (exit 0)
  • npm run typecheck (tsc --noEmit, against the rebased main) → pass (exit 0)
  • Focused test/unit/mcp-cli.test.ts → my three new cases pass:
    • reports the package version via version, --version, and -v
    • emits machine-readable version output with --json
    • guides unknown commands to --help

Two honest caveats about my local box (neither related to this change):

  • npm run test:mcp-pack could not run locally because scripts/check-mcp-package.mjs calls spawnSync("npm", …), which can't resolve npm.cmd on Windows without a shell (ERR_STREAM_NULL_VALUES). This passed on CI (Linux/Node 22) on the previous push and the script is untouched by this PR.
  • In a full mcp-cli.test.ts run, one pre-existing test (rejects unsafe server-provided packet markdown before non-json output, which does git init + subprocess work) timed out at the 10s limit under the slow portable Node. It is unrelated to the version command; my three cases pass in isolation and the file otherwise passes.

CI on this push should give the authoritative full-gate result on Node 22. Happy to adjust anything further.

@JSONbored
JSONbored self-requested a review June 4, 2026 06:35
@dosubot dosubot Bot added the lgtm label Jun 4, 2026
@JSONbored
JSONbored merged commit a580e2b into JSONbored:main Jun 4, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 4, 2026
@github-actions github-actions Bot mentioned this pull request Jun 4, 2026
12 tasks
@JSONbored JSONbored added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. and removed feature labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants