feat(cli): add setup command for shell integration#213
Merged
Conversation
Contributor
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. |
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 93.19%. Project has 3923 uncovered lines. Files with missing lines (63)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 76.46% 67.04% -9.42%
==========================================
Files 66 97 +31
Lines 8758 11904 +3146
Branches 0 0 —
==========================================
+ Hits 6696 7981 +1285
- Misses 2062 3923 +1861
- 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
Add buildCommand wrapper that automatically captures flag values as telemetry tags (e.g., flag.verbose, flag.no-modify-path). Commands just need to import buildCommand from lib/command.js instead of @stricli/core - no other changes needed. - Add setFlagContext() helper in telemetry.ts - Add buildCommand wrapper in new lib/command.ts - Update all 19 commands to use the wrapper
BYK
commented
Feb 9, 2026
- Use POSIX-style flags in install script (--no-modify-path, --no-completions) - Add positional args capture via setArgsContext() as Sentry context - Improve telemetry tests with spyOn to verify actual Sentry.setTag calls
BYK
commented
Feb 9, 2026
…ricli route map Walk the route map with getAllEntries() to discover commands, subcommands, and aliases automatically. No manual maintenance needed when commands change. Also fixes missing completions for log/list, auth/token, and shortcut aliases (issues, orgs, projects, logs).
Enable allow-kebab-for-camel in Stricli scanner config so flags like --no-modify-path work (fixes install script regression). Add tests for setup command (11 tests, 96% coverage), command wrapper integration (5 tests exercising actual Stricli run), shell utilities (GitHub Actions PATH, unknown shells, write failures).
Add property-based tests using fast-check for shell utilities and completion generation, including a real bash simulation that sources the generated completion script and verifies COMPREPLY output. New test files: - test/lib/shell.property.test.ts (14 property tests) - test/lib/completions.property.test.ts (12 tests incl. bash sim) Trim existing unit tests to remove overlap with property tests, keeping only I/O and dispatch tests in the original files.
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)Dynamic shell completions
Completion scripts are auto-generated from the Stricli route map — when commands are added or removed, completions update automatically. No manual maintenance needed.
Automatic flag telemetry
A
buildCommandwrapper auto-captures flag values as Sentry tags (e.g.,flag.verbose,flag.no-modify-path) and positional args as Sentry context. Commands just importbuildCommandfromlib/command.jsinstead of@stricli/core.Kebab-case flag support
Enabled
allow-kebab-for-camelin Stricli config so all flags accept both--noModifyPathand--no-modify-path.Benefits
record-install+ bash logicsetupcommand handles everythingsentry cli setupto configureNew files
src/lib/shell.tssrc/lib/completions.tssrc/lib/command.tsbuildCommandwrapper with automatic telemetrysrc/commands/cli/setup.tstest/lib/shell.test.tstest/lib/completions.test.tstest/lib/command.test.tstest/commands/cli/setup.test.tsRemoved
Fixes #67.