Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent_ui: Hide manage skills command when AI is disabled (#63598)

kai-xlr003826320f32
diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rs
index 1570315f888..30900097e93 100644
--- a/crates/agent_ui/src/agent_ui.rs
+++ b/crates/agent_ui/src/agent_ui.rs
@@ -865,15 +865,12 @@ fn update_command_palette_filter(cx: &mut App) {
filter.show_namespace("multi_workspace");
}
- // Hide `agent: manage skills` — skills are surfaced through the
- // settings UI now. Applied after the disable-ai / agent-enabled
- // branches so it overrides the `show_namespace("assistant")` call
- // above without affecting the rest of that namespace's actions.
+ // Skills are surfaced through the settings UI now, so this command
+ // should never appear in the palette.
+ filter.hide_action_types(&manage_skills_action);
if !disable_ai {
- filter.hide_action_types(&manage_skills_action);
filter.show_action_types(skill_creator_actions.iter());
} else {
- filter.show_action_types(manage_skills_action.iter());
filter.hide_action_types(&skill_creator_actions);
}
});
@@ -1051,6 +1048,10 @@ mod tests {
!filter.is_hidden(&zed_actions::assistant::OpenProjectAgentsMdRules),
"OpenProjectAgentsMdRules should be visible by default"
);
+ assert!(
+ filter.is_hidden(&zed_actions::assistant::ManageSkills),
+ "ManageSkills should be hidden even when AI is enabled"
+ );
});
// Disable agent
@@ -1128,6 +1129,29 @@ mod tests {
"EditPrediction should be hidden when provider is None"
);
});
+
+ // Disable AI entirely
+ cx.update(|cx| {
+ AgentSettings::override_global(agent_settings.clone(), cx);
+ DisableAiSettings::override_global(DisableAiSettings { disable_ai: true }, cx);
+ update_command_palette_filter(cx);
+ });
+
+ cx.update(|cx| {
+ let filter = CommandPaletteFilter::try_global(cx).unwrap();
+ assert!(
+ filter.is_hidden(&zed_actions::assistant::ManageSkills),
+ "ManageSkills should be hidden when AI is disabled"
+ );
+ assert!(
+ filter.is_hidden(&zed_actions::assistant::OpenSkillCreator),
+ "OpenSkillCreator should be hidden when AI is disabled"
+ );
+ assert!(
+ filter.is_hidden(&NewThread),
+ "NewThread should be hidden when AI is disabled"
+ );
+ });
}
async fn setup_backfill_test(cx: &mut TestAppContext) -> Arc<dyn Fs> {