Dashboard › cli › Distillation
1bd1829e-99b5-4f90-bc95-8f1aecf365ae["lore_tm_v1_R2DGH3hP2JKAVfrj9MCWzXs1QPZuytAyPjckpxLq9Do","lore_tm_v1_7DLadsPb_rrCSxYduKjawthgrLfxiyr1REq46uC6fjk","lore_tm_v1_n5rns7XyAj-C6fj5cPWC_C2BQ1_S83U1JoNhI5IefKI"]
packages/cli/AGENTS.md identifies Sentry CLI as a Node.js CLI built with pnpm and Stricli, located in packages/cli of a pnpm workspace; the docs site is in apps/cli-docs.packages/cli/AGENTS.md: zero-config project detection from DSNs in source/env files; Seer AI-powered debugging; UX following gh CLI conventions; agent-friendly JSON output and predictable behavior; native binaries via Node SEA/fossilize and SQLite API-response caching.packages/cli/AGENTS.md: DSN scanning across .env, JavaScript, Python, Go, Java, Ruby, and PHP; project-root detection via VCS/language/build markers; directory-name inference using bidirectional word-boundary matching; regional API fan-out for us.sentry.io and de.sentry.io; monorepo aliases; Seer AI commands issue explain and issue plan; OAuth Device Flow..cursor/rules/ultracite.mdc for code-style, formatting, and linting rules.package.json for the latest scripts.packages/cli, or from the repository root via pnpm --filter sentry run <script>.pnpm install from the repository root; pnpm run dev; and pnpm run cli -- <args>.pnpm run build for the current platform and pnpm run build:all for all platforms.pnpm run typecheck, pnpm run lint, and pnpm run lint:fix; pnpm run lint:fix should run before committing.pnpm run test:unit, pnpm run test:e2e, pnpm exec vitest run test/lib/foo.test.ts for one test file while skipping generation steps, and pnpm exec vitest for watch mode.devDependencies, never dependencies; everything is bundled at build time with esbuild, and CI enforces this through pnpm run check:deps.pnpm add -D <package> with the -D flag.@sentry/api provides API-response types, code should import those types directly rather than create redundant Zod schemas in src/types/sentry.ts.node:* standard-library APIs and must not reintroduce Bun.*, bun:test, or bun CLI commands.readFile(path, "utf-8") and writeFile(path, content) from node:fs/promises; existsSync(path) from node:fs; spawn() / execFile() and execSync() from node:child_process; the src/lib/which.ts helper for executable lookup; the src/lib/scan/ scanner for globs; setTimeout(ms) from node:timers/promises; and JSON.parse(await readFile(path, "utf-8")) for JSON files.mkdirSync(dir, { recursive: true, mode: 0o700 }) from node:fs.execFileSync with an argument array over execSync with an interpolated string to avoid shell injection; documented example: execFileSync("id", ["-u", "username"], { encoding: "utf-8", stdio: ["pipe", "pipe", "ignore"] }).apps/cli-docs/src/content/docs/contributing.md, in the project-structure block generated by script/generate-docs-sections.ts; it is intentionally not duplicated in packages/cli/AGENTS.md to avoid drift.ls src/commands/ or sentry --help.src/bin.ts as the entry point, src/app.ts for Stricli application setup, and src/context.ts for dependency injection.src/commands/ has command groups including auth, cli, dashboard, event, issue, log, org, project, release, replay, repo, sourcemap, span, team, trace, trial, and local, plus standalone files api.ts, explore.ts, help.ts, init.ts, and schema.ts.src/lib/ contains shared utilities, including api/, db/, dsn/ with per-language extractors under dsn/languages/, and formatters/; src/types/ contains TypeScript types and Zod schemas.test/ mirrors src/ and includes unit tests, *.property.test.ts, *.model-based.test.ts, e2e/, fixtures/, and mocks/.../../apps/cli-docs/ for the Astro + Starlight documentation site, script/ for build/utility scripts, .cursor/rules/ for Cursor AI rules, and biome.jsonc for lint configuration.buildCommand from ../../lib/command.js, never directly from @stricli/core; the wrapper adds telemetry, injects --json and --fields, and renders output.async *func() generator pattern, yield new CommandOutput(data), and may return { hint }.output.human formatter receives the same data object serialized as JSON; divergent human/JSON data paths should not be created.json flag or branch on flags.json, and must not use stdout.write() for command output because the buildCommand wrapper handles output behavior.src/commands/ should focus on exactly three concerns in order: 1. argument parsing, including positional arguments, flags, and URL detection; 2. API orchestration, including data fetching, errors, and enrichment; 3. output dispatch via yield new CommandOutput(data).src/lib/formatters/<domain>.ts; if a command file exceeds approximately 400 lines, formatting helpers should be extracted into a dedicated formatter module.src/lib/formatters/replay.ts extracted from replay/view.ts, src/lib/formatters/trace.ts, and src/lib/formatters/human.ts.stderr.write() is banned in command files through a GritQL rule; diagnostics must use logger, while data output must use CommandOutput.buildRouteMap from ../../lib/route-map.js, never directly from @stricli/core; the wrapper injects standard aliases according to existing route keys.list β ls; view β show; delete β remove, rm; and create β new.aliases are merged with and take precedence over generated route aliases; code must not manually add aliases already included in the standard alias set.[<org>/<project>/]<id> positional arguments should use parseSlashSeparatedArg from src/lib/arg-parsing.ts; required identifiers such as trace IDs and span IDs must be positional arguments rather than flags.parseSlashSeparatedArg(first, "Trace ID", USAGE_HINT) maps "my-org/my-project/abc123" to { id: "abc123", targetArg: "my-org/my-project" }, after which parseOrgProjectArg(targetArg) yields a type among "auto-detect", "explicit", "project-search", and "org-all".span/list.ts, trace/view.ts, and event/view.ts.mdKvTable(), colorTag(), escapeMarkdownCell(), and renderMarkdown().muted() or chalk; muted text inside Markdown must use colorTag("muted", text).renderMarkdown() should use isPlainOutput() ? text : muted(text), described as the plainSafeMuted pattern.isPlainOutput() precedence is SENTRY_PLAIN_OUTPUT first, then NO_COLOR, then FORCE_COLOR when TTY-only, then !isTTY.isPlainOutput() is implemented in src/lib/formatters/plain-detect.ts and re-exported from markdown.ts for compatibility; references include formatters/trace.ts function formatAncestorChain and formatters/human.ts function plainSafeMuted.src/lib/mutate-command.ts, paralleling list-command.ts.buildDeleteCommand() instead of buildCommand().buildDeleteCommand() automatically injects --yes, --force, and --dry-run, with aliases -y, -f, and -n, respectively.buildDeleteCommand() runs a non-interactive safety guard before func(): when stdin is not a TTY, it refuses to proceed unless --yes or --force is passed; dry-run bypasses the guard.buildDeleteCommand() supports noForceFlag, noDryRunFlag, and noNonInteractiveGuard to suppress specific defaults.packages/cli/AGENTS.md were displayed; continuation begins at offset 261.No files found; the search target/pattern was not included in the observed segment.