/**
 * R8: 现有系统分析器 — L1/L2/L3 多层级分析。
 *
 * 层级:
 * - L1: 目录结构扫描 + 技术栈指纹检测（项目指纹）
 * - L2: 架构拓扑 — 模块边界、import 依赖图、分层、耦合
 * - L3: 代码谱系 — 数据模型追踪、API 调用链、变更影响半径
 *
 * 所有解析使用正则表达式（无完整 AST）。结果为结构化数据供下游消费者使用。
 */
export interface AnalysisOptions {
    /** Source directories to scan (relative to projectPath). Default: ["src"] */
    sourceDirs?: string[];
    /** File extensions to analyze. Default: [".ts", ".tsx", ".js", ".jsx"] */
    extensions?: string[];
    /** Max files to scan (safety limit). Default: 500 */
    maxFiles?: number;
}
/** L1 result — project fingerprint */
export interface L1Result {
    level: "L1";
    project_path: string;
    directories: string[];
    tech_stack: TechStackEntry[];
    file_count: number;
    source_file_count: number;
    has_package_json: boolean;
    has_tsconfig: boolean;
    package_dependencies: string[];
}
export interface TechStackEntry {
    name: string;
    evidence: string;
    confidence: "high" | "medium" | "low";
}
/** L2 result — architecture topology */
export interface L2Result {
    level: "L2";
    project_path: string;
    modules: ModuleInfo[];
    dependency_graph: DependencyEdge[];
    layer_violations: LayerViolation[];
    coupling_metrics: CouplingMetrics;
    source_files_scanned: number;
}
export interface ModuleInfo {
    /** Module name — derived from directory path relative to source root */
    name: string;
    /** Directory path relative to project root */
    path: string;
    /** Number of .ts/.js files in this module */
    file_count: number;
    /** Exported function/class names detected via regex */
    exported_names: string[];
}
export interface DependencyEdge {
    /** Source module (importer) */
    from: string;
    /** Target module (imported) */
    to: string;
    /** Number of import relationships from source to target */
    weight: number;
    /** Example import paths */
    sample_paths: string[];
}
export interface LayerViolation {
    source_module: string;
    target_module: string;
    source_file: string;
    import_path: string;
    description: string;
}
export interface CouplingMetrics {
    /** Per-module afferent coupling (number of modules that depend on this module) */
    afferent: Record<string, number>;
    /** Per-module efferent coupling (number of modules this module depends on) */
    efferent: Record<string, number>;
    /** Modules with highest afferent coupling (most depended upon) */
    hotspots: Array<{
        module: string;
        afferent: number;
    }>;
}
/** L3 result — code lineage */
export interface L3Result {
    level: "L3";
    project_path: string;
    data_models: DataModelInfo[];
    api_call_chains: ApiCallChain[];
    change_impact: ChangeImpactEstimate[];
    source_files_scanned: number;
}
export interface DataModelInfo {
    /** Type or interface name */
    name: string;
    /** File where defined */
    defined_in: string;
    /** Files that import/use this type */
    used_in: string[];
    /** Whether this looks like a primary data entity (has many fields) */
    is_entity_like: boolean;
}
export interface ApiCallChain {
    /** Route path (e.g., from router file) */
    route_path: string;
    /** File containing the route definition */
    route_file: string;
    /** Handler function name */
    handler_name: string;
    /** Files the handler likely calls (from import analysis) */
    downstream_files: string[];
}
export interface ChangeImpactEstimate {
    /** File that might change */
    file: string;
    /** Estimated number of files that import this file (direct) */
    direct_dependents: number;
    /** Estimated number of files that would be affected transitively (up to 2 hops) */
    transitive_dependents: number;
    /** Risk level based on direct dependents */
    risk: "low" | "medium" | "high";
}
/** Union result type */
export type AnalysisResult = L1Result | L2Result | L3Result;
/**
 * L1 分析: 目录结构扫描 + 技术栈指纹检测。
 */
export declare function analyzeL1(projectPath: string, options?: AnalysisOptions): L1Result;
/**
 * L2 分析: 架构拓扑 — 模块边界、依赖图、分层、耦合。
 */
export declare function analyzeL2(projectPath: string, options?: AnalysisOptions): L2Result;
/**
 * L3 分析: 代码谱系 — 数据模型追踪、API 调用链、变更影响半径。
 */
export declare function analyzeL3(projectPath: string, options?: AnalysisOptions): L3Result;
/**
 * Analyze existing system at the specified level.
 *
 * - L1: Fast project fingerprint (directory structure + tech stack)
 * - L2: Architecture topology (modules, dependency graph, layering, coupling)
 * - L3: Code lineage (data models, API chains, change impact)
 */
export declare function analyzeExistingSystem(projectPath: string, level: "L1" | "L2" | "L3", options?: AnalysisOptions): AnalysisResult;
/**
 * Automatically select analysis level based on project complexity.
 *
 * - < 20 source files: L1
 * - 20-100 source files: L2
 * - > 100 source files: L3
 */
export declare function selectAnalysisLevel(projectPath: string, options?: AnalysisOptions): "L1" | "L2" | "L3";
//# sourceMappingURL=existing_system_analyzer.d.ts.map