Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/cli-docs/src/content/docs/agent-guidance.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Best practices and operational guidance for AI coding agents using the Sentry CL
- **Prefer CLI commands over raw API calls** — the CLI has dedicated commands for most tasks. Reach for `sentry issue view`, `sentry issue list`, `sentry trace view`, etc. before constructing API calls manually or fetching external documentation.
- **Use `sentry docs` for setup questions** — if you need to know how to configure a Sentry SDK or feature, run `sentry docs "your question"` to query the documentation directly. This is faster and more accurate than fetching docs externally.
- **Use `sentry schema` to explore the API** — if you need to discover API endpoints, run `sentry schema` to browse interactively or `sentry schema <resource>` to search. This is faster than fetching OpenAPI specs externally.
- **Use `sentry issue view <id>` to investigate issues** — when asked about a specific issue (e.g., `CLI-G5`, `PROJECT-123`), use `sentry issue view` directly.
- **Use `sentry issue view` to investigate issues** — when asked about a specific issue (e.g., `CLI-G5`, `PROJECT-123`), use `sentry issue view` directly. Multiple IDs can be passed in one invocation: `sentry issue view A B C --json` returns an array of the same objects.
- **Use `--json` for machine-readable output** — pipe through `jq` for filtering. Human-readable output includes formatting that is hard to parse.
- **The CLI auto-detects org/project — don't discover it yourself** — most commands work without explicit targets by checking `.sentryclirc` config files, scanning for DSNs in `.env` files and source code, and matching directory names. Do **not** run `sentry org list` and then `sentry project list` to figure out which project this checkout belongs to — that manual fan-out just replicates the detection the CLI already runs on every command. Only specify `<org>/<project>` when the CLI reports it can't detect the target or detects the wrong one.

Expand All @@ -28,6 +28,8 @@ The `sentry` CLI follows conventions from well-known tools — if you're familia
- Use `--json` when piping output between commands or processing programmatically
- Use `--limit` to cap the number of results (default is usually 10–100)
- Prefer `sentry issue view PROJECT-123` over listing and filtering manually
- Pass multiple issue IDs in one call (`sentry issue view A B C --json`) instead of looping `issue view` per ID
- Analyze multiple issues in one call (`sentry issue explain A B C --json`) instead of looping `issue explain` per ID
- Use `sentry api` for endpoints not covered by dedicated commands

## Safety Rules
Expand Down
29 changes: 25 additions & 4 deletions apps/cli-docs/src/fragments/commands/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ sentry issue events FRONT-ABC -c next

```bash
sentry issue view FRONT-ABC

# Multiple issues in one invocation (space-separated, not commas)
sentry issue view FRONT-ABC BACK-2
```

```
Expand All @@ -121,8 +124,11 @@ Latest event:
```

```bash
# Open in browser
sentry issue view FRONT-ABC -w
# Open one or more issues in the browser (up to 5 tabs by default)
sentry issue view FRONT-ABC BACK-2 -w

# Explicitly allow more than 5 tabs
sentry issue view FRONT-ABC BACK-2 API-3 WEB-4 IOS-5 OPS-6 -w --force
```

```bash
Expand All @@ -135,12 +141,16 @@ sentry issue view my-project#FRONT-ABC

`--json` returns the issue fields at the top level plus the latest event under
`event`, the resolved `org` slug, related `replayIds`, and `trace` context.
Prefer this over the human output when parsing programmatically.
Prefer this over the human output when parsing programmatically. One issue ID
still returns a single object; multiple IDs return an array of those objects.

```bash
# Full JSON (issue fields + latest event + trace/replay context)
sentry issue view FRONT-ABC --json

# Multiple issues: JSON is an array of the same objects
sentry issue view FRONT-ABC BACK-2 --json

# Select specific top-level fields to keep output small
sentry issue view FRONT-ABC --json --fields shortId,title,culprit,count,userCount,permalink

