Skip to content

fix(cli): report the installed version after a self-update - #198

Merged
danielvm-git merged 1 commit into
mainfrom
fix/cli-update-version
Nov 3, 2026
Merged

danielvm-git merged 1 commit into
mainfrom
fix/cli-update-version

Conversation

@danielvm-git

Copy link
Copy Markdown
Owner

Summary

bigpowers update reported the wrong version: after npm install -g bigpowers@latest installed
2.92.0, its banner (and menu header) still said 2.88.5, while bigpowers install — run right
after — correctly said 2.92.0. Fixes BUG-2026-11-03-cli-update-stale-version.

Cause. update reinstalls the package inside a live process. bin/bigpowers.js has already
required package.json by then, so when bin/setup.js (required after the reinstall, so read from
the new files) requires the same resolved path, Node returns the cached module object: the file is
new, the version string is the one the process booted with. install looked right only because it is
a fresh process with an empty cache.

Fix (3 files, +54/−11):

  • scripts/lib/cli-version.js — readPackageVersion(root): readFileSync + JSON.parse.
  • bin/setup.js — the module-level BANNER template (built from pkg.version at load) becomes
    banner(version), and main() reads the version fresh before rendering the banner and intro.
    pkg is no longer required at all.
  • bin/bigpowers.js — status and the default messages use the same helper, so no user-facing
    string can carry a startup snapshot.

Test plan

  • bash scripts/test-bigpowers-cli-version.sh → 3 passed, 0 failed
    • (1) the mechanism: readPackageVersion() sees the on-disk version after the path was already
      required and then rewritten
    • (2) end-to-end: a driver mimics update (snapshot 2.88.5 → overwrite to 2.92.0 → require
      bin/setup.js) and asserts the banner carries 2.92.0; pre-fix it fails with
      "the banner reported the startup version (v2.88.5) after 2.92.0 was installed"
    • (3) static guard: neither entry point interpolates pkg.version into a user-facing line
  • node bin/bigpowers.js status → bigpowers v2.93.0 — 86 skills installed
  • npm run compliance pass · bash scripts/run-verification-gates.sh → 55/55 pass (gate
    bigpowers-cli-version registered)

Not in scope

The menu both commands draw when stdin has no TTY is a real but separate defect — reproduced, and
logged as BUG-2026-11-03-cli-nontty-silent-noop (open) rather than folded into a
version-reporting fix.

bigpowers update ran npm install -g bigpowers@latest inside a live process. bin/
bigpowers.js had already require()d package.json, so when bin/setup.js read the
same path after the reinstall Node returned the cached object: the banner said
v2.88.5 while 2.92.0 was installed. bigpowers install looked correct only because
it is a fresh process with an empty cache.

- scripts/lib/cli-version.js: readPackageVersion() reads package.json from disk.
- bin/setup.js: BANNER (built from pkg.version at module load) becomes
  banner(version); main() reads the version fresh before rendering.
- bin/bigpowers.js: status and the default messages use the same helper, so no
  user-facing string can carry a startup snapshot.

The menu these commands draw without a TTY is a separate defect, reproduced and
logged as BUG-2026-11-03-cli-nontty-silent-noop (open) rather than mixed in here.

Refs BUG-2026-11-03-cli-update-stale-version.
@danielvm-git
danielvm-git merged commit 4a2d8d0 into main Nov 3, 2026
7 checks passed
@danielvm-git
danielvm-git deleted the fix/cli-update-version branch November 3, 2026 20:34
github-actions Bot pushed a commit that referenced this pull request Nov 3, 2026
## [2.93.1](v2.93.0...v2.93.1) (2026-11-03)

### Bug Fixes

* **cli:** report the installed version after a self-update ([#198](#198)) ([4a2d8d0](4a2d8d0))
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.93.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant