claude-issue-solver 1.26.4 → 1.27.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.
@@ -48,12 +48,13 @@ const os = __importStar(require("os"));
48
48
  const child_process_1 = require("child_process");
49
49
  const github_1 = require("../utils/github");
50
50
  const git_1 = require("../utils/git");
51
- function closeWindowsWithPath(folderPath, issueNumber) {
51
+ function closeWindowsWithPath(folderPath, issueNumber, prNumber) {
52
52
  if (os.platform() !== 'darwin')
53
53
  return;
54
54
  const folderName = path.basename(folderPath);
55
55
  const issuePattern = `Issue #${issueNumber}`;
56
- // Try to close iTerm2 tabs/windows with this path or issue number
56
+ const reviewPattern = prNumber ? `Review PR #${prNumber}` : `issue-${issueNumber}-`;
57
+ // Try to close iTerm2 tabs/windows with this path, issue number, or review PR
57
58
  try {
58
59
  (0, child_process_1.execSync)(`osascript -e '
59
60
  tell application "iTerm"
@@ -61,7 +62,7 @@ function closeWindowsWithPath(folderPath, issueNumber) {
61
62
  repeat with t in tabs of w
62
63
  repeat with s in sessions of t
63
64
  set sessionName to name of s
64
- if sessionName contains "${folderName}" or sessionName contains "${issuePattern}" then
65
+ if sessionName contains "${folderName}" or sessionName contains "${issuePattern}" or sessionName contains "${reviewPattern}" then
65
66
  close s
66
67
  end if
67
68
  end repeat
@@ -73,13 +74,13 @@ function closeWindowsWithPath(folderPath, issueNumber) {
73
74
  catch {
74
75
  // iTerm not running or no matching sessions
75
76
  }
76
- // Try to close Terminal.app windows with this path or issue number
77
+ // Try to close Terminal.app windows with this path, issue number, or review PR
77
78
  try {
78
79
  (0, child_process_1.execSync)(`osascript -e '
79
80
  tell application "Terminal"
80
81
  repeat with w in windows
81
82
  set windowName to name of w
82
- if windowName contains "${folderName}" or windowName contains "${issuePattern}" then
83
+ if windowName contains "${folderName}" or windowName contains "${issuePattern}" or windowName contains "${reviewPattern}" then
83
84
  close w
84
85
  end if
85
86
  end repeat
@@ -40,16 +40,34 @@ function getIssueWorktrees() {
40
40
  }
41
41
  function getPRForBranch(branch) {
42
42
  try {
43
- const output = (0, child_process_1.execSync)(`gh pr list --head "${branch}" --json url --jq '.[0].url'`, {
43
+ const output = (0, child_process_1.execSync)(`gh pr list --head "${branch}" --json url,reviewDecision --jq '.[0]'`, {
44
44
  encoding: 'utf-8',
45
45
  stdio: ['pipe', 'pipe', 'pipe'],
46
46
  }).trim();
47
- return output || null;
47
+ if (!output || output === 'null')
48
+ return null;
49
+ const data = JSON.parse(output);
50
+ return {
51
+ url: data.url,
52
+ reviewDecision: data.reviewDecision,
53
+ };
48
54
  }
49
55
  catch {
50
56
  return null;
51
57
  }
52
58
  }
59
+ function getReviewStatusLabel(reviewDecision) {
60
+ switch (reviewDecision) {
61
+ case 'APPROVED':
62
+ return chalk_1.default.green('✓ Approved');
63
+ case 'CHANGES_REQUESTED':
64
+ return chalk_1.default.red('✗ Changes requested');
65
+ case 'REVIEW_REQUIRED':
66
+ return chalk_1.default.yellow('○ Review required');
67
+ default:
68
+ return chalk_1.default.dim('○ No reviews');
69
+ }
70
+ }
53
71
  async function goCommand(issueNumber) {
54
72
  const worktrees = getIssueWorktrees();
55
73
  if (worktrees.length === 0) {
@@ -72,12 +90,22 @@ async function goCommand(issueNumber) {
72
90
  selectedWorktree = found;
73
91
  }
74
92
  else {
75
- // Show selection
93
+ // Show selection with PR status
76
94
  console.log(chalk_1.default.bold('\n📂 Issue worktrees:\n'));
77
- const choices = worktrees.map((wt) => ({
78
- name: `#${wt.issueNumber}\t${wt.branch}`,
79
- value: wt,
95
+ // Fetch PR info for all worktrees
96
+ const worktreesWithPR = worktrees.map((wt) => ({
97
+ ...wt,
98
+ prInfo: getPRForBranch(wt.branch),
80
99
  }));
100
+ const choices = worktreesWithPR.map((wt) => {
101
+ const statusTag = wt.prInfo
102
+ ? getReviewStatusLabel(wt.prInfo.reviewDecision)
103
+ : chalk_1.default.dim('No PR');
104
+ return {
105
+ name: `#${wt.issueNumber}\t${wt.branch}\t${statusTag}`,
106
+ value: wt,
107
+ };
108
+ });
81
109
  choices.push({
82
110
  name: chalk_1.default.dim('Cancel'),
83
111
  value: null,
@@ -98,13 +126,14 @@ async function goCommand(issueNumber) {
98
126
  selectedWorktree = selected;
99
127
  }
100
128
  // Get PR info
101
- const prUrl = getPRForBranch(selectedWorktree.branch);
129
+ const prInfo = getPRForBranch(selectedWorktree.branch);
102
130
  console.log();
103
131
  console.log(chalk_1.default.bold(`📂 Issue #${selectedWorktree.issueNumber}`));
104
132
  console.log(chalk_1.default.dim(` Path: ${selectedWorktree.path}`));
105
133
  console.log(chalk_1.default.dim(` Branch: ${selectedWorktree.branch}`));
106
- if (prUrl) {
107
- console.log(chalk_1.default.cyan(` PR: ${prUrl}`));
134
+ if (prInfo) {
135
+ console.log(chalk_1.default.cyan(` PR: ${prInfo.url}`));
136
+ console.log(` Status: ${getReviewStatusLabel(prInfo.reviewDecision)}`);
108
137
  }
109
138
  console.log();
110
139
  // Ask what to do
@@ -113,7 +142,7 @@ async function goCommand(issueNumber) {
113
142
  { name: '📂 Open in Finder', value: 'finder' },
114
143
  { name: '💻 Print cd command', value: 'cd' },
115
144
  ];
116
- if (prUrl) {
145
+ if (prInfo) {
117
146
  actions.unshift({ name: '🔗 Open PR in browser', value: 'pr' });
118
147
  }
119
148
  actions.push({ name: chalk_1.default.dim('Cancel'), value: 'cancel' });
@@ -128,7 +157,7 @@ async function goCommand(issueNumber) {
128
157
  switch (action) {
129
158
  case 'pr':
130
159
  console.log(chalk_1.default.dim(`\nOpening PR in browser...`));
131
- (0, child_process_1.execSync)(`open "${prUrl}"`, { stdio: 'pipe' });
160
+ (0, child_process_1.execSync)(`open "${prInfo.url}"`, { stdio: 'pipe' });
132
161
  break;
133
162
  case 'vscode':
134
163
  console.log(chalk_1.default.dim(`\nOpening in VS Code...`));
@@ -45,11 +45,12 @@ const path = __importStar(require("path"));
45
45
  const os = __importStar(require("os"));
46
46
  const child_process_1 = require("child_process");
47
47
  const git_1 = require("../utils/git");
48
- function closeWindowsWithPath(folderPath, issueNumber) {
48
+ function closeWindowsWithPath(folderPath, issueNumber, prNumber) {
49
49
  if (os.platform() !== 'darwin')
50
50
  return;
51
51
  const folderName = path.basename(folderPath);
52
52
  const issuePattern = `Issue #${issueNumber}`;
53
+ const reviewPattern = prNumber ? `Review PR #${prNumber}` : `issue-${issueNumber}-`;
53
54
  // Try to close iTerm2 tabs/windows
54
55
  try {
55
56
  (0, child_process_1.execSync)(`osascript -e '
@@ -58,7 +59,7 @@ function closeWindowsWithPath(folderPath, issueNumber) {
58
59
  repeat with t in tabs of w
59
60
  repeat with s in sessions of t
60
61
  set sessionName to name of s
61
- if sessionName contains "${folderName}" or sessionName contains "${issuePattern}" then
62
+ if sessionName contains "${folderName}" or sessionName contains "${issuePattern}" or sessionName contains "${reviewPattern}" then
62
63
  close s
63
64
  end if
64
65
  end repeat
@@ -76,7 +77,7 @@ function closeWindowsWithPath(folderPath, issueNumber) {
76
77
  tell application "Terminal"
77
78
  repeat with w in windows
78
79
  set windowName to name of w
79
- if windowName contains "${folderName}" or windowName contains "${issuePattern}" then
80
+ if windowName contains "${folderName}" or windowName contains "${issuePattern}" or windowName contains "${reviewPattern}" then
80
81
  close w
81
82
  end if
82
83
  end repeat
@@ -131,14 +132,14 @@ function getOpenPRs(projectRoot) {
131
132
  return [];
132
133
  }
133
134
  }
134
- function cleanupWorktree(projectRoot, branchName, issueNumber) {
135
+ function cleanupWorktree(projectRoot, branchName, issueNumber, prNumber) {
135
136
  const projectName = (0, git_1.getProjectName)();
136
137
  const parentDir = path.dirname(projectRoot);
137
138
  const worktreePath = path.join(parentDir, `${projectName}-${branchName}`);
138
- // Close windows
139
+ // Close windows (including review terminals)
139
140
  if (issueNumber) {
140
141
  try {
141
- closeWindowsWithPath(worktreePath, issueNumber);
142
+ closeWindowsWithPath(worktreePath, issueNumber, prNumber);
142
143
  }
143
144
  catch {
144
145
  // Ignore
@@ -250,7 +251,7 @@ async function mergeCommand() {
250
251
  try {
251
252
  // Clean up worktree FIRST (before merge) to avoid branch deletion issues
252
253
  try {
253
- cleanupWorktree(projectRoot, pr.headRefName, pr.issueNumber?.toString() || null);
254
+ cleanupWorktree(projectRoot, pr.headRefName, pr.issueNumber?.toString() || null, pr.number.toString());
254
255
  }
255
256
  catch {
256
257
  // Worktree may not exist, continue with merge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-issue-solver",
3
- "version": "1.26.4",
3
+ "version": "1.27.1",
4
4
  "description": "Automatically solve GitHub issues using Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {