Dashboard › cli › Distillation
82eeab77-a797-4f20-adb1-a2db40d51dce["lore_tm_v1_RHm00qbqP3A2hepFYznzKOnotTIpb4egucI-HCi6g7Y","lore_tm_v1_9g-6dhor9ubPqgMLldbLNQca2HdVwEUxR5h2cap3_ls","lore_tm_v1_CObLSRY6w9cC-uDxlmW4UsWrDdUIFZcatlCaDvdM3y4"]
π΄ (09:39) packages/cli/patches/@stricli%2Fcore@1.2.8.patch adds matchTopLevelFlag(input, topLevelFlags), supporting allow-listed booleanFlags, separate-value valueFlags, and inline --flag=value forms; it returns { takesValue, inlineValue } or null.
π΄ (09:39) The patched Stricli route scanner accepts optional scanner.topLevelFlags at any route depth and forwards recognized flags plus separate values through unprocessedInputs; the option is inert when unset, preserving stock Stricli behavior. The Sentry CLI supplies the allow-list from GLOBAL_FLAGS.
π΄ (09:39) buildRouteScanner() now tracks versionRequested and expectTopLevelFlagValue; an expected top-level flag value is forwarded unless the next token is --help, -h, --helpAll, --help-all, or --version.
π΄ (09:39) The Stricli patch removes -H handling and display as the helpAll alias: scanning recognizes only --helpAll and --help-all, formatDocumentationForFlagParameters() emits an empty alias, and generateBuiltInFlagUsageLines() always emits the long help-all flag.
π΄ (09:39) The Stricli patch removes the old first-token version shortcut for inputs[0] === "--version" || inputs[0] === "-v" and instead recognizes bare --version through the route scanner at any route depth; when config.versionInfo exists and result.versionRequested is true, runApplication() writes the current version plus \n and returns ExitCode.Success.
π΄ (09:39) The patched runApplication() invokes optional config.documentation.renderHelp({ prefix, unprocessedInputs, helpRequested }) before built-in help formatting; a returned string is written directly and returns ExitCode.Success, while undefined falls back to Stricliβs built-in formatHelp.
π΄ (09:39) withDefaults() carries config.scanner?.topLevelFlags into normalized scanner configuration and config.documentation?.renderHelp into normalized documentation configuration; both additions are inert when unset.
π΄ (09:39) Patch-integrity comments state check:patches fails if the matchTopLevelFlag or versionRequested markers are missing.
π΄ (09:39) Repository search found 95 matches related to help/JSON behavior; relevant runtime wiring includes packages/cli/src/lib/command.ts importing introspectCommand and formatHelpHuman, packages/cli/src/app.ts defining documentation.renderHelp, packages/cli/src/cli.ts recovering scanner failures, and packages/cli/src/commands/help.ts implementing the explicit help command.
π΄ (09:39) packages/cli/src/commands/help.ts states formatHelpHuman is human-output-only, so --json never triggers the human/branded help rendering path.
π΄ (09:39) packages/cli/src/commands/api.ts has a guard that binary output must never go through JSON, specifically JSON.stringify() or String().
π΄ (09:39) packages/cli/src/lib/help.ts defines HelpEnvVarInfo with required name, brief, and description, plus optional example and defaultValue; these represent top-level environment variables exposed by sentry help --json.
π΄ (09:39) packages/cli/src/lib/help.ts defines HelpFlagInfo with required long and description, plus optional short; these represent common flags exposed by sentry help --json.
π΄ (09:39) HelpJsonResult is a union of: full-tree { routes: RouteInfo[]; envVars: HelpEnvVarInfo[]; flags: HelpFlagInfo[] }, CommandInfo, RouteInfo, or { error: string; suggestions?: string[] }.
π΄ (09:39) buildTopLevelEnvVars() maps exactly TOP_LEVEL_ENV_VARS, deriving brief from briefDescription ?? description.split("\n")[0] ?? "" and preserving name, description, example, and defaultValue; buildCommonFlags() maps COMMON_FLAGS, preserving long, short, and description.
π΄ (09:39) introspectAllCommands() casts routes to RouteMap and returns extractAllRoutes(routeMap), buildTopLevelEnvVars(), and buildCommonFlags().
π΄ (09:39) introspectCommand(commandPath) resolves through resolveCommandPath(routeMap, commandPath); no resolution returns { error: \Command not found: ${commandPath.join(" ")}` }, while an "unresolved"result returns the same error plussuggestionsonly when the suggestions array is nonempty; successful resolution returnsresolved.info. π΄ (09:39) renderJsonHelp(prefix, unprocessedInputs)parses inputs withparseHelpJsonFlags()and returnsundefinedwhen--jsonis absent, preserving Stricliβs text help forsentry --helpandsentry <cmd> --help. π΄ (09:39) For JSON help, renderJsonHelp()constructscommandPathasprefix.slice(1)plusextraPath; this incorporates unroutable non-flag tokens such as nopefromsentry issue nope --help --json, allowing introspectCommand()to emit an error object rather than silently showing parent-group help. π΄ (09:39)renderJsonHelp()usesintrospectAllCommands()whencommandPath.length === 0, otherwise introspectCommand(commandPath); it optionally applies filterFields(data, fields)when fields are present and returns${formatJson(final)}\n. π΄ (09:39) isVersionRequest(argv)returns true for any bare--versionbefore a--escape and false once--is encountered;-vis intentionally excluded because Sentry maps it to--verbosethroughGLOBAL_FLAGS. π΄ (09:39) isVersionRequest()exists as post-run recovery becausesentry cli nope --versioncan abort withUnknownCommandbefore the patched scanner consumes--version; recovery restores the prior behavior that a bare --versionbefore--prints the version. π΄ (09:39)isRecoverableUnknownCommand(argv)treats three shapes as recoverable: 1.isVersionRequest(argv), 2. rewriteHelpJsonToHelpCommand(argv) !== undefined, and 3. at least two arguments with a final help` token. Unknown-command telemetry is suppressed for these recoverable help/version invocations.