import{o as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{cn as o,on as s}from"./paths-Ci1iwL5Y.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{Iy as u,Ly as d,cC as f,lC as p}from"./loadAgentsDir-C_wFhytF.js";import{t as m}from"./WelcomeV2-BijS6i2Z.js";import{t as h}from"./useManagePlugins-B4kcqcyY.js";import{n as g,t as _}from"./MCPConnectionManager-D5a9ysw2.js";import{n as v}from"./onChangeAppState-BkRihYau.js";import{cwd as y}from"process";var b=e(t(),1);r(),d(),c(),g(),p(),s();var x=a();async function S(e){l(`tengu_setup_token_command`,{});let t=!o(),{ConsoleOAuthFlow:r}=await import(`./ConsoleOAuthFlow-Dyv4mI_o.js`);await new Promise(a=>{e.render((0,x.jsx)(f,{onChangeAppState:v,children:(0,x.jsx)(u,{children:(0,x.jsxs)(i,{flexDirection:`column`,gap:1,children:[(0,x.jsx)(m,{}),t&&(0,x.jsxs)(i,{flexDirection:`column`,children:[(0,x.jsx)(n,{color:`warning`,children:`Warning: You already have authentication configured via environment variable or API key helper.`}),(0,x.jsx)(n,{color:`warning`,children:`The setup-token command will create a new OAuth token which you can use instead.`})]}),(0,x.jsx)(r,{onDone:()=>{a()},mode:`setup-token`,startingMessage:`This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required.`})]})})}))}),e.unmount(),process.exit(0)}var C=b.lazy(()=>import(`./Doctor-CRrE5Sf4.js`).then(e=>({default:e.Doctor})));function w({onDone:e}){return h(),(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(C,{onDone:e})})}async function T(e){l(`tengu_doctor_command`,{}),await new Promise(t=>{e.render((0,x.jsx)(f,{children:(0,x.jsx)(u,{children:(0,x.jsx)(_,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,x.jsx)(w,{onDone:()=>{t()}})})})}))}),e.unmount(),process.exit(0)}async function E(e,t){let{setup:n}=await import(`./setup-CDxkPTCq.js`);await n(y(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-CuVHbwyW.js`);await new Promise(n=>{let i=[];e&&i.push(e),t.force&&i.push(`--force`),r.call(e=>{n(),process.exit(+!!e.includes(`failed`))},{},i)})}export{T as doctorHandler,E as installHandler,S as setupTokenHandler};