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

Function wQ8

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

Source from the content-addressed store, hash-verified

7673${w}${j}
7674
7675Want to dig into any section or try one of the suggestions?
7676</message>`}]}};ORY=ARY});async function JRY(q){try{let[K,_]=await Promise.all([$s1(q).catch(($)=>{return H6(x1($)),N("Skill directory commands failed to load, continuing without them"),[]}),k17().catch(($)=>{return H6(x1($)),N("Plugin skills failed to load, continuing without them"),[]})]),z=puK(),Y=JK4();return N(`getSkills returning: ${K.length} skill dir commands, ${_.length} plugin skills, ${z.length} bundled skills, ${Y.length} builtin plugin skills`),{skillDirCommands:K,pluginSkills:_,bundledSkills:z,builtinPluginSkills:Y}}catch(K){return H6(x1(K)),N("Unexpected error in getSkills, returning empty"),{skillDirCommands:[],pluginSkills:[],bundledSkills:[],builtinPluginSkills:[]}}}function fBK(q){if(!q.availability)return!0;for(let K of q.availability)switch(K){case"claude-ai":if(d7())return!0;break;case"console":if(!d7()&&!A16()&&WP())return!0;break;default:{let _=K;break}}return!1}async function u0(q){let K=await ZBK(q),_=UYK(),z=K.filter((w)=>fBK(w)&&vs(w));if(_.length===0)return z;let Y=new Set(z.map((w)=>w.name)),$=_.filter((w)=>!Y.has(w.name)&&fBK(w)&&vs(w));if($.length===0)return z;let A=new Set(R97().map((w)=>w.name)),O=z.findIndex((w)=>A.has(w.name));if(O===-1)return[...z,...$];return[...z.slice(0,O),...$,...z.slice(O)]}function bq8(){ZBK.cache?.clear?.(),NC.cache?.clear?.(),EO6.cache?.clear?.(),jRY?.()}function tQ(){bq8(),jB8(),yfK(),oI8()}function kfK(q){return[]}function wQ8(q){if(q.type==="local-jsx")return!1;if(q.type==="prompt")return!0;return MRY.has(q)}function GBK(q){return q.filter((K)=>h97.has(K))}function hQ(q,K){return K.find((_)=>_.name===q||W_(_)===q||_.aliases?.includes(q))}function Gj6(q,K){return hQ(q,K)!==void 0}function iE6(q,K){let _=hQ(q,K);if(!_)throw ReferenceError(`Command ${q} not found. Available commands: ${K.map((z)=>{let Y=W_(z);return z.aliases?`${Y} (aliases: ${z.aliases.join(", ")})`:Y}).sort((z,Y)=>z.localeCompare(Y)).join(", ")}`);return _}function UH6(q){if(q.type!=="prompt")return q.description;if(q.kind==="workflow")return`${q.description} (workflow)`;if(q.source==="plugin"){let K=q.pluginInfo?.pluginManifest.name;if(K)return`(${K}) ${q.description}`;return`${q.description} (plugin)`}if(q.source==="builtin"||q.source==="mcp")return q.description;if(q.source==="bundled")return`${q.description} (bundled)`;return`${q.description} (${Ue(q.source)})`}var wRY=null,KBK=null,_BK,zBK=null,YBK,$BK=null,ABK,OBK=null,wBK=null,jBK,jRY=null,HBK=null,JBK=null,MBK=null,XBK=null,PBK=null,WBK=null,HRY,Oc2,R97,RQ,DBK=null,ZBK,NC,EO6,h97,MRY;var yA=y(()=>{QGK();cGK();nGK();sGK();eGK();KTK();jTK();RTK();CTK();ITK();dTK();qvK();YvK();jvK();uvK();qkK();zkK();ZkK();TkK();BkK();ekK();jVK();GVK();vVK();VVK();RVK();SVK();bVK();PNK();GNK();vNK();UyK();oLK();sLK();eLK();JRK();fRK();fSK();m57();ISK();mSK();QSK();nSK();bCK();ICK();mCK();BCK();FCK();dCK();nCK();oCK();KbK();$bK();VbK();EbK();CbK();pbK();dbK();OxK();HxK();WxK();kIK();EIK();bIK();uIK();QIK();cIK();iIK();oIK();aIK();quK();_uK();YuK();DuK();huK();buK();IuK();E8();y8();_8();Ga();WT();vn6();L18();F4();G7();Az();FuK();t37();qmK();YmK();jmK();MmK();TmK();A97();Fe6();ymK();EmK();bmK();MpK();PpK();DpK();kO();_BK=(GpK(),Eq(ZpK)).default,YBK=(LpK(),Eq(EpK)).default,ABK=(BpK(),Eq(ppK)).default,jBK=(npK(),Eq(lpK)).default,HRY={type:"prompt",name:"insights",description:"Generate a report analyzing your Claude Code sessions",contentLength:0,progressMessage:"analyzing your sessions",source:"builtin",async getPromptForCommand(q,K){let _=(await Promise.resolve().then(() => (qBK(),epK))).default;if(_.type!=="prompt")throw Error("unreachable");return _.getPromptForCommand(q,K)}},Oc2=[lGK,TNK,pCK,xTK,zvK,GkK,tGK,qTK,kVK,...OBK?[OBK]:[],dIK,nIK,rIK,...JBK?[JBK]:[],...HBK?[HBK]:[],tIK,eIK,aLK,uSK,c37,xCK,KuK,zuK,guK,XpK,WpK,wRY,dGK].filter(Boolean),R97=_1(()=>[UGK,xuK,vIK,PxK,Hq7,RuK,Zg8,uq7,Uq7,IvK,pq7,eTK,tvK,evK,Bg8,fkK,pkK,CmK,Vq8,SbK,V37,UIK,Z47,ZVK,TVK,T47,XNK,ZNK,FyK,tkK,nK7,zmK,JmK,GmK,yIK,tLK,sK7,CIK,DRK,DSK,p57,USK,JpK,lSK,O97,r37,wmK,A37,Wq7,$U8,CSK,IIK,uCK,gCK,iU8,t46,cqK,NmK,$37,HRY,O37,...jBK?[jBK]:[],...PBK?[PBK]:[],...WBK?[WBK]:[],...KBK?[KBK]:[],..._BK?[_BK]:[],...zBK?[zBK]:[],...YBK?[YBK]:[],...$BK?[$BK]:[],...ABK?[ABK]:[],qbK,YbK,kbK,P37,QbK,AxK,euK,WuK,...!A16()?[CVK,hVK()]:[],mbK,...XBK?[XBK]:[],CCK,...wBK?[wBK]:[],...MBK?[MBK]:[],...[]]),RQ=_1(()=>new Set(R97().flatMap((q)=>[q.name,...q.aliases??[]])));ZBK=_1(async(q)=>{let[{skillDirCommands:K,pluginSkills:_,bundledSkills:z,builtinPluginSkills:Y},$,A]=await Promise.all([JRY(q),kH6(),DBK?DBK(q):Promise.resolve([])]);return[...z,...Y,...K,...A,...$,..._,...R97()]});NC=_1(async(q)=>{return(await u0(q)).filter((_)=>_.type==="prompt"&&!_.disableModelInvocation&&_.source!=="builtin"&&(_.loadedFrom==="bundled"||_.loadedFrom==="skills"||_.loadedFrom==="commands_DEPRECATED"||_.hasUserSpecifiedDescription||_.whenToUse))}),EO6=_1(async(q)=>{try{return(await u0(q)).filter((_)=>_.type==="prompt"&&_.source!=="builtin"&&(_.hasUserSpecifiedDescription||_.whenToUse)&&(_.loadedFrom==="skills"||_.loadedFrom==="plugin"||_.loadedFrom==="bundled"||_.disableModelInvocation))}catch(K){return H6(x1(K)),N("Returning empty skills array due to load failure"),[]}}),h97=new Set([p57,Vq8,Zg8,Z47,A37,uq7,O37,Bg8,$37,pq7,Hq7,Wq7,P37,T47,O97,r37,nK7]),MRY=new Set([Uq7,Zg8,Bg8,c37,sK7,V37].filter((q)=>q!==null))});var Zx8={};T8(Zx8,{writeRemoteAgentMetadata:()=>Vo1,writeAgentMetadata:()=>ee6,setSessionFileForTesting:()=>RRY,setRemoteIngressUrlForTesting:()=>hRY,setInternalEventWriter:()=>u97,setInternalEventReader:()=>m97,setAgentTranscriptSubdir:()=>pr1,sessionIdExists:()=>Ks6,searchSessionsByCustomTitle:()=>kd,saveWorktreeState:()=>Oy,saveTaskSummary:()=>URY,saveTag:()=>nU8,saveMode:()=>dRY,saveCustomTitle:()=>$s,saveAiGeneratedTitle:()=>Q97,saveAgentSetting:()=>uq8,saveAgentName:()=>o78,saveAgentColor:()=>Gg8,restoreSessionMetadata:()=>Ld,resetSessionFilePointer:()=>mb,resetProjectForTesting:()=>LRY,resetProjectFlushStateForTesting:()=>ERY,removeTranscriptMessage:()=>p97,removeExtraFields:()=>KL6,recordTranscript:()=>fN,recordSidechainTranscript:()=>SQ,recordQueueOperation:()=>tI1,recordFileHistorySnapshot:()=>O68,recordContextCollapseSnapshot:()=>bRY,recordContextCollapseCommit:()=>CRY,recordContentReplacement:()=>DH6,recordAttributionSnapshot:()=>SRY,readRemoteAgentMetadata:()=>NRY,readAgentMetadata:()=>J67,reAppendSessionMetadata:()=>xp8,loadTranscriptFromFile:()=>mRY,loadTranscriptFile:()=>$a,loadSubagentTranscripts:()=>WQ8,loadSameRepoMessageLogsProgressive:()=>mq8,loadSameRepoMessageLogs:()=>YU8,loadMessageLogs:()=>_L6,loadFullLog:()=>om,loadAllSubagentTranscriptsFromDisk:()=>Xq7,loadAllProjectsMessageLogsProgressive:()=>PQ8,loadAllProjectsMessageLogs:()=>I57,loadAllLogsFromSessionFile:()=>AQ8,listRemoteAgentMetadata:()=>yo1,linkSessionToPR:()=>QRY,isTranscriptMessage:()=>Oa,isLoggableMessage:()=>pq8,isLiteLog:()=>qR,isEphemeralToolProgress:()=>b97,isCustomTitleEnabled:()=>Js,isChainParticipant:()=>FS6,hydrateRemoteSession:()=>B97,hydrateFromCCRv2InternalEvents:()=>g97,getUserType:()=>HQ8,getTranscriptPathForSession:()=>JT,getTranscriptPath:()=>Y$,getSessionIdFromLog:()=>SA,getSessionFilesWithMtime:()=>Cq8,getSessionFilesLite:()=>pS6,getProjectsDir:()=>Rp,getProjectDir:()=>_2,getNodeEnv:()=>LBK,getLogByIndex:()=>eRY,getLastSessionLog:()=>f68,getFirstMeaningfulUserMessageTextContent:()=>wq8,getCurrentSessionTitle:()=>k0,getCurrentSessionTag:()=>q97,getCurrentSessionAgentColor:()=>d97,getAgentTranscriptPath:()=>c0,getAgentTranscript:()=>AK6,flushSessionStorage:()=>Hd,findUnresolvedToolUse:()=>i97,fetchLogs:()=>hBK,extractTeammateTranscriptsFromTasks:()=>Mq7,extractAgentIdsFromMessages:()=>n97,enrichLogs:()=>kJ6,doesMessageExistInSession:()=>l97,deleteRemoteAgentMetadata:()=>No1,clearSessionMetadata:()=>j78,clearSessionMessagesCache:()=>u87,clearAgentTranscriptSubdir:()=>Br1,cleanMessagesForLogging:()=>Bq8,checkResumeConsistency:()=>Po1,cacheSessionTitle:()=>c97,buildConversationChain:()=>XK6,adoptResumedSessionFile:()=>vJ6,MAX_TRANSCRIPT_READ_BYTES:()=>$78});import{closeSync as XRY,fstatSync as PRY,openSync as WRY,readSync as DRY}from"fs";import{appendFile as TBK,open as fRY,mkdir as BS6,readdir as QS6,readFile as dS6,stat as C97,unlink as ZRY,writeFile as gS6}from"fs/promises";import{basename as GRY,dirname as Iq8,join as HZ}from"path";function Oa(q){return q.type==="user"||q.type==="assistant"||q.type==="attachment"||q.type==="system"}function FS6(q){return q.type!=="progress"}function kRY(q){return typeof q==="object"&&q!==null&&"type"in q&&q.type==="progress"&&"uuid"in q&&typeof q.uuid==="string"}function b97(q){return typeof q==="string"&&VRY.has(q)}function Rp(){return HZ(c1(),"projects")}function Y$(){let q=Q36()??_2(r1());return HZ(q,`${N8()}.jsonl`)}function JT(q){if(q===N8())return Y$();let K=_2(r1());return HZ(K,`${q}.jsonl`)}function pr1(q,K){x97.set(q,K)}function Br1(q){x97.delete(q)}function c0(q){let K=Q36()??_2(r1()),_=N8(),z=x97.get(q),Y=z?HZ(K,_,"subagents",z):HZ(K,_,"subagents");return HZ(Y,`agent-${q}.jsonl`)}function yBK(q){return c0(q).replace(/\.jsonl$/,".meta.json")}async function ee6(q,K){let _=yBK(q);await BS6(Iq8(_),{recursive:!0}),await gS6(_,JSON.stringify(K))}async function J67(q){let K=yBK(q);try{let _=await dS6(K,"utf-8");return JSON.parse(_)}catch(_){if(e3(_))return null;throw _}}function EBK(){let q=Q36()??_2(r1());return HZ(q,N8(),"remote-agents")}function I97(q){return HZ(EBK(),`remote-agent-${q}.meta.json`)}async function Vo1(q,K){let _=I97(q);await BS6(Iq8(_),{recursive:!0}),await gS6(_,JSON.stringify(K))}async function NRY(q){let K=I97(q);try{let _=await dS6(K,"utf-8");return JSON.parse(_)}catch(_){if(e3(_))return null;throw _}}async function No1(q){let K=I97(q);try{await ZRY(K)}catch(_){if(e3(_))return;throw _}}async function yo1(){let q=EBK(),K;try{K=await QS6(q,{withFileTypes:!0})}catch(z){if(e3(z))return[];throw z}let _=[];for(let z of K){if(!z.isFile()||!z.name.endsWith(".meta.json"))continue;try{let Y=await dS6(HZ(q,z.name),"utf-8");_.push(JSON.parse(Y))}catch(Y){N(`listRemoteAgentMetadata: skipping ${z.name}: ${String(Y)}`)}}return _}function Ks6(q){let K=_2(r1()),_=HZ(K,`${q}.jsonl`),z=X8();try{return z.statSync(_),!0}catch{return!1}}function LBK(){return"production"}function HQ8(){return"external"}function yRY(){return process.env.CLAUDE_CODE_ENTRYPOINT}function Js(){return!0}function dY(){if(!TJ6){if(TJ6=new RBK,!vBK)pq(async()=>{await TJ6?.flush();try{TJ6?.reAppendSessionMetadata()}catch{}}),vBK=!0}return TJ6}function ERY(){TJ6?._resetFlushState()}function LRY(){TJ6=null}function RRY(q){dY().sessionFile=q}function u97(q){dY().setInternalEventWriter(q)}function m97(q,K){dY().setInternalEventReader(q),dY().setInternalSubagentEventReader(K)}function hRY(q){dY().setRemoteIngressUrl(q)}class RBK{currentSessionTag;currentSessionTitle;currentSessionAgentName;currentSessionAgentColor;currentSessionLastPrompt;currentSessionAgentSetting;currentSessionMode;currentSessionWorktree;currentSessionPrNumber;currentSessionPrUrl;currentSessionPrRepository;sessionFile=null;pendingEntries=[];remoteIngressUrl=null;internalEventWriter=null;internalEventReader=null;internalSubagentEventReader=null;pendingWriteCount=0;flushResolvers=[];writeQueues=new Map;flushTimer=null;activeDrain=null;FLUSH_INTERVAL_MS=100;MAX_CHUNK_BYTES=104857600;constructor(){}_resetFlushState(){if(this.pendingWriteCount=0,this.flushResolvers=[],this.flushTimer)clearTimeout(this.flushTimer);this.flushTimer=null,this.activeDrain=null,this.writeQueues=new Map}incrementPendingWrites(){this.pendingWriteCount++}decrementPendingWrites(){if(this.pendingWriteCount--,this.pendingWriteCount===0){for(let q of this.flushResolvers)q();this.flushResolvers=[]}}async trackWrite(q){this.incrementPendingWrites();try{return await q()}finally{this.decrementPendingWrites()}}enqueueWrite(q,K){return new Promise((_)=>{let z=this.writeQueues.get(q);if(!z)z=[],this.writeQueues.set(q,z);z.push({entry:K,resolve:_}),this.scheduleDrain()})}scheduleDrain(){if(this.flushTimer)return;this.flushTimer=setTimeout(async()=>{if(this.flushTimer=null,this.activeDrain=this.drainWriteQueue(),await this.activeDrain,this.activeDrain=null,this.writeQueues.size>0)this.scheduleDrain()},this.FLUSH_INTERVAL_MS)}async appendToFile(q,K){try{await TBK(q,K,{mode:384})}catch{await BS6(Iq8(q),{recursive:!0,mode:448}),await TBK(q,K,{mode:384})}}async drainWriteQueue(){for(let[q,K]of this.writeQueues){if(K.length===0)continue;let _=K.splice(0),z="",Y=[];for(let{entry:$,resolve:A}of _){let O=g6($)+`
7677`;if(z.length+O.length>=this.MAX_CHUNK_BYTES){await this.appendToFile(q,z);for(let w of Y)w();Y.length=0,z=""}z+=O,Y.push(A)}if(z.length>0){await this.appendToFile(q,z);for(let $ of Y)$()}}for(let[q,K]of this.writeQueues)if(K.length===0)this.writeQueues.delete(q)}resetSessionFile(){this.sessionFile=null,this.pendingEntries=[]}reAppendSessionMetadata(q=!1){if(!this.sessionFile)return;let K=N8();if(!K)return;let z=FRY(this.sessionFile).split(`
7678`);if(!q){let $=z.findLast((A)=>A.startsWith('{"type":"custom-title"'));if($){let A=UT($,"customTitle");if(A!==void 0)this.currentSessionTitle=A||void 0}}let Y=z.findLast(($)=>$.startsWith('{"type":"tag"'));if(Y){let $=UT(Y,"tag");if($!==void 0)this.currentSessionTag=$||void 0}if(this.currentSessionLastPrompt)jZ(this.sessionFile,{type:"last-prompt",lastPrompt:this.currentSessionLastPrompt,sessionId:K});if(this.currentSessionTitle)jZ(this.sessionFile,{type:"custom-title",customTitle:this.currentSessionTitle,sessionId:K});if(this.currentSessionTag)jZ(this.sessionFile,{type:"tag",tag:this.currentSessionTag,sessionId:K});if(this.currentSessionAgentName)jZ(this.sessionFile,{type:"agent-name",agentName:this.currentSessionAgentName,sessionId:K});if(this.currentSessionAgentColor)jZ(this.sessionFile,{type:"agent-color",agentColor:this.currentSessionAgentColor,sessionId:K});if(this.currentSessionAgentSetting)jZ(this.sessionFile,{type:"agent-setting",agentSetting:this.currentSessionAgentSetting,sessionId:K});if(this.currentSessionMode)jZ(this.sessionFile,{type:"mode",mode:this.currentSessionMode,sessionId:K});if(this.currentSessionWorktree!==void 0)jZ(this.sessionFile,{type:"worktree-state",worktreeSession:this.currentSessionWorktree,sessionId:K});if(this.currentSessionPrNumber!==void 0&&this.currentSessionPrUrl&&this.currentSessionPrRepository)jZ(this.sessionFile,{type:"pr-link",sessionId:K,prNumber:this.currentSessionPrNumber,prUrl:this.currentSessionPrUrl,prRepository:this.currentSessionPrRepository,timestamp:new Date().toISOString()})}async flush(){if(this.flushTimer)clearTimeout(this.flushTimer),this.flushTimer=null;if(this.activeDrain)await this.activeDrain;if(await this.drainWriteQueue(),this.pendingWriteCount===0)return;return new Promise((q)=>{this.flushResolvers.push(q)})}async removeMessageByUuid(q){return this.trackWrite(async()=>{if(this.sessionFile===null)return;try{let K=0,_=await fRY(this.sessionFile,"r+");try{let{size:$}=await _.stat();if(K=$,$===0)return;let A=Math.min($,ue),O=$-A,w=Buffer.allocUnsafe(A),{bytesRead:j}=await _.read(w,0,A,O),H=w.subarray(0,j),J=`"uuid":"${q}"`,M=H.lastIndexOf(J);if(M>=0){let X=H.lastIndexOf(10,M);if(X>=0||O===0){let P=X+1,W=H.indexOf(10,M+J.length),D=W>=0?W+1:j,f=O+P,G=j-D;if(await _.truncate(f),G>0)await _.write(H,D,G,f);return}}}finally{await _.close()}if(K>vRY){N(`Skipping tombstone removal: session file too large (${m4(K)})`,{level:"warn"});return}let Y=(await dS6(this.sessionFile,{encoding:"utf-8"})).split(`

Callers 1

jQYFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected