Dashboard › cli › Distillation
5a2914b9-ae1a-467b-8ed3-07111b786a22["lore_tm_v1_JbsWHm2AOrQgH3DroHMDbNhIcK_rqgsQi5luUz6vhNU","lore_tm_v1_Ul26dq8BZaQ1c14FNIQE-jbJuRKSoeo2K-2QM1n3Pjk","lore_tm_v1_Xajd-Lho5dih7XUVtTdOZraxocCB2WZntbnoOlBcRDE","lore_tm_v1_mzsJrxUZjUX7SSuISNBVtrCQZy-tYuVkGL-EPTC100M","lore_tm_v1_eGhuDwA49QdgchYO5cDRP2-BlbB_iFtU4iKfX6YyGSo","lore_tm_v1_-MUursOroEVT_OmQ81SvH04zXnEWqBJZz5Q3V8rOU8k","lore_tm_v1_XK6XnB6Dgjygt1RvtuCDOBkqkUpVv0xpr8oXtBP5WxU"]
packages/cli/script/generate-command-docs.ts generates docs/src/content/docs/commands/{route}.md, docs/src/content/docs/commands/index.md, and docs/src/content/docs/configuration.md by introspecting the CLI route tree and ENV_VAR_REGISTRY, then appending hand-written fragments from docs/src/fragments/.packages/cli/script/generate-command-docs.ts bootstraps missing src/generated/skill-content.ts before dynamically importing ../src/app.js, writing the exact stub export const SKILL_FILES: [string, string][] = [];\n after creating src/generated; this avoids fresh-checkout/CI resolution failure through app.ts β agent-skills.ts β skill-content.ts.packages/cli/script/generate-command-docs.ts uses DOCS_CONTENT and DOCS_FRAGMENTS from packages/cli/script/paths.js; derived paths are DOCS_DIR = ${DOCS_CONTENT}/commands, FRAGMENTS_DIR = ${DOCS_FRAGMENTS}/commands, INDEX_PATH = ${DOCS_DIR}/index.md, and CONFIG_PATH = ${DOCS_CONTENT}/configuration.md.<!-- GENERATED:END -->; generated material precedes it and hand-written fragment content follows it.json, fields, help, helpAll, and log-level, as well as hidden flags, from per-command option tables; route help is excluded entirely through SKIP_ROUTES.formatFlagRow() in packages/cli/script/generate-command-docs.ts finds the first alias mapping to the flag name; emits -q, --query <query>-style syntax; uses <flag-name> for non-variadic parsed/enum flags and <flag-name>... for variadic flags; appends (default: ${JSON.stringify(flag.default)}) only for defined non-Boolean defaults whose brief does not already contain default:.escapeAngleBrackets() replaces </> with </>; formatPositionalsTable() renders required arguments as `<placeholder>` and optional arguments as `[<placeholder>]`, escaping angle brackets only in positional descriptions.generateCommandSection() builds a ### command heading from cmd.path plus cmd.positional, includes cmd.brief, optional Arguments and Options tables, and canonical examples produced by formatCommandExamples(cmd.examples).isStandaloneCommand() considers a route standalone only when it has exactly one command whose path is sentry ${route.name}.generatePage() sets frontmatter title to the route name and description to either ${capitalize(route.name)} command for the Sentry CLI or ${capitalize(route.name)} commands for the Sentry CLI; it uses ## Usage for standalone commands and ## Commands for groups, then adds the exact footer All commands support \--json` for machine-readable output and `--fields` to select specific JSON fields.before<!-- GENERATED:END -->`.api and cli; other route names receive only an uppercase first character.generateCommandsTable() preserves route insertion order from extractAllRoutes()/app.ts and emits links in the form [`route.name`](./route.name/) with each route brief.generateEnvVarSection() emits a ### \VAR_NAME`heading and description, plus a Bash block containingexport ${entry.name}=${entry.example}only whenentry.example !== undefined`.generateConfigurationPage() creates frontmatter titled Configuration, description Environment variables, config files, and configuration options for the Sentry CLI, an intro explaining config files/environment variables/local database and automatic project detection/local credential storage after sentry auth login, an ## Environment Variables section in registry order, and the generated end marker.readCustomContent() reads ${FRAGMENTS_DIR}/${fragmentName}.md, while readTopLevelFragment() reads ${FRAGMENTS_ROOT}/${fragmentName}.md; both return "" on any read failure.packages/cli/script/generate-command-docs.ts creates DOCS_DIR, removes legacy ${DOCS_DIR}/cli recursively with force, generates one ${DOCS_DIR}/${route.name}.md per visible non-skipped route, appends matching custom content without inserting an extra separator, and records generated paths in generatedFiles.title: Commands and description: Available commands in the Sentry CLI, the intro The Sentry CLI provides commands for interacting with various Sentry resources., an ## Available Commands table, <!-- GENERATED:END -->, and the index command fragment to INDEX_PATH.generateConfigurationPage(ENV_VAR_REGISTRY) with the top-level configuration fragment and writes CONFIG_PATH; completion logs Generated ${generatedFiles.length} command doc pages + ${INDEX_PATH} + ${CONFIG_PATH}.packages/cli/script/check-fragments.ts validates five conditions: 1. every visible route plus index has a command fragment, 2. every command fragment maps to a route or index, 3. fragments contain neither YAML frontmatter nor <!-- GENERATED:END -->, 4. required top-level fragments exist, and 5. multi-command fragments cover all subcommands; missing subcommand coverage is warning-only unless invoked with --strict.packages/cli/script/check-fragments.ts also bootstraps missing src/generated/skill-content.ts, writing exact content export const SKILL_FILES: [string, string][] = [];\n, before dynamically importing ../src/app.js and ../src/lib/introspect.js.${DOCS_FRAGMENTS}/commands, excludes route help, recognizes files with /\.md$/, and expects one fragment per route plus index; failure to read the fragment directory logs ERROR: Fragment directory not found: ${FRAGMENTS_DIR} and exits with status 1.Missing fragment: ... (route "..." exists but has no fragment file) and extra files as Stale fragment: ... (no matching route found β delete it or add the route).content.includes("---\ntitle:") or content.startsWith("---\n") as accidental frontmatter and rejects any occurrence of <!-- GENERATED:END -->.REQUIRED_TOP_LEVEL_FRAGMENTS currently contains exactly configuration; missing ${DOCS_FRAGMENTS}/configuration.md is a validation error.FENCED_CODE_BLOCK_RE = /^({3,}|~{3,}).\n[\s\S]?\n\1\s*$/gm` before heading matching, to avoid treating Bash comments in code as Markdown headings.fragmentMentionsSubcommand() accepts coverage through, in order: 1. a case-insensitive full command-path occurrence anywhere, 2. for a default command, a regex-matched bare sentry <route> not followed as a larger command token, or 3. a level 1β4 Markdown heading outside fenced code blocks containing the leaf subcommand name.getMultiCommandRoutes() skips only routes having at most one command whose path is exactly sentry ${route.name}; all other routes are checked for subcommand coverage.target.getDefaultCommand() by object identity against target.getAllEntries() and returns the matching sub.name.original.cmd.examples.length > 0; for each remaining command it derives the subpath after sentry ${routeName} and compares its final leaf against the detected default command.sentry ${routeName} ${missing[0]}; it is appended to errors under --strict, otherwise to warnings.1 when errors exist, and on success logs All ${actualFragments.size} command fragment files valid (${routeNames.size} routes + index) plus All ${REQUIRED_TOP_LEVEL_FRAGMENTS.length} top-level fragment(s) valid.packages/cli/script/generate-skill-markdown.ts uses COMMAND_HEADING_RE = /^sentry\s+([^<[\s]+(?:\s+[^<[\s]+))(?:\s(?:<|[)[^]*)?$/to extract literal command paths while stopping before positional usage;extractCommandPathFromHeading()returnssentry ${match[1]}orundefined`.matchExampleToCommand() sorts command paths by descending length so a path such as sentry auth login wins over sentry auth, returns the first path included in the code, rejects blocks lacking groupFallback, and maps bare-group examples to defaultCommandPath ?? groupFallback.formatCommandExamples() returns "" for no examples; otherwise it emits **Examples:** followed by one Bash fence, joining examples with exactly two newlines.packages/cli/script/generate-skill.ts generates plugins/sentry-cli/skills/sentry-cli/SKILL.md, plugins/sentry-cli/skills/sentry-cli/references/*.md, and docs/public/.well-known/skills/index.json by combining Stricli route metadata with generated documentation.packages/cli/script/generate-skill.ts bootstraps missing src/generated/skill-content.ts synchronously with exact content export const SKILL_FILES: ReadonlyMap<string, string> = new Map();\n; this differs from the tuple-array stub used by the command-doc and fragment-check scripts.findDefaultCommandName() in packages/cli/script/generate-skill.ts compares the route mapβs default-command object with subcommand targets; a hidden default named default is specially mapped to login because bare sentry auth examples document authentication login.SKILL_DIR = "plugins/sentry-cli/skills/sentry-cli", OUTPUT_PATH = ${SKILL_DIR}/SKILL.md, REFERENCES_DIR = ${SKILL_DIR}/references, INDEX_JSON_PATH = ${DOCS_PUBLIC}/.well-known/skills/index.json, and DOCS_PATH = DOCS_CONTENT.getPackageVersion() parses package.json and returns pkg.version for generated YAML frontmatter.Guide for using the Sentry CLI to interact with Sentry from the command line. Use when the user asks about viewing issues, events, projects, organizations, making API calls, or authenticating with Sentry via CLI. and is shared by skill frontmatter and index.json.SKILL.md route order is exactly: 1. help, 2. auth, 3. org, 4. project, 5. issue, 6. event, 7. api; unspecified routes follow these.json, fields, help, helpAll, and log-level from compact/per-command flag listings.packages/cli/script/generate-skill.ts strips start-of-file YAML frontmatter, removes single-line MDX imports/exports and uppercase JSX/Astro components, collapses 3+ newlines to 2, and trims the result.extractSection() matches a heading of levels 1β6 exactly by escaped heading text and returns content until the next heading at the same or higher level; extractCodeBlocks() recognizes triple-backtick blocks with optional word-character language tags and can filter by exact language.loadDoc(relativePath) reads ${DOCS_PATH}/${relativePath} only when accessible, returning processed Markdown or null.extractPackageManagerCommand() extracts the npm="..." value from a possibly multiline <PackageManagerCode ...> component.### Installation, combines all Bash blocks from the Install Script section into one Bash fence, and appends the extracted package-manager command; when both forms exist, it inserts the exact comment # Or install via npm/pnpm/bun.### Authentication and combines all Bash code blocks into one Bash fence.loadPrerequisites() reads docs/src/content/docs/getting-started.mdx; when present it emits ## Prerequisites, the sentence The CLI must be installed and authenticated before use., then generated Install Script and Authentication sections when found.curl https://cli.sentry.dev/install -fsS | bash and npm install -g sentry; authentication examples are sentry auth, sentry auth --token YOUR_SENTRY_API_TOKEN, and sentry auth status, with OAuth labeled recommended.collectCommandPaths() examines only depth-3 Markdown heading tokens, extracts command paths with extractCommandPathFromHeading(), preserves their sequence, and initializes each in the examples map with an empty array.associateCodeBlocks() walks Markdown tokens sequentially; a depth-3 command heading establishes currentCmd, only bash code tokens are considered, blocks under a recognized current command are attached there, and loose blocks are assigned using matchExampleToCommand(commandPaths, groupFallback, defaultCommandPath).loadCommandExamples() loads commands/${commandGroup}.md, parses it with marked.lexer(), collects generated command headings, maps a configured default to sentry ${commandGroup} ${defaultCommandName}, associates Bash blocks by heading context or content, and returns an empty Map when the doc is absent.loadCommandsOverview() extracts Global Options, JSON Output, and Opening in Browser from commands/index.md, returning empty strings for missing sections and null if the document is absent.loadAgentGuidance() loads processed body content from agent-guidance.md.extractRoutes() skips hidden route entries, loads examples per route with its detected default command, uses extractRouteGroupCommands(target, routeName, docExamples) for route maps, and uses buildCommandInfo(target, \sentry ${routeName}`, docExamples.get(path) ?? [])` for standalone commands.sortRoutes() assigns listed ROUTE_ORDER entries their array positions and all unlisted entries order 999; JavaScriptβs sort behavior retains their existing relative order when comparator results tie.formatFlag() emits aliases plus long names, uses generic <value> or <value>... placeholders, includes the brief, and always appends a defined non-Boolean default as (default: ${JSON.stringify(flag.default)}).generateFullCommandDoc() emits each command signature and brief, a **Flags:** bullet list for visible flags, and a JSON fields table when cmd.jsonFields exists; JSON field type and description pipes are escaped as \|.**JSON Fields** (use \--json --fields` to select specific fields):; canonical examples are appended through formatCommandExamples(cmd.examples)`.api and cli.generateReferenceFile() creates one reference file per route with frontmatter fields name: sentry-cli-${refName}, package version, route-brief description, requires.bins: ["sentry"], and requires.auth: true; its title is ${capitalize(refName)} Commands.All commands also support \--json`, `--fields`, `--help`, `--log-level`, and `--verbose` flags.`.- `${signature}` β ${cmd.brief}; generateCompactCommandsSection() skips route help, includes each route heading/brief and all command lines, and adds β Full flags and examples: \references/${refFile}`` when a reference mapping exists.Global Options, JSON Output, and Opening in Browser when available; fallbacks state that most commands support --json and that view commands support -w or --web.