Add workspace-dependent tools These tools need to know the workspace directory. Args: tools: Existing tools list to add to config: Configuration object workspace_dir: Workspace directory path
(tools: List[Tool], config: Config, workspace_dir: Path)
| 432 | |
| 433 | |
| 434 | def add_workspace_tools(tools: List[Tool], config: Config, workspace_dir: Path): |
| 435 | """Add workspace-dependent tools |
| 436 | |
| 437 | These tools need to know the workspace directory. |
| 438 | |
| 439 | Args: |
| 440 | tools: Existing tools list to add to |
| 441 | config: Configuration object |
| 442 | workspace_dir: Workspace directory path |
| 443 | """ |
| 444 | # Ensure workspace directory exists |
| 445 | workspace_dir.mkdir(parents=True, exist_ok=True) |
| 446 | |
| 447 | # Bash tool - needs workspace as cwd for command execution |
| 448 | if config.tools.enable_bash: |
| 449 | bash_tool = BashTool(workspace_dir=str(workspace_dir)) |
| 450 | tools.append(bash_tool) |
| 451 | print(f"{Colors.GREEN}✅ Loaded Bash tool (cwd: {workspace_dir}){Colors.RESET}") |
| 452 | |
| 453 | # File tools - need workspace to resolve relative paths |
| 454 | if config.tools.enable_file_tools: |
| 455 | tools.extend( |
| 456 | [ |
| 457 | ReadTool(workspace_dir=str(workspace_dir)), |
| 458 | WriteTool(workspace_dir=str(workspace_dir)), |
| 459 | EditTool(workspace_dir=str(workspace_dir)), |
| 460 | ] |
| 461 | ) |
| 462 | print(f"{Colors.GREEN}✅ Loaded file operation tools (workspace: {workspace_dir}){Colors.RESET}") |
| 463 | |
| 464 | # Session note tool - needs workspace to store memory file |
| 465 | if config.tools.enable_note: |
| 466 | tools.append(SessionNoteTool(memory_file=str(workspace_dir / ".agent_memory.json"))) |
| 467 | print(f"{Colors.GREEN}✅ Loaded session note tool{Colors.RESET}") |
| 468 | |
| 469 | |
| 470 | async def _quiet_cleanup(): |
no test coverage detected