Severity
High
Description
All 8 non-Claude AI modules contain 90%+ duplicated code from the Claude module. This represents approximately 32,000 lines of duplicated code across:
- API client implementations
- UI components (chat windows, panels)
- Code completion providers
- Action handlers
- Settings panels
- Utility classes
Affected Modules
ai/gemini/ - ~4,000 LOC duplicated from Claude
ai/chatgpt/ - ~4,000 LOC duplicated from Claude
ai/grok/ - ~4,000 LOC duplicated from Claude
ai/mistral/ - ~4,000 LOC duplicated from Claude
ai/perplexity/ - ~4,000 LOC duplicated from Claude
ai/cohere/ - ~4,000 LOC duplicated from Claude
ai/deepseek/ - ~4,000 LOC duplicated from Claude
ai/openrouter/ - ~4,000 LOC duplicated from Claude
Impact
- DRY principle violation
- Bug fixes must be applied 9 times
- Inconsistent behavior across modules
- Maintenance nightmare
- Difficult to add new features
Recommended Solution
Create ai/common module with shared abstractions:
-
Abstract Base Classes:
AbstractAIClient - HTTP client, conversation history, error handling
AbstractChatTopComponent - Chat UI, message rendering
AbstractCompletionProvider - Code completion logic
AbstractConfigPanel - Settings UI
-
Shared Utilities:
AIClientFactory - Factory for creating clients
ConversationManager - Thread-safe conversation handling
RetryPolicy - Exponential backoff logic
StreamingResponseHandler - SSE/streaming handling
-
Module Structure:
ai/
├── common/ # NEW
│ ├── api/
│ │ ├── AbstractAIClient.java
│ │ └── ConversationManager.java
│ ├── ui/
│ │ └── AbstractChatTopComponent.java
│ └── completion/
│ └── AbstractCompletionProvider.java
├── claude/
│ └── extends common classes
├── gemini/
│ └── extends common classes
└── ...
Estimated Impact
Priority
High - Technical debt affecting maintainability
Severity
High
Description
All 8 non-Claude AI modules contain 90%+ duplicated code from the Claude module. This represents approximately 32,000 lines of duplicated code across:
Affected Modules
ai/gemini/- ~4,000 LOC duplicated from Claudeai/chatgpt/- ~4,000 LOC duplicated from Claudeai/grok/- ~4,000 LOC duplicated from Claudeai/mistral/- ~4,000 LOC duplicated from Claudeai/perplexity/- ~4,000 LOC duplicated from Claudeai/cohere/- ~4,000 LOC duplicated from Claudeai/deepseek/- ~4,000 LOC duplicated from Claudeai/openrouter/- ~4,000 LOC duplicated from ClaudeImpact
Recommended Solution
Create
ai/commonmodule with shared abstractions:Abstract Base Classes:
AbstractAIClient- HTTP client, conversation history, error handlingAbstractChatTopComponent- Chat UI, message renderingAbstractCompletionProvider- Code completion logicAbstractConfigPanel- Settings UIShared Utilities:
AIClientFactory- Factory for creating clientsConversationManager- Thread-safe conversation handlingRetryPolicy- Exponential backoff logicStreamingResponseHandler- SSE/streaming handlingModule Structure:
Estimated Impact
Priority
High - Technical debt affecting maintainability