Skip to content

fix(cli): support --version and -V - #579

Merged
khaliqgant merged 2 commits into
mainfrom
fix/cli-version-flag
Sep 24, 2026
Merged

khaliqgant merged 2 commits into
mainfrom
fix/cli-version-flag

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Support exactly flows --version and flows -V in the SDK CLI.
  • Read the installed @relayflows/sdk/package.json version at runtime for Node/npm artifacts.
  • Embed the SDK version during the Bun standalone build, where no neighboring package manifest exists.
  • Keep argument validation strict: version flags with extra arguments remain invalid.
  • Add mounted-surface, built-binary, npm-installed, and compiled-standalone regression coverage.

Verification

Focused gate:

$ npm run typecheck && npm run build && npx vitest run tests/bin.test.ts tests/relay-cli-surface.test.ts
✓ tests/relay-cli-surface.test.ts (79 tests)
✓ tests/bin.test.ts (12 tests)
Test Files  2 passed (2)
Tests  91 passed (91)

Installed npm artifact smoke:

$ node <temporary npm-installed @relayflows/sdk>/dist/cli.js --version
--version rc=0 stdout=2.0.31 stderr=''
$ node <temporary npm-installed @relayflows/sdk>/dist/cli.js -V
-V rc=0 stdout=2.0.31 stderr=''

Compiled standalone smoke:

$ node scripts/build-standalone-cli.mjs bun-linux-x64 <temporary>/flows
build_rc=0
--version rc=0 stdout=2.0.31 stderr=''
-V rc=0 stdout=2.0.31 stderr=''

The repository's full SDK gate was also run before the standalone follow-up:

$ npm test
Test Files  7 failed | 195 passed | 3 skipped (205)
Tests  15 failed | 3325 passed | 25 skipped (3365)

Those failures are environment/runtime fixture failures (missing built Surface fixture, missing local kernel/target/debug/relayflowd, Bun 1.4.2 vs the test's 1.4.0 pin, and missing live daemon connection); the focused CLI/surface/standalone tests pass.

Session-Id: 01a0d4c3-fc7d-7882-9e9e-342059219272
@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c5862f92-d4db-4d13-8593-d91d6d3866dd

📥 Commits

Reviewing files that changed from the base of the PR and between e04c5b9 and fce1cb1.

📒 Files selected for processing (5)
  • packages/sdk/src/cli.ts
  • packages/sdk/src/package-version.ts
  • packages/sdk/src/relay-cli.ts
  • packages/sdk/tests/bin.test.ts
  • packages/sdk/tests/relay-cli-surface.test.ts

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T19:08:50.779462Z fce1cb1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Devin Review

export function packageVersion(): string {
try {
const manifest: unknown = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),

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.

🟡 Standalone executable reports placeholder version

For Bun-compiled flows, packageVersion() cannot find the SDK manifest beside its bundled module. Both version flags print 0.0.0 instead of the release version.

Learn more

The standalone build imports runCli into a temporary entrypoint, then compiles that entrypoint as a single executable. The compiled module does not have the SDK package manifest at the relative URL used by packageVersion(). The failed read reaches the placeholder fallback, so the new flags report 0.0.0 in standalone artifacts even though the installed Node CLI reports the correct version. The release workflow builds standalone binaries for both supported platforms.

Example: Compile the standalone executable into packages/runtime-linux-x64/bin/flows and invoke flows --version. The SDK package version is 2.0.31, but the manifest read fails and stdout contains 0.0.0.

Recommended fix: Embed the SDK version at standalone build time and pass it to runCli for version output, while retaining the manifest read for source and Node-installed packages. Add an assertion for both version flags against a built standalone executable.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 5413fba. The standalone builder now reads packages/sdk/package.json at build time and passes the embedded version to runCli. Added bin.test.ts coverage that compiles the standalone executable and asserts both --version and -V return 2.0.31 with rc 0 and empty stderr. The Linux artifact CI is green on this head.

Session-Id: 01a0d4c3-fc7d-7882-9e9e-342059219272
@khaliqgant

Copy link
Copy Markdown
Member Author

Addressed Devin review in 5413fba. The Bun standalone build now embeds the SDK manifest version into runCli, so the self-contained executable reports 2.0.31 rather than falling back to 0.0.0. Added compiled-standalone regression tests for --version and -V; focused gate now reports 91/91 passing.

@khaliqgant
khaliqgant merged commit 37c4116 into main Sep 24, 2026
8 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