claude-issue-solver 1.38.0 → 1.39.1

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.
@@ -1 +1,2 @@
1
- export declare function selectCommand(): Promise<void>;
1
+ import { SolveOptions } from './solve';
2
+ export declare function selectCommand(options?: SolveOptions): Promise<void>;
@@ -9,7 +9,7 @@ const inquirer_1 = __importDefault(require("inquirer"));
9
9
  const github_1 = require("../utils/github");
10
10
  const git_1 = require("../utils/git");
11
11
  const solve_1 = require("./solve");
12
- async function selectCommand() {
12
+ async function selectCommand(options = {}) {
13
13
  const projectName = (0, git_1.getProjectName)();
14
14
  console.log(chalk_1.default.bold(`\nOpen issues for ${projectName}:\n`));
15
15
  const issues = (0, github_1.listIssues)();
@@ -44,7 +44,7 @@ async function selectCommand() {
44
44
  }
45
45
  console.log(chalk_1.default.cyan(`\nStarting ${issueNumbers.length} issue(s)...\n`));
46
46
  for (const issueNumber of issueNumbers) {
47
- await (0, solve_1.solveCommand)(issueNumber);
47
+ await (0, solve_1.solveCommand)(issueNumber, options);
48
48
  console.log();
49
49
  }
50
50
  }
@@ -1 +1,4 @@
1
- export declare function solveCommand(issueNumber: number): Promise<void>;
1
+ export interface SolveOptions {
2
+ autoClose?: boolean;
3
+ }
4
+ export declare function solveCommand(issueNumber: number, options?: SolveOptions): Promise<void>;
@@ -45,7 +45,7 @@ const child_process_1 = require("child_process");
45
45
  const github_1 = require("../utils/github");
46
46
  const git_1 = require("../utils/git");
47
47
  const helpers_1 = require("../utils/helpers");
48
- async function solveCommand(issueNumber) {
48
+ async function solveCommand(issueNumber, options = {}) {
49
49
  const spinner = (0, ora_1.default)(`Fetching issue #${issueNumber}...`).start();
50
50
  const issue = (0, github_1.getIssue)(issueNumber);
51
51
  if (!issue) {
@@ -125,6 +125,48 @@ Instructions:
125
125
  fs.writeFileSync(promptFile, prompt);
126
126
  // Create runner script
127
127
  const runnerScript = path.join(worktreePath, '.claude-runner.sh');
128
+ const autoClose = options.autoClose || false;
129
+ const autoCloseEnding = `
130
+ echo ""
131
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
132
+ echo "Claude session ended. Cleaning up worktree..."
133
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
134
+ echo ""
135
+
136
+ # Remove worktree (need to cd out first)
137
+ cd "${projectRoot}"
138
+ git worktree remove "${worktreePath}" --force 2>/dev/null
139
+
140
+ echo "✅ Worktree removed. Branch '${branchName}' preserved on remote."
141
+ echo " Fetch it in main repo: git fetch origin ${branchName}"
142
+ echo ""
143
+ echo "Terminal will close in 3 seconds..."
144
+ sleep 3
145
+
146
+ # Close the terminal window (macOS)
147
+ if [[ "$OSTYPE" == "darwin"* ]]; then
148
+ if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
149
+ osascript -e 'tell application "iTerm" to close (current window)' &
150
+ else
151
+ osascript -e 'tell application "Terminal" to close (first window whose selected tab contains (frontmost tab))' &
152
+ fi
153
+ fi
154
+ exit 0
155
+ `;
156
+ const interactiveEnding = `
157
+ echo ""
158
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
159
+ echo "Claude session ended. Terminal staying open."
160
+ echo "To clean up after merge: claude-issue clean ${issueNumber}"
161
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
162
+ echo ""
163
+
164
+ # Keep terminal open with minimal shell (skip rc files to avoid prompts)
165
+ exec bash --norc --noprofile
166
+ `;
167
+ const modeMessage = autoClose
168
+ ? 'Terminal will close after PR is created.'
169
+ : 'The terminal stays open for follow-up changes.';
128
170
  const runnerContent = `#!/bin/bash
129
171
  cd "${worktreePath}"
130
172
 
@@ -135,7 +177,7 @@ echo "🤖 Claude Code - Issue #${issueNumber}: ${issue.title}"
135
177
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
136
178
  echo ""
137
179
  echo "When Claude commits, a PR will be created automatically."
138
- echo "The terminal stays open for follow-up changes."
180
+ echo "${modeMessage}"
139
181
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
140
182
  echo ""
141
183
 
@@ -218,18 +260,8 @@ rm -f '${promptFile}'
218
260
  kill $WATCHER_PID 2>/dev/null
219
261
 
220
262
  # Final PR check after Claude exits
221
- create_pr > /dev/null
222
-
223
- echo ""
224
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
225
- echo "Claude session ended. Terminal staying open."
226
- echo "To clean up after merge: claude-issue clean ${issueNumber}"
227
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
228
- echo ""
229
-
230
- # Keep terminal open with minimal shell (skip rc files to avoid prompts)
231
- exec bash --norc --noprofile
232
- `;
263
+ create_pr
264
+ ${autoClose ? autoCloseEnding : interactiveEnding}`;
233
265
  fs.writeFileSync(runnerScript, runnerContent, { mode: 0o755 });
234
266
  console.log();
235
267
  console.log(chalk_1.default.cyan('🤖 Opening new terminal to run Claude Code...'));
package/dist/index.js CHANGED
@@ -52,17 +52,18 @@ program.hook('preAction', (thisCommand) => {
52
52
  // Default command - interactive selection
53
53
  program
54
54
  .argument('[issue]', 'Issue number to solve')
55
- .action(async (issue) => {
55
+ .option('-c, --auto-close', 'Close terminal and clean up worktree after PR is created')
56
+ .action(async (issue, options) => {
56
57
  if (issue) {
57
58
  const issueNumber = parseInt(issue, 10);
58
59
  if (isNaN(issueNumber)) {
59
60
  console.log(chalk_1.default.red(`❌ Invalid issue number: ${issue}`));
60
61
  process.exit(1);
61
62
  }
62
- await (0, solve_1.solveCommand)(issueNumber);
63
+ await (0, solve_1.solveCommand)(issueNumber, { autoClose: options.autoClose });
63
64
  }
64
65
  else {
65
- await (0, select_1.selectCommand)();
66
+ await (0, select_1.selectCommand)(options);
66
67
  }
67
68
  });
68
69
  // List command
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.38.0",
3
+ "version": "1.39.1",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {