fix(cli): derive baked version from package.json

Merged
SA
5mo ago
+2-1

Problem

superset update reports success but superset --version never changes — e.g. it prints Updated 0.2.19 → 0.2.22 while --version keeps saying 0.2.19.

Root cause

packages/cli/cli.config.ts hardcoded const VERSION = "0.2.19", and that constant is baked into every binary as both --version and process.env.SUPERSET_VERSION. It was never bumped, while package.json and the cli-v* git tags moved on to 0.2.22.

The two sources of truth diverged:

  • version.txt in the cli-latest release is derived from the git tag → 0.2.22
  • the version baked into the binary → 0.2.19

So 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), prints Updated 0.2.19 → 0.2.22 — but the freshly installed binary still self-reports 0.2.19. Every update looks like a no-op and the CLI perpetually thinks an update is available.

Fix

Read the version from package.json so there's a single source of truth that can't drift from the release tag.

-const VERSION = "0.2.19";
+import pkg from "./package.json" with { type: "json" };
+const VERSION = pkg.version;

Notes

Takes effect once the next CLI release is cut — the 0.2.22 build already in cli-latest will keep reporting 0.2.19 until then.

Test plan

  • bun run lint
  • bun run typecheck --filter=@superset/cli
  • Verified cli.config.ts resolves version and the SUPERSET_VERSION define to 0.2.22

Open in Stage

Summary by cubic

Fixes CLI version reporting by deriving the baked version from package.json. superset --version and SUPERSET_VERSION now match the release tag, so updates no longer look like no-ops.

  • Bug Fixes
    • Read version from ./package.json in packages/cli/cli.config.ts instead of a hardcoded string.
    • Aligns --version and process.env.SUPERSET_VERSION with the published cli-v* tag.
    • Note: takes effect with the next CLI release; the current 0.2.22 build will still report 0.2.19.

Summary by CodeRabbit

  • Chores
    • Updated CLI version management to dynamically source from package metadata instead of a hardcoded value, improving version consistency across builds.