Skip to content

feat: add version management scripts and CI check #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2025

Conversation

jerome3o-anthropic
Copy link
Member

Summary

This PR adds automated version management scripts and integrates version consistency checking into the CI pipeline.

What's Added

Scripts

  • scripts/update-version.js - Automates version updates across all packages

    • Updates all package.json files with a single command
    • Updates workspace dependencies in the root package.json
    • Automatically runs npm install to update package-lock.json
    • Provides helpful next steps for committing and tagging
  • scripts/check-version-consistency.js - Verifies version consistency

    • Checks all package.json files have the same version
    • Verifies workspace dependencies match the current version
    • NEW: Ensures package-lock.json is in sync with package.json versions
    • Exits with error code 1 if any inconsistencies are found

CI Integration

  • Added version consistency check to the existing GitHub Actions workflow
  • The check runs on every PR and push to main
  • Build will fail if versions are inconsistent or package-lock.json is out of date

Documentation

  • Added scripts/README.md with usage instructions and common workflows

Usage

# Update version across all packages
npm run update-version 0.15.0

# Check version consistency
npm run check-version

Why This Matters

Previously, version updates required manually editing 4 different package.json files and remembering to update the workspace dependencies. This was error-prone and easy to miss.

With these scripts:

  • Version updates are automated and consistent
  • CI catches version mismatches before they're merged
  • package-lock.json sync issues are detected early
  • The release process is simplified and documented

Testing

The scripts have been tested locally and correctly:

  • ✅ Update versions across all packages
  • ✅ Detect version inconsistencies
  • ✅ Detect outdated package-lock.json
  • ✅ Provide clear error messages and guidance

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

- Added update-version.js script to automate version bumps across all packages
- Added check-version-consistency.js script to verify version consistency
- Integrated version check into CI workflow
- Scripts check package.json versions AND package-lock.json sync
- Added npm scripts: `npm run update-version` and `npm run check-version`
- Added documentation in scripts/README.md

This ensures version consistency across the monorepo and prevents
accidental version mismatches or outdated lock files.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

The update-version script works great. Changed version to 20.0.0 in all places.

Tested the check-version script by first running update-version with 20.0.0, and then one location at a time, changing to 20.0.1 and running check-version again. All such tweaks to package-json caused check-version to complain as expected.

In package-lock.json, results:

  • PROBLEM: It doesn't complain if packages/""/@modelcontextprotocol/inspector/version is out of step:
Screenshot 2025-06-14 at 3 34 42 PM
  • PROBLEM: It doesn't complain if any of the packages/""/@modelcontextprotocol/inspector/dependencies are out of step:
Screenshot 2025-06-14 at 3 42 55 PM
  • NOT A PROBLEM: The rest of the packages in package-lock.json DO work as expected
Screenshot 2025-06-14 at 3 46 32 PM

@cliffhall
Copy link
Contributor

cliffhall commented Jun 14, 2025

A related issue is updating the typescript SDK version, which we sometimes do at an inspector version bump and sometimes not. It would be nice to have a similar script for updating the SDK version in all the places. Could be a second arg on the CLI for update-version or we could have two scripts update-sdk-version and update-inspector-version both of which operate the same.

If it was a combined script, you'd need a way to decouple them on the command line which could be providing a dash/dot/
other placeholder for the first option so it doesn't update the inspector version and then supplying the SDK version as the second arg.

Either way it would be super helpful to get in the same PR if possible.

Copy link
Contributor

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

Approving because the failures of the version consistency check are somewhat contrived, they wouldn't happen unless someone manually modified the dependencies in package-lock.json after doing the version bump. And adding a script to bump the TS SDK version can be added separately in another PR.

@cliffhall cliffhall merged commit 21fd2f9 into main Jun 17, 2025
6 checks passed
@cliffhall cliffhall deleted the jerome/feature/version-update-and-check-scripts branch June 17, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants