ccmanager 0.1.3 → 0.1.5
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/components/Configuration.js +11 -0
- package/dist/components/ConfigureWorktree.d.ts +6 -0
- package/dist/components/ConfigureWorktree.js +99 -0
- package/dist/components/NewWorktree.js +36 -6
- package/dist/components/Session.js +18 -19
- package/dist/services/configurationManager.d.ts +3 -1
- package/dist/services/configurationManager.js +14 -0
- package/dist/services/sessionManager.js +16 -7
- package/dist/services/worktreeService.js +5 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/utils/worktreeUtils.d.ts +5 -0
- package/dist/utils/worktreeUtils.js +29 -0
- package/dist/utils/worktreeUtils.test.js +74 -0
- package/package.json +1 -1
- package/dist/services/sessionManager.colorRestore.test.js +0 -142
- package/dist/services/sessionManager.integration.test.d.ts +0 -1
- package/dist/services/sessionManager.integration.test.js +0 -178
- package/dist/utils/terminalSerializer.d.ts +0 -119
- package/dist/utils/terminalSerializer.js +0 -376
- package/dist/utils/terminalSerializer.test.d.ts +0 -1
- package/dist/utils/terminalSerializer.test.js +0 -137
- /package/dist/{services/sessionManager.colorRestore.test.d.ts → utils/worktreeUtils.test.d.ts} +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
-
import pkg from '@xterm/headless';
|
|
3
|
-
import { TerminalSerializer } from './terminalSerializer.js';
|
|
4
|
-
const { Terminal } = pkg;
|
|
5
|
-
describe('TerminalSerializer', () => {
|
|
6
|
-
let terminal;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
terminal = new Terminal({
|
|
9
|
-
cols: 80,
|
|
10
|
-
rows: 24,
|
|
11
|
-
allowProposedApi: true,
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
// Helper to write to terminal and wait for processing
|
|
15
|
-
const writeAsync = (data) => {
|
|
16
|
-
return new Promise(resolve => {
|
|
17
|
-
terminal.write(data, () => resolve());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
it('should serialize plain text without escape sequences', async () => {
|
|
21
|
-
await writeAsync('Hello, World!');
|
|
22
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
23
|
-
expect(serialized).toContain('Hello, World!');
|
|
24
|
-
});
|
|
25
|
-
it('should preserve foreground colors', async () => {
|
|
26
|
-
// Write red text
|
|
27
|
-
await writeAsync('\x1b[31mRed Text\x1b[0m');
|
|
28
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
29
|
-
expect(serialized).toContain('\x1b[31m');
|
|
30
|
-
expect(serialized).toContain('Red Text');
|
|
31
|
-
});
|
|
32
|
-
it('should preserve background colors', async () => {
|
|
33
|
-
// Write text with blue background
|
|
34
|
-
await writeAsync('\x1b[44mBlue Background\x1b[0m');
|
|
35
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
36
|
-
expect(serialized).toContain('\x1b[44m');
|
|
37
|
-
expect(serialized).toContain('Blue Background');
|
|
38
|
-
});
|
|
39
|
-
it('should preserve 256 colors', async () => {
|
|
40
|
-
// Write text with extended color (color 196 = bright red)
|
|
41
|
-
await writeAsync('\x1b[38;5;196mExtended Color\x1b[0m');
|
|
42
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
43
|
-
expect(serialized).toContain('\x1b[38;5;196m');
|
|
44
|
-
expect(serialized).toContain('Extended Color');
|
|
45
|
-
});
|
|
46
|
-
it('should preserve RGB colors', async () => {
|
|
47
|
-
// Write text with true color RGB
|
|
48
|
-
await writeAsync('\x1b[38;2;255;128;0mOrange RGB\x1b[0m');
|
|
49
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
50
|
-
expect(serialized).toContain('\x1b[38;2;255;128;0m');
|
|
51
|
-
expect(serialized).toContain('Orange RGB');
|
|
52
|
-
});
|
|
53
|
-
it('should preserve text styles', async () => {
|
|
54
|
-
// Write bold text
|
|
55
|
-
await writeAsync('\x1b[1mBold Text\x1b[0m');
|
|
56
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
57
|
-
expect(serialized).toContain('\x1b[1m');
|
|
58
|
-
expect(serialized).toContain('Bold Text');
|
|
59
|
-
// Clear and write italic text
|
|
60
|
-
terminal.reset();
|
|
61
|
-
await writeAsync('\x1b[3mItalic Text\x1b[0m');
|
|
62
|
-
const serializedItalic = TerminalSerializer.serialize(terminal);
|
|
63
|
-
expect(serializedItalic).toContain('\x1b[3m');
|
|
64
|
-
expect(serializedItalic).toContain('Italic Text');
|
|
65
|
-
});
|
|
66
|
-
it('should handle multiple lines correctly', async () => {
|
|
67
|
-
await writeAsync('Line 1\r\n');
|
|
68
|
-
await writeAsync('\x1b[32mLine 2 (green)\x1b[0m\r\n');
|
|
69
|
-
await writeAsync('Line 3');
|
|
70
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
71
|
-
const lines = serialized.split('\n');
|
|
72
|
-
expect(lines.length).toBeGreaterThanOrEqual(3);
|
|
73
|
-
expect(lines[0]).toContain('Line 1');
|
|
74
|
-
expect(lines[1]).toContain('\x1b[32m');
|
|
75
|
-
expect(lines[1]).toContain('Line 2 (green)');
|
|
76
|
-
expect(lines[2]).toContain('Line 3');
|
|
77
|
-
});
|
|
78
|
-
it('should trim trailing empty lines when trimRight is true', async () => {
|
|
79
|
-
await writeAsync('Content\r\n\r\n\r\n\r\n');
|
|
80
|
-
const serialized = TerminalSerializer.serialize(terminal, {
|
|
81
|
-
trimRight: true,
|
|
82
|
-
});
|
|
83
|
-
const lines = serialized.split('\n');
|
|
84
|
-
// Should only have the content line, not the trailing empty lines
|
|
85
|
-
expect(lines[0]).toContain('Content');
|
|
86
|
-
expect(lines.length).toBe(1); // Plus reset code
|
|
87
|
-
});
|
|
88
|
-
it('should preserve empty lines when includeEmptyLines is true', async () => {
|
|
89
|
-
await writeAsync('Line 1\r\n\r\nLine 3');
|
|
90
|
-
const serialized = TerminalSerializer.serialize(terminal, {
|
|
91
|
-
includeEmptyLines: true,
|
|
92
|
-
});
|
|
93
|
-
const lines = serialized.split('\n');
|
|
94
|
-
expect(lines.length).toBe(3); // 3 lines including the empty one
|
|
95
|
-
expect(lines[1]).toBe(''); // Empty line
|
|
96
|
-
});
|
|
97
|
-
it('should handle getLastLines correctly', async () => {
|
|
98
|
-
// Create a small terminal so we can see the scrolling
|
|
99
|
-
const smallTerminal = new Terminal({
|
|
100
|
-
cols: 80,
|
|
101
|
-
rows: 10,
|
|
102
|
-
allowProposedApi: true,
|
|
103
|
-
});
|
|
104
|
-
// Helper for this specific terminal
|
|
105
|
-
const writeToSmall = (data) => {
|
|
106
|
-
return new Promise(resolve => {
|
|
107
|
-
smallTerminal.write(data, () => resolve());
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
// Write enough lines to fill and scroll the buffer
|
|
111
|
-
for (let i = 1; i <= 15; i++) {
|
|
112
|
-
await writeToSmall(`Line ${i}\r\n`);
|
|
113
|
-
}
|
|
114
|
-
const lastLines = TerminalSerializer.getLastLines(smallTerminal, 3);
|
|
115
|
-
// Should contain the last few lines
|
|
116
|
-
expect(lastLines).toContain('Line 14');
|
|
117
|
-
expect(lastLines).toContain('Line 15');
|
|
118
|
-
// Should not contain much older lines
|
|
119
|
-
expect(lastLines).not.toContain('Line 10');
|
|
120
|
-
});
|
|
121
|
-
it('should handle complex mixed formatting', async () => {
|
|
122
|
-
// Complex formatting with multiple attributes
|
|
123
|
-
await writeAsync('\x1b[1;31;44mBold Red on Blue\x1b[0m Normal \x1b[3;38;5;226mItalic Yellow\x1b[0m');
|
|
124
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
125
|
-
// Should contain various escape sequences
|
|
126
|
-
expect(serialized).toContain('Bold Red on Blue');
|
|
127
|
-
expect(serialized).toContain('Normal');
|
|
128
|
-
expect(serialized).toContain('Italic Yellow');
|
|
129
|
-
// Should have some escape sequences (exact sequences may vary based on implementation)
|
|
130
|
-
expect(serialized).toMatch(/\x1b\[\d+(;\d+)*m/);
|
|
131
|
-
});
|
|
132
|
-
it('should add reset at the end', async () => {
|
|
133
|
-
await writeAsync('Some text');
|
|
134
|
-
const serialized = TerminalSerializer.serialize(terminal);
|
|
135
|
-
expect(serialized).toMatch(/\x1b\[0m$/);
|
|
136
|
-
});
|
|
137
|
-
});
|
/package/dist/{services/sessionManager.colorRestore.test.d.ts → utils/worktreeUtils.test.d.ts}
RENAMED
|
File without changes
|