@sentry/junior-sentry 0.248.0 → 0.250.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @sentry/junior-sentry
2
2
 
3
- Sentry investigations (per-user OAuth plus optional org read access) and signed issue webhooks (internal integration) for Junior.
3
+ Sentry investigations and explicitly requested project, team, and alert changes (per-user OAuth plus optional org read access) and signed issue webhooks (internal integration) for Junior.
4
4
 
5
5
  ```bash
6
6
  pnpm add @sentry/junior @sentry/junior-sentry
@@ -27,10 +27,11 @@ Verified CLI surface (check live `sentry --help` before blocking):
27
27
 
28
28
  - `sentry issue list|events|explain|plan|view`
29
29
  - `sentry org list|view`
30
+ - `sentry project create|list|view`, `sentry team list`, `sentry dsn list`
30
31
  - `sentry log list|view`
31
32
  - `sentry trace list|view|logs`
32
33
  - `sentry alert metrics list|view|create|edit|delete`
33
- - `sentry api <endpoint>` fallback
34
+ - `sentry api <endpoint>` fallback, with `sentry schema` for endpoint lookup
34
35
 
35
36
  ## Org read access
36
37
 
package/dist/index.js CHANGED
@@ -104,7 +104,7 @@ function sentryPlugin() {
104
104
  domains: SENTRY_API_DOMAINS,
105
105
  type: "oauth-bearer"
106
106
  },
107
- description: "Investigate Sentry telemetry, manage alerting, and receive issue and metric alert webhooks",
107
+ description: "Investigate Sentry telemetry, manage projects, teams, and alerting, and receive issue and metric alert webhooks",
108
108
  displayName: "Sentry",
109
109
  envVars: {
110
110
  SENTRY_CLIENT_ID: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-sentry",
3
- "version": "0.248.0",
3
+ "version": "0.250.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "zod": "^4.5.4",
30
- "@sentry/junior-plugin-api": "0.248.0"
30
+ "@sentry/junior-plugin-api": "0.250.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@oxlint/plugins": "1.79.0",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sentry
3
- description: Query live Sentry telemetry, create explicitly requested Sentry alerts and monitors, and generate Sentry deep links. Use when users ask to investigate Sentry issues, events, logs, traces, organizations, projects, replays, product feature usage, Sentry's own product telemetry, authenticated Sentry API data, or to create alerting. Do not use it for repository/source-code/PR tasks, even when the topic concerns Sentry products.
3
+ description: Query live Sentry telemetry, make explicitly requested Sentry configuration changes (projects, teams, alerts, and monitors), and generate Sentry deep links. Use when users ask to investigate Sentry issues, events, logs, traces, organizations, projects, replays, product feature usage, Sentry's own product telemetry, authenticated Sentry API data, to create or configure Sentry projects and teams, to assign teams to projects, or to create alerting. Do not use it for repository/source-code/PR tasks, even when the topic concerns Sentry products.
4
4
  allowed-tools: bash
5
5
  ---
6
6
 
@@ -18,7 +18,7 @@ Before declaring a Sentry data surface unavailable, verify the current CLI help:
18
18
 
19
19
  1. Confirm operation and target:
20
20
 
21
- - Determine operation: issue, event, log, trace, org, project, replay/deep-link, Sentry product feature usage, alert/monitor creation, or API query.
21
+ - Determine operation: issue, event, log, trace, org, project, replay/deep-link, Sentry product feature usage, project/team configuration, alert/monitor creation, or API query.
22
22
  - Resolve org from channel config: `jr-rpc config get sentry.org`
23
23
  - Resolve project from channel config: `jr-rpc config get sentry.project` (optional — many queries span multiple projects).
24
24
  - If org is missing and needed, ask the user.
@@ -32,26 +32,36 @@ Before declaring a Sentry data surface unavailable, verify the current CLI help:
32
32
  - Read [references/sandbox-runtime.md](references/sandbox-runtime.md) before relying on sandbox credentials.
33
33
  - Prefer `--json` when parsing or summarizing results.
34
34
  - If no high-level CLI command covers the request, use `sentry api <endpoint>` before claiming the workflow is blocked.
35
- - Create alerts only when the user explicitly asks. Prefer `sentry alert metrics` for metric-alert list/view/create/edit/delete; before writing, resolve the exact target, check duplicates, run the complete command with `--dry-run`, then execute once and report the created rule URL.
36
- - Use `sentry api` only when live CLI help confirms the first-class command cannot express the requested alert behavior, such as dynamic anomaly detection.
35
+ - For an explicitly requested write, follow the write workflow below.
36
+ - Prefer `sentry alert metrics` for metric alerts. Use `sentry api` only when live CLI help confirms the first-class command cannot express the requested alert behavior, such as dynamic anomaly detection.
37
37
  - If a Sentry API call returns `401`, or clearly says the token is invalid, expired, revoked, or unauthorized, rerun the real Sentry command once and let the runtime trigger a reconnect flow when needed.
38
38
  - If a Sentry API call explicitly says `missing scope`, `missing scopes`, or `insufficient scope`, rerun the real Sentry command once and let the runtime trigger a reconnect flow when needed.
39
39
  - If a Sentry API call returns a generic `403`, `permission denied`, or otherwise indicates missing org/project access without naming missing scopes, stop and tell the user the current Sentry connection could not access the requested Sentry data.
40
40
  - Only mention a specific missing scope when the CLI or API error explicitly names that scope. Do not guess scope names from a generic `403`.
41
41
 
42
- 3. Generate deep links:
42
+ 3. Make requested writes:
43
+
44
+ - Read [references/cli-commands.md](references/cli-commands.md) for the write command shapes. Use `sentry schema <resource>` to confirm the current endpoint and fields before an API write.
45
+ - Resolve the exact org, project, team, and member slugs or IDs. Ask when the target is ambiguous; do not guess.
46
+ - Read the current state first. Stop on a likely duplicate (for example, a project or team with the same slug) and report it.
47
+ - Change only the fields the user asked for. Do not reset or rewrite other settings.
48
+ - Run the complete command with `--dry-run` first, then run it once without `--dry-run`.
49
+ - Read the resource again and report what changed (before → after) with the Sentry URL.
50
+ - For a destructive or irreversible change (a delete, removing a team from a project, a slug rename, or a transfer), make sure the user named that exact action in the current request.
51
+
52
+ 4. Generate deep links:
43
53
 
44
54
  - For user-scoped or entity-specific views, generate URLs instead of CLI calls.
45
55
  - Read [references/deep-link-patterns.md](references/deep-link-patterns.md) for URL templates.
46
56
 
47
- 4. Report result:
57
+ 5. Report result:
48
58
 
49
59
  - Return issue details, replay links, deep links, or CLI output inline.
50
60
  - Include Sentry web URLs for easy navigation.
51
61
 
52
62
  ## Guardrails
53
63
 
54
- - Default to read-only operations. Only create, edit, or delete alerting resources when the user explicitly requests that exact action and a documented first-class CLI command supports it. Use API fallback only for explicitly requested alert behavior that live CLI help confirms is unsupported.
64
+ - Write only when the user asks for that change.
55
65
  - Avoid speculative Sentry CLI subcommands. Use bundled references plus live `sentry --help` output to verify current commands.
56
66
  - Do not print credential values.
57
67
  - If org is missing and needed, ask the user.
@@ -1,6 +1,6 @@
1
1
  # Sentry Skill Sources
2
2
 
3
- Last updated: 2026-07-13
3
+ Last updated: 2026-10-16
4
4
 
5
5
  ## Source inventory
6
6
 
@@ -32,7 +32,9 @@ Last updated: 2026-07-13
32
32
  | Treat Sentry product feature usage and explicit Sentry telemetry redirects as Sentry skill triggers. | adopted | Issue 615 showed the previous trigger language under-specified product-introspection queries and let Hex win. |
33
33
  | Preserve stale plural subcommands as recommended forms. | rejected | `organizations list` was the root failure; aliases should not be taught as canonical command shapes. |
34
34
  | Create a broad new troubleshooting reference. | deferred | Current failure modes fit in the focused CLI reference without crowding `SKILL.md`. |
35
- | Permit explicitly requested alert/monitor writes only. | adopted | `alerts:write` is intentionally narrow; unrelated Sentry mutations remain out of scope. |
35
+ | Permit explicitly requested alert/monitor writes only. | replaced | Replaced on 2026-10-16 by the project and team write decision below. |
36
+ | Write when the user asks; do not keep an allowlist of writes in the skill. | adopted | Access limits belong to OAuth scopes, Sentry roles, and egress rules, not skill text. |
37
+ | Use `sentry schema` before API writes. | adopted | CLI `0.47.0` ships the API schema, so endpoint and field names come from the installed CLI, not memory. |
36
38
  | Prefer first-class `sentry alert metrics` commands. | adopted | CLI `0.38.0` supports list, view, create, edit, delete, triggers, and dry-run. |
37
39
  | Keep API fallback for dynamic anomaly detection. | adopted | The current CLI create flags expose threshold triggers but no dynamic/anomaly configuration. |
38
40
 
@@ -53,6 +55,8 @@ Last updated: 2026-07-13
53
55
 
54
56
  ## Changelog
55
57
 
58
+ - 2026-10-16: Replaced the alert-only write rule with a general write workflow (dry-run, duplicate, and verify steps) and project and team command shapes. The skill no longer lists allowed or denied writes. Checked against CLI `0.47.0` help and `sentry schema` output, and Sentry endpoint permissions (`ProjectPermission`, `ProjectTeamsPermission`, `OrganizationTeamMemberPermission`).
59
+
56
60
  - 2026-07-13: Added CLI-first `sentry alert metrics` guidance, explicit-write and duplicate safeguards, API fallback for unsupported anomaly configuration, and `alerts:write` scope behavior.
57
61
  - 2026-06-18: Expanded trigger language for Sentry product telemetry and feature usage, and recorded issue 615 routing evidence.
58
62
  - 2026-04-30: Reconciled skill guidance with Sentry CLI `0.30.0`, replaced stale plural command forms, added live-help verification, expanded log/trace/API guidance, updated eval smoke artifacts, and added an org-list command-selection eval.
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Intent
4
4
 
5
- The Sentry skill helps agents investigate live Sentry telemetry and create explicitly requested alerts and monitors through the Sentry CLI using per-user credentials injected by Junior.
6
- It should produce useful investigation results, safe alerting mutations, or Sentry web links without exposing credentials.
5
+ The Sentry skill helps agents investigate live Sentry telemetry and make explicitly requested project, team, and alerting changes through the Sentry CLI using per-user credentials injected by Junior.
6
+ It should produce useful investigation results, safe configuration changes, or Sentry web links without exposing credentials.
7
7
 
8
8
  ## Scope
9
9
 
@@ -13,26 +13,27 @@ In scope:
13
13
  - Investigating Sentry's own product telemetry and product feature usage through Sentry CLI/API data surfaces.
14
14
  - Using `sentry api <endpoint>` for authenticated requests when no high-level command exists.
15
15
  - Creating explicitly requested metric alerts through `sentry alert metrics` after duplicate checks and dry-run validation, with API fallback only for unsupported alert behavior.
16
+ - Other Sentry API writes the user asks for, such as creating projects, updating project settings, and managing teams, after target resolution, duplicate checks, and dry-run validation.
16
17
  - Generating Sentry deep links for user-scoped or entity-specific views.
17
18
  - Diagnosing auth, scope, and access failures without guessing missing scopes.
18
19
 
19
20
  Out of scope:
20
21
 
21
22
  - Repository, code search, commit, branch, and pull-request work.
22
- - Mutating Sentry data outside explicitly requested alert or monitor operations.
23
+ - Sentry writes the user did not ask for.
23
24
  - Persisting, printing, or transforming Sentry credentials.
24
25
 
25
26
  ## Users And Trigger Context
26
27
 
27
28
  - Primary users: Junior users asking Slack or harness agents to investigate Sentry data.
28
- - Common user requests: "list my Sentry issues", "show error logs", "inspect this trace", "which orgs can I access", "open the issue in Sentry", "use Sentry telemetry", "create a metric alert", and "notify this channel when this monitor fires".
29
+ - Common user requests: "list my Sentry issues", "show error logs", "inspect this trace", "which orgs can I access", "open the issue in Sentry", "use Sentry telemetry", "create a metric alert", "create a project for this service", "give team X access to project Y", "change this project setting", and "notify this channel when this monitor fires".
29
30
  - Should not trigger for: source-code tasks, GitHub PRs, repository searches, or generic questions about Sentry SDK implementation.
30
31
 
31
32
  ## Runtime Contract
32
33
 
33
34
  - Required first actions: classify the Sentry operation, resolve configured org/project when needed, and verify current CLI help before blocking on an unknown command.
34
- - Required outputs: concise findings, relevant Sentry URLs or deep links, created alerting resource URLs, and clear access/auth failure messages.
35
- - Non-negotiable constraints: do not print credentials; default to read-only commands; only perform explicitly requested alerting mutations; check duplicates and dry-run before writing; use canonical current CLI command groups; use `sentry api` before claiming a surface is unavailable.
35
+ - Required outputs: concise findings, relevant Sentry URLs or deep links, changed resource URLs with before/after values, and clear access/auth failure messages.
36
+ - Non-negotiable constraints: do not print credentials; default to read-only commands; write only when the user asks; read current state, check duplicates, and dry-run before writing; change only requested fields; verify after writing; use canonical current CLI command groups; use `sentry api` before claiming a surface is unavailable.
36
37
  - Expected bundled files loaded at runtime: `references/cli-commands.md`, `references/deep-link-patterns.md`, and `references/sandbox-runtime.md`.
37
38
 
38
39
  ## Current CLI Data
@@ -40,10 +41,11 @@ Out of scope:
40
41
  - Verified date: 2026-07-13.
41
42
  - Verified npm package: `sentry@0.38.0`, installed from the `runtimeDependencies` declared by `sentryPlugin()`.
42
43
  - Auth model: Junior injects `SENTRY_AUTH_TOKEN` for authenticated Sentry commands during the requesting user's turn.
43
- - Canonical command groups: `sentry issue`, `sentry org`, `sentry log`, `sentry trace`, `sentry alert metrics`, and `sentry api`.
44
+ - Canonical command groups: `sentry issue`, `sentry org`, `sentry project`, `sentry team`, `sentry dsn`, `sentry log`, `sentry trace`, `sentry alert metrics`, `sentry schema`, and `sentry api`.
44
45
  - Required migration rule: prefer singular command groups such as `sentry org list`; do not teach stale plural command forms such as `sentry organizations list`.
45
46
  - Required fallback rule: use `sentry api <endpoint>` when no high-level CLI command covers the requested surface.
46
47
  - Alerting write rule: prefer `sentry alert metrics`; use the API fallback only when live CLI help confirms the requested behavior is unsupported.
48
+ - Project and team write rule: use `sentry project create` for new projects; use `sentry api` for settings, project-team, and team writes after `sentry schema` confirms the endpoint.
47
49
 
48
50
  ## Source And Evidence Model
49
51
 
@@ -79,12 +81,14 @@ Data that must not be stored:
79
81
  ## Evaluation
80
82
 
81
83
  - Lightweight validation: run skill validation and grep for stale command forms after CLI updates.
82
- - Deeper evaluation: add Slack/harness evals for org listing, issue search, log search, trace lookup, API fallback, auth recovery, explicit alert creation, duplicate prevention, and refusal of unrelated mutations.
84
+ - Deeper evaluation: add Slack/harness evals for org listing, issue search, log search, trace lookup, API fallback, auth recovery, explicit alert creation, explicit project creation and team assignment, duplicate prevention, and refusal of unrelated mutations.
83
85
  - Holdout examples: requests that mention "organizations list", "orgs", "logs for this trace", and "use the API".
84
- - Acceptance gates: command guidance matches latest CLI help, stale plural forms are not canonical, read-only fallback is available, alerting writes require explicit intent plus duplicate and dry-run checks, unrelated mutations remain blocked, and credential handling remains private.
86
+ - Acceptance gates: command guidance matches latest CLI help, stale plural forms are not canonical, read-only fallback is available, writes require explicit intent plus duplicate and dry-run checks, unrelated mutations remain blocked, and credential handling remains private.
85
87
 
86
88
  ## Known Limitations
87
89
 
90
+ - This skill does not decide which Sentry requests are allowed. OAuth scopes, the user's Sentry role, and host egress rules (when added) own that limit.
91
+
88
92
  - The skill depends on the runtime-installed npm `sentry` package, which may change independently of this repository.
89
93
  - The eval shim is intentionally narrow and is not a full Sentry CLI replacement.
90
94
  - Some live Sentry requests require org/project context or product access that the current user may not have.
@@ -7,11 +7,12 @@ The npm `sentry` package is intentionally installed at runtime by `sentryPlugin(
7
7
 
8
8
  ## Command selection rules
9
9
 
10
- 1. Prefer current canonical singular command groups: `issue`, `org`, `log`, `trace`, and `api`.
10
+ 1. Prefer current canonical singular command groups: `issue`, `org`, `project`, `team`, `dsn`, `log`, `trace`, `alert`, and `api`.
11
11
  2. Do not use stale plural subcommands such as `sentry organizations list`.
12
12
  3. If a command errors as unknown, run `sentry --help` and the nearest subcommand help before declaring the surface unavailable.
13
13
  4. Prefer `--json` and, when useful, `--fields` for structured parsing.
14
- 5. Use `sentry api <endpoint>` for authenticated API calls when a high-level command does not cover the request. Default to `GET`; only perform documented alert or monitor mutations when explicitly requested.
14
+ 5. Use `sentry api <endpoint>` for authenticated API calls when a high-level command does not cover the request. Default to `GET`; write only when the user asks for the change.
15
+ 6. Use `sentry schema <resource>` (for example `sentry schema projects` or `sentry schema --search team`) to find the current endpoint and body fields before an API write.
15
16
 
16
17
  ## Issue commands
17
18
 
@@ -50,6 +51,40 @@ sentry org view ORG [--json]
50
51
 
51
52
  Views one organization.
52
53
 
54
+ ## Project and team commands
55
+
56
+ Read commands:
57
+
58
+ ```bash
59
+ sentry project list ORG/ [--platform PLATFORM] [--json]
60
+ sentry project view ORG/PROJECT [--json]
61
+ sentry team list ORG/ [--json]
62
+ sentry dsn list ORG/PROJECT [--json]
63
+ sentry api projects/ORG/PROJECT/teams/ --json
64
+ sentry api teams/ORG/TEAM/members/ --json
65
+ ```
66
+
67
+ Write commands. Each write runs once with `--dry-run`, then once for real:
68
+
69
+ | Change | Command | Scope |
70
+ | ---------------------------- | -------------------------------------------------------------------- | --------------- |
71
+ | Create a project | `sentry project create ORG/NAME:PLATFORM --team TEAM [--json]` | `project:write` |
72
+ | Update project settings | `sentry api projects/ORG/PROJECT/ -X PUT -d '{"FIELD":VALUE}'` | `project:write` |
73
+ | Add a team to a project | `sentry api projects/ORG/PROJECT/teams/TEAM/ -X POST` | `project:write` |
74
+ | Remove a team from a project | `sentry api projects/ORG/PROJECT/teams/TEAM/ -X DELETE` | `project:write` |
75
+ | Create a team | `sentry api organizations/ORG/teams/ -X POST -d '{"slug":"TEAM"}'` | `team:write` |
76
+ | Update a team | `sentry api teams/ORG/TEAM/ -X PUT -d '{"name":"NAME"}'` | `team:write` |
77
+ | Add a member to a team | `sentry api organizations/ORG/members/MEMBER_ID/teams/TEAM/ -X POST` | `team:write` |
78
+
79
+ Notes:
80
+
81
+ - Run `sentry platform list` when the platform slug is unclear.
82
+ - `sentry project create` needs `--team` when the org has more than one team. Ask which team when the user did not say.
83
+ - After a project is created, run `sentry dsn list ORG/PROJECT` and report the DSN and the project URL.
84
+ - For a settings update, run `sentry schema updateProject` to confirm the field name. Send only the changed fields. Common fields: `name`, `slug`, `platform`, `isBookmarked`, `resolveAge`, `subjectPrefix`, `highlightTags`, `options[...]`.
85
+ - Changing `slug` changes project URLs and breaks saved links. Treat it as an irreversible change.
86
+ - Resolve `MEMBER_ID` with `sentry api organizations/ORG/members/?query=EMAIL --json`. Do not guess IDs.
87
+
53
88
  ## Log commands
54
89
 
55
90
  ### List logs
@@ -124,7 +159,7 @@ The current CLI create command exposes threshold triggers but no dynamic/anomaly
124
159
  sentry api ENDPOINT [--method METHOD] [--field KEY=VALUE] [--data JSON] [--json]
125
160
  ```
126
161
 
127
- Use `sentry api` only when no first-class CLI command covers the requested operation. Default to read-only `GET` requests. For an explicitly requested alerting write, validate with `--dry-run` and verify the current API schema before executing. Do not mutate unrelated Sentry resources.
162
+ Use `sentry api` only when no first-class CLI command covers the requested operation. Default to read-only `GET` requests. For an explicitly requested write, verify the endpoint with `sentry schema`, validate with `--dry-run`, then execute once. Do not mutate unrelated Sentry resources.
128
163
 
129
164
  ## Common flags
130
165
 
@@ -135,19 +170,22 @@ Use `sentry api` only when no first-class CLI command covers the requested opera
135
170
 
136
171
  ## Common use cases
137
172
 
138
- | User request | Command pattern |
139
- | ----------------------------------------------------- | ------------------------------------------------------------------- |
140
- | "List my orgs" | `sentry org list --json` |
141
- | "Show issues in frontend" | `sentry issue list ORG/frontend --json` |
142
- | "Show unresolved errors across the org" | `sentry issue list ORG/ --query "is:unresolved level:error" --json` |
143
- | "Inspect this issue" | `sentry issue view ISSUE --json` |
144
- | "Show events for this issue" | `sentry issue events ISSUE --json` |
145
- | "Find error logs" | `sentry log list ORG/PROJECT --query "level:error" --json` |
146
- | "Inspect a trace" | `sentry trace view ORG/PROJECT/TRACE_ID --json` |
147
- | "Show logs for a trace" | `sentry trace logs ORG/TRACE_ID --json` |
148
- | "Call an endpoint not covered by high-level commands" | `sentry api organizations/ --json` |
149
- | "Create a static metric alert" | `sentry alert metrics create ... --dry-run`, then execute |
150
- | "Create a dynamic anomaly alert" | Verify CLI help; use API fallback only if still unsupported |
173
+ | User request | Command pattern |
174
+ | ----------------------------------------------------- | --------------------------------------------------------------------------------- |
175
+ | "List my orgs" | `sentry org list --json` |
176
+ | "Show issues in frontend" | `sentry issue list ORG/frontend --json` |
177
+ | "Show unresolved errors across the org" | `sentry issue list ORG/ --query "is:unresolved level:error" --json` |
178
+ | "Inspect this issue" | `sentry issue view ISSUE --json` |
179
+ | "Show events for this issue" | `sentry issue events ISSUE --json` |
180
+ | "Find error logs" | `sentry log list ORG/PROJECT --query "level:error" --json` |
181
+ | "Inspect a trace" | `sentry trace view ORG/PROJECT/TRACE_ID --json` |
182
+ | "Show logs for a trace" | `sentry trace logs ORG/TRACE_ID --json` |
183
+ | "Call an endpoint not covered by high-level commands" | `sentry api organizations/ --json` |
184
+ | "Create a project for my Node app" | `sentry project create ORG/NAME:node --team TEAM --dry-run`, then execute |
185
+ | "Give team X access to project Y" | `sentry api projects/ORG/Y/teams/X/ -X POST --dry-run`, then execute |
186
+ | "Change project setting Z" | `sentry schema updateProject`, then `sentry api projects/ORG/PROJECT/ -X PUT ...` |
187
+ | "Create a static metric alert" | `sentry alert metrics create ... --dry-run`, then execute |
188
+ | "Create a dynamic anomaly alert" | Verify CLI help; use API fallback only if still unsupported |
151
189
 
152
190
  ## Troubleshooting
153
191
 
@@ -163,8 +201,9 @@ Use `sentry api` only when no first-class CLI command covers the requested opera
163
201
  | API returns `401` or invalid/expired/revoked token text | Stale or missing credential | Rerun the real command once so the runtime can trigger reconnect. |
164
202
  | API returns explicit missing scope text | OAuth grant lacks a named scope | Rerun the real command once so the runtime can trigger reconnect. |
165
203
  | API returns generic `403` or permission denied | Connected account lacks org/project access | Stop and tell the user the current connection cannot access the requested data. |
166
- | Alert write returns an explicit missing-scope error | OAuth grant predates alert writes | Rerun once to trigger reconnect; the connection needs `alerts:write`. |
167
- | Static metric alert requested | First-class CLI command is available | Use `sentry alert metrics create`; do not drop directly to `sentry api`. |
168
- | Dynamic/anomaly alert flags are unavailable | CLI coverage gap | Verify live help, then use the current API fallback if needed. |
204
+ | Alert write returns an explicit missing-scope error | OAuth grant predates alert writes | Rerun once to trigger reconnect; the connection needs `alerts:write`. |
205
+ | Project or team write returns an explicit missing-scope error | OAuth grant predates the write scope | Rerun once to trigger reconnect; the connection needs `project:write` or `team:write`. |
206
+ | Static metric alert requested | First-class CLI command is available | Use `sentry alert metrics create`; do not drop directly to `sentry api`. |
207
+ | Dynamic/anomaly alert flags are unavailable | CLI coverage gap | Verify live help, then use the current API fallback if needed. |
169
208
 
170
209
  Use these command shapes during normal skill execution, but treat live CLI help as the final source when this reference and the installed CLI disagree.