Skip to content

Commit 964c105

Browse files
authored
feat(team): add team list command (#238)
## Summary Adds a `sentry team list` command to list teams in an organization, along with a `sentry teams` shortcut alias. Follows the same patterns as `repo list` — optional positional org arg, config defaults, DSN auto-detection fallback. ## Changes New command at `src/commands/team/list.ts` with human-readable table output (ORG, SLUG, NAME, MEMBERS columns) and `--json` support. Registered in the app route map with a `teams` top-level shortcut. Includes 8 unit tests covering JSON output, empty states, limit overflow, and all org resolution paths (explicit, default, DSN detection, all-orgs fallback). ## Test Plan ```bash bun test test/commands/team/list.test.ts # 8 tests pass bun run typecheck # clean bun run lint # clean ```
1 parent baaa3d3 commit 964c105

File tree

10 files changed

+648
-0
lines changed

10 files changed

+648
-0
lines changed

docs/src/content/docs/commands/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The Sentry CLI provides commands for interacting with various Sentry resources.
1313
| [`cli`](./cli/) | CLI-related commands (feedback, upgrade) |
1414
| [`org`](./org/) | Organization operations |
1515
| [`project`](./project/) | Project operations |
16+
| [`team`](./team/) | Team operations |
1617
| [`issue`](./issue/) | Issue tracking |
1718
| [`event`](./event/) | Event inspection |
1819
| [`log`](./log/) | Log viewing and streaming |
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: team
3+
description: Team commands for the Sentry CLI
4+
---
5+
6+
Manage Sentry teams.
7+
8+
## Commands
9+
10+
### `sentry team list`
11+
12+
List teams in an organization.
13+
14+
```bash
15+
# Auto-detect organization or list all
16+
sentry team list
17+
18+
# List teams in a specific organization
19+
sentry team list <org-slug>
20+
21+
# Limit results
22+
sentry team list --limit 10
23+
```
24+
25+
**Arguments:**
26+
27+
| Argument | Description |
28+
|----------|-------------|
29+
| `[org-slug]` | Optional organization slug to filter by |
30+
31+
**Options:**
32+
33+
| Option | Description |
34+
|--------|-------------|
35+
| `-n, --limit <number>` | Maximum number of teams to list (default: 30) |
36+
| `--json` | Output as JSON |
37+
38+
**Example output:**
39+
40+
```
41+
ORG SLUG NAME MEMBERS
42+
my-org backend Backend Team 8
43+
my-org frontend Frontend Team 5
44+
my-org mobile Mobile Team 3
45+
```
46+
47+
**JSON output:**
48+
49+
```bash
50+
sentry team list --json
51+
```
52+
53+
```json
54+
[
55+
{
56+
"id": "100",
57+
"slug": "backend",
58+
"name": "Backend Team",
59+
"memberCount": 8
60+
}
61+
]
62+
```

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,33 @@ List repositories
440440
- `-n, --limit <value> - Maximum number of repositories to list - (default: "30")`
441441
- `--json - Output JSON`
442442

443+
### Team
444+
445+
Work with Sentry teams
446+
447+
#### `sentry team list <org>`
448+
449+
List teams
450+
451+
**Flags:**
452+
- `-n, --limit <value> - Maximum number of teams to list - (default: "30")`
453+
- `--json - Output JSON`
454+
455+
**Examples:**
456+
457+
```bash
458+
# Auto-detect organization or list all
459+
sentry team list
460+
461+
# List teams in a specific organization
462+
sentry team list <org-slug>
463+
464+
# Limit results
465+
sentry team list --limit 10
466+
467+
sentry team list --json
468+
```
469+
443470
### Log
444471

445472
View Sentry logs
@@ -594,6 +621,18 @@ List repositories
594621
- `-n, --limit <value> - Maximum number of repositories to list - (default: "30")`
595622
- `--json - Output JSON`
596623

624+
### Teams
625+
626+
List teams
627+
628+
#### `sentry teams <org>`
629+
630+
List teams
631+
632+
**Flags:**
633+
- `-n, --limit <value> - Maximum number of teams to list - (default: "30")`
634+
- `--json - Output JSON`
635+
597636
### Logs
598637

599638
List logs from a project

src/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import { projectRoute } from "./commands/project/index.js";
2121
import { listCommand as projectListCommand } from "./commands/project/list.js";
2222
import { repoRoute } from "./commands/repo/index.js";
2323
import { listCommand as repoListCommand } from "./commands/repo/list.js";
24+
import { teamRoute } from "./commands/team/index.js";
25+
import { listCommand as teamListCommand } from "./commands/team/list.js";
2426
import { traceRoute } from "./commands/trace/index.js";
2527
import { listCommand as traceListCommand } from "./commands/trace/list.js";
2628
import { CLI_VERSION } from "./lib/constants.js";
@@ -36,6 +38,7 @@ export const routes = buildRouteMap({
3638
org: orgRoute,
3739
project: projectRoute,
3840
repo: repoRoute,
41+
team: teamRoute,
3942
issue: issueRoute,
4043
event: eventRoute,
4144
log: logRoute,
@@ -45,6 +48,7 @@ export const routes = buildRouteMap({
4548
orgs: orgListCommand,
4649
projects: projectListCommand,
4750
repos: repoListCommand,
51+
teams: teamListCommand,
4852
logs: logListCommand,
4953
traces: traceListCommand,
5054
},

src/commands/team/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { buildRouteMap } from "@stricli/core";
2+
import { listCommand } from "./list.js";
3+
4+
export const teamRoute = buildRouteMap({
5+
routes: {
6+
list: listCommand,
7+
},
8+
docs: {
9+
brief: "Work with Sentry teams",
10+
fullDescription: "List and manage teams in your Sentry organizations.",
11+
hideRoute: {},
12+
},
13+
});

0 commit comments

Comments
 (0)