refactor: reorganize src/ into domain/, features/, presentation/ layers#456
refactor: reorganize src/ into domain/, features/, presentation/ layers#456carlos-alm merged 3 commits intomainfrom
Conversation
Move source files into a domain-driven directory structure: - src/domain/ — core graph building, queries, analysis, search (embeddings) - src/features/ — composable feature modules (audit, check, complexity, etc.) - src/presentation/ — CLI formatting and output rendering - src/db/ — database layer (db.js → db/index.js) All 199 files updated with corrected import paths. 1858 tests pass, 0 cycles, all manifesto rules green. Impact: 22 functions changed, 5 affected
|
Claude finished @carlos-alm's task —— View job PR Review: Domain-Driven Architecture RefactorConducting comprehensive review of this structural refactor following the 5-phase analysis process. Review Checklist
Root Cause AnalysisProblem Being Solved: The existing flat Why This Approach: Domain-driven directory structure follows established patterns:
Risk Assessment: ✅ LOW RISK
Configuration & Test Integrity Analysis✅ No problematic configuration changes detected
✅ Test integrity maintained
Code Quality & Structural Assessment✅ Excellent Structural ImprovementsDomain Layer (
Features Layer (
Presentation Layer (
✅ Import Path Management
✅ Backward Compatibility
Backlog ComplianceZero-dep: ✓ — No new runtime dependencies added
Problem-fit: 3/5 — Good structural improvement but doesn't directly address core AI agent problems (token waste, hallucinated deps, blast radius). However, better organization may help maintainability and future development. Breaking: No — Purely additive structural change, no external interface changes Critical ConcernsNone identified. This is a well-executed refactor with:
Minor Observations
Final Assessment |
Greptile SummaryThis PR reorganizes the flat Key changes:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[src/index.js\npublic API] --> B[src/domain/]
A --> C[src/features/]
A --> D[src/db/]
A --> E[src/errors.js]
A --> F[src/kinds.js]
B --> B1[domain/graph/builder.js]
B --> B2[domain/graph/cycles.js]
B --> B3[domain/queries.js]
B --> B4[domain/search/index.js]
B3 --> B3a[analysis/context.js]
B3 --> B3b[analysis/dependencies.js]
B3 --> B3c[analysis/impact.js]
B3 --> B3d[analysis/symbol-lookup.js]
C --> C1[features/audit.js]
C --> C2[features/check.js]
C --> C3[features/triage.js]
C --> C4[features/structure.js]
C --> C5[features/export.js]
C --> C6[... 10+ more features]
D --> D1[db/connection.js]
D --> D2[db/migrations.js]
D --> D3[db/repository/index.js]
G[src/cli/commands/*] --> B
G --> C
H[src/mcp/tools/*] --> C
H --> B
style A fill:#f9f,stroke:#333
style B3 fill:#ffd700,stroke:#333
note1[⚠️ diffImpactMermaid, kindIcon\nlistFunctionsData, normalizeSymbol\nNOT re-exported from index.js]
B3 -.-> note1
style note1 fill:#ffcccc,stroke:#cc0000
|
Update file paths in the architecture table to reflect the domain/, features/, presentation/, db/ reorganization. Addresses Greptile review.
|
Addressed the Greptile feedback on stale CLAUDE.md architecture table paths:
See commit 712428f. |
Summary
src/into a domain-driven directory structure with three top-level layers:src/domain/— core graph building, import resolution, queries, analysis, and search (embeddings)src/features/— composable feature modules (audit, check, complexity, cfg, dataflow, etc.)src/presentation/— CLI formatting and output renderingsrc/db/— database layer (db.js→db/index.js)Test plan
codegraph buildsucceeds (5334 nodes, 11259 edges)codegraph check— 0 cycles, 0 boundary violations, all 10 manifesto rules passsrc/locations