Dashboard › cli › Distillation
16215f8c-f405-4e17-89ea-b4cdc4a29da0["lore_tm_v1_sI4jQw0GpfXNAbmhTyZ-kMhDrf1Pg6k6l7SPcnvNWJs","lore_tm_v1_uBiuriD7A1y50A0MOZaA4e7i2Lg9eIyF_3xoG2p5VQM","lore_tm_v1_DUU-qevvULlk5mVfhmXUmEp2g4HQ_Z2zlMKZ_pbPcU0","lore_tm_v1_T9rpbTe_HUkAq9J4yrjwOfdPikz7Qo_N26Hy8rDKk1U","lore_tm_v1_DvSBYr51osvHuTpQfMASiYhO3mKoGfOP30Npp42JuC4"]
packages/cli/test/commands/agent-conversation/view.test.ts tests viewCommand.func with ORG = "test-org", CONVERSATION_ID = "conv-abc-123", JSON_FLAGS = { json: true, fresh: false }, and HUMAN_FLAGS = { json: false, fresh: false }; mocks getAuthConfig() to return { token: "sntrys_test", source: "oauth" }, mocks withProgress as a direct passthrough, and uses 2 AgentConversationSpan fixtures.packages/cli/test/commands/agent-conversation/view.test.ts verifies slash-separated ${ORG}/${CONVERSATION_ID} passes explicit org: ORG to resolveOrg() and calls getConversationSpans(ORG, CONVERSATION_ID); a bare conversation ID passes org: undefined to resolveOrg() and, when resolved to "auto-org", calls getConversationSpans("auto-org", CONVERSATION_ID).packages/cli/test/commands/agent-conversation/view.test.ts rejects exactly 5 malformed targets before organization resolution or API access: ${ORG}/${CONVERSATION_ID}/extra, ${ORG}//${CONVERSATION_ID}, ${ORG}/${CONVERSATION_ID}/, /${CONVERSATION_ID}, and ${ORG}/. Each must produce a ValidationError with field: "conversation-id" and a message containing sentry agent-conversation view [<org>/]<conversation-id>; neither resolveOrg() nor getConversationSpans() may be called.packages/cli/test/commands/agent-conversation/view.test.ts verifies no argument throws ContextError mentioning "Conversation ID"; unresolved organization (resolveOrg() returns null) throws ContextError mentioning "organization"; JSON output includes conversationId, org, spanCount: 2, and an array-valued turns; human output contains the conversation ID and organization; and the API responseβs truncated boolean is preserved for both true and false.packages/cli/src/lib/resolve-target.ts: resolveOrgFromDsn at line 264, resolveOrgAndProject at line 1298, resolveOrgProjectOrGuide at line 1653, resolveOrg at line 1673, resolveOrgsForListing at line 1877, resolveOrgProjectTarget at line 1951, and resolveOrgOptionalProjectTarget at line 2385.packages/cli/src/lib/resolve-target.ts lines 1660β1723 define resolveOrg(options) with resolution priority: 1. positional/CLI org, 2. SENTRY_ORG / SENTRY_PROJECT environment variables, 3. .sentryclirc, 4. config defaults, 5. DSN auto-detection. DSN results pass through normalizeNumericOrg() because resolveOrgFromDsn() can return a bare numeric organization ID while endpoints such as dashboards reject numeric IDs; DSN failures are silently caught and return null.packages/cli/src/lib/command.ts establishes that all commands must import buildCommand from this module rather than @stricli/core; direct Stricli imports bypass telemetry and global flag handling.CommandOutput<T> and may return { hint }; streaming yields render immediately, but commands supporting --json must yield one aggregate value when callers require one parseable JSON document because individual chunks are pretty-printed rather than JSONL; void commands return without yielding. Hints live exclusively on the generator return value, never on individual yields.buildCommand injects hidden --log-level and --verbose flags globally. --log-level takes precedence over --verbose; --verbose maps to debug. If a command owns verbose, its flag is reused for logging and passed through; otherwise the injected flag is stripped. LOG_LEVEL_KEY = "log-level" is always stripped, and ALWAYS_STRIP = new Set([LOG_LEVEL_KEY]); injected global flags are always stripped so the command never sees them.output: { human: ... } is configured, buildCommand injects --json unless the command owns json, and --fields is always injected regardless. The wrapper pre-parses a string fields value with parseFieldsList() into string[]; --fields supports comma-separated dot-notation paths, is silently ignored without --json, and can expose schema-derived available field names in flag help and a JSON-fields section in command documentation.--org and --project are globally injected for LLM recovery from older sentry-cli syntax. applyOrgProjectFlags() trims them and writes nonblank values to SENTRY_ORG and SENTRY_PROJECT, overwriting existing environment values because explicit CLI intent has priority; blank or whitespace-only values do not overwrite existing environment values. Commands owning their own org or project flags retain those values and do not map them to the environment.mergeGlobalFlags() injects defaults for "log-level", verbose, org, and project only when absent, tracks injected keys in stripKeys, injects output flags when an OutputConfig exists, and derives short aliases such as -v β --verbose from GLOBAL_FLAGS unless the command already owns the corresponding flag or alias.buildCommand authentication defaults to required: it throws new AuthError("not_authenticated") when getAuthConfig() returns no credentials. auth: false disables the token guard; auth: "dsn" skips both the token guard and .sentryclirc URL trust validation; skipRcUrlCheck: true independently skips that trust check.buildCommand wrapper applies logging and org/project compatibility flags before cleaning flags and recording telemetry with setFlagContext() / setArgsContext(). It enables JSON mode when this.env.SENTRY_OUTPUT_FORMAT === "json" and no parsed JSON flag is active, and disables interactive prompts when json, yes, or "dry-run" is exactly true.packages/cli/src/lib/command.ts ignores values unless they are CommandOutput instances with an output config and renderer. ClearScreen defers "\x1b[H\x1b[J" until the next render and is ignored for plain or JSON output. A human renderer is resolved once per invocation to preserve fresh per-invocation state for streaming commands..next() rather than for await...of so it can capture the final CommandReturn; after successful completion it applies appendCacheHint(returned.hint) and finalizes output. Bare return; paths such as --web receive no footer. JSON mode suppresses finalization text; human mode uses renderer.finalize(hint) when available, otherwise writeFooter(stdout, hint).maybeRecoverWithHelp() handles failed positional inputs equal to "help", "--h", or "-help": for any CliError except OutputError, it introspects the current command path, writes a warning such as Tip: use --help for help, and renders command help. Recovery occurs only after an error, so legitimate successful resources named "help" remain valid.OutputError handling renders non-null/non-undefined err.data through new CommandOutput(err.data) and then rethrows so the exit code propagates. On other failures, human renderers finalize without a hint before help recovery/error propagation, while JSON mode avoids finalization to prevent corrupting machine-readable output.__primaryUsage from the first docs.customUsage entry, __examples from command examples, __jsonSchema from outputConfig.schema, and __rawFunc = originalFunc for internal dispatchers that must bypass telemetry, authentication, rc-trust, and output wrapping.