Overview
This issue tracks the implementation of the batch file operations feature as proposed in RFC PR #1772.
Feature Description
Enhance the fs_read and fs_write tools to support batch operations on multiple files in a single call, with the ability to perform multiple edits per file, maintain line number integrity through proper edit ordering, and perform search/replace operations across files in a folder using wildcard patterns with sed-like syntax.
Implementation Phases
The implementation will be broken down into three distinct phases:
Phase 1: fs_read Batch Operations
- Add the
paths parameter to fs_read
- Implement batch processing logic for multiple files
- Update the response format to include content_hash and last_modified timestamp
- Add comprehensive error handling for batch operations
- Add tests for the new functionality
Phase 2: Pattern Replacement for fs_write
- Add the
pattern_replace command to fs_write
- Integrate the sd crate for sed-like functionality
- Implement file pattern matching with glob/globset
- Add support for recursive directory traversal
- Add tests for pattern replacement functionality
Phase 3: Multi-File Operations for fs_write
- Add the
fileEdits parameter to fs_write
- Implement edit ordering logic for maintaining line number integrity
- Add the
replace_lines command with content hash verification for safety
- Update the response format to handle multiple file results with detailed error reporting
- Add tests for multi-file operations and multiple edits per file
Dependencies
Acceptance Criteria
- All phases implemented and tested
- Documentation updated to reflect new functionality
- Examples provided for common use cases
- Performance impact assessed and optimized
🤖 Assisted by Amazon Q Developer
Overview
This issue tracks the implementation of the batch file operations feature as proposed in RFC PR #1772.
Feature Description
Enhance the fs_read and fs_write tools to support batch operations on multiple files in a single call, with the ability to perform multiple edits per file, maintain line number integrity through proper edit ordering, and perform search/replace operations across files in a folder using wildcard patterns with sed-like syntax.
Implementation Phases
The implementation will be broken down into three distinct phases:
Phase 1: fs_read Batch Operations
pathsparameter to fs_readPhase 2: Pattern Replacement for fs_write
pattern_replacecommand to fs_writePhase 3: Multi-File Operations for fs_write
fileEditsparameter to fs_writereplace_linescommand with content hash verification for safetyDependencies
Acceptance Criteria
🤖 Assisted by Amazon Q Developer