superaugment
Version:
Enterprise-grade MCP server with world-class C++ analysis, robust error handling, and production-ready architecture for VS Code Augment
238 lines • 5.44 kB
TypeScript
/**
* SuperAugment C++ Code Analyzer
*
* Provides comprehensive C++ code analysis including syntax parsing,
* semantic analysis, dependency tracking, and code metrics calculation.
*/
import { FileSystemManager } from '../utils/FileSystemManager.js';
/**
* C++ analysis result interfaces
*/
export interface CppAnalysisResult {
lineCount: {
total: number;
code: number;
comments: number;
blank: number;
};
functions: CppFunction[];
classes: CppClass[];
namespaces: CppNamespace[];
includes: CppInclude[];
variables: CppVariable[];
enums: CppEnum[];
}
export interface CppFunction {
name: string;
line: number;
returnType: string;
parameters: CppParameter[];
isStatic: boolean;
isVirtual: boolean;
isConst: boolean;
complexity: number;
bodyLines: number;
}
export interface CppClass {
name: string;
line: number;
type: 'class' | 'struct';
baseClasses: string[];
methods: CppFunction[];
members: CppVariable[];
accessLevel: 'public' | 'private' | 'protected';
}
export interface CppNamespace {
name: string;
line: number;
nested: boolean;
}
export interface CppInclude {
file: string;
line: number;
type: 'system' | 'local';
found: boolean;
path?: string;
}
export interface CppVariable {
name: string;
line: number;
type: string;
isStatic: boolean;
isConst: boolean;
scope: string;
}
export interface CppParameter {
name: string;
type: string;
defaultValue?: string;
}
export interface CppEnum {
name: string;
line: number;
values: string[];
isClass: boolean;
}
/**
* Modern C++ features analysis
*/
export interface ModernCppFeatures {
features: {
name: string;
used: boolean;
recommendation: string;
}[];
improvements: string[];
}
/**
* Performance analysis result
*/
export interface PerformanceAnalysis {
hotspots: {
file: string;
line: number;
issue: string;
severity: string;
suggestion: string;
}[];
optimizations: string[];
}
/**
* Memory analysis result
*/
export interface MemoryAnalysis {
issues: {
file: string;
line: number;
type: string;
description: string;
fix: string;
}[];
recommendations: string[];
}
/**
* Security analysis result
*/
export interface SecurityAnalysis {
vulnerabilities: {
file: string;
line: number;
type: string;
severity: string;
description: string;
mitigation: string;
}[];
recommendations: string[];
}
/**
* Dependency analysis result
*/
export interface DependencyAnalysis {
includes: CppInclude[];
circularDependencies: string[][];
missingIncludes: string[];
}
/**
* Code metrics
*/
export interface CodeMetrics {
cyclomatic: number;
cognitive: number;
halstead: {
volume: number;
difficulty: number;
effort: number;
};
}
/**
* C++ Code Analyzer
*/
export declare class CppAnalyzer {
private fileSystemManager;
constructor(fileSystemManager: FileSystemManager);
/**
* Analyze C++ syntax and structure
*/
analyzeSyntax(filePath: string, cppStandard: string): Promise<CppAnalysisResult>;
/**
* Analyze C++ semantics (placeholder implementation)
*/
analyzeSemantics(_filePath: string, _cppStandard: string): Promise<any>;
/**
* Analyze dependencies and includes
*/
analyzeDependencies(filePath: string, maxDepth: number): Promise<DependencyAnalysis>;
/**
* Analyze modern C++ features usage
*/
analyzeModernCppFeatures(files: string[], cppStandard: string): Promise<ModernCppFeatures>;
/**
* Analyze performance issues
*/
analyzePerformance(filePath: string): Promise<PerformanceAnalysis>;
/**
* Analyze memory management issues
*/
analyzeMemory(filePath: string): Promise<MemoryAnalysis>;
/**
* Analyze security vulnerabilities
*/
analyzeSecurity(filePath: string): Promise<SecurityAnalysis>;
/**
* Calculate code metrics
*/
calculateMetrics(filePath: string): Promise<CodeMetrics>;
/**
* Analyze line count statistics
*/
private analyzeLineCount;
/**
* Extract function definitions
*/
private extractFunctions;
/**
* Extract class definitions
*/
private extractClasses;
/**
* Extract namespace definitions
*/
private extractNamespaces;
/**
* Extract include statements
*/
private extractIncludes;
/**
* Extract variable declarations
*/
private extractVariables;
/**
* Extract enum definitions
*/
private extractEnums;
/**
* Resolve include path
*/
private resolveIncludePath;
/**
* Get modern C++ features for a given standard
*/
private getModernCppFeatures;
/**
* Check feature usage in content
*/
private checkFeatureUsage;
/**
* Calculate cyclomatic complexity
*/
private calculateCyclomaticComplexity;
/**
* Calculate cognitive complexity (simplified)
*/
private calculateCognitiveComplexity;
/**
* Calculate Halstead metrics (simplified)
*/
private calculateHalsteadMetrics;
}
//# sourceMappingURL=CppAnalyzer.d.ts.map