feat(cli): add setup command for shell integration#213
Draft
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Cli
Other
Bug Fixes 🐛Upgrade
Documentation 📚
🤖 This preview updates automatically when you update the PR. |
|
Codecov Results 📊✅ Patch coverage is 81.13%. Project has 2023 uncovered lines. Files with missing lines (42)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 76.73% 76.96% +0.23%
==========================================
Files 65 68 +3
Lines 8419 8780 +361
Branches 0 0 —
==========================================
+ Hits 6460 6757 +297
- Misses 1959 2023 +64
- Partials 0 0 —Generated by Codecov Action |
Install script changes: - Prefer ~/.local/bin or ~/bin when available and in $PATH - Fall back to ~/.sentry/bin only when needed (adds to PATH) - Support SENTRY_INSTALL_DIR env var for custom locations - Call 'sentry cli record-install' after installation New 'sentry cli record-install' command: - Records method, path, version in SQLite metadata table - Called automatically by install script - Enables future upgrades to use correct method/path Detection improvements: - Check stored install info first (fast path) - Legacy detection for existing installs (auto-saves for future) - Expanded known curl paths: ~/.local/bin, ~/bin, ~/.sentry/bin Upgrade command: - Persists --method flag for future upgrades - Uses stored path for curl upgrades instead of hardcoded path
716990a to
3e73719
Compare
New 'sentry cli setup' command that: - Configures PATH by modifying shell config files - Installs shell completions (bash, zsh, fish) - Records installation metadata for upgrades This moves PATH modification logic from bash to TypeScript for: - Better error handling and testability - Reusability for users who download binary manually - Shell completion installation in the same step Install script now simply calls 'sentry cli setup --method curl' after downloading the binary. New files: - src/lib/shell.ts - Shell detection and PATH utilities - src/lib/completions.ts - Shell completion generation - src/commands/cli/setup.ts - The setup command
The setup command now handles recording install info via --method flag, making record-install redundant. Removed to simplify the codebase.
The executeUpgrade and cleanupOldBinary tests were failing in CI because paths were computed once at module load time, potentially capturing stale database state from previous test runs.
9de75a0 to
faedb9e
Compare
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
Adds a new
sentry cli setupcommand that configures shell integration, replacing the bash-based PATH modification logic with a proper TypeScript implementation.New
sentry cli setupcommandSimplified install script
The curl install script is now much simpler - it just downloads the binary and calls
sentry cli setup:Install priority order:
$SENTRY_INSTALL_DIR(if set)~/.local/bin(if exists AND in$PATH)~/bin(if exists AND in$PATH)~/.sentry/bin(fallback)Benefits
record-install+ bash logicsetupcommand handles everythingsentry cli setupto configureNew files
src/lib/shell.tssrc/lib/completions.tssrc/commands/cli/setup.tstest/lib/shell.test.tstest/lib/completions.test.tsRemoved
src/commands/cli/record-install.ts- functionality merged intosetup --method