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: Improve menu items related to rules (#57828)

Danilo Lealceff1b227be0
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs
index 567cab36c1b..c3bc3088360 100644
--- a/crates/agent_ui/src/agent_panel.rs
+++ b/crates/agent_ui/src/agent_panel.rs
@@ -57,7 +57,7 @@ use anyhow::Result;
#[cfg(feature = "audio")]
use audio::{Audio, Sound};
use chrono::{DateTime, Utc};
-use client::UserStore;
+use client::{UserStore, zed_urls};
use cloud_api_types::Plan;
use collections::HashMap;
use editor::{Editor, MultiBuffer};
@@ -4958,9 +4958,20 @@ impl AgentPanel {
if global_agents_md_loaded {
let workspace = workspace.clone();
- menu = menu.entry(
- "Open Global AGENTS.md",
- None,
+
+ menu = menu.custom_entry(
+ |_window, _cx| {
+ h_flex()
+ .w_full()
+ .gap_1()
+ .child(Label::new("Open Global Rules"))
+ .child(
+ Label::new("(AGENTS.md)")
+ .color(Color::Muted)
+ .size(LabelSize::Small),
+ )
+ .into_any_element()
+ },
move |window, cx| {
workspace
.update(cx, |workspace, cx| {
@@ -4983,9 +4994,19 @@ impl AgentPanel {
if let Some(path) = project_agents_md_path.clone() {
let workspace = workspace.clone();
- menu = menu.entry(
- "Open Project AGENTS.md",
- None,
+ menu = menu.custom_entry(
+ |_window, _cx| {
+ h_flex()
+ .w_full()
+ .gap_1()
+ .child(Label::new("Open Project Rules"))
+ .child(
+ Label::new("(AGENTS.md)")
+ .color(Color::Muted)
+ .size(LabelSize::Small),
+ )
+ .into_any_element()
+ },
move |window, cx| {
let path = path.clone();
workspace
@@ -5007,6 +5028,10 @@ impl AgentPanel {
);
}
+ menu = menu.entry("Rules Library", None, |_window, cx| {
+ cx.open_url(&zed_urls::rules_docs(cx));
+ });
+
menu = menu.separator();
}
diff --git a/crates/client/src/zed_urls.rs b/crates/client/src/zed_urls.rs
index 70ff9537d7a..8cd284da035 100644
--- a/crates/client/src/zed_urls.rs
+++ b/crates/client/src/zed_urls.rs
@@ -56,6 +56,10 @@ pub fn skills_docs(cx: &App) -> String {
format!("{server_url}/docs/ai/skills", server_url = server_url(cx))
}
+pub fn rules_docs(cx: &App) -> String {
+ format!("{server_url}/docs/ai/rules", server_url = server_url(cx))
+}
+
/// Returns the URL to Zed's ACP registry blog post.
pub fn acp_registry_blog(cx: &App) -> String {
format!(