Dashboard › cli › Distillation
47cc01b8-4c04-4835-837c-3777c2c8506d["lore_tm_v1_eUhoByrKYYcQZNd6LSqT9uNW0Mp-nU_oveTy6veXJls","lore_tm_v1_ZVA-Me4_fb-rswCmug1e217S7Y2kCRb-ahKzMHiBgFo","lore_tm_v1_Sq7zVHRjUxyd2GRKdwB67XLvWg_iwhwfVxB02FjpuTg","lore_tm_v1_3qj9oy0Z5ferpl_e-uNbnFCa5NcBtE5Q6iCV549Tvik","lore_tm_v1_vzmgt2u5yCeObnitGsJMIhLtK5GD0zbjT1tnzv0LT5E"]
/home/byk/Code/getsentry/cli-pr-1558/packages/cli/script/check-fragments.ts is a 316-line validator for documentation fragments; normal mode reports missing-subcommand coverage as warnings, while tsx script/check-fragments.ts --strict treats those findings as errors.check-fragments.ts bootstraps src/generated/skill-content.ts before importing ../src/app.js; if absent, it recursively creates src/generated and writes the exact stub export const SKILL_FILES: [string, string][] = [];\n.check-fragments.ts dynamically imports routes from ../src/app.js and extractAllRoutes from ../src/lib/introspect.js; command fragments live at ${DOCS_FRAGMENTS}/commands, help is skipped via SKIP_ROUTES, and expected fragment names are every remaining route plus index..md fragment, 2. every actual .md fragment corresponds to a route/index, 3. fragments contain neither YAML frontmatter nor <!-- GENERATED:END -->, 4. required top-level fragments exist, and 5. multi-command fragments cover subcommands.check-fragments.ts requires the top-level fragment ${DOCS_FRAGMENTS}/configuration.md; a missing file becomes Missing top-level fragment: ${path} (required for generated configuration.md page).stripCodeBlocks(md) uses FENCED_CODE_BLOCK_RE = /^({3,}|~{3,}).\n[\s\S]?\n\1\s*$/gm` to remove fenced code before checking headings, preventing Bash comments inside code blocks from being mistaken for Markdown headings.fragmentMentionsSubcommand(content, routeName, command, isDefaultCommand) accepts coverage through: 1. the full sentry <route> <subcommand> reference anywhere, 2. for a default command, bare sentry <route> bounded so a longer subcommand does not falsely match, or 3. a level-1-through-level-4 heading outside code blocks containing the leaf subcommand name.getMultiCommandRoutes() skips standalone routes only when they have at most 1 command and that command path equals sentry ${route.name}; all other routes are checked for subcommand coverage.findDefaultInRouteMap(target) identifies a default command by object-reference equality between target.getDefaultCommand() and entries from target.getAllEntries(), returning sub.name.original; getDefaultCommandName(routeName) applies this to the matching top-level route.cmd.examples.length > 0; uncovered commands produce a message listing exact missing subpaths and suggesting a heading or example such as sentry ${routeName} ${missing[0]}. Findings enter warnings normally or errors under --strict.check-fragments.ts exits with status 1 when the fragment directory is absent or validation errors exist; success logs 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/src/lib/command.ts, every SentryCommandFunction is an async generator: non-streaming commands yield one CommandOutput<T>, streaming commands render each yield immediately, JSON-capable commands must yield one aggregate value when one parseable JSON document is required because individual chunks are pretty-printed rather than JSONL, and void commands return without yielding.CommandReturn, never on individual yields.LocalCommandBuilderArguments.output?: OutputConfig<any> causes automatic injection of --json and --fields; commands yield new CommandOutput(data), the wrapper handles JSON/human rendering, and void yields are ignored.LocalCommandBuilderArguments.auth defaults to requiring authentication; false is for intentionally unauthenticated commands such as auth login, auth logout, auth status, help, and cli upgrade, while "dsn" is for DSN-authenticated commands such as event send and bypasses both the bearer-token guard and .sentryclirc URL trust check.skipRcUrlCheck?: boolean defaults to false; true is intended for trust-establishing/tearing-down commands such as auth login and auth logout, which must run even if a repository-local .sentryclirc URL mismatches the current token.LOG_LEVEL_FLAG is a hidden optional enum over LOG_LEVEL_NAMES with brief Set log verbosity level; VERBOSE_FLAG is a hidden boolean defaulting to false, with brief Enable verbose (debug-level) logging output, and is equivalent to --log-level debug.buildFieldsFlag(outputConfig) uses the generic FIELDS_FLAG when no schema or no extracted fields exist; otherwise its brief appends . Available: ${fieldNames}, where field names are comma-separated from extractSchemaFields(outputConfig.schema).enrichDocsWithSchema() appends formatSchemaForHelp(schemaFields) to docs.fullDescription ?? docs.brief; prepareNativeDocs() removes extended examples from native docs and renders each as ${command} # ${description} under an Examples: section.attachDocumentationMetadata() stores the first customUsage value as __primaryUsageβusing the string directly or .input for an objectβand stores nonempty examples as __examples.GLOBAL_FLAG_DEFAULTS injects [LOG_LEVEL_KEY]: LOG_LEVEL_FLAG, verbose: VERBOSE_FLAG, org: ORG_FLAG, and project: PROJECT_FLAG; ALWAYS_STRIP = new Set([LOG_LEVEL_KEY]).ALWAYS_STRIP are always stripped, so the command never sees them.mergeGlobalFlags(existingFlags, outputConfig) preserves command ownership of json, org, and project; injects absent global defaults and adds their names to stripKeys; injects json only when output configuration exists and the command does not own it; and sets fields = buildFieldsFlag(outputConfig) whenever output configuration exists.buildCommand() derives short global aliases from shared GLOBAL_FLAGS; an alias is injected only when gf.short exists and neither the global flag name is command-owned nor its short name already occurs in merged aliases.handleYieldedValue() defers a ClearScreen token until the next render unless output is plain or JSON; only CommandOutput values with an output config and renderer are rendered, using json, parsed fields, and optional clear prefix \x1b[H\x1b[J.cleanRawFlags() removes every key in stripKeys; when output configuration exists and fields remains a string, it converts it with parseFieldsList().writeFinalization() suppresses all finalization in JSON mode; otherwise it prefers renderer.finalize(hint) and writes nonempty text, falling back to writeFooter(stdout, hint).maybeRecoverWithHelp() recovers only from CliError other than OutputError, when positional args contain exactly "help", "--h", or "-help" and ctx.commandPrefix exists; it dynamically imports introspectCommand and formatHelpHuman, writes a Tip: use --help warning to stderr, and writes formatted command help to stdout.buildCommand() wrapper applies logging flags first, maps compatibility --org/--project flags to environment variables before auth or resolution, cleans flags, records flag/argument telemetry context, and enables environment-based JSON when SENTRY_OUTPUT_FORMAT === "json".json === true, yes === true, or dry-run === true; using parsed flags avoids confusing command-specific aliases such as list -n for limit versus init -n for dry-run..next() so the final CommandReturn and its hint are retained; auth guarding is inside the try so positional-help recovery can intercept an AuthError, and .sentryclirc trust is checked through dynamically imported assertRcUrlTrusted() unless bypassed.withTracing("exec", "cli.command.exec", ...); render tracing uses withTracing("render", "cli.command.render", ...). Completed commands receive appendCacheHint(returned.hint), while bare return; paths such as --web receive no footer.OutputError; OutputError.data is rendered through CommandOutput when non-nullish, after which the error is rethrown so the exit code propagates.__jsonSchema when outputConfig.schema exists and always receive __rawFunc = originalFunc; __rawFunc supports internal dispatchers such as bare sentry auth without re-entering telemetry, auth-guard, rc-trust, or output pipelines./home/byk/Code/getsentry/cli-pr-1558/packages/cli/test/commands/agent-conversation/view.test.ts is a 415-line Vitest suite for sentry agent-conversation view; it mocks api-client.js, db/auth.js, polling.js, and resolve-target.js by wrapping exported functions with vi.fn, and uses spyOn for getConversationSpans, getAuthConfig, withProgress, and resolveOrg.ORG = "test-org", CONVERSATION_ID = "conv-abc-123", /tmp as cwd, auth token "sntrys_test" with source "oauth", JSON_FLAGS = { json: true, fresh: false }, and HUMAN_FLAGS = { json: false, fresh: false }."my-project" / project ID 42, model "gpt-4", operation "ai_client", token count "100", and messages hiβhello followed by what is 2+2?β4.${ORG}/${CONVERSATION_ID} resolves the explicit org and API call, while a lone conversation ID resolves { org: undefined } to "auto-org" before calling getConversationSpans("auto-org", CONVERSATION_ID).${ORG}/${CONVERSATION_ID}/extra, 2. ${ORG}//${CONVERSATION_ID}, 3. ${ORG}/${CONVERSATION_ID}/, 4. /${CONVERSATION_ID}, and 5. ${ORG}/; each must throw ValidationError with field "conversation-id" and a message containing sentry agent-conversation view [<org>/]<conversation-id>, without calling org resolution or the API.ContextError mentioning Conversation ID, and unresolved organization to throw ContextError mentioning organization.conversationId, org, spanCount: 2, and an array-valued turns; human output must contain the conversation ID and organization.truncated: true and truncated: false, require human output to contain truncated when true, and require empty-span human output to contain No spans found.