claude-issue-solver 1.8.0 → 1.8.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.
@@ -223,11 +223,19 @@ function getIssueWorktrees() {
223
223
  }
224
224
  async function cleanAllCommand() {
225
225
  const projectRoot = (0, git_1.getProjectRoot)();
226
+ const currentDir = process.cwd();
226
227
  const worktrees = getIssueWorktrees();
227
228
  if (worktrees.length === 0) {
228
229
  console.log(chalk_1.default.yellow('\nNo issue worktrees found.'));
229
230
  return;
230
231
  }
232
+ // Warn if user is inside a worktree that might be deleted
233
+ const inWorktree = worktrees.find((wt) => currentDir.startsWith(wt.path));
234
+ if (inWorktree) {
235
+ console.log(chalk_1.default.yellow(`\n⚠️ You are inside worktree #${inWorktree.issueNumber}`));
236
+ console.log(chalk_1.default.yellow(` Run this command from the main project directory for best results.`));
237
+ console.log(chalk_1.default.dim(` cd ${projectRoot}\n`));
238
+ }
231
239
  // Fetch status for all worktrees
232
240
  const statusSpinner = (0, ora_1.default)('Fetching issue and PR status...').start();
233
241
  const worktreesWithStatus = worktrees.map((wt) => ({
@@ -495,11 +503,19 @@ async function cleanCommand(issueNumber) {
495
503
  }
496
504
  async function cleanMergedCommand() {
497
505
  const projectRoot = (0, git_1.getProjectRoot)();
506
+ const currentDir = process.cwd();
498
507
  const worktrees = getIssueWorktrees();
499
508
  if (worktrees.length === 0) {
500
509
  console.log(chalk_1.default.yellow('\nNo issue worktrees found.'));
501
510
  return;
502
511
  }
512
+ // Warn if user is inside a worktree that might be deleted
513
+ const inWorktree = worktrees.find((wt) => currentDir.startsWith(wt.path));
514
+ if (inWorktree) {
515
+ console.log(chalk_1.default.yellow(`\n⚠️ You are inside worktree #${inWorktree.issueNumber}`));
516
+ console.log(chalk_1.default.yellow(` Run this command from the main project directory for best results.`));
517
+ console.log(chalk_1.default.dim(` cd ${projectRoot}\n`));
518
+ }
503
519
  // Fetch status for all worktrees
504
520
  const statusSpinner = (0, ora_1.default)('Fetching PR status...').start();
505
521
  const worktreesWithStatus = worktrees.map((wt) => ({
@@ -606,7 +622,12 @@ async function cleanMergedCommand() {
606
622
  }
607
623
  }
608
624
  // Prune stale worktrees
609
- (0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
625
+ try {
626
+ (0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
627
+ }
628
+ catch {
629
+ // May fail if current directory was deleted
630
+ }
610
631
  console.log();
611
632
  console.log(chalk_1.default.green(`✅ Cleaned up ${mergedWorktrees.length} merged worktree(s)!`));
612
633
  }
@@ -104,7 +104,7 @@ async function solveCommand(issueNumber) {
104
104
  (0, helpers_1.symlinkNodeModules)(projectRoot, worktreePath);
105
105
  setupSpinner.succeed('Worktree setup complete');
106
106
  }
107
- // Build the prompt for Claude
107
+ // Build the prompt for Claude and save to file (avoids shell escaping issues)
108
108
  const prompt = `Please solve this GitHub issue:
109
109
 
110
110
  ## Issue #${issueNumber}: ${issue.title}
@@ -118,6 +118,9 @@ Instructions:
118
118
  2. Implement the necessary changes
119
119
  3. Make sure to run tests if applicable
120
120
  4. When done, commit your changes with a descriptive message that references the issue`;
121
+ // Write prompt to a file to avoid shell escaping issues with backticks, <>, etc.
122
+ const promptFile = path.join(worktreePath, '.claude-prompt.txt');
123
+ fs.writeFileSync(promptFile, prompt);
121
124
  // Create runner script
122
125
  const runnerScript = path.join(worktreePath, '.claude-runner.sh');
123
126
  const runnerContent = `#!/bin/bash
@@ -203,8 +206,11 @@ while true; do
203
206
  done &
204
207
  WATCHER_PID=$!
205
208
 
206
- # Run Claude interactively
207
- claude --dangerously-skip-permissions "${prompt.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"
209
+ # Run Claude interactively (read prompt from file to avoid shell escaping issues)
210
+ claude --dangerously-skip-permissions "$(cat '${promptFile}')"
211
+
212
+ # Clean up prompt file
213
+ rm -f '${promptFile}'
208
214
 
209
215
  # Kill the watcher
210
216
  kill $WATCHER_PID 2>/dev/null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {