MCPcopy Index your code
hub / github.com/ds300/patch-package / parseRepoString

Function parseRepoString

src/createIssue.ts:11–30  ·  view source on GitHub ↗
(
  repository: string,
)

Source from the content-addressed store, hash-verified

9const githubURL = /github.com(:|\/)([\w.-]+\/[\w.-]+?)(.git|\/.*)?$/
10
11function parseRepoString(
12 repository: string,
13): null | { repo: string; org: string; provider: "GitHub" } {
14 if (repository.startsWith("github:")) {
15 repository = repository.replace(/^github:/, "")
16 }
17 const urlMatch = repository.match(githubURL)
18 if (urlMatch) {
19 repository = urlMatch[2]
20 }
21
22 const specMatch = repository.match(repoSpecifier)
23
24 if (!specMatch) {
25 return null
26 }
27 const [, org, repo] = specMatch
28
29 return { org, repo, provider: "GitHub" }
30}
31
32export function getPackageVCSDetails(packageDetails: PackageDetails) {
33 const repository = require(resolve(join(packageDetails.path, "package.json")))

Callers 1

getPackageVCSDetailsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…