Skip to content

fix(version): report the real package version - #88

Merged
tupe12334 merged 1 commit into
mainfrom
fix/version-from-package-json
Oct 19, 2026
Merged

tupe12334 merged 1 commit into
mainfrom
fix/version-from-package-json

Conversation

@tupe12334

Copy link
Copy Markdown
Member

Bug

src/version.ts hard-codes export const VERSION = '0.0.0'. No script or release step rewrites that file. release-it only bumps package.json, and the git history shows the placeholder was never synced.

Every published release (0.8.1 to 0.8.4) ships 0.0.0. As a result:

  • centy version prints CLI: 0.0.0.
  • It reports a false "Version mismatch" against the daemon for every user.

Fix

VERSION now reads the version field from the package's own package.json. It uses createRequire, the same pattern bin/run.js already uses. The path ../package.json resolves from both src/ (tests) and dist/ (built CLI).

No new dependency. No release-step change is needed, because the value now follows package.json at run time.

Test

src/version.spec.ts gets a new case, should equal the version in package.json. It asserts getVersion() equals package.json's version. This test fails on main (expected '0.0.0' to be '0.8.4') and passes with this change.

Verification

  • pnpm lint, pnpm format:check, pnpm spell, pnpm knip, tsc --noEmit: pass
  • pnpm test:coverage --run: 229 files, 1116 tests pass
  • pnpm build: pass
  • Built CLI, node bin/run.js version, before: published centy@0.8.4 printed CLI: 0.0.0. After: CLI: 0.8.4, with the real daemon at 0.15.1. The mismatch shown now is a real one.

🤖 Generated with Claude Code

src/version.ts hard-coded VERSION = '0.0.0' and no release step rewrites
it. Every published CLI therefore reported 0.0.0 and a false version
mismatch against the daemon.

VERSION now reads the version from package.json, the same way
bin/run.js already does. A new test asserts getVersion() equals
package.json's version.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@tupe12334
tupe12334 merged commit b4b9d8b into main Oct 19, 2026
18 of 20 checks passed
@tupe12334
tupe12334 deleted the fix/version-from-package-json branch October 19, 2026 12:42
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.

1 participant