- Add NetworkX dependency to pyproject.toml - Create dependency_analyzer.py with comprehensive functionality - Support Python, JavaScript/TypeScript, and C++ import extraction - Build directed graphs using NetworkX DiGraph - Detect circular dependencies with NetworkX algorithms - Export graphs in multiple formats (JSON, Mermaid, DOT) - Add 24 comprehensive tests with 100% pass rate Features: - Python: AST-based import extraction (import, from, relative) - JavaScript/TypeScript: ES6 and CommonJS parsing (import, require) - C++: #include directive extraction (system and local headers) - Graph statistics (total files, dependencies, cycles, components) - Circular dependency detection and reporting - Multiple export formats for visualization Architecture: - DependencyAnalyzer class with NetworkX integration - DependencyInfo dataclass for tracking import relationships - FileNode dataclass for graph nodes - Language-specific extraction methods Related research: - NetworkX: Standard Python graph library for analysis - pydeps: Python-specific analyzer (inspiration) - madge: JavaScript dependency analyzer (reference) - dependency-cruiser: Advanced JS/TS analyzer (reference) Test coverage: - 5 Python import tests - 4 JavaScript/TypeScript import tests - 3 C++ include tests - 3 graph building tests - 3 circular dependency detection tests - 3 export format tests - 3 edge case tests
12 KiB
12 KiB