Skip to content

CLI --version reports 0.1.0 for published 1.0.0 package #14

Description

@120850853

Summary

The published @contextmesh/cli@1.0.0 package reports 0.1.0 from contextmesh --version.

Reproduction

tmp=$(mktemp -d /tmp/contextmesh-repro-XXXXXX)
cd "$tmp"
npm init -y >/dev/null
npm install --ignore-scripts --no-audit --no-fund @contextmesh/cli@1.0.0
./node_modules/.bin/contextmesh --version
node -e "console.log(require('./node_modules/@contextmesh/cli/package.json').version)"

Actual behavior

0.1.0
1.0.0

Expected behavior

contextmesh --version should print the installed package version, 1.0.0.

Root cause

src/cli.ts currently calls .version('0.1.0'), so the compiled CLI keeps the development version even when release tooling publishes a package with updated metadata.

Proposed fix

I have a small PR ready that:

  • reads the version from the runtime package's package.json,
  • keeps 0.1.0 as a fallback for unusual development/runtime cases,
  • adds a Jest CLI smoke test that simulates a release package whose package metadata version differs from the source checkout version.

Verification performed locally:

npm install --ignore-scripts --no-audit --no-fund
npm run build
npx jest src/__tests__/cli.test.ts --runInBand
npm test -- --runInBand
npm run typecheck
npm run lint:check
npm pack --pack-destination /tmp/earn-micro-scan/contextmesh-pack
# fresh install smoke from a packed tarball with package.json version set to 1.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions