claude-issue-solver 1.6.5 → 1.6.6

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.
@@ -215,25 +215,42 @@ async function cleanAllCommand() {
215
215
  catch {
216
216
  // Ignore errors closing windows
217
217
  }
218
- // Remove worktree
218
+ // Remove worktree/folder
219
+ const isOrphaned = !wt.branch;
219
220
  if (fs.existsSync(wt.path)) {
220
- try {
221
- (0, child_process_1.execSync)(`git worktree remove "${wt.path}" --force`, {
222
- cwd: projectRoot,
223
- stdio: 'pipe',
224
- });
221
+ // Try git worktree remove first (only if not orphaned)
222
+ if (!isOrphaned) {
223
+ try {
224
+ (0, child_process_1.execSync)(`git worktree remove "${wt.path}" --force`, {
225
+ cwd: projectRoot,
226
+ stdio: 'pipe',
227
+ });
228
+ }
229
+ catch {
230
+ // Ignore - we'll force delete below if needed
231
+ }
225
232
  }
226
- catch {
227
- // If git worktree remove fails, try removing directory manually with rm -rf
228
- // This handles locked files better than fs.rmSync
233
+ // If folder still exists, force delete it
234
+ if (fs.existsSync(wt.path)) {
229
235
  try {
230
- (0, child_process_1.execSync)(`rm -rf "${wt.path}"`, { stdio: 'pipe' });
236
+ (0, child_process_1.execSync)(`/bin/rm -rf "${wt.path}"`, { stdio: 'pipe' });
231
237
  }
232
238
  catch {
233
- fs.rmSync(wt.path, { recursive: true, force: true });
239
+ try {
240
+ fs.rmSync(wt.path, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
241
+ }
242
+ catch {
243
+ // Ignore - will check at end
244
+ }
234
245
  }
246
+ }
247
+ // Prune git worktrees
248
+ try {
235
249
  (0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
236
250
  }
251
+ catch {
252
+ // Ignore
253
+ }
237
254
  }
238
255
  // Delete branch (if we have one)
239
256
  if (wt.branch) {
@@ -335,34 +352,52 @@ async function cleanCommand(issueNumber) {
335
352
  catch {
336
353
  windowSpinner.warn('Could not close some windows');
337
354
  }
338
- // Remove worktree
355
+ // Remove worktree/folder
339
356
  if (fs.existsSync(worktreePath)) {
340
357
  const worktreeSpinner = (0, ora_1.default)('Removing worktree...').start();
341
- try {
342
- (0, child_process_1.execSync)(`git worktree remove "${worktreePath}" --force`, {
343
- cwd: projectRoot,
344
- stdio: 'pipe',
345
- });
346
- worktreeSpinner.succeed('Worktree removed');
358
+ // Try git worktree remove first (only if not orphaned)
359
+ if (!isOrphaned) {
360
+ try {
361
+ (0, child_process_1.execSync)(`git worktree remove "${worktreePath}" --force`, {
362
+ cwd: projectRoot,
363
+ stdio: 'pipe',
364
+ });
365
+ }
366
+ catch {
367
+ // Ignore - we'll force delete below if needed
368
+ }
347
369
  }
348
- catch {
349
- // If git worktree remove fails, try removing directory manually with rm -rf
370
+ // If folder still exists, force delete it
371
+ if (fs.existsSync(worktreePath)) {
350
372
  try {
351
- (0, child_process_1.execSync)(`rm -rf "${worktreePath}"`, { stdio: 'pipe' });
352
- (0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
353
- worktreeSpinner.succeed('Worktree removed (manually)');
373
+ // Use rm -rf with full path
374
+ (0, child_process_1.execSync)(`/bin/rm -rf "${worktreePath}"`, { stdio: 'pipe' });
354
375
  }
355
376
  catch {
377
+ // Try Node's rmSync as fallback
356
378
  try {
357
- fs.rmSync(worktreePath, { recursive: true, force: true });
358
- (0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
359
- worktreeSpinner.succeed('Worktree removed (manually)');
379
+ fs.rmSync(worktreePath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
360
380
  }
361
381
  catch {
362
- worktreeSpinner.warn('Could not remove worktree directory');
382
+ // Last resort - try with sudo hint
383
+ worktreeSpinner.warn(`Could not remove directory. Try manually: rm -rf "${worktreePath}"`);
363
384
  }
364
385
  }
365
386
  }
387
+ // Prune git worktrees
388
+ try {
389
+ (0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
390
+ }
391
+ catch {
392
+ // Ignore
393
+ }
394
+ // Check final result
395
+ if (fs.existsSync(worktreePath)) {
396
+ worktreeSpinner.warn(`Could not fully remove directory: ${worktreePath}`);
397
+ }
398
+ else {
399
+ worktreeSpinner.succeed(isOrphaned ? 'Folder removed' : 'Worktree removed');
400
+ }
366
401
  }
367
402
  // Delete branch (if we have one)
368
403
  if (branchName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {