diff --git a/opencode-container.py b/opencode-container.py index d4dcb96..84a7919 100755 --- a/opencode-container.py +++ b/opencode-container.py @@ -45,6 +45,14 @@ class OpenCodeContainer: # Ensure container home directory exists self.container_home_path.mkdir(parents=True, exist_ok=True) + # Pre-create project directory structure to prevent root-owned directories + try: + relative_path = self.project_path.relative_to(Path.home()) + (self.container_home_path / relative_path).mkdir(parents=True, exist_ok=True) + except ValueError: + # Project is outside home directory - no action needed + pass + if not self.image_exists(): self.build_image()