feat: add auto shell detection to atuin init#3605
Conversation
Add `atuin init` (no arguments) and `atuin init auto` which auto-detect the current shell using the parent process name, matching the behavior already available in `atuin ai init`. Explicit shell names continue to work as before. Also update bash and zsh docs to recommend `atuin init` (auto-detect) alongside the explicit shell forms. Closes atuinsh#3604
Fossier: Manual Review Requested
Score BreakdownTotal Score: 56.3/100 | Confidence: 100% | Outcome: REVIEW
|
Greptile SummaryThis PR adds auto shell detection to
Confidence Score: 4/5The changed CLI path can crash when auto shell detection cannot read the process tree.
crates/atuin/src/command/client/init.rs Important Files Changed
Reviews (1): Last reviewed commit: "feat: add auto shell detection to `atuin..." | Re-trigger Greptile |
| impl Cmd { | ||
| fn resolve_shell(&self) -> Result<Shell> { | ||
| match self.shell { | ||
| Shell::Auto => { |
There was a problem hiding this comment.
When atuin init runs without an explicit shell, this line calls the process-tree detector and propagates its expect() panics if the current or parent process is unavailable, such as in a PID namespace or container where Atuin has no visible parent. The new documented default can crash instead of returning the existing shell-detection error.
There was a problem hiding this comment.
Pull request overview
Adds an auto-detection mode to atuin init so users can run atuin init (or atuin init auto) without specifying a shell, aligning the UX with existing auto-detect behavior in atuin ai init. Documentation is updated to recommend the new default invocation in common setup snippets.
Changes:
- Make
atuin initdefault toauto, resolving the shell via parent-process detection. - Thread the resolved shell through both static and dotfiles-based init paths.
- Update multiple docs pages to use
eval "$(atuin init)"(and flag examples likeatuin init --disable-ai) instead of explicitatuin init zsh|bash.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/docs/reference/pty-proxy.md | Switches the example to eval "$(atuin init)" for the post-pty-proxy init step. |
| docs/docs/integrations.md | Updates zsh/bash integration examples to reference atuin init auto-detection. |
| docs/docs/guide/shell-integration.md | Updates shell-init snippet to use atuin init without an explicit shell. |
| docs/docs/guide/installation.md | Adds optional auto-detect setup snippets for zsh and bash installation flows. |
| docs/docs/faq.md | Updates FAQ snippets to use atuin init with flags (no explicit shell arg). |
| docs/docs/configuration/key-binding.md | Updates key-binding examples to use atuin init with flags (no explicit shell arg). |
| crates/atuin/src/command/client/init.rs | Implements auto as the default shell argument and resolves it before generating init output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Shell::Auto => { | ||
| let detected = CommonShell::current(); | ||
| match detected { |
Add
atuin init(no arguments) andatuin init autowhich auto-detectthe current shell using the parent process name, matching the behavior
already available in
atuin ai init. Explicit shell names continue towork as before.
Also update bash and zsh docs to recommend
atuin init(auto-detect)alongside the explicit shell forms.
Closes #3604