Skip to content

Conversation

@pyramation
Copy link
Contributor

feat(cli): add lql version command for semver bumping and tagging

Summary

This PR adds a new lql version CLI command that allows users to bump package versions using semantic versioning and automatically creates corresponding tags. The command:

  • Prompts users to select a semver bump type (major, minor, patch)
  • Updates the package.json version field in the target module
  • Creates a corresponding git tag using LaunchQLPackage.addTag() to keep versions and tags in sync
  • Supports both workspace and individual module contexts
  • Follows established CLI patterns from the existing tag command

Files Changed:

  • packages/cli/src/commands.ts - Added version command import and registration
  • packages/cli/src/commands/version.ts - New command implementation
  • packages/cli/package.json - Added semver dependency

Review & Testing Checklist for Human

⚠️ HIGH PRIORITY - This implementation was not fully tested due to build system issues:

  • End-to-end testing: Test the command in a working LaunchQL workspace/module environment to ensure it actually runs without errors
  • Package.json integrity: Verify that package.json files are updated correctly and maintain proper formatting/structure after version bumps
  • Tag creation verification: Confirm that LaunchQLPackage.addTag() properly creates tags and they appear in the plan file as expected
  • Semver calculations: Test all three bump types (major, minor, patch) with various starting versions to ensure semver library integration works correctly
  • Context handling: Test the command in both workspace and individual module contexts to verify proper package selection logic

Recommended Test Plan:

  1. Navigate to a test LaunchQL module with an existing version in package.json
  2. Run lql version and select each bump type (patch, minor, major)
  3. Verify package.json version updates and tags are created correctly
  4. Test in workspace context with multiple packages
  5. Test error cases (missing package.json, invalid versions, etc.)

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    Commands["packages/cli/src/commands.ts"]:::minor-edit
    VersionCmd["packages/cli/src/commands/version.ts"]:::major-edit
    TagCmd["packages/cli/src/commands/tag.ts"]:::context
    LaunchQLPkg["@launchql/core<br/>LaunchQLPackage"]:::context
    PackageJson["package.json<br/>(target module)"]:::context
    PlanFile["launchql.plan<br/>(target module)"]:::context
    
    Commands -->|imports and registers| VersionCmd
    VersionCmd -->|follows patterns from| TagCmd
    VersionCmd -->|uses addTag method| LaunchQLPkg
    VersionCmd -->|reads/writes version| PackageJson
    LaunchQLPkg -->|creates tags in| PlanFile
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

⚠️ Important: The build system had widespread TypeScript module resolution errors during development, preventing full end-to-end testing. The implementation uses require('semver') instead of ES6 imports due to type definition issues. While the code follows established patterns from the tag command, thorough manual testing is essential before merging.

The command implementation closely mirrors the existing tag command structure for consistency, including package selection logic, error handling, and support for both workspace and module contexts.

Session Info:

- Add new version command to CLI command map
- Implement version.ts with semver bump prompts (major/minor/patch)
- Update package.json version and create corresponding tag
- Follow existing CLI patterns from tag command
- Add semver dependency for version calculations

Co-Authored-By: Dan Lynch <[email protected]>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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