Skip to content

feat: Add --version flag - #4

Merged
razor-x merged 1 commit into
mainfrom
claude/wizard-version-command-9vj6q0
Jul 29, 2026
Merged

feat: Add --version flag#4
razor-x merged 1 commit into
mainfrom
claude/wizard-version-command-9vj6q0

Conversation

@razor-x

@razor-x razor-x commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds support for the --version flag 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

  • New prepack.ts script: Automatically injects the package version from package.json into src/lib/version.ts and recompiles it using a dedicated TypeScript configuration before packing
  • New src/lib/version.ts module: Exports the wizard version, initialized with a 0.0.0 placeholder that gets replaced during the pack process
  • Version flag support: Added --version and -v alias flags to the wizard CLI that display the version and exit without running the app
  • Updated help text: Modified usage documentation to include the new --version flag option
  • Test coverage: Added three new tests verifying --version and -v flags work correctly and don't run the app
  • Build configuration: Added tsconfig.prepack.json for selective compilation of just the version module during packing
  • Package.json: Added prepack npm script hook and execa dependency for executing the version injection

Implementation Details

The version injection approach uses a placeholder pattern: src/lib/version.ts ships with a hardcoded '0.0.0' string that the prepack.ts script replaces with the actual version from package.json before 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

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
razor-x marked this pull request as ready for review July 29, 2026 02:54
@razor-x razor-x changed the title Add --version flag support with version injection at pack time feat: Add --version flag support with version injection at pack time Jul 29, 2026
@razor-x razor-x changed the title feat: Add --version flag support with version injection at pack time feat: Add --version flag Jul 29, 2026
@razor-x
razor-x merged commit 91aae71 into main Jul 29, 2026
11 checks passed
@razor-x
razor-x deleted the claude/wizard-version-command-9vj6q0 branch July 29, 2026 02:55
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.

2 participants