Skip to content

Commit 0627f6a

Browse files
committed
Extend external mv/cp/mkdir, cap MCP output, tighten edit/symlink gates
1 parent 46dd069 commit 0627f6a

6 files changed

Lines changed: 729 additions & 180 deletions

File tree

src/tools/codesearch.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ pub const SEARCH_RESULTS_PREFIX: &str = "Code search results:\n\n";
1515
/// in the tool schema is derived from this via [`default_exclude_dirs_human`],
1616
/// so adding an entry here automatically updates the description the
1717
/// model sees.
18-
pub const DEFAULT_EXCLUDE_DIRS: &[&str] =
19-
&["target", "node_modules", ".git", "dist", "build"];
18+
pub const DEFAULT_EXCLUDE_DIRS: &[&str] = &["target", "node_modules", ".git", "dist", "build"];
2019

2120
/// Default per-file match cap when the caller doesn't specify `max_results`.
2221
/// Exposed `pub` so the schema description in `types.rs` stays in sync
@@ -168,9 +167,8 @@ impl CodeSearchTool {
168167
// is the common "no matches" shape; we also keep the legacy
169168
// "No matches found" substring check for defence-in-depth.
170169
let stderr = String::from_utf8_lossy(&output.stderr);
171-
let is_no_match = output.status.success()
172-
|| stderr.is_empty()
173-
|| stderr.contains("No matches found");
170+
let is_no_match =
171+
output.status.success() || stderr.is_empty() || stderr.contains("No matches found");
174172
if is_no_match {
175173
Ok(format!("No matches found for pattern: '{}'", pattern))
176174
} else {

src/tools/filesystem.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ impl FileSystemTool {
188188
)));
189189
}
190190

191-
fs::read_to_string(path)
192-
.with_context(|| format!("Failed to read file: {}", label))
191+
fs::read_to_string(path).with_context(|| format!("Failed to read file: {}", label))
193192
}
194193

195194
pub fn write_file(&self, path: &str, content: &str) -> Result<()> {

0 commit comments

Comments
 (0)