Skip to content

[Refactoring] Split Large Services - impact-analyzer & memory-service #22

@gloomcheng

Description

@gloomcheng

Problem

Two services have grown too large:

  • src/core/mcp/services/impact-analyzer.ts (677 lines)
  • src/core/mcp/services/memory-service.ts (668 lines)

Impact

  • Hard to maintain
  • Multiple responsibilities
  • Difficult to test
  • Violates Single Responsibility Principle

Proposed Refactoring

impact-analyzer.ts → impact-analysis/

services/impact-analysis/
  dependency-graph-builder.ts (graph construction)
  impact-calculator.ts (impact analysis)
  breaking-change-detector.ts (breaking changes)
  index.ts (exports)

memory-service.ts → memory/

services/memory/
  memory-storage.ts (core memory CRUD)
  correction-tracker.ts (corrections)
  snapshot-manager.ts (project snapshots)
  index.ts (exports)

Benefits

✅ Single Responsibility: Each module focused
✅ Testability: Easier to test smaller modules
✅ Maintainability: Easier to find and modify
✅ Reusability: Components can be used independently

Acceptance Criteria

  • impact-analyzer.ts split into 3 files (<300 lines each)
  • memory-service.ts split into 3 files (<300 lines each)
  • All tests passing
  • Public API unchanged (backward compatible)
  • Documentation updated

Priority

Medium - Technical debt cleanup

Effort Estimate

2 days

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions