Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Hide Rules UI when Skills feature flag is enabled (#56782)
MartinYe123433c5ce69ef84
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 57fcc22a9cb..a511b365632 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -60,6 +60,7 @@ use collections::HashMap;use editor::{Editor, MultiBuffer};use extension::ExtensionEvents;use extension_host::ExtensionStore;+use feature_flags::{FeatureFlagAppExt as _, SkillsFeatureFlag};use fs::Fs;use gpui::{Action, Anchor, Animation, AnimationExt, AnyElement, App, AsyncWindowContext, ClipboardItem,@@ -4178,6 +4179,12 @@ impl AgentPanel {.with_handle(self.agent_panel_menu_handle.clone()).menu({move |window, cx| {+ // When the Skills feature flag is on, hide the legacy Rules menu entry.+ // The flag is read from a global store populated asynchronously, and+ // this menu builder runs on every open, so the latest resolved value is+ // reflected when the user clicks the ellipsis.+ let skills_enabled = cx.has_flag::<SkillsFeatureFlag>();+Some(ContextMenu::build(window, cx, |mut menu, _window, _| {menu = menu.context(focus_handle.clone());@@ -4212,9 +4219,13 @@ impl AgentPanel {}),).action("Add Custom Server…", Box::new(AddContextServer))- .separator()- .action("Rules", Box::new(OpenRulesLibrary::default()))- .action("Profiles", Box::new(ManageProfiles::default()));+ .separator();++ if !skills_enabled {+ menu = menu.action("Rules", Box::new(OpenRulesLibrary::default()));+ }++ menu = menu.action("Profiles", Box::new(ManageProfiles::default()));}menu = menudiff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rsindex a9af71ddf7b..99297e20a70 100644--- a/crates/agent_ui/src/agent_ui.rs+++ b/crates/agent_ui/src/agent_ui.rs@@ -651,6 +651,12 @@ fn update_command_palette_filter(cx: &mut App) {.edit_predictions.provider;+ // The Skills feature flag is loaded asynchronously, so this value may+ // be `false` before flags resolve. `update_command_palette_filter`+ // gets re-run from `cx.on_flags_ready` (see `init`), which means the+ // filter is reapplied with the correct value once flags arrive.+ let skills_enabled = cx.has_flag::<SkillsFeatureFlag>();+CommandPaletteFilter::update_global(cx, |filter, _| {use editor::actions::{AcceptEditPrediction, AcceptNextLineEditPrediction, AcceptNextWordEditPrediction,@@ -667,6 +673,8 @@ fn update_command_palette_filter(cx: &mut App) {TypeId::of::<ToggleEditPrediction>(),];+ let open_rules_library_action = [TypeId::of::<zed_actions::assistant::OpenRulesLibrary>()];+if disable_ai {filter.hide_namespace("agent");filter.hide_namespace("agents");@@ -715,6 +723,17 @@ fn update_command_palette_filter(cx: &mut App) {filter.show_namespace("multi_workspace");}++ // Hide `assistant: open rules library` when Skills are enabled —+ // Rules are surfaced through the Skills UI in that case. 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.+ if !disable_ai && skills_enabled {+ filter.hide_action_types(&open_rules_library_action);+ } else {+ filter.show_action_types(open_rules_library_action.iter());+ }});}