claude-issue-solver 1.16.0 ā 1.17.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/clean.js +10 -10
- package/dist/utils/github.d.ts +2 -0
- package/dist/utils/github.js +31 -0
- package/package.json +1 -1
package/dist/commands/clean.js
CHANGED
|
@@ -236,13 +236,13 @@ async function cleanAllCommand() {
|
|
|
236
236
|
console.log(chalk_1.default.yellow(` Run this command from the main project directory for best results.`));
|
|
237
237
|
console.log(chalk_1.default.dim(` cd ${projectRoot}\n`));
|
|
238
238
|
}
|
|
239
|
-
// Fetch status for all worktrees
|
|
239
|
+
// Fetch status for all worktrees in parallel
|
|
240
240
|
const statusSpinner = (0, ora_1.default)('Fetching issue and PR status...').start();
|
|
241
|
-
const worktreesWithStatus = worktrees.map((wt) => ({
|
|
241
|
+
const worktreesWithStatus = await Promise.all(worktrees.map(async (wt) => ({
|
|
242
242
|
...wt,
|
|
243
|
-
issueStatus: (0, github_1.
|
|
244
|
-
prStatus: wt.branch ? (0, github_1.
|
|
245
|
-
}));
|
|
243
|
+
issueStatus: await (0, github_1.getIssueStatusAsync)(parseInt(wt.issueNumber, 10)),
|
|
244
|
+
prStatus: wt.branch ? await (0, github_1.getPRForBranchAsync)(wt.branch) : null,
|
|
245
|
+
})));
|
|
246
246
|
statusSpinner.stop();
|
|
247
247
|
console.log(chalk_1.default.bold('\nš§¹ Found issue worktrees:\n'));
|
|
248
248
|
for (const wt of worktreesWithStatus) {
|
|
@@ -516,13 +516,13 @@ async function cleanMergedCommand() {
|
|
|
516
516
|
console.log(chalk_1.default.yellow(` Run this command from the main project directory for best results.`));
|
|
517
517
|
console.log(chalk_1.default.dim(` cd ${projectRoot}\n`));
|
|
518
518
|
}
|
|
519
|
-
// Fetch status for all worktrees
|
|
519
|
+
// Fetch status for all worktrees in parallel
|
|
520
520
|
const statusSpinner = (0, ora_1.default)('Fetching PR status...').start();
|
|
521
|
-
const worktreesWithStatus = worktrees.map((wt) => ({
|
|
521
|
+
const worktreesWithStatus = await Promise.all(worktrees.map(async (wt) => ({
|
|
522
522
|
...wt,
|
|
523
|
-
issueStatus: (0, github_1.
|
|
524
|
-
prStatus: wt.branch ? (0, github_1.
|
|
525
|
-
}));
|
|
523
|
+
issueStatus: await (0, github_1.getIssueStatusAsync)(parseInt(wt.issueNumber, 10)),
|
|
524
|
+
prStatus: wt.branch ? await (0, github_1.getPRForBranchAsync)(wt.branch) : null,
|
|
525
|
+
})));
|
|
526
526
|
statusSpinner.stop();
|
|
527
527
|
// Filter to only merged PRs
|
|
528
528
|
const mergedWorktrees = worktreesWithStatus.filter((wt) => wt.prStatus?.state === 'merged');
|
package/dist/utils/github.d.ts
CHANGED
|
@@ -25,7 +25,9 @@ export interface PRStatus {
|
|
|
25
25
|
url: string;
|
|
26
26
|
}
|
|
27
27
|
export declare function getIssueStatus(issueNumber: number): IssueStatus | null;
|
|
28
|
+
export declare function getIssueStatusAsync(issueNumber: number): Promise<IssueStatus | null>;
|
|
28
29
|
export declare function getPRForBranch(branch: string): PRStatus | null;
|
|
30
|
+
export declare function getPRForBranchAsync(branch: string): Promise<PRStatus | null>;
|
|
29
31
|
/**
|
|
30
32
|
* Get all open PRs with their head branch names (single API call)
|
|
31
33
|
* Returns a Set of issue numbers that have open PRs from issue-{number}-* branches
|
package/dist/utils/github.js
CHANGED
|
@@ -5,9 +5,13 @@ exports.getIssue = getIssue;
|
|
|
5
5
|
exports.listIssues = listIssues;
|
|
6
6
|
exports.createPullRequest = createPullRequest;
|
|
7
7
|
exports.getIssueStatus = getIssueStatus;
|
|
8
|
+
exports.getIssueStatusAsync = getIssueStatusAsync;
|
|
8
9
|
exports.getPRForBranch = getPRForBranch;
|
|
10
|
+
exports.getPRForBranchAsync = getPRForBranchAsync;
|
|
9
11
|
exports.getIssuesWithOpenPRs = getIssuesWithOpenPRs;
|
|
10
12
|
const child_process_1 = require("child_process");
|
|
13
|
+
const util_1 = require("util");
|
|
14
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
11
15
|
function createIssue(title, body, labels) {
|
|
12
16
|
try {
|
|
13
17
|
let cmd = `gh issue create --title "${title.replace(/"/g, '\\"')}"`;
|
|
@@ -71,6 +75,18 @@ function getIssueStatus(issueNumber) {
|
|
|
71
75
|
return null;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
78
|
+
async function getIssueStatusAsync(issueNumber) {
|
|
79
|
+
try {
|
|
80
|
+
const { stdout } = await execAsync(`gh issue view ${issueNumber} --json state`);
|
|
81
|
+
const data = JSON.parse(stdout);
|
|
82
|
+
return {
|
|
83
|
+
state: data.state.toLowerCase(),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
74
90
|
function getPRForBranch(branch) {
|
|
75
91
|
try {
|
|
76
92
|
const output = (0, child_process_1.execSync)(`gh pr list --head "${branch}" --state all --json state,url --limit 1`, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
@@ -86,6 +102,21 @@ function getPRForBranch(branch) {
|
|
|
86
102
|
return null;
|
|
87
103
|
}
|
|
88
104
|
}
|
|
105
|
+
async function getPRForBranchAsync(branch) {
|
|
106
|
+
try {
|
|
107
|
+
const { stdout } = await execAsync(`gh pr list --head "${branch}" --state all --json state,url --limit 1`);
|
|
108
|
+
const data = JSON.parse(stdout);
|
|
109
|
+
if (data.length === 0)
|
|
110
|
+
return null;
|
|
111
|
+
return {
|
|
112
|
+
state: data[0].state.toLowerCase(),
|
|
113
|
+
url: data[0].url,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
89
120
|
/**
|
|
90
121
|
* Get all open PRs with their head branch names (single API call)
|
|
91
122
|
* Returns a Set of issue numbers that have open PRs from issue-{number}-* branches
|