MCPcopy Index your code
hub / github.com/HKUDS/DeepCode / initialize_workspace

Function initialize_workspace

tools/code_implementation_server.py:56–77  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

54
55
56def 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
80def ensure_workspace_exists():

Callers 3

ensure_workspace_existsFunction · 0.85
validate_pathFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected