Skip to content

Commit 04b7b08

Browse files
cdeustclaude
andcommitted
feat(wiki): add flow-diagram canonical section (parity with agentic-ai)
agentic-ai added a 14th canonical section ``flow-diagram`` alongside ``sequence-diagram`` because they cover different mermaid types and different intents: * ``sequenceDiagram`` — call traces between participants (caller → this file → callees). Lives in the existing ``sequence-diagram`` section. * ``flowchart`` / ``stateDiagram-v2`` — branching, lifecycle, decision trees within one component. Now lives in the new ``flow-diagram`` section. Lumping both into ``sequence-diagram`` forced the LLM to pick one and skip the other; splitting lets it author whichever shape fits the file's actual semantics. Changes: * ``core/wiki_curation_gaps.py`` — new ``CurationSection(name="flow-diagram", …)`` with probes for ``## Flow diagram`` / ``## Flowchart`` / ``## State diagram`` and the corresponding mermaid fence forms. ``sequence-diagram`` probes tightened so it no longer claims a ``## Flow diagram`` heading. * ``handlers/consolidation/headless_authoring.py`` — ``_GAP_DESCRIPTIONS`` + ``_gap_heading`` extended so the worker knows what to write under ``## Flow diagram``. * ``ui/unified/js/wiki.js`` — curation banner label for ``flow-diagram``, total section count bumped 13 → 14. 121-test wiki suite + ruff format + ruff check all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2ef0a08 commit 04b7b08

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

mcp_server/core/wiki_curation_gaps.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class CurationSection:
148148
heading="## Sequence diagram",
149149
probes=(
150150
"## Sequence diagram",
151-
"## Flow diagram",
152151
"## Sequence",
153152
"```mermaid\nsequenceDiagram",
154153
),
@@ -163,6 +162,29 @@ class CurationSection:
163162
"why."
164163
),
165164
),
165+
CurationSection(
166+
name="flow-diagram",
167+
heading="## Flow diagram",
168+
probes=(
169+
"## Flow diagram",
170+
"## Flowchart",
171+
"## State diagram",
172+
"```mermaid\nflowchart",
173+
"```mermaid\nstateDiagram",
174+
),
175+
min_chars_under_heading=120,
176+
description=(
177+
"A `mermaid` flowchart (or state diagram) of the file's "
178+
"branching logic, lifecycle, or decision tree. Use "
179+
"```mermaid flowchart TD/LR``` fences for branching, "
180+
"```mermaid stateDiagram-v2``` for state machines. "
181+
"Distinct from the sequence diagram above (sequenceDiagram "
182+
"covers call traces between participants; flowchart covers "
183+
"branching / lifecycle / trees within a single component). "
184+
'For files with no branching to depict, write "Not '
185+
'applicable" and explain why.'
186+
),
187+
),
166188
CurationSection(
167189
name="parameters",
168190
heading="## Parameters",

mcp_server/handlers/consolidation/headless_authoring.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,17 @@ def _scan_pages_with_gaps(wiki_root: Path) -> list[tuple[Path, dict[str, Any], s
461461
'data types, constants), explicitly write "Not applicable" '
462462
"and explain why."
463463
),
464+
"flow-diagram": (
465+
"A `mermaid` flowchart or state diagram of the file's "
466+
"branching logic, lifecycle, or decision tree. Use "
467+
"```mermaid flowchart TD``` (or `LR`) for branching, "
468+
"```mermaid stateDiagram-v2``` for state machines. "
469+
"Distinct from the sequence diagram (sequenceDiagram is "
470+
"for call traces between participants; flowchart covers "
471+
"branching / lifecycle / trees within one component). For "
472+
'files with no branching to depict, write "Not applicable" '
473+
"and explain why."
474+
),
464475
"parameters": (
465476
"Exhaustive table of every parameter exposed by this "
466477
"file's public entry points. Columns: name | type | "
@@ -500,6 +511,7 @@ def _gap_heading(name: str) -> str:
500511
"tests": "Tests",
501512
"see-also": "See also",
502513
"sequence-diagram": "Sequence diagram",
514+
"flow-diagram": "Flow diagram",
503515
"parameters": "Parameters",
504516
"request-example": "Request example",
505517
"response-example": "Response example",

ui/unified/js/wiki.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@
748748
// is not curation; visibility is.
749749
var gaps = meta.curation_gaps;
750750
if (Array.isArray(gaps) && gaps.length > 0) {
751-
var totalSections = 13; // matches FILE_DOC_SECTIONS (incl. sequence-diagram, parameters, request/response-example)
751+
var totalSections = 14; // matches FILE_DOC_SECTIONS (incl. sequence-diagram + flow-diagram + parameters + request/response-example)
752752
var coveredCount = Math.max(0, totalSections - gaps.length);
753753
var pct = Math.round(100 * coveredCount / totalSections);
754754
var banner = el('aside', 'wiki-curation-banner');
@@ -780,7 +780,8 @@
780780
'failure-modes': 'What can go wrong — failure modes + symptoms',
781781
tests: 'Tests — which test files exercise this',
782782
'see-also': 'See also — cross-links to architecture / services / api',
783-
'sequence-diagram': 'Sequence diagram — mermaid flow of caller → this file → callees',
783+
'sequence-diagram': 'Sequence diagram — mermaid sequenceDiagram of caller → this file → callees',
784+
'flow-diagram': 'Flow diagram — mermaid flowchart/stateDiagram of branching, lifecycle, decision tree',
784785
parameters: 'Parameters — exhaustive table (name, type, required, default, description)',
785786
'request-example': 'Request example — curl + headers / JSON-RPC envelope / call site',
786787
'response-example': 'Response example — every field annotated, success + error shapes',

0 commit comments

Comments
 (0)