ccmanager 3.6.0 → 3.6.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.
@@ -17,6 +17,7 @@ export declare class SessionManager extends EventEmitter implements ISessionMana
17
17
  private spawn;
18
18
  detectTerminalState(session: Session): SessionState;
19
19
  detectBackgroundTask(session: Session): number;
20
+ private getTerminalContent;
20
21
  private handleAutoApproval;
21
22
  private cancelAutoApprovalVerification;
22
23
  /**
@@ -46,6 +46,11 @@ export class SessionManager extends EventEmitter {
46
46
  detectBackgroundTask(session) {
47
47
  return session.stateDetector.detectBackgroundTask(session.terminal);
48
48
  }
49
+ getTerminalContent(session) {
50
+ // Use the new screen capture utility that correctly handles
51
+ // both normal and alternate screen buffers
52
+ return getTerminalScreenContent(session.terminal, TERMINAL_CONTENT_MAX_LINES);
53
+ }
49
54
  handleAutoApproval(session) {
50
55
  // Cancel any existing verification before starting a new one
51
56
  this.cancelAutoApprovalVerification(session, 'Restarting verification for pending auto-approval state');
@@ -56,7 +61,7 @@ export class SessionManager extends EventEmitter {
56
61
  autoApprovalReason: undefined,
57
62
  }));
58
63
  // Get terminal content for verification
59
- const terminalContent = getTerminalScreenContent(session.terminal, TERMINAL_CONTENT_MAX_LINES);
64
+ const terminalContent = this.getTerminalContent(session);
60
65
  // Verify if permission is needed
61
66
  void Effect.runPromise(autoApprovalVerifier.verifyNeedsPermission(terminalContent, {
62
67
  signal: abortController.signal,
@@ -1,10 +1,21 @@
1
- import { getTerminalScreenContent } from '../../utils/screenCapture.js';
2
1
  export class BaseStateDetector {
3
2
  getTerminalLines(terminal, maxLines = 30) {
4
- const content = getTerminalScreenContent(terminal, maxLines);
5
- return content.split('\n');
3
+ const buffer = terminal.buffer.active;
4
+ const lines = [];
5
+ // Start from the bottom and work our way up
6
+ for (let i = buffer.length - 1; i >= 0 && lines.length < maxLines; i--) {
7
+ const line = buffer.getLine(i);
8
+ if (line) {
9
+ const text = line.translateToString(true);
10
+ // Skip empty lines at the bottom
11
+ if (lines.length > 0 || text.trim() !== '') {
12
+ lines.unshift(text);
13
+ }
14
+ }
15
+ }
16
+ return lines;
6
17
  }
7
18
  getTerminalContent(terminal, maxLines = 30) {
8
- return getTerminalScreenContent(terminal, maxLines);
19
+ return this.getTerminalLines(terminal, maxLines).join('\n');
9
20
  }
10
21
  }
@@ -2,10 +2,6 @@ import type { Terminal } from '../../types/index.js';
2
2
  /**
3
3
  * Creates a mock Terminal object for testing state detectors.
4
4
  * @param lines - Array of strings representing terminal output lines
5
- * @param options - Optional configuration for rows and cols
6
5
  * @returns Mock Terminal object with buffer interface
7
6
  */
8
- export declare const createMockTerminal: (lines: string[], options?: {
9
- rows?: number;
10
- cols?: number;
11
- }) => Terminal;
7
+ export declare const createMockTerminal: (lines: string[]) => Terminal;
@@ -1,12 +1,9 @@
1
1
  /**
2
2
  * Creates a mock Terminal object for testing state detectors.
3
3
  * @param lines - Array of strings representing terminal output lines
4
- * @param options - Optional configuration for rows and cols
5
4
  * @returns Mock Terminal object with buffer interface
6
5
  */
7
- export const createMockTerminal = (lines, options) => {
8
- const rows = options?.rows ?? lines.length;
9
- const cols = options?.cols ?? 80;
6
+ export const createMockTerminal = (lines) => {
10
7
  const buffer = {
11
8
  length: lines.length,
12
9
  active: {
@@ -14,12 +11,12 @@ export const createMockTerminal = (lines, options) => {
14
11
  getLine: (index) => {
15
12
  if (index >= 0 && index < lines.length) {
16
13
  return {
17
- translateToString: (_trimRight, _startCol, _endCol) => lines[index],
14
+ translateToString: () => lines[index],
18
15
  };
19
16
  }
20
17
  return null;
21
18
  },
22
19
  },
23
20
  };
24
- return { buffer, rows, cols };
21
+ return { buffer };
25
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccmanager",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "TUI application for managing multiple Claude Code sessions across Git worktrees",
5
5
  "license": "MIT",
6
6
  "author": "Kodai Kabasawa",
@@ -41,11 +41,11 @@
41
41
  "bin"
42
42
  ],
43
43
  "optionalDependencies": {
44
- "@kodaikabasawa/ccmanager-darwin-arm64": "3.6.0",
45
- "@kodaikabasawa/ccmanager-darwin-x64": "3.6.0",
46
- "@kodaikabasawa/ccmanager-linux-arm64": "3.6.0",
47
- "@kodaikabasawa/ccmanager-linux-x64": "3.6.0",
48
- "@kodaikabasawa/ccmanager-win32-x64": "3.6.0"
44
+ "@kodaikabasawa/ccmanager-darwin-arm64": "3.6.1",
45
+ "@kodaikabasawa/ccmanager-darwin-x64": "3.6.1",
46
+ "@kodaikabasawa/ccmanager-linux-arm64": "3.6.1",
47
+ "@kodaikabasawa/ccmanager-linux-x64": "3.6.1",
48
+ "@kodaikabasawa/ccmanager-win32-x64": "3.6.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^9.28.0",