refactor: eradicate deprecated tools (sticky_notes, pinned_files, context_workspaces, pr_checklist, preferences) and dead code

This commit is contained in:
Riz Ashraf committed 2026-10-07 11:12:42 +01:00
1 parent d80915635f
commit 79209da711
31 files changed
+1230 -3920

No files matched your search

+67 -46
View File
@@ -81,27 +81,64 @@ impl McpTool for ReadFileSkeletonHandler {
return;
}
let kind = node.kind();
let is_structural = matches!(
let is_container = matches!(
kind,
"use_declaration"
| "import_statement"
| "import_from_statement"
| "struct_item"
| "enum_item"
| "trait_item"
| "impl_item"
| "function_item"
| "function_declaration"
| "function_definition"
| "method_definition"
| "interface_declaration"
| "type_alias_declaration"
"impl_item"
| "class_declaration"
| "class_definition"
| "trait_item"
| "interface_declaration"
);
if is_structural {
let is_structural = is_container
|| matches!(
kind,
"use_declaration"
| "import_statement"
| "import_from_statement"
| "struct_item"
| "enum_item"
| "function_item"
| "function_declaration"
| "function_definition"
| "method_definition"
| "type_alias_declaration"
);
if is_container {
let indent = " ".repeat(depth);
let node_text = node.utf8_text(code.as_bytes()).unwrap_or("");
let mut header = String::new();
for line in node_text.lines() {
let trimmed = line.trim();
if trimmed.ends_with('{') || trimmed.ends_with(':') {
header.push_str(line);
break;
} else {
header.push_str(line);
header.push('\n');
}
}
if header.is_empty() {
if let Some(first_line) = node_text.lines().next() {
header = first_line.to_string();
}
}
out.push_str(&indent);
out.push_str(header.trim());
out.push('\n');
let mut cursor = node.walk();
for child in node.named_children(&mut cursor) {
extract_skeleton(child, code, out, depth + 1);
}
if header.trim().ends_with('{') {
out.push_str(&indent);
out.push_str("}\n");
}
} else if is_structural {
let indent = " ".repeat(depth);
let node_text = node.utf8_text(code.as_bytes()).unwrap_or("");
@@ -127,7 +164,7 @@ impl McpTool for ReadFileSkeletonHandler {
} else if node.is_named() {
let mut cursor = node.walk();
for child in node.named_children(&mut cursor) {
extract_skeleton(child, code, out, depth + 1);
extract_skeleton(child, code, out, depth);
}
}
}
@@ -231,6 +268,7 @@ impl McpTool for ReplaceAstNodeHandler {
actual_kind,
"trait_item" | "interface_declaration" | "interface_item"
),
"impl" | "impl_item" => actual_kind == "impl_item",
"type" | "type_alias" => matches!(
actual_kind,
"type_alias_declaration" | "type_item" | "type_definition"
@@ -253,6 +291,7 @@ impl McpTool for ReplaceAstNodeHandler {
let kind = child.kind();
if kind == "identifier"
|| kind == "name"
|| kind == "type_identifier"
|| kind == "property_identifier"
|| kind == "field_identifier"
{
@@ -386,6 +425,11 @@ fn scan_workspace_for_symbol(
if scanned_files > 500 {
break;
}
if let Ok(meta) = std::fs::metadata(path) {
if meta.len() > 1024 * 1024 {
continue;
}
}
if let Ok(content) = std::fs::read_to_string(path) {
for (line_num, line) in content.lines().enumerate() {
let is_match = if filter_fn_call {
@@ -450,17 +494,7 @@ impl McpTool for FindSymbolReferencesHandler {
Ok::<Vec<serde_json::Value>, crate::error::AppError>(refs)
})?;
let custom_dir = if let Some(ref d) = req.workspace_dir {
Some(std::path::PathBuf::from(d))
} else {
state.project.pinned_files.read_with(|pinned| {
pinned.first().and_then(|pin| {
std::path::Path::new(&pin.file_path)
.parent()
.map(|p| p.to_path_buf())
})
})
};
let custom_dir = req.workspace_dir.as_ref().map(std::path::PathBuf::from);
if matches.len() < limit {
let remaining = limit - matches.len();
@@ -516,17 +550,7 @@ impl McpTool for GetCallersHandler {
Ok::<Vec<serde_json::Value>, crate::error::AppError>(matching)
})?;
let custom_dir = if let Some(ref d) = req.workspace_dir {
Some(std::path::PathBuf::from(d))
} else {
state.project.pinned_files.read_with(|pinned| {
pinned.first().and_then(|pin| {
std::path::Path::new(&pin.file_path)
.parent()
.map(|p| p.to_path_buf())
})
})
};
let custom_dir = req.workspace_dir.as_ref().map(std::path::PathBuf::from);
if callers.len() < limit {
let remaining = limit - callers.len();
@@ -571,13 +595,10 @@ impl McpTool for AnalyzeImpactHandler {
}
});
let custom_dir = state.project.pinned_files.read_with(|pinned| {
pinned.first().and_then(|pin| {
std::path::Path::new(&pin.file_path)
.parent()
.map(|p| p.to_path_buf())
})
});
let custom_dir = req
.file_path
.as_ref()
.and_then(|p| std::path::Path::new(p).parent().map(|p| p.to_path_buf()));
let sym_clone = sym.clone();
let disk_refs = tokio::task::spawn_blocking(move || {