UNPKG

aetherlight-analyzer

Version:

Code analysis tool to generate ÆtherLight sprint plans from any codebase

54 lines 1.97 kB
/** * DESIGN DECISION: Hybrid Rust parser using CLI wrapper around syn crate * WHY: TypeScript can't parse Rust natively, need Rust tooling via subprocess * * REASONING CHAIN: * 1. Rust has complex syntax (lifetimes, macros, trait bounds) * 2. Only way to parse correctly is using Rust's `syn` crate * 3. Create Rust CLI tool that outputs JSON (using syn) * 4. Call CLI from TypeScript, parse JSON output * 5. Transform to unified CodeElement types * 6. Result: Accurate Rust parsing with <3s for 30k LOC * * PATTERN: Pattern-ANALYZER-001 (AST-Based Code Analysis) * RELATED: PHASE_0_CODE_ANALYZER.md (Task A-002) * PERFORMANCE: Target <3s for 30k LOC Rust code */ import { ParseResult } from './types'; export declare class RustParser { private rustParserPath; constructor(rustParserPath?: string); /** * Parse all Rust files in directory * * DESIGN DECISION: Call Rust CLI tool via subprocess, parse JSON output * WHY: Only accurate way to parse Rust is using Rust's syn crate * * @param directoryPath - Root directory to scan * @returns ParseResult with all parsed files and dependencies */ parse(directoryPath: string): Promise<ParseResult>; /** * Check if Rust parser binary exists */ private checkRustParserExists; /** * Call Rust parser CLI and get JSON output */ private callRustParser; /** * Transform Rust parser output to unified CodeElement types * * REASONING CHAIN: * 1. Rust output has different structure (structs, traits, impls) * 2. Need to map to unified types (ClassElement, FunctionElement, etc.) * 3. Preserve Rust-specific info in metadata * 4. Result: Analyzers work on same types regardless of language */ private transformRustOutput; private transformFile; private transformField; private transformMethod; private convertLocation; } //# sourceMappingURL=rust-parser.d.ts.map