File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'vitest' ;
2+ import { selectMcpJsonDir } from './register.js' ;
3+
4+ describe ( 'selectMcpJsonDir' , ( ) => {
5+ it ( 'returns worktreePath when defined' , ( ) => {
6+ expect ( selectMcpJsonDir ( '/worktrees/my-task' , '/project' ) ) . toBe ( '/worktrees/my-task' ) ;
7+ } ) ;
8+
9+ it ( 'returns projectRoot when worktreePath is undefined' , ( ) => {
10+ expect ( selectMcpJsonDir ( undefined , '/project' ) ) . toBe ( '/project' ) ;
11+ } ) ;
12+
13+ it ( 'returns empty string when worktreePath is empty string (nullish coalescing only catches null/undefined)' , ( ) => {
14+ expect ( selectMcpJsonDir ( '' , '/project' ) ) . toBe ( '' ) ;
15+ } ) ;
16+ } ) ;
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ vi.mock('./core', () => ({
5454 if ( prop === 'agents' ) return mockAgents ;
5555 if ( prop === 'taskOrder' ) return mockTaskOrder ;
5656 if ( prop === 'collapsedTaskOrder' ) return [ ] ;
57+ if ( prop === 'availableAgents' ) return [ ] ;
5758 return undefined ;
5859 } ,
5960 } ) ,
Original file line number Diff line number Diff line change @@ -912,18 +912,22 @@ export function initMCPListeners(): () => void {
912912 skipPermissions : evt . skipPermissions ?? false ,
913913 } ;
914914
915+ const cmd = evt . agentCommand ?? 'claude' ;
916+ const matchedDef = store . availableAgents ?. find ( ( a ) => a . command === cmd ) ;
917+ const agentDef = matchedDef ?? {
918+ id : cmd ,
919+ name : cmd ,
920+ command : cmd ,
921+ args : evt . agentArgs ?? [ ] ,
922+ resume_args : [ ] ,
923+ skip_permissions_args : [ '--dangerously-skip-permissions' ] ,
924+ description : '' ,
925+ } ;
926+
915927 const agent : Agent = {
916928 id : evt . agentId ,
917929 taskId : evt . taskId ,
918- def : {
919- id : 'claude' ,
920- name : 'Claude Code' ,
921- command : evt . agentCommand ?? 'claude' ,
922- args : evt . agentArgs ?? [ ] ,
923- resume_args : [ ] ,
924- skip_permissions_args : [ '--dangerously-skip-permissions' ] ,
925- description : '' ,
926- } ,
930+ def : matchedDef ? { ...matchedDef , args : evt . agentArgs ?? matchedDef . args } : agentDef ,
927931 resumed : false ,
928932 status : 'running' ,
929933 exitCode : null ,
You can’t perform that action at this time.
0 commit comments