claude-issue-solver 1.7.1 → 1.7.2
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 +65 -35
- package/package.json +1 -1
package/dist/commands/clean.js
CHANGED
|
@@ -89,16 +89,31 @@ function closeWindowsWithPath(folderPath, issueNumber) {
|
|
|
89
89
|
// Terminal not running or no matching windows
|
|
90
90
|
}
|
|
91
91
|
// Try to close VS Code windows with this path
|
|
92
|
+
// Method 1: AppleScript to close windows matching the folder name
|
|
92
93
|
try {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
(0, child_process_1.execSync)(`osascript -e '
|
|
95
|
+
tell application "System Events"
|
|
96
|
+
if exists process "Code" then
|
|
97
|
+
tell process "Code"
|
|
98
|
+
set windowList to every window
|
|
99
|
+
repeat with w in windowList
|
|
100
|
+
try
|
|
101
|
+
set windowName to name of w
|
|
102
|
+
if windowName contains "${folderName}" then
|
|
103
|
+
perform action "AXPress" of (first button of w whose subrole is "AXCloseButton")
|
|
104
|
+
delay 0.2
|
|
105
|
+
end if
|
|
106
|
+
end try
|
|
107
|
+
end repeat
|
|
108
|
+
end tell
|
|
109
|
+
end if
|
|
110
|
+
end tell
|
|
111
|
+
'`, { stdio: 'pipe', timeout: 5000 });
|
|
98
112
|
}
|
|
99
113
|
catch {
|
|
100
|
-
// VS Code
|
|
114
|
+
// VS Code not running or no matching windows
|
|
101
115
|
}
|
|
116
|
+
// Method 2: Also try matching the issue number in window title
|
|
102
117
|
try {
|
|
103
118
|
(0, child_process_1.execSync)(`osascript -e '
|
|
104
119
|
tell application "System Events"
|
|
@@ -106,15 +121,18 @@ function closeWindowsWithPath(folderPath, issueNumber) {
|
|
|
106
121
|
tell process "Code"
|
|
107
122
|
set windowList to every window
|
|
108
123
|
repeat with w in windowList
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
124
|
+
try
|
|
125
|
+
set windowName to name of w
|
|
126
|
+
if windowName contains "${issuePattern}" then
|
|
127
|
+
perform action "AXPress" of (first button of w whose subrole is "AXCloseButton")
|
|
128
|
+
delay 0.2
|
|
129
|
+
end if
|
|
130
|
+
end try
|
|
113
131
|
end repeat
|
|
114
132
|
end tell
|
|
115
133
|
end if
|
|
116
134
|
end tell
|
|
117
|
-
'`, { stdio: 'pipe' });
|
|
135
|
+
'`, { stdio: 'pipe', timeout: 5000 });
|
|
118
136
|
}
|
|
119
137
|
catch {
|
|
120
138
|
// VS Code not running or no matching windows
|
|
@@ -254,40 +272,46 @@ async function cleanAllCommand() {
|
|
|
254
272
|
}
|
|
255
273
|
// Remove worktree/folder
|
|
256
274
|
const isOrphaned = !wt.branch;
|
|
275
|
+
// Try git worktree remove first (only if not orphaned)
|
|
276
|
+
if (!isOrphaned && fs.existsSync(wt.path)) {
|
|
277
|
+
try {
|
|
278
|
+
(0, child_process_1.execSync)(`git worktree remove "${wt.path}" --force`, {
|
|
279
|
+
cwd: projectRoot,
|
|
280
|
+
stdio: 'pipe',
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
// Ignore - we'll force delete below
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
// Always try to force delete the folder
|
|
257
288
|
if (fs.existsSync(wt.path)) {
|
|
258
|
-
// Try
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
(0, child_process_1.execSync)(`git worktree remove "${wt.path}" --force`, {
|
|
262
|
-
cwd: projectRoot,
|
|
263
|
-
stdio: 'pipe',
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
catch {
|
|
267
|
-
// Ignore - we'll force delete below if needed
|
|
268
|
-
}
|
|
289
|
+
// Try multiple deletion methods
|
|
290
|
+
try {
|
|
291
|
+
(0, child_process_1.execSync)(`/bin/rm -rf "${wt.path}"`, { stdio: 'pipe', timeout: 10000 });
|
|
269
292
|
}
|
|
270
|
-
|
|
271
|
-
|
|
293
|
+
catch {
|
|
294
|
+
// Fallback 1: try with shell
|
|
272
295
|
try {
|
|
273
|
-
(0, child_process_1.execSync)(
|
|
296
|
+
(0, child_process_1.execSync)(`rm -rf "${wt.path}"`, { shell: '/bin/bash', stdio: 'pipe', timeout: 10000 });
|
|
274
297
|
}
|
|
275
298
|
catch {
|
|
299
|
+
// Fallback 2: Node.js rmSync
|
|
276
300
|
try {
|
|
277
|
-
fs.rmSync(wt.path, { recursive: true, force: true, maxRetries:
|
|
301
|
+
fs.rmSync(wt.path, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
|
278
302
|
}
|
|
279
303
|
catch {
|
|
280
|
-
//
|
|
304
|
+
// Will report failure below
|
|
281
305
|
}
|
|
282
306
|
}
|
|
283
307
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
308
|
+
}
|
|
309
|
+
// Prune git worktrees
|
|
310
|
+
try {
|
|
311
|
+
(0, child_process_1.execSync)('git worktree prune', { cwd: projectRoot, stdio: 'pipe' });
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// Ignore
|
|
291
315
|
}
|
|
292
316
|
// Delete branch (if we have one)
|
|
293
317
|
if (wt.branch) {
|
|
@@ -301,7 +325,13 @@ async function cleanAllCommand() {
|
|
|
301
325
|
// Branch may already be deleted
|
|
302
326
|
}
|
|
303
327
|
}
|
|
304
|
-
|
|
328
|
+
// Check if cleanup was successful
|
|
329
|
+
if (fs.existsSync(wt.path)) {
|
|
330
|
+
spinner.warn(`Cleaned issue #${wt.issueNumber} (folder may remain: ${wt.path})`);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
spinner.succeed(`Cleaned issue #${wt.issueNumber}`);
|
|
334
|
+
}
|
|
305
335
|
}
|
|
306
336
|
catch (error) {
|
|
307
337
|
spinner.fail(`Failed to clean issue #${wt.issueNumber}: ${error}`);
|