Home / Function/ detectRepoName() — mcp Function Reference

detectRepoName() — mcp Function Reference

Architecture documentation for the detectRepoName() function in graph-cache.ts from the mcp codebase.

Entity Profile

Dependency Diagram

graph TD
  7b324bf5_8fc4_6549_8aca_337ba2b036bd["detectRepoName()"]
  108c9ff4_bdb8_518a_9256_9ff4cd9d39a7["graph-cache.ts"]
  7b324bf5_8fc4_6549_8aca_337ba2b036bd -->|defined in| 108c9ff4_bdb8_518a_9256_9ff4cd9d39a7
  5f051fd3_b5fd_05fe_3e0b_f20364a0b064["precacheForDirectory()"]
  5f051fd3_b5fd_05fe_3e0b_f20364a0b064 -->|calls| 7b324bf5_8fc4_6549_8aca_337ba2b036bd
  style 7b324bf5_8fc4_6549_8aca_337ba2b036bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/cache/graph-cache.ts lines 547–561

function detectRepoName(directory: string): string {
  try {
    const { execSync } = require('child_process');
    const remote = execSync('git remote get-url origin', {
      cwd: directory,
      encoding: 'utf-8',
      timeout: 2000,
    }).trim();
    const match = remote.match(/\/([^\/]+?)(?:\.git)?$/);
    if (match) return match[1];
  } catch {
    // Not a git repo
  }
  return basename(directory);
}

Domain

Subdomains

Frequently Asked Questions

What does detectRepoName() do?
detectRepoName() is a function in the mcp codebase, defined in src/cache/graph-cache.ts.
Where is detectRepoName() defined?
detectRepoName() is defined in src/cache/graph-cache.ts at line 547.
What calls detectRepoName()?
detectRepoName() is called by 1 function(s): precacheForDirectory.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free