claude-issue-solver 1.6.3 → 1.6.4
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 +44 -13
- package/package.json +1 -1
package/dist/commands/clean.js
CHANGED
|
@@ -46,11 +46,12 @@ const path = __importStar(require("path"));
|
|
|
46
46
|
const os = __importStar(require("os"));
|
|
47
47
|
const child_process_1 = require("child_process");
|
|
48
48
|
const git_1 = require("../utils/git");
|
|
49
|
-
function closeWindowsWithPath(folderPath) {
|
|
49
|
+
function closeWindowsWithPath(folderPath, issueNumber) {
|
|
50
50
|
if (os.platform() !== 'darwin')
|
|
51
51
|
return;
|
|
52
52
|
const folderName = path.basename(folderPath);
|
|
53
|
-
|
|
53
|
+
const issuePattern = `Issue #${issueNumber}`;
|
|
54
|
+
// Try to close iTerm2 tabs/windows with this path or issue number
|
|
54
55
|
try {
|
|
55
56
|
(0, child_process_1.execSync)(`osascript -e '
|
|
56
57
|
tell application "iTerm"
|
|
@@ -58,7 +59,7 @@ function closeWindowsWithPath(folderPath) {
|
|
|
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}" then
|
|
62
|
+
if sessionName contains "${folderName}" or sessionName contains "${issuePattern}" then
|
|
62
63
|
close s
|
|
63
64
|
end if
|
|
64
65
|
end repeat
|
|
@@ -70,12 +71,13 @@ function closeWindowsWithPath(folderPath) {
|
|
|
70
71
|
catch {
|
|
71
72
|
// iTerm not running or no matching sessions
|
|
72
73
|
}
|
|
73
|
-
// Try to close Terminal.app windows with this path
|
|
74
|
+
// Try to close Terminal.app windows with this path or issue number
|
|
74
75
|
try {
|
|
75
76
|
(0, child_process_1.execSync)(`osascript -e '
|
|
76
77
|
tell application "Terminal"
|
|
77
78
|
repeat with w in windows
|
|
78
|
-
|
|
79
|
+
set windowName to name of w
|
|
80
|
+
if windowName contains "${folderName}" or windowName contains "${issuePattern}" then
|
|
79
81
|
close w
|
|
80
82
|
end if
|
|
81
83
|
end repeat
|
|
@@ -86,6 +88,16 @@ function closeWindowsWithPath(folderPath) {
|
|
|
86
88
|
// Terminal not running or no matching windows
|
|
87
89
|
}
|
|
88
90
|
// Try to close VS Code windows with this path
|
|
91
|
+
try {
|
|
92
|
+
// Use VS Code CLI to close the folder if it's open
|
|
93
|
+
(0, child_process_1.execSync)(`code --folder-uri "file://${folderPath}" --command "workbench.action.closeWindow"`, {
|
|
94
|
+
stdio: 'pipe',
|
|
95
|
+
timeout: 3000
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// VS Code CLI method failed, try AppleScript
|
|
100
|
+
}
|
|
89
101
|
try {
|
|
90
102
|
(0, child_process_1.execSync)(`osascript -e '
|
|
91
103
|
tell application "System Events"
|
|
@@ -169,7 +181,9 @@ async function cleanAllCommand() {
|
|
|
169
181
|
try {
|
|
170
182
|
// Close terminal and VS Code windows for this worktree
|
|
171
183
|
try {
|
|
172
|
-
closeWindowsWithPath(wt.path);
|
|
184
|
+
closeWindowsWithPath(wt.path, wt.issueNumber);
|
|
185
|
+
// Give windows time to close before removing folder
|
|
186
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
173
187
|
}
|
|
174
188
|
catch {
|
|
175
189
|
// Ignore errors closing windows
|
|
@@ -183,8 +197,14 @@ async function cleanAllCommand() {
|
|
|
183
197
|
});
|
|
184
198
|
}
|
|
185
199
|
catch {
|
|
186
|
-
// If git worktree remove fails, try removing directory manually
|
|
187
|
-
|
|
200
|
+
// If git worktree remove fails, try removing directory manually with rm -rf
|
|
201
|
+
// This handles locked files better than fs.rmSync
|
|
202
|
+
try {
|
|
203
|
+
(0, child_process_1.execSync)(`rm -rf "${wt.path}"`, { stdio: 'pipe' });
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
fs.rmSync(wt.path, { recursive: true, force: true });
|
|
207
|
+
}
|
|
188
208
|
(0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
|
|
189
209
|
}
|
|
190
210
|
}
|
|
@@ -268,11 +288,15 @@ async function cleanCommand(issueNumber) {
|
|
|
268
288
|
return;
|
|
269
289
|
}
|
|
270
290
|
// Close terminal and VS Code windows for this worktree
|
|
291
|
+
const windowSpinner = (0, ora_1.default)('Closing terminal and VS Code windows...').start();
|
|
271
292
|
try {
|
|
272
|
-
closeWindowsWithPath(worktreePath);
|
|
293
|
+
closeWindowsWithPath(worktreePath, String(issueNumber));
|
|
294
|
+
// Give windows time to close before removing folder
|
|
295
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
296
|
+
windowSpinner.succeed('Windows closed');
|
|
273
297
|
}
|
|
274
298
|
catch {
|
|
275
|
-
|
|
299
|
+
windowSpinner.warn('Could not close some windows');
|
|
276
300
|
}
|
|
277
301
|
// Remove worktree
|
|
278
302
|
if (fs.existsSync(worktreePath)) {
|
|
@@ -285,14 +309,21 @@ async function cleanCommand(issueNumber) {
|
|
|
285
309
|
worktreeSpinner.succeed('Worktree removed');
|
|
286
310
|
}
|
|
287
311
|
catch {
|
|
288
|
-
// If git worktree remove fails, try removing directory manually
|
|
312
|
+
// If git worktree remove fails, try removing directory manually with rm -rf
|
|
289
313
|
try {
|
|
290
|
-
|
|
314
|
+
(0, child_process_1.execSync)(`rm -rf "${worktreePath}"`, { stdio: 'pipe' });
|
|
291
315
|
(0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
|
|
292
316
|
worktreeSpinner.succeed('Worktree removed (manually)');
|
|
293
317
|
}
|
|
294
318
|
catch {
|
|
295
|
-
|
|
319
|
+
try {
|
|
320
|
+
fs.rmSync(worktreePath, { recursive: true, force: true });
|
|
321
|
+
(0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
|
|
322
|
+
worktreeSpinner.succeed('Worktree removed (manually)');
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
worktreeSpinner.warn('Could not remove worktree directory');
|
|
326
|
+
}
|
|
296
327
|
}
|
|
297
328
|
}
|
|
298
329
|
}
|