Skip to content

Commit 618671d

Browse files
authored
fix(project-list): add pagination and flexible target parsing (#221)
## Summary Fixes three bugs in `sentry project list`: - **No pagination** — showed "displaying 30 out of 100 projects" with no way to see the rest. Added `--cursor/-c` flag with a `last` magic value that resumes from where you left off. - **API pagination not followed** — setting `-n 200` still capped at 100 because the Sentry API paginates and we never followed cursor links. Added `orgScopedPaginateAll()` so `listProjects()` transparently fetches all pages. - **`project list sentry/sentry`** said "No projects found in organization 'sentry/sentry'" — now uses `parseOrgProjectArg()` (same as `issue list`) to handle `org/project`, `org/`, and bare-word targets. ## Changes ### `src/lib/api-client.ts` — Pagination infrastructure - `PaginatedResponse<T>` type, `parseLinkHeader()`, `orgScopedRequestPaginated()`, `orgScopedPaginateAll()` - `listProjects()` now auto-paginates transparently (all 6 callers unchanged) - New `listProjectsPaginated()` for explicit single-page fetches with cursor control ### `src/commands/project/list.ts` — Rewritten command - 4 target modes: `auto-detect`, `explicit` (org/project), `org-all` (org/), `project-search` (bare slug) - `--cursor/-c` flag with `last` magic value for easy page navigation - JSON output returns `{ data, nextCursor?, hasMore }` in paginated mode ### `src/lib/db/schema.ts` — Schema v6 - Added `pagination_cursors` table for cursor caching ### `src/lib/db/pagination.ts` — New module - Cursor cache with TTL (default 5 min) and context validation ### Tests - Updated `test/e2e/project.test.ts` and `test/e2e/multiregion.test.ts` for new `org/` syntax and paginated JSON format
1 parent 395aede commit 618671d

File tree

16 files changed

+2955
-223
lines changed

16 files changed

+2955
-223
lines changed

plugins/sentry-cli/skills/sentry-cli/SKILL.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ sentry org view my-org -w
136136

137137
Work with Sentry projects
138138

139-
#### `sentry project list <org>`
139+
#### `sentry project list <target>`
140140

141141
List projects
142142

143143
**Flags:**
144144
- `-n, --limit <value> - Maximum number of projects to list - (default: "30")`
145145
- `--json - Output JSON`
146+
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
146147
- `-p, --platform <value> - Filter by platform (e.g., javascript, python)`
147148

148149
**Examples:**
@@ -600,13 +601,14 @@ List organizations
600601

601602
List projects
602603

603-
#### `sentry projects <org>`
604+
#### `sentry projects <target>`
604605

605606
List projects
606607

607608
**Flags:**
608609
- `-n, --limit <value> - Maximum number of projects to list - (default: "30")`
609610
- `--json - Output JSON`
611+
- `-c, --cursor <value> - Pagination cursor (use "last" to continue from previous page)`
610612
- `-p, --platform <value> - Filter by platform (e.g., javascript, python)`
611613

612614
### Repos

0 commit comments

Comments
 (0)