[PR #1294] [CLOSED] refactor: extract and modularize core system components #9881

Closed
opened 2026-02-16 18:14:19 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1294
Author: @yordyi
Created: 7/24/2025
Status: Closed

Base: devHead: refactor/modularize-core-components


📝 Commits (2)

  • c83df9a refactor: extract and modularize core system components
  • 9567bb7 merge: resolve conflicts with latest dev branch

📊 Changes

18 files changed (+4142 additions, -433 deletions)

View changed files

packages/opencode/src/file/ripgrep-installer.ts (+153 -0)
📝 packages/opencode/src/file/ripgrep.ts (+23 -222)
packages/opencode/src/file/tree-builder.ts (+194 -0)
📝 packages/opencode/src/lsp/client.ts (+17 -44)
packages/opencode/src/lsp/diagnostics-manager.ts (+145 -0)
packages/opencode/src/lsp/timeout-manager.ts (+84 -0)
packages/opencode/src/storage/migration-manager.ts (+151 -0)
📝 packages/opencode/src/storage/storage.ts (+32 -90)
packages/opencode/src/storage/stream-handler.ts (+117 -0)
📝 packages/opencode/src/tool/edit.ts (+4 -33)
packages/opencode/src/tool/replace-strategy.ts (+137 -0)
packages/opencode/src/tool/replacer-registry.ts (+50 -0)
packages/opencode/src/tool/replacers.ts (+292 -0)
packages/opencode/src/trace/buffered-writer.ts (+120 -0)
📝 packages/opencode/src/trace/index.ts (+44 -44)
packages/opencode/src/trace/request-interceptor.ts (+4 -0)
tests/auth/auth.integration.test.spec.ts (+1571 -0)
tests/auth/auth.unit.test.spec.ts (+1004 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1294 **Author:** [@yordyi](https://github.com/yordyi) **Created:** 7/24/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `refactor/modularize-core-components` --- ### 📝 Commits (2) - [`c83df9a`](https://github.com/anomalyco/opencode/commit/c83df9a36e7abf7c6b3a8d2cda34a32a1292feb9) refactor: extract and modularize core system components - [`9567bb7`](https://github.com/anomalyco/opencode/commit/9567bb7ea1e4aa50db157f626f99de1e34a97924) merge: resolve conflicts with latest dev branch ### 📊 Changes **18 files changed** (+4142 additions, -433 deletions) <details> <summary>View changed files</summary> ➕ `packages/opencode/src/file/ripgrep-installer.ts` (+153 -0) 📝 `packages/opencode/src/file/ripgrep.ts` (+23 -222) ➕ `packages/opencode/src/file/tree-builder.ts` (+194 -0) 📝 `packages/opencode/src/lsp/client.ts` (+17 -44) ➕ `packages/opencode/src/lsp/diagnostics-manager.ts` (+145 -0) ➕ `packages/opencode/src/lsp/timeout-manager.ts` (+84 -0) ➕ `packages/opencode/src/storage/migration-manager.ts` (+151 -0) 📝 `packages/opencode/src/storage/storage.ts` (+32 -90) ➕ `packages/opencode/src/storage/stream-handler.ts` (+117 -0) 📝 `packages/opencode/src/tool/edit.ts` (+4 -33) ➕ `packages/opencode/src/tool/replace-strategy.ts` (+137 -0) ➕ `packages/opencode/src/tool/replacer-registry.ts` (+50 -0) ➕ `packages/opencode/src/tool/replacers.ts` (+292 -0) ➕ `packages/opencode/src/trace/buffered-writer.ts` (+120 -0) 📝 `packages/opencode/src/trace/index.ts` (+44 -44) ➕ `packages/opencode/src/trace/request-interceptor.ts` (+4 -0) ➕ `tests/auth/auth.integration.test.spec.ts` (+1571 -0) ➕ `tests/auth/auth.unit.test.spec.ts` (+1004 -0) </details> ### 📄 Description ## 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](https://claude.ai/code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:19 -05:00
yindo closed this issue 2026-02-16 18:14:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9881