Skip to content

Commit 629012c

Browse files
BYKbetegonclaudegithub-actions[bot]
authored
refactor(list): align all list commands to issue list standards (#453)
## Summary Aligns all `list` subcommands to the standards established by `sentry issue list`. ### Key Changes 1. **`sentry log list` — trace-id as positional arg** - Removed `--trace` flag entirely - Accept trace-id positionally: `sentry log list <trace-id>`, `sentry log list <org>/<trace-id>` - Added `parseLogListArgs()` with `isTraceId()` disambiguation (32-char hex → trace mode, otherwise project mode) - Added `--period` / `-t` flag (default `90d`, trace mode auto-uses `14d`) - JSON output now returns `{ data, hasMore }` envelope instead of flat array 2. **`withProgress` spinner in all list commands** - `trace list`, `span list`, `trace logs`, `org list`, `trial list`, `project list` - Added to `org-list.ts` framework so `team list` and `repo list` get spinners automatically 3. **JSON envelope alignment** - `trace logs` now returns `{ data, hasMore }` envelope 4. **Test improvements** - Fixed pre-existing 5s timeout failures in `dispatchOrgScopedList` tests (missing `resolveEffectiveOrg` mock) - Complete rewrite of `log/list.test.ts` (49 tests) - Added `isTraceId()` tests to `trace-id.test.ts` ### New helper `isTraceId(value: string): boolean` — non-throwing check extracted from `validateTraceId` core logic. Used by `log list` for positional disambiguation. ### Files changed (15) | File | Change | |------|--------| | `src/lib/trace-id.ts` | Add `isTraceId()` | | `src/commands/log/list.ts` | Major: remove --trace, array positional, --period, withProgress, JSON envelope | | `src/commands/trace/list.ts` | Add withProgress | | `src/commands/span/list.ts` | Add withProgress | | `src/commands/trace/logs.ts` | Add withProgress + JSON envelope | | `src/commands/org/list.ts` | Add withProgress | | `src/commands/trial/list.ts` | Add withProgress | | `src/commands/project/list.ts` | Add withProgress | | `src/lib/org-list.ts` | Add withProgress to framework | | `test/` files | Updated/new tests | --------- Co-authored-by: betegon <miguelbetegongarcia@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4bba476 commit 629012c

20 files changed

Lines changed: 890 additions & 304 deletions

File tree

AGENTS.md

Lines changed: 40 additions & 21 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,15 +599,15 @@ sentry team list --json
599599

600600
View Sentry logs
601601

602-
#### `sentry log list <org/project>`
602+
#### `sentry log list <org/project-or-trace-id...>`
603603

604604
List logs from a project
605605

606606
**Flags:**
607607
- `-n, --limit <value> - Number of log entries (1-1000) - (default: "100")`
608608
- `-q, --query <value> - Filter query (Sentry search syntax)`
609609
- `-f, --follow <value> - Stream logs (optionally specify poll interval in seconds)`
610-
- `--trace <value> - Filter logs by trace ID (32-character hex string)`
610+
- `-t, --period <value> - Time period (e.g., "90d", "14d", "24h"). Default: 90d (project mode), 14d (trace mode)`
611611
- `--fresh - Bypass cache, re-detect projects, and fetch fresh data`
612612
- `--json - Output as JSON`
613613
- `--fields <value> - Comma-separated fields to include in JSON output (dot.notation supported)`

src/commands/dashboard/list.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ export const listCommand = buildCommand({
135135
}
136136

137137
const dashboards = await withProgress(
138-
{ message: `Fetching dashboards (up to ${flags.limit})...` },
138+
{
139+
message: `Fetching dashboards (up to ${flags.limit})...`,
140+
json: flags.json,
141+
},
139142
() => listDashboards(orgSlug, { perPage: flags.limit })
140143
);
141144
const url = buildDashboardsListUrl(orgSlug);

src/commands/issue/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ async function handleOrgAllIssues(
814814
setContext([org], []);
815815

816816
const { issues, nextCursor } = await withProgress(
817-
{ message: `Fetching issues (up to ${flags.limit})...` },
817+
{ message: `Fetching issues (up to ${flags.limit})...`, json: flags.json },
818818
(setMessage) =>
819819
fetchOrgAllIssues(org, flags, cursor, (fetched, limit) =>
820820
setMessage(
@@ -954,7 +954,7 @@ async function handleResolvedTargets(
954954
: "Fetching issues";
955955

956956
const { results, hasMore } = await withProgress(
957-
{ message: `${baseMessage} (up to ${flags.limit})...` },
957+
{ message: `${baseMessage} (up to ${flags.limit})...`, json: flags.json },
958958
(setMessage) =>
959959
fetchWithBudget(
960960
activeTargets,

0 commit comments

Comments
 (0)