fix(cli): use dynamic version from package.json and improve dev workflow #43
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