Expand Down Expand Up @@ -169,7 +179,7 @@ sentry issue view FRONT-ABC --json | jq '.event.entries[] | select(.type == "req
sentry issue view FRONT-ABC --json | jq '.event.entries[] | select(.type == "exception") | .data.values[0] | {type, value}'
```

### Explain and plan with Seer AI
### Explain issues with Seer AI

```bash
# Analyze root cause (may take a few minutes for new issues)
Expand All @@ -178,9 +188,20 @@ sentry issue explain 123456789
# By short ID with org prefix
sentry issue explain my-org/MYPROJECT-ABC

# Analyze multiple issues in one invocation
sentry issue explain FRONT-ABC BACK-2

# Force a fresh analysis
sentry issue explain 123456789 --force
```

With `--json`, one explained issue preserves the existing array of root causes.
Multiple issues return an array of labeled objects containing `issue`, `org`,
`issueId`, and `rootCauses`.

### Generate a plan with Seer AI

```bash
# Generate a fix plan (automatically runs explain if needed)
sentry issue plan 123456789

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ View commands use **optional positional arguments** for the primary identifier,
```bash
sentry org view [org-slug] [--json] [-w] # works with DSN if no arg
sentry project view [<org>/<project>] [--json] [-w] # works with DSN if no arg
sentry issue view <issue-id> [--json] [-w] # issue ID required
sentry issue view <issue-id> [<issue-id>...] [--json] [-w] # one or more issue IDs
sentry event view [<org>/<project>] <event-id> [--json] [-w] # event ID required
```

**Key insight**: `org view` and `project view` mirror `gh repo view` - works in context (DSN) or with explicit arg.

**Browser flag**: All view commands support `-w` (or `--web`) to open the resource in your default browser instead of displaying it in the terminal.
**Browser flag**: All view commands support `-w` (or `--web`) to open the resource in your default browser instead of displaying it in the terminal. Batch `issue view` opens at most 5 tabs unless `--force` is passed.

## Context Resolution

Expand Down
8 changes: 5 additions & 3 deletions packages/cli/plugins/sentry-cli/skills/sentry-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Best practices and operational guidance for AI coding agents using the Sentry CL
- **Prefer CLI commands over raw API calls** — the CLI has dedicated commands for most tasks. Reach for `sentry issue view`, `sentry issue list`, `sentry trace view`, etc. before constructing API calls manually or fetching external documentation.
- **Use `sentry docs` for setup questions** — if you need to know how to configure a Sentry SDK or feature, run `sentry docs "your question"` to query the documentation directly. This is faster and more accurate than fetching docs externally.
- **Use `sentry schema` to explore the API** — if you need to discover API endpoints, run `sentry schema` to browse interactively or `sentry schema <resource>` to search. This is faster than fetching OpenAPI specs externally.
- **Use `sentry issue view <id>` to investigate issues** — when asked about a specific issue (e.g., `CLI-G5`, `PROJECT-123`), use `sentry issue view` directly.
- **Use `sentry issue view` to investigate issues** — when asked about a specific issue (e.g., `CLI-G5`, `PROJECT-123`), use `sentry issue view` directly. Multiple IDs can be passed in one invocation: `sentry issue view A B C --json` returns an array of the same objects.
- **Use `--json` for machine-readable output** — pipe through `jq` for filtering. Human-readable output includes formatting that is hard to parse.
- **The CLI auto-detects org/project — don't discover it yourself** — most commands work without explicit targets by checking `.sentryclirc` config files, scanning for DSNs in `.env` files and source code, and matching directory names. Do **not** run `sentry org list` and then `sentry project list` to figure out which project this checkout belongs to — that manual fan-out just replicates the detection the CLI already runs on every command. Only specify `<org>/<project>` when the CLI reports it can't detect the target or detects the wrong one.

