MCPcopy Index your code
hub / github.com/ChinaSiro/claude-code-sourcemap / eaY

Function eaY

package/cli.js:16486–16504  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

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
16485`),console.log(Y.join(`
16486`).trimEnd())}var Eq5=y(()=>{CU8();SP();I7()});var Ll8={};T8(Ll8,{autoModeDefaultsHandler:()=>aaY,autoModeCritiqueHandler:()=>eaY,autoModeConfigHandler:()=>saY});function Lq5(q){process.stdout.write(g6(q,null,2)+`
16487`)}function aaY(){Lq5(vL8())}function saY(){let q=Np6(),K=vL8();Lq5({allow:q?.allow?.length?q.allow:K.allow,soft_deny:q?.soft_deny?.length?q.soft_deny:K.soft_deny,environment:q?.environment?.length?q.environment:K.environment})}async function eaY(q){let K=Np6();if(!((K?.allow?.length??0)>0||(K?.soft_deny?.length??0)>0||(K?.environment?.length??0)>0)){process.stdout.write(`No custom auto mode rules found.
16488
16489Add rules to your settings file under autoMode.{allow, soft_deny, environment}.
16490Run \`claude auto-mode defaults\` to see the default rules for reference.
16491`);return}let z=q.model?A5(q.model):D5(),Y=vL8(),$=ab4(),A=aA7("allow",K?.allow??[],Y.allow)+aA7("soft_deny",K?.soft_deny??[],Y.soft_deny)+aA7("environment",K?.environment??[],Y.environment);process.stdout.write(`Analyzing your auto mode rules…
16492
16493`);let O;try{O=await CN({querySource:"auto_mode_critique",model:z,system:taY,skipSystemPromptPrefix:!0,max_tokens:4096,messages:[{role:"user",content:`Here is the full classifier system prompt that the auto mode classifier receives:
16494
16495<classifier_system_prompt>
16496`+$+`
16497</classifier_system_prompt>
16498
16499Here are the user's custom rules that REPLACE the corresponding default sections:
16500
16501`+A+`
16502Please critique these custom rules.`}]})}catch(j){process.stderr.write("Failed to analyze rules: "+d6(j)+`
16503`),process.exitCode=1;return}let w=O.content.find((j)=>j.type==="text");if(w?.type==="text")process.stdout.write(w.text+`
16504`);else process.stdout.write(`No critique was generated. Please try again.
16505`)}function aA7(q,K,_){if(K.length===0)return"";let z=K.map(($)=>"- "+$).join(`
16506`),Y=_.map(($)=>"- "+$).join(`
16507`);return"## "+q+` (custom rules replacing defaults)

Callers

nothing calls this directly

Calls 10

Np6Function · 0.85
A5Function · 0.85
D5Function · 0.85
vL8Function · 0.85
ab4Function · 0.85
aA7Function · 0.85
CNFunction · 0.85
d6Function · 0.85
writeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected