MCPcopy
hub / github.com/opentrace/opentrace / parseRepoUrl

Function parseRepoUrl

ui/src/pr/client.ts:254–286  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

252
253/** Parse a repo URL into RepoMeta, or null if unrecognized. */
254export function parseRepoUrl(url: string): RepoMeta | null {
255 const gh = parseGitHubUrl(url);
256 if (gh) return { provider: 'github', owner: gh.owner, repo: gh.repo };
257
258 const gl = parseGitLabUrl(url);
259 if (gl)
260 return {
261 provider: 'gitlab',
262 owner: gl.namespace,
263 repo: gl.project,
264 host: gl.host,
265 };
266
267 const bb = parseBitbucketUrl(url);
268 if (bb)
269 return {
270 provider: 'bitbucket',
271 owner: bb.workspace,
272 repo: bb.repo,
273 };
274
275 const ado = parseAzureDevOpsUrl(url);
276 if (ado)
277 return {
278 provider: 'azuredevops',
279 owner: `${ado.org}/${ado.project}`,
280 repo: ado.repo,
281 host: ado.host,
282 project: ado.project,
283 };
284
285 return null;
286}

Callers 2

ChatPanel.tsxFile · 0.90
client.test.tsFile · 0.90

Calls 4

parseGitHubUrlFunction · 0.90
parseGitLabUrlFunction · 0.90
parseBitbucketUrlFunction · 0.90
parseAzureDevOpsUrlFunction · 0.90

Tested by

no test coverage detected