Dashboard › cli › Distillation
82c697b5-7fa1-4d79-a797-18ca5dd6ffa2["lore_tm_v1_ZLhETi49eGSCFklrnrhFCzJ17bpTcFHPi2rCrNxMCj0"]
--fields is always injected when output: { human: ... } is configured, including when the command already defines its own json flag.ALWAYS_STRIP are always stripped so the command never sees them; ALWAYS_STRIP is new Set([LOG_LEVEL_KEY]), and LOG_LEVEL_KEY is "log-level".package.json for the latest scripts; commands run from packages/cli or through pnpm --filter sentry run <script> from the repository root.devDependencies, never dependencies, because everything is bundled with esbuild and CI checks this via pnpm run check:deps; package installation must always use pnpm add -D <package> with the -D flag.@sentry/api provides API-response types, they must be imported directly rather than recreated as redundant Valibot schemas in src/types/sentry.ts..cursor/rules/ultracite.mdc before working in the codebase.node:* APIs and must not reintroduce Bun.*, bun:test, or bun CLI commands.execFileSync() with array arguments over string-based execSync() when values may be user-controlled, to avoid shell injection.buildCommand from the local src/lib/command.ts wrapper rather than @stricli/core; direct Stricli imports bypass telemetry, global-flag handling, --json/--fields injection, and output rendering.new CommandOutput(data) and may return { hint }; output.human receives the same data serialized to JSON, and command files must not branch on flags.json or write directly with stdout.write().src/lib/formatters/<domain>.ts, and files over approximately 400 lines should have formatting helpers extracted.buildRouteMap from src/lib/route-map.ts, not @stricli/core; standard aliases are automatically injected as list → ls, view → show, delete → remove, rm, and create → new.mdKvTable(), colorTag(), escapeMarkdownCell(), renderMarkdown()); raw muted()/chalk must not be embedded in output strings.buildDeleteCommand() from src/lib/mutate-command.ts; it injects --yes, --force, and --dry-run with aliases -y, -f, and -n, and applies a non-interactive safety guard unless explicitly opted out.paginationHint() rather than manually assembling navigation arrays; cursor directions include next, prev, and first, with "last" as a silent alias for "next".buildOrgListCommand, 2. dispatchOrgScopedList with overrides, 3. buildListCommand with manual pagination.API_MAX_PER_PAGE (100) must transparently fetch multiple pages, cap perPage with Math.min(flags.limit, API_MAX_PER_PAGE), and never send an API per_page value above 100."date", not "time".pnpm run generate:docs, which runs generate:command-docs followed by generate:skill; command docs are gitignored, while files under plugins/sentry-cli/skills/sentry-cli/ are committed.getAuthToken(), isAuthenticated(), and setAuthToken(token, expiresIn).src/lib/**/*.ts file must begin with module-level JSDoc, and existing shared modules should be extended instead of creating a new utility file when they already cover at least 80% of the need..js extension; imports should group external packages before local imports and use type for type-only imports.catch block must rethrow, log with log.debug()/log.warn(), or return a fallback while logging the suppression; silent, empty, comment-only, and return-only catches are prohibited.useTestConfigDir() from test/helpers.ts; tests must not delete process.env.SENTRY_CONFIG_DIR, capture it at module scope, or manually manage it in beforeEach/afterEach.DEFAULT_NUM_RUNS, whose standard value is 50.main and reverify the bug, 3. separate correctness fixes from subjective UX changes, and 4. reuse shared helpers such as autoPaginate() and safeParseJson() rather than re-deriving fixes.packages/cli/src/lib/command.ts contains 906 lines and defines buildCommand() as the single Sentry CLI command-builder entry point.mergeGlobalFlags() in packages/cli/src/lib/command.ts injects hidden global flags --log-level, --verbose, --org, and --project only when a command does not own them; injected keys are added to stripKeys, while "log-level" is stripped even if command-owned because it is in ALWAYS_STRIP.applyLoggingFlags() gives --log-level precedence over --verbose; --verbose maps to debug logging only when no explicit log level is provided.applyOrgProjectFlags() trims injected --org and --project values and writes non-empty values to SENTRY_ORG and SENTRY_PROJECT; explicit CLI values overwrite existing environment variables, while command-owned flags pass through untouched.buildCommand() authentication defaults to required; auth: false disables the token guard, while auth: "dsn" disables both the token guard and .sentryclirc URL trust check. Missing credentials produce AuthError("not_authenticated"); refresh-token credentials pass for silent API-client refresh.cleanRawFlags() removes all stripKeys and converts a string fields value into string[] through parseFieldsList() when output configuration exists.buildCommand() wrapper enables JSON mode when SENTRY_OUTPUT_FORMAT === "json" and no parsed --json flag is already true.json === true, yes === true, or "dry-run" === true.handleYieldedValue() defers a ClearScreen token until the next human render and emits the ANSI prefix \x1b[H\x1b[J; clear-screen behavior is disabled for plain or JSON output.writeFinalization() suppresses final output in JSON mode, otherwise prefers renderer.finalize(hint) and falls back to writeFooter(stdout, hint).maybeRecoverWithHelp() treats positional "help", "--h", or "-help" as likely mistaken help syntax only after a CliError; it excludes OutputError, writes a warning suggesting --help, and renders command help when introspection succeeds.buildCommand() wraps command execution in tracing span cli.command.exec and output finalization in cli.command.render; it manually calls generator .next() so the terminal CommandReturn value and its hint are preserved.buildCommand() passes the returned hint through appendCacheHint(); bare return; paths such as browser-opening --web flows receive no footer.buildCommand() finalizes streaming human renderers before help recovery/error propagation; OutputError.data is rendered through the configured output system and the original error is rethrown so its exit code propagates.__jsonSchema metadata for introspection and generated docs, and expose the original unwrapped generator as __rawFunc for internal dispatchers that must avoid re-entering telemetry, authentication, rc-trust, and output pipelines.