Dashboard › cli › Distillation
61d0ce30-b887-4e81-b6f3-0d34e8fd443c["lore_tm_v1_xXA-9OK_hVFu6vqESUXzWblecCM7tjHDNt7fCImbGTU","lore_tm_v1_QtpB3HiMy8W7QK_-as0SR-lWAyMHZ2mM09ACvRc6QDw","lore_tm_v1_coLfQklUUz9NgHJfPy4mG3CuiBBpFMIRJCjmjLm9UUI"]
packages/cli/src/lib/introspect.ts defines simplified route-introspection types because @stricli/coreβs exported RouteMap and Command require complex CommandContext generics and internal types such as RouteMapEntry and FlagParameter are not exported.packages/cli/src/lib/introspect.ts defines RouteMapEntry as { name: { original: string }; target: RouteTarget; hidden: boolean }, RouteTarget as RouteMap | Command, and RouteMap with brief, optional fullDescription, getAllEntries(), and optional getDefaultCommand().packages/cli/src/lib/introspect.ts defines PositionalParams as either a fixed tuple of PositionalParam values or a variadic array parameter; PositionalParam supports brief, placeholder, and optional, while extracted PositionalInfo always contains placeholder, brief, and optional.packages/cli/src/lib/introspect.ts defines FlagDef with kind "boolean" | "parsed" | "enum" plus optional brief, default, optional, variadic, placeholder, and hidden; normalized FlagInfo contains name, brief, kind, optional default, optional, variadic, and hidden.CommandInfo in packages/cli/src/lib/introspect.ts contains path, brief, optional fullDescription, flags, rendered positional, structured positionals, aliases, examples, and optional schema-derived jsonFields; RouteInfo contains name, brief, and commands.packages/cli/src/lib/introspect.ts models path resolution as ResolvedPath = { kind: "command"; info: CommandInfo } | { kind: "group"; info: RouteInfo }; unresolved paths use { kind: "unresolved"; input: string; suggestions: string[] } with up to 3 fuzzy-matched suggestions from routes available at the failing level.isRouteMap(target) and isCommand(target) in packages/cli/src/lib/introspect.ts accept unknown; a route map is detected by a non-null object containing getAllEntries, while a command is a non-null object containing parameters but not getAllEntries.getPositionalString() in packages/cli/src/lib/introspect.ts returns "" when no positionals exist; tuple parameters render as space-separated <placeholder> values with fallback names arg0, arg1, etc.; array parameters render as <placeholder...> with fallback <args...>.extractPositionals() in packages/cli/src/lib/introspect.ts returns [] for no parameters; tuple entries default to placeholder arg${i}, brief "", and optional: false; array parameters produce one entry whose placeholder ends in ..., brief defaults to "", and optional is always true.extractFlags() in packages/cli/src/lib/introspect.ts returns [] for absent flags and normalizes entries with brief "", preserved default, optional: def.optional ?? def.kind === "boolean", variadic: false by default, and hidden: false by default.buildCommandInfo() in packages/cli/src/lib/introspect.ts derives jsonFields with extractSchemaFields(cmd.__jsonSchema), omits the property when extraction is empty, prefers cmd.__primaryUsage over generated positional syntax, extracts aliases and structured positionals, and accepts legacy examples: string[] = [] as fallback.extractRouteGroupCommands() in packages/cli/src/lib/introspect.ts recursively walks nested route maps, skips hidden entries, builds paths as sentry ${routeName} ${subcommand}, and passes matching docExamples into buildCommandInfo().extractAllRoutes() in packages/cli/src/lib/introspect.ts synchronously walks all visible top-level entries without loading documentation examples; groups use recursive extraction, while standalone commands become a one-command RouteInfo at path sentry ${routeName}.packages/cli/script/generate-command-docs.ts bootstraps a missing src/generated/skill-content.ts before dynamically importing the route tree by creating src/generated/ and writing the exact stub export const SKILL_FILES: [string, string][] = [];\n; generate:skill later overwrites it.packages/cli/script/generate-command-docs.ts writes command pages under ${DOCS_CONTENT}/commands, the command index to ${DOCS_CONTENT}/commands/index.md, and configuration documentation to ${DOCS_CONTENT}/configuration.md; command fragments come from ${DOCS_FRAGMENTS}/commands.packages/cli/script/generate-command-docs.ts uses the boundary marker <!-- GENERATED:END -->: content above it is regenerated and content below it is preserved.packages/cli/script/generate-command-docs.ts treats json, fields, help, helpAll, and log-level as global flags documented in the global footer rather than per command; hidden flags are also excluded. The help route is omitted via SKIP_ROUTES.formatFlagRow() in packages/cli/script/generate-command-docs.ts resolves a short alias by finding an alias map entry whose value equals the long flag name; parsed and enum flags render as --name <name>, variadic flags as --name <name>..., and aliases as -x, --name.formatFlagRow() appends (default: ${JSON.stringify(flag.default)}) only when the default is defined, the flag is non-boolean, and the brief does not already contain default:.escapeAngleBrackets() in packages/cli/script/generate-command-docs.ts replaces < with < and > with >; positional argument descriptions pass through this escaping before insertion into Markdown tables.formatPositionalsTable() emits an **Arguments:** Markdown table with columns Argument and Description, rendering placeholders as `<${p.placeholder}>`; it returns "" for zero positionals.formatFlagsTable() emits an **Options:** Markdown table with columns Option and Description, using formatFlagRow() for each flag; it returns "" for zero flags.generateCommandSection() in packages/cli/script/generate-command-docs.ts renders a heading as ### \${cmd.path} ${cmd.positional}`when positional usage exists or### `${cmd.path}`otherwise, followed bycmd.brief`, an optional arguments table, an optional visible-options table, and formatted examples.isStandaloneCommand() in packages/cli/script/generate-command-docs.ts considers a route standalone only when it contains exactly 1 command and that commandβs path is exactly sentry ${route.name}.generatePage() in packages/cli/script/generate-command-docs.ts emits YAML frontmatter with the route name as title and either β${CapName} command for the Sentry CLIβ or β${CapName} commands for the Sentry CLIβ as description; it uses ## Usage for standalone commands and ## Commands for groups.--json for machine-readable output and --fields to select specific JSON fields.β followed by <!-- GENERATED:END -->.capitalize() in packages/cli/script/generate-command-docs.ts fully uppercases the known acronyms api and cli; other route names only have their first character uppercased.generateCommandsTable() in packages/cli/script/generate-command-docs.ts preserves route insertion order from app.tsβs buildRouteMap and emits each row as | [`route`](./route/) | route.brief | rather than using a manual ordering constant.generateEnvVarSection() in packages/cli/script/generate-command-docs.ts emits a ### \VAR_NAME`heading and description; when an example exists, it adds a fencedbashblock containingexport VAR_NAME=example`.packages/cli/script/generate-skill.ts generates 3 artifact groups: plugins/sentry-cli/skills/sentry-cli/SKILL.md, full per-route Markdown under plugins/sentry-cli/skills/sentry-cli/references/*.md, and docs/public/.well-known/skills/index.json.packages/cli/script/generate-skill.ts separately bootstraps a missing src/generated/skill-content.ts with the exact stub export const SKILL_FILES: ReadonlyMap<string, string> = new Map();\n before dynamically importing ../src/app.js; the script replaces this stub with real generated content at the end.findDefaultCommandName(routeMap) in packages/cli/script/generate-skill.ts uses getDefaultCommand() and identity comparison against route entries to find a default subcommand; the hidden auth route named default is specially mapped to user-facing login, so bare sentry auth examples document the login path.packages/cli/script/generate-skill.ts reads the package version from package.json; its output locations are plugins/sentry-cli/skills/sentry-cli/SKILL.md, plugins/sentry-cli/skills/sentry-cli/references, and ${DOCS_PUBLIC}/.well-known/skills/index.json.packages/cli/script/generate-skill.ts uses FRONTMATTER_REGEX = /^---\n[\s\S]*?\n---\n/, CODE_BLOCK_REGEX = /```(\w*)\n([\s\S]*?)```/g, and PACKAGE_MANAGER_REGEX = /<PackageManagerCode[\s\S]*?npm="([^"]+)"/ for documentation parsing.SKILL_DESCRIPTION in packages/cli/script/generate-skill.ts is β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.βpackages/cli/script/generate-skill.ts is exactly: 1. help, 2. auth, 3. org, 4. project, 5. issue, 6. event, 7. api; unlisted routes follow in alphabetical order.packages/cli/script/generate-skill.ts omits global flags json, fields, help, helpAll, and log-level from the compact command index and documents them once in a Global Options section.packages/cli/script/generate-skill.ts include: stripFrontmatter() removing only leading YAML frontmatter; stripMdxComponents() removing line-based imports/exports, self-closing capitalized JSX components, paired capitalized JSX components, and collapsing 3 or more newlines to 2; extractSection() returning content under a named heading until the next heading of equal or higher level; extractCodeBlocks() returning trimmed { code, lang } values with optional exact-language filtering; and escapeRegex() escaping regex metacharacters.loadDoc(relativePath) in packages/cli/script/generate-skill.ts resolves files beneath DOCS_CONTENT, checks existence with access(), returns null when absent, and otherwise reads UTF-8 content.