| 16484 | `),_.forEach((z)=>{let Y=K[z];if(console.log(` ${t6.pointer} ${z}`),Y?.source){let $=Y.source;if($.source==="github")console.log(` Source: GitHub (${$.repo})`);else if($.source==="git")console.log(` Source: Git (${$.url})`);else if($.source==="url")console.log(` Source: URL (${$.url})`);else if($.source==="directory")console.log(` Source: Directory (${$.path})`);else if($.source==="file")console.log(` Source: File (${$.path})`)}console.log("")}),gA()}catch(K){TK8(K,"list marketplaces")}}async function SaY(q,K){if(K.cowork)ty(!0);try{await Mh6(q),Sz(),d("tengu_marketplace_removed",{marketplace_name:q}),gA(`${t6.tick} Successfully removed marketplace: ${q}`)}catch(_){TK8(_,"remove marketplace")}}async function CaY(q,K){if(K.cowork)ty(!0);try{if(q)console.log(`Updating marketplace: ${q}...`),await q56(q,(_)=>{console.log(_)}),Sz(),d("tengu_marketplace_updated",{marketplace_name:q}),gA(`${t6.tick} Successfully updated marketplace: ${q}`);else{let _=await r_(),z=Object.keys(_);if(z.length===0)gA("No marketplaces configured");console.log(`Updating ${z.length} marketplace(s)...`),await q0K(),Sz(),d("tengu_marketplace_updated_all",{count:z.length}),gA(`${t6.tick} Successfully updated ${z.length} marketplace(s)`)}}catch(_){TK8(_,"update marketplace(s)")}}async function baY(q,K){if(K.cowork)ty(!0);let _=K.scope||"user";if(K.cowork&&_!=="user")o3("--cowork can only be used with user scope");if(!e0.includes(_))o3(`Invalid scope: ${_}. Must be one of: ${e0.join(", ")}.`);let{name:z,marketplace:Y}=Z4(q);d("tengu_plugin_install_command",{_PROTO_plugin_name:z,...Y&&{_PROTO_marketplace_name:Y},scope:_}),await D65(q,_)}async function xaY(q,K){if(K.cowork)ty(!0);let _=K.scope||"user";if(K.cowork&&_!=="user")o3("--cowork can only be used with user scope");if(!e0.includes(_))o3(`Invalid scope: ${_}. Must be one of: ${e0.join(", ")}.`);let{name:z,marketplace:Y}=Z4(q);d("tengu_plugin_uninstall_command",{_PROTO_plugin_name:z,...Y&&{_PROTO_marketplace_name:Y},scope:_}),await f65(q,_,K.keepData)}async function IaY(q,K){if(K.cowork)ty(!0);let _;if(K.scope){if(!e0.includes(K.scope))o3(`Invalid scope "${K.scope}". Valid scopes: ${e0.join(", ")}`);_=K.scope}if(K.cowork&&_!==void 0&&_!=="user")o3("--cowork can only be used with user scope");if(K.cowork&&_===void 0)_="user";let{name:z,marketplace:Y}=Z4(q);d("tengu_plugin_enable_command",{_PROTO_plugin_name:z,...Y&&{_PROTO_marketplace_name:Y},scope:_??"auto"}),await Z65(q,_)}async function uaY(q,K){if(K.all&&q)o3("Cannot use --all with a specific plugin");if(!K.all&&!q)o3("Please specify a plugin name or use --all to disable all plugins");if(K.cowork)ty(!0);if(K.all){if(K.scope)o3("Cannot use --scope with --all");d("tengu_plugin_disable_command",{}),await T65();return}let _;if(K.scope){if(!e0.includes(K.scope))o3(`Invalid scope "${K.scope}". Valid scopes: ${e0.join(", ")}`);_=K.scope}if(K.cowork&&_!==void 0&&_!=="user")o3("--cowork can only be used with user scope");if(K.cowork&&_===void 0)_="user";let{name:z,marketplace:Y}=Z4(q);d("tengu_plugin_disable_command",{_PROTO_plugin_name:z,...Y&&{_PROTO_marketplace_name:Y},scope:_??"auto"}),await G65(q,_)}async function maY(q,K){if(K.cowork)ty(!0);let{name:_,marketplace:z}=Z4(q);d("tengu_plugin_update_command",{_PROTO_plugin_name:_,...z&&{_PROTO_marketplace_name:z}});let Y="user";if(K.scope){if(!rH6.includes(K.scope))o3(`Invalid scope "${K.scope}". Valid scopes: ${rH6.join(", ")}`);Y=K.scope}if(K.cowork&&Y!=="user")o3("--cowork can only be used with user scope");await v65(q,Y)}var Ax=y(()=>{bq();v8();k8();bA7();y8();E8();Jy();wF8();pX();qd();Nw();AN6();u47();hP();bj();i47();l8()});var kq5={};T8(kq5,{install:()=>QaY});import{homedir as paY}from"node:os";import{join as BaY}from"node:path";function gaY(){let q=a1.platform==="win32",K=paY();if(q)return BaY(K,".local","bin","claude.exe").replace(/\//g,"\\");return"~/.local/bin/claude"}function vq5(q){let K=z6(5),{messages:_}=q;if(_.length===0)return null;let z;if(K[0]===Symbol.for("react.memo_cache_sentinel"))z=U9.default.createElement(u,null,U9.default.createElement(k,{color:"warning"},U9.default.createElement(M56,{status:"warning",withSpace:!0}),"Setup notes:")),K[0]=z;else z=K[0];let Y;if(K[1]!==_)Y=_.map(FaY),K[1]=_,K[2]=Y;else Y=K[2];let $;if(K[3]!==Y)$=U9.default.createElement(u,{flexDirection:"column",gap:0,marginBottom:1},z,Y),K[3]=Y,K[4]=$;else $=K[4];return $}function FaY(q,K){return U9.default.createElement(u,{key:K,marginLeft:2},U9.default.createElement(k,{dimColor:!0},"• ",q))}function UaY({onDone:q,force:K,target:_}){let[z,Y]=U9.useState({type:"checking"});return U9.useEffect(()=>{async function $(){try{N(`Install: Starting installation process (force=${K}, target=${_})`);let A=_||N7()?.autoUpdatesChannel||"latest";Y({type:"installing",version:A}),N(`Install: Calling installLatest(channelOrVersion=${A}, forceReinstall=${K})`);let O=await I26(A,K);if(N(`Install: installLatest returned version=${O.latestVersion}, wasUpdated=${O.wasUpdated}, lockFailed=${O.lockFailed}`),O.lockFailed)throw Error("Could not install - another process is currently installing Claude. Please try again in a moment.");if(!O.latestVersion)N("Install: Failed to retrieve version information during install",{level:"error"});if(!O.wasUpdated)N("Install: Already up to date");Y({type:"setting-up"});let w=await x26(!0);if(N(`Install: Setup launcher completed with ${w.length} messages`),w.length>0)w.forEach((P)=>N(`Install: Setup message: ${P.message}`));N("Install: Cleaning up npm installations after successful install");let{removed:j,errors:H,warnings:J}=await Jn1();if(j>0)N(`Cleaned up ${j} npm installation(s)`);if(H.length>0)N(`Cleanup errors: ${H.join(", ")}`);let M=await Hn1();if(M.length>0)N(`Shell alias cleanup: ${M.map((P)=>P.message).join("; ")}`);if(d("tengu_claude_install_command",{has_version:O.latestVersion?1:0,forced:K?1:0}),_==="latest"||_==="stable")W7("userSettings",{autoUpdatesChannel:_}),N(`Install: Saved autoUpdatesChannel=${_} to user settings`);let X=[...J,...M.map((P)=>P.message)];if(w.length>0)Y({type:"set-up",messages:w.map((P)=>P.message)}),setTimeout(Y,2000,{type:"success",version:O.latestVersion||"current",setupMessages:[...w.map((P)=>P.message),...X]});else N("Install: Shell PATH already configured"),Y({type:"success",version:O.latestVersion||"current",setupMessages:X.length>0?X:void 0})}catch(A){N(`Install command failed: ${A}`,{level:"error"}),Y({type:"error",message:d6(A)})}}$()},[K,_]),U9.useEffect(()=>{if(z.type==="success")setTimeout(q,2000,"Claude Code installation completed successfully",{display:"system"});else if(z.type==="error")setTimeout(q,3000,"Claude Code installation failed",{display:"system"})},[z,q]),U9.default.createElement(u,{flexDirection:"column",marginTop:1},z.type==="checking"&&U9.default.createElement(k,{color:"claude"},"Checking installation status..."),z.type==="cleaning-npm"&&U9.default.createElement(k,{color:"warning"},"Cleaning up old npm installations..."),z.type==="installing"&&U9.default.createElement(k,{color:"claude"},"Installing Claude Code native build ",z.version,"..."),z.type==="setting-up"&&U9.default.createElement(k,{color:"claude"},"Setting up launcher and shell integration..."),z.type==="set-up"&&U9.default.createElement(vq5,{messages:z.messages}),z.type==="success"&&U9.default.createElement(u,{flexDirection:"column",gap:1},U9.default.createElement(u,null,U9.default.createElement(M56,{status:"success",withSpace:!0}),U9.default.createElement(k,{color:"success",bold:!0},"Claude Code successfully installed!")),U9.default.createElement(u,{marginLeft:2,flexDirection:"column",gap:1},z.version!=="current"&&U9.default.createElement(u,null,U9.default.createElement(k,{dimColor:!0},"Version: "),U9.default.createElement(k,{color:"claude"},z.version)),U9.default.createElement(u,null,U9.default.createElement(k,{dimColor:!0},"Location: "),U9.default.createElement(k,{color:"text"},gaY()))),U9.default.createElement(u,{marginLeft:2,flexDirection:"column",gap:1},U9.default.createElement(u,{marginTop:1},U9.default.createElement(k,{dimColor:!0},"Next: Run "),U9.default.createElement(k,{color:"claude",bold:!0},"claude --help"),U9.default.createElement(k,{dimColor:!0}," to get started"))),z.setupMessages&&U9.default.createElement(vq5,{messages:z.setupMessages})),z.type==="error"&&U9.default.createElement(u,{flexDirection:"column",gap:1},U9.default.createElement(u,null,U9.default.createElement(M56,{status:"error",withSpace:!0}),U9.default.createElement(k,{color:"error"},"Installation failed")),U9.default.createElement(k,{color:"error"},z.message),U9.default.createElement(u,{marginTop:1},U9.default.createElement(k,{dimColor:!0},"Try running with --force to override checks"))))}var U9,QaY;var Vq5=y(()=>{q8();k8();Ig8();s6();_8();y_();y8();PQ();U1();U9=O6(D6(),1);QaY={type:"local-jsx",name:"install",description:"Install Claude Code native build",argumentHint:"[options]",async call(q,K,_){let z=_.includes("--force"),$=_.filter((O)=>!O.startsWith("--"))[0],{unmount:A}=await vu(U9.default.createElement(UaY,{onDone:(O,w)=>{A(),q(O,w)},force:z,target:$}))}}});var yl8={};T8(yl8,{setupTokenHandler:()=>caY,installHandler:()=>raY,doctorHandler:()=>iaY});import{cwd as daY}from"process";async function caY(q){d("tengu_setup_token_command",{});let K=!WJ(),{ConsoleOAuthFlow:_}=await Promise.resolve().then(() => (Ie6(),NqK));await new Promise((z)=>{q.render(vZ.default.createElement(LJ,{onChangeAppState:Ss},vZ.default.createElement(WM,null,vZ.default.createElement(u,{flexDirection:"column",gap:1},vZ.default.createElement(Hl8,null),K&&vZ.default.createElement(u,{flexDirection:"column"},vZ.default.createElement(k,{color:"warning"},"Warning: You already have authentication configured via environment variable or API key helper."),vZ.default.createElement(k,{color:"warning"},"The setup-token command will create a new OAuth token which you can use instead.")),vZ.default.createElement(_,{onDone:()=>{z()},mode:"setup-token",startingMessage:"This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required."})))))}),q.unmount(),process.exit(0)}function naY(q){let K=z6(2),{onDone:_}=q;Rc8();let z;if(K[0]!==_)z=vZ.default.createElement(vZ.default.Suspense,{fallback:null},vZ.default.createElement(laY,{onDone:_})),K[0]=_,K[1]=z;else z=K[1];return z}async function iaY(q){d("tengu_doctor_command",{}),await new Promise((K)=>{q.render(vZ.default.createElement(LJ,null,vZ.default.createElement(WM,null,vZ.default.createElement(tg8,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1},vZ.default.createElement(naY,{onDone:()=>{K()}})))))}),q.unmount(),process.exit(0)}async function raY(q,K){let{setup:_}=await Promise.resolve().then(() => (Gl8(),Zl8));await _(daY(),"default",!1,!1,void 0,!1);let{install:z}=await Promise.resolve().then(() => (Vq5(),kq5));await new Promise((Y)=>{let $=[];if(q)$.push(q);if(K.force)$.push("--force");z.call((A)=>{Y(),process.exit(A.includes("failed")?1:0)},{},$)})}var vZ,laY;var El8=y(()=>{q8();LA7();B$7();s6();dU();k8();Z56();C7();tS6();G7();vZ=O6(D6(),1);laY=vZ.default.lazy(()=>Promise.resolve().then(() => (X47(),xkK)).then((q)=>({default:q.Doctor})))});var yq5={};T8(yq5,{agentsHandler:()=>oaY});function Nq5(q){let K=RU8(q),_=[q.agentType];if(K)_.push(K);if(q.memory)_.push(`${q.memory} memory`);return _.join(" · ")}async function oaY(){let q=Z8(),{allAgents:K}=await VC(q),_=AN(K),z=LU8(K,_),Y=[],$=0;for(let{label:A,source:O}of Dq8){let w=z.filter((j)=>j.source===O).sort(SU8);if(w.length===0)continue;Y.push(`${A}:`);for(let j of w)if(j.overriddenBy){let H=hU8(j.overriddenBy);Y.push(` (shadowed by ${H}) ${Nq5(j)}`)}else Y.push(` ${Nq5(j)}`),$++;Y.push("")}if(Y.length===0)console.log("No agents found.");else console.log(`${$} active agents |