Expand All @@ -40,6 +40,8 @@ The `sentry` CLI follows conventions from well-known tools — if you're familia
- Use `--json` when piping output between commands or processing programmatically
- Use `--limit` to cap the number of results (default is usually 10–100)
- Prefer `sentry issue view PROJECT-123` over listing and filtering manually
- Pass multiple issue IDs in one call (`sentry issue view A B C --json`) instead of looping `issue view` per ID
- Analyze multiple issues in one call (`sentry issue explain A B C --json`) instead of looping `issue explain` per ID
- Use `sentry api` for endpoints not covered by dedicated commands

### Safety Rules
Expand Down Expand Up @@ -408,9 +410,9 @@ Manage Sentry issues

- `sentry issue list <org/project>` — List issues in a project
- `sentry issue events <issue>` — List events for a specific issue
- `sentry issue explain <issue>` — Analyze an issue's root cause using Seer AI
- `sentry issue explain <issue...>` — Analyze one or more issues using Seer AI
- `sentry issue plan <issue>` — Generate a solution plan using Seer AI
- `sentry issue view <issue>` — View details of a specific issue
- `sentry issue view <issue...>` — View details of one or more issues
- `sentry issue resolve <issue>` — Mark an issue as resolved
- `sentry issue unresolve <issue>` — Reopen a resolved issue
- `sentry issue archive <issue>` — Archive (ignore) an issue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ sentry issue events FRONT-ABC --limit 50 --period 24h
sentry issue events FRONT-ABC -c next
```

### `sentry issue explain <issue>`
### `sentry issue explain <issue...>`

Analyze an issue's root cause using Seer AI
Analyze one or more issues using Seer AI

**Flags:**
- `--force - Force new analysis even if one exists`
Expand All @@ -161,14 +161,11 @@ sentry issue explain 123456789
# By short ID with org prefix
sentry issue explain my-org/MYPROJECT-ABC

# Analyze multiple issues in one invocation
sentry issue explain FRONT-ABC BACK-2

# Force a fresh analysis
sentry issue explain 123456789 --force

# Generate a fix plan (automatically runs explain if needed)
sentry issue plan 123456789

# Force a fresh plan even if one already exists
sentry issue plan 123456789 --force
```

### `sentry issue plan <issue>`
Expand All @@ -179,12 +176,23 @@ Generate a solution plan using Seer AI
- `--force - Force new plan even if one exists`
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`

### `sentry issue view <issue>`
**Examples:**

```bash
# Generate a fix plan (automatically runs explain if needed)
sentry issue plan 123456789

# Force a fresh plan even if one already exists
sentry issue plan 123456789 --force
```

### `sentry issue view <issue...>`

View details of a specific issue
View details of one or more issues

**Flags:**
- `-w, --web - Open in browser`
- `--force - Allow --web to open more than 5 issues`
- `--spans <value> - Span tree depth limit (number, "all" for unlimited, "no" to disable) - (default: "3")`
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`

Expand Down Expand Up @@ -221,8 +229,14 @@ View details of a specific issue
```bash
sentry issue view FRONT-ABC

# Open in browser
sentry issue view FRONT-ABC -w
# Multiple issues in one invocation (space-separated, not commas)
sentry issue view FRONT-ABC BACK-2

# Open one or more issues in the browser (up to 5 tabs by default)
sentry issue view FRONT-ABC BACK-2 -w

# Explicitly allow more than 5 tabs
sentry issue view FRONT-ABC BACK-2 API-3 WEB-4 IOS-5 OPS-6 -w --force

# GitHub-style identifiers work too (the "#" replaces the final slash)
sentry issue view my-org/my-project#FRONT-ABC
Expand All @@ -231,6 +245,9 @@ sentry issue view my-project#FRONT-ABC
# Full JSON (issue fields + latest event + trace/replay context)
sentry issue view FRONT-ABC --json

# Multiple issues: JSON is an array of the same objects
sentry issue view FRONT-ABC BACK-2 --json

# Select specific top-level fields to keep output small
sentry issue view FRONT-ABC --json --fields shortId,title,culprit,count,userCount,permalink

Expand Down
Loading
Loading