Skip to content

docs: fix auth token precedence, update stale architecture tree, and documentation audit report#783

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/sentry-cli-documentation-audit-e809
Draft

docs: fix auth token precedence, update stale architecture tree, and documentation audit report#783
cursor[bot] wants to merge 1 commit intomainfrom
cursor/sentry-cli-documentation-audit-e809

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 20, 2026

Summary

This PR fixes several documentation inaccuracies found during a comprehensive audit of the repository's documentation against the actual implementation. It also includes a full gap report below.

Changes

1. Fix auth token precedence documentation (Critical)

The SENTRY_AUTH_TOKEN description in env-registry.ts and the auth command fragment incorrectly stated that environment tokens take precedence over stored OAuth tokens. In reality (since PR #646), stored OAuth tokens take priority by default because they support automatic refresh. The SENTRY_FORCE_ENV_TOKEN env var restores the old behavior.

Files changed:

  • src/lib/env-registry.ts — Fixed SENTRY_AUTH_TOKEN description
  • docs/src/fragments/commands/auth.md — Corrected "Token Precedence" section

2. Update stale AGENTS.md architecture tree

The commands/ tree in AGENTS.md was significantly outdated, missing 7 command directories and many subcommands.

Added: dashboard/, release/, sourcemap/, repo/, init.ts, schema.ts
Updated subcommand lists for: auth/, cli/, event/, issue/, project/

3. Update DEVELOPMENT.md environment variables table

Added 4 missing env vars: SENTRY_AUTH_TOKEN, SENTRY_FORCE_ENV_TOKEN, SENTRY_CLI_NO_TELEMETRY, SENTRY_LOG_LEVEL.

4. Expand agentic-usage.md

  • Documented automatic skill installation via sentry cli setup
  • Expanded supported agents beyond Claude Code (Cursor, ~/.agents convention)
  • Added --no-agent-skills opt-out documentation

Full Documentation Audit Report

A. Undocumented or Missing Commands/Subcommands

All implemented commands have corresponding documentation fragments in docs/src/fragments/commands/. No command directories are missing fragments. The generated doc system + fragment system provides full coverage.

However, the AGENTS.md architecture tree (now fixed in this PR) was missing:

  • dashboard/ (list, view, create, widget add/edit/delete)
  • release/ (list, view, create, finalize, delete, deploy, deploys, set-commits, propose-version)
  • sourcemap/ (inject, upload)
  • repo/ (list)
  • init.ts, schema.ts

B. Undocumented Flags

Most flags are auto-documented by the generated command docs system. However, several globally-injected flags deserve explicit documentation:

Flag Injected By Current Doc Status
--fresh buildListCommand Mentioned in some fragments but not systematically documented
--log-level buildCommand (hidden) Documented in configuration.md fragment
--verbose / -v buildCommand (hidden) Documented in configuration.md fragment
--json / --fields buildCommand (when output set) Documented in command index fragment

Notable undocumented flags:

  • sentry cli setup --install — Internal flag used by the installer, intentionally undocumented
  • sentry cli upgrade --offline — Not mentioned in cli.md fragment
  • sentry auth login --timeout — Not mentioned in auth fragment (default: 900s)
  • sentry auth login --force — Not mentioned in auth fragment
  • sentry auth status --fresh — Not mentioned in auth fragment
  • sentry event list --full — Not mentioned in event fragment
  • sentry trace view --full — Not mentioned in trace fragment
  • sentry issue list --compact — Not mentioned in issue fragment
  • sentry release create --finalize — Mentioned in example but not in a flags table
  • sentry release set-commits --initial-depth — Not documented
  • sentry release set-commits --clear — Not documented
  • sentry release deploy --time — Not documented
  • sentry release deploy --url, --started, --finished — Not documented

C. Missing Usage Examples

All command fragments include bash examples. Coverage is good. Minor gaps:

  • sentry auth whoami — No standalone example in auth fragment (only briefly shown)
  • sentry cli defaults — Examples exist in configuration fragment but not in cli fragment
  • sentry release deploys — No example in release fragment
  • sentry release propose-version — Only shown inline in another example, no standalone section

D. Stale Descriptions

Location Issue
env-registry.ts SENTRY_AUTH_TOKEN Fixed in this PR: Said env token "takes precedence over" stored OAuth — actually reversed since #646
docs/src/fragments/commands/auth.md Fixed in this PR: Listed wrong precedence order (env first, DB last)
AGENTS.md commands tree Fixed in this PR: Missing 7+ command directories and many subcommands
DEVELOPMENT.md env vars table Fixed in this PR: Only listed 3 env vars, missing many development-relevant ones

E. Missing Route Mappings in Skill Generator

No gaps. The ROUTE_TO_REFERENCE map was replaced by automatic introspection in generate-skill.ts. All non-hidden routes automatically get reference files. Hidden routes (plural aliases like issues, orgs, sourcemaps, plus whoami) are intentionally excluded.

F. Installation / Distribution Gaps

The install documentation in getting-started.mdx and README.md is accurate and comprehensive. Minor observations:

Topic Status
Curl install ✅ Documented with --version flag and SENTRY_VERSION env var
Homebrew ✅ Documented
npm/pnpm/bun/yarn ✅ Documented (yarn global add is in docs site but not README)
npx/bunx/pnpm dlx ✅ Documented in getting-started
Nightly channel ✅ Documented in getting-started and cli fragment
SENTRY_INSTALL_DIR Documented in env-registry but not in getting-started
SENTRY_INIT=1 Documented in env-registry but not in getting-started
--no-modify-path / --no-completions installer flags Documented in install script help but not in getting-started
Supported platforms (darwin arm64/x64, linux x64/arm64/musl, windows x64) Not explicitly listed anywhere in docs
Node.js >=22 requirement for npm package Documented in library-usage.md but not in getting-started under Package Managers

G. Undocumented Environment Variables

The env-registry.ts is comprehensive and generates configuration.md. All major env vars are registered. However, configuration.md is gitignored (generated), so docs/src/content/docs/configuration.md was reported as "not found" during this audit — it only exists after running bun run generate:docs.

All 21 env vars from env-registry.ts are documented:
SENTRY_AUTH_TOKEN, SENTRY_TOKEN, SENTRY_FORCE_ENV_TOKEN, SENTRY_ORG, SENTRY_PROJECT, SENTRY_DSN, SENTRY_HOST, SENTRY_URL, SENTRY_CLIENT_ID, SENTRY_CUSTOM_HEADERS, SENTRY_CONFIG_DIR, SENTRY_INSTALL_DIR, SENTRY_VERSION, SENTRY_INIT, SENTRY_PLAIN_OUTPUT, NO_COLOR, FORCE_COLOR, SENTRY_OUTPUT_FORMAT, SENTRY_LOG_LEVEL, SENTRY_CLI_NO_TELEMETRY, SENTRY_CLI_NO_UPDATE_CHECK, SENTRY_NO_CACHE, SENTRY_MAX_PAGINATION_PAGES, SENTRY_CLI_NO_AUTO_REPAIR.

H. Auth / Self-Hosted Gaps

Topic Status
OAuth device flow ✅ Well documented
API token login ✅ Documented
OAuth scopes ✅ Auto-generated from oauth.ts into DEVELOPMENT.md and self-hosted.md
Token storage (SQLite at ~/.sentry/cli.db) ✅ Documented in auth fragment
Self-hosted SENTRY_HOST/SENTRY_URL ✅ Documented
Self-hosted SENTRY_CLIENT_ID requirement ✅ Documented with step-by-step guide
SENTRY_CUSTOM_HEADERS for proxies ✅ Documented in env-registry
.sentryclirc backward compatibility ✅ Documented in configuration fragment
Auth token precedence Fixed in this PR — was inverted in docs vs code
SENTRY_FORCE_ENV_TOKEN Was in env-registry but missing from auth fragment and DEVELOPMENT.md — partially fixed

I. Plugin/Skills Gaps

Topic Status
Automatic installation via sentry cli setup Fixed in this PR — was undocumented in agentic-usage.md
Claude Code support ✅ Documented
Cursor support Mentioned in plugins/README.md but .cursor/skills/ path doesn't exist in repo — README may be aspirational
~/.agents convention Fixed in this PR — now mentioned in agentic-usage.md
Skill files embedded in binary (no network fetch) Fixed in this PR — now documented
--no-agent-skills opt-out Was documented in cli fragment setup section but not in agentic-usage.md
Skills refreshed on upgrade Fixed in this PR — now documented

J. README / DEVELOPMENT.md Drift

Claim Code Reality Status
README: "Bun v1.0+" prerequisite packageManager: bun@1.3.11 in package.json Soft minimum, acceptable
README: bun test Actual: bun run test (runs test:unit && test:isolated) Minor difference — bun test works too
README: Node.js ≥22 for library usage engines.node: ">=22" in package.json ✅ Accurate
DEVELOPMENT.md: Only 3 env vars listed 21+ env vars exist Fixed in this PR (added key dev-relevant ones)
DEVELOPMENT.md: No mention of SENTRY_AUTH_TOKEN build requirement Build script requires SENTRY_CLIENT_ID env var Already documented as (required) in env table
Contributing.md: bun test --coverage Actual test:unit uses --coverage --coverage-reporter=lcov ✅ Close enough

Top 5 Most Impactful Fixes (Prioritized)

  1. Auth token precedence inversion (Fixed) — env-registry.ts and auth fragment told users env tokens win over stored OAuth, but the opposite is true since Wizard-generated SENTRY_AUTH_TOKEN blocks OAuth-based CLI login #646. This could cause confusion for CI/CD setups where users set SENTRY_AUTH_TOKEN expecting it to override an interactive login.

  2. AGENTS.md stale architecture tree (Fixed) — Missing 7+ command directories (dashboard, release, sourcemap, repo, init, schema) means AI agents working on this codebase had an incomplete picture of the command surface.

  3. Agentic usage: missing automatic install docs (Fixed) — The primary installation path (automatic via sentry cli setup) was undocumented, and supported agents were listed as only "Claude Code".

  4. Release command flags undocumentedset-commits --initial-depth, --clear, deploy --time/--url/--started/--finished, and propose-version details are not in the fragment. This is the largest single area of missing flag documentation.

  5. Node.js >=22 not mentioned in getting-started for npm install — Users installing via npm install -g sentry may not realize they need Node.js 22+, which is a hard requirement due to the node:sqlite polyfill. This is only documented in library-usage.md.

Open in Web View Automation 

… 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>
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (issue) Add resolve, unresolve (reopen), and merge commands by BYK in #778

Bug Fixes 🐛

  • (error-reporting) Fall back to message prefix for ValidationError without field by BYK in #776
  • (hex-id) Auto-recover malformed hex IDs in view commands (CLI-16G) by BYK in #777
  • (init) Force process exit after wizard completes by betegon in #782

Documentation 📚

  • Fix auth token precedence, update stale architecture tree, and documentation audit report by cursor[bot] in #783

Internal Changes 🔧

  • (init) Trim deprecated --features help entries by MathurAditya724 in #781
  • Regenerate docs by github-actions[bot] in 58a84035

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-783/

Built to branch gh-pages at 2026-04-20 12:12 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

138 passed | Total: 138 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1709 uncovered lines.
✅ Project coverage is 95.52%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.52%    95.52%        —%
==========================================
  Files          262       262         —
  Lines        38174     38173        -1
  Branches         0         0         —
==========================================
+ Hits         36464     36464         —
- Misses        1710      1709        -1
- Partials         0         0         —

Generated by Codecov Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant