Skip to content

Commit 8f824dd

Browse files
authored
docs: unify BugBot audit fixes and stop AGENTS.md tree drift (#1050)
## Summary Consolidates the four recurring Cursor BugBot **"docs:"** audit PRs into a single set of verified fixes, and removes the *root cause* of the repeated audits. Supersedes and closes: - #972 — comprehensive documentation gap audit report - #946 — fix documentation gaps identified by automated audit - #1043 — fix stale architecture tree and phantom `--cause` flag - #909 — fix documentation gaps identified in comprehensive audit ## Root cause: AGENTS.md tree drift Every one of those PRs re-fixed the **hand-maintained architecture tree in `AGENTS.md`**. That tree drifts whenever a command or API module is added, so the weekly audit keeps re-filing it. The repo already generates an always-current project-structure tree into `docs/src/content/docs/contributing.md` via `script/generate-docs-sections.ts`. This PR **removes the duplicated tree from `AGENTS.md`** and replaces it with a concise pointer to the generated tree (plus `ls src/commands/` / `sentry --help`). This eliminates the recurring audit target permanently. ## Verified fixes harvested from the audits Each change was verified against current `main` source, not blindly cherry-picked: - **`issue.md`** — removed the phantom `sentry issue plan --cause 0` example. The `--cause` flag does not exist in `plan.ts`; `plan` automatically runs root-cause analysis (`ensureRootCauseAnalysis`) when needed. Requirements text updated accordingly. *(from #1043)* - **`src/lib/env-registry.ts`** — registered `SENTRY_INIT_TUI` (read at `src/lib/init/ui/factory.ts`) so it surfaces in the generated `configuration.md`. *(from #946)* - **`cli.md`** — documented `sentry cli defaults headers` and `sentry cli defaults ca-cert` (both implemented in `defaults.ts`). *(from #946)* - **`self-hosted.md`** — documented `auth login --url` as the recommended, trust-anchoring login method, and added a **TLS / Corporate Proxies** section (`NODE_EXTRA_CA_CERTS` + `cli defaults ca-cert`/`headers`). *(from #909)* - **`getting-started.mdx` / `README.md`** — noted the **Node.js 22.15+** requirement for npm/pnpm/yarn packages (matches `package.json` engines); added `yarn` install + `pnpm dlx`/`yarn dlx`/`bunx` run options to the README. *(from #909/#946)* Regenerated skill references (`references/issue.md`, `references/cli.md`) via `pnpm run generate:docs`. ## Discarded - The throwaway `DOCUMENTATION_GAPS.md` / `docs/DOCUMENTATION_GAPS.md` / `DOCUMENTATION_GAP_REPORT.md` audit artifacts are **not** committed, and are now gitignored so future bot audits don't accidentally commit them. - Skipped items already landed on `main` since the PRs opened (dashboard `revisions`/`restore` examples, `configuration.md` cross-refs) and the unverified Cursor `~/.agents` claim that #972 itself flagged as inaccurate. ## Verification - `pnpm run typecheck` ✅ - `pnpm run lint` ✅ (only pre-existing unrelated warning in `formatters/local.ts`) - `pnpm run check:fragments` ✅ (all 22 fragments valid) - `pnpm exec vitest run test/lib test/commands test/types` ✅ (5529 passed, 9 skipped) - Confirmed `SENTRY_INIT_TUI` appears in generated `configuration.md`.
1 parent 1a883b9 commit 8f824dd

10 files changed

Lines changed: 93 additions & 135 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ docs/public/.well-known/skills/index.json
7272
# OpenCode
7373
.opencode/
7474
opencode.json*
75+
76+
# Throwaway documentation audit reports (bot-generated, not real docs)
77+
DOCUMENTATION_GAPS.md
78+
docs/DOCUMENTATION_GAPS.md
79+
DOCUMENTATION_GAP_REPORT.md

AGENTS.md

Lines changed: 24 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -105,132 +105,30 @@ const result = execSync("id -u username", { encoding: "utf-8", stdio: ["pipe", "
105105

106106
## Architecture
107107

108-
```
109-
cli/
110-
├── src/
111-
│ ├── bin.ts # Entry point
112-
│ ├── app.ts # Stricli application setup
113-
│ ├── context.ts # Dependency injection context
114-
│ ├── commands/ # CLI commands
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
121-
│ │ ├── org/ # 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
126-
│ │ ├── span/ # list, view
127-
│ │ ├── team/ # list
128-
│ │ ├── trace/ # list, view, logs
129-
│ │ ├── trial/ # list, start
130-
│ │ ├── api.ts # Direct API access command
131-
│ │ ├── help.ts # Help command
132-
│ │ ├── init.ts # Initialize Sentry in your project (experimental)
133-
│ │ └── schema.ts # Browse the Sentry API schema
134-
│ ├── lib/ # Shared utilities
135-
│ │ ├── command.ts # buildCommand wrapper (telemetry + output)
136-
│ │ ├── api-client.ts # Barrel re-export for API modules
137-
│ │ ├── api/ # Domain API modules
138-
│ │ │ ├── infrastructure.ts # Shared helpers, types, raw requests
139-
│ │ │ ├── organizations.ts
140-
│ │ │ ├── projects.ts
141-
│ │ │ ├── issues.ts
142-
│ │ │ ├── events.ts
143-
│ │ │ ├── traces.ts # Trace + span listing
144-
│ │ │ ├── logs.ts
145-
│ │ │ ├── seer.ts
146-
│ │ │ └── trials.ts
147-
│ │ ├── region.ts # Multi-region resolution
148-
│ │ ├── telemetry.ts # Sentry SDK instrumentation
149-
│ │ ├── sentry-urls.ts # URL builders for Sentry
150-
│ │ ├── hex-id.ts # Hex ID validation (32-char + 16-char span)
151-
│ │ ├── trace-id.ts # Trace ID validation wrapper
152-
│ │ ├── db/ # SQLite database layer
153-
│ │ │ ├── instance.ts # Database singleton
154-
│ │ │ ├── schema.ts # Table definitions
155-
│ │ │ ├── migration.ts # Schema migrations
156-
│ │ │ ├── utils.ts # SQL helpers (upsert)
157-
│ │ │ ├── auth.ts # Token storage
158-
│ │ │ ├── user.ts # User info cache
159-
│ │ │ ├── regions.ts # Org→region URL cache
160-
│ │ │ ├── defaults.ts # Default org/project
161-
│ │ │ ├── pagination.ts # Cursor pagination storage
162-
│ │ │ ├── dsn-cache.ts # DSN resolution cache
163-
│ │ │ ├── project-cache.ts # Project data cache
164-
│ │ │ ├── project-root-cache.ts # Project root cache
165-
│ │ │ ├── project-aliases.ts # Monorepo alias mappings
166-
│ │ │ └── version-check.ts # Version check cache
167-
│ │ ├── dsn/ # DSN detection system
168-
│ │ │ ├── detector.ts # High-level detection API
169-
│ │ │ ├── scanner.ts # File scanning logic
170-
│ │ │ ├── code-scanner.ts # Code file DSN extraction
171-
│ │ │ ├── project-root.ts # Project root detection
172-
│ │ │ ├── parser.ts # DSN parsing utilities
173-
│ │ │ ├── resolver.ts # DSN to org/project resolution
174-
│ │ │ ├── fs-utils.ts # File system helpers
175-
│ │ │ ├── env.ts # Environment variable detection
176-
│ │ │ ├── env-file.ts # .env file parsing
177-
│ │ │ ├── errors.ts # DSN-specific errors
178-
│ │ │ ├── types.ts # Type definitions
179-
│ │ │ └── languages/ # Per-language DSN extractors
180-
│ │ │ ├── javascript.ts
181-
│ │ │ ├── python.ts
182-
│ │ │ ├── go.ts
183-
│ │ │ ├── java.ts
184-
│ │ │ ├── ruby.ts
185-
│ │ │ └── php.ts
186-
│ │ ├── formatters/ # Output formatting
187-
│ │ │ ├── human.ts # Human-readable output
188-
│ │ │ ├── json.ts # JSON output
189-
│ │ │ ├── output.ts # Output utilities
190-
│ │ │ ├── seer.ts # Seer AI response formatting
191-
│ │ │ ├── colors.ts # Terminal colors
192-
│ │ │ ├── markdown.ts # Markdown → ANSI renderer
193-
│ │ │ ├── trace.ts # Trace/span formatters
194-
│ │ │ ├── time-utils.ts # Shared time/duration utils
195-
│ │ │ ├── table.ts # Table rendering
196-
│ │ │ └── log.ts # Log entry formatting
197-
│ │ ├── oauth.ts # OAuth device flow
198-
│ │ ├── errors.ts # Error classes
199-
│ │ ├── resolve-target.ts # Org/project resolution
200-
│ │ ├── resolve-issue.ts # Issue ID resolution
201-
│ │ ├── issue-id.ts # Issue ID parsing utilities
202-
│ │ ├── arg-parsing.ts # Argument parsing helpers
203-
│ │ ├── alias.ts # Alias generation
204-
│ │ ├── promises.ts # Promise utilities
205-
│ │ ├── polling.ts # Polling utilities
206-
│ │ ├── upgrade.ts # CLI upgrade functionality
207-
│ │ ├── version-check.ts # Version checking
208-
│ │ ├── browser.ts # Open URLs in browser
209-
│ │ ├── clipboard.ts # Clipboard access
210-
│ │ └── qrcode.ts # QR code generation
211-
│ └── types/ # TypeScript types and Zod schemas
212-
│ ├── sentry.ts # Sentry API types
213-
│ ├── config.ts # Configuration types
214-
│ ├── oauth.ts # OAuth types
215-
│ └── seer.ts # Seer AI types
216-
├── test/ # Test files (mirrors src/ structure)
217-
│ ├── lib/ # Unit tests for lib/
218-
│ │ ├── *.test.ts # Standard unit tests
219-
│ │ ├── *.property.test.ts # Property-based tests
220-
│ │ └── db/
221-
│ │ ├── *.test.ts # DB unit tests
222-
│ │ └── *.model-based.test.ts # Model-based tests
223-
│ ├── model-based/ # Model-based testing helpers
224-
│ │ └── helpers.ts # Isolated DB context, constants
225-
│ ├── commands/ # Unit tests for commands/
226-
│ ├── e2e/ # End-to-end tests
227-
│ ├── fixtures/ # Test fixtures
228-
│ └── mocks/ # Test mocks
229-
├── docs/ # Documentation site (Astro + Starlight)
230-
├── script/ # Build and utility scripts
231-
├── .cursor/rules/ # Cursor AI rules (read these!)
232-
└── biome.jsonc # Linting config (extends ultracite)
233-
```
108+
The full project-structure tree — including the live command/subcommand list and the
109+
domain API modules — is generated from the route tree and lives in
110+
[`docs/src/content/docs/contributing.md`](docs/src/content/docs/contributing.md)
111+
(the `project-structure` block produced by `script/generate-docs-sections.ts`). It is
112+
kept in sync automatically, so it is **not** duplicated here to avoid drift. For the
113+
current command list run `ls src/commands/` or `sentry --help`.
114+
115+
Top-level layout:
116+
117+
- **`src/bin.ts`** — entry point; **`src/app.ts`** — Stricli application setup;
118+
**`src/context.ts`** — dependency-injection context.
119+
- **`src/commands/`** — one directory per command group (`auth`, `cli`, `dashboard`,
120+
`event`, `issue`, `log`, `org`, `project`, `release`, `replay`, `repo`, `sourcemap`,
121+
`span`, `team`, `trace`, `trial`, `local`, …) plus standalone command files
122+
(`api.ts`, `explore.ts`, `help.ts`, `init.ts`, `schema.ts`).
123+
- **`src/lib/`** — shared utilities. Key subtrees: `api/` (domain API modules),
124+
`db/` (SQLite layer), `dsn/` (DSN detection, with per-language extractors under
125+
`dsn/languages/`), and `formatters/` (output formatting). See the file-locations
126+
table below and the JSDoc in each module for details.
127+
- **`src/types/`** — TypeScript types and Zod schemas.
128+
- **`test/`** — tests mirroring `src/` (unit, `*.property.test.ts`,
129+
`*.model-based.test.ts`, `e2e/`, `fixtures/`, `mocks/`).
130+
- **`docs/`** — documentation site (Astro + Starlight); **`script/`** — build/utility
131+
scripts; **`.cursor/rules/`** — Cursor AI rules; **`biome.jsonc`** — lint config.
234132

235133
## Key Patterns
236134

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ brew install getsentry/tools/sentry
3333
```bash
3434
npm install -g sentry
3535
pnpm add -g sentry
36+
yarn global add sentry
3637
bun add -g sentry
3738
```
3839

40+
> The npm/pnpm/yarn packages require Node.js 22.15+.
41+
3942
### Run Without Installing
4043

4144
```bash
4245
npx sentry@latest
46+
pnpm dlx sentry --help
47+
yarn dlx sentry --help
48+
bunx sentry --help
4349
```
4450

4551
## Quick Start

docs/src/content/docs/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ brew install getsentry/tools/sentry
5454

5555
### Package Managers
5656

57-
Install globally with your preferred package manager:
57+
Install globally with your preferred package manager (the npm/pnpm/yarn packages require **Node.js 22.15+**):
5858

5959
<PackageManagerCode
6060
npm="npm install -g sentry"

docs/src/content/docs/self-hosted.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ The OAuth device flow requires **Sentry 26.1.0 or later** and a public OAuth app
2424

2525
#### 2. Log In
2626

27-
Pass your instance URL and the client ID:
27+
Use the `--url` flag to authenticate against your instance (recommended — this registers the host as trusted):
28+
29+
```bash
30+
SENTRY_CLIENT_ID=your-client-id sentry auth login --url https://sentry.example.com
31+
```
32+
33+
Or pass the instance URL via environment variable:
2834

2935
```bash
3036
SENTRY_HOST=https://sentry.example.com SENTRY_CLIENT_ID=your-client-id sentry auth login
@@ -39,6 +45,10 @@ export SENTRY_CLIENT_ID=your-client-id
3945
```
4046
:::
4147

48+
:::note
49+
The `--url` flag is the most secure way to authenticate with a new host — it is the only way to register a trust anchor for that host. Without it, the CLI refuses to log in to an instance URL that was picked up from an untrusted channel (e.g. a `.sentryclirc` file), protecting you from credential leaks and OAuth phishing.
50+
:::
51+
4252
### With an API Token
4353

4454
If your instance is on an older version or you prefer not to create an OAuth application, you can use an API token instead:
@@ -65,6 +75,26 @@ sentry org list
6575

6676
If you pass a self-hosted Sentry URL as a command argument (e.g., an issue or event URL), the CLI detects the instance automatically.
6777

78+
## TLS / Corporate Proxies
79+
80+
If your self-hosted instance sits behind a private CA certificate (common with corporate TLS-intercepting proxies like Zscaler or Netskope), point `NODE_EXTRA_CA_CERTS` at your CA bundle:
81+
82+
```bash
83+
export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem
84+
```
85+
86+
You can also persist this so you don't need the env var on every invocation:
87+
88+
```bash
89+
sentry cli defaults ca-cert /path/to/corporate-ca.pem
90+
```
91+
92+
If your proxy requires custom HTTP headers (e.g. an IAP token), set them with `SENTRY_CUSTOM_HEADERS` or persist them:
93+
94+
```bash
95+
sentry cli defaults headers "X-IAP: token"
96+
```
97+
6898
## Relevant Environment Variables
6999

70100
<!-- GENERATED:START self-hosted-env-vars -->

docs/src/fragments/commands/cli.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ sentry cli defaults project my-project
7676
# Set default Sentry URL (self-hosted)
7777
sentry cli defaults url https://sentry.example.com
7878

79+
# Set custom HTTP headers (self-hosted, e.g. for IAP/proxies)
80+
sentry cli defaults headers "X-IAP: token"
81+
82+
# Set a custom CA certificate (self-hosted, behind a TLS proxy)
83+
sentry cli defaults ca-cert /path/to/ca.pem
84+
7985
# Disable telemetry
8086
sentry cli defaults telemetry off
8187

docs/src/fragments/commands/issue.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@ sentry issue explain my-org/MYPROJECT-ABC
131131
# Force a fresh analysis
132132
sentry issue explain 123456789 --force
133133

134-
# Generate a fix plan (requires explain to be run first)
134+
# Generate a fix plan (automatically runs explain if needed)
135135
sentry issue plan 123456789
136136

137-
# Specify which root cause to plan for
138-
sentry issue plan 123456789 --cause 0
137+
# Force a fresh plan even if one already exists
138+
sentry issue plan 123456789 --force
139139
```
140140

141141
**Requirements:**
142142

143143
- Seer AI enabled for your organization
144144
- GitHub integration configured with repository access
145145
- Code mappings set up to link stack frames to source files
146-
- Root cause analysis must be completed (`sentry issue explain`) before generating a plan
146+
- Root cause analysis is run automatically if needed (the `plan` command triggers `explain` first)
147147

148148
### Resolve and reopen issues
149149

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ sentry cli defaults project my-project
3535
# Set default Sentry URL (self-hosted)
3636
sentry cli defaults url https://sentry.example.com
3737

38+
# Set custom HTTP headers (self-hosted, e.g. for IAP/proxies)
39+
sentry cli defaults headers "X-IAP: token"
40+
41+
# Set a custom CA certificate (self-hosted, behind a TLS proxy)
42+
sentry cli defaults ca-cert /path/to/ca.pem
43+
3844
# Disable telemetry
3945
sentry cli defaults telemetry off
4046

plugins/sentry-cli/skills/sentry-cli/references/issue.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ sentry issue explain my-org/MYPROJECT-ABC
159159
# Force a fresh analysis
160160
sentry issue explain 123456789 --force
161161

162-
# Generate a fix plan (requires explain to be run first)
162+
# Generate a fix plan (automatically runs explain if needed)
163163
sentry issue plan 123456789
164164

165-
# Specify which root cause to plan for
166-
sentry issue plan 123456789 --cause 0
165+
# Force a fresh plan even if one already exists
166+
sentry issue plan 123456789 --force
167167
```
168168

169169
### `sentry issue plan <issue>`

src/lib/env-registry.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ export const ENV_VAR_REGISTRY: readonly EnvVarEntry[] = [
175175
example: "1",
176176
installOnly: true,
177177
},
178+
// -- Init wizard --
179+
{
180+
name: "SENTRY_INIT_TUI",
181+
description:
182+
"Control the TUI (terminal user interface) for `sentry init`. Set to `0` to disable the interactive TUI and use plain text logging output instead. Useful in CI/CD pipelines or environments without full terminal support.",
183+
example: "0",
184+
},
178185
// -- TLS / Certificates --
179186
{
180187
name: "NODE_EXTRA_CA_CERTS",

0 commit comments

Comments
 (0)