Skip to content

feat(pagination): add cursor-based pagination to all list commands#53

Merged
iamfj merged 11 commits intonextfrom
feat/cursor-pagination
Feb 20, 2026
Merged

feat(pagination): add cursor-based pagination to all list commands#53
iamfj merged 11 commits intonextfrom
feat/cursor-pagination

Conversation

@iamfj
Copy link
Collaborator

@iamfj iamfj commented Feb 20, 2026

What

  • Forward cursor-based pagination (--after <cursor>) on all list commands
  • Wrapped output format: { nodes, pageInfo } for all list commands (breaking change)
  • --limit option added to teams, users, labels, cycles (previously hardcoded)
  • Shared parseLimit() helper with consistent NaN/negative validation
  • PageInfo type derived from codegen (no drift)
  • Full service test coverage (13/13 services now have tests)

Why

Details

GraphQL layer

  • Added $after: String variable and pageInfo { hasNextPage endCursor } to all 10 list queries
  • Nested connections (e.g., issues inside cycles) left untouched

Service layer

  • All 9 list functions accept PaginationOptions and return PaginatedResult<T>
  • Null-safety aligned for pageInfo in milestone and document services

Command layer

  • --after <cursor> on all 8 list commands
  • --limit added where missing (teams, users, labels, cycles)
  • --window + --after rejected in cycles (incompatible)
  • documents list --issue wrapped in PaginatedResult for consistency
  • parseLimit() replaces 9 bare parseInt calls

Testing

  • 203 tests passing (up from 143)
  • 8 new service test files with full coverage
  • Pagination-specific tests: cursor passthrough, default limits, pageInfo shape

Breaking Change

All list commands now output { "nodes": [...], "pageInfo": { "hasNextPage": bool, "endCursor": string|null } } instead of flat arrays.

Checklist

  • Main feature implemented
  • Tests written and passing (203/203)
  • Documentation updated (USAGE.md regenerated)
  • Code review ready

Resolves iamfj#11

iamfj and others added 11 commits February 20, 2026 13:15
Add $after variable and pageInfo { hasNextPage endCursor } selection
to all 10 list queries for cursor-based pagination support.
Add PageInfo, PaginatedResult<T>, and PaginationOptions types to
src/common/types.ts.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
Accept PaginationOptions with optional after cursor. Return
{ nodes, pageInfo } instead of flat arrays.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
…nt services

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
Wire all list commands to updated service signatures that accept
PaginationOptions and return PaginatedResult.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
Local filtering makes server pageInfo misleading. Set hasNextPage
to false since cursor pagination is incompatible with --window.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
…ases

Fix existing tests for new PaginationOptions signatures and
PaginatedResult return types. Add cursor passthrough and pageInfo
assertions.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
…ct --window with --after

Ensure documents list --issue returns { nodes, pageInfo } like all
other list commands. Prevent --after with --window in cycles since
local filtering is incompatible with cursor pagination.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
Ties PageInfo to the GraphQL schema instead of maintaining a
separate interface that could drift from the generated types.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
…dation

Replace 9 unvalidated parseInt calls across 7 command files with a
shared parseLimit() that rejects NaN and non-positive values.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
…stone services

Cover all public functions with happy path and error cases.
Include pagination-specific assertions for all list functions.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
Cover createComment with success and failure cases. Cover FileService
download and upload with happy paths and error conditions.

Co-Authored-By: claude-opus-4-6 <noreply@anthropic.com>
@iamfj iamfj added the enhancement New feature label Feb 20, 2026
@iamfj iamfj merged commit 50dab1a into next Feb 20, 2026
2 checks passed
@iamfj iamfj mentioned this pull request Feb 20, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments