Skip to content

fix(cli): read version from root package.json (closes #348)#552

Open
Bortlesboat wants to merge 1 commit intodavila7:mainfrom
Bortlesboat:fix-cct-version-output-348
Open

fix(cli): read version from root package.json (closes #348)#552
Bortlesboat wants to merge 1 commit intodavila7:mainfrom
Bortlesboat:fix-cct-version-output-348

Conversation

@Bortlesboat
Copy link
Copy Markdown

@Bortlesboat Bortlesboat commented Apr 29, 2026

Issue #348 reports that claude-code-templates 1.28.16 on npm prints 1.28.13 from --version. Still reproducible on current main.

Cause

cli-tool/bin/create-claude-config.js reads its version with require('../package.json'), which resolves to cli-tool/package.json — a sub-manifest that has drifted from the actual published version. The root package.json is the npm publish source (its bin field already points at cli-tool/bin/create-claude-config.js, and CLAUDE.md's publishing workflow bumps the root version), so the bin should read from there.

Repro on HEAD before this PR

$ npm view claude-code-templates version
1.28.16
$ cd cli-tool && npm install && node bin/create-claude-config.js --version
1.28.13

After this PR

$ node cli-tool/bin/create-claude-config.js --version
1.28.16

The banner (v${pkg.version}) and the commander --version flag now share a single source.

Diff

Three lines in cli-tool/bin/create-claude-config.js: switch require('../package.json')require('../../package.json'), reuse the already-imported pkg for .version() instead of requiring a second time, add a one-line comment pointing at #348 so the next refactor doesn't re-introduce the drift.

Closes #348.


Summary by cubic

Fixes the CLI version mismatch by reading the version from the root package.json. Now --version and the banner show the published package version.

  • Bug Fixes
    • Area: CLI (cli-tool/bin/)
    • Read version from root package.json instead of cli-tool/package.json; banner and .version() now share pkg.version.
    • Resolves the outdated --version output reported in version output for claude-code-templates 1.28.16 is 1.28.13 #348.
    • No new components; no docs catalog regen needed. No new env vars or secrets.

Written for commit d16faf6. Summary will update on new commits. Review in cubic

The bin script resolves `require('../package.json')` against
cli-tool/, which has a separate sub-manifest that drifts from the
published version. The root package.json is what npm publishes from
(its bin entry already points at cli-tool/bin/create-claude-config.js
and CLAUDE.md's release workflow bumps the root version), so reading
from there gives the user the actual installed npm release.

Reproducer (HEAD before this change):
  npm view claude-code-templates version  # 1.28.16
  cd cli-tool && node bin/create-claude-config.js --version
  # prints 1.28.13

After this change `--version` and the banner both print 1.28.16.

Closes davila7#348
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

@Bortlesboat is attempting to deploy a commit to the Daniel Avila's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

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.

version output for claude-code-templates 1.28.16 is 1.28.13

1 participant