picoclaw/pkg/tools
yinwm 35fa64cde8 feat: US-015 - Add EditTool tests
Added comprehensive test coverage for EditTool (EditFileTool, AppendFileTool) with 10 test cases:
- TestEditTool_EditFile_Success: Verifies successful file editing
- TestEditTool_EditFile_NotFound: Verifies error handling for non-existent files
- TestEditTool_EditFile_OldTextNotFound: Verifies error when old_text not found
- TestEditTool_EditFile_MultipleMatches: Verifies error for multiple occurrences
- TestEditTool_EditFile_OutsideAllowedDir: Verifies directory restriction
- TestEditTool_EditFile_MissingPath: Verifies missing path parameter
- TestEditTool_EditFile_MissingOldText: Verifies missing old_text parameter
- TestEditTool_EditFile_MissingNewText: Verifies missing new_text parameter
- TestEditTool_AppendFile_Success: Verifies successful file appending
- TestEditTool_AppendFile_MissingPath: Verifies missing path for append
- TestEditTool_AppendFile_MissingContent: Verifies missing content for append

EditTool implementation already conforms to ToolResult specification:
- EditFile returns SilentResult('File edited: ...')
- AppendFile returns SilentResult('Appended to ...')
- Errors return ErrorResult with IsError=true

EditFileTool includes security feature: optional directory restriction to prevent editing files outside allowed paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:55:57 +08:00
..
base.go feat: US-006 - Add AsyncCallback type and AsyncTool interface 2026-02-12 19:35:41 +08:00
cron.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
cron.go.bak2 feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
cron.go.broken feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
edit.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
edit_test.go feat: US-015 - Add EditTool tests 2026-02-12 19:55:57 +08:00
filesystem.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
filesystem_test.go feat: US-013 - Add FilesystemTool tests 2026-02-12 19:53:00 +08:00
message.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
message_test.go feat: US-011 - Add MessageTool tests 2026-02-12 19:50:53 +08:00
registry.go feat: US-008 - Inject callback into async tools in AgentLoop 2026-02-12 19:42:24 +08:00
result.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
result_test.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
shell.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
shell_test.go feat: US-012 - Add ShellTool tests 2026-02-12 19:52:16 +08:00
spawn.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
subagent.go Add memory system, debug mode, and tools 2026-02-11 00:14:23 +08:00
types.go * First commit 2026-02-09 19:20:19 +08:00
web.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
web_test.go feat: US-014 - Add WebTool tests 2026-02-12 19:54:44 +08:00