Skip to content

Add version bump script and docs#1308

Open
rohan-pandeyy wants to merge 2 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:feat/bump-version-script
Open

Add version bump script and docs#1308
rohan-pandeyy wants to merge 2 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:feat/bump-version-script

Conversation

@rohan-pandeyy

@rohan-pandeyy rohan-pandeyy commented Jun 7, 2026

Copy link
Copy Markdown
Member

Closes #1306

This pull request introduces a standardized process for managing and synchronizing version numbers across the project's main manifest files. It adds a new script to automate version bumps and updates the documentation to guide maintainers through the release process.

Release management automation:

  • Added a new script, scripts/bump-version.mjs, which validates a provided version number and updates the version field in package.json, frontend/package.json, and frontend/src-tauri/Cargo.toml to keep them in sync. The script checks for errors, prints a summary of changes, and reminds the user to regenerate the Cargo lock file.
  • Added a new npm script version:bump in the root package.json to run the version bump script easily from the command line.

Documentation updates:

  • Updated CONTRIBUTING.md with a new "Release Management" section, documenting the version synchronization requirement, how to use the version bump script, and additional steps for regenerating lock files.

Additional Notes:

@rahulharpal1603, now, running npm run version:bump -- 1.2.0 in root directory will bump all the versions at once.

image

AI Usage Disclosure:

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Gemini

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Documentation

    • Added release management guidelines describing synchronized versioning across the project, required X.Y.Z format, and how to invoke the version bump process.
  • New Features

    • Added a command to automate validated version bumps across all relevant project manifests; it reports changes, attempts rollback on failures, and reminds maintainers to regenerate lock state afterward.

Add scripts/bump-version.mjs to validate and synchronize the version across root package.json, frontend/package.json, and frontend/src-tauri/Cargo.toml. Register a new npm script ('version:bump') and update CONTRIBUTING.md with release-management instructions and usage examples. The script enforces X.Y.Z numeric format, verifies current files before writing, prints a summary of changes, and reminds developers to run cargo check to regenerate Cargo.lock.
@github-actions github-actions Bot added GSoC 2026 enhancement New feature or request labels Jun 7, 2026
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 02dc2b32-d70c-4704-aa9d-41dfb398314b

📥 Commits

Reviewing files that changed from the base of the PR and between f979484 and 8413ba9.

📒 Files selected for processing (1)
  • scripts/bump-version.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/bump-version.mjs

Walkthrough

Adds a Node.js CLI and npm script to bump an X.Y.Z version across root package.json, frontend/package.json, and frontend/src-tauri/Cargo.toml, with validation, batched writes and rollback, and documents the release workflow in CONTRIBUTING.md.

Changes

Version Bump Automation

Layer / File(s) Summary
Release management documentation and npm entry point
CONTRIBUTING.md, package.json
Release Management section documents synchronized manifests, Tauri v2 inheritance, npm run version:bump -- <version> usage, X.Y.Z requirement, and post-bump cargo check. Adds version:bump npm script.
Script path and targets
scripts/bump-version.mjs
Resolves repo root and target manifest file paths for root package.json, frontend/package.json, and frontend/src-tauri/Cargo.toml.
Argument parsing and validation
scripts/bump-version.mjs
Parses CLI positional version argument and validates strict X.Y.Z format; exits with error on missing/invalid input.
Read target files
scripts/bump-version.mjs
Reads the three manifest files' UTF‑8 contents with error handling that aborts on read failure.
Extract current version values
scripts/bump-version.mjs
Extracts and verifies current version strings using format-specific regexes for JSON and TOML; errors if any version is not found.
Build updated file contents
scripts/bump-version.mjs
Creates in-memory updated contents by replacing the extracted version values for each manifest format.
Write files with rollback
scripts/bump-version.mjs
Writes all files in a batched list; on any write error attempts to rollback prior writes, reports rollback failures, and exits with status 1 on unrecoverable errors.
Completion output
scripts/bump-version.mjs
Prints old→new version summaries per file and reminds to run cargo check to regenerate Cargo.lock.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AOSSIE-Org/PictoPy#1274: Directly bumps version fields in package.json and frontend/package.json; this PR automates that workflow.
  • AOSSIE-Org/PictoPy#659: Bumps Cargo.toml version; related to Cargo manifest version changes automated here.

Suggested labels

TypeScript/JavaScript, Documentation

Poem

🐰 I hop from file to file with glee,
Replacing versions: one-two-three,
No more drift across the tree,
One command, synced harmony,
Cargo lock? Run cargo check for me.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding a version bump script and documentation for release management.
Linked Issues check ✅ Passed The PR fully addresses issue #1306 objectives: the bump-version.mjs script accepts version input, updates all three manifest files (package.json, frontend/package.json, Cargo.toml), includes error handling with rollback safety, and provides a single command for maintainers to synchronize versions.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #1306 requirements: script implementation, npm script entry, and documentation updates for release management.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/bump-version.mjs (1)

1-143: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Add automated tests for the version bump script’s critical paths.

This is release-critical automation, but no automated coverage is included for success path, invalid input, missing version field, and partial-failure handling.

As per coding guidelines, "Ensure that test code is automated, comprehensive, and follows testing best practices" and "Verify that all critical functionality is covered by tests."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/bump-version.mjs` around lines 1 - 143, Add automated tests for
scripts/bump-version.mjs covering the success path and failure modes: write
unit/integration tests that invoke the script (e.g., via child_process.exec or
by importing a testable entry function) to validate (1) successful bump updates
rootPackageJsonPath/frontendPackageJsonPath/Cargo.toml and prints the summary
when newVersion matches semverRegex; (2) invalid input (missing or malformed
newVersion) causes the script to exit with a non-zero code and prints the
appropriate error messages for newVersion/semverRegex checks; (3) missing
"version" field in any of
rootPackageJsonContent/frontendPackageJsonContent/cargoTomlContent triggers the
corresponding error branch and exit; and (4) partial-failure/file-write errors
(simulate fs.readFileSync/fs.writeFileSync throwing) cause the script to log the
specific error and exit non-zero; use temp fixture files (or mock fs) and assert
on file contents, exit codes, and console output for variables and symbols in
the script such as newVersion, semverRegex, rootPackageJsonPath,
frontendPackageJsonPath, cargoTomlPath, and the replacement behavior that
produces
updatedRootJsonContent/updatedFrontendJsonContent/updatedCargoTomlContent.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/bump-version.mjs`:
- Around line 111-131: The current sequential writes using fs.writeFileSync to
rootPackageJsonPath, frontendPackageJsonPath and cargoTomlPath can leave the
repo in a partially-updated state if one write fails; change the write strategy
in bump-version.mjs to perform atomic updates: write each updated*Content to a
temporary file (e.g., rootPackageJsonPath + ".tmp"), fsync/close it, then
fs.rename the temp over the target (or use atomic rename semantics) so the
replacement is atomic; if any step fails, roll back by removing any created
temps and do not rename any remaining files (or restore from backups created
before writes), and ensure errors from rename/failures are caught and cause
process.exit(1). Target symbols: updatedRootJsonContent,
updatedFrontendJsonContent, updatedCargoTomlContent, rootPackageJsonPath,
frontendPackageJsonPath, cargoTomlPath and the current try/catch write blocks.

---

Outside diff comments:
In `@scripts/bump-version.mjs`:
- Around line 1-143: Add automated tests for scripts/bump-version.mjs covering
the success path and failure modes: write unit/integration tests that invoke the
script (e.g., via child_process.exec or by importing a testable entry function)
to validate (1) successful bump updates
rootPackageJsonPath/frontendPackageJsonPath/Cargo.toml and prints the summary
when newVersion matches semverRegex; (2) invalid input (missing or malformed
newVersion) causes the script to exit with a non-zero code and prints the
appropriate error messages for newVersion/semverRegex checks; (3) missing
"version" field in any of
rootPackageJsonContent/frontendPackageJsonContent/cargoTomlContent triggers the
corresponding error branch and exit; and (4) partial-failure/file-write errors
(simulate fs.readFileSync/fs.writeFileSync throwing) cause the script to log the
specific error and exit non-zero; use temp fixture files (or mock fs) and assert
on file contents, exit codes, and console output for variables and symbols in
the script such as newVersion, semverRegex, rootPackageJsonPath,
frontendPackageJsonPath, cargoTomlPath, and the replacement behavior that
produces
updatedRootJsonContent/updatedFrontendJsonContent/updatedCargoTomlContent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 619c1396-014b-417c-a71d-93e01d3cf37b

📥 Commits

Reviewing files that changed from the base of the PR and between 07a2e78 and f979484.

📒 Files selected for processing (3)
  • CONTRIBUTING.md
  • package.json
  • scripts/bump-version.mjs

Comment thread scripts/bump-version.mjs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request GSoC 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add version bump script for manifest synchronization

1 participant