opencode
opencode copied to clipboard
refactor: extract and modularize core system components
Summary
This PR refactors the codebase by extracting and modularizing core system components to improve maintainability and code organization.
Key Changes
- RipgrepInstaller: Extracted ripgrep installation logic from ripgrep.ts
- TreeBuilder: Separated file tree construction logic into dedicated module
- TimeoutManager: Added adaptive timeout handling with configurable strategies
- DiagnosticsManager: Centralized LSP diagnostics coordination and event handling
- StreamHandler: Implemented atomic file operations for better data integrity
- MigrationManager: Created extensible database schema migration system
- ReplaceStrategy & Replacers: Modularized text replacement system with multiple strategies
Benefits
- Improved separation of concerns
- Better code reusability
- Enhanced maintainability
- Cleaner architecture
- More testable components
Files Changed
- Modified core files: ripgrep.ts, client.ts, storage.ts, edit.ts, trace/index.ts
- Added 12+ new modular components
- Maintained backward compatibility
Test Plan
- Existing functionality remains unchanged
- All extracted modules maintain the same public APIs
- Enhanced error handling and timeout management
🤖 Generated with Claude Code