refactor(agent-dispatcher): split into 4 focused modules (SOLID Phase 2)
This commit is contained in:
parent
54b1c60810
commit
450756f540
7 changed files with 326 additions and 252 deletions
|
|
@ -205,7 +205,6 @@ import {
|
|||
isSidecarAlive,
|
||||
setSidecarAlive,
|
||||
waitForPendingPersistence,
|
||||
detectWorktreeFromCwd,
|
||||
} from './agent-dispatcher';
|
||||
|
||||
// Stop any previous dispatcher between tests so `unlistenMsg` is null and start works
|
||||
|
|
@ -624,32 +623,6 @@ describe('agent-dispatcher', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('detectWorktreeFromCwd', () => {
|
||||
it('detects Claude Code worktree path', () => {
|
||||
const result = detectWorktreeFromCwd('/home/user/project/.claude/worktrees/my-session');
|
||||
expect(result).toBe('/.claude/worktrees/my-session');
|
||||
});
|
||||
|
||||
it('detects Codex worktree path', () => {
|
||||
const result = detectWorktreeFromCwd('/home/user/project/.codex/worktrees/task-1');
|
||||
expect(result).toBe('/.codex/worktrees/task-1');
|
||||
});
|
||||
|
||||
it('detects Cursor worktree path', () => {
|
||||
const result = detectWorktreeFromCwd('/home/user/project/.cursor/worktrees/feature-x');
|
||||
expect(result).toBe('/.cursor/worktrees/feature-x');
|
||||
});
|
||||
|
||||
it('returns null for non-worktree CWD', () => {
|
||||
expect(detectWorktreeFromCwd('/home/user/project')).toBeNull();
|
||||
expect(detectWorktreeFromCwd('/tmp/work')).toBeNull();
|
||||
});
|
||||
|
||||
it('returns null for empty string', () => {
|
||||
expect(detectWorktreeFromCwd('')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('init event CWD worktree detection', () => {
|
||||
beforeEach(async () => {
|
||||
await startAgentDispatcher();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue