Skip to content

refactor(mcp): derive version literals instead of hand-syncing them - #4161

Merged
JSONbored merged 1 commit into
mainfrom
refactor/mcp-derive-version-literals
Jul 8, 2026
Merged

refactor(mcp): derive version literals instead of hand-syncing them#4161
JSONbored merged 1 commit into
mainfrom
refactor/mcp-derive-version-literals

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

packages/gittensory-mcp/bin/gittensory-mcp.js's packageVersion/packageName and src/services/mcp-compatibility.ts's LATEST_RECOMMENDED_MCP_VERSION were independently hardcoded literals that had to be bumped by hand every release (the exact bug #751 fixed last cycle by re-bumping the literal, not by removing it). Both now derive from packages/gittensory-mcp/package.json directly:

  • the bin script reads its own package.json at runtime (always present in any install — npm ships it regardless of the files allowlist)
  • mcp-compatibility.ts imports it the same way src/server.ts:14 already imports the root package.json

Two of the three hand-synced version-pin sites from today's release are now impossible to forget, by construction.

Also makes the version-pinned test assertions in mcp-cli-basics.test.ts, mcp-cli-profiles.test.ts, mcp-cli-doctor.test.ts, and mcp-compatibility.test.ts derive from the real package.json/constants instead of hardcoded literals — required for future release-please-automated version bumps to pass CI without a human editing these files every time.

Test plan

  • npm run typecheck — clean
  • npx vitest run test/unit/mcp-cli-basics.test.ts test/unit/mcp-cli-profiles.test.ts test/unit/mcp-cli-doctor.test.ts test/unit/mcp-compatibility.test.ts test/integration/api.test.ts — 95 tests pass
  • Verified genuinely self-updating: temporarily bumped the local package version (twice, to unrelated values) and confirmed all 95 tests still pass with zero test-file edits. That stress test also caught a real pre-existing fragility — mcp-cli-doctor.test.ts hardcoded latestVersion: "1.0.0" as "clearly above local," which silently breaks once the package naturally reaches 1.0.0 — fixed the same way.

packages/gittensory-mcp/bin/gittensory-mcp.js's packageVersion/packageName
and src/services/mcp-compatibility.ts's LATEST_RECOMMENDED_MCP_VERSION were
independently hardcoded literals that had to be bumped by hand every
release (the exact bug #751 fixed last cycle by re-bumping the literal,
not by removing it). Both now derive from packages/gittensory-mcp/package.json
directly -- the bin script reads its own package.json at runtime (always
present in any install, npm ships it regardless of the "files" allowlist),
and mcp-compatibility.ts imports it the same way src/server.ts:14 already
imports the root package.json. Two of the three hand-synced version-pin
sites from today's release are now impossible to forget, by construction.

Also makes the version-pinned test assertions in mcp-cli-basics.test.ts,
mcp-cli-profiles.test.ts, mcp-cli-doctor.test.ts, and mcp-compatibility.test.ts
derive from the real package.json/constants instead of hardcoded literals --
required for future release-please-automated version bumps to pass CI
without a human editing these files every time. Verified genuinely
self-updating by temporarily bumping the local package version and
confirming all 95 tests still pass unmodified; that stress test also
caught a real pre-existing fragility (mcp-cli-doctor.test.ts hardcoded
latestVersion: "1.0.0" as "clearly above local", which silently breaks
once the package naturally reaches 1.0.0) and fixed it the same way.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 3402cd5 Commit Preview URL

Branch Preview URL
Jul 08 2026, 08:44 AM

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb

loopover-orb Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 Gittensory is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing

@JSONbored
JSONbored merged commit ab95b4c into main Jul 8, 2026
10 checks passed
@JSONbored
JSONbored deleted the refactor/mcp-derive-version-literals branch July 8, 2026 08:49
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.73%. Comparing base (08b4495) to head (3402cd5).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4161   +/-   ##
=======================================
  Coverage   93.73%   93.73%           
=======================================
  Files         387      387           
  Lines       36304    36304           
  Branches    13298    13298           
=======================================
  Hits        34031    34031           
  Misses       1617     1617           
  Partials      656      656           
Files with missing lines Coverage Δ
src/services/mcp-compatibility.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Development

Successfully merging this pull request may close these issues.

1 participant