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

Function parsePRReference

source code/utils/worktree.ts:635–653  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

633 * Returns the PR number or null if the string is not a recognized PR reference.
634 */
635export function parsePRReference(input: string): number | null {
636 // GitHub-style PR URL: https://<host>/owner/repo/pull/123 (with optional trailing slash, query, hash)
637 // The /pull/N path shape is specific to GitHub — GitLab uses /-/merge_requests/N,
638 // Bitbucket uses /pull-requests/N — so matching any host here is safe.
639 const urlMatch = input.match(
640 /^https?:\/\/[^/]+\/[^/]+\/[^/]+\/pull\/(\d+)\/?(?:[?#].*)?$/i,
641 )
642 if (urlMatch?.[1]) {
643 return parseInt(urlMatch[1], 10)
644 }
645
646 // #N format
647 const hashMatch = input.match(/^#(\d+)$/)
648 if (hashMatch?.[1]) {
649 return parseInt(hashMatch[1], 10)
650 }
651
652 return null
653}
654
655export async function isTmuxAvailable(): Promise<boolean> {
656 const { code } = await execFileNoThrow('tmux', ['-V'])

Callers 2

runFunction · 0.85
execIntoTmuxWorktreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected