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

Function Eoz

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

Source from the content-addressed store, hash-verified

2975Total duration (API): ${I5(ay())}
2976Total duration (wall): ${I5(RX6())}
2977Total code changes: ${l36()} ${l36()===1?"line":"lines"} added, ${n36()} ${n36()===1?"line":"lines"} removed
2978${K}`)}function Voz(q,K){return Math.round(q*K)/K}function Noz(q,K,_){let z=Yi8(_)??{inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0,webSearchRequests:0,costUSD:0,contextWindow:0,maxOutputTokens:0};return z.inputTokens+=K.input_tokens,z.outputTokens+=K.output_tokens,z.cacheReadInputTokens+=K.cache_read_input_tokens??0,z.cacheCreationInputTokens+=K.cache_creation_input_tokens??0,z.webSearchRequests+=K.server_tool_use?.web_search_requests??0,z.costUSD+=q,z.contextWindow=lf(_,QM()),z.maxOutputTokens=t86(_).default,z}function QL6(q,K,_){let z=Noz(q,K,_);Un8(q,z,_);let Y=BK()&&K.speed==="fast"?{model:_,speed:"fast"}:{model:_};Hi8()?.add(q,Y),bX6()?.add(K.input_tokens,{...Y,type:"input"}),bX6()?.add(K.output_tokens,{...Y,type:"output"}),bX6()?.add(K.cache_read_input_tokens??0,{...Y,type:"cacheRead"}),bX6()?.add(K.cache_creation_input_tokens??0,{...Y,type:"cacheCreation"});let $=q;for(let A of Tx4(K)){let O=q86(A.model,A);d("tengu_advisor_tool_token_usage",{advisor_model:A.model,input_tokens:A.input_tokens,output_tokens:A.output_tokens,cache_read_input_tokens:A.cache_read_input_tokens??0,cache_creation_input_tokens:A.cache_creation_input_tokens??0,cost_usd_micros:Math.round(O*1e6)}),$+=QL6(O,A,A.model)}return $}var Tb=y(()=>{x3();v8();k8();eq6();V1();fP();xf();U7();aq();wn()});function Ku8(q,K){if(K===0)return q;return q.map((_)=>({..._,oldStart:_.oldStart+K,newStart:_.newStart+K}))}function s68(q){return q.replaceAll("&",dYK).replaceAll("$",cYK)}function lYK(q){return q.replaceAll(dYK,"&").replaceAll(cYK,"$")}function t68(q,K){let _=0,z=0;if(q.length===0&&K)_=K.split(/\r?\n/).length;else _=q.reduce((Y,$)=>Y+$7($.lines,(A)=>A.startsWith("+")),0),z=q.reduce((Y,$)=>Y+$7($.lines,(A)=>A.startsWith("-")),0);t58(_,z),K38()?.add(_,{type:"added"}),K38()?.add(z,{type:"removed"}),d("tengu_file_changed",{lines_added:_,lines_removed:z})}function _u8({filePath:q,oldContent:K,newContent:_,ignoreWhitespace:z=!1,singleHunk:Y=!1}){let $=Ck6(q,q,s68(K),s68(_),void 0,void 0,{ignoreWhitespace:z,context:Y?1e5:dL6,timeout:qu8});if(!$)return[];return $.hunks.map((A)=>({...A,lines:A.lines.map(lYK)}))}function _y({filePath:q,fileContents:K,edits:_,ignoreWhitespace:z=!1}){let Y=s68(jl(K)),$=Ck6(q,q,Y,_.reduce((A,O)=>{let{old_string:w,new_string:j}=O,H="replace_all"in O?O.replace_all:!1,J=s68(jl(w)),M=s68(jl(j));if(H)return A.replaceAll(J,()=>M);else return A.replace(J,()=>M)},Y),void 0,void 0,{context:dL6,ignoreWhitespace:z,timeout:qu8});if(!$)return[];return $.hunks.map((A)=>({...A,lines:A.lines.map(lYK)}))}var dL6=3,qu8=5000,dYK="<<:AMPERSAND_TOKEN:>>",cYK="<<:DOLLAR_TOKEN:>>";var BQ=y(()=>{RO6();k8();v8();Tb();bK()});import{createHash as nYK}from"crypto";function yoz(q){return nYK("sha256").update(q).digest("hex").slice(0,16)}function Eoz(q){return nYK("sha256").update(q).digest("hex")}function em(q){let K={operation:q.operation,tool:q.tool,filePathHash:yoz(q.filePath)};if(q.content!==void 0&&q.content.length<=Loz)K.contentHash=Eoz(q.content);if(q.type!==void 0)K.type=q.type;d("tengu_file_operation",K)}var Loz=102400;var zu8=y(()=>{k8()});import{access as Roz,readFile as hoz}from"fs/promises";import{dirname as Soz,join as Coz,relative as boz,sep as xoz}from"path";async function rYK(){if(!await YJ())return null;if(await aYK())return null;let{stdout:K,code:_}=await a8(L7(),["--no-optional-locks","diff","HEAD","--shortstat"],{timeout:Yu8,preserveOutputOnError:!1});if(_===0){let w=goz(K);if(w&&w.filesCount>uoz)return{stats:w,perFileStats:new Map,hunks:new Map}}let{stdout:z,code:Y}=await a8(L7(),["--no-optional-locks","diff","HEAD","--numstat"],{timeout:Yu8,preserveOutputOnError:!1});if(Y!==0)return null;let{stats:$,perFileStats:A}=moz(z),O=js1-A.size;if(O>0){let w=await Boz(O);if(w){$.filesCount+=w.size;for(let[j,H]of w)A.set(j,H)}}return{stats:$,perFileStats:A,hunks:new Map}}async function oYK(){if(!await YJ())return new Map;if(await aYK())return new Map;let{stdout:K,code:_}=await a8(L7(),["--no-optional-locks","diff","HEAD"],{timeout:Yu8,preserveOutputOnError:!1});if(_!==0)return new Map;return poz(K)}function moz(q){let K=q.trim().split(`
2979`).filter(Boolean),_=0,z=0,Y=0,$=new Map;for(let A of K){let O=A.split("\t");if(O.length<3)continue;Y++;let w=O[0],j=O[1],H=O.slice(2).join("\t"),J=w==="-"||j==="-",M=J?0:parseInt(w??"0",10)||0,X=J?0:parseInt(j??"0",10)||0;if(_+=M,z+=X,$.size<js1)$.set(H,{added:M,removed:X,isBinary:J})}return{stats:{filesCount:Y,linesAdded:_,linesRemoved:z},perFileStats:$}}function poz(q){let K=new Map;if(!q.trim())return K;let _=q.split(/^diff --git /m).filter(Boolean);for(let z of _){if(K.size>=js1)break;if(z.length>iYK)continue;let Y=z.split(`
2980`),$=Y[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!$)continue;let A=$[2]??$[1]??"",O=[],w=null,j=0;for(let H=1;H<Y.length;H++){let J=Y[H]??"",M=J.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(M){if(w)O.push(w);w={oldStart:parseInt(M[1]??"0",10),oldLines:parseInt(M[2]??"1",10),newStart:parseInt(M[3]??"0",10),newLines:parseInt(M[4]??"1",10),lines:[]};continue}if(J.startsWith("index ")||J.startsWith("---")||J.startsWith("+++")||J.startsWith("new file")||J.startsWith("deleted file")||J.startsWith("old mode")||J.startsWith("new mode")||J.startsWith("Binary files"))continue;if(w&&(J.startsWith("+")||J.startsWith("-")||J.startsWith(" ")||J==="")){if(j>=Ioz)continue;w.lines.push(""+J),j++}}if(w)O.push(w);if(O.length>0)K.set(A,O)}return K}async function aYK(){let q=await Ap6(Z8());if(!q)return!1;return(await Promise.all(["MERGE_HEAD","REBASE_HEAD","CHERRY_PICK_HEAD","REVERT_HEAD"].map((z)=>Roz(Coz(q,z)).then(()=>!0).catch(()=>!1)))).some(Boolean)}async function Boz(q){let{stdout:K,code:_}=await a8(L7(),["--no-optional-locks","ls-files","--others","--exclude-standard"],{timeout:Yu8,preserveOutputOnError:!1});if(_!==0||!K.trim())return null;let z=K.trim().split(`

Callers 1

emFunction · 0.85

Calls 2

digestMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected