#!/usr/bin/env node
import {b}from'./chunk-A7KFOJ2F.js';import'./chunk-TYWB5IQJ.js';import'./chunk-UDUHSHO4.js';import'./chunk-FYDRENK7.js';import'./chunk-HXGYVS2N.js';import'./chunk-AO7ZSRME.js';import'./chunk-SHD27BQX.js';import'./chunk-EKZDFEJW.js';import'./chunk-T6IDXUUA.js';import'./chunk-JIXHEBGK.js';import'./chunk-QT2LKB3P.js';import'./chunk-5TAVYPOV.js';import*as g from'path';import e from'chalk';async function u(n,s,r){let a=s?g.resolve(s):process.cwd();if(!n){r.json?console.log(JSON.stringify({error:"Orchestration ID required"})):(console.log(e.red(`
Orchestration ID required.`)),console.log(e.gray(`Usage: paradigm team accept <orchestration-id>
`)));return}let l=new b(a),o=l.getOrchestration(n);if(!o){r.json?console.log(JSON.stringify({error:"Orchestration not found",id:n})):console.log(e.red(`
Orchestration not found: ${n}
`));return}if(o.status!=="completed"){r.json?console.log(JSON.stringify({error:"Cannot accept orchestration",reason:`Status is '${o.status}', expected 'completed'`})):(console.log(e.red(`
Cannot accept orchestration in '${o.status}' status.`)),console.log(e.gray(`Only completed orchestrations can be accepted.
`)));return}try{if(await l.accept(n,{note:r.note}),r.json){console.log(JSON.stringify({success:!0,id:n,status:"accepted",artifacts:o.artifacts.length}));return}if(console.log(),console.log(e.green("\u2501".repeat(60))),console.log(e.green("  \u2713 Orchestration Accepted")),console.log(e.green("\u2501".repeat(60))),console.log(),console.log(e.white(`  ID: ${n}`)),console.log(e.gray(`  Task: ${o.task.slice(0,50)}${o.task.length>50?"...":""}`)),r.note&&console.log(e.gray(`  Note: ${r.note}`)),console.log(),o.artifacts.length>0){console.log(e.cyan("  Artifacts accepted:"));for(let t of o.artifacts){let c=t.action==="created"?e.green("+"):t.action==="modified"?e.yellow("~"):e.red("-");console.log(`    ${c} ${t.path}`);}console.log();}o.parallelBuilderStats&&(console.log(e.cyan("  Parallel builder stats:")),console.log(e.gray(`    Sub-phases: ${o.parallelBuilderStats.totalSubPhases}`)),console.log(e.gray(`    Parallel builders: ${o.parallelBuilderStats.totalParallelBuilders}`)),console.log(e.gray(`    Files created: ${o.parallelBuilderStats.filesCreated}`)),console.log());}catch(t){r.json?console.log(JSON.stringify({error:t instanceof Error?t.message:String(t)})):console.log(e.red(`
Error: ${t instanceof Error?t.message:t}
`));}}async function p(n,s,r){let a=s?g.resolve(s):process.cwd();if(!n){r.json?console.log(JSON.stringify({error:"Orchestration ID required"})):(console.log(e.red(`
Orchestration ID required.`)),console.log(e.gray(`Usage: paradigm team reject <orchestration-id>
`)));return}let l=new b(a),o=l.getOrchestration(n);if(!o){r.json?console.log(JSON.stringify({error:"Orchestration not found",id:n})):console.log(e.red(`
Orchestration not found: ${n}
`));return}if(o.status!=="completed"){r.json?console.log(JSON.stringify({error:"Cannot reject orchestration",reason:`Status is '${o.status}', expected 'completed'`})):(console.log(e.red(`
Cannot reject orchestration in '${o.status}' status.`)),console.log(e.gray(`Only completed orchestrations can be rejected.
`)));return}try{if(await l.reject(n,{reason:r.reason,cleanup:r.cleanup}),r.json){console.log(JSON.stringify({success:!0,id:n,status:"rejected",cleanup:r.cleanup||!1}));return}if(console.log(),console.log(e.red("\u2501".repeat(60))),console.log(e.red("  \u2717 Orchestration Rejected")),console.log(e.red("\u2501".repeat(60))),console.log(),console.log(e.white(`  ID: ${n}`)),console.log(e.gray(`  Task: ${o.task.slice(0,50)}${o.task.length>50?"...":""}`)),r.reason&&console.log(e.gray(`  Reason: ${r.reason}`)),console.log(),r.cleanup&&o.artifacts.length>0){console.log(e.yellow("  Files cleaned up:"));let t=o.artifacts.filter(c=>c.action==="created");for(let c of t)console.log(e.gray(`    - ${c.path}`));console.log();}}catch(t){r.json?console.log(JSON.stringify({error:t instanceof Error?t.message:String(t)})):console.log(e.red(`
Error: ${t instanceof Error?t.message:t}
`));}}export{u as teamAcceptOrchestrationCommand,p as teamRejectOrchestrationCommand};