claude-issue-solver 1.30.2 ā 1.32.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/review.d.ts +6 -2
- package/dist/commands/review.js +58 -6
- package/dist/index.js +4 -3
- package/package.json +1 -1
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export declare function reviewCommand(issueNumber: number
|
|
2
|
-
|
|
1
|
+
export declare function reviewCommand(issueNumber: number, options?: {
|
|
2
|
+
merge?: boolean;
|
|
3
|
+
}): Promise<void>;
|
|
4
|
+
export declare function selectReviewCommand(options?: {
|
|
5
|
+
merge?: boolean;
|
|
6
|
+
}): Promise<void>;
|
package/dist/commands/review.js
CHANGED
|
@@ -48,7 +48,7 @@ const github_1 = require("../utils/github");
|
|
|
48
48
|
const git_1 = require("../utils/git");
|
|
49
49
|
const helpers_1 = require("../utils/helpers");
|
|
50
50
|
const config_1 = require("./config");
|
|
51
|
-
async function reviewCommand(issueNumber) {
|
|
51
|
+
async function reviewCommand(issueNumber, options = {}) {
|
|
52
52
|
const spinner = (0, ora_1.default)(`Fetching issue #${issueNumber}...`).start();
|
|
53
53
|
const issue = (0, github_1.getIssue)(issueNumber);
|
|
54
54
|
if (!issue) {
|
|
@@ -275,6 +275,7 @@ echo "${botNote}"
|
|
|
275
275
|
echo ""
|
|
276
276
|
echo "Claude will review the PR and post suggestions."
|
|
277
277
|
echo "You can commit suggestions directly on GitHub."
|
|
278
|
+
${options.merge ? 'echo "\\nš Auto-merge enabled: will merge if approved."' : ''}
|
|
278
279
|
echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
279
280
|
echo ""
|
|
280
281
|
|
|
@@ -288,7 +289,32 @@ echo ""
|
|
|
288
289
|
echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
289
290
|
echo "Review session ended."
|
|
290
291
|
echo ""
|
|
291
|
-
|
|
292
|
+
|
|
293
|
+
# Check if PR was approved
|
|
294
|
+
REVIEW_STATUS=$(gh pr view ${prNumber} --json reviewDecision --jq '.reviewDecision' 2>/dev/null)
|
|
295
|
+
|
|
296
|
+
if [ "$REVIEW_STATUS" = "APPROVED" ]; then
|
|
297
|
+
echo "ā
PR #${prNumber} is approved!"
|
|
298
|
+
echo ""
|
|
299
|
+
${options.merge ? ` echo "š¤ Auto-merging PR #${prNumber}..."
|
|
300
|
+
if gh pr merge ${prNumber} --squash --delete-branch; then
|
|
301
|
+
echo ""
|
|
302
|
+
echo "ā
PR merged successfully!"
|
|
303
|
+
echo ""
|
|
304
|
+
echo "Cleaning up worktree..."
|
|
305
|
+
cd "${projectRoot}"
|
|
306
|
+
git worktree remove "${worktreePath}" --force 2>/dev/null || rm -rf "${worktreePath}"
|
|
307
|
+
git worktree prune 2>/dev/null
|
|
308
|
+
git branch -D "${branchName}" 2>/dev/null
|
|
309
|
+
echo "ā
Cleanup complete!"
|
|
310
|
+
else
|
|
311
|
+
echo ""
|
|
312
|
+
echo "ā ļø Merge failed. You can try manually: gh pr merge ${prNumber} --squash"
|
|
313
|
+
fi` : ` echo "View PR: gh pr view ${prNumber} --web"
|
|
314
|
+
echo "To merge: cis merge"`}
|
|
315
|
+
else
|
|
316
|
+
echo "View PR: gh pr view ${prNumber} --web"
|
|
317
|
+
fi
|
|
292
318
|
echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
293
319
|
echo ""
|
|
294
320
|
|
|
@@ -341,7 +367,7 @@ function getOpenPRs(projectRoot) {
|
|
|
341
367
|
return [];
|
|
342
368
|
}
|
|
343
369
|
}
|
|
344
|
-
async function selectReviewCommand() {
|
|
370
|
+
async function selectReviewCommand(options = {}) {
|
|
345
371
|
const projectRoot = (0, git_1.getProjectRoot)();
|
|
346
372
|
const projectName = (0, git_1.getProjectName)();
|
|
347
373
|
console.log(chalk_1.default.bold(`\nOpen PRs for ${projectName}:\n`));
|
|
@@ -392,13 +418,13 @@ async function selectReviewCommand() {
|
|
|
392
418
|
console.log();
|
|
393
419
|
// Launch reviews in parallel
|
|
394
420
|
for (const pr of selected) {
|
|
395
|
-
await launchReviewForPR(pr, projectRoot, projectName);
|
|
421
|
+
await launchReviewForPR(pr, projectRoot, projectName, options);
|
|
396
422
|
}
|
|
397
423
|
console.log();
|
|
398
424
|
console.log(chalk_1.default.green(`ā
Started ${selected.length} review session(s)!`));
|
|
399
425
|
console.log(chalk_1.default.dim(' Each review is running in its own terminal window.'));
|
|
400
426
|
}
|
|
401
|
-
async function launchReviewForPR(pr, projectRoot, projectName) {
|
|
427
|
+
async function launchReviewForPR(pr, projectRoot, projectName, options = {}) {
|
|
402
428
|
const baseBranch = (0, git_1.getDefaultBranch)();
|
|
403
429
|
const branchName = pr.headRefName;
|
|
404
430
|
const worktreePath = path.join(path.dirname(projectRoot), `${projectName}-${branchName}`);
|
|
@@ -582,6 +608,7 @@ echo "${botNote}"
|
|
|
582
608
|
echo ""
|
|
583
609
|
echo "Claude will review the PR and post suggestions."
|
|
584
610
|
echo "You can commit suggestions directly on GitHub."
|
|
611
|
+
${options.merge ? 'echo "\\nš Auto-merge enabled: will merge if approved."' : ''}
|
|
585
612
|
echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
586
613
|
echo ""
|
|
587
614
|
|
|
@@ -595,7 +622,32 @@ echo ""
|
|
|
595
622
|
echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
596
623
|
echo "Review session ended."
|
|
597
624
|
echo ""
|
|
598
|
-
|
|
625
|
+
|
|
626
|
+
# Check if PR was approved
|
|
627
|
+
REVIEW_STATUS=$(gh pr view ${pr.number} --json reviewDecision --jq '.reviewDecision' 2>/dev/null)
|
|
628
|
+
|
|
629
|
+
if [ "$REVIEW_STATUS" = "APPROVED" ]; then
|
|
630
|
+
echo "ā
PR #${pr.number} is approved!"
|
|
631
|
+
echo ""
|
|
632
|
+
${options.merge ? ` echo "š¤ Auto-merging PR #${pr.number}..."
|
|
633
|
+
if gh pr merge ${pr.number} --squash --delete-branch; then
|
|
634
|
+
echo ""
|
|
635
|
+
echo "ā
PR merged successfully!"
|
|
636
|
+
echo ""
|
|
637
|
+
echo "Cleaning up worktree..."
|
|
638
|
+
cd "${projectRoot}"
|
|
639
|
+
git worktree remove "${worktreePath}" --force 2>/dev/null || rm -rf "${worktreePath}"
|
|
640
|
+
git worktree prune 2>/dev/null
|
|
641
|
+
git branch -D "${branchName}" 2>/dev/null
|
|
642
|
+
echo "ā
Cleanup complete!"
|
|
643
|
+
else
|
|
644
|
+
echo ""
|
|
645
|
+
echo "ā ļø Merge failed. You can try manually: gh pr merge ${pr.number} --squash"
|
|
646
|
+
fi` : ` echo "View PR: gh pr view ${pr.number} --web"
|
|
647
|
+
echo "To merge: cis merge"`}
|
|
648
|
+
else
|
|
649
|
+
echo "View PR: gh pr view ${pr.number} --web"
|
|
650
|
+
fi
|
|
599
651
|
echo "āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā"
|
|
600
652
|
echo ""
|
|
601
653
|
|
package/dist/index.js
CHANGED
|
@@ -157,17 +157,18 @@ program
|
|
|
157
157
|
program
|
|
158
158
|
.command('review [issue]')
|
|
159
159
|
.description('Review PRs with Claude and post suggestions')
|
|
160
|
-
.
|
|
160
|
+
.option('-m, --merge', 'Automatically merge PR if approved')
|
|
161
|
+
.action(async (issue, options) => {
|
|
161
162
|
if (issue) {
|
|
162
163
|
const issueNumber = parseInt(issue, 10);
|
|
163
164
|
if (isNaN(issueNumber)) {
|
|
164
165
|
console.log(chalk_1.default.red(`ā Invalid issue number: ${issue}`));
|
|
165
166
|
process.exit(1);
|
|
166
167
|
}
|
|
167
|
-
await (0, review_1.reviewCommand)(issueNumber);
|
|
168
|
+
await (0, review_1.reviewCommand)(issueNumber, { merge: options.merge });
|
|
168
169
|
}
|
|
169
170
|
else {
|
|
170
|
-
await (0, review_1.selectReviewCommand)();
|
|
171
|
+
await (0, review_1.selectReviewCommand)({ merge: options.merge });
|
|
171
172
|
}
|
|
172
173
|
});
|
|
173
174
|
// Config command - manage settings
|