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
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,8 @@ Stage by stage:
137
137
138
138
Three plugin roles drive the middle of the pipeline — **extractors** (source → facts), **explainers** (facts → insights), and **renderers** (snapshot → artifacts). Each is a small Go interface with a registry, so adding a language or an analysis is a self-contained addition rather than a change to the engine.
139
139
140
+
**One-shot explain mode.**`enola --explain [repo_path]` is an alternative exit path through the pipeline: stages 1–6 run normally, but instead of proceeding to stage 7 (Renderer) and stage 8 (Artifacts), `pkg/explain.Compute()` reads the fact store, produces a `Report` struct, and `report.Render()` prints a human-readable statistical summary to stdout. No artifacts are written; `.enola/` is not touched. See [The explain package (`pkg/explain`)](#the-explain-package-pkgexplain) below.
141
+
140
142
---
141
143
142
144
## Insights (explainers)
@@ -149,6 +151,36 @@ Explainers turn raw facts into architectural observations. Each insight carries
149
151
150
152
---
151
153
154
+
## The explain package (`pkg/explain`)
155
+
156
+
`pkg/explain` ([`pkg/explain/explain.go`](pkg/explain/explain.go)) is a **public** package rather than `internal/` for one reason: `enola-enterprise` imports it to append its own license-gated sections (dead code, package metrics) to the base `Report` before rendering. It is the only package in the OSS codebase with that cross-module consumer.
157
+
158
+
### `Report` and `Compute()`
159
+
160
+
`Compute(eng *bootstrap.Engine) *Report` reads the engine's current fact store and snapshot — it does not generate a snapshot; callers do that first. The fields it populates map directly to the seven output sections:
`CouplingUnresolved` is a special flag: it is set when dependency facts exist but no import edge resolved to a module, meaning coupling analysis is unavailable rather than genuinely zero. The renderer surfaces this as an explanatory note instead of implying the codebase has no coupling.
173
+
174
+
### Extensibility via `ExtraSections`
175
+
176
+
`Report.ExtraSections []Section` is the extension point for enterprise code. After calling `Compute()`, enterprise calls `report.AddSection(title, body)` (or directly appends `explain.Section{...}`) and then calls `report.Render()`. The renderer appends the extra sections after the seven base sections, using the same plain-text format. This design means `enola-enterprise` only depends on the exported `pkg/explain` surface and never needs to import `internal/facts` or `internal/engine` directly.
177
+
178
+
### Output format
179
+
180
+
`Render()` produces plain aligned text (not Markdown), designed to read well in a terminal without paging. Sections are separated by `═` rule lines (60 characters). Key-value pairs use `fmt.Fprintf` with a 20-character label width; tables (hotspots) use fixed-width column formats. No color codes — output is safe to pipe or capture in CI.
181
+
182
+
---
183
+
152
184
## The tools
153
185
154
186
enola is a stdio [MCP](https://modelcontextprotocol.io/) server. It exposes **seven tools** and no MCP resources — everything flows through tool calls. The tools defined in [`internal/server/server.go`](internal/server/server.go) are listed below, each leading with the question it answers.
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,6 +186,38 @@ Artifacts are written to the configured `output.dir` (default `.enola/`). Config
186
186
187
187
---
188
188
189
+
## Explain a repository at a glance
190
+
191
+
`enola --explain [repo_path]` is a one-shot mode that generates a snapshot, computes statistics over the fact graph, and prints a human-readable report to stdout — no MCP server started, no artifacts written to `.enola/`.
192
+
193
+
**When to use it:**
194
+
- New contributor getting a first orientation — module count, architecture pattern, hottest packages.
195
+
- Pre-refactor sanity check — cycles, layer violations, blast radius of top modules.
196
+
- Quick audit without spinning up an AI agent.
197
+
198
+
```bash
199
+
# Use the config in the current directory (mcp-arch.yaml)
200
+
enola --explain
201
+
202
+
# Analyze a specific repository path
203
+
enola --explain /path/to/repo
204
+
```
205
+
206
+
**The report covers seven sections:**
207
+
-**Overview** — path, analysis time, active languages, total fact count
-**Impact analysis (hotspots)** — top modules ranked by fan-in + fan-out coupling, with criticality tier and blast radius
214
+
215
+
No artifacts are written; `.enola/` is not touched. For a persistent snapshot with agent-readable output, use `--generate` or the MCP server.
216
+
217
+
For interactive per-module blast-radius queries with configurable depth, see the `impact_analysis` tool reference in **[ARCHITECTURE.md → The tools](ARCHITECTURE.md#the-tools)**.
218
+
219
+
---
220
+
189
221
## Learn more
190
222
191
223
-**[ARCHITECTURE.md](ARCHITECTURE.md)** — the concept, the fact model, the pipeline, and the full tool reference.
0 commit comments