MCPcopy Create free account
hub / github.com/Tencent/teamai-cli / gitcodeRepoClone

Function gitcodeRepoClone

src/providers/gitcode/gitcode-api.ts:178–199  ·  view source on GitHub ↗
(repo: string, localPath: string)

Source from the content-addressed store, hash-verified

176 * subsequent pull/push operations work (see cloneUrl).
177 */
178export function gitcodeRepoClone(repo: string, localPath: string): void {
179 const token = getGitCodeToken();
180 const result = spawnSync('git', ['clone', cloneUrl(repo, token), localPath], {
181 encoding: 'utf-8',
182 stdio: ['pipe', 'pipe', 'pipe'],
183 timeout: 120_000,
184 });
185 const allOutput = `${result.stderr ?? ''} ${result.stdout ?? ''}`;
186 if (result.status === 0) return;
187
188 if (
189 allOutput.includes('not found')
190 || allOutput.includes('does not exist')
191 || allOutput.includes('Repository not found')
192 || allOutput.includes('could not be found')
193 || /\b404\b/.test(allOutput)
194 ) {
195 throw new GitCodeRepoNotFoundError(repo);
196 }
197
198 throw new Error(`git clone failed: ${redactCloneOutput(allOutput)}`);
199}
200
201/**
202 * Create a private GitCode repo. Uses the authenticated user's namespace when

Callers 1

cloneRepoMethod · 0.85

Calls 3

getGitCodeTokenFunction · 0.85
redactCloneOutputFunction · 0.85
cloneUrlFunction · 0.70

Tested by

no test coverage detected