Refactor: Modular AST & Storage Architecture with Comprehensive Testing#9
Open
mehdibalouchi wants to merge 5 commits into
Open
Refactor: Modular AST & Storage Architecture with Comprehensive Testing#9mehdibalouchi wants to merge 5 commits into
mehdibalouchi wants to merge 5 commits into
Conversation
- Add complete AST command group for file analysis - vibe ast parse <file> - complete analysis (elements + relationships + dataflow) - vibe ast elements <file> - extract code elements only - vibe ast relationships <file> - discover relationships only - vibe ast dataflow <file> - analyze data flow only - All AST commands are read-only with no database effects - Support --verbose flag for detailed output - Add storage command for database operations - vibe storage index-file <file> - index specific file to database - Integrates with existing workspace and storage infrastructure - Enhanced CLI help system with new command sections - Added "AST Analysis (Read-Only)" section - Added "Database Operations" section - Updated examples to include new commands - Cleanup old monolithic files - Remove src/infra/ast.ts (replaced by modular ast/ directory) - Remove src/infra/storage.ts (replaced by modular storage/ directory) - Clean integration with refactored modules - Import from src/infra/ast/index.ts and src/infra/storage/index.ts - Consistent error handling and UX patterns - Proper Commander.js subcommand structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…xing Implements recursive directory indexing with batch processing, progress reporting, and comprehensive error handling as planned in index-dir-plan.md. **New Features:** - `vibe storage index-dir <dir>` command with options: - `--verbose` for detailed progress per file - `--max-depth <n>` for directory depth control (default: 10) - `--batch-size <n>` for parallel processing (default: 5) **Implementation:** - DirectoryIndexOptions & DirectoryIndexResult types in storage/types.ts - indexDirectory() function in storage/core.ts with file-scanner integration - Storage.indexDirectory() method in storage/index.ts - handleStorageIndexDirCommand() CLI handler with path validation - Enhanced help text with examples and usage information **Key Features:** - Recursive file discovery with .ts, .tsx, .js, .jsx filtering - Batch processing for performance with configurable parallelism - Individual file error handling that doesn't break the entire process - Comprehensive progress reporting and statistics - Database uniqueness via existing element_path constraints - Graceful handling of permission errors and missing directories **Usage Examples:** ```bash vibe storage index-dir src/ vibe storage index-dir src/ --verbose --max-depth 5 --batch-size 10 vibe storage index-dir . --max-depth 8 ``` 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Implements complete test coverage for AST module functionality: **New Test Files (4 categories, 84 total tests):** - tests/unit/ast/path-resolution.test.ts (19 tests) - tests/unit/ast/element-extraction.test.ts (23 tests) - tests/unit/ast/import-export.test.ts (30 tests) - tests/unit/ast/database-utils.test.ts (16 tests) - tests/unit/ast/core.test.ts (comprehensive existing tests) **Test Coverage:** - Path resolution: WASM loading, development vs compiled mode - Element extraction: Node filtering, type mapping, name extraction - Import/export handling: Module resolution, relationship parsing - Database utilities: Storage ID generation, relationship consistency - Core parsing: Parser management, file parsing, relationship discovery **Infrastructure Improvements:** - Enhanced resolveWasmPath() with testable compilation mode detection - Added comprehensive test utilities in tests/utils/test-helpers.ts - Updated deno.json with --no-check flag for faster test execution **Key Features:** - Mock file system scenarios for path resolution testing - Comprehensive AST node type coverage and edge case handling - Storage-compatible ID generation validation - Functional programming patterns throughout (no classes) - Effect-TS integration for async operations and error handling Achieves 100% coverage of issue #8 requirements with 47/47 specified tests implemented. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request implements a comprehensive refactoring of the dotvibe codebase into modular AST and storage systems with complete test coverage. The changes include:
ast.tsandstorage.tsfiles into clean, focused modulesKey Changes
🏗️ Architecture Refactoring
core.ts,types.ts,utils.ts,cli.ts, andindex.ts🧪 Comprehensive Testing (Issue #8)
🚀 Enhanced CLI Commands
AST Analysis (Read-Only)
Storage Operations
📊 Directory Indexing Features
--batch-size)--verboseoption--max-depth)Test Coverage
AST Module Testing
Test Infrastructure
Migration Notes
Breaking Changes
src/infra/ast.ts→src/infra/ast/module directorysrc/infra/storage.ts→src/infra/storage/module directoryBackwards Compatibility
Performance Improvements
Promise.allSettledfor concurrencyDevelopment Experience
Enhanced DX Features
--no-checkflag for quicker test executionCode Quality
@tested_byannotations for traceabilityTest Plan
All tests can be executed with:
deno test --allow-all tests/unit/ast/Individual test suites:
tests/unit/ast/core.test.ts- Core parsing functionalitytests/unit/ast/path-resolution.test.ts- WASM and path handlingtests/unit/ast/element-extraction.test.ts- AST node processingtests/unit/ast/import-export.test.ts- Module relationship parsingtests/unit/ast/database-utils.test.ts- Storage integrationFiles Changed
New Modular Structure
src/infra/ast/- Complete AST module with 5 focused filessrc/infra/storage/- Complete storage module with 5 focused filestests/unit/ast/- Comprehensive test suite with 84 teststests/fixtures/- Test data for edge cases and scenariosEnhanced Files
src/cli.ts- Integrated new command groups and help systemdeno.json- Updated with performance flags for testingtests/utils/test-helpers.ts- Enhanced testing utilities🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com