claude-issue-solver 1.43.0 → 1.43.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.
- package/dist/utils/terminal.js +21 -40
- package/dist/utils/terminal.test.js +3 -6
- package/package.json +1 -1
package/dist/utils/terminal.js
CHANGED
|
@@ -79,58 +79,39 @@ function generateITermCloseScript(patterns) {
|
|
|
79
79
|
return `
|
|
80
80
|
tell application "iTerm"
|
|
81
81
|
set windowsToClose to {}
|
|
82
|
-
set sessionsToClose to {}
|
|
83
82
|
|
|
84
|
-
-- First pass: collect windows
|
|
83
|
+
-- First pass: collect windows to close (by name or by session working directory)
|
|
85
84
|
repeat with w in windows
|
|
86
85
|
try
|
|
87
86
|
set windowName to name of w
|
|
88
87
|
set windowId to id of w
|
|
89
|
-
|
|
90
|
-
end try
|
|
88
|
+
set shouldClose to false
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
repeat with s in sessions of t
|
|
95
|
-
try
|
|
96
|
-
set sessionName to name of s
|
|
97
|
-
set sessionPath to ""
|
|
98
|
-
try
|
|
99
|
-
set sessionPath to path of s
|
|
100
|
-
end try
|
|
101
|
-
set sessionId to unique id of s
|
|
102
|
-
-- Match by session name
|
|
103
|
-
${escapedPatterns.map((p) => `if sessionName contains "${p}" then set end of sessionsToClose to {windowId, sessionId}`).join('\n ')}
|
|
104
|
-
-- Match by working directory path (more reliable)
|
|
105
|
-
${escapedPatterns.map((p) => `if sessionPath contains "${p}" then set end of sessionsToClose to {windowId, sessionId}`).join('\n ')}
|
|
106
|
-
end try
|
|
107
|
-
end repeat
|
|
108
|
-
end repeat
|
|
109
|
-
end repeat
|
|
90
|
+
-- Match by window name
|
|
91
|
+
${escapedPatterns.map((p) => `if windowName contains "${p}" then set shouldClose to true`).join('\n ')}
|
|
110
92
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
close s
|
|
124
|
-
end if
|
|
125
|
-
end repeat
|
|
126
|
-
end repeat
|
|
127
|
-
end if
|
|
93
|
+
-- Match by session working directory path (more reliable)
|
|
94
|
+
if not shouldClose then
|
|
95
|
+
repeat with t in tabs of w
|
|
96
|
+
repeat with s in sessions of t
|
|
97
|
+
try
|
|
98
|
+
set sessionPath to ""
|
|
99
|
+
try
|
|
100
|
+
set sessionPath to path of s
|
|
101
|
+
end try
|
|
102
|
+
${escapedPatterns.map((p) => `if sessionPath contains "${p}" then set shouldClose to true`).join('\n ')}
|
|
103
|
+
end try
|
|
104
|
+
end repeat
|
|
128
105
|
end repeat
|
|
129
106
|
end if
|
|
107
|
+
|
|
108
|
+
if shouldClose and windowsToClose does not contain windowId then
|
|
109
|
+
set end of windowsToClose to windowId
|
|
110
|
+
end if
|
|
130
111
|
end try
|
|
131
112
|
end repeat
|
|
132
113
|
|
|
133
|
-
--
|
|
114
|
+
-- Second pass: close windows
|
|
134
115
|
repeat with targetWindowId in windowsToClose
|
|
135
116
|
try
|
|
136
117
|
repeat with w in windows
|
|
@@ -62,7 +62,6 @@ const terminal_1 = require("./terminal");
|
|
|
62
62
|
(0, vitest_1.expect)(script).toContain('project-issue-42');
|
|
63
63
|
(0, vitest_1.expect)(script).toContain('Issue #42');
|
|
64
64
|
(0, vitest_1.expect)(script).toContain('windowsToClose');
|
|
65
|
-
(0, vitest_1.expect)(script).toContain('sessionsToClose');
|
|
66
65
|
});
|
|
67
66
|
(0, vitest_1.it)('should escape double quotes in patterns', () => {
|
|
68
67
|
const patterns = ['Issue "quoted"'];
|
|
@@ -72,12 +71,10 @@ const terminal_1 = require("./terminal");
|
|
|
72
71
|
(0, vitest_1.it)('should use two-pass approach for closing', () => {
|
|
73
72
|
const patterns = ['test'];
|
|
74
73
|
const script = (0, terminal_1.generateITermCloseScript)(patterns);
|
|
75
|
-
// First pass collects
|
|
74
|
+
// First pass collects windows to close
|
|
76
75
|
(0, vitest_1.expect)(script).toContain('First pass: collect');
|
|
77
|
-
// Second pass closes
|
|
78
|
-
(0, vitest_1.expect)(script).toContain('Second pass: close
|
|
79
|
-
// Third pass closes windows
|
|
80
|
-
(0, vitest_1.expect)(script).toContain('Third pass: close entire windows');
|
|
76
|
+
// Second pass closes windows
|
|
77
|
+
(0, vitest_1.expect)(script).toContain('Second pass: close windows');
|
|
81
78
|
});
|
|
82
79
|
(0, vitest_1.it)('should match by session working directory path', () => {
|
|
83
80
|
const patterns = ['/Users/test/worktree'];
|