Skip to content

Commit d1e3fad

Browse files
cursoragentbetegon
andcommitted
fix: correct auth token precedence docs and update stale architecture tree
- Fix SENTRY_AUTH_TOKEN description in env-registry.ts: stored OAuth token takes priority by default, not the env var (unless SENTRY_FORCE_ENV_TOKEN is set) - Fix auth fragment docs: token precedence order was inverted - Update AGENTS.md architecture tree: add missing command directories (dashboard, release, sourcemap, repo, init, schema) and update subcommand lists for auth, cli, event, issue, project - Update DEVELOPMENT.md env var table: add SENTRY_AUTH_TOKEN, SENTRY_FORCE_ENV_TOKEN, SENTRY_CLI_NO_TELEMETRY, SENTRY_LOG_LEVEL - Update agentic-usage.md: document automatic skill installation, expand supported agent list beyond Claude Code Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
1 parent ce27678 commit d1e3fad

5 files changed

Lines changed: 41 additions & 22 deletions

File tree

AGENTS.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,25 @@ cli/
112112
│ ├── app.ts # Stricli application setup
113113
│ ├── context.ts # Dependency injection context
114114
│ ├── commands/ # CLI commands
115-
│ │ ├── auth/ # login, logout, status, refresh
116-
│ │ ├── event/ # view
117-
│ │ ├── issue/ # list, view, explain, plan
115+
│ │ ├── auth/ # login, logout, refresh, status, token, whoami
116+
│ │ ├── cli/ # defaults, feedback, fix, setup, upgrade
117+
│ │ ├── dashboard/ # list, view, create, widget (add, edit, delete)
118+
│ │ ├── event/ # list, view
119+
│ │ ├── issue/ # list, view, events, explain, plan, resolve, unresolve, merge
120+
│ │ ├── log/ # list, view
118121
│ │ ├── org/ # list, view
119-
│ │ ├── project/ # list, view
122+
│ │ ├── project/ # list, view, create, delete
123+
│ │ ├── release/ # list, view, create, finalize, delete, deploy, deploys, set-commits, propose-version
124+
│ │ ├── repo/ # list
125+
│ │ ├── sourcemap/ # inject, upload
120126
│ │ ├── span/ # list, view
127+
│ │ ├── team/ # list
121128
│ │ ├── trace/ # list, view, logs
122-
│ │ ├── log/ # list, view
123129
│ │ ├── trial/ # list, start
124-
│ │ ├── cli/ # fix, upgrade, feedback, setup
125130
│ │ ├── api.ts # Direct API access command
126-
│ │ └── help.ts # Help command
131+
│ │ ├── help.ts # Help command
132+
│ │ ├── init.ts # Initialize Sentry in your project (experimental)
133+
│ │ └── schema.ts # Browse the Sentry API schema
127134
│ ├── lib/ # Shared utilities
128135
│ │ ├── command.ts # buildCommand wrapper (telemetry + output)
129136
│ │ ├── api-client.ts # Barrel re-export for API modules

DEVELOPMENT.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ When creating your Sentry OAuth application:
6969

7070
## Environment Variables
7171

72-
| Variable | Description | Default |
73-
| ------------------ | ----------------------------------------------------- | -------------------- |
74-
| `SENTRY_CLIENT_ID` | Sentry OAuth app client ID | (required) |
75-
| `SENTRY_HOST` | Sentry instance URL (for self-hosted, takes precedence) | `https://sentry.io` |
76-
| `SENTRY_URL` | Alias for `SENTRY_HOST` | `https://sentry.io` |
72+
| Variable | Description | Default |
73+
| ----------------------- | ---------------------------------------------------------------- | -------------------- |
74+
| `SENTRY_CLIENT_ID` | Sentry OAuth app client ID | (required for build) |
75+
| `SENTRY_HOST` | Sentry instance URL (for self-hosted, takes precedence) | `https://sentry.io` |
76+
| `SENTRY_URL` | Alias for `SENTRY_HOST` | `https://sentry.io` |
77+
| `SENTRY_AUTH_TOKEN` | API token for non-interactive use (lower priority than stored OAuth by default) ||
78+
| `SENTRY_FORCE_ENV_TOKEN`| Force env token to take priority over stored OAuth token ||
79+
| `SENTRY_CLI_NO_TELEMETRY`| Disable CLI telemetry (error tracking) ||
80+
| `SENTRY_LOG_LEVEL` | Diagnostic log level (`error`, `warn`, `log`, `info`, `debug`, `trace`) | `info` |
7781

7882
## Building
7983

docs/src/content/docs/agentic-usage.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ title: Agentic Usage
33
description: Enable AI coding agents to use the Sentry CLI
44
---
55

6-
AI coding agents like Claude Code can use the Sentry CLI through the skill system. This allows agents to interact with Sentry directly from your development environment.
6+
AI coding agents like Claude Code and Cursor can use the Sentry CLI through the skill system. This allows agents to interact with Sentry directly from your development environment.
77

8-
## Adding the Skill
8+
## Automatic Installation
99

10-
Add the Sentry CLI skill to your agent:
10+
When you install the CLI (via `curl`, Homebrew, or a package manager), `sentry cli setup` automatically installs agent skills into any detected agent root directories (`~/.claude`, `~/.agents`). Skills are also refreshed on `sentry cli upgrade`. No network fetch is needed — skill files are embedded in the binary.
11+
12+
To skip automatic skill installation, pass `--no-agent-skills` to `sentry cli setup`.
13+
14+
## Manual Installation
15+
16+
Add the Sentry CLI skill to your agent manually:
1117

1218
```bash
1319
npx skills add https://cli.sentry.dev
@@ -43,4 +49,4 @@ The skill uses your existing CLI authentication, so you'll need to run `sentry a
4349
## Requirements
4450

4551
- An authenticated Sentry CLI installation (`sentry auth login`)
46-
- An AI coding agent that supports the skills system (e.g., Claude Code)
52+
- An AI coding agent that supports the skills system (e.g., Claude Code, Cursor, or any agent using `~/.agents`)

docs/src/fragments/commands/auth.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ sentry auth whoami
7676

7777
Auth tokens are stored in a SQLite database at `~/.sentry/cli.db` with restricted file permissions.
7878

79-
## Environment Variable Precedence
79+
## Token Precedence
8080

81-
The CLI checks for auth tokens in the following order, using the first one found:
81+
By default, the CLI checks for auth tokens in the following order:
8282

83-
1. `SENTRY_AUTH_TOKEN` environment variable
84-
2. `SENTRY_TOKEN` environment variable (legacy alias)
85-
3. The stored OAuth token in the SQLite database
83+
1. The stored OAuth token in the SQLite database (from `sentry auth login`)
84+
2. `SENTRY_AUTH_TOKEN` environment variable
85+
3. `SENTRY_TOKEN` environment variable (legacy alias)
86+
87+
The stored OAuth token takes priority because it supports automatic refresh. To override this and force environment tokens to win, set `SENTRY_FORCE_ENV_TOKEN=1`.
8688

8789
When a token comes from an environment variable, the CLI skips expiry checks and automatic refresh.

src/lib/env-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const ENV_VAR_REGISTRY: readonly EnvVarEntry[] = [
3232
{
3333
name: "SENTRY_AUTH_TOKEN",
3434
description:
35-
"Authentication token for the Sentry API. This is the primary way to authenticate in CI/CD pipelines and scripts where interactive login is not possible.\n\nYou can create auth tokens in your [Sentry account settings](https://sentry.io/settings/account/api/auth-tokens/). When set, this takes precedence over any stored OAuth token from `sentry auth login`.",
35+
"Authentication token for the Sentry API. This is the primary way to authenticate in CI/CD pipelines and scripts where interactive login is not possible.\n\nYou can create auth tokens in your [Sentry account settings](https://sentry.io/settings/account/api/auth-tokens/). By default, a stored OAuth token from `sentry auth login` takes priority over this variable. Set `SENTRY_FORCE_ENV_TOKEN=1` to give environment tokens precedence instead.",
3636
example: "sntrys_YOUR_TOKEN_HERE",
3737
},
3838
{

0 commit comments

Comments
 (0)