Force-remove all active worktrees (for process exit handler).
()
| 231 | |
| 232 | /** Force-remove all active worktrees (for process exit handler). */ |
| 233 | cleanupAll(): void { |
| 234 | for (const testName of [...this.active.keys()]) { |
| 235 | this.cleanup(testName); |
| 236 | } |
| 237 | |
| 238 | // Clean up the run directory if empty |
| 239 | const runDir = path.join(this.repoRoot, '.gstack-worktrees', this.runId); |
| 240 | try { |
| 241 | const entries = fs.readdirSync(runDir); |
| 242 | if (entries.length === 0) { |
| 243 | fs.rmdirSync(runDir); |
| 244 | } |
| 245 | } catch { /* non-fatal */ } |
| 246 | } |
| 247 | |
| 248 | /** Remove worktrees from previous runs that weren't cleaned up. */ |
| 249 | pruneStale(): void { |