Repository navigation
refactor(cli): Store docs.examples steps without the program name - #2087
Merged
Merged
Conversation
docs.examples steps now leave out `sentry`: `run: "issue list my-org/"`.
`--help` adds getInvocationCommand(), and the generated docs, skill
references and check:doc-examples add `sentry`, so nothing swaps a
leading `sentry ` at runtime anymore. A step inside other shell text
keeps it around the invocation, as `{ prefix: "sudo ", args: "cli fix" }`.
An AST codemod converted all 711 steps in 697 examples. The
no-hardcoded-sentry-command lint rule now rejects a step that starts
with `sentry `.
Refs #2085
Refs #2050
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Nov 7, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs.examplessteps no longer repeatsentry.exampleForRunningProgramis deleted fromsrc/lib/command.ts. It was the last runtime match on command text:--helpused to swap a leadingsentryfor the running program.Schema
command→run, so tsc flags any call site that was missed. This is a hard cutover with no shim.run: "issue list my-org/frontend".exampleSteps(example, program)rendersprefix + program + " " + args + suffix. Each renderer picks the program:--help(prepareNativeDocs) usesgetInvocationCommand(), so it showssentry-mcp …ornpx -y @sentry/mcp-server ….introspect.ts, which feeds the generated command docs, skill references andcheck:fragments, uses"sentry". So docheck:doc-examplesandgenerate-docs-sections.Steps that aren't a bare
sentrycommandOf 711 steps in 697 examples, 4 wrap the invocation in other shell text. These became
{ prefix, args, suffix }:commands/cli/fix.tssudo sentry cli fix→{ prefix: "sudo ", args: "cli fix" }commands/cli/completion.tseval "$(sentry cli completion bash)"→{ prefix: 'eval "$(', args: "cli completion bash", suffix: ')"' }commands/wasm-split.tsBUILD_ID=$(sentry wasm-split app.wasm)→{ prefix: "BUILD_ID=$(", args: "wasm-split app.wasm", suffix: ")" }commands/monitor/run.tsSENTRY_DSN=… sentry monitor run nightly-job -- python manage.py cron→{ prefix: "SENTRY_DSN=… ", args: "monitor run …" }No step is a pipe, an
npx …line, another tool, or a shell line with nosentryinvocation in it. A literal{ shell }form would have had no users, so I left it out. Trailing redirections such ascli completion zsh > ~/.local/share/zsh/site-functions/_sentryfollow the command, so they stay in the plain string.Behavior change: under
sentry-mcpor npx,--helpnow names the running program inside these 4 wrapped steps too. The old swap only matched a leadingsentry, so it skipped them.Conversion and guard
examples: [{ description, command }]entry. It renamed the key torun, stripped the leadingsentryfrom every string step (keeping the original quotes and escapes), and converted the 4 wrapped steps above. It found no non-literal steps and no unmatched ones.sentry-cli/no-hardcoded-sentry-commandnow rejects an example step that starts withsentry: arunstring, an element of arunarray, or a step'sargs. RuleTester cases cover each form.check:doc-examplesstill checks every rendered step against the route tree (1649 examples in 669 files). A doubledsentry sentry …would fail there as an unknown command.Verification
pnpm run generate:docsonmainand on this branch, then diffed recursively:apps/cli-docs/src/content(command pages,index.md,configuration.md, docs sections),plugins/sentry-cli(SKILL.md plus 42 references),.well-known/skills/index.json,src/generated/(includingskill-content.ts) andsdk.generated.*. There were no differences.test/lib/command-examples.test.ts:--helprenderssentry-mcp …,sudo sentry-mcp cli fixandnpx -y @sentry/mcp-server …under those identities, andexampleSteps(e, "sentry")gives the docs form.pnpm run tscandpnpm run lint(root) pass.node --test scripts/cli-lint-rules.test.mjspasses 118 of 118.check:doc-examples,check:fragmentsandcheck:docs-sectionspass.pnpm --filter sentry run test: 12933 passed. 5 failed, all known sandbox permission failures: completions EACCES/EPERM (2), db/resilient readonly, the dsn code-scanner unreadable file, and the upgrade lock.Refs #2085
Refs #2050
via @BYK.
--
View Session [Sentry]