autopilot-code 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autopilot-code",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "private": false,
5
5
  "description": "Repo-issue–driven autopilot runner",
6
6
  "license": "MIT",
@@ -14,7 +14,9 @@ if (process.env.CI || process.env.GITHUB_ACTIONS) {
14
14
  }
15
15
 
16
16
  // Skip if running in an autopilot worktree (prevents killing the running service)
17
- if (process.cwd().includes('/tmp/autopilot-issue-') || process.env.AUTOPILOT_WORKTREE) {
17
+ // INIT_CWD is set by npm to the directory where npm install was run
18
+ const initCwd = process.env.INIT_CWD || process.cwd();
19
+ if (initCwd.includes('/tmp/autopilot-issue-') || process.env.AUTOPILOT_WORKTREE) {
18
20
  console.log('Autopilot: skipping auto-install (running in worktree).');
19
21
  process.exit(0);
20
22
  }
@@ -80,6 +80,9 @@ BRANCH="autopilot/issue-$ISSUE_NUMBER"
80
80
  echo "[run_opencode_issue.sh] repo=$REPO issue=$ISSUE_NUMBER worktree=$WORKTREE"
81
81
 
82
82
  # 1. Create or reuse git worktree from main
83
+ # First, prune any stale worktrees (e.g., if directory was deleted but still registered)
84
+ git worktree prune 2>/dev/null || true
85
+
83
86
  if [[ -d "$WORKTREE" ]]; then
84
87
  echo "[run_opencode_issue.sh] Reusing existing worktree: $WORKTREE"
85
88
  else