feat(commands): rename get commands to view and add -w browser flag#53
feat(commands): rename get commands to view and add -w browser flag#53
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Rename all `get` commands to `view` for better UX: - `sentry org get` → `sentry org view` - `sentry project get` → `sentry project view` - `sentry issue get` → `sentry issue view` - `sentry event get` → `sentry event view` Add `-w` / `--web` flag to all view commands that opens the entity in the browser. If browser launch fails (headless environment, etc.), falls back to displaying the URL with a QR code - reusing the pattern from `sentry auth login`. New utilities: - `src/lib/sentry-urls.ts`: URL builders for Sentry web pages - `openOrShowUrl()` helper in `src/lib/browser.ts`
a4903e4 to
619758c
Compare
Unify the browser + fallback logic in auth login with view commands: - Use openOrShowUrl helper instead of inline browser + QR logic - Remove --qr flag (QR is always shown when browser can't open) - Only show manual URL/code when browser fails to open
- Fix tabs to spaces formatting in view commands - Refactor issue/view.ts to reduce cognitive complexity from 16 to <15 - Refactor project/view.ts to reduce cognitive complexity from 16 to <15 - Fix flag alias syntax (move from individual flags to parameters.aliases)
Rename command references in E2E tests to match the CLI changes: - issue get → issue view - event get → event view - org get → org view - project get → project view
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 1538 uncovered lines. Files with missing lines (18)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 54.90% 54.90% —%
==========================================
Files 33 33 —
Lines 3410 3410 —
Branches 0 0 —
==========================================
+ Hits 1872 1872 —
- Misses 1538 1538 —
- Partials 0 0 —Generated by Codecov Action |
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.
| orgSlug = projectEntry.orgSlug; | ||
| issue = await getIssueByShortId(orgSlug, resolvedShortId); | ||
| resolved = | ||
| aliasResult ?? (await resolveShortSuffixId(issueId, flags, cwd)); |
There was a problem hiding this comment.
Alias fallback bypasses short ID handling for hyphenated IDs
High Severity
The refactored issue ID resolution logic breaks handling of standard short IDs like "CRAFT-G" or "PROJECT-123". The ALIAS_SUFFIX_PATTERN matches any input with a hyphen, so parseAliasSuffix("CRAFT-G") returns {alias: "craft", suffix: "G"}. When the alias "craft" isn't found in the cache, the code falls back to resolveShortSuffixId, which incorrectly tries to expand "CRAFT-G" as a short suffix rather than treating it as a full short ID.
The original code checked if (aliasSuffix && projectEntry), falling through to isShortId() when the alias wasn't in cache. The new code only checks if (aliasSuffix), so the isShortId branch is now unreachable for any hyphenated input.
Summary
getcommands toviewfor better UX-w/--webflag to open entities in browser with QR code fallbackChanges
Commands Renamed
sentry org getsentry org viewsentry project getsentry project viewsentry issue getsentry issue viewsentry event getsentry event viewNew
-w/--webFlagAll view commands now support a
-wflag that opens the entity in the browser:sentry auth login)New Utilities
src/lib/sentry-urls.ts- URL builders for Sentry web pages (supports self-hosted viaSENTRY_URLenv var)openOrShowUrl()helper insrc/lib/browser.ts