feat(cli): extract CLI functionality into standalone package#142
Merged
willgriffin merged 15 commits intomainfrom Oct 31, 2025
Merged
feat(cli): extract CLI functionality into standalone package#142willgriffin merged 15 commits intomainfrom
willgriffin merged 15 commits intomainfrom
Conversation
Extract CLI functionality from @happyvertical/smrt-core into a new @happyvertical/smrt-cli package with automatic manifest discovery and new introspection commands. **New CLI Package:** - Created standalone @happyvertical/smrt-cli package - Moved CLIGenerator and all command implementations from core - Added tar dependency to CLI (removed from core) - Configured TypeScript project references - Built with Vite for optimal tree-shaking **New Features:** - Auto-discovery of SMRT object manifests from project and node_modules - `smrt introspect` command for project analysis (verbose mode available) - `smrt test` command with guidance for test manifest generation - Discovery finds manifests in dist/, src/manifest/, and other locations **Core Package Cleanup:** - Removed CLI binary and all CLI command implementations - Removed tar dependency (now only in CLI package) - Clean separation between framework (core) and tooling (CLI) **Benefits:** - Independent versioning for CLI and core - Reduced core dependencies - Better discoverability with introspect command - Each package has focused responsibility **Testing:** - CLI tested in profiles package - Introspect successfully discovers 7 objects - Both normal and verbose modes working Related to #135
- Generate test manifests using ASTScanner and ManifestGenerator - Scan src/**/*.test.ts and src/**/*.spec.ts files - Create both JSON manifest and TypeScript stub - Optionally run vitest after manifest generation - Replace guidance-only implementation with actual functionality Addresses user feedback to make smrt test functional instead of informational.
- Update CLI_EXTRACTION_SUMMARY.md with actual smrt test functionality - Update packages/cli/README.md with test command details - Document --manifest-only and --output options - Reflect actual scanner-based implementation
Contributor
Author
Update: Implemented Full
|
- Adds prepare script that builds dist/ if it doesn't exist - Fixes CI failure where pnpm install tries to link smrt-prebuild binary before dist/ is built - Only builds when necessary (dist/ missing) to avoid slowing down local development
- Explains purpose of smrt vs smrt-prebuild CLIs - Documents why both are needed (developer tool vs build-time utility) - Adds example usage for smrt-prebuild in build scripts - Clarifies that separation is intentional, not accidental
The prepare script was attempting to build during pnpm install, but workspace dependencies weren't available yet, causing module resolution failures in CI. Turborepo already handles build ordering correctly, so the prepare script is unnecessary. The smrt-prebuild binary will be available after the main build step.
Replace custom generate-test-manifest.js script with standardized 'smrt test --manifest-only' command. Benefits: - Consistent test manifest generation across all packages - One implementation to maintain (in CLI package) - Better UX with configurable output directory - Matches exact behavior of previous custom script The smrt test command was designed based on this package's script, so behavior is identical.
- Mark CI fix and profiles migration as completed - Update future enhancements to reflect current state - Remove outdated note about smrt test needing enhancement
- Add @happyvertical/smrt-cli as devDependency in profiles package - Externalize @happyvertical/smrt-core/scanner in CLI vite config to prevent bundling issues - Add fallback for output option default value in test command - Update pnpm lockfile with new dependency - Regenerate test manifests for core and profiles packages Profiles package now successfully uses 'smrt test --manifest-only' command.
Ensures the workspace binary is found in CI environments where PATH may not include node_modules/.bin
npx works more reliably with workspace binaries in CI
Changes pretest script from 'npx smrt test --manifest-only' to 'node ../cli/dist/index.js test --manifest-only'. This bypasses all PATH and binary resolution issues (npx, pnpm exec) that were causing CI failures. Relies on Turborepo to ensure CLI is built before profiles tests run via test->build dependency.
- Change './cli.js' to './cli-generator.js' (3 occurrences) - Remove test that imports non-existent '../test-utils.js' - All CLI tests now pass (119 passing)
8 tasks
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
Extracted CLI functionality from
@happyvertical/smrt-coreinto a new standalone@happyvertical/smrt-clipackage with automatic manifest discovery and new introspection commands.This achieves clean separation between framework code (core) and developer tooling (CLI), reduces core dependencies, and provides better discoverability through the new
smrt introspectcommand.Changes
New CLI Package (
packages/cli/)@happyvertical/smrt-clipackageCLIGeneratorand all command implementations from coretardependency to CLI (removed from core)New Features
Manifest Discovery System:
dist/manifest.json,dist/static-manifest.js,src/manifest/, etc..jsand.jsonmanifest formatssmrt introspectCommand:--verboseflag for detailed field informationinspect,infosmrt testCommand:Core Package Cleanup
dist/generators/cli.js)src/cli/directory with command implementationssrc/generators/cli.tsandcli.spec.tstardependency from package.jsongenerators/index.tsDocumentation
CLI_EXTRACTION_SUMMARY.mdREADME.mdto list CLI packagepackages/cli/README.mdwith usage examples and manifest discovery detailsTesting
Build Status:
@happyvertical/smrt-clibuilds without errors@happyvertical/smrt-corebuilds without errorsRuntime Testing:
Discovery Path Fix:
dist/manifest.jsonanddist/static-manifest.jsto search pathssrc/manifest/and root, missing build artifactsBenefits
tarremoved from coresmrt introspectsolves the discovery problem from Issue Implement 'smrt test' CLI command for test manifest generation #135Breaking Changes
smrtbinary from@happyvertical/smrt-coremust now install@happyvertical/smrt-cli.Migration:
{ "devDependencies": { "@happyvertical/smrt-cli": "^0.6.0" } }Then use:
Related Issues
Related to #135 (partially addresses the discovery problem with
smrt introspect)Checklist