1use crate::api::{ScopeProtocolItemSchema, ScopeUsageResponse};
2
3const SCOPE_USAGE_MD: &str = include_str!("../USAGE.md");
4
5pub fn usage_markdown() -> &'static str {
7 SCOPE_USAGE_MD
8}
9
10pub fn protocol_schema() -> Vec<ScopeProtocolItemSchema> {
12 vec![
13 ScopeProtocolItemSchema {
14 item: "search_code".to_string(),
15 syntax: r#"{"query":"matching_commands(","mode":"literal","path":"src/dashboard","include":["*.rs"],"exclude":["target/**"],"types":["rust"],"case":"smart","word":false,"line":false,"hidden":false,"respect_ignore":true,"follow":false,"limit":20}"#
16 .to_string(),
17 notes: "Searches source content and returns matched-line hits with path plus line-hash anchors. Query defaults to literal matching with smart case; use mode:\"regex\" only for regular expressions."
18 .to_string(),
19 },
20 ScopeProtocolItemSchema {
21 item: "read_code".to_string(),
22 syntax: r##"{"path":"src/foo.rs","anchor":"42#ab","mode":"full"}"##.to_string(),
23 notes: "Reads a path plus line-hash anchor in around or full mode and returns only hash-anchored source lines."
24 .to_string(),
25 },
26 ScopeProtocolItemSchema {
27 item: "edit_code".to_string(),
28 syntax: r#"{"edits":[{"path":"src/foo.rs","op":"replace","start":"10#7a","end":"20#d4","content":"..."}]}"#
29 .to_string(),
30 notes: "Applies path plus line-hash anchored Replace/Append/Prepend edits and returns propagation results."
31 .to_string(),
32 },
33 ]
34}
35
36pub fn usage_response() -> ScopeUsageResponse {
38 ScopeUsageResponse {
39 usage_markdown: usage_markdown().to_string(),
40 protocol_items: protocol_schema(),
41 }
42}