ccmanager 2.9.1 → 2.9.3
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,6 +48,11 @@ export class ClaudeStateDetector extends BaseStateDetector {
|
|
|
48
48
|
content.includes('│ Would you like')) {
|
|
49
49
|
return 'waiting_input';
|
|
50
50
|
}
|
|
51
|
+
// Check for "Do you want" or "Would you like" pattern with options
|
|
52
|
+
// Handles both simple ("Do you want...\nYes") and complex (numbered options) formats
|
|
53
|
+
if (/(?:do you want|would you like).+\n+[\s\S]*?(?:yes|❯)/.test(lowerContent)) {
|
|
54
|
+
return 'waiting_input';
|
|
55
|
+
}
|
|
51
56
|
// Check for busy state
|
|
52
57
|
if (lowerContent.includes('esc to interrupt')) {
|
|
53
58
|
return 'busy';
|
|
@@ -153,6 +153,91 @@ describe('ClaudeStateDetector', () => {
|
|
|
153
153
|
expect(state).toBe('busy');
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
+
it('should detect waiting_input when "Do you want" with options prompt is present', () => {
|
|
157
|
+
// Arrange
|
|
158
|
+
terminal = createMockTerminal([
|
|
159
|
+
'Some previous output',
|
|
160
|
+
'Do you want to make this edit to test.txt?',
|
|
161
|
+
'❯ 1. Yes',
|
|
162
|
+
'2. Yes, allow all edits during this session (shift+tab)',
|
|
163
|
+
'3. No, and tell Claude what to do differently (esc)',
|
|
164
|
+
]);
|
|
165
|
+
// Act
|
|
166
|
+
const state = detector.detectState(terminal, 'idle');
|
|
167
|
+
// Assert
|
|
168
|
+
expect(state).toBe('waiting_input');
|
|
169
|
+
});
|
|
170
|
+
it('should detect waiting_input when "Do you want" with options prompt is present (case insensitive)', () => {
|
|
171
|
+
// Arrange
|
|
172
|
+
terminal = createMockTerminal([
|
|
173
|
+
'Some output',
|
|
174
|
+
'DO YOU WANT to make this edit?',
|
|
175
|
+
'❯ 1. YES',
|
|
176
|
+
'2. NO',
|
|
177
|
+
]);
|
|
178
|
+
// Act
|
|
179
|
+
const state = detector.detectState(terminal, 'idle');
|
|
180
|
+
// Assert
|
|
181
|
+
expect(state).toBe('waiting_input');
|
|
182
|
+
});
|
|
183
|
+
it('should prioritize "Do you want" with options over busy state', () => {
|
|
184
|
+
// Arrange
|
|
185
|
+
terminal = createMockTerminal([
|
|
186
|
+
'Press ESC to interrupt',
|
|
187
|
+
'Do you want to continue?',
|
|
188
|
+
'❯ 1. Yes',
|
|
189
|
+
'2. No',
|
|
190
|
+
]);
|
|
191
|
+
// Act
|
|
192
|
+
const state = detector.detectState(terminal, 'idle');
|
|
193
|
+
// Assert
|
|
194
|
+
expect(state).toBe('waiting_input'); // waiting_input should take precedence
|
|
195
|
+
});
|
|
196
|
+
it('should detect waiting_input with "Would you like" and multiple numbered options', () => {
|
|
197
|
+
// Arrange
|
|
198
|
+
terminal = createMockTerminal([
|
|
199
|
+
'Some previous output',
|
|
200
|
+
'Would you like to proceed?',
|
|
201
|
+
'',
|
|
202
|
+
'❯ 1. Yes, and auto-accept edits',
|
|
203
|
+
' 2. Yes, and manually approve edits',
|
|
204
|
+
' 3. No, keep planning',
|
|
205
|
+
]);
|
|
206
|
+
// Act
|
|
207
|
+
const state = detector.detectState(terminal, 'idle');
|
|
208
|
+
// Assert
|
|
209
|
+
expect(state).toBe('waiting_input');
|
|
210
|
+
});
|
|
211
|
+
it('should detect waiting_input with complex multi-line prompt and cursor indicator', () => {
|
|
212
|
+
// Arrange
|
|
213
|
+
terminal = createMockTerminal([
|
|
214
|
+
'Processing complete.',
|
|
215
|
+
'Would you like to apply these changes?',
|
|
216
|
+
'',
|
|
217
|
+
'❯ 1. Yes, apply all changes',
|
|
218
|
+
' 2. Yes, review changes first',
|
|
219
|
+
' 3. No, discard changes',
|
|
220
|
+
' 4. Cancel operation',
|
|
221
|
+
]);
|
|
222
|
+
// Act
|
|
223
|
+
const state = detector.detectState(terminal, 'idle');
|
|
224
|
+
// Assert
|
|
225
|
+
expect(state).toBe('waiting_input');
|
|
226
|
+
});
|
|
227
|
+
it('should detect waiting_input when cursor indicator is present without explicit "yes" text', () => {
|
|
228
|
+
// Arrange
|
|
229
|
+
terminal = createMockTerminal([
|
|
230
|
+
'Do you want to proceed?',
|
|
231
|
+
'',
|
|
232
|
+
'❯ 1. Apply all',
|
|
233
|
+
' 2. Review first',
|
|
234
|
+
' 3. Skip',
|
|
235
|
+
]);
|
|
236
|
+
// Act
|
|
237
|
+
const state = detector.detectState(terminal, 'idle');
|
|
238
|
+
// Assert
|
|
239
|
+
expect(state).toBe('waiting_input');
|
|
240
|
+
});
|
|
156
241
|
});
|
|
157
242
|
});
|
|
158
243
|
describe('GeminiStateDetector', () => {
|