claude-issue-solver 1.26.1 → 1.26.3

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.
@@ -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) {
@@ -14,15 +14,19 @@ const util_1 = require("util");
14
14
  const execAsync = (0, util_1.promisify)(child_process_1.exec);
15
15
  function createIssue(title, body, labels) {
16
16
  try {
17
- let cmd = `gh issue create --title "${title.replace(/"/g, '\\"')}"`;
17
+ // Build args array to avoid shell escaping issues
18
+ const args = ['issue', 'create', '--title', title];
18
19
  if (body) {
19
- cmd += ` --body "${body.replace(/"/g, '\\"')}"`;
20
+ args.push('--body', body);
20
21
  }
21
22
  if (labels && labels.length > 0) {
22
23
  for (const label of labels) {
23
- cmd += ` --label "${label.replace(/"/g, '\\"')}"`;
24
+ args.push('--label', label);
24
25
  }
25
26
  }
27
+ // Use spawn-like approach with shell: false would be ideal, but execSync doesn't support it well
28
+ // Instead, use -- to prevent argument parsing issues and proper quoting
29
+ const cmd = `gh ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`;
26
30
  const output = (0, child_process_1.execSync)(cmd, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
27
31
  // Output is the issue URL, extract the number
28
32
  const match = output.trim().match(/\/issues\/(\d+)$/);
@@ -31,7 +35,11 @@ function createIssue(title, body, labels) {
31
35
  }
32
36
  return null;
33
37
  }
34
- catch {
38
+ catch (error) {
39
+ // Log error for debugging
40
+ if (process.env.DEBUG) {
41
+ console.error('createIssue error:', error.stderr?.toString() || error.message);
42
+ }
35
43
  return null;
36
44
  }
37
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.26.1",
3
+ "version": "1.26.3",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {