import{a as o,b as m}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var c={name:"ag-team",summary:"manage multi-agent teams",usage:"ag-team <create|delete|list|add|remove> [args]",options:["  create  <name> [--desc <description>]","  delete  <name>","  list","  add     <team-name> <agent-id>","  remove  <team-name> <agent-id>","  --help  display this help and exit"]},l={name:"ag-team",async execute(s,i){if(m(s))return o(c);let d=i.bash?.services?.teamManager;if(!d)return{stdout:"",stderr:`ag-team: team manager not available
`,exitCode:1};let r=s[0]||"list";switch(r){case"create":{let e=s[1];if(!e)return{stdout:"",stderr:`ag-team: missing team name
`,exitCode:1};let t=s.indexOf("--desc"),a=t!==-1?s[t+1]:void 0;try{let n=d.createTeam({name:e,description:a});return{stdout:`Created team ${n.id}: ${n.name}
`,stderr:"",exitCode:0}}catch(n){return{stdout:"",stderr:`ag-team: ${n instanceof Error?n.message:String(n)}
`,exitCode:1}}}case"delete":{let e=s[1];return e?d.deleteTeam(e)?{stdout:`Deleted team ${e}
`,stderr:"",exitCode:0}:{stdout:"",stderr:`ag-team: team "${e}" not found
`,exitCode:1}:{stdout:"",stderr:`Usage: ag-team delete <name>
`,exitCode:1}}case"list":{let e=d.listTeams();if(e.length===0)return{stdout:`No teams.
`,stderr:"",exitCode:0};let t=`Teams:
`;for(let a of e){let n=a.agents.length;t+=`  ${a.name} (${n} agent${n!==1?"s":""})`,a.description&&(t+=` \u2014 ${a.description}`),t+=`
`}return{stdout:t,stderr:"",exitCode:0}}case"add":{let e=s[1],t=s[2];if(!e||!t)return{stdout:"",stderr:`Usage: ag-team add <team-name> <agent-id>
`,exitCode:1};try{return d.addAgentToTeam(e,t),{stdout:`Added ${t} to team ${e}
`,stderr:"",exitCode:0}}catch(a){return{stdout:"",stderr:`ag-team: ${a instanceof Error?a.message:String(a)}
`,exitCode:1}}}case"remove":{let e=s[1],t=s[2];if(!e||!t)return{stdout:"",stderr:`Usage: ag-team remove <team-name> <agent-id>
`,exitCode:1};try{return d.removeAgentFromTeam(e,t),{stdout:`Removed ${t} from team ${e}
`,stderr:"",exitCode:0}}catch(a){return{stdout:"",stderr:`ag-team: ${a instanceof Error?a.message:String(a)}
`,exitCode:1}}}default:return{stdout:"",stderr:`ag-team: unknown subcommand: ${r}
`,exitCode:1}}}};export{l as agTeamCommand};
