-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(upgrade): add self-update command #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adds `sentry upgrade` command to update the CLI to the latest or a specific version. - Auto-detects installation method (curl, npm, pnpm, bun, yarn) - Fetches latest version from GitHub releases or npm registry - Supports --check flag for dry-run mode - Supports --method flag to override auto-detection - Includes `update` alias Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊❌ Patch coverage is 36.19%. Project has 2008 uncovered lines. Files with missing lines (26)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 69.98% 68.08% -1.9%
==========================================
Files 51 53 +2
Lines 5926 6290 +364
Branches 0 0 —
==========================================
+ Hits 4147 4282 +135
- Misses 1779 2008 +229
- Partials 0 0 —Generated by Codecov Action |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove SeerError class that was accidentally added - Add proper error handling for curl failures in executeUpgradeCurl to prevent false success when curl fails but bash exits 0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Addressed the PR review comments: Fixed Issues
Invalid Issues (verified through testing)
Commit: abb0be4 |
- Normalize user-provided versions by stripping 'v' prefix - Show correct upgrade command in check-only mode when version specified - Add versionExists() to validate user-specified versions before upgrade Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move regex to top-level constant (use existing VERSION_PREFIX_REGEX) - Remove useless else clause in versionExists Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, `issue view 15` would fail with a 404 because numeric-only inputs like "15" were not recognized as potential short suffixes. The detection required at least one letter (isShortId check). Now, any short alphanumeric input (≤4 chars) is first tried as a short suffix when project context is available. If resolution fails due to missing context or 404, it falls through to other resolution methods. Auth errors and server errors are properly propagated. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds `sentry upgrade` command to update the CLI to the latest or a specific version. - Auto-detects installation method (curl, npm, pnpm, bun, yarn) - Fetches latest version from GitHub releases or npm registry - Supports --check flag for dry-run mode - Supports --method flag to override auto-detection - Includes `update` alias Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove SeerError class that was accidentally added - Add proper error handling for curl failures in executeUpgradeCurl to prevent false success when curl fails but bash exits 0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Normalize user-provided versions by stripping 'v' prefix - Show correct upgrade command in check-only mode when version specified - Add versionExists() to validate user-specified versions before upgrade Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move regex to top-level constant (use existing VERSION_PREFIX_REGEX) - Remove useless else clause in versionExists Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
daed4de to
7129168
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
… into feat/upgrade-command
…essages Network failures (DNS, timeout, no internet) now throw UpgradeError instead of raw TypeError, giving users clean error messages like: 'Error: Failed to connect to GitHub: fetch failed' instead of: 'Unexpected error: TypeError: fetch failed' with stack trace - Add try-catch around fetch() in fetchLatestFromGitHub() - Add try-catch around fetch() in fetchLatestFromNpm() - Add try-catch around fetch() in versionExists() - Add tests for network failure scenarios
upgrade.ts: - Add URL constants (GITHUB_RELEASES_URL, NPM_REGISTRY_URL, INSTALL_SCRIPT_URL) - Add GITHUB_HEADERS constant to avoid repetition - Add fetchWithUpgradeError() helper to centralize network error handling - Refactor fetchLatestFromGitHub, fetchLatestFromNpm, versionExists to use helper oauth.ts: - Use fetchWithConnectionError consistently in pollForToken (was using raw fetch)
closes #91
Summary
Adds
sentry upgradecommand so users can update the CLI without remembering how they installed it.Changes
src/lib/upgrade.ts- Detection logic and upgrade executionsrc/commands/upgrade.ts- Command definition with --check and --method flagssrc/lib/errors.ts- UpgradeError class for error handlingsrc/app.ts- Register command withupdatealiasThe command auto-detects how the CLI was installed by checking:
~/.sentry/bin(curl install)curl installs fetch the latest version from GitHub releases; package manager installs check the npm registry.
Test plan
bun test test/lib/upgrade.test.ts test/commands/upgrade.test.ts- all 17 tests passsentry upgrade --check --method npmshows version infoCloses #91
🤖 Generated with Claude Code