fix(cli): use dynamic version from package.json and improve dev workflow#43
Merged
aridyckovsky merged 8 commits intomainfrom Nov 8, 2025
Merged
fix(cli): use dynamic version from package.json and improve dev workflow#43aridyckovsky merged 8 commits intomainfrom
aridyckovsky merged 8 commits intomainfrom
Conversation
- Add getPackageMeta to public API for reading package version - Export PackageMeta interface - Enables CLI and other consumers to read toolVersion dynamically
…ptions - Import getPackageMeta from @effect-migrate/core - Read toolVersion dynamically instead of hardcoded '0.1.0' - Add HelpDoc and Span for CLI configuration - Add executable, summary, and footer options to Command.run - Wrap in Effect.gen for proper Effect composition - Add catchAll for fatal error handling with exit code 1
- Add 'pnpm cli' script that runs CLI from source using tsx - Enables testing local changes without rebuilding - Usage: pnpm cli audit --config myfile.json
- Update root README.md with pnpm cli usage examples - Update packages/cli/README.md with local development section - Update AGENTS.md with recommended CLI development workflow - Update packages/cli/AGENTS.md troubleshooting section - Emphasize 'pnpm cli' as recommended approach (no build needed) - Document alternative methods (built version, global link)
Amp-Thread-ID: https://ampcode.com/threads/T-3cdeac4e-ff15-4d90-bb85-0426185e695c Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-d64ed10b-e989-4b98-8519-14ff20375c5e Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-d64ed10b-e989-4b98-8519-14ff20375c5e Co-authored-by: Amp <amp@ampcode.com>
Merged
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.
What
Fixes CLI version display bug, adds development workflow improvement, and updates documentation to match current architecture.
Why
Issue 1: CLI version bug
Issue 2: Development friction
pnpm build) after every change to test, slowing iterationIssue 3: Outdated documentation
Scope
Packages affected:
@effect-migrate/core- AddedgetPackageMetaservice@effect-migrate/cli- Updated to use dynamic versionpnpm cliscriptFiles changed:
packages/core/src/amp/package-meta.ts- New getPackageMeta servicepackages/core/src/index.ts- Export getPackageMeta and PackageMetapackages/cli/src/index.ts- Use dynamic version, enhance CLI configpackage.json- Add 'cli' scriptAGENTS.md- Update development workflow and directory structurepackages/cli/AGENTS.md- Update CLI patterns and directory structureChanges
1. Added
getPackageMetaEffect service to coreCreated
packages/core/src/amp/package-meta.tswith:PackageMetainterface exposingtoolVersionandschemaVersiongetPackageMetaEffect that reads package.json at runtimeKey features:
2. Exported from core public API
Updated
packages/core/src/index.ts:3. Updated CLI to use dynamic version with Effect composition
Changed
packages/cli/src/index.tsfrom imperative style to proper Effect composition:Before:
After:
Improvements:
4. Added 'pnpm cli' development script
Added to root
package.json:{ "scripts": { "cli": "tsx packages/cli/src/index.ts" } }Benefits:
5. Updated AGENTS.md documentation
Root AGENTS.md:
pnpm cliusagepackages/cli/AGENTS.md:
Testing
Version display verification:
pnpm cli --version # ✓ Shows: 0.4.0 (correct, from package.json)Development workflow:
All checks passing:
pnpm build:types ✓ pnpm typecheck ✓ pnpm lint ✓ pnpm build ✓ pnpm test ✓Backward Compatibility
getPackageMetais additive to core public APIChangeset
Checklist
Agent Context (for AI agents)
Implementation approach:
Effect patterns used:
Effect.genfor sequential operations with dependenciesFileSystem.FileSystemandPath.Pathservices from @effect/platformEffect.catchAllfor top-level error handlingNodeContext.layerCommit structure (6 granular commits):
feat(core): add getPackageMeta service for dynamic version loadingfeat(cli): use dynamic version from package.json and add CLI config optionschore: add 'cli' script for local developmentdocs: update development workflow to use 'pnpm cli' commandchore: fix formattingdocs: update AGENTS.md directory structure and CLI patternsAmp Thread(s):
Estimated Review Time
Medium (15-30 minutes) - Multiple packages affected, documentation updates