Dashboard › cli › Distillation
ff0602fb-8a0b-43d0-a85c-75ce952827c9["lore_tm_v1_-vSj6mYKlOgrZtMQimnk8le0jqBTy3ZB7sMhOMEwqhE","lore_tm_v1_V_4SRnRFwCLYUFFTLvcor1k3W1OmiV_myPYk9Iipauw","lore_tm_v1_2fVAKXI0VOLFJrXNht04LbPj0k02OXqORxrPEKYNROs","lore_tm_v1__ILBS9Itv3W7pFD6_9RHIQUB88s3yRcLf2qz_ZUfvqA"]
/home/byk/Code/getsentry/cli-pr-1558/packages/cli/src/app.ts defines the top-level routes with buildRouteMap(), defaultCommand: "help", brief "A gh-like CLI for Sentry", and visible routes in this order: help, alert, auth, build, cli, code-mappings, agent-conversation, dart-symbol-map, debug-files, dashboard, docs, org, platform, project, proguard, react-native, replay, release, repo, team, issue, event, events, explore, feedback, log, monitor, snapshots, sourcemap, sourcemaps, span, status, trace, trial, init, info, local, api, and schema.src/app.ts retains backward-compatible old sentry-cli aliases hidden from help: send-event, send-envelope, bash-hook, agent-conversations, dashboards, issues, orgs, platforms, projects, replays, releases, repos, teams, logs, monitors, spans, traces, trials, and whoami; sourcemaps is also hidden.src/app.ts defines PLURAL_TO_SINGULAR mappings: agent-conversations→agent-conversation, dashboards→dashboard, events→event, issues→issue, orgs→org, platforms→platform, projects→project, releases→release, repos→repo, teams→team, logs→log, monitors→monitor, replays→replay, spans→span, traces→trace, and trials→trial.routesWithDefaultCommand is derived automatically at module load from routes.getAllEntries() by selecting RouteMap entries whose getDefaultCommand?.() is truthy, avoiding a manually maintained group list.detectBareRouteGroup(ansiColor) detects a route group entered without a subcommand and returns Usage: sentry ${route} <command> [args]\nRun "sentry ${route} --help" to see available commands, optionally wrapped with warning().detectPluralAliasMisuse(ansiColor) recognizes a first argument in PLURAL_TO_SINGULAR and suggests \nDid you mean: sentry ${singular} ${rest}\n, optionally styled with warning().formatSynonymError(exc, ansiColor) handles only CliError values with a result from getSynonymSuggestionFromArgv(), formatting Error: ${exc.format()}\nTip: ${synonymHint} and skipping this known user mistake otherwise.escapesToOuterMiddleware(exc) returns true for every OutputError, for AuthError reasons "not_authenticated" or "expired", and for ApiError HTTP statuses 401 or 403./home/byk/Code/getsentry/cli-pr-1558/packages/cli/src/lib/help.ts, HelpJsonResult is the union of the full-tree object { routes: RouteInfo[]; envVars: HelpEnvVarInfo[]; flags: HelpFlagInfo[] }, CommandInfo, RouteInfo, and { error: string; suggestions?: string[] }.buildTopLevelEnvVars() maps exactly the TOP_LEVEL_ENV_VARS registry entries to name, brief, description, example, and defaultValue; brief falls back from briefDescription to the first line of description, then "". buildCommonFlags() maps COMMON_FLAGS to long, short, and description.introspectAllCommands() returns { routes: extractAllRoutes(routeMap), envVars: buildTopLevelEnvVars(), flags: buildCommonFlags() }. introspectCommand(commandPath) returns resolved command/group metadata, { error: "Command not found: …" } when unresolved, and includes suggestions only when the unresolved suggestion list is nonempty.renderJsonHelp(prefix, unprocessedInputs) returns undefined unless --json is detected, allowing Stricli’s ordinary text help to remain unchanged. In JSON mode it builds the path from prefix.slice(1) plus leftover extraPath, calls introspectAllCommands() for an empty path or introspectCommand(commandPath) otherwise, optionally applies filterFields(data, fields), and returns ${formatJson(final)}\n.renderJsonHelp() deliberately folds unresolved non-flag tokens into the command path, so an invocation such as sentry issue nope --help --json produces structured { error } output for the unknown command instead of silently returning the parent group.isVersionRequest(argv) returns true for a bare --version encountered before --; it returns false once -- is encountered and intentionally excludes -v, because Sentry maps -v to --verbose.isRecoverableUnknownCommand(argv) marks an unknown-command exit recoverable when any of these apply: 1. isVersionRequest(argv), 2. rewriteHelpJsonToHelpCommand(argv) !== undefined, or 3. at least 2 arguments are present and the final token is help; recoverable requests suppress erroneous unknown_command telemetry.rewriteHelpJsonToHelpCommand(argv) requires both --help/-h and --json before a -- separator. It rewrites the request to ["help", "--json", ...extraPath] and appends ["--fields", fields.join(",")] when fields are present, allowing unknown routes rejected before Stricli’s help hook to emit structured error JSON through the regular help command.parseHelpJsonFlags(inputs) scans only before --, detects --json, parses spaced or inline --fields, skips values belonging to value-taking global flags, ignores other flags, and collects leftover non-flag tokens in extraPath.VALUE_FLAG_TOKENS is derived from GLOBAL_FLAGS entries with kind === "value" except fields, including both --${flag.name} and any -${flag.short}. isValueFlagToken(token) supports inline long forms by stripping the =<value> suffix.consumeValueFlag(inputs, index) consumes a following spaced value unless the current token contains = or the next token begins with -; consumeFieldsFlag() supports --fields=a,b and --fields a,b and parses values with parseFieldsList().formatSuggestionList(items) uses these exact forms: 1 item → "issue", 2 items → "issue or trace", 3 items → "issue, trace, or auth".src/lib/help.ts: formatFlagHuman() includes a short alias when present, adds <value> for non-variadic parsed/enum flags, adds <value>... for variadic flags, includes the brief, and prints non-boolean defaults as (default: ${JSON.stringify(flag.default)}); formatCommandHuman() prints signature, brief, visible flags, and JSON fields; formatGroupHuman() prints sentry ${group.name}, the brief, and aligned subcommand names/descriptions, or (no commands) for an empty group.--json never calls the human formatter formatHelpHuman; therefore it never triggers printCustomHelp()’s sixel probe or terminal I/O.formatHelpHuman(data) dispatches full trees containing routes to printCustomHelp().trimEnd(), route groups containing commands and name to formatGroupHuman(), single commands containing path to formatCommandHuman(), and errors to Error: ${data.error} with optional Did you mean: ${formatSuggestionList(suggestions)}?./home/byk/Code/getsentry/cli-pr-1558/packages/cli/test/commands/agent-conversation/view.test.ts is 415 lines and tests viewCommand.func using Vitest spyOn mocks for getConversationSpans, getAuthConfig, withProgress, and resolveOrg, avoiding real HTTP and database access.ORG = "test-org", CONVERSATION_ID = "conv-abc-123", auth token "sntrys_test" with source "oauth", and 2 AgentConversationSpan fixtures for project "my-project" / project ID 42, model "gpt-4", with messages "hi"→"hello" and "what is 2+2?"→"4".viewCommand.func tests verify that test-org/conv-abc-123 resolves the explicit org and calls getConversationSpans("test-org", "conv-abc-123"), while a bare conv-abc-123 calls resolveOrg with org: undefined and can resolve to "auto-org".test-org/conv-abc-123/extra, 2. test-org//conv-abc-123, 3. test-org/conv-abc-123/, 4. /conv-abc-123, 5. test-org/. Each must throw ValidationError with field "conversation-id" and a message containing sentry agent-conversation view [<org>/]<conversation-id>.ContextError mentioning "Conversation ID" and require failed org resolution (resolveOrg returns null) to throw ContextError mentioning "organization".conversationId = "conv-abc-123", org = "test-org", spanCount = 2, an array-valued turns, and propagation of API truncated values for both true and false. Human output must contain the conversation ID and org, show "truncated" when truncation is true, and show "No spans found" for an empty span list./home/byk/Code/getsentry/cli-pr-1558/packages/cli/src/lib/resolve-target.ts contains 9 matched org-resolution exports: resolveOrgFromDsn at line 264, resolveOrgAndProject at line 1298, resolveOrgProjectOrGuide at line 1653, resolveOrg at line 1673, resolveOrgsForListing at line 1877, resolveOrgProjectTarget at line 1951, resolveOrgProjectFromArg at line 2086, resolveOrgOptionalProjectTarget at line 2385, and resolveOrgOptionalProjectFromArg at line 2424.