feat(cli): add completion command - #1427
Conversation
|
@MunifTanjim is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
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.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fc00641. Configure here.
| throw new ValidationError( | ||
| `Unsupported shell: ${shell ?? shellType}. Supported shells: bash, zsh, fish`, | ||
| "shell" | ||
| ); |
There was a problem hiding this comment.
Auto-detect error hides shell
Low Severity
When no shell argument is given and auto-detection fails, the error uses shellType (unknown) instead of the actual $SHELL value. Users with an unsupported or unset shell only see Unsupported shell: unknown, which hides what was detected and makes the failure harder to diagnose.
Reviewed by Cursor Bugbot for commit fc00641. Configure here.
fc00641 to
b76d690
Compare


Why?
I like to manage my own shell setup, so I do this:
But currently there's no way to get the completion script without letting
sentry cliput it on the filesystem for me.Adding
sentry cli completioncommand solves that. It is a common pattern for most popular CLIs.Summary
Adds
sentry cli completion <shell>to print the shell completion script to stdout for bash, zsh, and fish. When no shell argument is given, the shell is auto-detected from$SHELL.This complements
sentry cli setup(which writes completion files to disk) by letting users and package managers install completions however they like:Details
packages/cli/src/commands/cli/completion.ts, registered under the existingcliroute group next tosetup/uninstall.getCompletionScript()generator (lib/completions.ts) anddetectShellType()helper (lib/shell.ts) — no new generation logic. Output is byte-identical to whatcli setupwrites.auth: false; unsupported shells fail with aValidationErrorlisting the supported shells.cli.md,SKILL.md,contributing.md) viapnpm run generate:docs.Testing
packages/cli/test/commands/cli/completion.test.ts— covers bash/zsh/fish output, the unsupported-shell error, and$SHELLauto-detection. All pass.tsc --noEmitandbiome checkclean.nonsenseerrors with a non-zero exit, andsentry cli --helplists the command.