fix(cube-cli): version from lerna.json, "Cube CLI" branding, sk- API-key detection#11311
Conversation
…-version The release version-bump commit updates lerna.json but not the crate manifest, so source builds (and any path that skipped the workflow's sed) reported a stale version. build.rs now reads the repo-root lerna.json and injects CUBE_CLI_VERSION at compile time — source and release builds both report the real Cube version, and the workflow's sed step is replaced with a tag-vs-lerna.json consistency check. The Cargo.toml version is a 0.0.0 placeholder used only for out-of-tree builds. --version now prints 'Cube CLI 1.7.5' (clap display_name) instead of 'cube 1.7.5'; version propagation to subcommands is dropped (it rendered as 'Cube CLI-deployments'). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdcyqFwUF9BbWLeX4uERnk
|
Claude finished @paveltiunov's task in 45s —— View job Code ReviewVerdict: LGTM — 0 blocking, 2 low-severity notes. Expand for details.
Summary The change cleanly moves the CLI version source of truth to Low-severity notes
Testing/Docs README update ( Nothing else surfaces on code quality, security, or performance. |
Users don't always know their tenant URL. The login prompt now accepts an empty answer (with a help hint) and falls back to the generic https://cubecloud.dev sign-in, which resolves the tenant from the signed-in account; the device token response's tenantUrl is then used as the saved context URL and for credential validation. --url and --api-key behavior unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdcyqFwUF9BbWLeX4uERnk
|
Claude finished @paveltiunov's task in 55s —— View job Code Review (updated for
|
…tice The Bearer/Api-Key heuristic classified credentials by JWT shape, which broke device login: OAuth access tokens aren't necessarily three-segment JWTs, so freshly minted tokens were sent as Api-Key and the post-login /users/me validation failed with 401. Cube Cloud API keys carry an sk- prefix — use that as the discriminator: sk- → Api-Key, everything else → Bearer (CUBE_AUTH_SCHEME still overrides). Update-notice wording: 'A new release of Cube CLI is available' (and Cube CLI in cube update output) instead of 'cube'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdcyqFwUF9BbWLeX4uERnk
|
Claude finished @paveltiunov's task in 40s —— View job Code Review (updated for
|
…login The Enter fallback in cube login targets https://cubecloud.dev, which doesn't serve the device-OAuth endpoints yet; the env override lets the generic sign-in be pointed at a console that does (verified against staging: Enter → device code minted, no 404). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdcyqFwUF9BbWLeX4uERnk
|
Claude finished @paveltiunov's task in 39s —— View job Code Review (updated for
|
In the tenant-discovery flow the browser link is now
{host}/auth?redirect_to=<percent-encoded device approval path> instead
of the bare device page, so the user signs in first (which resolves
their tenant) and lands on the approval page. Tenant-URL logins keep
the direct verification link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdcyqFwUF9BbWLeX4uERnk
|
Claude finished @paveltiunov's task in 48s —— View job Code Review (updated for
|
There's no server to mint device codes on the generic cubecloud.dev host, so the Enter fallback can't work — POST /auth/device/code 404s before the browser ever opens. Reverts the generic sign-in fallback, the /auth?redirect_to= link wrapping, the CUBE_GENERIC_LOGIN_URL override, and the tenantUrl token field; cube login requires the tenant URL again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdcyqFwUF9BbWLeX4uERnk
|
Claude finished @paveltiunov's task in 44s —— View job Code Review (updated for
|
Check List
Description of Changes Made
Cube CLI fixes, follow-up to #11291:
Version was stale outside release builds. The release version-bump commit updates
lerna.jsonbut notrust/cube-cli/Cargo.toml, so source builds reported the old version (1.7.2 on a 1.7.5 tree). Nowbuild.rsreads the repo-rootlerna.jsonand injectsCUBE_CLI_VERSIONat compile time — source builds and release builds both report the real Cube version with no manifest syncing. TheCargo.tomlversion becomes a0.0.0placeholder used only as a fallback for out-of-tree builds, and the release workflow's sed step is replaced by a tag-vs-lerna.jsonconsistency check (fails the release job on drift). All version references (--version, User-Agent, update check, telemetrycliVersion) use the injected version.Branding.
cube --versionnow printsCube CLI 1.7.5(clapdisplay_name) instead ofcube 1.7.5; the update notice andcube updateoutput say "Cube CLI" too. Version propagation to subcommands is dropped — it rendered asCube CLI-deployments 1.7.5.Device login was broken by credential-scheme detection. The Bearer/Api-Key heuristic from #11291 classified credentials by JWT shape, but OAuth access tokens aren't necessarily three-segment JWTs — freshly minted device-flow tokens were sent as
Api-Keyand the post-login/users/mevalidation failed with 401. Cube Cloud API keys carry ansk-prefix, so that's now the discriminator:sk-→Api-Key, everything else →Bearer(CUBE_AUTH_SCHEMEstill overrides). Verified end-to-end on staging with both credential types.(A tenant-discovery login fallback via generic cubecloud.dev sign-in was prototyped and reverted within this branch — there's no server to mint device codes on the generic host.)
🤖 Generated with Claude Code
Generated by Claude Code