ccmanager 2.2.1 → 2.2.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/README.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
# CCManager - AI Code
|
|
2
|
-
|
|
3
|
-
CCManager is a TUI application for managing multiple AI coding assistant sessions (Claude Code, Gemini CLI) across Git worktrees and projects.
|
|
1
|
+
# CCManager - AI Code Agent Session Manager
|
|
4
2
|
|
|
3
|
+
[](https://github.com/Piebald-AI/awesome-gemini-cli)
|
|
5
4
|
|
|
5
|
+
CCManager is a CLI application for managing multiple AI coding assistant sessions (Claude Code, Gemini CLI, Codex CLI) across Git worktrees and projects.
|
|
6
6
|
|
|
7
7
|
https://github.com/user-attachments/assets/15914a88-e288-4ac9-94d5-8127f2e19dbf
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
9
|
## Features
|
|
12
10
|
|
|
13
11
|
- Run multiple AI assistant sessions in parallel across different Git worktrees
|
|
@@ -24,7 +24,7 @@ export class SessionManager extends EventEmitter {
|
|
|
24
24
|
// Create a detector based on the session's detection strategy
|
|
25
25
|
const strategy = session.detectionStrategy || 'claude';
|
|
26
26
|
const detector = createStateDetector(strategy);
|
|
27
|
-
return detector.detectState(session.terminal);
|
|
27
|
+
return detector.detectState(session.terminal, session.state);
|
|
28
28
|
}
|
|
29
29
|
constructor() {
|
|
30
30
|
super();
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { SessionState, Terminal, StateDetectionStrategy } from '../types/index.js';
|
|
2
2
|
export interface StateDetector {
|
|
3
|
-
detectState(terminal: Terminal): SessionState;
|
|
3
|
+
detectState(terminal: Terminal, currentState: SessionState): SessionState;
|
|
4
4
|
}
|
|
5
5
|
export declare function createStateDetector(strategy?: StateDetectionStrategy): StateDetector;
|
|
6
6
|
export declare abstract class BaseStateDetector implements StateDetector {
|
|
7
|
-
abstract detectState(terminal: Terminal): SessionState;
|
|
7
|
+
abstract detectState(terminal: Terminal, currentState: SessionState): SessionState;
|
|
8
8
|
protected getTerminalLines(terminal: Terminal, maxLines?: number): string[];
|
|
9
9
|
protected getTerminalContent(terminal: Terminal, maxLines?: number): string;
|
|
10
10
|
}
|
|
11
11
|
export declare class ClaudeStateDetector extends BaseStateDetector {
|
|
12
|
-
detectState(terminal: Terminal): SessionState;
|
|
12
|
+
detectState(terminal: Terminal, currentState: SessionState): SessionState;
|
|
13
13
|
}
|
|
14
14
|
export declare class GeminiStateDetector extends BaseStateDetector {
|
|
15
|
-
detectState(terminal: Terminal): SessionState;
|
|
15
|
+
detectState(terminal: Terminal, _currentState: SessionState): SessionState;
|
|
16
16
|
}
|
|
17
17
|
export declare class CodexStateDetector extends BaseStateDetector {
|
|
18
|
-
detectState(terminal: Terminal): SessionState;
|
|
18
|
+
detectState(terminal: Terminal, _currentState: SessionState): SessionState;
|
|
19
19
|
}
|
|
@@ -32,9 +32,13 @@ export class BaseStateDetector {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
export class ClaudeStateDetector extends BaseStateDetector {
|
|
35
|
-
detectState(terminal) {
|
|
35
|
+
detectState(terminal, currentState) {
|
|
36
36
|
const content = this.getTerminalContent(terminal);
|
|
37
37
|
const lowerContent = content.toLowerCase();
|
|
38
|
+
// Check for ctrl+r toggle prompt - maintain current state
|
|
39
|
+
if (lowerContent.includes('ctrl+r to toggle')) {
|
|
40
|
+
return currentState;
|
|
41
|
+
}
|
|
38
42
|
// Check for waiting prompts with box character
|
|
39
43
|
if (content.includes('│ Do you want') ||
|
|
40
44
|
content.includes('│ Would you like')) {
|
|
@@ -50,7 +54,7 @@ export class ClaudeStateDetector extends BaseStateDetector {
|
|
|
50
54
|
}
|
|
51
55
|
// https://github.com/google-gemini/gemini-cli/blob/main/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
|
|
52
56
|
export class GeminiStateDetector extends BaseStateDetector {
|
|
53
|
-
detectState(terminal) {
|
|
57
|
+
detectState(terminal, _currentState) {
|
|
54
58
|
const content = this.getTerminalContent(terminal);
|
|
55
59
|
const lowerContent = content.toLowerCase();
|
|
56
60
|
// Check for waiting prompts with box character
|
|
@@ -68,7 +72,7 @@ export class GeminiStateDetector extends BaseStateDetector {
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
export class CodexStateDetector extends BaseStateDetector {
|
|
71
|
-
detectState(terminal) {
|
|
75
|
+
detectState(terminal, _currentState) {
|
|
72
76
|
const content = this.getTerminalContent(terminal);
|
|
73
77
|
const lowerContent = content.toLowerCase();
|
|
74
78
|
// Check for waiting prompts
|
|
@@ -33,7 +33,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
33
33
|
'│ > ',
|
|
34
34
|
]);
|
|
35
35
|
// Act
|
|
36
|
-
const state = detector.detectState(terminal);
|
|
36
|
+
const state = detector.detectState(terminal, 'idle');
|
|
37
37
|
// Assert
|
|
38
38
|
expect(state).toBe('waiting_input');
|
|
39
39
|
});
|
|
@@ -45,7 +45,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
45
45
|
'│ > ',
|
|
46
46
|
]);
|
|
47
47
|
// Act
|
|
48
|
-
const state = detector.detectState(terminal);
|
|
48
|
+
const state = detector.detectState(terminal, 'idle');
|
|
49
49
|
// Assert
|
|
50
50
|
expect(state).toBe('waiting_input');
|
|
51
51
|
});
|
|
@@ -56,7 +56,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
56
56
|
'Press ESC to interrupt',
|
|
57
57
|
]);
|
|
58
58
|
// Act
|
|
59
|
-
const state = detector.detectState(terminal);
|
|
59
|
+
const state = detector.detectState(terminal, 'idle');
|
|
60
60
|
// Assert
|
|
61
61
|
expect(state).toBe('busy');
|
|
62
62
|
});
|
|
@@ -67,7 +67,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
67
67
|
'press esc to interrupt the process',
|
|
68
68
|
]);
|
|
69
69
|
// Act
|
|
70
|
-
const state = detector.detectState(terminal);
|
|
70
|
+
const state = detector.detectState(terminal, 'idle');
|
|
71
71
|
// Assert
|
|
72
72
|
expect(state).toBe('busy');
|
|
73
73
|
});
|
|
@@ -79,7 +79,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
79
79
|
'> ',
|
|
80
80
|
]);
|
|
81
81
|
// Act
|
|
82
|
-
const state = detector.detectState(terminal);
|
|
82
|
+
const state = detector.detectState(terminal, 'idle');
|
|
83
83
|
// Assert
|
|
84
84
|
expect(state).toBe('idle');
|
|
85
85
|
});
|
|
@@ -87,7 +87,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
87
87
|
// Arrange
|
|
88
88
|
terminal = createMockTerminal([]);
|
|
89
89
|
// Act
|
|
90
|
-
const state = detector.detectState(terminal);
|
|
90
|
+
const state = detector.detectState(terminal, 'idle');
|
|
91
91
|
// Assert
|
|
92
92
|
expect(state).toBe('idle');
|
|
93
93
|
});
|
|
@@ -106,7 +106,7 @@ describe('ClaudeStateDetector', () => {
|
|
|
106
106
|
}
|
|
107
107
|
terminal = createMockTerminal(lines);
|
|
108
108
|
// Act
|
|
109
|
-
const state = detector.detectState(terminal);
|
|
109
|
+
const state = detector.detectState(terminal, 'idle');
|
|
110
110
|
// Assert
|
|
111
111
|
expect(state).toBe('idle'); // Should not detect the old prompt
|
|
112
112
|
});
|
|
@@ -118,10 +118,42 @@ describe('ClaudeStateDetector', () => {
|
|
|
118
118
|
'│ > ',
|
|
119
119
|
]);
|
|
120
120
|
// Act
|
|
121
|
-
const state = detector.detectState(terminal);
|
|
121
|
+
const state = detector.detectState(terminal, 'idle');
|
|
122
122
|
// Assert
|
|
123
123
|
expect(state).toBe('waiting_input'); // waiting_input should take precedence
|
|
124
124
|
});
|
|
125
|
+
it('should maintain current state when "ctrl+r to toggle" is present', () => {
|
|
126
|
+
// Arrange
|
|
127
|
+
terminal = createMockTerminal([
|
|
128
|
+
'Some output',
|
|
129
|
+
'Press Ctrl+R to toggle history search',
|
|
130
|
+
'More output',
|
|
131
|
+
]);
|
|
132
|
+
// Act - test with different current states
|
|
133
|
+
const idleState = detector.detectState(terminal, 'idle');
|
|
134
|
+
const busyState = detector.detectState(terminal, 'busy');
|
|
135
|
+
const waitingState = detector.detectState(terminal, 'waiting_input');
|
|
136
|
+
// Assert - should maintain whatever the current state was
|
|
137
|
+
expect(idleState).toBe('idle');
|
|
138
|
+
expect(busyState).toBe('busy');
|
|
139
|
+
expect(waitingState).toBe('waiting_input');
|
|
140
|
+
});
|
|
141
|
+
it('should maintain current state for various "ctrl+r" patterns', () => {
|
|
142
|
+
// Arrange - test different case variations
|
|
143
|
+
const patterns = [
|
|
144
|
+
'ctrl+r to toggle',
|
|
145
|
+
'CTRL+R TO TOGGLE',
|
|
146
|
+
'Ctrl+R to toggle history',
|
|
147
|
+
'Press ctrl+r to toggle the search',
|
|
148
|
+
];
|
|
149
|
+
for (const pattern of patterns) {
|
|
150
|
+
terminal = createMockTerminal(['Some output', pattern]);
|
|
151
|
+
// Act
|
|
152
|
+
const state = detector.detectState(terminal, 'busy');
|
|
153
|
+
// Assert - should maintain the current state
|
|
154
|
+
expect(state).toBe('busy');
|
|
155
|
+
}
|
|
156
|
+
});
|
|
125
157
|
});
|
|
126
158
|
});
|
|
127
159
|
describe('GeminiStateDetector', () => {
|
|
@@ -157,7 +189,7 @@ describe('GeminiStateDetector', () => {
|
|
|
157
189
|
'│ > ',
|
|
158
190
|
]);
|
|
159
191
|
// Act
|
|
160
|
-
const state = detector.detectState(terminal);
|
|
192
|
+
const state = detector.detectState(terminal, 'idle');
|
|
161
193
|
// Assert
|
|
162
194
|
expect(state).toBe('waiting_input');
|
|
163
195
|
});
|
|
@@ -169,7 +201,7 @@ describe('GeminiStateDetector', () => {
|
|
|
169
201
|
'│ > ',
|
|
170
202
|
]);
|
|
171
203
|
// Act
|
|
172
|
-
const state = detector.detectState(terminal);
|
|
204
|
+
const state = detector.detectState(terminal, 'idle');
|
|
173
205
|
// Assert
|
|
174
206
|
expect(state).toBe('waiting_input');
|
|
175
207
|
});
|
|
@@ -181,7 +213,7 @@ describe('GeminiStateDetector', () => {
|
|
|
181
213
|
'│ > ',
|
|
182
214
|
]);
|
|
183
215
|
// Act
|
|
184
|
-
const state = detector.detectState(terminal);
|
|
216
|
+
const state = detector.detectState(terminal, 'idle');
|
|
185
217
|
// Assert
|
|
186
218
|
expect(state).toBe('waiting_input');
|
|
187
219
|
});
|
|
@@ -192,7 +224,7 @@ describe('GeminiStateDetector', () => {
|
|
|
192
224
|
'Press ESC to cancel',
|
|
193
225
|
]);
|
|
194
226
|
// Act
|
|
195
|
-
const state = detector.detectState(terminal);
|
|
227
|
+
const state = detector.detectState(terminal, 'idle');
|
|
196
228
|
// Assert
|
|
197
229
|
expect(state).toBe('busy');
|
|
198
230
|
});
|
|
@@ -203,7 +235,7 @@ describe('GeminiStateDetector', () => {
|
|
|
203
235
|
'Press Esc to cancel the operation',
|
|
204
236
|
]);
|
|
205
237
|
// Act
|
|
206
|
-
const state = detector.detectState(terminal);
|
|
238
|
+
const state = detector.detectState(terminal, 'idle');
|
|
207
239
|
// Assert
|
|
208
240
|
expect(state).toBe('busy');
|
|
209
241
|
});
|
|
@@ -214,7 +246,7 @@ describe('GeminiStateDetector', () => {
|
|
|
214
246
|
'Type your message below',
|
|
215
247
|
]);
|
|
216
248
|
// Act
|
|
217
|
-
const state = detector.detectState(terminal);
|
|
249
|
+
const state = detector.detectState(terminal, 'idle');
|
|
218
250
|
// Assert
|
|
219
251
|
expect(state).toBe('idle');
|
|
220
252
|
});
|
|
@@ -222,7 +254,7 @@ describe('GeminiStateDetector', () => {
|
|
|
222
254
|
// Arrange
|
|
223
255
|
terminal = createMockTerminal([]);
|
|
224
256
|
// Act
|
|
225
|
-
const state = detector.detectState(terminal);
|
|
257
|
+
const state = detector.detectState(terminal, 'idle');
|
|
226
258
|
// Assert
|
|
227
259
|
expect(state).toBe('idle');
|
|
228
260
|
});
|
|
@@ -234,7 +266,7 @@ describe('GeminiStateDetector', () => {
|
|
|
234
266
|
'│ > ',
|
|
235
267
|
]);
|
|
236
268
|
// Act
|
|
237
|
-
const state = detector.detectState(terminal);
|
|
269
|
+
const state = detector.detectState(terminal, 'idle');
|
|
238
270
|
// Assert
|
|
239
271
|
expect(state).toBe('waiting_input'); // waiting_input should take precedence
|
|
240
272
|
});
|
|
@@ -267,7 +299,7 @@ describe('CodexStateDetector', () => {
|
|
|
267
299
|
// Arrange
|
|
268
300
|
terminal = createMockTerminal(['Some output', '│Allow execution?', '│ > ']);
|
|
269
301
|
// Act
|
|
270
|
-
const state = detector.detectState(terminal);
|
|
302
|
+
const state = detector.detectState(terminal, 'idle');
|
|
271
303
|
// Assert
|
|
272
304
|
expect(state).toBe('waiting_input');
|
|
273
305
|
});
|
|
@@ -275,7 +307,7 @@ describe('CodexStateDetector', () => {
|
|
|
275
307
|
// Arrange
|
|
276
308
|
terminal = createMockTerminal(['Some output', 'Continue? [y/N]', '> ']);
|
|
277
309
|
// Act
|
|
278
|
-
const state = detector.detectState(terminal);
|
|
310
|
+
const state = detector.detectState(terminal, 'idle');
|
|
279
311
|
// Assert
|
|
280
312
|
expect(state).toBe('waiting_input');
|
|
281
313
|
});
|
|
@@ -286,7 +318,7 @@ describe('CodexStateDetector', () => {
|
|
|
286
318
|
'Press any key to continue...',
|
|
287
319
|
]);
|
|
288
320
|
// Act
|
|
289
|
-
const state = detector.detectState(terminal);
|
|
321
|
+
const state = detector.detectState(terminal, 'idle');
|
|
290
322
|
// Assert
|
|
291
323
|
expect(state).toBe('waiting_input');
|
|
292
324
|
});
|
|
@@ -298,7 +330,7 @@ describe('CodexStateDetector', () => {
|
|
|
298
330
|
'Working...',
|
|
299
331
|
]);
|
|
300
332
|
// Act
|
|
301
|
-
const state = detector.detectState(terminal);
|
|
333
|
+
const state = detector.detectState(terminal, 'idle');
|
|
302
334
|
// Assert
|
|
303
335
|
expect(state).toBe('busy');
|
|
304
336
|
});
|
|
@@ -310,7 +342,7 @@ describe('CodexStateDetector', () => {
|
|
|
310
342
|
'Working...',
|
|
311
343
|
]);
|
|
312
344
|
// Act
|
|
313
|
-
const state = detector.detectState(terminal);
|
|
345
|
+
const state = detector.detectState(terminal, 'idle');
|
|
314
346
|
// Assert
|
|
315
347
|
expect(state).toBe('busy');
|
|
316
348
|
});
|
|
@@ -318,7 +350,7 @@ describe('CodexStateDetector', () => {
|
|
|
318
350
|
// Arrange
|
|
319
351
|
terminal = createMockTerminal(['Normal output', 'Some message', 'Ready']);
|
|
320
352
|
// Act
|
|
321
|
-
const state = detector.detectState(terminal);
|
|
353
|
+
const state = detector.detectState(terminal, 'idle');
|
|
322
354
|
// Assert
|
|
323
355
|
expect(state).toBe('idle');
|
|
324
356
|
});
|
|
@@ -326,7 +358,7 @@ describe('CodexStateDetector', () => {
|
|
|
326
358
|
// Arrange
|
|
327
359
|
terminal = createMockTerminal(['press esc to cancel', '[y/N]']);
|
|
328
360
|
// Act
|
|
329
|
-
const state = detector.detectState(terminal);
|
|
361
|
+
const state = detector.detectState(terminal, 'idle');
|
|
330
362
|
// Assert
|
|
331
363
|
expect(state).toBe('waiting_input');
|
|
332
364
|
});
|