diff options
| author | Michelle Tilley <michelle@michelletilley.net> | 2026-03-22 20:55:02 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-23 03:55:02 +0000 |
| commit | e3aeef208739fe6ce38b688e12c2320d67e77c19 (patch) | |
| tree | e9c52074e72764a0b09a5911ff5da298bbc3daf2 | |
| parent | chore(ci): Tag docker images with semantic versions on tag creation (#3316) (diff) | |
| download | atuin-e3aeef208739fe6ce38b688e12c2320d67e77c19.zip | |
fix: Disable features in init when that feature is explicitly disabled (#3328)
This PR updates `atuin init` to skip initializers for subfeatures when
that subfeature is explicitly disabled with a setting value of `false`.
For `ai.enabled = false`, this releases the question mark keybind.
Fixes #3325
| -rw-r--r-- | crates/atuin-ai/src/commands/inline.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-client/src/settings.rs | 3 | ||||
| -rw-r--r-- | crates/atuin/src/command/client/init.rs | 37 |
3 files changed, 16 insertions, 26 deletions
diff --git a/crates/atuin-ai/src/commands/inline.rs b/crates/atuin-ai/src/commands/inline.rs index fe6327a5..7ceaf5b5 100644 --- a/crates/atuin-ai/src/commands/inline.rs +++ b/crates/atuin-ai/src/commands/inline.rs @@ -27,7 +27,7 @@ pub async fn run( settings: &atuin_client::settings::Settings, output_for_hook: bool, ) -> Result<()> { - if !settings.ai.enabled { + if !settings.ai.enabled.unwrap_or(false) { emit_shell_result( Action::Print( "Atuin AI is not enabled. Please enable it in your settings or run `atuin setup`." diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index 745bd2ff..becf72db 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -615,7 +615,7 @@ pub struct Logs { #[derive(Default, Clone, Debug, Deserialize, Serialize)] pub struct Ai { /// Whether or not the AI features are enabled. - pub enabled: bool, + pub enabled: Option<bool>, /// The address of the Atuin AI endpoint. Used for AI features like command generation. /// Only necessary for custom AI endpoints. @@ -1450,7 +1450,6 @@ impl Settings { .set_default("search.frequency_score_multiplier", 1.0)? .set_default("search.frecency_score_multiplier", 1.0)? .set_default("meta.db_path", meta_path.to_str())? - .set_default("ai.enabled", false)? .set_default("ai.send_cwd", false)? .set_default( "search.filters", diff --git a/crates/atuin/src/command/client/init.rs b/crates/atuin/src/command/client/init.rs index 00c6c2fc..798cc22b 100644 --- a/crates/atuin/src/command/client/init.rs +++ b/crates/atuin/src/command/client/init.rs @@ -98,31 +98,20 @@ $env.config = ( } } - fn static_init(&self, tmux: &Tmux) { + fn static_init(&self, settings: &Settings) { + let tmux = &settings.tmux; + + let disable_ai = self.disable_ai || matches!(settings.ai.enabled, Some(false)); + match self.shell { Shell::Zsh => { - zsh::init_static( - self.disable_up_arrow, - self.disable_ctrl_r, - self.disable_ai, - tmux, - ); + zsh::init_static(self.disable_up_arrow, self.disable_ctrl_r, disable_ai, tmux); } Shell::Bash => { - bash::init_static( - self.disable_up_arrow, - self.disable_ctrl_r, - self.disable_ai, - tmux, - ); + bash::init_static(self.disable_up_arrow, self.disable_ctrl_r, disable_ai, tmux); } Shell::Fish => { - fish::init_static( - self.disable_up_arrow, - self.disable_ctrl_r, - self.disable_ai, - tmux, - ); + fish::init_static(self.disable_up_arrow, self.disable_ctrl_r, disable_ai, tmux); } Shell::Nu => { self.init_nu(tmux); @@ -148,6 +137,8 @@ $env.config = ( let alias_store = AliasStore::new(sqlite_store.clone(), host_id, encryption_key); let var_store = VarStore::new(sqlite_store.clone(), host_id, encryption_key); + let disable_ai = self.disable_ai || matches!(settings.ai.enabled, Some(false)); + match self.shell { Shell::Zsh => { zsh::init( @@ -155,7 +146,7 @@ $env.config = ( var_store, self.disable_up_arrow, self.disable_ctrl_r, - self.disable_ai, + disable_ai, &settings.tmux, ) .await?; @@ -166,7 +157,7 @@ $env.config = ( var_store, self.disable_up_arrow, self.disable_ctrl_r, - self.disable_ai, + disable_ai, &settings.tmux, ) .await?; @@ -177,7 +168,7 @@ $env.config = ( var_store, self.disable_up_arrow, self.disable_ctrl_r, - self.disable_ai, + disable_ai, &settings.tmux, ) .await?; @@ -219,7 +210,7 @@ $env.config = ( if settings.dotfiles.enabled { self.dotfiles_init(settings).await?; } else { - self.static_init(&settings.tmux); + self.static_init(settings); } Ok(()) |
