Commit 22d1767
committed
refactor(cli): extract services from openalex-cli-class (2,055 → 423 lines)
Extracted five focused service modules from monolithic CLI class:
- EntityCacheService: Entity CRUD operations and file loading (149 lines)
- QueryCacheService: Query result caching and index management (221 lines)
- IndexManagementService: Unified index operations (197 lines)
- StatisticsService: Cache stats, analysis, and metrics (215 lines)
- StaticDataGeneratorService: Pattern-based static data generation (200 lines)
Benefits:
- Each service is independently testable and maintainable
- Clear separation of concerns with service layer
- Reduced main file complexity by 79% (2,055 → 423 lines)
- Preserved identical public API (no breaking changes)
- Services use CLI-specific types instead of complex utils package types
- All services have descriptive 'Cache' or 'Service' suffix for clarity
Technical changes:
- Created CLI-specific types (CLIIndexEntry, CLIUnifiedIndex) to avoid utils package complexity
- Removed zod validation dependencies for simpler type checking
- Service classes named with descriptive suffixes (CacheService pattern)
- Main CLI class now orchestrates services instead of handling all logic directly1 parent 8fee403 commit 22d1767
File tree
7 files changed
+1324
-1758
lines changed- apps/cli/src
- services
7 files changed
+1324
-1758
lines changed
0 commit comments