ccmanager 2.9.3 → 2.10.0

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.
@@ -18,6 +18,7 @@ const createStrategyItems = () => {
18
18
  label: 'GitHub Copilot CLI',
19
19
  value: 'github-copilot',
20
20
  },
21
+ cline: { label: 'Cline', value: 'cline' },
21
22
  };
22
23
  return Object.values(strategies);
23
24
  };
@@ -23,3 +23,6 @@ export declare class CursorStateDetector extends BaseStateDetector {
23
23
  export declare class GitHubCopilotStateDetector extends BaseStateDetector {
24
24
  detectState(terminal: Terminal, _currentState: SessionState): SessionState;
25
25
  }
26
+ export declare class ClineStateDetector extends BaseStateDetector {
27
+ detectState(terminal: Terminal, _currentState: SessionState): SessionState;
28
+ }
@@ -10,6 +10,8 @@ export function createStateDetector(strategy = 'claude') {
10
10
  return new CursorStateDetector();
11
11
  case 'github-copilot':
12
12
  return new GitHubCopilotStateDetector();
13
+ case 'cline':
14
+ return new ClineStateDetector();
13
15
  default:
14
16
  return new ClaudeStateDetector();
15
17
  }
@@ -132,3 +134,26 @@ export class GitHubCopilotStateDetector extends BaseStateDetector {
132
134
  return 'idle';
133
135
  }
134
136
  }
137
+ // https://github.com/cline/cline/blob/580db36476b6b52def03c8aeda325aae1c817cde/cli/pkg/cli/task/input_handler.go
138
+ export class ClineStateDetector extends BaseStateDetector {
139
+ detectState(terminal, _currentState) {
140
+ const content = this.getTerminalContent(terminal);
141
+ const lowerContent = content.toLowerCase();
142
+ // Check for waiting prompts with tool permission - Priority 1
143
+ // Pattern: [\[act|plan\] mode].*?\n.*yes (when mode indicator present)
144
+ // Or simply: let cline use this tool (distinctive text)
145
+ if (/\[(act|plan) mode\].*?\n.*yes/i.test(lowerContent) ||
146
+ /let cline use this tool/i.test(lowerContent)) {
147
+ return 'waiting_input';
148
+ }
149
+ // Check for idle state - Priority 2
150
+ // Pattern: [\[act|plan\] mode].*Cline is ready for your message... (when mode indicator present)
151
+ // Or simply: cline is ready for your message (distinctive text)
152
+ if (/\[(act|plan) mode\].*cline is ready for your message/i.test(lowerContent) ||
153
+ /cline is ready for your message/i.test(lowerContent)) {
154
+ return 'idle';
155
+ }
156
+ // Otherwise busy - Priority 3
157
+ return 'busy';
158
+ }
159
+ }
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, beforeEach } from 'vitest';
2
- import { ClaudeStateDetector, GeminiStateDetector, CodexStateDetector, CursorStateDetector, GitHubCopilotStateDetector, } from './stateDetector.js';
2
+ import { ClaudeStateDetector, GeminiStateDetector, CodexStateDetector, CursorStateDetector, GitHubCopilotStateDetector, ClineStateDetector, } from './stateDetector.js';
3
3
  const createMockTerminal = (lines) => {
4
4
  const buffer = {
5
5
  length: lines.length,
@@ -591,3 +591,115 @@ describe('GitHubCopilotStateDetector', () => {
591
591
  expect(state).toBe('idle');
592
592
  });
593
593
  });
594
+ describe('ClineStateDetector', () => {
595
+ let detector;
596
+ let terminal;
597
+ beforeEach(() => {
598
+ detector = new ClineStateDetector();
599
+ });
600
+ it('should detect waiting_input when "Let Cline use this tool?" is present', () => {
601
+ // Arrange
602
+ terminal = createMockTerminal([
603
+ '┃ [act mode] Let Cline use this tool?',
604
+ '┃ > Yes',
605
+ "┃ Yes, and don't ask again for this task",
606
+ '┃ No, with feedback',
607
+ ]);
608
+ // Act
609
+ const state = detector.detectState(terminal, 'idle');
610
+ // Assert
611
+ expect(state).toBe('waiting_input');
612
+ });
613
+ it('should detect waiting_input when "let cline use this tool?" is present (case insensitive)', () => {
614
+ // Arrange
615
+ terminal = createMockTerminal([
616
+ 'Some output',
617
+ 'LET CLINE USE THIS TOOL?',
618
+ '> Yes',
619
+ ]);
620
+ // Act
621
+ const state = detector.detectState(terminal, 'idle');
622
+ // Assert
623
+ expect(state).toBe('waiting_input');
624
+ });
625
+ it('should detect idle when "Cline is ready for your message" is present in act mode', () => {
626
+ // Arrange
627
+ terminal = createMockTerminal([
628
+ '┃ [act mode] Cline is ready for your message...',
629
+ '┃ /plan or /act to switch modes',
630
+ '┃ ctrl+e to open editor',
631
+ ]);
632
+ // Act
633
+ const state = detector.detectState(terminal, 'idle');
634
+ // Assert
635
+ expect(state).toBe('idle');
636
+ });
637
+ it('should detect idle when "Cline is ready for your message" is present in plan mode', () => {
638
+ // Arrange
639
+ terminal = createMockTerminal([
640
+ '┃ [plan mode] Cline is ready for your message...',
641
+ '┃ /plan or /act to switch modes',
642
+ '┃ ctrl+e to open editor',
643
+ ]);
644
+ // Act
645
+ const state = detector.detectState(terminal, 'idle');
646
+ // Assert
647
+ expect(state).toBe('idle');
648
+ });
649
+ it('should detect idle when "cline is ready" is present (case insensitive)', () => {
650
+ // Arrange
651
+ terminal = createMockTerminal([
652
+ 'Some output',
653
+ 'CLINE IS READY FOR YOUR MESSAGE',
654
+ 'Ready to go',
655
+ ]);
656
+ // Act
657
+ const state = detector.detectState(terminal, 'idle');
658
+ // Assert
659
+ expect(state).toBe('idle');
660
+ });
661
+ it('should detect busy when no specific patterns are found', () => {
662
+ // Arrange
663
+ terminal = createMockTerminal([
664
+ 'Processing your request...',
665
+ 'Running analysis...',
666
+ 'Working on it...',
667
+ ]);
668
+ // Act
669
+ const state = detector.detectState(terminal, 'idle');
670
+ // Assert
671
+ expect(state).toBe('busy');
672
+ });
673
+ it('should handle empty terminal as busy', () => {
674
+ // Arrange
675
+ terminal = createMockTerminal([]);
676
+ // Act
677
+ const state = detector.detectState(terminal, 'idle');
678
+ // Assert
679
+ expect(state).toBe('busy');
680
+ });
681
+ it('should prioritize waiting_input over idle', () => {
682
+ // Arrange
683
+ terminal = createMockTerminal([
684
+ '┃ [act mode] Cline is ready for your message...',
685
+ '┃ Let Cline use this tool?',
686
+ '┃ > Yes',
687
+ ]);
688
+ // Act
689
+ const state = detector.detectState(terminal, 'idle');
690
+ // Assert
691
+ expect(state).toBe('waiting_input'); // waiting_input should take precedence
692
+ });
693
+ it('should prioritize idle over busy', () => {
694
+ // Arrange
695
+ terminal = createMockTerminal([
696
+ 'Processing...',
697
+ 'Working...',
698
+ '┃ [act mode] Cline is ready for your message...',
699
+ ]);
700
+ // Act
701
+ const state = detector.detectState(terminal, 'idle');
702
+ // Assert
703
+ expect(state).toBe('idle'); // idle should take precedence over busy
704
+ });
705
+ });
@@ -3,7 +3,7 @@ import type pkg from '@xterm/headless';
3
3
  import { GitStatus } from '../utils/gitStatus.js';
4
4
  export type Terminal = InstanceType<typeof pkg.Terminal>;
5
5
  export type SessionState = 'idle' | 'busy' | 'waiting_input';
6
- export type StateDetectionStrategy = 'claude' | 'gemini' | 'codex' | 'cursor' | 'github-copilot';
6
+ export type StateDetectionStrategy = 'claude' | 'gemini' | 'codex' | 'cursor' | 'github-copilot' | 'cline';
7
7
  export interface Worktree {
8
8
  path: string;
9
9
  branch?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccmanager",
3
- "version": "2.9.3",
3
+ "version": "2.10.0",
4
4
  "description": "TUI application for managing multiple Claude Code sessions across Git worktrees",
5
5
  "license": "MIT",
6
6
  "author": "Kodai Kabasawa",