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
  bdea66c6_0db3_43e0_a427_aa1942e42baa["detectRepoName()"]
  966fdd0a_509a_01b0_865e_32cfde84f964["precacheForDirectory()"]
  966fdd0a_509a_01b0_865e_32cfde84f964 -->|calls| bdea66c6_0db3_43e0_a427_aa1942e42baa
  style bdea66c6_0db3_43e0_a427_aa1942e42baa 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.
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