Skip to main content
Glama

DollhouseMCP

by DollhouseMCP
REFACTORING_NEXT_STEPS.md•4.16 kB
# Refactoring Next Steps - Post-PR #45 Review ## Current Status - **PR #45**: Epic refactoring to modularize 3000-line index.ts - **Result**: Reduced from 3,000+ lines to 1,314 lines (56% reduction) - **Review**: Received excellent feedback from Claude with specific recommendations - **CI/CD**: Multiple test failures need fixing ## Critical Issues to Fix ### 1. Barrel File Export Conflicts (HIGH PRIORITY) **Error**: TS2308 - Module has already exported member **Location**: `src/index.barrel.ts:23` **Members with conflicts**: - `validateCategory` (exported from both `./security/InputValidator.js` and `./utils/validation.js`) - `validateUsername` (exported from both `./security/InputValidator.js` and `./utils/validation.js`) - `VALIDATION_PATTERNS` (exported from both `./security/constants.js` and `./utils/validation.js`) **Fix needed**: Remove duplicate exports or use explicit re-exports ### 2. CI/CD Failures (HIGH PRIORITY) All checks failing except Claude review: - Docker Build & Test (linux/amd64) - FAIL - Docker Build & Test (linux/arm64) - FAIL - Docker Compose Test - FAIL - Test (macos-latest, Node 20.x) - FAIL - Test (ubuntu-latest, Node 20.x) - FAIL - Test (windows-latest, Node 20.x) - FAIL - Validate Build Artifacts - FAIL **Root cause**: TypeScript compilation errors from barrel file ## Claude's PR Review Recommendations ### Code Quality Improvements 1. **Interface Segregation**: PersonaManager is still quite large and could benefit from further splitting 2. **Central Export**: āœ… Added barrel file but needs conflict resolution ### Testing Requirements (HIGH PRIORITY) 1. **Unit Tests**: Add comprehensive unit tests for each module: - PersonaManager - GitHubClient - UpdateManager - VersionManager - BackupManager - Each utility module 2. **Security Tests**: Add tests for input validation edge cases - Path traversal attempts - XSS prevention - Control character handling - Size limit enforcement 3. **Performance Tests**: Add benchmarks for: - Large persona collections (1000+ personas) - API caching efficiency - Rate limiting behavior 4. **Error Handling Tests**: Comprehensive error scenarios - Network failures - File system errors - Invalid input handling - Concurrent operations ### Documentation Tasks (MEDIUM PRIORITY) 1. **README Update**: Document the new module architecture 2. **Module Docs**: Add documentation for each module's purpose and API 3. **Architecture Diagram**: Visual representation of module dependencies ### Performance Suggestions 1. **Lazy Loading**: Already implemented āœ… 2. **Benchmarks**: Add performance tracking to monitor improvements ## Fixed Issues āœ… PersonaManager.getCurrentUserForAttribution() type consistency āœ… GitHubClient error wrapping preserves original error āœ… ServerSetup circular dependency resolved with IToolHandler interface āœ… Added central barrel file for easier imports ## Module Structure Reference ``` src/ ā”œā”€ā”€ cache/ # API caching functionality ā”œā”€ā”€ config/ # Configuration and constants ā”œā”€ā”€ marketplace/ # GitHub marketplace integration ā”œā”€ā”€ persona/ # Persona management ā”œā”€ā”€ security/ # Input validation and security ā”œā”€ā”€ server/ # Server setup and tool handling │ └── tools/ # Tool definitions by category ā”œā”€ā”€ types/ # TypeScript interfaces ā”œā”€ā”€ update/ # Update and version management └── utils/ # Utility functions ``` ## Key Files with Issues 1. `src/index.barrel.ts` - Export conflicts need resolution 2. `src/utils/validation.ts` - Duplicate exports with InputValidator 3. `src/security/InputValidator.ts` - Original validation functions ## Next Session Action Plan 1. Fix barrel file export conflicts 2. Ensure all CI/CD checks pass 3. Begin implementing unit tests for core modules 4. Update documentation with module architecture ## Commands to Run ```bash # Fix barrel file locally npm run build # Run tests locally npm test # Check specific test suites npm run test:basic npm run test:integration npm run test:performance ```

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DollhouseMCP/DollhouseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server