MCPcopy Create free account
hub / github.com/ChinaSiro/claude-code-sourcemap / #W

Method #W

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

Source from the content-addressed store, hash-verified

2530`,Y-1),O++,O===5)$=Y<=0?0:Y+1;if(O===100)A=Y<=0?0:Y+1}let w=_>=z?O:Math.max(q.#z,Math.round(z/_*O));q.#z=w,q.#O=z,q.#w(K.slice($),K.slice(A),w,z,_<z)},()=>{})}}writeStdout(q){this.#J(q,!1)}writeStderr(q){this.#J(q,!0)}#J(q,K){if(this.#O+=q.length,this.#f(q),this.#_){this.#_.append(K?`[stderr] ${q}`:q);return}if(this.#q.length+this.#K.length+q.length>this.#$){this.#W(K?q:null,K?null:q);return}if(K)this.#K+=q;else this.#q+=q}#f(q){let z=0,Y=[],$=0,A=q.length;while(A>0){let O=q.lastIndexOf(`
2531`,A-1);if(O===-1)break;if(z++,Y.length<100&&$<4096){let w=A-O-1;if(w>0&&w<=4096-$){let j=q.slice(O+1,A);if(j.trim())Y.push(Buffer.from(j).toString()),$+=w}}A=O}this.#z+=z;for(let O=Y.length-1;O>=0;O--)this.#Y.add(Y[O]);if(this.#w&&Y.length>0){let O=this.#Y.getRecent(5);this.#w(kA8(O,`
2532`),kA8(this.#Y.getRecent(100),`
2533`),this.#z,this.#O,this.#_!==null)}}#W(q,K){if(this.#_=new jI8(this.taskId),this.#q)this.#_.append(this.#q),this.#q="";if(this.#K)this.#_.append(`[stderr] ${this.#K}`),this.#K="";if(K)this.#_.append(K);if(q)this.#_.append(`[stderr] ${q}`)}async getStdout(){if(this.stdoutToFile)return this.#G();if(this.#_){let q=this.#Y.getRecent(5),K=kA8(q,`
2534`),z=`
2535Output truncated (${Math.round(this.#O/1024)}KB total). Full output saved to: ${this.path}`;return K?K+z:z.trimStart()}return this.#q}async#G(){let q=fL6();try{let K=await H98(this.path,0,q);if(!K)return this.#H=!0,"";let{content:_,bytesRead:z,bytesTotal:Y}=K;return this.#j=Y,this.#H=Y<=z,_}catch(K){let _=K instanceof Error&&"code"in K?String(K.code):"unknown";return N(`TaskOutput.#readStdoutFromFile: failed to read ${this.path} (${_}): ${K}`),`<bash output unavailable: output file ${this.path} could not be read (${_}). This usually means another Claude Code process in the same project deleted it during startup cleanup.>`}}getStderr(){if(this.#_)return"";return this.#K}get isOverflowed(){return this.#_!==null}get totalLines(){return this.#z}get totalBytes(){return this.#O}get outputFileRedundant(){return this.#H}get outputFileSize(){return this.#j}spillToDisk(){if(!this.#_)this.#W(null,null)}async flush(){await this.#_?.flush()}async deleteOutputFile(){try{await Qlz(this.path)}catch{}}clear(){this.#q="",this.#K="",this.#Y.clear(),this.#w=null,this.#_?.cancel(),JO.stopPolling(this.taskId),JO.#A.delete(this.taskId)}}});function o_K(q){if(q.includes("`"))return Xa(q);if(q.includes("$("))return Xa(q);if(/\$[A-Za-z_{]/.test(q))return Xa(q);if(olz(q))return Xa(q);let K=alz(q);if(K.includes(`

Callers 2

#JMethod · 0.95
spillToDiskMethod · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected