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

Function Cb

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

Source from the content-addressed store, hash-verified

4701
4702Original error: ${O.stderr}`};if(O.stderr.includes("timed out")||O.stderr.includes("timeout")||O.stderr.includes("Could not resolve host"))return{...O,stderr:`Network error or timeout while cloning repository. Please check your internet connection and try again.
4703
4704Original error: ${O.stderr}`}}if(!O.stderr)return{code:O.code,stderr:O.error||`git clone exited with code ${O.code} (no stderr output). Run with --debug to see the full command.`};return O}function Cb(q,K){if(!q)return;try{q(K)}catch(_){N(`Progress callback error: ${d6(_)}`,{level:"warn"})}}async function rzY(q,K){let _={...process.env,...b18};if(K&&K.length>0)return S7(L7(),["sparse-checkout","set","--cone","--",...K],{cwd:q,timeout:ga(),stdin:"ignore",env:_});let z=await S7(L7(),["config","--get","core.sparseCheckout"],{cwd:q,stdin:"ignore",env:_});if(z.code===0&&z.stdout.trim()==="true")return{code:1,stderr:"sparsePaths removed from config but repository is sparse; re-cloning for full checkout"};return{code:0,stderr:""}}async function Ba(q,K,_,z,Y,$){let A=X8(),O=Math.round(ga()/1000);Cb(Y,`Refreshing marketplace cache (timeout: ${O}s)…`);let w=await rzY(K,z);if(w.code===0){let M=performance.now(),X=await lzY(K,_,{disableCredentialHelper:$?.disableCredentialHelper,sparsePaths:z});if(KD("marketplace_pull",q,X.code===0?"success":"failure",performance.now()-M,X.code===0?void 0:zC(X.stderr)),X.code===0)return;N(`git pull failed, will re-clone: ${X.stderr}`,{level:"warn"})}else N(`sparse-checkout reconcile requires re-clone: ${w.stderr}`);try{await A.rm(K,{recursive:!0}),N(`Found stale marketplace directory at ${K}, cleaning up to allow re-clone`,{level:"warn"}),Cb(Y,"Found stale directory, cleaning up and re-cloning…")}catch(M){if(!_7(M)){let X=d6(M);throw Error(`Failed to clean up existing marketplace directory. Please manually delete the directory at ${K} and try again.
4705
4706Technical details: ${X}`)}}let j=_?` (ref: ${_})`:"";Cb(Y,`Cloning repository (timeout: ${O}s): ${EH6(q)}${j}`);let H=performance.now(),J=await izY(q,K,_,z);if(KD("marketplace_clone",q,J.code===0?"success":"failure",performance.now()-H,J.code===0?void 0:zC(J.stderr)),J.code!==0){try{await A.rm(K,{recursive:!0,force:!0})}catch{}throw Error(`Failed to clone marketplace repository: ${J.stderr}`)}Cb(Y,"Clone complete, validating marketplace…")}function ozY(q){return Object.fromEntries(Object.entries(q).map(([K])=>[K,"***REDACTED***"]))}function EH6(q){try{let K=new URL(q);if((K.protocol==="http:"||K.protocol==="https:")&&(K.username||K.password)){if(K.username)K.username="***";if(K.password)K.password="***";return K.toString()}}catch{}return q}async function efK(q,K,_,z){let Y=X8(),$=EH6(q);if(Cb(z,`Downloading marketplace from ${$}`),N(`Downloading marketplace from URL: ${$}`),_&&Object.keys(_).length>0)N(`Using custom headers: ${g6(ozY(_))}`);let A={..._,"User-Agent":"Claude-Code-Plugin-Manager"},O,w=performance.now();try{O=await $1.get(q,{timeout:1e4,headers:A})}catch(J){if(KD("marketplace_url",q,"failure",performance.now()-w,zC(J)),$1.isAxiosError(J)){if(J.code==="ECONNREFUSED"||J.code==="ENOTFOUND")throw Error(`Could not connect to ${$}. Please check your internet connection and verify the URL is correct.

Callers 4

BaFunction · 0.85
efKFunction · 0.85
p17Function · 0.85
q56Function · 0.85

Calls 3

NFunction · 0.85
d6Function · 0.85
qFunction · 0.70

Tested by

no test coverage detected