Initialize workspace By default, the workspace will be set by the workflow via the set_workspace tool to: {plan_file_parent}/generate_code Args: workspace_dir: Optional workspace directory path
(workspace_dir: str = None)
| 54 | |
| 55 | |
| 56 | def initialize_workspace(workspace_dir: str = None): |
| 57 | """ |
| 58 | Initialize workspace |
| 59 | |
| 60 | By default, the workspace will be set by the workflow via the set_workspace tool to: |
| 61 | {plan_file_parent}/generate_code |
| 62 | |
| 63 | Args: |
| 64 | workspace_dir: Optional workspace directory path |
| 65 | """ |
| 66 | global WORKSPACE_DIR |
| 67 | if workspace_dir is None: |
| 68 | # Default to generate_code directory under current directory, but don't create immediately |
| 69 | # This default value will be overridden by workflow via set_workspace tool |
| 70 | WORKSPACE_DIR = Path.cwd() / "generate_code" |
| 71 | # logger.info(f"Workspace initialized (default value, will be overridden by workflow): {WORKSPACE_DIR}") |
| 72 | # logger.info("Note: Actual workspace will be set by workflow via set_workspace tool to {plan_file_parent}/generate_code") |
| 73 | else: |
| 74 | WORKSPACE_DIR = Path(workspace_dir).resolve() |
| 75 | # Only create when explicitly specified |
| 76 | WORKSPACE_DIR.mkdir(parents=True, exist_ok=True) |
| 77 | logger.info(f"Workspace initialized: {WORKSPACE_DIR}") |
| 78 | |
| 79 | |
| 80 | def ensure_workspace_exists(): |
no outgoing calls
no test coverage detected