claude-issue-solver 1.28.1 â 1.30.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 +1 -3
- package/dist/commands/select.js +3 -3
- package/dist/commands/solve.d.ts +1 -3
- package/dist/commands/solve.js +3 -152
- package/dist/index.js +3 -4
- package/package.json +1 -1
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() {
|
|
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)();
|
|
@@ -42,9 +42,9 @@ async function selectCommand(options = {}) {
|
|
|
42
42
|
console.log(chalk_1.default.dim('No issues selected.'));
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
console.log(chalk_1.default.cyan(`\nStarting ${issueNumbers.length} issue(s)
|
|
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);
|
|
48
48
|
console.log();
|
|
49
49
|
}
|
|
50
50
|
}
|
package/dist/commands/solve.d.ts
CHANGED
package/dist/commands/solve.js
CHANGED
|
@@ -45,8 +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
|
-
|
|
49
|
-
async function solveCommand(issueNumber, options = {}) {
|
|
48
|
+
async function solveCommand(issueNumber) {
|
|
50
49
|
const spinner = (0, ora_1.default)(`Fetching issue #${issueNumber}...`).start();
|
|
51
50
|
const issue = (0, github_1.getIssue)(issueNumber);
|
|
52
51
|
if (!issue) {
|
|
@@ -123,9 +122,6 @@ Instructions:
|
|
|
123
122
|
// Write prompt to a file to avoid shell escaping issues with backticks, <>, etc.
|
|
124
123
|
const promptFile = path.join(worktreePath, '.claude-prompt.txt');
|
|
125
124
|
fs.writeFileSync(promptFile, prompt);
|
|
126
|
-
// Get bot token for auto mode
|
|
127
|
-
const botToken = (0, config_1.getBotToken)();
|
|
128
|
-
const autoMode = options.auto || false;
|
|
129
125
|
// Create runner script
|
|
130
126
|
const runnerScript = path.join(worktreePath, '.claude-runner.sh');
|
|
131
127
|
const runnerContent = `#!/bin/bash
|
|
@@ -137,16 +133,11 @@ echo -ne "\\033]0;Issue #${issueNumber}: ${issue.title.replace(/"/g, '\\"').slic
|
|
|
137
133
|
echo "đ¤ Claude Code - Issue #${issueNumber}: ${issue.title}"
|
|
138
134
|
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
139
135
|
echo ""
|
|
140
|
-
|
|
136
|
+
echo "When Claude commits, a PR will be created automatically."
|
|
141
137
|
echo "The terminal stays open for follow-up changes."
|
|
142
138
|
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
143
139
|
echo ""
|
|
144
140
|
|
|
145
|
-
${botToken ? `# Bot token for reviews (only used during review, not PR creation)
|
|
146
|
-
export BOT_TOKEN="${botToken}"
|
|
147
|
-
# DO NOT set GH_TOKEN here - PR should be created as you, not the bot
|
|
148
|
-
` : ''}
|
|
149
|
-
|
|
150
141
|
# Function to create PR
|
|
151
142
|
create_pr() {
|
|
152
143
|
COMMITS=$(git log origin/${baseBranch}..HEAD --oneline 2>/dev/null | wc -l | tr -d ' ')
|
|
@@ -191,7 +182,6 @@ $COMMIT_LIST
|
|
|
191
182
|
# Update terminal title with PR info
|
|
192
183
|
PR_NUM=$(echo "$PR_URL" | grep -oE '[0-9]+$')
|
|
193
184
|
echo -ne "\\033]0;Issue #${issueNumber} â PR #\$PR_NUM\\007"
|
|
194
|
-
echo "$PR_NUM"
|
|
195
185
|
fi
|
|
196
186
|
else
|
|
197
187
|
# PR exists, just push new commits
|
|
@@ -201,21 +191,10 @@ $COMMIT_LIST
|
|
|
201
191
|
echo "đ¤ Pushed new commits to PR #$EXISTING_PR"
|
|
202
192
|
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
203
193
|
echo ""
|
|
204
|
-
echo "$EXISTING_PR"
|
|
205
194
|
fi
|
|
206
195
|
fi
|
|
207
196
|
}
|
|
208
197
|
|
|
209
|
-
# Function to get PR number
|
|
210
|
-
get_pr_number() {
|
|
211
|
-
gh pr list --head "${branchName}" --json number --jq '.[0].number' 2>/dev/null
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
# Function to get PR review status
|
|
215
|
-
get_review_status() {
|
|
216
|
-
gh pr view "$1" --json reviewDecision --jq '.reviewDecision' 2>/dev/null
|
|
217
|
-
}
|
|
218
|
-
|
|
219
198
|
# Watch for new commits in background and create PR
|
|
220
199
|
LAST_COMMIT=""
|
|
221
200
|
while true; do
|
|
@@ -228,7 +207,7 @@ while true; do
|
|
|
228
207
|
done &
|
|
229
208
|
WATCHER_PID=$!
|
|
230
209
|
|
|
231
|
-
# Run Claude interactively
|
|
210
|
+
# Run Claude interactively
|
|
232
211
|
claude --dangerously-skip-permissions "$(cat '${promptFile}')"
|
|
233
212
|
|
|
234
213
|
# Clean up prompt file
|
|
@@ -240,134 +219,6 @@ kill $WATCHER_PID 2>/dev/null
|
|
|
240
219
|
# Final PR check after Claude exits
|
|
241
220
|
create_pr > /dev/null
|
|
242
221
|
|
|
243
|
-
${autoMode ? `
|
|
244
|
-
# AUTO MODE: Review loop
|
|
245
|
-
MAX_ITERATIONS=3
|
|
246
|
-
ITERATION=0
|
|
247
|
-
|
|
248
|
-
while [ $ITERATION -lt $MAX_ITERATIONS ]; do
|
|
249
|
-
ITERATION=$((ITERATION + 1))
|
|
250
|
-
|
|
251
|
-
# Wait for PR to be created
|
|
252
|
-
sleep 2
|
|
253
|
-
PR_NUM=$(get_pr_number)
|
|
254
|
-
|
|
255
|
-
if [ -z "$PR_NUM" ]; then
|
|
256
|
-
echo ""
|
|
257
|
-
echo "â ī¸ No PR found, skipping auto-review"
|
|
258
|
-
break
|
|
259
|
-
fi
|
|
260
|
-
|
|
261
|
-
echo ""
|
|
262
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
263
|
-
echo "đ AUTO-REVIEW: Iteration $ITERATION of $MAX_ITERATIONS"
|
|
264
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
265
|
-
echo ""
|
|
266
|
-
|
|
267
|
-
# Get PR diff for review
|
|
268
|
-
PR_DIFF=$(gh pr diff $PR_NUM 2>/dev/null | head -500)
|
|
269
|
-
|
|
270
|
-
# Create review prompt
|
|
271
|
-
REVIEW_PROMPT="You are reviewing PR #$PR_NUM for issue #${issueNumber}: ${issue.title.replace(/"/g, '\\"')}
|
|
272
|
-
|
|
273
|
-
## Issue Description
|
|
274
|
-
${issue.body.replace(/"/g, '\\"').replace(/\$/g, '\\$').replace(/\`/g, '\\`')}
|
|
275
|
-
|
|
276
|
-
## Your Task
|
|
277
|
-
Review the code changes in this PR. Look for:
|
|
278
|
-
1. Bugs and logic errors
|
|
279
|
-
2. Security vulnerabilities
|
|
280
|
-
3. Missing error handling
|
|
281
|
-
4. Code quality issues
|
|
282
|
-
5. Performance problems
|
|
283
|
-
|
|
284
|
-
## How to Leave Feedback
|
|
285
|
-
${botToken ? `Use GH_TOKEN=\\$BOT_TOKEN prefix for all gh commands.
|
|
286
|
-
|
|
287
|
-
If the code looks good:
|
|
288
|
-
\\\`\\\`\\\`bash
|
|
289
|
-
GH_TOKEN=\\$BOT_TOKEN gh pr review $PR_NUM --approve --body \\"LGTM! Code looks good.\\"
|
|
290
|
-
\\\`\\\`\\\`
|
|
291
|
-
|
|
292
|
-
If changes are needed:
|
|
293
|
-
\\\`\\\`\\\`bash
|
|
294
|
-
GH_TOKEN=\\$BOT_TOKEN gh pr review $PR_NUM --request-changes --body \\"<your feedback>\\"
|
|
295
|
-
\\\`\\\`\\\`
|
|
296
|
-
` : `If the code looks good:
|
|
297
|
-
\\\`\\\`\\\`bash
|
|
298
|
-
gh pr review $PR_NUM --approve --body \\"LGTM! Code looks good.\\"
|
|
299
|
-
\\\`\\\`\\\`
|
|
300
|
-
|
|
301
|
-
If changes are needed:
|
|
302
|
-
\\\`\\\`\\\`bash
|
|
303
|
-
gh pr review $PR_NUM --request-changes --body \\"<your feedback>\\"
|
|
304
|
-
\\\`\\\`\\\`
|
|
305
|
-
`}
|
|
306
|
-
|
|
307
|
-
## PR Diff (first 500 lines)
|
|
308
|
-
\\\`\\\`\\\`diff
|
|
309
|
-
$PR_DIFF
|
|
310
|
-
\\\`\\\`\\\`
|
|
311
|
-
|
|
312
|
-
Review the code and either approve or request changes."
|
|
313
|
-
|
|
314
|
-
# Run Claude for review
|
|
315
|
-
claude --dangerously-skip-permissions "$REVIEW_PROMPT"
|
|
316
|
-
|
|
317
|
-
# Check review status
|
|
318
|
-
sleep 2
|
|
319
|
-
REVIEW_STATUS=$(get_review_status $PR_NUM)
|
|
320
|
-
|
|
321
|
-
echo ""
|
|
322
|
-
echo "đ Review status: $REVIEW_STATUS"
|
|
323
|
-
|
|
324
|
-
if [ "$REVIEW_STATUS" = "APPROVED" ]; then
|
|
325
|
-
echo ""
|
|
326
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
327
|
-
echo "â
PR APPROVED! Ready to merge."
|
|
328
|
-
echo " Run: cis merge"
|
|
329
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
330
|
-
break
|
|
331
|
-
elif [ "$REVIEW_STATUS" = "CHANGES_REQUESTED" ]; then
|
|
332
|
-
if [ $ITERATION -lt $MAX_ITERATIONS ]; then
|
|
333
|
-
echo ""
|
|
334
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
335
|
-
echo "đ§ Changes requested. Claude will fix them..."
|
|
336
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
337
|
-
echo ""
|
|
338
|
-
|
|
339
|
-
# Get the review comments
|
|
340
|
-
REVIEW_COMMENTS=$(gh pr view $PR_NUM --json reviews --jq '.reviews[-1].body' 2>/dev/null)
|
|
341
|
-
|
|
342
|
-
FIX_PROMPT="The code review requested changes. Please fix them:
|
|
343
|
-
|
|
344
|
-
## Review Feedback
|
|
345
|
-
$REVIEW_COMMENTS
|
|
346
|
-
|
|
347
|
-
Please address the feedback above, make the necessary changes, and commit them."
|
|
348
|
-
|
|
349
|
-
# Run Claude to fix
|
|
350
|
-
claude --dangerously-skip-permissions "$FIX_PROMPT"
|
|
351
|
-
|
|
352
|
-
# Push changes
|
|
353
|
-
git push origin "${branchName}" 2>/dev/null
|
|
354
|
-
sleep 2
|
|
355
|
-
else
|
|
356
|
-
echo ""
|
|
357
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
358
|
-
echo "â ī¸ Max iterations reached. Manual review needed."
|
|
359
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
360
|
-
fi
|
|
361
|
-
else
|
|
362
|
-
echo ""
|
|
363
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
364
|
-
echo "âšī¸ Review status: $REVIEW_STATUS"
|
|
365
|
-
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
366
|
-
break
|
|
367
|
-
fi
|
|
368
|
-
done
|
|
369
|
-
` : ''}
|
|
370
|
-
|
|
371
222
|
echo ""
|
|
372
223
|
echo "ââââââââââââââââââââââââââââââââââââââââââââââââ"
|
|
373
224
|
echo "Claude session ended. Terminal staying open."
|
package/dist/index.js
CHANGED
|
@@ -52,18 +52,17 @@ program.hook('preAction', (thisCommand) => {
|
|
|
52
52
|
// Default command - interactive selection
|
|
53
53
|
program
|
|
54
54
|
.argument('[issue]', 'Issue number to solve')
|
|
55
|
-
.
|
|
56
|
-
.action(async (issue, options) => {
|
|
55
|
+
.action(async (issue) => {
|
|
57
56
|
if (issue) {
|
|
58
57
|
const issueNumber = parseInt(issue, 10);
|
|
59
58
|
if (isNaN(issueNumber)) {
|
|
60
59
|
console.log(chalk_1.default.red(`â Invalid issue number: ${issue}`));
|
|
61
60
|
process.exit(1);
|
|
62
61
|
}
|
|
63
|
-
await (0, solve_1.solveCommand)(issueNumber
|
|
62
|
+
await (0, solve_1.solveCommand)(issueNumber);
|
|
64
63
|
}
|
|
65
64
|
else {
|
|
66
|
-
await (0, select_1.selectCommand)(
|
|
65
|
+
await (0, select_1.selectCommand)();
|
|
67
66
|
}
|
|
68
67
|
});
|
|
69
68
|
// List command
|