Skip to content

refactor(pr-automation): replace git checkout with worktree isolation#1976

Merged
piorpua merged 1 commit intomainfrom
zynx/refactor/worktree-pr-automation
Mar 31, 2026
Merged

refactor(pr-automation): replace git checkout with worktree isolation#1976
piorpua merged 1 commit intomainfrom
zynx/refactor/worktree-pr-automation

Conversation

@piorpua
Copy link
Copy Markdown
Contributor

@piorpua piorpua commented Mar 31, 2026

Summary

  • Replace all git checkout / gh pr checkout branch switching in pr-review, pr-fix, pr-automation skills with git worktree isolation — the main repo never leaves main
  • Extract hardcoded configuration (CRITICAL_PATH_PATTERN, LARGE_PR_FILE_THRESHOLD, etc.) to scripts/pr-automation.conf, sourced by daemon with env var override support
  • Add worktree cleanup to daemon crash recovery and use remote refs (FETCH_HEAD) for PR scale assessment (eliminates checkout entirely for read-only operations)

Test plan

  • Run bash -n scripts/pr-automation.sh — syntax check passes
  • Run /pr-review <PR> manually — verify worktree created at /tmp/aionui-pr-* and cleaned up after
  • Run /pr-fix <PR> manually — verify fixes applied in worktree, pushed correctly
  • Kill Claude mid-review, restart daemon — verify stale worktree cleaned up
  • Override config via env: CRITICAL_PATH_PATTERN="" ./scripts/pr-automation.sh — verify env takes precedence

- Replace branch switching in pr-review, pr-fix, pr-automation skills
  with git worktree for full isolation (main repo never leaves main)
- Add worktree cleanup to daemon crash recovery (pr-automation.sh)
- Extract config to scripts/pr-automation.conf (CRITICAL_PATH_PATTERN,
  LARGE_PR_FILE_THRESHOLD, PR_DAYS_LOOKBACK, etc.)
- Export env vars needed by Claude's Bash tool at runtime
- Use remote refs (FETCH_HEAD) for scale assessment instead of checkout
@piorpua piorpua enabled auto-merge (squash) March 31, 2026 03:52
@piorpua piorpua merged commit 7de60d5 into main Mar 31, 2026
19 of 21 checks passed
@piorpua piorpua deleted the zynx/refactor/worktree-pr-automation branch March 31, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant