Dashboard › cli › Distillation
7d02d7cf-a3d5-4a1e-9007-0c6ee111a6cd["lore_tm_v1_M9FCX2DsLfwJZlvGH9_UG2hJknzWmmoD-GXtYywuhN4","lore_tm_v1_BP-Da_Q8-L7FO8kNJa9SFqndJA_yimDeE1-jU2ofHWM","lore_tm_v1_dQ_BrbkC9-l34BtAgup1MI5tS_7VXiaKN1DG5ivBFSs","lore_tm_v1_U6kyetKcXJaMcCi5Lkej2dNye7DRRkmA8sR4dZc7jdI"]
/home/byk/Code/getsentry/cli-pr-1558/packages/cli/script/generate-skill-markdown.ts (48 lines), which exports extractCommandPathFromHeading(), matchExampleToCommand(), and formatCommandExamples().generate-skill-markdown.ts, COMMAND_HEADING_RE is /^sentry\s+([^<[\s]+(?:\s+[^<[\s]+))(?:\s(?:<|[)[^]*)?$/; extractCommandPathFromHeading()returns the literalsentry ${match[1]}path while excluding positional usage such as<...>or[...]`.matchExampleToCommand(code, commandPaths, groupFallback, defaultCommandPath?) sorts command paths longest-first so a specific path such as sentry auth login wins over sentry auth; it then uses code.includes(path), returns undefined if groupFallback is absent, and maps bare group examples to defaultCommandPath ?? groupFallback.formatCommandExamples(examples) returns "" for zero examples; otherwise it emits an **Examples:** section with one fenced bash block and joins examples using a blank line (examples.join("\n\n"))./home/byk/Code/getsentry/cli-pr-1558/packages/cli/script/check-fragments.ts (316 lines), invoked as tsx script/check-fragments.ts for warnings or tsx script/check-fragments.ts --strict to treat missing-subcommand coverage as errors.check-fragments.ts bootstraps missing src/generated/skill-content.ts by creating src/generated recursively and writing export const SKILL_FILES: [string, string][] = [];\n before dynamically importing ../src/app.js and ../src/lib/introspect.js.FRAGMENTS_DIR = \${DOCS_FRAGMENTS}/commands`, skips route helpviaSKIP_ROUTES, expects one .mdfragment per visible route plusindex.md`, and reports both missing fragments and stale fragments with no corresponding route.content.includes("---\ntitle:") || content.startsWith("---\n") and reject the generated marker <!-- GENERATED:END -->; required top-level fragments are defined by REQUIRED_TOP_LEVEL_FRAGMENTS = ["configuration"].check-fragments.ts strips fenced code blocks with FENCED_CODE_BLOCK_RE = /^({3,}|~{3,}).\n[\s\S]?\n\1\s*$/gm` before checking headings, preventing bash comments inside code fences from being mistaken for Markdown headings.fragmentMentionsSubcommand() accepts coverage through: 1. a case-insensitive full CLI path anywhere in the fragment; 2. for a default command, a bare sentry <route> matched with a boundary-aware regex; or 3. a level 1–4 Markdown heading containing the leaf subcommand name outside fenced code blocks.getMultiCommandRoutes() omits standalone routes only when route.commands.length <= 1 and route.commands[0]?.path === \sentry ${route.name}`. findDefaultInRouteMap()identifies a default command by object-reference equality againsttarget.getAllEntries(), and getDefaultCommandName()locates the named top-level route in the StricliRouteMap`.cmd.examples.length > 0 are skipped; uncovered subcommands produce Fragment missing subcommand coverage messages with the fragment path, exact missing subcommand list, and an example sentry ${routeName} ${missing[0]} hint. Messages go to warnings normally or errors under --strict.check-fragments.ts exits with status 1 if the fragment directory is absent or validation errors exist; otherwise it reports All ${actualFragments.size} command fragment files valid (${routeNames.size} routes + index) and All ${REQUIRED_TOP_LEVEL_FRAGMENTS.length} top-level fragment(s) valid./home/byk/Code/getsentry/cli-pr-1558/packages/cli/script/generate-skill.ts (962 lines), which generates: 1. plugins/sentry-cli/skills/sentry-cli/SKILL.md; 2. plugins/sentry-cli/skills/sentry-cli/references/*.md; 3. docs/public/.well-known/skills/index.json; and 4. src/generated/skill-content.ts.generate-skill.ts bootstraps absent src/generated/skill-content.ts before dynamically importing ../src/app.js, writing export const SKILL_FILES: ReadonlyMap<string, string> = new Map();\n; the bootstrap is deliberately before the dynamic import because app.ts → agent-skills.ts → skill-content.ts otherwise fails on a fresh checkout and static imports are hoisted.generate-skill.ts imports marked and helper functions extractCommandPathFromHeading, formatCommandExamples, and matchExampleToCommand from ./generate-skill-markdown.js; route introspection uses buildCommandInfo, extractRouteGroupCommands, isCommand, and isRouteMap from ../src/lib/introspect.js.findDefaultCommandName(routeMap) resolves the configured default by object identity; when the matched route entry is the hidden Auth dispatcher named default, it returns login, ensuring bare sentry auth examples document the user-facing login path.SKILL_DESCRIPTION = "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.", ROUTE_ORDER = ["help", "auth", "org", "project", "issue", "event", "api"], and global flags json, fields, help, helpAll, and log-level.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="([^"]+)"/; stripMdxComponents() removes imports, exports, uppercase JSX/Astro components, and runs of 3+ newlines.${DOCS_PATH}/getting-started.mdx, extracting Install Script and Authentication. The fallback installation commands are curl https://cli.sentry.dev/install -fsS | bash and npm install -g sentry; fallback authentication commands are sentry auth, sentry auth --token YOUR_SENTRY_API_TOKEN, and sentry auth status.collectCommandPaths() recognizes depth-3 generated command headings and initializes each command path in a Map<string, string[]>. associateCodeBlocks() walks marked tokens sequentially, assigns bash blocks to the current recognized command heading when possible, and otherwise calls matchExampleToCommand() using groupFallback = \sentry ${commandGroup}`` and an optional default command path.loadCommandExamples(commandGroup, defaultCommandName?) parses commands/${commandGroup}.md with marked.lexer(), supports both generated ### \sentry ...`` sections and hand-written custom example sections, and returns an empty map when the documentation file is absent.loadCommandsOverview() reads commands/index.md and extracts Global Options, JSON Output, and Opening in Browser; loadAgentGuidance() reads agent-guidance.md.extractRoutes(routeMap) skips hidden top-level entries, loads documentation examples per route, uses extractRouteGroupCommands(target, routeName, docExamples) for route maps, and uses buildCommandInfo(target, \sentry ${routeName}`, examples)` for standalone commands.formatFlag() displays aliases as -${alias}, --${flag.name}, appends <value> for non-variadic parsed/enum flags, appends <value>... for variadic flags, includes briefs, and includes JSON-stringified defaults except for boolean flags. getVisibleFlags() excludes hidden flags and names in GLOBAL_FLAG_NAMES.generateFullCommandDoc() emits a depth-3 command signature, brief, visible flags, a JSON Fields table when present, and canonical examples from formatCommandExamples(). Pipe characters in JSON field types and descriptions are escaped with replaceAll("|", "\\|").TITLE_ACRONYMS = new Set(["api", "cli"]). Each visible non-help route maps 1:1 to references/${route.name}.md, with frontmatter name: sentry-cli-${refName}, package version, route brief as description, bins: ["sentry"], and auth: true.All commands also support \--json`, `--fields`, `--help`, `--log-level`, and `--verbose` flags.`SKILL.md is a compact index: each non-help route gets its title, brief, command signatures and briefs, plus → Full flags and examples: \references/${refFile}`. Preferred routes follow ROUTE_ORDER; unlisted routes receive order value 999`, preserving their source order rather than explicitly alphabetizing them.SKILL.md includes the core agent rule: run the command directly because the CLI auto-detects org/project from .sentryclirc, DSNs in .env/source, and the directory name; agents should not manually list organizations then projects, and should pass explicit <org>/<project> only if auto-detection fails or chooses incorrectly.agent-guidance.md is nested under ## Agent Guidance by increasing heading levels one step using /^(#{2,6})\s/gm. Supplementary output uses documentation content when present; fallbacks state that most commands support --json and that view commands support -w or --web.generateIndexJson() sorts SKILL.md first and all remaining generated file paths with localeCompare(), then writes a discovery manifest containing one skill named sentry-cli, SKILL_DESCRIPTION, and the complete sorted file list.plugins/sentry-cli/skills/sentry-cli/references recursively with force: true to remove stale files, recreates parent directories, writes all skill files, and writes ${DOCS_PUBLIC}/.well-known/skills/index.json.${ sequences, then writes src/generated/skill-content.ts with export const SKILL_FILES: ReadonlyMap<string, string> = new Map([...]); its header marks it auto-generated by script/generate-skill.ts and not to edit manually.generate-skill.ts counts keys beginning with references/ and logs Generated ${OUTPUT_PATH} + ${refCount} reference files + ${INDEX_JSON_PATH} + ${SKILL_CONTENT_PATH}.