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

Function xN4

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

Source from the content-addressed store, hash-verified

1658
1659Format: 2-12 words, match the user's style. Or nothing.
1660
1661Reply with ONLY the suggestion, no quotes or explanation.`,z_z;var zw6=y(()=>{v8();i$();m8();y8();nv();E8();i1();U1();AY();o1();k8();ZU();Yw6();z_z={user_intent:yN4,stated_intent:yN4}});import{basename as Y_z,extname as $_z,posix as hN4,sep as A_z}from"path";function CN4(q){let K=hN4.sep+q.split(A_z).join(hN4.sep).replace(/^\/+/,""),_=Y_z(q).toLowerCase(),z=$_z(q).toLowerCase();if(O_z.has(_))return!0;if(SN4.has(z))return!0;let Y=_.split(".");if(Y.length>2){let $="."+Y.slice(-2).join(".");if(SN4.has($))return!0}for(let $ of w_z)if(K.includes($))return!0;for(let $ of j_z)if($.test(_))return!0;return!1}var O_z,SN4,w_z,j_z;var bN4=y(()=>{O_z=new Set(["package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lockb","bun.lock","composer.lock","gemfile.lock","cargo.lock","poetry.lock","pipfile.lock","shrinkwrap.json","npm-shrinkwrap.json"]),SN4=new Set([".lock",".min.js",".min.css",".min.html",".bundle.js",".bundle.css",".generated.ts",".generated.js",".d.ts"]),w_z=["/dist/","/build/","/out/","/output/","/node_modules/","/vendor/","/vendored/","/third_party/","/third-party/","/external/","/.next/","/.nuxt/","/.svelte-kit/","/coverage/","/__pycache__/","/.tox/","/venv/","/.venv/","/target/release/","/target/debug/"],j_z=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]});import{stat as H_z}from"fs/promises";import{isAbsolute as m5O,join as J_z,relative as p5O,sep as B5O}from"path";function vN8(){let q=Z8();return hY(q)??r1()}function IN4(){return Xo6==="internal"}function mN4(q){if(q.includes("opus-4-6"))return"claude-opus-4-6";if(q.includes("opus-4-5"))return"claude-opus-4-5";if(q.includes("opus-4-1"))return"claude-opus-4-1";if(q.includes("opus-4"))return"claude-opus-4";if(q.includes("sonnet-4-6"))return"claude-sonnet-4-6";if(q.includes("sonnet-4-5"))return"claude-sonnet-4-5";if(q.includes("sonnet-4"))return"claude-sonnet-4";if(q.includes("sonnet-3-7"))return"claude-sonnet-3-7";if(q.includes("haiku-4-5"))return"claude-haiku-4-5";if(q.includes("haiku-3-5"))return"claude-haiku-3-5";return"claude"}function X_z(){return process.env.CLAUDE_CODE_ENTRYPOINT??"cli"}function yV6(){return{fileStates:new Map,sessionBaselines:new Map,surface:X_z(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function pN4(q,K){let _=vN8(),z=N8(),Y={},$=[],A=new Set,O={},w=0,j=0,H=new Map,J=new Map;for(let D of q){A.add(D.surface);let f=D.sessionBaselines instanceof Map?D.sessionBaselines:new Map(Object.entries(D.sessionBaselines??{}));for(let[Z,T]of f)if(!J.has(Z))J.set(Z,T);let G=D.fileStates instanceof Map?D.fileStates:new Map(Object.entries(D.fileStates??{}));for(let[Z,T]of G){let v=H.get(Z);if(v)H.set(Z,{...T,claudeContribution:v.claudeContribution+T.claudeContribution});else H.set(Z,T)}}let M=await Promise.all(K.map(async(D)=>{if(CN4(D))return{type:"generated",file:D};let f=J_z(_,D),G=H.get(D),Z=J.get(D),T=q[0].surface,v=0,V=0;if(await P_z(D))if(G)v=G.claudeContribution,V=0;else{let x=await xN4(D);V=x>0?x:100}else try{let x=await H_z(f);if(G)v=G.claudeContribution,V=0;else if(Z){let I=await xN4(D);V=I>0?I:x.size}else V=x.size}catch{return null}v=Math.max(0,v),V=Math.max(0,V);let S=v+V,R=S>0?Math.round(v/S*100):0;return{type:"file",file:D,claudeChars:v,humanChars:V,percent:R,surface:T}}));for(let D of M){if(!D)continue;if(D.type==="generated"){$.push(D.file);continue}Y[D.file]={claudeChars:D.claudeChars,humanChars:D.humanChars,percent:D.percent,surface:D.surface},w+=D.claudeChars,j+=D.humanChars,O[D.surface]=(O[D.surface]??0)+D.claudeChars}let X=w+j,P=X>0?Math.round(w/X*100):0,W={};for(let[D,f]of Object.entries(O)){let G=X>0?Math.round(f/X*100):0;W[D]={claudeChars:f,percent:G}}return{version:1,summary:{claudePercent:P,claudeChars:w,humanChars:j,surfaces:Array.from(A)},files:Y,surfaceBreakdown:W,excludedGenerated:$,sessions:[z]}}async function xN4(q){let K=vN8();try{let _=await S7(L7(),["diff","--cached","--stat","--",q],{cwd:K,timeout:5000});if(_.code!==0||!_.stdout)return 0;let z=_.stdout.split(`
1662`).filter(Boolean),Y=0;for(let $ of z)if($.includes("file changed")||$.includes("files changed")){let A=$.match(/(\d+) insertions?/),O=$.match(/(\d+) deletions?/),w=A?parseInt(A[1],10):0,j=O?parseInt(O[1],10):0;Y+=(w+j)*40}return Y}catch{return 0}}async function P_z(q){let K=vN8();try{let _=await S7(L7(),["diff","--cached","--name-status","--",q],{cwd:K,timeout:5000});if(_.code===0&&_.stdout)return _.stdout.trim().startsWith("D\t")}catch{}return!1}var M_z,Xo6=null,uN4;var xr=y(()=>{v8();I7();_8();XK();e7();bN4();Hl();E5();E8();aq();M_z=["github.com:anthropics/claude-cli-internal","github.com/anthropics/claude-cli-internal","github.com:anthropics/anthropic","github.com/anthropics/anthropic","github.com:anthropics/apps","github.com/anthropics/apps","github.com:anthropics/casino","github.com/anthropics/casino","github.com:anthropics/dbt","github.com/anthropics/dbt","github.com:anthropics/dotfiles","github.com/anthropics/dotfiles","github.com:anthropics/terraform-config","github.com/anthropics/terraform-config","github.com:anthropics/hex-export","github.com/anthropics/hex-export","github.com:anthropics/feedback-v2","github.com/anthropics/feedback-v2","github.com:anthropics/labs","github.com/anthropics/labs","github.com:anthropics/argo-rollouts","github.com/anthropics/argo-rollouts","github.com:anthropics/starling-configs","github.com/anthropics/starling-configs","github.com:anthropics/ts-tools","github.com/anthropics/ts-tools","github.com:anthropics/ts-capsules","github.com/anthropics/ts-capsules","github.com:anthropics/feldspar-testing","github.com/anthropics/feldspar-testing","github.com:anthropics/trellis","github.com/anthropics/trellis","github.com:anthropics/claude-for-hiring","github.com/anthropics/claude-for-hiring","github.com:anthropics/forge-web","github.com/anthropics/forge-web","github.com:anthropics/infra-manifests","github.com/anthropics/infra-manifests","github.com:anthropics/mycro_manifests","github.com/anthropics/mycro_manifests","github.com:anthropics/mycro_configs","github.com/anthropics/mycro_configs","github.com:anthropics/mobile-apps","github.com/anthropics/mobile-apps"];uN4=TB(async()=>{if(Xo6!==null)return Xo6==="internal";let q=vN8(),K=await o$8(q);if(!K)return Xo6="none",!1;let _=M_z.some((z)=>K.includes(z));return Xo6=_?"internal":"external",_})});function $w6(){let q=(AY(),Eq(SV1)),K=q.isTeammate()&&q.isPlanModeRequired()?"plan":"default";return{settings:N7(),tasks:{},agentNameRegistry:new Map,verbose:!1,mainLoopModel:null,mainLoopModelForSession:null,statusLineText:void 0,expandedView:"none",isBriefOnly:!1,showTeammateMessagePreview:!1,selectedIPAgentIndex:-1,coordinatorTaskIndex:-1,viewSelectionMode:"none",footerSelection:null,kairosEnabled:!1,remoteSessionUrl:void 0,remoteConnectionStatus:"connecting",remoteBackgroundTaskCount:0,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:void 0,showRemoteCallout:!1,toolPermissionContext:{...MX(),mode:K},agent:void 0,agentDefinitions:{activeAgents:[],allAgents:[]},fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:yV6(),mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},todos:{},remoteAgentTaskSuggestions:[],notifications:{current:null,queue:[]},elicitation:{queue:[]},thinkingEnabled:j76(),promptSuggestionEnabled:TN8(),sessionHooks:new Map,inbox:{messages:[]},workerSandboxPermissions:{queue:[],selectedIndex:0},pendingWorkerRequest:null,pendingSandboxRequest:null,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:Wq6,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:null,effortValue:void 0,activeOverlays:new Set,fastMode:!1}}var Wq6;var EV6=y(()=>{zw6();Bq();xr();U1();WL();Wq6={status:"idle"}});import{randomBytes as W_z}from"crypto";function Z_z(){return W_z(8).toString("hex")}function Dq6(q,K){let _=new Map;if(!q.includes("<<"))return{processedCommand:q,heredocs:_};if(/\$['"]/.test(q))return{processedCommand:q,heredocs:_};let z=q.indexOf("<<");if(z>0&&q.slice(0,z).includes("`"))return{processedCommand:q,heredocs:_};if(z>0){let Z=q.slice(0,z),T=(Z.match(/\(\(/g)||[]).length,v=(Z.match(/\)\)/g)||[]).length;if(T>v)return{processedCommand:q,heredocs:_}}let Y=new RegExp(G_z.source,"g"),$=[],A=[],O,w=0,j=!1,H=!1,J=!1,M=!1,X=0,P=(Z)=>{for(let T=w;T<Z;T++){let v=q[T];if(v===`
1663`)J=!1;if(j){if(v==="'")j=!1;continue}if(H){if(M){M=!1;continue}if(v==="\\"){M=!0;continue}if(v==='"')H=!1;continue}if(v==="\\"){X++;continue}let V=X%2===1;if(X=0,V)continue;if(v==="'")j=!0;else if(v==='"')H=!0;else if(!J&&v==="#")J=!0}w=Z};while((O=Y.exec(q))!==null){let Z=O.index;if(P(Z),j||H)continue;if(J)continue;if(X%2===1)continue;let T=!1;for(let j6 of A)if(Z>j6.contentStartIndex&&Z<j6.contentEndIndex){T=!0;break}if(T)continue;let v=O[0],V=O[1]==="-",E=O[3]||O[4],S=Z+v.length,R=O[2];if(R&&q[S-1]!==R)continue;let x=v.includes("\\"),I=!!R||x;if(S<q.length){let j6=q[S];if(!/^[ \t\n|&;()<>]$/.test(j6))continue}let B=-1;{let j6=!1,G6=!1;for(let w6=S;w6<q.length;w6++){let o=q[w6];if(j6){if(o==="'")j6=!1;continue}if(G6){if(o==="\\"){w6++;continue}if(o==='"')G6=!1;continue}if(o===`
1664`){B=w6-S;break}let s=0;for(let a=w6-1;a>=S&&q[a]==="\\";a--)s++;if(s%2===1)continue;if(o==="'")j6=!0;else if(o==='"')G6=!0}}if(B===-1)continue;let p=q.slice(S,S+B),C=0;for(let j6=p.length-1;j6>=0;j6--)if(p[j6]==="\\")C++;else break;if(C%2===1)continue;let g=S+B,U=q.slice(g+1).split(`

Callers 1

pN4Function · 0.85

Calls 5

vN8Function · 0.85
S7Function · 0.85
filterMethod · 0.80
includesMethod · 0.80
matchMethod · 0.45

Tested by

no test coverage detected