MCPcopy Create free account
hub / github.com/anus-dev/ANUS / getGitHubRepoInfo

Function getGitHubRepoInfo

packages/cli/src/utils/gitUtils.ts:99–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 * @throws error if the exec command fails.
98 */
99export function getGitHubRepoInfo(): { owner: string; repo: string } {
100 const remoteUrl = execSync('git remote get-url origin', {
101 encoding: 'utf-8',
102 }).trim();
103
104 // Matches either https://github.com/owner/repo.git or git@github.com:owner/repo.git
105 const match = remoteUrl.match(
106 /(?:https?:\/\/|git@)github\.com(?::|\/)([^/]+)\/([^/]+?)(?:\.git)?$/,
107 );
108
109 // If the regex fails match, throw an error.
110 if (!match || !match[1] || !match[2]) {
111 throw new Error(
112 `Owner & repo could not be extracted from remote URL: ${remoteUrl}`,
113 );
114 }
115
116 return { owner: match[1], repo: match[2] };
117}

Callers 2

gitUtils.test.tsFile · 0.85
getOpenUrlsCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected