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

Function _88

package/cli.js:3014–3014  ·  view source on GitHub ↗
({filePath:q,fileContents:K,oldString:_,newString:z,replaceAll:Y=!1})

Source from the content-addressed store, hash-verified

3012`||_==="\r"||_==="("||_==="["||_==="{"||_==="—"||_==="–"}function baz(q){let K=[...q],_=[];for(let z=0;z<K.length;z++)if(K[z]==='"')_.push(m$K(K,z)?ys1:Es1);else _.push(K[z]);return _.join("")}function xaz(q){let K=[...q],_=[];for(let z=0;z<K.length;z++)if(K[z]==="'"){let Y=z>0?K[z-1]:void 0,$=z<K.length-1?K[z+1]:void 0,A=Y!==void 0&&/\p{L}/u.test(Y),O=$!==void 0&&/\p{L}/u.test($);if(A&&O)_.push(Gu8);else _.push(m$K(K,z)?Ns1:Gu8)}else _.push(K[z]);return _.join("")}function Iaz(q,K,_,z=!1){let Y=z?(A,O,w)=>A.replaceAll(O,()=>w):(A,O,w)=>A.replace(O,()=>w);if(_!=="")return Y(q,K,_);return!K.endsWith(`
3013`)&&q.includes(K+`
3014`)?Y(q,K+`
3015`,_):Y(q,K,_)}function _88({filePath:q,fileContents:K,oldString:_,newString:z,replaceAll:Y=!1}){return K88({filePath:q,fileContents:K,edits:[{old_string:_,new_string:z,replace_all:Y}]})}function K88({filePath:q,fileContents:K,edits:_}){let z=K,Y=[];if(!K&&_.length===1&&_[0]&&_[0].old_string===""&&_[0].new_string==="")return{patch:_y({filePath:q,fileContents:K,edits:[{old_string:K,new_string:z,replace_all:!1}]}),updatedFile:""};for(let A of _){let O=A.old_string.replace(/\n+$/,"");for(let j of Y)if(O!==""&&j.includes(O))throw Error("Cannot edit file: old_string is a substring of a new_string from a previous edit.");let w=z;if(z=A.old_string===""?A.new_string:Iaz(z,A.old_string,A.new_string,A.replace_all),z===w)throw Error("String not found in file. Failed to apply edit.");Y.push(A.new_string)}if(z===K)throw Error("Original and edited file match exactly. Failed to apply edit.");return{patch:_u8({filePath:q,oldContent:jl(K),newContent:jl(z)}),updatedFile:z}}function p$K(q,K){let _=Ck6("file.txt","file.txt",q,K,void 0,void 0,{context:8,timeout:qu8});if(!_)return"";let z=_.hunks.map((O)=>({startLine:O.oldStart,content:O.lines.filter((w)=>!w.startsWith("-")&&!w.startsWith("\\")).map((w)=>w.slice(1)).join(`
3016`)})).map(Q$8).join(`
3017...

Callers 2

FazFunction · 0.85
callFunction · 0.85

Calls 1

K88Function · 0.85

Tested by

no test coverage detected