feat(version): keep every version field in sync with package.json - #174
Conversation
package.json was the only version that moved. The plugin manifests fell three minors behind and the MCP handshake fell further still, which #173 corrected by hand — this stops it recurring. - scripts/sync-version.ts rewrites drifted manifest fields, or reports them and exits 1 under --check. - CI runs --check, so drift cannot land. - The npm `version` lifecycle runs the fixer and git-adds .claude-plugin, so a bump updates the manifests in the same commit. - server/index.ts imports pkg.version instead of a literal, which is better than syncing it — a test asserts no hardcoded semver returns to that call. Design and the original implementation are from #110 by @grlee. That PR now conflicts with main and lives on a fork, so it could not be rebased; this reimplements it and #110 should be closed in its favour. Verified both directions: injecting 0.1.0 into plugin.json makes --check exit 1 with an exact report, and the fixer restores the file byte-identically. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2GXsqpMvUhxBSNabSqZdk
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR makes package.json the single source of truth for the project version and prevents drift across the Claude plugin manifests and the MCP server’s advertised handshake version by adding an automated sync/check workflow.
Changes:
- Added
scripts/sync-version.tsto detect and fix version-field drift across.claude-plugin/*, with a--checkmode for CI. - Updated MCP server handshake to read
versionfrompackage.jsoninstead of a hardcoded literal, and added tests to prevent regressions. - Wired the version sync into both CI and the npm
versionlifecycle so version bumps update related manifests in the same commit.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
server/index.ts |
Imports pkg.version and uses it in the MCP server handshake instead of a literal. |
scripts/sync-version.ts |
New script to detect and optionally rewrite drifted manifest version fields based on package.json. |
scripts/sync-version.test.ts |
Adds tests asserting versions are in sync and preventing reintroduction of a hardcoded handshake semver. |
package.json |
Adds sync-version script and hooks it into the version lifecycle to auto-stage manifest updates. |
.github/workflows/ci.yml |
Adds a CI guard that runs sync-version --check to block version drift from landing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ffd32d290
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…urce assertion Review round 1 (Copilot, Devin): - tsconfig `include` did not cover scripts/, so sync-version.ts was never typechecked despite CI now running it. Added scripts/**/*.ts, and set resolveJsonModule explicitly since server/index.ts now imports package.json. Verified with --listFilesOnly that both the script and package.json are in the program. - The marketplace metadata.version setter was guarded by `if (doc.metadata)`, so an absent metadata block would be reported as drift the fixer could never resolve. It now creates the block. Verified by deleting the field: --check reports it, the fixer restores it. - The "no hardcoded semver" assertion scanned all of server/index.ts. Scoped to the new McpServer(...) options object so an unrelated literal cannot fail it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2GXsqpMvUhxBSNabSqZdk
0.9.3 was published from the release commit, before the version-field fixes merged, so its tarball still carried plugin manifests at 0.8.0 and an MCP handshake at 0.6.0. Nothing consuming the published package could see correct versions. This ships them. Contents since 0.9.3: - #173 synced the plugin manifests and the MCP handshake version. - #174 added scripts/sync-version.ts, a CI drift check, and the npm version lifecycle hook, so this bump updated all three manifests in one command. Claude-Session: https://claude.ai/code/session_01H2GXsqpMvUhxBSNabSqZdk Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
package.jsonwas the only version that moved. The plugin manifests fell three minors behind and the MCP handshake fell further still. #173 corrected those by hand — this stops it happening again.scripts/sync-version.tsrewrites drifted manifest fields, or under--checkreports them and exits 1.--check, so drift cannot land.versionlifecycle runs the fixer and git-adds.claude-plugin, so a bump updates the manifests in the same commit aspackage.json.server/index.tsimportspkg.versioninstead of a literal — strictly better than syncing one. A test asserts no hardcoded semver returns to that call.Verified both directions
Not just "it passes":
The fixer restores the file byte-identically —
git diffis empty afterwards, so the 4-space manifest formatting round-trips.bun test→ 475 pass, 0 fail (4 new).bun run typecheckclean.Credit
Design and the original implementation are from #110 by @grlee. That PR now conflicts with
mainand lives on a fork, so it could not be rebased — this reimplements the same approach. #110 should be closed in favour of this one, with thanks.🤖 Created with the help of AI (Claude Opus 5).
Note
Keep version fields in
.claude-pluginmanifests and MCP server in sync withpackage.jsonpackage.jsonand the.claude-plugin/plugin.jsonand.claude-plugin/marketplace.jsonmanifests.sync-versionnpm script and aversionlifecycle hook that stages manifest changes automatically onnpm version.pkg.versionimported frompackage.json.bun run sync-version --checkto fail the build on any drift.resolveJsonModulein tsconfig.json and includesscripts/**/*.tsto support the new script and JSON import.Macroscope summarized 0d5d417.