Dashboard › cli › Distillation
01e025d1-19ad-439e-8c81-9a346f5ef82d["lore_tm_v1_IqrKQj830YiqpvqRcuFGzJgezPhzFPH2OBj2B59zTdc","lore_tm_v1_1vcqtI_6AJPegpsO69_GaQUo1cw9RW_30zR4qkc0hDo","lore_tm_v1_TDDuEz1Uce4m1c1qcctl2pao0itkKtR2_SSIWx77xKs"]
packages/cli/script/generate-skill.ts defines SKILL_DESCRIPTION as "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."; preferred ROUTE_ORDER is ["help", "auth", "org", "project", "issue", "event", "api"], with unlisted routes sorted afterward, and GLOBAL_FLAG_NAMES contains "json", "fields", "help", "helpAll", and "log-level".packages/cli/script/generate-skill.ts include stripFrontmatter(), stripMdxComponents(), extractSection(), extractCodeBlocks(), and escapeRegex(); stripMdxComponents() removes import/export lines, self-closing and paired capitalized JSX components, collapses 3+ newlines to 2, and trims.loadDoc(relativePath) in packages/cli/script/generate-skill.ts reads ${DOCS_PATH}/${relativePath} only if accessible, uses UTF-8, and returns content processed through stripFrontmatter() then stripMdxComponents(); missing files return null.loadPrerequisites() in packages/cli/script/generate-skill.ts reads ${DOCS_PATH}/getting-started.mdx, emits ## Prerequisites plus βThe CLI must be installed and authenticated before use.β, extracts Install Script and Authentication, and falls back to getDefaultPrerequisites() if the file is absent.generateInstallSection() gathers bash code blocks and the npm command extracted from the PackageManagerCode Astro component; when both exist it inserts # Or install via npm/pnpm/bun. generateAuthSection() combines all bash blocks from the authentication section into one fenced block.getDefaultPrerequisites() use installation commands curl https://cli.sentry.dev/install -fsS | bash and npm install -g sentry; authentication examples are sentry auth labeled βOAuth login (recommended)β, sentry auth --token YOUR_SENTRY_API_TOKEN, and sentry auth status.packages/cli/script/generate-skill.ts uses marked.lexer(): collectCommandPaths() recognizes depth-3 headings through extractCommandPathFromHeading() and initializes each command in Map<string, string[]>; associateCodeBlocks() walks tokens sequentially, associates bash blocks with the current depth-3 command heading when available, otherwise calls matchExampleToCommand().loadCommandExamples(commandGroup, defaultCommandName?) reads commands/${commandGroup}.md, supports auto-generated ### \sentry ...`sections and hand-written## Examplessections, derives an optional default path assentry ${commandGroup} ${defaultCommandName}, and returns an empty Map` when documentation is absent.loadCommandsOverview() reads commands/index.md and returns sections globalOptions, jsonOutput, and webFlag, extracted respectively from Global Options, JSON Output, and Opening in Browser, with missing sections represented as empty strings; loadAgentGuidance() reads agent-guidance.md.extractRoutes(routeMap) in packages/cli/script/generate-skill.ts skips hidden entries, finds each routeβs default command with findDefaultCommandName() when the target is a route map, loads documentation examples by top-level route name, recursively builds route-group commands through extractRouteGroupCommands(), and builds standalone command info using path sentry ${routeName}.sortRoutes() in packages/cli/script/generate-skill.ts assigns preferred routes their index in ROUTE_ORDER and all unlisted routes order value 999; sorting compares only those numeric order values.packages/cli/script/generate-skill.ts uses formatFlag(): aliases render as -${alias}, --${flag.name}, parsed/enum non-variadic flags add <value>, variadic flags add <value>..., briefs are appended with -, and non-boolean defaults render as (default: ${JSON.stringify(flag.default)}). getVisibleFlags() excludes hidden flags and names in GLOBAL_FLAG_NAMES.generateFullCommandDoc() in packages/cli/script/generate-skill.ts starts each command with heading ### `${cmd.path} ${cmd.positional}` when positional usage exists (otherwise only cmd.path), then emits cmd.brief, a **Flags:** list for visible flags, and subsequently handles JSON-field content.packages/cli/script/generate-skill-markdown.ts defines COMMAND_HEADING_RE = /^sentry\s+([^<[\s]+(?:\s+[^<[\s]+))(?:\s(?:<|[)[^]*)?$/; extractCommandPathFromHeading()strips positional usage beginning with<or[and returns the literal path prefixed withsentry `.matchExampleToCommand() in packages/cli/script/generate-skill-markdown.ts sorts command paths by descending string length so a specific path such as sentry auth login wins over sentry auth, matches using code.includes(path), rejects blocks lacking groupFallback, and routes bare-group examples to defaultCommandPath ?? groupFallback.formatCommandExamples(examples) in packages/cli/script/generate-skill-markdown.ts returns an empty string for no examples; otherwise it emits **Examples:**, a blank line, and one bash fenced block with examples separated by two newlines.packages/cli/script/generate-command-docs.ts, formatFlagRow() renders aliases and long names in a Markdown table row, uses the flagβs own name as the placeholder (for example --limit <limit> rather than <value>), appends ... for variadic values, and adds a non-boolean default only when flag.brief does not already contain "default:".formatPositionalsTable() in packages/cli/script/generate-command-docs.ts emits an **Arguments:** table with <placeholder> values and descriptions processed by escapeAngleBrackets(); formatFlagsTable() emits an **Options:** table and delegates rows to formatFlagRow(). Both return "" for empty input.generateCommandSection() in packages/cli/script/generate-command-docs.ts renders, in order: command signature heading, cmd.brief, an arguments table when cmd.positionals is nonempty, an options table for visible non-global flags, and canonical examples from formatCommandExamples(cmd.examples).isStandaloneCommand(route) identifies a standalone route only when it has exactly 1 command whose path equals sentry ${route.name}.generatePage(route) in packages/cli/script/generate-command-docs.ts creates YAML frontmatter with title: ${route.name} and singular/plural description, adds the route brief, uses ## Usage for standalone commands or ## Commands for groups, emits every command section, adds All commands support \--json` for machine-readable output and `--fields` to select specific JSON fields., and ends with GENERATED_END_MARKER`.capitalize() in packages/cli/script/generate-command-docs.ts fully uppercases acronyms in ACRONYMS = new Set(["api", "cli"]); other names receive only an uppercase first character.generateCommandsTable(allRoutes) in packages/cli/script/generate-command-docs.ts preserves route order from extractAllRoutes() / app.tsβs buildRouteMap insertion order and emits links as [\${route.name}`](./${route.name}/)`; it intentionally uses no manual ordering constant.generateEnvVarSection(entry) in packages/cli/script/generate-command-docs.ts emits heading ### `${entry.name}` , its description, andβwhen entry.example !== undefinedβa bash block containing export ${entry.name}=${entry.example}.generateConfigurationPage() begins with title: Configuration, description Environment variables, config files, and configuration options for the Sentry CLI, and an intro stating that configuration can use config files, environment variables, and a local database; it says the CLI auto-detects the project from the codebase and stores credentials locally after sentry auth login.