claude-issue-solver 1.26.0 → 1.26.2

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.
@@ -527,10 +527,12 @@ async function cleanMergedCommand() {
527
527
  prStatus: wt.branch ? await (0, github_1.getPRForBranchAsync)(wt.branch) : null,
528
528
  })));
529
529
  statusSpinner.stop();
530
- // Filter to only merged PRs
530
+ // Filter to merged PRs and orphaned folders
531
531
  const mergedWorktrees = worktreesWithStatus.filter((wt) => wt.prStatus?.state === 'merged');
532
- if (mergedWorktrees.length === 0) {
533
- console.log(chalk_1.default.yellow('\nNo worktrees with merged PRs found.'));
532
+ const orphanedWorktrees = worktreesWithStatus.filter((wt) => !wt.branch);
533
+ const toClean = [...mergedWorktrees, ...orphanedWorktrees];
534
+ if (toClean.length === 0) {
535
+ console.log(chalk_1.default.yellow('\nNo worktrees with merged PRs or orphaned folders found.'));
534
536
  // Show what's available
535
537
  if (worktreesWithStatus.length > 0) {
536
538
  console.log(chalk_1.default.dim('\nExisting worktrees:'));
@@ -541,15 +543,16 @@ async function cleanMergedCommand() {
541
543
  }
542
544
  return;
543
545
  }
544
- console.log(chalk_1.default.bold(`\n🧹 Cleaning ${mergedWorktrees.length} worktree(s) with merged PRs:\n`));
545
- for (const wt of mergedWorktrees) {
546
- console.log(` ${chalk_1.default.cyan(`#${wt.issueNumber}`)}\t${chalk_1.default.green('āœ“ PR merged')}`);
546
+ console.log(chalk_1.default.bold(`\n🧹 Cleaning ${toClean.length} worktree(s):\n`));
547
+ for (const wt of toClean) {
548
+ const status = getStatusLabel(wt);
549
+ console.log(` ${chalk_1.default.cyan(`#${wt.issueNumber}`)}\t${status}`);
547
550
  if (wt.branch) {
548
551
  console.log(chalk_1.default.dim(` \t${wt.branch}`));
549
552
  }
550
553
  }
551
554
  console.log();
552
- for (const wt of mergedWorktrees) {
555
+ for (const wt of toClean) {
553
556
  const spinner = (0, ora_1.default)(`Cleaning issue #${wt.issueNumber}...`).start();
554
557
  try {
555
558
  // Close terminal and VS Code windows for this worktree
@@ -632,5 +635,5 @@ async function cleanMergedCommand() {
632
635
  // May fail if current directory was deleted
633
636
  }
634
637
  console.log();
635
- console.log(chalk_1.default.green(`āœ… Cleaned up ${mergedWorktrees.length} merged worktree(s)!`));
638
+ console.log(chalk_1.default.green(`āœ… Cleaned up ${toClean.length} worktree(s)!`));
636
639
  }
@@ -248,6 +248,13 @@ async function mergeCommand() {
248
248
  for (const pr of selected) {
249
249
  const prSpinner = (0, ora_1.default)(`Merging PR #${pr.number}...`).start();
250
250
  try {
251
+ // Clean up worktree FIRST (before merge) to avoid branch deletion issues
252
+ try {
253
+ cleanupWorktree(projectRoot, pr.headRefName, pr.issueNumber?.toString() || null);
254
+ }
255
+ catch {
256
+ // Worktree may not exist, continue with merge
257
+ }
251
258
  // Merge the PR
252
259
  (0, child_process_1.execSync)(`gh pr merge ${pr.number} --squash --delete-branch`, {
253
260
  cwd: projectRoot,
@@ -255,15 +262,6 @@ async function mergeCommand() {
255
262
  stdio: ['pipe', 'pipe', 'pipe'],
256
263
  });
257
264
  prSpinner.succeed(`Merged PR #${pr.number}: ${pr.title.slice(0, 50)}`);
258
- // Clean up worktree
259
- const cleanSpinner = (0, ora_1.default)(` Cleaning up worktree...`).start();
260
- try {
261
- cleanupWorktree(projectRoot, pr.headRefName, pr.issueNumber?.toString() || null);
262
- cleanSpinner.succeed(` Cleaned up worktree`);
263
- }
264
- catch {
265
- cleanSpinner.warn(` Could not clean worktree (may not exist)`);
266
- }
267
265
  merged++;
268
266
  }
269
267
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.26.0",
3
+ "version": "1.26.2",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {