Skip to content

Add just bump command for bumping app version#128

Merged
hsjoberg merged 2 commits intomasterfrom
just-bump
Feb 8, 2026
Merged

Add just bump command for bumping app version#128
hsjoberg merged 2 commits intomasterfrom
just-bump

Conversation

@hsjoberg
Copy link
Member

@hsjoberg hsjoberg commented Feb 8, 2026

Simply do just bump to bump patch version.

You can also do jump major|minor|patch|<x.x.x>

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hsjoberg, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the client application's version management by introducing a new just bump command. This command automates the process of updating version numbers across package.json and app.config.ts, including platform-specific build numbers, thereby ensuring consistency and simplifying release procedures.

Highlights

  • Automated Version Bumping: Introduces a just bump command to automate the client application versioning process.
  • Flexible Versioning: Supports bumping patch, minor, major versions, or setting an explicit semantic version (e.g., 1.2.3).
  • Multi-file Updates: The script updates the version in client/package.json and client/app.config.ts, including android!.versionCode and ios!.buildNumber.
Changelog
  • justfile
    • Added a new bump recipe that executes bun scripts/bump_client_version.ts with passed arguments.
  • scripts/bump_client_version.ts
    • New TypeScript script for client version bumping.
    • Reads version from client/package.json and config.expo.version, config.expo.android!.versionCode, config.expo.ios!.buildNumber from client/app.config.ts.
    • Validates that package.json and app.config.ts versions match before bumping.
    • Implements logic to increment patch, minor, or major versions, or set an explicit version.
    • Increments android!.versionCode and ios!.buildNumber by one.
    • Writes updated versions back to client/package.json and client/app.config.ts.
    • Includes usage instructions and error handling for invalid arguments or missing version fields.
Activity
  • Initial implementation of a new feature. No review comments or further activity yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a convenient just bump command for version management, implemented via a new TypeScript script. While a great addition, the justfile recipe is vulnerable to command injection due to unsafe string interpolation when passing arguments to the shell, which needs to be addressed by using the shell's built-in positional parameter handling. Furthermore, there's a critical issue in how the script modifies package.json that will cause it to fail, and some suggestions have been provided to improve the script's structure and maintainability.

Comment on lines +50 to +58
const packageVersionRegex = /^ "version"\s*:\s*"(\d+\.\d+\.\d+)"/m;
const appVersionRegex = /config\.expo\.version\s*=\s*"(\d+\.\d+\.\d+)";/;
const versionCodeRegex = /config\.expo\.android!\.versionCode\s*=\s*(\d+);/;
const buildNumberRegex = /config\.expo\.ios!\.buildNumber\s*=\s*"(\d+)";/;

const packageVersionMatch = packageJson.match(packageVersionRegex);
if (!packageVersionMatch) {
throw new Error("Could not find a top-level version in client/package.json.");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

Using regular expressions to modify package.json is fragile and will not work as written.

  1. The packageVersionRegex does not account for the trailing comma on the version line in client/package.json. This will cause packageJson.match(packageVersionRegex) to return null, and the script will fail.
  2. Even if the regex were fixed, the replacement logic on line 116 would remove the comma, resulting in an invalid package.json file.

A more robust approach is to parse the JSON file, modify the version property on the resulting object, and then stringify it back to the file. This would involve using JSON.parse() to read the file, updating the version property, and JSON.stringify() to write it back.

Copy link
Member Author

Choose a reason for hiding this comment

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

The packageVersionRegex does not account for the trailing comma on the version line in client/package.json. This will cause packageJson.match(packageVersionRegex) to return null, and the script will fail.

The regex ^ "version"\s*:\s*"(\d+.\d+.\d+)" isn’t anchored to end‑of‑line, so it matches the version substring even with a trailing comma.


# Bump client version numbers
bump *args:
bun scripts/bump_client_version.ts {{ args }}
Copy link
Contributor

Choose a reason for hiding this comment

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

security-high high

The bump recipe uses string interpolation {{ args }} to pass user-supplied arguments to a shell command. Because just recipes are executed in a shell, an attacker can provide arguments containing shell metacharacters (like ;, &, |, or backticks) to execute arbitrary commands on the system. Using "$@" is the recommended way to safely pass positional arguments to commands in just recipes, ensuring they are correctly quoted and not interpreted by the shell.

    bun scripts/bump_client_version.ts "$@"

Copy link
Member Author

@hsjoberg hsjoberg Feb 8, 2026

Choose a reason for hiding this comment

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

The risk is technically real, but the proposed fix is wrong for just.

  • {{ args }} is unquoted, so metacharacters are interpreted by the shell. You can see it with just --dry-run bump "foo;bar" which prints bun scripts/
    bump_client_version.ts foo;bar. So the injection claim is correct in a strict sense.
  • $@ doesn’t apply to just recipe args. just interpolates {{ args }} itself; it doesn’t pass recipe args as shell positional parameters, so $@ would be
    empty. That recommendation is incorrect in this context.
  • Practically, this isn’t a meaningful security issue for a local just command: anyone who can run just already has shell access.

Comment on lines 29 to 44
if (args.length > 0) {
const first = args[0].toLowerCase();
if (["patch", "minor", "major"].includes(first)) {
if (args.length > 1) {
throw new Error(`Too many arguments. ${usage}`);
}
mode = first as "patch" | "minor" | "major";
} else if (isSemver(first)) {
if (args.length > 1) {
throw new Error(`Too many arguments. ${usage}`);
}
explicitVersion = first;
} else {
throw new Error(`Unknown argument "${args[0]}". ${usage}`);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The argument validation logic can be simplified. The check for too many arguments (args.length > 1) is currently duplicated within each conditional branch. By moving this check to before the branches, you can avoid repetition and make the code easier to read and maintain.

if (args.length > 1) {
  throw new Error(`Too many arguments. ${usage}`);
}

if (args.length > 0) {
  const first = args[0].toLowerCase();
  if (["patch", "minor", "major"].includes(first)) {
    mode = first as "patch" | "minor" | "major";
  } else if (isSemver(first)) {
    explicitVersion = first;
  } else {
    throw new Error(`Unknown argument "${args[0]}". ${usage}`);
  }
}

Comment on lines 46 to 48
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This check is redundant. The explicitVersion variable is only assigned a value if it has already passed the isSemver() check during argument parsing on line 36. This block can be safely removed.

@hsjoberg hsjoberg merged commit 9f0df1f into master Feb 8, 2026
3 checks passed
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.

1 participant

Comments