Skip to content

feat: validate installed CLI version before pin-version sync - #24

Merged
m-shaka merged 1 commit into
mainfrom
feat/validate-cli-version-for-pin-version
Aug 20, 2026
Merged

feat: validate installed CLI version before pin-version sync#24
m-shaka merged 1 commit into
mainfrom
feat/validate-cli-version-for-pin-version

Conversation

@m-shaka

@m-shaka m-shaka commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

  • pin-version: true passes --pin-version to bm sync, but that flag only exists in @basemachina/cli 1.5.0+. Older CLIs previously failed with a confusing unknown-flag error from the CLI itself.
  • Add a pre-flight check in scripts/run.sh that reads the installed CLI version and fails fast with a clear ::error:: when it is below 1.5.0. The CLI has no --version command, so the version is read from @basemachina/cli/package.json resolved from the caller's node_modules.
  • Prerelease builds are exempted with a ::notice::, since their numeric parts do not reflect release ordering.
  • When the version cannot be determined (no node, unresolvable package), only a ::warning:: is emitted and sync proceeds — bm sync itself fails if the CLI is truly missing, so there is no need to fail twice.

Test plan

  • bats tests/ (37/37 passing, including 6 new cases for the version gate)
  • shellcheck -x scripts/*.sh tests/fixtures/bm-mock

🤖 Generated with Claude Code

https://claude.ai/code/session_01QJHtSgSBsmL1rdGEgep6rp

Add a pre-flight check for `pin-version: true` so run.sh fails fast
with a clear error when the installed @basemachina/cli is older than
1.5.0, instead of letting `bm sync` fail later with an unknown-flag
error. Prerelease builds (e.g. internal dev builds) are exempted from
the check, and an undetectable version only warns and proceeds, since
`bm sync` itself will fail if the CLI is truly missing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJHtSgSBsmL1rdGEgep6rp
@github-actions

Copy link
Copy Markdown

mock sync output

@github-actions

Copy link
Copy Markdown

mock sync output

@github-actions

Copy link
Copy Markdown

mock sync output

@github-actions

Copy link
Copy Markdown

mock sync output

@m-shaka
m-shaka marked this pull request as ready for review August 20, 2026 09:33
@m-shaka
m-shaka requested a review from a team as a code owner August 20, 2026 09:33
@m-shaka
m-shaka requested review from taro-28 and yebis0942 August 20, 2026 09:33
@m-shaka
m-shaka enabled auto-merge August 20, 2026 09:33
@m-shaka
m-shaka merged commit 2b476c3 into main Aug 20, 2026
6 checks passed
@m-shaka
m-shaka deleted the feat/validate-cli-version-for-pin-version branch August 20, 2026 09:37
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.

2 participants