feat: add coding tools (edit_file, write_file, bash)

New tools for code modification:
- EditFileTool: find-and-replace with safety checks (unique match required)
- WriteFileTool: create/overwrite files with path validation
- BashTool: full bash with controlled write access

Security controls on BashTool:
- Allowed: mkdir, touch, cp, mv, rm (single files), git, pip, pytest
- Forbidden: sudo, curl, wget, ssh, rm -rf, chmod 777

Includes 39 new tests (78 total now passing).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-10 11:16:05 +01:00
co-authored by Claude Opus 4.5
parent 3b58fa4f8b
commit d0fa5b38a7
8 changed files with 1350 additions and 4 deletions
+5 -2
View File
@@ -4,15 +4,18 @@ Tool implementations for agent use.
All tools inherit from BaseTool and return ToolResult.
"""
from src.domains.tools.base import BaseTool, ToolResult
from src.domains.tools.file import ReadFileTool, GlobFilesTool
from src.domains.tools.file import ReadFileTool, GlobFilesTool, EditFileTool, WriteFileTool
from src.domains.tools.search import GrepContentTool
from src.domains.tools.shell import BashReadOnlyTool
from src.domains.tools.shell import BashReadOnlyTool, BashTool
__all__ = [
"BaseTool",
"ToolResult",
"ReadFileTool",
"GlobFilesTool",
"EditFileTool",
"WriteFileTool",
"GrepContentTool",
"BashReadOnlyTool",
"BashTool",
]