/** * GitHub URL parsing utilities */ /** * Get the GitHub repo name from a remote URL */ export function parseGitHubUrl(url: string): { owner: string; repo: string } | null { // SSH format: git@github.com:owner/repo.git const sshMatch = url.match(/git@github\.com:([^/]+)\/(.+?)(\.git)?$/); if (sshMatch) { return { owner: sshMatch[1]!, repo: sshMatch[2]! }; } // HTTPS format: https://github.com/owner/repo.git const httpsMatch = url.match(/https:\/\/github\.com\/([^/]+)\/(.+?)(\.git)?$/); if (httpsMatch) { return { owner: httpsMatch[1]!, repo: httpsMatch[2]! }; } return null; }