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

Function VSK

package/cli.js:6236–6238  ·  view source on GitHub ↗
(q,K,_)

Source from the content-addressed store, hash-verified

6234
6235Respond with ONLY the JSON object, no markdown formatting:
6236{"relevant_indices": [2, 5, 0]}`;var C57=y(()=>{_8();E8();aq();_K();nq6();l8()});import{sep as MGY}from"path";function zU8(q,K,_){let z=r1();if(!K||!q.projectPath||q.projectPath===z)return{isCrossProject:!1};{let O=SA(q);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${E4([q.projectPath])} && claude --resume ${O}`,projectPath:q.projectPath}}if(_.some((O)=>q.projectPath===O||q.projectPath.startsWith(O+MGY)))return{isCrossProject:!0,isSameRepoWorktree:!0,projectPath:q.projectPath};let $=SA(q);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${E4([q.projectPath])} && claude --resume ${$}`,projectPath:q.projectPath}}var b57=y(()=>{v8();NX();_K()});var PSK={};T8(PSK,{filterResumableSessions:()=>XSK,call:()=>PGY});function MSK(q){switch(q.resultType){case"sessionNotFound":return`Session ${$8.bold(q.arg)} was not found.`;case"multipleMatches":return`Found ${q.count} sessions matching ${$8.bold(q.arg)}. Please use /resume to pick a specific session.`}}function x57(q){let K=z6(10),{message:_,args:z,onDone:Y}=q,$,A;if(K[0]!==Y)$=()=>{let H=setTimeout(Y,0);return()=>clearTimeout(H)},A=[Y],K[0]=Y,K[1]=$,K[2]=A;else $=K[1],A=K[2];p9.useEffect($,A);let O;if(K[3]!==z)O=p9.createElement(k,{dimColor:!0},t6.pointer," /resume ",z),K[3]=z,K[4]=O;else O=K[4];let w;if(K[5]!==_)w=p9.createElement(s8,null,p9.createElement(k,null,_)),K[5]=_,K[6]=w;else w=K[6];let j;if(K[7]!==O||K[8]!==w)j=p9.createElement(u,{flexDirection:"column"},O,w),K[7]=O,K[8]=w,K[9]=j;else j=K[9];return j}function XGY({onDone:q,onResume:K}){let[_,z]=p9.useState([]),[Y,$]=p9.useState([]),[A,O]=p9.useState(!0),[w,j]=p9.useState(!1),[H,J]=p9.useState(!1),{rows:M}=t1(),X=RN(),P=p9.useCallback(async(G,Z)=>{O(!0);try{let T=G?await I57():await YU8(Z),v=XSK(T,N8());if(v.length===0){q("No conversations found to resume");return}z(v)}catch(T){q("Failed to load conversations")}finally{O(!1)}},[q]);p9.useEffect(()=>{async function G(){let Z=await As(r1());$(Z),P(!1,Z)}G()},[P]);let W=p9.useCallback(()=>{let G=!H;J(G),P(G,Y)},[H,P,Y]);async function D(G){let Z=BL(SA(G));if(!Z){q("Failed to resume conversation");return}let T=qR(G)?await om(G):G,v=zU8(T,H,Y);if(v.isCrossProject){if(v.isSameRepoWorktree){j(!0),K(Z,T,"slash_command_picker");return}let V=await XX(v.command);if(V)process.stdout.write(V);let E=["","This conversation is from a different directory.","","To resume, run:",` ${v.command}`,"","(Command copied to clipboard)",""].join(`
6237`);q(E,{display:"user"});return}j(!0),K(Z,T,"slash_command_picker")}function f(){q("Resume cancelled",{display:"system"})}if(A)return p9.createElement(u,null,p9.createElement(IK,null),p9.createElement(k,null," Loading conversations…"));if(w)return p9.createElement(u,null,p9.createElement(IK,null),p9.createElement(k,null," Resuming conversation…"));return p9.createElement(KU8,{logs:_,maxHeight:X?Math.floor(M/2):M-2,onCancel:f,onSelect:D,onLogsChanged:()=>P(H,Y),showAllProjects:H,onToggleAllProjects:W,onAgenticSearch:_U8})}function XSK(q,K){return q.filter((_)=>!_.isSidechain&&SA(_)!==K)}var p9,PGY=async(q,K,_)=>{let z=async(j,H,J)=>{try{await K.resume?.(j,H,J),q(void 0,{display:"skip"})}catch(M){H6(M),q(`Failed to resume: ${M.message}`)}},Y=_?.trim();if(!Y)return p9.createElement(XGY,{key:Date.now(),onDone:q,onResume:z});let $=await As(r1()),A=await YU8($);if(A.length===0)return p9.createElement(x57,{message:"No conversations found to resume.",args:Y,onDone:()=>q("No conversations found to resume.")});let O=BL(Y);if(O){let j=A.filter((J)=>SA(J)===O).sort((J,M)=>M.modified.getTime()-J.modified.getTime());if(j.length>0){let J=j[0],M=qR(J)?await om(J):J;return z(O,M,"slash_command_session_id"),null}let H=await f68(O);if(H)return z(O,H,"slash_command_session_id"),null}if(Js()){let j=await kd(Y,{exact:!0});if(j.length===1){let H=j[0],J=SA(H);if(J){let M=qR(H)?await om(H):H;return z(J,M,"slash_command_title"),null}}if(j.length>1){let H=MSK({resultType:"multipleMatches",arg:Y,count:j.length});return p9.createElement(x57,{message:H,args:Y,onDone:()=>q(H)})}}let w=MSK({resultType:"sessionNotFound",arg:Y});return p9.createElement(x57,{message:w,args:Y,onDone:()=>q(w)})};var WSK=y(()=>{q8();x3();bq();v8();R57();gK();Q2();CU();t4();YM();s6();C57();b57();a78();E8();_K();jm();p9=O6(D6(),1)});var WGY,DSK;var fSK=y(()=>{WGY={type:"local-jsx",name:"resume",description:"Resume a previous conversation",aliases:["continue"],argumentHint:"[conversation id or search term]",load:()=>Promise.resolve().then(() => (WSK(),PSK))},DSK=WGY});function jq8(){return g8("tengu_review_bughunter_config",null)?.enabled===!0}var u57=y(()=>{o1()});async function ZSK(){if(!d7())return null;try{let{accessToken:q,orgUUID:K}=await pH();return(await $1.get(`${u7().BASE_API_URL}/v1/ultrareview/quota`,{headers:{...UY(q),"x-organization-uuid":K},timeout:5000})).data}catch(q){return N(`fetchUltrareviewQuota failed: ${q}`),null}}var GSK=y(()=>{CK();H3();G7();_8();VM()});function vSK(){TSK=!0}async function kSK(){if(W$6()||LG6())return{kind:"proceed",billingNote:""};let[q,K]=await Promise.all([ZSK(),pE6().catch(()=>null)]);if(!q)return{kind:"proceed",billingNote:""};if(q.reviews_remaining>0)return{kind:"proceed",billingNote:` This is free ultrareview ${q.reviews_used+1} of ${q.reviews_limit}.`};if(!K)return{kind:"proceed",billingNote:""};let _=K.extra_usage;if(!_?.is_enabled)return d("tengu_review_overage_not_enabled",{}),{kind:"not-enabled"};let z=_.monthly_limit,Y=_.used_credits??0,$=z===null||z===void 0?1/0:z-Y;if($<10)return d("tengu_review_overage_low_balance",{available:$}),{kind:"low-balance",available:$};if(!TSK)return d("tengu_review_overage_dialog_shown",{}),{kind:"needs-confirm"};return{kind:"proceed",billingNote:" This review bills as Extra Usage."}}async function VSK(q,K,_){let z=await Ix8();if(!z.eligible){let W=z.errors.filter((D)=>D.type!=="no_remote_environment");if(W.length>0)return d("tengu_review_remote_precondition_failed",{precondition_errors:W.map((f)=>f.type).join(",")}),[{type:"text",text:`Ultrareview cannot launch:
6238${W.map(ux8).join(`
6239`)}`}]}let Y=_??"",$=q.trim(),A=/^\d+$/.test($),O="env_011111111111111111111113",w=g8("tengu_review_bughunter_config",null),j=(W,D,f)=>{if(typeof W!=="number"||!Number.isFinite(W))return D;let G=Math.floor(W);if(G<=0)return D;return f!==void 0&&G>f?D:G},H={BUGHUNTER_DRY_RUN:"1",BUGHUNTER_FLEET_SIZE:String(j(w?.fleet_size,5,20)),BUGHUNTER_MAX_DURATION:String(j(w?.max_duration_minutes,10,25)),BUGHUNTER_AGENT_TIMEOUT:String(j(w?.agent_timeout_seconds,600,1800)),BUGHUNTER_TOTAL_WALLCLOCK:String(j(w?.total_wallclock_minutes,22,27)),...process.env.BUGHUNTER_DEV_BUNDLE_B64&&{BUGHUNTER_DEV_BUNDLE_B64:process.env.BUGHUNTER_DEV_BUNDLE_B64}},J,M,X;if(A){let W=await Dh();if(!W||W.host!=="github.com")return d("tengu_review_remote_precondition_failed",{}),null;J=await Lj6({initialMessage:null,description:`ultrareview: ${W.owner}/${W.name}#${$}`,signal:K.abortController.signal,branchName:`refs/pull/${$}/head`,environmentId:O,environmentVariables:{BUGHUNTER_PR_NUMBER:$,BUGHUNTER_REPOSITORY:`${W.owner}/${W.name}`,...H}}),M=`/ultrareview ${$}`,X=`${W.owner}/${W.name}#${$}`}else{let W=await dT()||"main",{stdout:D,code:f}=await a8(L7(),["merge-base",W,"HEAD"],{preserveOutputOnError:!1}),G=D.trim();if(f!==0||!G)return d("tengu_review_remote_precondition_failed",{}),[{type:"text",text:`Could not find merge-base with ${W}. Make sure you're in a git repo with a ${W} branch.`}];let{stdout:Z,code:T}=await a8(L7(),["diff","--shortstat",G],{preserveOutputOnError:!1});if(T===0&&!Z.trim())return d("tengu_review_remote_precondition_failed",{}),[{type:"text",text:`No changes against the ${W} fork point. Make some commits or stage files first.`}];if(J=await Lj6({initialMessage:null,description:`ultrareview: ${W}`,signal:K.abortController.signal,useBundle:!0,environmentId:O,environmentVariables:{BUGHUNTER_BASE_BRANCH:G,...H}}),!J)return d("tengu_review_remote_teleport_failed",{}),[{type:"text",text:"Repo is too large. Push a PR and use `/ultrareview <PR#>` instead."}];M="/ultrareview",X=W}if(!J)return d("tengu_review_remote_teleport_failed",{}),null;mx8({remoteTaskType:"ultrareview",session:J,command:M,context:K,isRemoteReview:!0}),d("tengu_review_remote_launched",{});let P=Rj6(J.id);return[{type:"text",text:`Ultrareview launched for ${X} (~10–20 min, runs in the cloud). Track: ${P}${Y} Findings arrive via task-notification. Briefly acknowledge the launch to the user without repeating the target or URL — both are already visible in the tool output above.`}]}var TSK=!1;var NSK=y(()=>{o1();k8();GSK();fb8();PK6();G7();mZ();XK();E5();am()});function ySK(q){let K=z6(15),{onProceed:_,onCancel:z}=q,[Y,$]=Vd.useState(!1),A;if(K[0]===Symbol.for("react.memo_cache_sentinel"))A=new AbortController,K[0]=A;else A=K[0];let O=Vd.useRef(A),w;if(K[1]!==z||K[2]!==_)w=(f)=>{if(f==="proceed")$(!0),_(O.current.signal).catch(()=>$(!1));else z()},K[1]=z,K[2]=_,K[3]=w;else w=K[3];let j=w,H;if(K[4]!==z)H=()=>{O.current.abort(),z()},K[4]=z,K[5]=H;else H=K[5];let J=H,M;if(K[6]===Symbol.for("react.memo_cache_sentinel"))M=[{label:"Proceed with Extra Usage billing",value:"proceed"},{label:"Cancel",value:"cancel"}],K[6]=M;else M=K[6];let X=M,P;if(K[7]===Symbol.for("react.memo_cache_sentinel"))P=Vd.default.createElement(k,null,"Your free ultrareviews for this organization are used. Further reviews bill as Extra Usage (pay-per-use)."),K[7]=P;else P=K[7];let W;if(K[8]!==J||K[9]!==j||K[10]!==Y)W=Vd.default.createElement(u,{flexDirection:"column",gap:1},P,Y?Vd.default.createElement(k,{color:"background"},"Launching…"):Vd.default.createElement(H1,{options:X,onChange:j,onCancel:J})),K[8]=J,K[9]=j,K[10]=Y,K[11]=W;else W=K[11];let D;if(K[12]!==J||K[13]!==W)D=Vd.default.createElement(R1,{title:"Ultrareview billing",onCancel:J,color:"background"},W),K[12]=J,K[13]=W,K[14]=D;else D=K[14];return D}var Vd;var ESK=y(()=>{q8();p3();e4();s6();Vd=O6(D6(),1)});var hSK={};T8(hSK,{call:()=>fGY});function DGY(q){return q.map((K)=>K.type==="text"?K.text:"").filter(Boolean).join(`
6240`)}async function LSK(q,K,_,z,Y){let $=await VSK(q,K,z);if(Y?.aborted)return;if($)_(DGY($),{shouldQuery:!0});else _("Ultrareview failed to launch the remote session. Check that this is a GitHub repo and try again.",{display:"system"})}var RSK,fGY=async(q,K,_)=>{let z=await kSK();if(z.kind==="not-enabled")return q("Free ultrareviews used. Enable Extra Usage at https://claude.ai/settings/billing to continue.",{display:"system"}),null;if(z.kind==="low-balance")return q(`Balance too low to launch ultrareview ($${z.available.toFixed(2)} available, $10 minimum). Top up at https://claude.ai/settings/billing`,{display:"system"}),null;if(z.kind==="needs-confirm")return RSK.default.createElement(ySK,{onProceed:async(Y)=>{if(await LSK(_,K,q," This review bills as Extra Usage.",Y),!Y.aborted)vSK()},onCancel:()=>q("Ultrareview cancelled.",{display:"system"})});return await LSK(_,K,q,z.billingNote),null};var SSK=y(()=>{NSK();ESK();RSK=O6(D6(),1)});var ZGY="https://code.claude.com/docs/en/claude-code-on-the-web",GGY=(q)=>`
6241 You are an expert code reviewer. Follow these steps:

Callers 1

LSKFunction · 0.85

Calls 14

Ix8Function · 0.85
dFunction · 0.85
g8Function · 0.85
DhFunction · 0.85
Lj6Function · 0.85
dTFunction · 0.85
a8Function · 0.85
mx8Function · 0.85
Rj6Function · 0.85
filterMethod · 0.80
jFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected