|
203 | 203 | code block MUST still follow — the JSON is supplementary metadata, NOT a |
204 | 204 | replacement for the Mermaid diagram. |
205 | 205 |
|
| 206 | +The JSON MUST include a "simplifiedMermaidSource" field containing a simplified |
| 207 | +overview version of the diagram. This simplified version is critical for users |
| 208 | +who want a high-level understanding at a glance. |
| 209 | +
|
206 | 210 | Format: |
207 | 211 | <!-- DIAGRAM_DATA_START --> |
208 | 212 | { |
209 | 213 | "nodes": [ |
210 | 214 | { "id": "A", "label": "Frontend App", "technology": "react", "files": ["src/App.tsx"], "description": "Main React application", "depth": 0 }, |
211 | | - { "id": "B", "label": "API Server", "technology": "fastapi", "files": ["api/api.py"], "description": "REST API backend", "depth": 0 } |
| 215 | + { "id": "B", "label": "API Server", "technology": "fastapi", "files": ["api/api.py"], "description": "REST API backend", "depth": 0 }, |
| 216 | + { "id": "C", "label": "Database", "technology": "postgresql", "files": ["db/models.py"], "description": "Data persistence layer", "depth": 0 }, |
| 217 | + { "id": "D", "label": "Auth Service", "technology": "python", "files": ["api/auth.py"], "description": "Authentication and authorization", "depth": 1 }, |
| 218 | + { "id": "E", "label": "Cache Layer", "technology": "redis", "files": ["api/cache.py"], "description": "Response caching", "depth": 1 } |
212 | 219 | ], |
213 | 220 | "edges": [ |
214 | | - { "source": "A", "target": "B", "label": "HTTP requests", "type": "api_call" } |
| 221 | + { "source": "A", "target": "B", "label": "HTTP requests", "type": "api_call" }, |
| 222 | + { "source": "B", "target": "C", "label": "queries", "type": "data_flow" }, |
| 223 | + { "source": "B", "target": "D", "label": "validates tokens", "type": "dependency" }, |
| 224 | + { "source": "B", "target": "E", "label": "reads/writes", "type": "data_flow" } |
215 | 225 | ], |
216 | | - "mermaidSource": "graph TD\n A[Frontend App] --> B[API Server]", |
217 | | - "diagramType": "flowchart" |
| 226 | + "mermaidSource": "graph TD\n A[Frontend App] -->|HTTP requests| B[API Server]\n B -->|queries| C[Database]\n B -->|validates tokens| D[Auth Service]\n B -->|reads/writes| E[Cache Layer]", |
| 227 | + "diagramType": "flowchart", |
| 228 | + "simplifiedMermaidSource": "graph TD\n A[Frontend App] --> B[API Server]\n B --> C[Database]\n B --> D[External Services]" |
218 | 229 | } |
219 | 230 | <!-- DIAGRAM_DATA_END --> |
220 | 231 |
|
221 | 232 | ```mermaid |
222 | 233 | graph TD |
223 | | - A[Frontend App] --> B[API Server] |
| 234 | + A[Frontend App] -->|HTTP requests| B[API Server] |
| 235 | + B -->|queries| C[Database] |
| 236 | + B -->|validates tokens| D[Auth Service] |
| 237 | + B -->|reads/writes| E[Cache Layer] |
224 | 238 | ``` |
225 | 239 |
|
226 | 240 | Rules for the structured JSON: |
|
232 | 246 | - "mermaidSource" must contain the exact Mermaid source used in the code fence |
233 | 247 | - If a diagram has no meaningful structured metadata, you may omit the JSON block |
234 | 248 | - The JSON must be valid — if you are unsure, omit it rather than produce invalid JSON |
| 249 | +
|
| 250 | +Rules for "simplifiedMermaidSource" (the simplified overview diagram): |
| 251 | +- MUST contain a valid Mermaid diagram with MAXIMUM 5-8 nodes |
| 252 | +- Show ONLY the highest-level architectural components (think "executive summary") |
| 253 | +- Use clear, short labels (2-4 words each, e.g., "User Interface", "API Layer", "Database") |
| 254 | +- Use simple relationships WITHOUT detailed edge labels (just arrows, no labels) |
| 255 | +- Collapse related sub-components into a single node (e.g., merge "Auth Service" + "User Service" into "Backend Services") |
| 256 | +- The simplified diagram must be immediately understandable at a glance by a non-technical person |
| 257 | +- If the full diagram already has 8 or fewer nodes, simplifiedMermaidSource can match mermaidSource |
| 258 | +- Do NOT include implementation details, file names, or technical jargon in the simplified version |
235 | 259 | </structured_diagram_data> |
236 | 260 | """ |
237 | 261 |
|
|
0 commit comments