You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add Vertical Slice Architecture to Phase 3 roadmap (#395)
* docs: add Vertical Slice Architecture pattern to Phase 3 roadmap
Name Vertical Slice Architecture as the target pattern for Phase 3.
Add target end-state directory structure and key design principles.
Add two new steps: 3.14 (Presentation Layer Extraction) and
3.15 (Domain Directory Grouping). Renumber old 3.14 to 3.16.
* docs: fix directory structure inconsistencies in VSA roadmap
@@ -560,6 +560,30 @@ Plus updated enums on existing tools (edge_kinds, symbol kinds).
560
560
561
561
> Reference: [generated/architecture.md](../../generated/architecture.md) -- full analysis with code examples and rationale.
562
562
563
+
**Architecture pattern: Vertical Slice Architecture.** Each CLI command is a natural vertical slice — thin command entry point → domain logic → data access → formatted output. This avoids the overhead of layered patterns (Hexagonal, Clean Architecture) that would create abstractions with only one implementation, while giving clear boundaries and independent testability per feature. The target end-state directory structure:
564
+
565
+
```
566
+
src/
567
+
commands/ # Thin CLI entry points (one per command)
-**Commands are thin** — parse args, call domain, format output. No business logic in CLI layer
583
+
-**Domain modules don't import presentation** — they return data, callers decide format
584
+
-**Shared kernel stays flat** — `db/`, `infrastructure/`, `shared/` are cross-cutting
585
+
-**No premature abstractions** — no interfaces/ports for single implementations
586
+
563
587
**Context:** Phases 2.5 and 2.7 added 38 modules and grew the codebase from 5K to 26,277 lines without introducing shared abstractions. The dual-function anti-pattern was replicated across 19 modules. Three independent AST analysis engines (complexity, CFG, dataflow) totaling 4,801 lines share the same fundamental pattern but no infrastructure. Raw SQL is scattered across 25+ modules touching 13 tables. The priority ordering has been revised based on actual growth patterns -- the new #1 priority is the unified AST analysis framework.
@@ -888,7 +912,51 @@ The repository pattern (3.3) enables true unit testing:
888
912
889
913
**Current gap:** Many "unit" tests still hit SQLite because there's no repository abstraction.
890
914
891
-
### 3.14 -- Remaining Items (Lower Priority)
915
+
### 3.14 -- Presentation Layer Extraction
916
+
917
+
Separate all output formatting from domain logic into a dedicated `src/presentation/` directory. Currently `viewer.js` (948 lines) and `export.js` (681 lines) mix graph traversal with rendering. `result-formatter.js` already exists in `infrastructure/` as a first step.
result-formatter.js # Structured result formatting (moved from infrastructure/)
927
+
```
928
+
929
+
- 🔲 Extract rendering logic from `viewer.js` — keep graph data loading in domain, move formatting to presentation
930
+
- 🔲 Extract serialization from `export.js` — DOT/Mermaid/JSON writers become pure data → string transforms
931
+
- 🔲 Extract table formatting helpers used across `queries-cli.js`, `complexity`, `stats`
932
+
- 🔲 Move `result-formatter.js` from `infrastructure/` to `presentation/` (it's output formatting, not infrastructure)
933
+
- 🔲 Extract Mermaid rendering from `sequence.js` into `sequence-renderer.js`
934
+
935
+
**Principle:** Domain functions return plain data objects. Presentation functions are pure transforms: `data → formatted string`. Commands wire the two together.
Once 3.2-3.4 are complete and analysis modules are standalone, group them under `src/domain/` by feature area. This is a move-only refactor — no logic changes, just directory organization to match the vertical slice target structure.
0 commit comments