Skip to content

jtk: Add pagination and lightweight fields to issues list/search#168

Merged
piekstra merged 1 commit intomainfrom
piekstra/jtk-pagination-and-lightweight-fields
Feb 24, 2026
Merged

jtk: Add pagination and lightweight fields to issues list/search#168
piekstra merged 1 commit intomainfrom
piekstra/jtk-pagination-and-lightweight-fields

Conversation

@piekstra
Copy link
Contributor

@piekstra piekstra commented Feb 24, 2026

Summary

  • Always paginate: issues list and issues search now return a single page of results (default 25) with cursor-based pagination metadata, instead of fetching all matching issues at once
  • Lightweight fields by default: List/search results exclude the description field (which can be ~24K chars per issue due to ADF), reducing output from ~746K to ~43K for 25 issues
  • --full flag: Opt-in to include all fields (description, reporter, components, parent) when needed
  • --next-page-token flag: Fetch subsequent pages using the cursor token from the previous response

Details

The Jira /search/jql endpoint uses cursor-based pagination (nextPageToken/isLast), not offset-based. Updated Search() and SearchAll() to use cursor-based pagination, and added a new SearchPage() method that returns a single page with pagination metadata.

New types: JQLSearchResult, SearchPageOptions, PaginatedIssues, PaginationInfo. The existing SearchResult type (used by the Agile API) is unchanged.

Test plan

  • go build ./...
  • go test ./...
  • jtk issues list --project MON --output json — returns page of 25, no description, with pagination metadata
  • jtk issues list --project MON --next-page-token <token> — fetches next page
  • jtk issues list --project MON --full --max 5 --output json — includes description
  • jtk issues search --jql "project = MON" --output json — same pagination behavior

- Use cursor-based pagination (nextPageToken/isLast) matching Jira's
  /search/jql endpoint instead of the deprecated offset-based approach
- Add SearchPage() for single-page fetches with pagination metadata
- Add JQLSearchResult type for the cursor-based /search/jql response
- Add ListSearchFields (excludes description) for compact list output
- Default page size 25, with --next-page-token for subsequent pages
- Add --full flag to include all fields when needed
- JSON output always wrapped with pagination metadata
- Reduces typical list output from ~746K to ~43K characters
@piekstra piekstra merged commit 0204304 into main Feb 24, 2026
7 checks passed
@piekstra piekstra deleted the piekstra/jtk-pagination-and-lightweight-fields branch February 24, 2026 21:43
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.

1 participant