MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parsePrUrl

Function parsePrUrl

src/tools/shared/gitOperationTracking.ts:58–70  ·  view source on GitHub ↗

* Parse PR info from a GitHub PR URL. * Returns { prNumber, prUrl, prRepository } or null if not a valid PR URL.

(
  url: string,
)

Source from the content-addressed store, hash-verified

56 * Returns { prNumber, prUrl, prRepository } or null if not a valid PR URL.
57 */
58function parsePrUrl(
59 url: string,
60): { prNumber: number; prUrl: string; prRepository: string } | null {
61 const match = url.match(/https:\/\/github\.com\/([^/]+\/[^/]+)\/pull\/(\d+)/)
62 if (match?.[1] && match?.[2]) {
63 return {
64 prNumber: parseInt(match[2], 10),
65 prUrl: url,
66 prRepository: match[1],
67 }
68 }
69 return null
70}
71
72/** Find a GitHub PR URL embedded anywhere in stdout and parse it. */
73function findPrInStdout(stdout: string): ReturnType<typeof parsePrUrl> {

Callers 1

findPrInStdoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected