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

Function isGitHubRepository

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

Source from the content-addressed store, hash-verified

13 * @returns true if the directory is in a git repository with a github.com remote, false otherwise
14 */
15export const isGitHubRepository = (): boolean => {
16 try {
17 const remotes = (
18 execSync('git remote -v', {
19 encoding: 'utf-8',
20 }) || ''
21 ).trim();
22
23 const pattern = /github\.com/;
24
25 return pattern.test(remotes);
26 } catch (_error) {
27 // If any filesystem error occurs, assume not a git repo
28 console.debug(`Failed to get git remote:`, _error);
29 return false;
30 }
31};
32
33/**
34 * getGitRepoRoot returns the root directory of the git repository.

Callers 2

gitUtils.test.tsFile · 0.85

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected