Commit 995fd40
feat(list): add pagination and consistent target parsing to all list commands (#262)
## Summary
Extends the pagination and flexible target parsing pattern introduced in
#221 for \`project list\` to all remaining list commands: \`issue
list\`, \`team list\`, \`repo list\`, \`trace list\`, and \`log list\`.
Also introduces a shared \`dispatchOrgScopedList\` infrastructure that
all four list commands now use.
## Changes
### Shared infrastructure
- **\`src/lib/arg-parsing.ts\`**: Added \`validateLimit(value, min,
max)\` — shared limit validation, replaces duplicate implementations in
\`trace/list.ts\` and \`log/list.ts\`
- **\`src/lib/resolve-target.ts\`**: Added \`resolveOrgsForListing()\`
(deduplicates identical logic from \`team/list.ts\` and
\`repo/list.ts\`), \`resolveOrgProjectTarget()\`, and
\`resolveOrgProjectFromArg()\` — replaces local
\`resolveTraceTarget\`/\`resolveLogTarget\` in trace/log commands
- **\`src/lib/api-client.ts\`**: Added \`listIssuesPaginated()\`,
\`listTeamsPaginated()\`, \`listRepositoriesPaginated()\`,
\`listProjectTeams()\` using \`orgScopedRequestPaginated()\` for
cursor-based pagination with Link header support
- **\`src/lib/org-list.ts\`**: New shared dispatch infrastructure —
\`ListCommandMeta\`, \`OrgListConfig\`, \`ModeHandlerMap\`,
\`dispatchOrgScopedList\` — all list commands use this
- **\`src/lib/list-command.ts\`**: Shared Stricli parameter constants
and \`buildOrgListCommand\` factory for simple org-scoped commands
### Command changes
| Command | What changed |
|---|---|
| \`issue list\` | Added \`--cursor/-c\` flag; org-all mode now uses
\`listIssuesPaginated\` and returns \`{ data, hasMore, nextCursor? }\`
in JSON output |
| \`team list\` | Full rewrite: 4-mode handler via
\`dispatchOrgScopedList\`, \`--cursor/-c\` flag, project-scoped team
listing via \`listProjectTeams\` for \`org/project\` mode |
| \`repo list\` | Full rewrite: 4-mode handler via
\`dispatchOrgScopedList\`, \`--cursor/-c\` flag, org-scoped fallback
with note for \`org/project\` mode |
| \`project list\` | Migrated to \`dispatchOrgScopedList\` with mode
overrides (no behavior change) |
| \`trace list\` | Replaced local \`resolveTraceTarget\` +
\`validateLimit\` with shared versions from \`resolve-target.ts\` /
\`arg-parsing.ts\` |
| \`log list\` | Replaced local \`resolveLogTarget\` + \`validateLimit\`
with shared versions from \`resolve-target.ts\` / \`arg-parsing.ts\` |
### Tests
- \`test/commands/team/list.test.ts\`: Covers all 4 modes including
project-scoped team listing and bare-slug project search
- \`test/commands/repo/list.test.ts\`: Covers all 4 modes including
bare-slug project search with org-scoped fallback
- \`test/lib/org-list.test.ts\`: 36 tests covering the shared dispatch
infrastructure
- \`test/e2e/issue.test.ts\`: Updated org-all JSON output assertion to
match new \`{ data, hasMore }\` shape
## Behavior notes
- **\`issue list\` org-all JSON output shape changed**: was a plain
array \`[...]\`, now \`{ data: [...], hasMore: bool, nextCursor?: string
}\` — consistent with \`project list\`
- **Target parsing convention**: org-all mode requires a trailing slash
(\`<org>/\`). A bare slug (no slash) is always treated as a project slug
and triggers a cross-org project search via \`findProjectsBySlug\` —
consistent across \`project list\`, \`issue list\`, \`team list\`, and
\`repo list\`
- **\`team list org/project\`**: fetches teams scoped to that project
(via \`listProjectTeams\` endpoint)
- **\`repo list org/project\`**: repos are org-scoped; shows all repos
in the org with a note that the project part is ignored
- All 1874 unit tests pass; typecheck and lint clean
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 7b1c9a9 commit 995fd40
File tree
27 files changed
+4736
-1218
lines changed- plugins/sentry-cli/skills/sentry-cli
- src
- commands
- issue
- log
- project
- repo
- team
- trace
- lib
- db
- formatters
- test
- commands
- issue
- project
- repo
- team
- trace
- e2e
- lib
- formatters
27 files changed
+4736
-1218
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
322 | 336 | | |
323 | 337 | | |
324 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| |||
433 | 434 | | |
434 | 435 | | |
435 | 436 | | |
436 | | - | |
| 437 | + | |
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
| 444 | + | |
443 | 445 | | |
444 | 446 | | |
445 | 447 | | |
446 | 448 | | |
447 | 449 | | |
448 | | - | |
| 450 | + | |
449 | 451 | | |
450 | 452 | | |
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
454 | 456 | | |
| 457 | + | |
455 | 458 | | |
456 | 459 | | |
457 | 460 | | |
| |||
581 | 584 | | |
582 | 585 | | |
583 | 586 | | |
584 | | - | |
| 587 | + | |
585 | 588 | | |
586 | | - | |
| 589 | + | |
| 590 | + | |
587 | 591 | | |
588 | 592 | | |
589 | 593 | | |
| |||
615 | 619 | | |
616 | 620 | | |
617 | 621 | | |
618 | | - | |
| 622 | + | |
619 | 623 | | |
620 | 624 | | |
621 | 625 | | |
622 | 626 | | |
623 | 627 | | |
624 | 628 | | |
| 629 | + | |
625 | 630 | | |
626 | 631 | | |
627 | 632 | | |
628 | 633 | | |
629 | 634 | | |
630 | | - | |
| 635 | + | |
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
634 | 639 | | |
635 | 640 | | |
636 | 641 | | |
| 642 | + | |
637 | 643 | | |
638 | 644 | | |
639 | 645 | | |
| |||
0 commit comments