Skip to content

feat(cli): add completion command - #1427

Open
MunifTanjim wants to merge 1 commit into
getsentry:mainfrom
MunifTanjim:feat/cli-completion-command
Open

feat(cli): add completion command#1427
MunifTanjim wants to merge 1 commit into
getsentry:mainfrom
MunifTanjim:feat/cli-completion-command

Conversation

@MunifTanjim

@MunifTanjim MunifTanjim commented Aug 14, 2026

Copy link
Copy Markdown

Why?

I like to manage my own shell setup, so I do this:

sentry cli setup --method brew --no-modify-path --no-completions --no-agent-skills

But currently there's no way to get the completion script without letting sentry cli put it on the filesystem for me.

Adding sentry cli completion command 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:

sentry cli completion zsh > ~/.zfunc/_sentry
eval "$(sentry cli completion bash)"

Details

  • New command in packages/cli/src/commands/cli/completion.ts, registered under the existing cli route group next to setup/uninstall.
  • Reuses the existing getCompletionScript() generator (lib/completions.ts) and detectShellType() helper (lib/shell.ts) — no new generation logic. Output is byte-identical to what cli setup writes.
  • auth: false; unsupported shells fail with a ValidationError listing the supported shells.
  • Regenerated skill/command docs (cli.md, SKILL.md, contributing.md) via pnpm run generate:docs.

Testing

  • packages/cli/test/commands/cli/completion.test.ts — covers bash/zsh/fish output, the unsupported-shell error, and $SHELL auto-detection. All pass.
  • tsc --noEmit and biome check clean.
  • Manual smoke test: each shell prints its script, nonsense errors with a non-zero exit, and sentry cli --help lists the command.

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

@MunifTanjim is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Fix All in Cursor

❌ 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"
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc00641. Configure here.

Comment thread packages/cli/src/commands/cli/completion.ts
@MunifTanjim
MunifTanjim force-pushed the feat/cli-completion-command branch from fc00641 to b76d690 Compare August 14, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant