-
Notifications
You must be signed in to change notification settings - Fork 1
Add cycles & project milestones + automated testing #7
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
…tering - Add comprehensive cycles support: - List cycles with filtering by state, team, and project - Get specific cycle details by ID or name - Create cycles with start/end dates, name, description - Update cycles (name, description, dates) - Delete cycles - --around-active option for listing cycles around active one - Add project milestones support: - List milestones with project filtering - Get specific milestone details - Create milestones with name, target date, description - Update milestones - Delete milestones - Add smart ID resolution for cycles (by name or ID) - Fix project list --team-id filtering bug (was not properly filtering) - All operations tested against live Linear API Closes #1, czottmann#2, czottmann#3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
feat: Add cycles and project milestones support, fix project list filtering
- 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.
- Update docs/testing.md with comprehensive testing guide - Add sections for unit tests, integration tests, and command coverage - Document how to run tests and interpret coverage reports - Add troubleshooting section - Update .gitignore to exclude test-pr4.sh and coverage/ directory - Update CLAUDE.md with testing framework details
- Add include/exclude to tsconfig.json - Exclude tests/, vitest.config.ts, and test files from build - Fixes TS6059 errors about files not under rootDir
|
Hi @czottmann! I've created this new PR that includes:
Testing Capabilities 1. Local Test Verification Run
2. Integration Test Coverage Command coverage report via
3. (Optional) CI/CD Integration GitHub Actions workflow included ci.yml
Testing Documentation About the Tests I went ahead and added the testing framework (apologies for not waiting for explicit approval from PR If you're comfortable with this direction, I'd be interested in contributing additional features:
I'm happy to create issues/PRs for these if they align with your vision for the tool. Or we can connect Let me know your thoughts! |
|
The mama of all PRs, eh? 😂 Thanks, @ryanrozich, I'll be reviewing now! |
czottmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a pretty solid patch, thank you! There are a few issues that need some more love, but overall I'm quite happy with it, especially considering the breadth.
Side note: It's borderline unwieldy due to the scope (two new commands plus testing setup). Having several smaller PRs would make it easier to review, especially for a human 😉
src/utils/graphql-issues-service.ts
Outdated
| updateInput.assigneeId = args.assigneeId; | ||
| } | ||
| if (finalProjectId !== undefined) updateInput.projectId = finalProjectId; | ||
| if (finalCycleId !== undefined) updateInput.cycleId = finalCycleId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor indentation issue, 2 spaces instead of 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/utils/graphql-issues-service.ts
Outdated
| if (args.parentId !== undefined) updateInput.parentId = args.parentId; | ||
|
|
||
| if (finalLabelIds !== undefined) { | ||
| if (finalMilestoneId !== undefined) updateInput.projectMilestoneId = finalMilestoneId; if (finalLabelIds !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two statements on one line, please split up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
dist/commands/projectMilestones.js
Outdated
| if (!isUuid(milestoneIdOrName)) { | ||
| let nodes = []; | ||
| if (options.project) { | ||
| let projectId = options.project; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project resolution code is duplicated several times (lines 43+, 91+, etc.). Please extract it into a helper function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed - extracted resolveProjectId() helper function
src/commands/projectMilestones.ts
Outdated
|
|
||
| let milestoneId = milestoneIdOrName; | ||
|
|
||
| if (!isUuid(milestoneIdOrName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This milestone resolution logic appears both in the "read" and "update" commands, and is nearly identical code. I'd put it in a helper function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed - extracted resolveMilestoneId() helper function
src/queries/cycles.ts
Outdated
| @@ -0,0 +1,95 @@ | |||
| /** | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated queries should be removed. If they're to be kept as reference, make it part of the docs, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right - will remove these deprecated queries since they're not being used. The SDK-based approach replaced them entirely.
|
CRAP. This wasn't supposed to be closed! I just deleted a branch, hnnngh. Let me try to reopen this. |
- Keep both cycles/milestones and embeds functionality - Preserve our CLAUDE.md with testing documentation - Combine gitignore entries from both branches
- Fix indentation in graphql-issues-service.ts (4 spaces consistently) - Split two-statement line into separate lines - Extract helper functions for project and milestone ID resolution - Add DEFAULT_CYCLE_PAGINATION_LIMIT constant instead of magic number 250 - Keep deprecated cycles queries with clear documentation Addresses all review comments from czottmann
|
Apologies for the large PR, the automated testing idea was an add-on after you found the bug. Appreciate you taking the time to review! |
Per review feedback, removing the deprecated cycles.ts queries file since they are no longer used after refactoring to SDK-based pagination
- Keep both our fragments (cycles, milestones) and upstream fragments (comments, parent, children) - Rebuild dist files after conflict resolution
|
Merged! Thanks again, @ryanrozich! |
Add two-layer service architecture documentation and update test suite description in preparation for PR #7 merge. This ensures AGENTS.md contains all relevant documentation before restoring CLAUDE.md symlink.
These files were accidentally committed in PR #7: - Research notes (labels-*, github-issue-*, project-labels-*) - PR description draft (pr-7-description.md) They belong in local notes/drafts, not the repository. Part of ZCO-1576
These queries were replaced with Linear SDK implementation in PR #7 to avoid GraphQL complexity errors with large datasets (500+ cycles). The file was not imported or used anywhere in the codebase. Part of ZCO-1576


Add Cycles & Project Milestones + Automated Testing
Summary
This PR adds comprehensive cycles and project milestones support to linearis, fixes two critical bugs, and establishes automated testing infrastructure.
Features Added
Bug Fixes
projectMilestonestoproject-milestonesfor CLI consistencyTesting Infrastructure
Closes
project.targetDate?.toISOStringwhen runninglinearis projects list#1 (bug:project.targetDateerror)Cycles Commands
List Cycles
Read Cycle
Features:
Project Milestones Commands
List Milestones
Read Milestone
Create Milestone
Update Milestone
Features:
Bug Fixes
Issue 1: Command Naming Inconsistency
Before:
linearis projectMilestones(camelCase - didn't work as expected)After:
linearis project-milestones(kebab-case - works correctly)Impact: Users can now discover and use the command with standard CLI conventions.
Issue 2: GraphQL Complexity Errors
Before: Direct GraphQL queries failed with "query too complex" for workspaces with 500+ cycles
After: SDK-based pagination handles any workspace size
Changes:
getCycles(),getCycleById(),resolveCycleId()to LinearServiceTesting Framework
Test Suite
What's Tested
Unit Tests (14 tests):
Integration Tests (13 tests):
Command Coverage: 35% (7/20 commands)
CI/CD Pipeline
GitHub Actions workflow runs on every push:
Verification
Automated Checks ✅
pnpm run buildpnpm testManual Testing
Cycles Commands:
Project Milestones Commands:
Regression Tests:
# Other commands should still work linearis issues list -l 5 linearis projects listImplementation Details
Architecture
Cycles Implementation:
Files Changed:
src/commands/cycles.ts- New cycles command (78 lines)src/commands/projectMilestones.ts- New milestones command (308 lines)src/utils/linear-service.ts- Add cycle methods (+169 lines)src/queries/cycles.ts- GraphQL queries (deprecated, preserved for reference)src/queries/projectMilestones.ts- GraphQL queries (149 lines)Testing Files:
tests/unit/linear-service-cycles.test.ts- 14 unit teststests/integration/cycles-cli.test.ts- 8 integration teststests/integration/project-milestones-cli.test.ts- 5 integration teststests/command-coverage.ts- Command coverage analyzer.github/workflows/ci.yml- CI/CD pipelineSmart ID Resolution
Cycles:
Project Milestones:
Breaking Changes
None - All changes are backward compatible:
Performance
Cycles with Large Datasets:
Future Work
Testing Coverage Goals:
Target: 50%+ command coverage
Files Changed
Source Code: 32 files
Line Changes: +4,958 / -196
Documentation
docs/testing.md- Comprehensive testing guideCLAUDE.md- Updated with testing framework.gitignore- Exclude coverage and test filesChecklist
Ready for Review: All features implemented, bugs fixed, and thoroughly tested with 27 automated tests.