Repository navigation
docs(cli): Correct CLI docs drift and guard against it - #1667
Conversation
Show issue aliases the way issue list prints them, list every scanned extension, document configurable Local session retention, drop the duplicated defaults from Local port and host briefs, and replace the unsupported -l limit alias in SDK examples with -n.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
left a comment
There was a problem hiding this comment.
This is pretty good but we need systemic changes to prevent these kinds of drifts. Can you figure out a way to prevent these drifts?
Generate the DSN extension and alias tables on the features page from the scanner and alias code, check sdk.run() examples like CLI examples, fail fragment subcommand coverage instead of warning, and test that value flag briefs don't restate their declared defaults.
|
Thanks @BYK. Pushed 5c76a8e, which adds guards so these kinds of drift fail CI:
I checked that each guard fails when its drift is reintroduced. Some hand-written samples, like the old |
BYK
left a comment
There was a problem hiding this comment.
Love the updates and the direction but I'm pretty sure you can do more/better :)
Address review feedback on drift prevention: - Find sdk.run() calls with the TypeScript compiler instead of regexes. TypeScript fences in docs and @example JSDoc in src/index.ts are parsed, so multi-line calls, comments, and parentheses in arguments are handled. - Generate the library-usage.md sdk.run() sample from `issue list` docs.examples, so it can't drift from a checked CLI example. - Let docs.examples take an array of steps for multi-step workflows. Every step is checked by check:doc-examples and shown in --help, the generated pages, and the skill. Move the release CI workflow and the Local session lifecycle out of allow-commands fragment blocks into examples, and count workflow steps toward fragment subcommand coverage.
BYK
left a comment
There was a problem hiding this comment.
Beautiful. See my comment about bash tokenization. It's not a hard-blocker but if there's already a battle-tested and small library we should probably prefer that.
Alternatively you can also write this in peggyjs if you can find a good and simple enough grammar definition.
Replace the hand-written shell tokenizer and the operator-splitting regex with shell-quote (zero dependencies, already in the lockfile), added as a dev dependency for the doc scripts. Quoting, escapes, control operators, comments, and redirections now follow shell rules, so a `|` or `&&` inside a quoted argument no longer splits a command. `<placeholder>` words are protected before parsing so they aren't read as redirections.
Summary
Fixes several places where the CLI docs no longer matched CLI behavior, and adds checks so the same kinds of drift fail CI instead of shipping.
What changed
buildOrgAwareAliases:frontendbecomesfr, notf, and cross-org aliases look likea/a/g/a, noto1:api.issue listhas noALIAScolumn and prints noDetected project:line, so the sample tables are gone. The page now says the alias-suffix (e-4y) appears under the short ID in multi-project lists, and the list title names the resolved project..luaand.config.issue viewaccepts them.localfragment: documents--max-envelopes(1–50,000, default 500),session view,session retention,envelope view,daemon startanddaemon restart.--help, the command pages and the skill references. This coverslocal serve/local run--port/--host,alert issues create --frequency,auth login/auth default--timeout,dashboard view --rendererandsourcemap upload --url-prefix.createSentrySDKJSDoc):sdk.run("issue", "list", "-l", "5")becomes-n.-lisn't a registered alias.packages/cli/AGENTS.md: removed the deletedsrc/lib/dsn/languages/references and documented the new guards.Implementation updates
Drift guards, so these mistakes fail CI:
generate-docs-sections.tsnow generates the features page's DSN extension table and alias tables.TEXT_EXTENSIONS.buildOrgAwareAliases.check:docs-sectionsflags them as stale if the alias code changes.check-doc-examples.tsnow checks string-literalsdk.run(…)calls in the docs,README.mdandsrc/index.tsagainst the route tree, the same way it checkssentry …examples.check:fragmentsnow runs with--strict, so a fragment that misses a subcommand fails instead of warning.test/lib/flag-briefs.test.tsfails when a value flag's brief restates its declared default.Validation
pnpm --filter sentry run generate:schemaandpnpm --filter sentry run generate:docs: pass.pnpm --filter sentry run ci:policy: passes, with strict fragment coverage.pnpm --filter sentry-cli-docs run build: passes.packages/clipnpm run lintandpnpm run typecheck: pass.-lfailscheck:doc-examples.zigtoTEXT_EXTENSIONSfailscheck:docs-sections(default 8969)fails the brief testvitest runontest/lib,test/scriptand thealert,auth,dashboard,sourcemapandlocalcommand tests: 9059 passed, 6 failed. The 6 failures are permission tests (EACCES/EPERM/readonly) that also fail on the base commit in this sandbox, so this change didn't cause them.via Junior system actor
event.--
View Junior Session [Sentry]