Skip to content

feat: add auto shell detection to atuin init#3605

Open
vegerot wants to merge 1 commit into
atuinsh:mainfrom
vegerot:pr3605
Open

feat: add auto shell detection to atuin init#3605
vegerot wants to merge 1 commit into
atuinsh:mainfrom
vegerot:pr3605

Conversation

@vegerot

@vegerot vegerot commented Jul 10, 2026

Copy link
Copy Markdown

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 #3604

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
Copilot AI review requested due to automatic review settings July 10, 2026 23:36
@github-actions

Copy link
Copy Markdown
Contributor

Fossier: Manual Review Requested

@vegerot is a new contributor. A maintainer should review this PR before merging.

Score Breakdown

Total Score: 56.3/100 | Confidence: 100% | Outcome: REVIEW

Signal Value Score Weight
account_age 4704 1.00 0.09
public_repos 223 1.00 0.05
contribution_history 238 1.00 0.05
follower_ratio 0.96 0.48 0.05
bot_signals False 0.50 0.04
open_prs_elsewhere 62 0.00 0.09
closed_prs_elsewhere 96 0.00 0.10
merged_prs_elsewhere 131 1.00 0.08
prior_interaction 0 0.00 0.08
activity_velocity 2 0.67 0.08
pr_content ... 1.00 0.08
commit_email mchcopl@gmail.com 0.80 0.04
pr_description ... 0.70 0.05
repo_stars 30517 0.30 0.04
org_membership 1 0.33 0.03
commit_verification ... 0.30 0.04
contributor_stars 39 0.78 0.04

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds auto shell detection to atuin init. The main changes are:

  • atuin init now defaults to an auto shell mode.
  • Auto mode maps the detected parent shell to the existing init generators.
  • Bash, zsh, integration, and pty-proxy docs now recommend the no-argument form.

Confidence Score: 4/5

The changed CLI path can crash when auto shell detection cannot read the process tree.

  • Explicit shell arguments still follow the old init paths.
  • The new default path calls a panic-prone detector before returning a recoverable detection error.
  • The docs now steer users onto that default path.

crates/atuin/src/command/client/init.rs

Important Files Changed

Filename Overview
crates/atuin/src/command/client/init.rs Adds auto shell parsing and routes the resolved shell into static and dotfiles init.
docs/docs/configuration/key-binding.md Updates key-binding examples to use atuin init without an explicit shell.
docs/docs/faq.md Updates FAQ examples to use the new auto-detected init form.
docs/docs/guide/installation.md Adds no-argument init examples for bash and zsh installation.
docs/docs/guide/shell-integration.md Updates the conditional shell integration example to use auto-detection.
docs/docs/integrations.md Updates integration guidance to refer to atuin init without shell arguments.
docs/docs/reference/pty-proxy.md Updates the pty-proxy setup example to use the no-argument init form.

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 => {

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.

P1 Auto Detection Can Panic

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 init default to auto, 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 like atuin init --disable-ai) instead of explicit atuin 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.

Comment on lines +61 to +63
Shell::Auto => {
let detected = CommonShell::current();
match detected {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-detect shell in atuin init

2 participants