MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / parsePrUrl

Function parsePrUrl

source code/tools/shared/gitOperationTracking.ts:60–72  ·  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

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

Callers 1

findPrInStdoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected