feat: Add --version flag - #4
Merged
Merged
Conversation
Report the package version with '--version' and the '-v' alias, using the same version injection the Seam CLI uses: 'src/lib/version.ts' ships a '0.0.0' placeholder that 'prepack.ts' replaces with the version from 'package.json' on 'npm pack', recompiling just that module with 'tsconfig.prepack.json'. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012cVGBZBJwZygoowCb9Ksp9
razor-x
marked this pull request as ready for review
July 29, 2026 02:54
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.
Summary
This PR adds support for the
--versionflag to the wizard CLI and implements a version injection system that replaces a placeholder with the actual package version when the package is packed.Key Changes
prepack.tsscript: Automatically injects the package version frompackage.jsonintosrc/lib/version.tsand recompiles it using a dedicated TypeScript configuration before packingsrc/lib/version.tsmodule: Exports the wizard version, initialized with a0.0.0placeholder that gets replaced during the pack process--versionand-valias flags to the wizard CLI that display the version and exit without running the app--versionflag option--versionand-vflags work correctly and don't run the apptsconfig.prepack.jsonfor selective compilation of just the version module during packingprepacknpm script hook andexecadependency for executing the version injectionImplementation Details
The version injection approach uses a placeholder pattern:
src/lib/version.tsships with a hardcoded'0.0.0'string that theprepack.tsscript replaces with the actual version frompackage.jsonbefore packing. This ensures the version is only correct in packed/published packages, not in development clones, which is documented in the README.https://claude.ai/code/session_012cVGBZBJwZygoowCb9Ksp9