Repository navigation
fix(cli): derive baked version from package.json - #5196
Conversation
cli.config.ts hardcoded VERSION = "0.2.19", which is baked into every binary as --version and SUPERSET_VERSION. package.json and the cli-v* tags moved on to 0.2.22, so released binaries kept self-reporting 0.2.19: superset update read the newer version.txt, reinstalled the (genuinely newer) tarball, printed "Updated 0.2.19 -> 0.2.22", but --version never moved. Read the version from package.json so there is a single source of truth that can't drift from the release tag.
|
Ready to review this PR? Stage has broken it down into 1 individual chapter for you:
Chapters generated by Stage for commit 83d5b80 on Jun 8, 2026 9:10pm UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CLI configuration file is updated to read the version from ChangesVersion Import Update
Possibly related PRs
Poem
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Greptile SummaryThis PR fixes a version drift bug where
Confidence Score: 5/5Safe to merge — the change is a minimal two-line swap that eliminates a stale hardcoded constant in favour of a build-time JSON import that stays in sync with package.json. The fix is self-contained and correct: resolveJsonModule is already enabled, TypeScript 5.9.3 supports the with { type: json } import attribute, and pkg.version resolves to a typed string so no runtime ambiguity is possible. The downstream consumer (update/command.ts via env.VERSION) is unchanged and will correctly receive the baked value. No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/cli/cli.config.ts | Replaces hardcoded "0.2.19" version constant with a JSON import of package.json, ensuring the baked SUPERSET_VERSION and --version flag always match the authoritative package version. |
Sequence Diagram
sequenceDiagram
participant Build as cli-framework build
participant Config as cli.config.ts
participant PkgJSON as package.json
participant Binary as dist/superset (binary)
participant Update as update command
participant Remote as cli-latest/version.txt
Build->>Config: load config
Config->>PkgJSON: import pkg from package.json
PkgJSON-->>Config: version 0.2.22
Config-->>Build: "VERSION = 0.2.22"
Build->>Binary: "bake SUPERSET_VERSION = 0.2.22"
Note over Binary: at runtime
Binary->>Update: "env.VERSION = 0.2.22"
Update->>Remote: fetch version.txt
Remote-->>Update: 0.2.22
Update-->>Update: "upToDate = true"
Reviews (1): Last reviewed commit: "fix(cli): derive baked version from pack..." | Re-trigger Greptile
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Problem
superset updatereports success butsuperset --versionnever changes — e.g. it printsUpdated 0.2.19 → 0.2.22while--versionkeeps saying0.2.19.Root cause
packages/cli/cli.config.tshardcodedconst VERSION = "0.2.19", and that constant is baked into every binary as both--versionandprocess.env.SUPERSET_VERSION. It was never bumped, whilepackage.jsonand thecli-v*git tags moved on to0.2.22.The two sources of truth diverged:
version.txtin thecli-latestrelease is derived from the git tag →0.2.220.2.19So the update flow: reads
version.txt(target 0.2.22), sees baked current 0.2.19, downloads & installs today's tarball (which is the real 0.2.22 build), printsUpdated 0.2.19 → 0.2.22— but the freshly installed binary still self-reports 0.2.19. Everyupdatelooks like a no-op and the CLI perpetually thinks an update is available.Fix
Read the version from
package.jsonso there's a single source of truth that can't drift from the release tag.Notes
Takes effect once the next CLI release is cut — the
0.2.22build already incli-latestwill keep reporting 0.2.19 until then.Test plan
bun run lintbun run typecheck --filter=@superset/clicli.config.tsresolvesversionand theSUPERSET_VERSIONdefine to0.2.22Summary by cubic
Fixes CLI version reporting by deriving the baked version from package.json.
superset --versionandSUPERSET_VERSIONnow match the release tag, so updates no longer look like no-ops../package.jsoninpackages/cli/cli.config.tsinstead of a hardcoded string.--versionandprocess.env.SUPERSET_VERSIONwith the publishedcli-v*tag.0.2.22build will still report0.2.19.Written for commit 83d5b80. Summary will update on new commits.
Summary by CodeRabbit