claude-issue-solver 1.38.0 → 1.39.0
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.
- package/dist/commands/select.d.ts +2 -1
- package/dist/commands/select.js +2 -2
- package/dist/commands/solve.d.ts +4 -1
- package/dist/commands/solve.js +37 -14
- package/dist/index.js +4 -3
- package/package.json +1 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { SolveOptions } from './solve';
|
|
2
|
+
export declare function selectCommand(options?: SolveOptions): Promise<void>;
|
package/dist/commands/select.js
CHANGED
|
@@ -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
|
}
|
package/dist/commands/solve.d.ts
CHANGED
package/dist/commands/solve.js
CHANGED
|
@@ -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,39 @@ 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
|
+
exit 0
|
|
146
|
+
`;
|
|
147
|
+
const interactiveEnding = `
|
|
148
|
+
echo ""
|
|
149
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
150
|
+
echo "Claude session ended. Terminal staying open."
|
|
151
|
+
echo "To clean up after merge: claude-issue clean ${issueNumber}"
|
|
152
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
153
|
+
echo ""
|
|
154
|
+
|
|
155
|
+
# Keep terminal open with minimal shell (skip rc files to avoid prompts)
|
|
156
|
+
exec bash --norc --noprofile
|
|
157
|
+
`;
|
|
158
|
+
const modeMessage = autoClose
|
|
159
|
+
? 'Terminal will close after PR is created.'
|
|
160
|
+
: 'The terminal stays open for follow-up changes.';
|
|
128
161
|
const runnerContent = `#!/bin/bash
|
|
129
162
|
cd "${worktreePath}"
|
|
130
163
|
|
|
@@ -135,7 +168,7 @@ echo "🤖 Claude Code - Issue #${issueNumber}: ${issue.title}"
|
|
|
135
168
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
136
169
|
echo ""
|
|
137
170
|
echo "When Claude commits, a PR will be created automatically."
|
|
138
|
-
echo "
|
|
171
|
+
echo "${modeMessage}"
|
|
139
172
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
140
173
|
echo ""
|
|
141
174
|
|
|
@@ -218,18 +251,8 @@ rm -f '${promptFile}'
|
|
|
218
251
|
kill $WATCHER_PID 2>/dev/null
|
|
219
252
|
|
|
220
253
|
# Final PR check after Claude exits
|
|
221
|
-
create_pr
|
|
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
|
-
`;
|
|
254
|
+
create_pr
|
|
255
|
+
${autoClose ? autoCloseEnding : interactiveEnding}`;
|
|
233
256
|
fs.writeFileSync(runnerScript, runnerContent, { mode: 0o755 });
|
|
234
257
|
console.log();
|
|
235
258
|
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
|
-
.
|
|
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
|