ccmanager 3.5.1 → 3.5.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/dist/cli.js +3 -2
- package/dist/components/App.d.ts +1 -0
- package/dist/components/App.js +17 -39
- package/dist/components/App.test.js +12 -44
- package/dist/components/Configuration.js +10 -15
- package/dist/components/ConfigureCommand.js +18 -106
- package/dist/components/ConfigureCustomCommand.js +2 -17
- package/dist/components/ConfigureOther.js +5 -23
- package/dist/components/ConfigureOther.test.js +7 -31
- package/dist/components/ConfigureShortcuts.js +4 -31
- package/dist/components/ConfigureStatusHooks.js +5 -44
- package/dist/components/ConfigureStatusHooks.test.js +7 -31
- package/dist/components/ConfigureTimeout.js +2 -14
- package/dist/components/ConfigureWorktree.js +4 -47
- package/dist/components/ConfigureWorktreeHooks.js +5 -37
- package/dist/components/ConfigureWorktreeHooks.test.js +8 -33
- package/dist/components/Confirmation.js +9 -21
- package/dist/components/CustomCommandSummary.js +2 -5
- package/dist/components/DeleteConfirmation.js +10 -47
- package/dist/components/DeleteWorktree.js +14 -42
- package/dist/components/DeleteWorktree.test.js +6 -6
- package/dist/components/LoadingSpinner.js +3 -6
- package/dist/components/LoadingSpinner.test.js +22 -22
- package/dist/components/Menu.d.ts +1 -0
- package/dist/components/Menu.js +10 -42
- package/dist/components/Menu.recent-projects.test.js +8 -8
- package/dist/components/Menu.test.js +10 -10
- package/dist/components/MergeWorktree.js +16 -88
- package/dist/components/MergeWorktree.test.js +5 -5
- package/dist/components/NewWorktree.js +25 -105
- package/dist/components/NewWorktree.test.js +8 -8
- package/dist/components/PresetSelector.js +3 -9
- package/dist/components/ProjectList.js +9 -38
- package/dist/components/ProjectList.recent-projects.test.js +7 -7
- package/dist/components/ProjectList.test.js +37 -37
- package/dist/components/RemoteBranchSelector.js +2 -21
- package/dist/components/RemoteBranchSelector.test.js +8 -8
- package/dist/components/TextInputWrapper.d.ts +5 -0
- package/dist/components/TextInputWrapper.js +138 -11
- package/dist/contexts/ConfigEditorContext.d.ts +1 -1
- package/dist/contexts/ConfigEditorContext.js +3 -2
- package/dist/services/autoApprovalVerifier.js +1 -8
- package/dist/services/bunTerminal.js +41 -136
- package/dist/services/config/configEditor.js +2 -12
- package/dist/services/config/globalConfigManager.js +4 -24
- package/dist/services/config/projectConfigManager.js +3 -18
- package/dist/services/globalSessionOrchestrator.js +3 -12
- package/dist/services/globalSessionOrchestrator.test.js +1 -8
- package/dist/services/projectManager.js +13 -68
- package/dist/services/sessionManager.effect.test.js +9 -37
- package/dist/services/sessionManager.js +3 -18
- package/dist/services/sessionManager.test.js +9 -37
- package/dist/services/shortcutManager.js +7 -13
- package/dist/services/worktreeConfigManager.js +3 -8
- package/dist/services/worktreeService.js +2 -12
- package/dist/types/index.js +4 -12
- package/dist/utils/logger.js +12 -33
- package/dist/utils/mutex.js +3 -18
- package/dist/utils/worktreeUtils.js +3 -3
- package/package.json +12 -12
|
@@ -9,118 +9,26 @@
|
|
|
9
9
|
* BunTerminal class that wraps Bun's built-in Terminal API.
|
|
10
10
|
*/
|
|
11
11
|
class BunTerminal {
|
|
12
|
+
_pid = -1;
|
|
13
|
+
_cols;
|
|
14
|
+
_rows;
|
|
15
|
+
_process;
|
|
16
|
+
_closed = false;
|
|
17
|
+
_dataListeners = [];
|
|
18
|
+
_exitListeners = [];
|
|
19
|
+
_subprocess = null;
|
|
20
|
+
_terminal = null;
|
|
21
|
+
_decoder = new globalThis.TextDecoder('utf-8');
|
|
22
|
+
// Buffering to combine fragmented data chunks from the same event loop
|
|
23
|
+
_dataBuffer = '';
|
|
24
|
+
_flushTimer = null;
|
|
25
|
+
_syncOutputMode = false;
|
|
26
|
+
// Synchronized output escape sequences (used by Ink and other TUI frameworks)
|
|
27
|
+
static SYNC_OUTPUT_START = '\x1b[?2026h';
|
|
28
|
+
static SYNC_OUTPUT_END = '\x1b[?2026l';
|
|
29
|
+
static FLUSH_DELAY_MS = 8; // ~2 frames at 60fps for batching
|
|
30
|
+
static SYNC_TIMEOUT_MS = 100; // Timeout for sync mode
|
|
12
31
|
constructor(file, args, options) {
|
|
13
|
-
Object.defineProperty(this, "_pid", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: -1
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(this, "_cols", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: void 0
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "_rows", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: void 0
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(this, "_process", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true,
|
|
34
|
-
writable: true,
|
|
35
|
-
value: void 0
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(this, "_closed", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true,
|
|
40
|
-
writable: true,
|
|
41
|
-
value: false
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(this, "_dataListeners", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
configurable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
value: []
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(this, "_exitListeners", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
configurable: true,
|
|
52
|
-
writable: true,
|
|
53
|
-
value: []
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(this, "_subprocess", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: null
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(this, "_terminal", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: null
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(this, "_decoder", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: new globalThis.TextDecoder('utf-8')
|
|
72
|
-
});
|
|
73
|
-
// Buffering to combine fragmented data chunks from the same event loop
|
|
74
|
-
Object.defineProperty(this, "_dataBuffer", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
configurable: true,
|
|
77
|
-
writable: true,
|
|
78
|
-
value: ''
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(this, "_flushTimer", {
|
|
81
|
-
enumerable: true,
|
|
82
|
-
configurable: true,
|
|
83
|
-
writable: true,
|
|
84
|
-
value: null
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(this, "_syncOutputMode", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
configurable: true,
|
|
89
|
-
writable: true,
|
|
90
|
-
value: false
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(this, "onData", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
configurable: true,
|
|
95
|
-
writable: true,
|
|
96
|
-
value: (listener) => {
|
|
97
|
-
this._dataListeners.push(listener);
|
|
98
|
-
return {
|
|
99
|
-
dispose: () => {
|
|
100
|
-
const index = this._dataListeners.indexOf(listener);
|
|
101
|
-
if (index !== -1) {
|
|
102
|
-
this._dataListeners.splice(index, 1);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(this, "onExit", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
configurable: true,
|
|
111
|
-
writable: true,
|
|
112
|
-
value: (listener) => {
|
|
113
|
-
this._exitListeners.push(listener);
|
|
114
|
-
return {
|
|
115
|
-
dispose: () => {
|
|
116
|
-
const index = this._exitListeners.indexOf(listener);
|
|
117
|
-
if (index !== -1) {
|
|
118
|
-
this._exitListeners.splice(index, 1);
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
32
|
this._cols = options.cols ?? 80;
|
|
125
33
|
this._rows = options.rows ?? 24;
|
|
126
34
|
this._process = file;
|
|
@@ -278,6 +186,28 @@ class BunTerminal {
|
|
|
278
186
|
get process() {
|
|
279
187
|
return this._process;
|
|
280
188
|
}
|
|
189
|
+
onData = (listener) => {
|
|
190
|
+
this._dataListeners.push(listener);
|
|
191
|
+
return {
|
|
192
|
+
dispose: () => {
|
|
193
|
+
const index = this._dataListeners.indexOf(listener);
|
|
194
|
+
if (index !== -1) {
|
|
195
|
+
this._dataListeners.splice(index, 1);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
onExit = (listener) => {
|
|
201
|
+
this._exitListeners.push(listener);
|
|
202
|
+
return {
|
|
203
|
+
dispose: () => {
|
|
204
|
+
const index = this._exitListeners.indexOf(listener);
|
|
205
|
+
if (index !== -1) {
|
|
206
|
+
this._exitListeners.splice(index, 1);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
};
|
|
281
211
|
write(data) {
|
|
282
212
|
if (this._closed || !this._terminal) {
|
|
283
213
|
return;
|
|
@@ -317,31 +247,6 @@ class BunTerminal {
|
|
|
317
247
|
}
|
|
318
248
|
}
|
|
319
249
|
}
|
|
320
|
-
// Synchronized output escape sequences (used by Ink and other TUI frameworks)
|
|
321
|
-
Object.defineProperty(BunTerminal, "SYNC_OUTPUT_START", {
|
|
322
|
-
enumerable: true,
|
|
323
|
-
configurable: true,
|
|
324
|
-
writable: true,
|
|
325
|
-
value: '\x1b[?2026h'
|
|
326
|
-
});
|
|
327
|
-
Object.defineProperty(BunTerminal, "SYNC_OUTPUT_END", {
|
|
328
|
-
enumerable: true,
|
|
329
|
-
configurable: true,
|
|
330
|
-
writable: true,
|
|
331
|
-
value: '\x1b[?2026l'
|
|
332
|
-
});
|
|
333
|
-
Object.defineProperty(BunTerminal, "FLUSH_DELAY_MS", {
|
|
334
|
-
enumerable: true,
|
|
335
|
-
configurable: true,
|
|
336
|
-
writable: true,
|
|
337
|
-
value: 8
|
|
338
|
-
}); // ~2 frames at 60fps for batching
|
|
339
|
-
Object.defineProperty(BunTerminal, "SYNC_TIMEOUT_MS", {
|
|
340
|
-
enumerable: true,
|
|
341
|
-
configurable: true,
|
|
342
|
-
writable: true,
|
|
343
|
-
value: 100
|
|
344
|
-
}); // Timeout for sync mode
|
|
345
250
|
/**
|
|
346
251
|
* Spawn a new PTY process using Bun's built-in Terminal API.
|
|
347
252
|
*
|
|
@@ -12,19 +12,9 @@ import { projectConfigManager } from './projectConfigManager.js';
|
|
|
12
12
|
* immediately visible to all components (e.g., shortcutManager, configReader).
|
|
13
13
|
*/
|
|
14
14
|
export class ConfigEditor {
|
|
15
|
+
scope;
|
|
16
|
+
configEditor;
|
|
15
17
|
constructor(scope) {
|
|
16
|
-
Object.defineProperty(this, "scope", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(this, "configEditor", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
18
|
this.scope = scope;
|
|
29
19
|
this.configEditor =
|
|
30
20
|
scope === 'global' ? globalConfigManager : projectConfigManager;
|
|
@@ -8,31 +8,11 @@ import { join } from 'path';
|
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
9
9
|
import { DEFAULT_SHORTCUTS, } from '../../types/index.js';
|
|
10
10
|
class GlobalConfigManager {
|
|
11
|
+
configPath;
|
|
12
|
+
legacyShortcutsPath;
|
|
13
|
+
configDir;
|
|
14
|
+
config = {};
|
|
11
15
|
constructor() {
|
|
12
|
-
Object.defineProperty(this, "configPath", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: void 0
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "legacyShortcutsPath", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(this, "configDir", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(this, "config", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: {}
|
|
35
|
-
});
|
|
36
16
|
// Determine config directory based on platform
|
|
37
17
|
const homeDir = homedir();
|
|
38
18
|
this.configDir =
|
|
@@ -14,25 +14,10 @@ const PROJECT_CONFIG_FILENAME = '.ccmanager.json';
|
|
|
14
14
|
* Implements IConfigEditor for consistent API with GlobalConfigManager.
|
|
15
15
|
*/
|
|
16
16
|
class ProjectConfigManager {
|
|
17
|
+
gitRoot;
|
|
18
|
+
configPath;
|
|
19
|
+
projectConfig = null;
|
|
17
20
|
constructor(cwd) {
|
|
18
|
-
Object.defineProperty(this, "gitRoot", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(this, "configPath", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(this, "projectConfig", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: null
|
|
35
|
-
});
|
|
36
21
|
// Use git repository root
|
|
37
22
|
this.gitRoot = getGitRepositoryRoot(cwd);
|
|
38
23
|
this.configPath = this.gitRoot
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { SessionManager } from './sessionManager.js';
|
|
2
2
|
class GlobalSessionOrchestrator {
|
|
3
|
+
static instance;
|
|
4
|
+
projectManagers = new Map();
|
|
5
|
+
globalManager;
|
|
3
6
|
constructor() {
|
|
4
|
-
Object.defineProperty(this, "projectManagers", {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true,
|
|
8
|
-
value: new Map()
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(this, "globalManager", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: void 0
|
|
15
|
-
});
|
|
16
7
|
// Create a global session manager for single-project mode
|
|
17
8
|
this.globalManager = new SessionManager();
|
|
18
9
|
}
|
|
@@ -3,14 +3,7 @@ import { globalSessionOrchestrator } from './globalSessionOrchestrator.js';
|
|
|
3
3
|
// Mock SessionManager
|
|
4
4
|
vi.mock('./sessionManager.js', () => {
|
|
5
5
|
class MockSessionManager {
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(this, "sessions", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
value: new Map()
|
|
12
|
-
});
|
|
13
|
-
}
|
|
6
|
+
sessions = new Map();
|
|
14
7
|
getAllSessions() {
|
|
15
8
|
return Array.from(this.sessions.values());
|
|
16
9
|
}
|
|
@@ -7,68 +7,20 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
|
7
7
|
import { Effect } from 'effect';
|
|
8
8
|
import { FileSystemError, ConfigError } from '../types/errors.js';
|
|
9
9
|
export class ProjectManager {
|
|
10
|
+
currentMode;
|
|
11
|
+
currentProject;
|
|
12
|
+
projects = [];
|
|
13
|
+
worktreeServiceCache = new Map();
|
|
14
|
+
projectsDir;
|
|
15
|
+
// Multi-project discovery
|
|
16
|
+
projectCache = new Map();
|
|
17
|
+
discoveryWorkers = 4;
|
|
18
|
+
// Recent projects
|
|
19
|
+
static MAX_RECENT_PROJECTS = 5;
|
|
20
|
+
recentProjects = [];
|
|
21
|
+
dataPath;
|
|
22
|
+
configDir;
|
|
10
23
|
constructor() {
|
|
11
|
-
Object.defineProperty(this, "currentMode", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: void 0
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, "currentProject", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: void 0
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(this, "projects", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: []
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(this, "worktreeServiceCache", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: new Map()
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "projectsDir", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: void 0
|
|
40
|
-
});
|
|
41
|
-
// Multi-project discovery
|
|
42
|
-
Object.defineProperty(this, "projectCache", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
writable: true,
|
|
46
|
-
value: new Map()
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(this, "discoveryWorkers", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: 4
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(this, "recentProjects", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true,
|
|
57
|
-
writable: true,
|
|
58
|
-
value: []
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(this, "dataPath", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
configurable: true,
|
|
63
|
-
writable: true,
|
|
64
|
-
value: void 0
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(this, "configDir", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
writable: true,
|
|
70
|
-
value: void 0
|
|
71
|
-
});
|
|
72
24
|
// Initialize mode based on environment variables
|
|
73
25
|
const multiProjectRoot = process.env[ENV_VARS.MULTI_PROJECT_ROOT];
|
|
74
26
|
this.projectsDir = process.env[ENV_VARS.MULTI_PROJECT_ROOT];
|
|
@@ -554,13 +506,6 @@ export class ProjectManager {
|
|
|
554
506
|
})));
|
|
555
507
|
}
|
|
556
508
|
}
|
|
557
|
-
// Recent projects
|
|
558
|
-
Object.defineProperty(ProjectManager, "MAX_RECENT_PROJECTS", {
|
|
559
|
-
enumerable: true,
|
|
560
|
-
configurable: true,
|
|
561
|
-
writable: true,
|
|
562
|
-
value: 5
|
|
563
|
-
});
|
|
564
509
|
// Create singleton instance
|
|
565
510
|
let _instance = null;
|
|
566
511
|
export const projectManager = {
|
|
@@ -42,43 +42,15 @@ vi.mock('@xterm/headless', () => ({
|
|
|
42
42
|
}));
|
|
43
43
|
// Create a mock IPty class
|
|
44
44
|
class MockPty extends EventEmitter {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true,
|
|
57
|
-
value: vi.fn()
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(this, "write", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: vi.fn()
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(this, "onData", {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
configurable: true,
|
|
68
|
-
writable: true,
|
|
69
|
-
value: vi.fn((callback) => {
|
|
70
|
-
this.on('data', callback);
|
|
71
|
-
})
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, "onExit", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: vi.fn((callback) => {
|
|
78
|
-
this.on('exit', callback);
|
|
79
|
-
})
|
|
80
|
-
});
|
|
81
|
-
}
|
|
45
|
+
kill = vi.fn();
|
|
46
|
+
resize = vi.fn();
|
|
47
|
+
write = vi.fn();
|
|
48
|
+
onData = vi.fn((callback) => {
|
|
49
|
+
this.on('data', callback);
|
|
50
|
+
});
|
|
51
|
+
onExit = vi.fn((callback) => {
|
|
52
|
+
this.on('exit', callback);
|
|
53
|
+
});
|
|
82
54
|
}
|
|
83
55
|
describe('SessionManager Effect-based Operations', () => {
|
|
84
56
|
let sessionManager;
|
|
@@ -19,6 +19,9 @@ const { Terminal } = pkg;
|
|
|
19
19
|
const execAsync = promisify(exec);
|
|
20
20
|
const TERMINAL_CONTENT_MAX_LINES = 300;
|
|
21
21
|
export class SessionManager extends EventEmitter {
|
|
22
|
+
sessions;
|
|
23
|
+
waitingWithBottomBorder = new Map();
|
|
24
|
+
busyTimers = new Map();
|
|
22
25
|
async spawn(command, args, worktreePath) {
|
|
23
26
|
const spawnOptions = {
|
|
24
27
|
name: 'xterm-256color',
|
|
@@ -158,24 +161,6 @@ export class SessionManager extends EventEmitter {
|
|
|
158
161
|
}
|
|
159
162
|
constructor() {
|
|
160
163
|
super();
|
|
161
|
-
Object.defineProperty(this, "sessions", {
|
|
162
|
-
enumerable: true,
|
|
163
|
-
configurable: true,
|
|
164
|
-
writable: true,
|
|
165
|
-
value: void 0
|
|
166
|
-
});
|
|
167
|
-
Object.defineProperty(this, "waitingWithBottomBorder", {
|
|
168
|
-
enumerable: true,
|
|
169
|
-
configurable: true,
|
|
170
|
-
writable: true,
|
|
171
|
-
value: new Map()
|
|
172
|
-
});
|
|
173
|
-
Object.defineProperty(this, "busyTimers", {
|
|
174
|
-
enumerable: true,
|
|
175
|
-
configurable: true,
|
|
176
|
-
writable: true,
|
|
177
|
-
value: new Map()
|
|
178
|
-
});
|
|
179
164
|
this.sessions = new Map();
|
|
180
165
|
}
|
|
181
166
|
createSessionId() {
|
|
@@ -63,43 +63,15 @@ vi.mock('./worktreeService.js', () => ({
|
|
|
63
63
|
}));
|
|
64
64
|
// Create a mock IPty class
|
|
65
65
|
class MockPty extends EventEmitter {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
enumerable: true,
|
|
76
|
-
configurable: true,
|
|
77
|
-
writable: true,
|
|
78
|
-
value: vi.fn()
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(this, "write", {
|
|
81
|
-
enumerable: true,
|
|
82
|
-
configurable: true,
|
|
83
|
-
writable: true,
|
|
84
|
-
value: vi.fn()
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(this, "onData", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
configurable: true,
|
|
89
|
-
writable: true,
|
|
90
|
-
value: vi.fn((callback) => {
|
|
91
|
-
this.on('data', callback);
|
|
92
|
-
})
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(this, "onExit", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
configurable: true,
|
|
97
|
-
writable: true,
|
|
98
|
-
value: vi.fn((callback) => {
|
|
99
|
-
this.on('exit', callback);
|
|
100
|
-
})
|
|
101
|
-
});
|
|
102
|
-
}
|
|
66
|
+
kill = vi.fn();
|
|
67
|
+
resize = vi.fn();
|
|
68
|
+
write = vi.fn();
|
|
69
|
+
onData = vi.fn((callback) => {
|
|
70
|
+
this.on('data', callback);
|
|
71
|
+
});
|
|
72
|
+
onExit = vi.fn((callback) => {
|
|
73
|
+
this.on('exit', callback);
|
|
74
|
+
});
|
|
103
75
|
}
|
|
104
76
|
describe('SessionManager', () => {
|
|
105
77
|
let sessionManager;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { configReader } from './config/configReader.js';
|
|
2
2
|
export class ShortcutManager {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{ ctrl: true, key: 'd' },
|
|
11
|
-
{ key: 'escape' }, // Ctrl+[ is equivalent to Escape
|
|
12
|
-
{ ctrl: true, key: '[' },
|
|
13
|
-
]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
3
|
+
reservedKeys = [
|
|
4
|
+
{ ctrl: true, key: 'c' },
|
|
5
|
+
{ ctrl: true, key: 'd' },
|
|
6
|
+
{ key: 'escape' }, // Ctrl+[ is equivalent to Escape
|
|
7
|
+
{ ctrl: true, key: '[' },
|
|
8
|
+
];
|
|
9
|
+
constructor() { }
|
|
16
10
|
validateShortcut(shortcut) {
|
|
17
11
|
if (!shortcut || typeof shortcut !== 'object') {
|
|
18
12
|
return null;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { isWorktreeConfigEnabled } from '../utils/worktreeConfig.js';
|
|
2
2
|
class WorktreeConfigManager {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true,
|
|
8
|
-
value: null
|
|
9
|
-
});
|
|
10
|
-
}
|
|
3
|
+
static instance;
|
|
4
|
+
isExtensionAvailable = null;
|
|
5
|
+
constructor() { }
|
|
11
6
|
static getInstance() {
|
|
12
7
|
if (!WorktreeConfigManager.instance) {
|
|
13
8
|
WorktreeConfigManager.instance = new WorktreeConfigManager();
|
|
@@ -54,19 +54,9 @@ export function getWorktreeLastOpenedTime(worktreePath) {
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
export class WorktreeService {
|
|
57
|
+
rootPath;
|
|
58
|
+
gitRootPath;
|
|
57
59
|
constructor(rootPath) {
|
|
58
|
-
Object.defineProperty(this, "rootPath", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
writable: true,
|
|
62
|
-
value: void 0
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(this, "gitRootPath", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
writable: true,
|
|
68
|
-
value: void 0
|
|
69
|
-
});
|
|
70
60
|
this.rootPath = path.resolve(rootPath || process.cwd());
|
|
71
61
|
// Get the actual git repository root for worktree operations
|
|
72
62
|
this.gitRootPath = this.getGitRepositoryRoot();
|
package/dist/types/index.js
CHANGED
|
@@ -3,22 +3,14 @@ export const DEFAULT_SHORTCUTS = {
|
|
|
3
3
|
cancel: { key: 'escape' },
|
|
4
4
|
};
|
|
5
5
|
export class AmbiguousBranchError extends Error {
|
|
6
|
+
branchName;
|
|
7
|
+
matches;
|
|
6
8
|
constructor(branchName, matches) {
|
|
7
9
|
super(`Ambiguous branch '${branchName}' found in multiple remotes: ${matches
|
|
8
10
|
.map(m => m.fullRef)
|
|
9
11
|
.join(', ')}. Please specify which remote to use.`);
|
|
10
|
-
Object.defineProperty(this, "branchName", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: branchName
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "matches", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: matches
|
|
21
|
-
});
|
|
22
12
|
this.name = 'AmbiguousBranchError';
|
|
13
|
+
this.branchName = branchName;
|
|
14
|
+
this.matches = matches;
|
|
23
15
|
}
|
|
24
16
|
}
|