Skip to content

Version Management Guide

The project uses automated version synchronization to ensure that all documentation files always reflect the current version from package.json. This prevents outdated version references in documentation and maintains consistency across the entire codebase.

Terminal window
npm run version:check

Checks if all documentation files have the correct version number. Exits with error code 1 if any files are outdated.

Terminal window
npm run version:sync

Updates all documentation files to match the current version in package.json.

Terminal window
npm run version:bump [major|minor|patch]

Bumps the version in package.json and automatically updates all documentation files.

Terminal window
npm run version:release [major|minor|patch]

Runs the complete release process:

  1. Ensures clean git state and main branch
  2. Pulls latest changes
  3. Runs all tests
  4. Bumps version
  5. Updates documentation
  6. Commits and tags
  7. Pushes to remote
Terminal window
npm run update:version:dry

Shows which files would be updated without making any changes.

When committing changes to package.json that include a version change, the pre-commit hook automatically:

  1. Detects the version change
  2. Updates all documentation files
  3. Stages the updated files for commit
  • Trigger: Push to main branch with package.json changes
  • Action: Checks version consistency and creates a commit if updates are needed
  • Trigger: Manual workflow dispatch
  • Action: Creates a PR with version bump and documentation updates
  • Trigger: Git tags matching v*.*.*
  • Action: Full release process including NPM publish and Docker image creation

The version update script (scripts/update-version.mjs) searches for version patterns in:

  • All .md files in the project root
  • All documentation in starlight-docs/src/content/docs/
  • Testing documentation in testing/
  • Other markdown files throughout the project

The script updates patterns like:

Terminal window
v1.1.0
version: 1.1.0
puppeteer-mcp v1.1.0

Including NPM package version references throughout documentation files.

If npm run version:check fails:

Terminal window
npm run version:sync
git add -A
git commit -m "chore: sync documentation versions"

If the pre-commit hook fails:

  1. Check if tests are passing: npm test
  2. Check TypeScript: npm run typecheck
  3. Manually sync versions: npm run version:sync

If you need to manually set a specific version:

Terminal window
npm version 1.0.14 --no-git-tag-version
npm run version:sync
git add -A
git commit -m "chore: set version to 1.0.14"

Version patterns are defined in scripts/update-version.mjs. To add new patterns or exclude files, modify the script configuration.

The version management system is fully integrated with the release process:

graph LR
A[Developer runs version:release] --> B[Version bumped in package.json]
B --> C[Documentation updated automatically]
C --> D[Changes committed and tagged]
D --> E[GitHub Actions triggered]
E --> F[Build, test, and publish]
  1. Developer runs npm run version:release minor
  2. Version is bumped in package.json
  3. All documentation is automatically updated
  4. Changes are committed and tagged
  5. GitHub Actions takes over for building, testing, and publishing

This ensures that every release has consistent version numbers across all documentation and package files.

CommandDescriptionUse Case
npm run version:checkVerify version consistencyCI validation
npm run version:syncUpdate all documentationFix inconsistencies
npm run version:bump [type]Bump version and update docsDevelopment releases
npm run version:release [type]Full release processProduction releases
npm run update:version:dryPreview changesReview before applying
TypeDescriptionExample
patchBug fixes and small changes1.0.131.0.14
minorNew features, backward compatible1.0.131.1.0
majorBreaking changes1.0.132.0.0

The automated version management system ensures consistency across all project documentation and package files. By integrating with the CI/CD pipeline and providing comprehensive automation, it eliminates manual version maintenance tasks while ensuring accuracy and reliability throughout the release process.