fix(cli): read version from root package.json (closes #348)#552
Open
Bortlesboat wants to merge 1 commit intodavila7:mainfrom
Open
fix(cli): read version from root package.json (closes #348)#552Bortlesboat wants to merge 1 commit intodavila7:mainfrom
Bortlesboat wants to merge 1 commit intodavila7:mainfrom
Conversation
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
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #348 reports that
claude-code-templates1.28.16 on npm prints1.28.13from--version. Still reproducible on current main.Cause
cli-tool/bin/create-claude-config.jsreads its version withrequire('../package.json'), which resolves tocli-tool/package.json— a sub-manifest that has drifted from the actual published version. The rootpackage.jsonis the npm publish source (itsbinfield already points atcli-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
After this PR
The banner (
v${pkg.version}) and the commander--versionflag now share a single source.Diff
Three lines in
cli-tool/bin/create-claude-config.js: switchrequire('../package.json')→require('../../package.json'), reuse the already-importedpkgfor.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--versionand the banner show the published package version.cli-tool/bin/)package.jsoninstead ofcli-tool/package.json; banner and.version()now sharepkg.version.--versionoutput reported in version output forclaude-code-templates1.28.16 is 1.28.13 #348.Written for commit d16faf6. Summary will update on new commits. Review in cubic