MCPcopy Index your code
hub / github.com/cursor/cookbook / normalizeGitHubRemote

Function normalizeGitHubRemote

sdk/coding-agent-cli/src/agent.ts:422–430  ·  view source on GitHub ↗
(remote: string)

Source from the content-addressed store, hash-verified

420}
421
422function normalizeGitHubRemote(remote: string) {
423 const trimmed = remote.trim().replace(/\.git$/, "")
424 const sshMatch = trimmed.match(/^git@github\.com:(.+\/.+)$/)
425 const sshUrlMatch = trimmed.match(/^ssh:\/\/git@github\.com\/(.+\/.+)$/)
426 const httpsMatch = trimmed.match(/^https:\/\/github\.com\/(.+\/.+)$/)
427 const repoPath = sshMatch?.[1] ?? sshUrlMatch?.[1] ?? httpsMatch?.[1]
428
429 return repoPath ? `https://github.com/${repoPath}` : undefined
430}
431
432function formatCloudRepository(repository: CloudRepository) {
433 return repository.startingRef

Callers 1

detectCloudRepositoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected