diff --git a/CHANGELOG.md b/CHANGELOG.md index d9df964d..3c98f94d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 2.3.1 - Linux Compatibility Fix + +### 🐛 Bug Fixes + +- Resolved path handling issues on Linux systems for improved cross-platform compatibility + +--- + +## What's Changed + +- fix: Fix to linux path issue by @AndyMik90 in 3276034 + ## 2.2.0 - 2025-12-17 ### ✨ New Features diff --git a/auto-claude/.env.example b/auto-claude/.env.example index d794366d..cb2f2329 100644 --- a/auto-claude/.env.example +++ b/auto-claude/.env.example @@ -9,6 +9,16 @@ CLAUDE_CODE_OAUTH_TOKEN=your-oauth-token-here # Default: claude-opus-4-5-20251101 # AUTO_BUILD_MODEL=claude-opus-4-5-20251101 +# ============================================================================= +# GIT/WORKTREE SETTINGS (OPTIONAL) +# ============================================================================= +# Configure how Auto Claude handles git worktrees for isolated builds. + +# Default base branch for worktree creation (OPTIONAL) +# If not set, Auto Claude will auto-detect main/master, or fall back to current branch. +# Common values: main, master, develop +# DEFAULT_BRANCH=main + # ============================================================================= # DEBUG MODE (OPTIONAL) # ============================================================================= diff --git a/auto-claude/core/worktree.py b/auto-claude/core/worktree.py index 6afaea67..ef7e0f80 100644 --- a/auto-claude/core/worktree.py +++ b/auto-claude/core/worktree.py @@ -15,6 +15,7 @@ This allows: """ import asyncio +import os import re import shutil import subprocess @@ -53,10 +54,55 @@ class WorktreeManager: def __init__(self, project_dir: Path, base_branch: str | None = None): self.project_dir = project_dir - self.base_branch = base_branch or self._get_current_branch() + self.base_branch = base_branch or self._detect_base_branch() self.worktrees_dir = project_dir / ".worktrees" self._merge_lock = asyncio.Lock() + def _detect_base_branch(self) -> str: + """ + Detect the base branch for worktree creation. + + Priority order: + 1. DEFAULT_BRANCH environment variable + 2. Auto-detect main/master (if they exist) + 3. Fall back to current branch (with warning) + + Returns: + The detected base branch name + """ + # 1. Check for DEFAULT_BRANCH env var + env_branch = os.getenv("DEFAULT_BRANCH") + if env_branch: + # Verify the branch exists + result = subprocess.run( + ["git", "rev-parse", "--verify", env_branch], + cwd=self.project_dir, + capture_output=True, + text=True, + ) + if result.returncode == 0: + return env_branch + else: + print(f"Warning: DEFAULT_BRANCH '{env_branch}' not found, auto-detecting...") + + # 2. Auto-detect main/master + for branch in ["main", "master"]: + result = subprocess.run( + ["git", "rev-parse", "--verify", branch], + cwd=self.project_dir, + capture_output=True, + text=True, + ) + if result.returncode == 0: + return branch + + # 3. Fall back to current branch with warning + current = self._get_current_branch() + print(f"Warning: Could not find 'main' or 'master' branch.") + print(f"Warning: Using current branch '{current}' as base for worktree.") + print(f"Tip: Set DEFAULT_BRANCH=your-branch in .env to avoid this.") + return current + def _get_current_branch(self) -> str: """Get the current git branch.""" result = subprocess.run( diff --git a/auto-claude/runners/spec_runner.py b/auto-claude/runners/spec_runner.py index cc741c3d..436c1573 100644 --- a/auto-claude/runners/spec_runner.py +++ b/auto-claude/runners/spec_runner.py @@ -240,7 +240,7 @@ Examples: print() # Build the run.py command - run_script = Path(__file__).parent / "run.py" + run_script = Path(__file__).parent.parent / "run.py" run_cmd = [ sys.executable, str(run_script),