Skip to content

fix: read CLI version from package.json so it cannot drift - #3

Open
brainsparker wants to merge 1 commit into
mainfrom
fix/cli-version-sync
Open

fix: read CLI version from package.json so it cannot drift#3
brainsparker wants to merge 1 commit into
mainfrom
fix/cli-version-sync

Conversation

@brainsparker

Copy link
Copy Markdown
Owner

Why

npx youagent --version prints 0.1.0 while the published package is 0.0.2. The version string in src/cli/index.ts is hardcoded, so every npm version bump silently leaves the CLI reporting the wrong number. Spotted during the clean-machine verification of the 0.0.2 release.

What changed

src/cli/index.ts resolves the version from package.json at runtime via createRequire(import.meta.url). The relative depth is identical in dev (src/cli/) and in the tsup output (dist/cli/), so the same path works in both. No tsconfig or build changes needed.

Validation

  • npm run build clean, tsc --noEmit clean, full test suite passes
  • node dist/cli/index.js --version now prints 0.0.2, matching package.json
  • Future npm version patch bumps are picked up automatically with no code change

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