Dashboard › cli › Distillation
9e033a12-9d99-4df1-9a78-2da8431f050d["lore_tm_v1_Usb6sbp5y_SyU0MtILZb0cJNNfZvEs_Kxc6bJfzqm38"]
Date: Sep 9, 2026
packages/cli/src/app.ts imports Stricli application primitives ApplicationText, buildApplication, text_en, UnexpectedPositionalError, and UnsatisfiedPositionalError; command-suggestion helpers getCommandSuggestion and getSynonymSuggestionFromArgv; error types/helpers ApiError, AuthError, CliError, getExitCode, OutputError, stringifyUnknown, and WizardError; color formatters error as errorColor and warning; buildTopLevelFlags; renderJsonHelp; introspection helpers isRouteMap and RouteMap; and buildRouteMap.packages/cli/src/app.ts defines PLURAL_TO_SINGULAR: Record<string, string> with 17 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.packages/cli/src/app.ts exports top-level routes = buildRouteMap(...) with defaultCommand: "help" and visible routes: 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.packages/cli/src/app.ts include aliases events: eventListCommand and sourcemaps: sourcemapRoute; backward-compatibility routes are "send-event": sendEventCommand, "send-envelope": sendEnvelopeCommand, "bash-hook": bashHookCommand, "agent-conversations": conversationListCommand, dashboards: dashboardListCommand, issues: issueListCommand, orgs: orgListCommand, platforms: platformListCommand, projects: projectListCommand, replays: replayListCommand, releases: releaseListCommand, repos: repoListCommand, teams: teamListCommand, logs: logListCommand, monitors: monitorListCommand, spans: spanListCommand, traces: traceListCommand, trials: trialListCommand, and whoami: whoamiCommand.packages/cli/src/app.ts uses brief "A gh-like CLI for Sentry" and full description "sentry is a command-line interface for interacting with Sentry. It provides commands for authentication, viewing issues, and making API calls."routes.docs.hideRoute hides 22 backward-compatible or alias routes from help: "agent-conversations", dashboards, events, issues, orgs, platforms, projects, replays, releases, repos, teams, logs, monitors, spans, traces, trials, sourcemaps, whoami, "send-event", "send-envelope", and "bash-hook" are each set to true.packages/cli/src/app.ts derives routesWithDefaultCommand: ReadonlySet<string> at module load rather than maintaining a manual list: it calls routes.getAllEntries(), filters entries whose target satisfies isRouteMap(e.target as unknown) and whose route map returns a truthy value from getDefaultCommand?.(), then stores each matching e.name.original.detectBareRouteGroup(ansiColor) examines process.argv.slice(2), removes tokens beginning with -, and recognizes the bare-route case when at most one non-flag remains and that route belongs to routesWithDefaultCommand. It returns Usage: sentry ${route} <command> [args]\nRun "sentry ${route} --help" to see available commands, wrapped with warning(msg) when ANSI color is enabled; otherwise it returns undefined. This handles route groups whose defaultCommand: "view" would otherwise produce UnsatisfiedPositionalError because an ID was omitted.detectPluralAliasMisuse(ansiColor) reads the first token from process.argv.slice(2) and, when it exists in PLURAL_TO_SINGULAR, preserves all remaining tokens via args.slice(1).join(" ") while suggesting \nDid you mean: sentry ${singular} ${rest}\n; the suggestion is wrapped in warning(...) when ANSI color is enabled and otherwise returned as plain text.formatSynonymError(exc, ansiColor) is intended to format a CliError with a synonym suggestion when a known synonym was consumed as a positional argument by defaultCommand: "view" and to skip Sentry capture for such known user mistakes. In the shown implementation, it returns undefined unless exc instanceof CliError, then calls getSynonymSuggestionFromArgv() and returns undefined when no synonym hint is found.