feat(help): add common flags section and cache-age hints (#785)#859
Merged
feat(help): add common flags section and cache-age hints (#785)#859
Conversation
Contributor
|
Contributor
Codecov Results 📊✅ 6178 passed | Total: 6178 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 79.17%. Project has 12843 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 75.82% 75.94% +0.12%
==========================================
Files 289 290 +1
Lines 53347 53384 +37
Branches 0 0 —
==========================================
+ Hits 40451 40541 +90
- Misses 12896 12843 -53
- Partials 0 0 —Generated by Codecov Action |
Surface --fresh/-f discoverability in two ways: 1. Add a "Flags:" section to `sentry --help` (between commands and env vars) showing --json, --fresh/-f, --verbose/-v, --help, --version. Also exposed via `sentry help --json` in the new `flags` array. 2. Show "cached · 3m ago · use -f to refresh" hint in command footers when data was served from the HTTP response cache. Applied automatically in buildCommand's wrapper — individual commands don't need any changes. Uses a module-level signal in response-cache.ts (set on cache hit, cleared per-request in authenticatedFetch). Closes the last remaining item from #785.
e99a401 to
5fe6860
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5fe6860. Configure here.
Cursor Bugbot caught a dangling 'Cache bypass control' banner left above the new 'Last cache-hit age' section in response-cache.ts.
…ession, tests - Intercept top-level `sentry --help` / `-h` in cli.ts and rewrite to `sentry help` so the branded output (with Flags + Env Vars sections) is shown instead of Stricli's terse default. Subcommand help is unchanged. - Suppress cache-age hint on bare `return;` paths (e.g. --web) where no data is rendered — the hint references refreshing data the user never saw. - Add positive-path tests for formatCacheHint and appendCacheHint using a test-only setter (setLastCacheHitAgeForTesting). - Add JSDoc note about parallel API call hint determinism. - Delete stale plan file.
Stricli's built-in `--help` is intentionally left as the terse, token-efficient format for AI agents. The branded help (with Flags + Environment Variables sections) is shown via `sentry` (no-args) and `sentry help`, which are the human discovery paths.
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.

Summary
Closes the last remaining item from #785 — making
--fresh/-fdiscoverable.1. "Flags:" section in
sentry/sentry helpAdds a new section between commands and environment variables showing the most important cross-command flags:
Also exposed via
sentry help --jsonin a newflagsarray.Shown in the branded help (
sentry,sentry help) but intentionally not insentry --help— the Stricli-generated--helpstays terse and token-efficient for AI agents.Note:
--freshis available on most read commands (list, view, whoami) but not on mutation commands (create, delete, resolve, login). This mirrorsgh --helpwhich lists flags that apply to "most commands" without enumerating exceptions.2. Cache-age hint in command footers
When data is served from the HTTP response cache, commands now show a hint like:
This is applied automatically in
buildCommand(src/lib/command.ts) — individual commands don't need any changes. The mechanism:response-cache.tssets a module-levellastCacheHitAgeMson cache hitssentry-client.tsclears it at the start of eachauthenticatedFetch()callbuildCommandcallsappendCacheHint(returned?.hint)after the generator completesreturn;paths (e.g.--web) are skipped since no data was renderedThe hint is suppressed in JSON mode, when
--freshis passed, and whenSENTRY_NO_CACHE=1is set.