Skip to content

fix: sync CLI_VERSION with package.json — unblocks arg-parser tests#317

Open
javimosch wants to merge 1 commit into
masterfrom
mago/task-411
Open

fix: sync CLI_VERSION with package.json — unblocks arg-parser tests#317
javimosch wants to merge 1 commit into
masterfrom
mago/task-411

Conversation

@javimosch

@javimosch javimosch commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What changed

__tests__/arg-parser.test.js already existed in master (23 tests covering all the required behaviors: --key=value syntax, flag value-swallowing, -- end-of-options, userFlags filtering, and readStdin JSON/raw/empty/TTY paths).

One test was failing: CLI_VERSION › matches package.json version — the constant in cli/arg-parser.js was "1.31.4" while package.json reads "1.31.5". This PR syncs the constant.

Why

Stale version constant caused a deterministic test failure. No behavior change beyond the constant value.

Verification

npx jest __tests__/arg-parser.test.js --no-coverage
# Tests: 23 passed, 23 total

mago task #411

Summary by CodeRabbit

  • Chores
    • Updated the CLI version to 1.31.5.

The version constant in arg-parser.js was one patch behind package.json,
causing the CLI_VERSION test in __tests__/arg-parser.test.js to fail.

mago task #411
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The exported CLI version constant was updated in cli/arg-parser.js from 1.31.4 to 1.31.5. No other parsing or I/O logic changed.

Changes

CLI version update

Layer / File(s) Summary
Version string bump
cli/arg-parser.js
The exported CLI_VERSION constant is updated from 1.31.4 to 1.31.5.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A tiny hop, a happy grin,
My CLI badge got polished in.
1.31.5 चम? No—just neat and bright,
A version nibble feels just right. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the version sync in cli/arg-parser.js and the related arg-parser test fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mago/task-411

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.

@javimosch

Copy link
Copy Markdown
Owner Author

Review — Head of Org Engineering: The diff correctly bumps the CLI_VERSION constant from 1.31.4 to 1.31.5 in the expected file, is syntactically valid, touches only arg-parser.js, and introduces no bugs, security issues, or secrets.

(approved — review-only mode; merge when ready.)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cli/arg-parser.js (1)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider automating version sync to prevent future drift.

This is the second time (implied by PR description) that a version constant has drifted from package.json. A build-time injection or a single-source-of-truth approach would eliminate this class of failure.

♻️ Suggested approaches
  1. Build-time injection: Use a build script or esbuild/rollup define to inject process.env.npm_package_version or read package.json at build time.
  2. Runtime read: Import package.json directly (if bundler allows) or use fs.readFileSync in a one-time init.
  3. Pre-commit hook: Add a lint rule or hook that fails if CLI_VERSION !== package.json.version.
🤖 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 `@cli/arg-parser.js` at line 3, The CLI version constant in CLI_VERSION is
drifting from package.json, so update the version source to be single-sourced
instead of hardcoded in arg-parser.js. Change the version handling so the CLI
reads or injects the package version at build time (or validates it in a check),
and keep CLI_VERSION aligned through the chosen mechanism to prevent future
mismatches.
🤖 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.

Nitpick comments:
In `@cli/arg-parser.js`:
- Line 3: The CLI version constant in CLI_VERSION is drifting from package.json,
so update the version source to be single-sourced instead of hardcoded in
arg-parser.js. Change the version handling so the CLI reads or injects the
package version at build time (or validates it in a check), and keep CLI_VERSION
aligned through the chosen mechanism to prevent future mismatches.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4da6be7e-6fba-460a-9ff5-cf93f597ac44

📥 Commits

Reviewing files that changed from the base of the PR and between afda2f7 and 9861d93.

📒 Files selected for processing (1)
  • cli/arg-parser.js

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