/** * @fileoverview TypeScript AST parser using ts-morph * @module @nahisaho/musubix-security/infrastructure/ast-parser * @trace REQ-SEC-SCAN-001, REQ-SEC-TAINT-001 */ import { Project, SourceFile, Node, CallExpression, Identifier } from 'ts-morph'; import type { SourceLocation } from '../types/index.js'; /** * AST Parser service for TypeScript/JavaScript analysis */ export declare class ASTParser { private project; private cache; constructor(tsConfigPath?: string); /** * Parse a file and return its AST */ parseFile(filePath: string): SourceFile; /** * Parse source code string */ parseCode(code: string, fileName?: string): SourceFile; /** * Get source location from a node */ getLocation(node: Node): SourceLocation; /** * Find all function calls in a file */ findCallExpressions(sourceFile: SourceFile): CallExpression[]; /** * Find all string literals in a file */ findStringLiterals(sourceFile: SourceFile): Node[]; /** * Find all identifiers in a file */ findIdentifiers(sourceFile: SourceFile): Identifier[]; /** * Get function/method name from a call expression */ getFunctionName(callExpr: CallExpression): string | undefined; /** * Get the receiver object name for a method call */ getReceiverName(callExpr: CallExpression): string | undefined; /** * Check if a node is inside a specific function/method */ getEnclosingFunction(node: Node): Node | undefined; /** * Extract code snippet around a node */ extractSnippet(node: Node, contextLines?: number): string; /** * Check if node represents user input source */ isUserInputSource(callExpr: CallExpression): boolean; /** * Check if node is a dangerous sink */ isDangerousSink(callExpr: CallExpression): { isDangerous: boolean; category?: string; }; /** * Clear cache for a file */ invalidateCache(filePath: string): void; /** * Clear all caches */ clearCache(): void; /** * Get project instance for advanced usage */ getProject(): Project; } /** * Get or create AST parser instance */ export declare function getASTParser(tsConfigPath?: string): ASTParser; /** * Reset parser instance (for testing) */ export declare function resetASTParser(): void; //# sourceMappingURL=ast-parser.d.ts.map