-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add cycles and project milestones support, fix project list filtering #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…and --around-active; closes czottmann#2 czottmann#3
|
Thanks, @ryanrozich, that's mighty kind of you! I currently review the PR, and it compiles – but while I see a Also, I've a ton of cycles by now, and the command errors out: I suspect this has nothing to do with the amount of cycles but the query as such (nested queries?). |
|
@ryanrozich Would you mind following up, please? |
|
I'm on it will get fixed today thanks! |
|
@czottmann I've got a fix that I've tested with a shell script to exercise the commands, would you be ok with me converting these to a vitest configuration in this project for automated testing? And if so are you ok with me adding it to this PR? |
- Change command from camelCase to kebab-case - Aligns with CLI naming conventions - Fixes user confusion when command appears "missing" fix: refactor cycles commands to use LinearService with SDK pagination - Add getCycles(), getCycleById(), resolveCycleId() to LinearService - Replace raw GraphQL queries with SDK-based implementation - Enables automatic pagination to avoid Linear's 10,000 complexity limit - Reduces cycles.ts from 135 lines to 78 lines - Maintains all existing functionality (--team, --active, --around-active) - Deprecate unused GraphQL query definitions These changes fix the two issues identified in PR czottmann#4: 1. Command naming inconsistency 2. GraphQL complexity errors with large cycle histories
Add comprehensive testing infrastructure: **Testing Framework:** - Add Vitest as test runner (fast, TypeScript-friendly, ESM support) - Add @vitest/coverage-v8 for code coverage reports - Add @vitest/ui for interactive test UI - Configure vitest.config.ts with proper paths and coverage settings **Unit Tests:** - Add tests/unit/linear-service-cycles.test.ts (14 tests) - Test getCycles(), getCycleById(), resolveCycleId() methods - Use mocks to avoid API calls - Verify PR czottmann#4 cycle methods work correctly **Integration Tests:** - Add tests/integration/cycles-cli.test.ts (8 tests) - Add tests/integration/project-milestones-cli.test.ts (5 tests) - Test end-to-end CLI functionality - Verify no "query too complex" errors (main bug fix) - Test all command flags and JSON output structure - Auto-skip if LINEAR_API_TOKEN not set **Command Coverage Tool:** - Add tests/command-coverage.ts for CLI-specific coverage analysis - Shows which commands have integration tests (more relevant than code coverage) - Automatically discovers new commands and tests - Reports: 35% of commands tested (cycles and project-milestones fully covered) **CI/CD:** - Add .github/workflows/ci.yml for automated testing - Run tests on every push and PR - Separate jobs for testing and linting - Optional integration tests if LINEAR_API_TOKEN secret configured **Scripts:** - pnpm test - Run all tests - pnpm test:watch - Run tests in watch mode - pnpm test:ui - Run tests with UI - pnpm test:coverage - Generate code coverage report - pnpm test:commands - Show command coverage report **Test Results:** - All 27 tests passing - Unit tests: 14 passed (instant, no API) - Integration tests: 13 passed (~15 seconds with API) - Command coverage: 35% (7/20 commands tested) - Cycles and project-milestones commands fully covered This establishes automated testing practices for the linearis project and prevents regressions in PR czottmann#4 fixes.
|
Closing in favor of PR #7 (#7) which includes all these changes plus critical bug fixes and automated testing infrastructure.
All features from this PR are included in PR #7 with additional improvements. |
Summary
This PR adds comprehensive support for Linear cycles and project milestones, and fixes a bug with project list filtering.
New Features
Cycles Support
Commands:
linearis cycles list- List all cycles with filtering options--state <state>- Filter by state (planned, started, completed, canceled)--team-id <id>- Filter by team--project-id <id>- Filter by project--around-active- Show cycles around the currently active onelinearis cycles get <id|name>- Get details for a specific cyclelinearis cycles create- Create a new cycle--name <name>- Cycle name (required)--team-id <id>- Team ID (required)--starts-at <date>- Start date (ISO format)--ends-at <date>- End date (ISO format)--description <text>- Cycle descriptionlinearis cycles update <id|name>- Update an existing cycle--name <name>- New name--starts-at <date>- New start date--ends-at <date>- New end date--description <text>- New descriptionlinearis cycles delete <id|name>- Delete a cycleProject Milestones Support
Commands:
linearis project-milestones list- List all project milestones--project-id <id>- Filter by projectlinearis project-milestones get <id>- Get details for a specific milestonelinearis project-milestones create- Create a new milestone--name <name>- Milestone name (required)--project-id <id>- Project ID (required)--target-date <date>- Target date (ISO format)--description <text>- Milestone descriptionlinearis project-milestones update <id>- Update an existing milestone--name <name>- New name--target-date <date>- New target date--description <text>- New descriptionlinearis project-milestones delete <id>- Delete a milestoneSmart ID Resolution
The CLI now supports smart resolution for cycles:
abc123-def456-..."Sprint 24"- automatically resolves to the cycle IDBug Fixes
linearis projects list --team-idfiltering - previously the team filter was not being applied correctly to the GraphQL queryTesting
All operations have been tested against a live Linear workspace to ensure they work correctly:
Closes
Closes #1
Closes #2
Closes #3