MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / analyzeFile

Method analyzeFile

src/core/analyzer-registry.ts:106–126  ·  view source on GitHub ↗

* Analyze a file using the best available analyzer

(
    filePath: string,
    content: string,
    options?: AnalyzerSelectionOptions
  )

Source from the content-addressed store, hash-verified

104 * Analyze a file using the best available analyzer
105 */
106 async analyzeFile(
107 filePath: string,
108 content: string,
109 options?: AnalyzerSelectionOptions
110 ): Promise<AnalysisResult | null> {
111 const analyzer = this.findAnalyzer(filePath, content, options);
112
113 if (!analyzer) {
114 if (process.env.CODEBASE_CONTEXT_DEBUG) {
115 console.error(`[DEBUG] No analyzer found for file: ${filePath}`);
116 }
117 return null;
118 }
119
120 try {
121 return await analyzer.analyze(filePath, content);
122 } catch (error) {
123 console.error(`Error analyzing ${filePath} with ${analyzer.name}:`, error);
124 return null;
125 }
126 }
127
128 /**
129 * Get analyzer statistics

Callers 2

indexMethod · 0.80

Calls 2

findAnalyzerMethod · 0.95
analyzeMethod · 0.65

Tested by

no test coverage detected