Skip to content

Commit e910513

Browse files
committed
feat(tools): Add batch file operations support
Implement comprehensive batch operations for fs_read and fs_write tools: - Add operations-based structure to fs_read with multiple operation types - Implement batch processing for fs_write to handle multiple files and edits - Add BatchReadResult and BatchWriteResult for consistent response formats - Standardize tool summary display with improved parameter handling - Add comprehensive test coverage for all new functionality - Optimize performance by reducing separate tool calls for multiple files - Improve error handling and reporting for batch operations This feature significantly improves performance and usability when working with multiple files by reducing the number of separate tool calls needed. 🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
1 parent 0a4530a commit e910513

File tree

7 files changed

+4196
-787
lines changed

7 files changed

+4196
-787
lines changed

crates/chat-cli/src/cli/chat/tools/execute_bash.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ use super::{
2626
MAX_TOOL_RESPONSE_SIZE,
2727
OutputKind,
2828
};
29-
use crate::cli::chat::{
30-
CONTINUATION_LINE,
31-
PURPOSE_ARROW,
32-
};
3329
use crate::platform::Context;
3430
const READONLY_COMMANDS: &[&str] = &["ls", "cat", "echo", "pwd", "which", "head", "tail", "find", "grep"];
3531

@@ -39,6 +35,7 @@ pub struct ExecuteBash {
3935
pub summary: Option<String>,
4036
}
4137

38+
// Direct access to summary field
4239
impl ExecuteBash {
4340
pub fn requires_acceptance(&self) -> bool {
4441
let Some(args) = shlex::split(&self.command) else {
@@ -125,23 +122,9 @@ impl ExecuteBash {
125122
style::Print("\n"),
126123
style::ResetColor
127124
)?;
128-
125+
129126
// Add the summary if available
130-
if let Some(summary) = &self.summary {
131-
queue!(
132-
updates,
133-
style::Print(CONTINUATION_LINE),
134-
style::Print("\n"),
135-
style::Print(PURPOSE_ARROW),
136-
style::SetForegroundColor(Color::Blue),
137-
style::Print("Purpose: "),
138-
style::ResetColor,
139-
style::Print(summary),
140-
style::Print("\n"),
141-
)?;
142-
}
143-
144-
queue!(updates, style::Print("\n"))?;
127+
super::queue_summary(self.summary.as_deref(), updates, Some(2))?;
145128

146129
Ok(())
147130
}

0 commit comments

Comments
 (0)