fix: sync CLI_VERSION with package.json — unblocks arg-parser tests#317
fix: sync CLI_VERSION with package.json — unblocks arg-parser tests#317javimosch wants to merge 1 commit into
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThe exported CLI version constant was updated in ChangesCLI version update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
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.) |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cli/arg-parser.js (1)
3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider 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
- Build-time injection: Use a build script or
esbuild/rollupdefine to injectprocess.env.npm_package_versionor readpackage.jsonat build time.- Runtime read: Import
package.jsondirectly (if bundler allows) or usefs.readFileSyncin a one-time init.- 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.
What changed
__tests__/arg-parser.test.jsalready existed inmaster(23 tests covering all the required behaviors:--key=valuesyntax, flag value-swallowing,--end-of-options,userFlagsfiltering, andreadStdinJSON/raw/empty/TTY paths).One test was failing:
CLI_VERSION › matches package.json version— the constant incli/arg-parser.jswas"1.31.4"whilepackage.jsonreads"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
mago task #411
Summary by CodeRabbit