//#region packages/analyzers/src/types.d.ts /** * Analyzer interfaces and result types. */ interface AnalysisResult { /** Formatted output (Markdown, JSON, or Mermaid) */ output: string; /** Structured data for programmatic access */ data: Record; /** Analysis metadata */ meta: { analyzedAt: string; scope: string; fileCount: number; durationMs: number; }; } interface AnalyzerOptions { format?: 'json' | 'markdown' | 'mermaid'; [key: string]: unknown; } interface IAnalyzer { readonly name: string; analyze(rootPath: string, options?: TOpts): Promise; } interface StructureAnalyzerOptions extends AnalyzerOptions { format?: 'json' | 'markdown'; maxDepth?: number; /** When true, only include source code and config files (no docs, images, fonts, etc.) */ sourceOnly?: boolean; /** Token budget for dynamic tree pruning (Level 1=full, 2=collapsed leaves, 3=top-level). */ maxTokens?: number; } interface DependencyAnalyzerOptions extends AnalyzerOptions { format?: 'json' | 'markdown' | 'mermaid'; maxNodes?: number; } interface SymbolAnalyzerOptions extends AnalyzerOptions { filter?: string; format?: 'json' | 'markdown'; } interface DiagramOptions extends AnalyzerOptions { diagramType?: 'architecture' | 'dependencies'; scope?: string; } interface TreeNode { name: string; type: 'file' | 'directory'; purpose?: string; language?: string; size?: number; children?: TreeNode[]; } interface ProjectStats { totalFiles: number; totalSize: number; languages: Record; } interface ImportInfo { source: string; specifiers: string[]; filePath: string; isExternal: boolean; /** Confidence level based on import resolution method */ confidence: 'high' | 'medium' | 'low'; } interface SymbolInfo { name: string; kind: 'function' | 'class' | 'interface' | 'type' | 'const' | 'enum' | 'variable' | 'method'; exported: boolean; filePath: string; line: number; /** Full signature for functions/methods (parameter list + return type) */ signature?: string; /** Return type annotation (e.g. "Promise", "string") */ returnType?: string; /** First line of JSDoc/docstring */ jsdoc?: string; /** Decorator names (e.g. ["@Controller('/api')", "@Injectable"]) */ decorators?: string[]; /** Condensed body for interfaces/types (e.g. "{ id: string; name: string }") */ typeBody?: string; } interface PatternMatch { pattern: string; description: string; locations: string[]; confidence: 'high' | 'medium' | 'low'; } interface EntryPoint { name: string; type: 'lambda-handler' | 'main' | 'bin' | 'server' | 'cli' | 'test' | 'cdk-construct'; filePath: string; trigger?: string; } interface ExtractionBaselines { structure?: AnalysisResult; dependencies?: AnalysisResult; symbols?: AnalysisResult; patterns?: AnalysisResult; entryPoints?: AnalysisResult; diagrams?: AnalysisResult[]; } interface ExistingKnowledge { categories: string[]; lastProduced: Record; documentCount: number; } //#endregion //#region packages/analyzers/src/blast-radius-analyzer.d.ts interface BlastRadiusOptions { /** Changed file paths (relative to root) */ files: string[]; /** Maximum depth of transitive dependency traversal (default: 5) */ maxDepth?: number; /** Output format */ format?: 'json' | 'markdown'; } declare class BlastRadiusAnalyzer { readonly name = "blast-radius"; private depAnalyzer; analyze(rootPath: string, options: BlastRadiusOptions): Promise; private formatMarkdown; } //#endregion //#region packages/analyzers/src/dependency-analyzer.d.ts declare class DependencyAnalyzer implements IAnalyzer { readonly name = "dependencies"; /** Map of workspace package names to their relative entry point paths */ private workspacePackages; analyze(rootPath: string, options?: DependencyAnalyzerOptions): Promise; private collectFiles; private extractImportsRegex; private groupExternalDeps; private groupInternalDeps; /** * Build reverse graph: for each source file, who imports it? */ buildReverseGraph(imports: ImportInfo[], _rootPath: string): Record; /** * Build test coverage map: for each source file, which test files exercise it? */ buildTestCoverage(imports: ImportInfo[], _rootPath: string): Record; /** Resolve a relative import path to a normalized file path (best-effort). */ private resolveImportPath; /** * Build a map of workspace package names → relative entry point paths. * Scans for package.json files in common workspace dirs. */ private buildWorkspaceMap; private formatMarkdown; private formatMermaid; } //#endregion //#region packages/analyzers/src/diagram-generator.d.ts /** * Generates Mermaid diagrams by combining output from other analyzers. */ declare class DiagramGenerator implements IAnalyzer { readonly name = "diagrams"; private readonly structureAnalyzer; private readonly dependencyAnalyzer; analyze(rootPath: string, options?: DiagramOptions): Promise; private generateArchitectureDiagram; private generateDependencyDiagram; } //#endregion //#region packages/analyzers/src/entry-point-analyzer.d.ts declare class EntryPointAnalyzer implements IAnalyzer { readonly name = "entry-points"; analyze(rootPath: string, _options?: AnalyzerOptions): Promise; private fromPackageJson; /** Parse package.json `exports` field into entry points. */ private parseExportsField; /** Resolve export value through condition maps (import > default > first string). */ private resolveExportValue; /** * Find all workspace package directories in a monorepo. * Supports pnpm-workspace.yaml and package.json#workspaces. */ private findWorkspacePackages; /** Simple YAML parser for pnpm-workspace.yaml — extracts packages list. */ private parsePnpmWorkspaceYaml; /** * Expand a workspace glob like "packages/*" into actual directories * that contain package.json files. */ private expandWorkspaceGlob; private fromHandlerExports; /** Check if a file is a test suite. */ private isTestFile; /** Extract a meaningful name from the file path for non-JS entry points */ private inferNameFromFile; /** * Derive a contextual name from the directory path for generic handler/main files. * E.g., "services/channels/email/delivery/src/handler.ts" → "email-delivery" */ private deriveContextualName; private inferEntryType; private detectTrigger; private collectFiles; private formatMarkdown; } //#endregion //#region packages/analyzers/src/pattern-analyzer.d.ts declare class PatternAnalyzer implements IAnalyzer { readonly name = "patterns"; analyze(rootPath: string, _options?: AnalyzerOptions): Promise; private collectDirectories; private collectCodeFiles; private detectDirectoryPatterns; private detectCodePatterns; private detectConfigPatterns; private formatMarkdown; } //#endregion //#region packages/analyzers/src/structure-analyzer.d.ts declare class StructureAnalyzer implements IAnalyzer { readonly name = "structure"; analyze(rootPath: string, options?: StructureAnalyzerOptions): Promise; private buildTree; private computeStats; private formatMarkdownWithBudget; private formatMarkdown; private renderTree; private renderTreeLevel3; private estimateTokens; private isLeafDir; private leafDirSummary; private countFiles; } //#endregion //#region packages/analyzers/src/symbol-analyzer.d.ts declare class SymbolAnalyzer implements IAnalyzer { readonly name = "symbols"; analyze(rootPath: string, options?: SymbolAnalyzerOptions): Promise; private collectFiles; private extractSymbolsRegex; private groupByKind; private formatMarkdown; private formatCallGraph; } //#endregion //#region packages/analyzers/src/knowledge-producer.d.ts interface Analyzers { structure: StructureAnalyzer; dependencies: DependencyAnalyzer; symbols: SymbolAnalyzer; patterns: PatternAnalyzer; entryPoints: EntryPointAnalyzer; diagrams: DiagramGenerator; } /** * Orchestrates Tier 1 deterministic extraction and prepares * synthesis instructions for the LLM to produce knowledge. */ declare class KnowledgeProducer { private readonly analyzers; constructor(analyzers: Analyzers); /** * Run Tier 1 deterministic extraction for specified aspects. */ runExtraction(scope: string, aspects: string[]): Promise; /** * Build synthesis instructions from baselines for the LLM. */ buildSynthesisInstructions(baselines: ExtractionBaselines, _aspects: string[]): string; /** * Build cross-references between baselines (symbols ↔ entry-points ↔ patterns). * Helps the LLM see connections across independently generated sections. */ private buildCrossReferences; } //#endregion //#region packages/analyzers/src/ts-call-graph.d.ts /** * TypeScript Compiler API-based call graph extractor. * * Uses ts.createProgram to build a real type-checked program, then walks * the AST to find function call sites and resolve them to their declaration files. * Produces module-level call edges: which modules call functions in which other modules. */ interface ModuleCallEdge { /** Caller module (relative path) */ from: string; /** Callee module (relative path) */ to: string; /** Function/symbol names called across this edge */ symbols: string[]; } interface CallGraphResult { edges: ModuleCallEdge[]; fileCount: number; edgeCount: number; durationMs: number; } /** * Extract module-level call graph from a TypeScript/JavaScript project. * Returns null if TypeScript compiler is unavailable or no TS files found. */ declare function extractTsCallGraph(rootPath: string): Promise; //#endregion //#region packages/analyzers/src/regex-call-graph.d.ts /** * Extract regex-based call graph for any supported language. * Returns null if no source files found. */ declare function extractRegexCallGraph(rootPath: string): Promise; //#endregion export { type AnalysisResult, type AnalyzerOptions, type Analyzers, BlastRadiusAnalyzer, type BlastRadiusOptions, DependencyAnalyzer, type DependencyAnalyzerOptions, DiagramGenerator, type DiagramOptions, type EntryPoint, EntryPointAnalyzer, type ExistingKnowledge, type ExtractionBaselines, type IAnalyzer, type ImportInfo, KnowledgeProducer, PatternAnalyzer, type PatternMatch, type ProjectStats, StructureAnalyzer, type StructureAnalyzerOptions, SymbolAnalyzer, type SymbolAnalyzerOptions, type SymbolInfo, type TreeNode, extractRegexCallGraph, extractTsCallGraph };