@vpxa/aikit 0.1.73 → 0.1.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/package.json +9 -1
  2. package/packages/cli/dist/index.js +2 -2
  3. package/packages/cli/dist/{init-D_OGLUN1.js → init-CuRXmyD9.js} +4 -4
  4. package/packages/cli/dist/scaffold-WMQ2uQ48.js +2 -0
  5. package/packages/cli/dist/{templates-DJ7EC5vw.js → templates-ArdAVWoY.js} +13 -3
  6. package/packages/cli/dist/user-vbJwa7x2.js +5 -0
  7. package/packages/dashboard/dist/assets/index-C6D-PCp0.js.map +1 -1
  8. package/packages/flows/dist/index.d.ts +29 -0
  9. package/packages/flows/dist/index.js +1 -1
  10. package/packages/server/dist/index.js +1 -1
  11. package/packages/server/dist/{server-B9Mx1aK-.js → server-CVhVH5cT.js} +127 -127
  12. package/packages/tools/dist/index.d.ts +19 -1
  13. package/packages/tools/dist/index.js +39 -39
  14. package/scaffold/dist/adapters/claude-code.mjs +4 -0
  15. package/scaffold/dist/adapters/copilot.mjs +75 -0
  16. package/scaffold/dist/adapters/flows.mjs +1 -0
  17. package/scaffold/dist/adapters/skills.mjs +1 -0
  18. package/scaffold/dist/compiled/flows-data.mjs +1429 -0
  19. package/scaffold/dist/compiled/skills-data.mjs +9951 -0
  20. package/scaffold/dist/definitions/agents.mjs +9 -0
  21. package/scaffold/{definitions → dist/definitions}/bodies.mjs +6 -229
  22. package/scaffold/dist/definitions/exclusions.mjs +1 -0
  23. package/scaffold/dist/definitions/hooks.mjs +1 -0
  24. package/scaffold/dist/definitions/models.mjs +1 -0
  25. package/scaffold/dist/definitions/plugins.mjs +1 -0
  26. package/scaffold/{definitions → dist/definitions}/prompts.mjs +9 -149
  27. package/scaffold/{definitions → dist/definitions}/protocols.mjs +9 -37
  28. package/scaffold/dist/definitions/tools.mjs +1 -0
  29. package/packages/cli/dist/scaffold-CJwkHf-q.js +0 -2
  30. package/packages/cli/dist/user-BEmVW8Tp.js +0 -5
  31. package/scaffold/adapters/claude-code.mjs +0 -73
  32. package/scaffold/adapters/copilot.mjs +0 -292
  33. package/scaffold/definitions/agents.mjs +0 -266
  34. package/scaffold/definitions/hooks.mjs +0 -43
  35. package/scaffold/definitions/models.mjs +0 -84
  36. package/scaffold/definitions/plugins.mjs +0 -147
  37. package/scaffold/definitions/tools.mjs +0 -250
  38. package/scaffold/flows/_epilogue/steps/docs-sync/README.md +0 -120
  39. package/scaffold/flows/aikit-advanced/README.md +0 -70
  40. package/scaffold/flows/aikit-advanced/flow.json +0 -69
  41. package/scaffold/flows/aikit-advanced/steps/design/README.md +0 -178
  42. package/scaffold/flows/aikit-advanced/steps/execute/README.md +0 -145
  43. package/scaffold/flows/aikit-advanced/steps/plan/README.md +0 -122
  44. package/scaffold/flows/aikit-advanced/steps/spec/README.md +0 -121
  45. package/scaffold/flows/aikit-advanced/steps/task/README.md +0 -119
  46. package/scaffold/flows/aikit-advanced/steps/verify/README.md +0 -145
  47. package/scaffold/flows/aikit-basic/README.md +0 -51
  48. package/scaffold/flows/aikit-basic/flow.json +0 -45
  49. package/scaffold/flows/aikit-basic/steps/assess/README.md +0 -109
  50. package/scaffold/flows/aikit-basic/steps/design/README.md +0 -116
  51. package/scaffold/flows/aikit-basic/steps/implement/README.md +0 -131
  52. package/scaffold/flows/aikit-basic/steps/verify/README.md +0 -123
  53. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +0 -132
  54. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +0 -132
  55. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +0 -112
  56. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +0 -112
  57. package/scaffold/general/agents/Debugger.agent.md +0 -412
  58. package/scaffold/general/agents/Documenter.agent.md +0 -468
  59. package/scaffold/general/agents/Explorer.agent.md +0 -76
  60. package/scaffold/general/agents/Frontend.agent.md +0 -440
  61. package/scaffold/general/agents/Implementer.agent.md +0 -425
  62. package/scaffold/general/agents/Orchestrator.agent.md +0 -452
  63. package/scaffold/general/agents/Planner.agent.md +0 -481
  64. package/scaffold/general/agents/README.md +0 -57
  65. package/scaffold/general/agents/Refactor.agent.md +0 -435
  66. package/scaffold/general/agents/Researcher-Alpha.agent.md +0 -151
  67. package/scaffold/general/agents/Researcher-Beta.agent.md +0 -152
  68. package/scaffold/general/agents/Researcher-Delta.agent.md +0 -153
  69. package/scaffold/general/agents/Researcher-Gamma.agent.md +0 -152
  70. package/scaffold/general/agents/Security.agent.md +0 -433
  71. package/scaffold/general/agents/_shared/architect-reviewer-base.md +0 -104
  72. package/scaffold/general/agents/_shared/code-agent-base.md +0 -366
  73. package/scaffold/general/agents/_shared/code-reviewer-base.md +0 -87
  74. package/scaffold/general/agents/_shared/decision-protocol.md +0 -27
  75. package/scaffold/general/agents/_shared/forge-protocol.md +0 -90
  76. package/scaffold/general/agents/_shared/researcher-base.md +0 -114
  77. package/scaffold/general/agents/templates/adr-template.md +0 -28
  78. package/scaffold/general/agents/templates/execution-state.md +0 -26
  79. package/scaffold/general/prompts/aikit-ask.prompt.md +0 -13
  80. package/scaffold/general/prompts/aikit-debug.prompt.md +0 -15
  81. package/scaffold/general/prompts/aikit-design.prompt.md +0 -15
  82. package/scaffold/general/prompts/aikit-flow-add.prompt.md +0 -84
  83. package/scaffold/general/prompts/aikit-flow-create.prompt.md +0 -80
  84. package/scaffold/general/prompts/aikit-flow-manage.prompt.md +0 -24
  85. package/scaffold/general/prompts/aikit-implement.prompt.md +0 -17
  86. package/scaffold/general/prompts/aikit-plan.prompt.md +0 -15
  87. package/scaffold/general/prompts/aikit-review.prompt.md +0 -24
  88. package/scaffold/general/skills/adr-skill/SKILL.md +0 -335
  89. package/scaffold/general/skills/adr-skill/assets/templates/adr-madr.md +0 -89
  90. package/scaffold/general/skills/adr-skill/assets/templates/adr-readme.md +0 -20
  91. package/scaffold/general/skills/adr-skill/assets/templates/adr-simple.md +0 -46
  92. package/scaffold/general/skills/adr-skill/references/adr-conventions.md +0 -95
  93. package/scaffold/general/skills/adr-skill/references/examples.md +0 -193
  94. package/scaffold/general/skills/adr-skill/references/review-checklist.md +0 -77
  95. package/scaffold/general/skills/adr-skill/references/template-variants.md +0 -52
  96. package/scaffold/general/skills/adr-skill/scripts/bootstrap_adr.js +0 -259
  97. package/scaffold/general/skills/adr-skill/scripts/new_adr.js +0 -391
  98. package/scaffold/general/skills/adr-skill/scripts/set_adr_status.js +0 -169
  99. package/scaffold/general/skills/aikit/SKILL.md +0 -754
  100. package/scaffold/general/skills/brainstorming/SKILL.md +0 -265
  101. package/scaffold/general/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  102. package/scaffold/general/skills/c4-architecture/SKILL.md +0 -389
  103. package/scaffold/general/skills/c4-architecture/references/advanced-patterns.md +0 -552
  104. package/scaffold/general/skills/c4-architecture/references/c4-syntax.md +0 -510
  105. package/scaffold/general/skills/c4-architecture/references/common-mistakes.md +0 -437
  106. package/scaffold/general/skills/c4-architecture/references/html-design-system.md +0 -337
  107. package/scaffold/general/skills/c4-architecture/references/html-template.html +0 -627
  108. package/scaffold/general/skills/docs/SKILL.md +0 -553
  109. package/scaffold/general/skills/docs/references/diataxis-anti-patterns.md +0 -147
  110. package/scaffold/general/skills/docs/references/diataxis-compass.md +0 -123
  111. package/scaffold/general/skills/docs/references/diataxis-quadrants.md +0 -192
  112. package/scaffold/general/skills/docs/references/diataxis-quality.md +0 -76
  113. package/scaffold/general/skills/docs/references/diataxis-templates.md +0 -120
  114. package/scaffold/general/skills/docs/references/flow-artifacts-guide.md +0 -70
  115. package/scaffold/general/skills/docs/references/project-knowledge-gotchas.md +0 -32
  116. package/scaffold/general/skills/docs/references/project-knowledge-templates.md +0 -281
  117. package/scaffold/general/skills/docs/references/project-knowledge-workflow.md +0 -80
  118. package/scaffold/general/skills/frontend-design/SKILL.md +0 -237
  119. package/scaffold/general/skills/lesson-learned/SKILL.md +0 -113
  120. package/scaffold/general/skills/lesson-learned/references/anti-patterns.md +0 -55
  121. package/scaffold/general/skills/lesson-learned/references/se-principles.md +0 -109
  122. package/scaffold/general/skills/multi-agents-development/SKILL.md +0 -448
  123. package/scaffold/general/skills/multi-agents-development/architecture-review-prompt.md +0 -81
  124. package/scaffold/general/skills/multi-agents-development/code-quality-review-prompt.md +0 -91
  125. package/scaffold/general/skills/multi-agents-development/implementer-prompt.md +0 -93
  126. package/scaffold/general/skills/multi-agents-development/parallel-dispatch-example.md +0 -167
  127. package/scaffold/general/skills/multi-agents-development/spec-review-prompt.md +0 -81
  128. package/scaffold/general/skills/present/SKILL.md +0 -616
  129. package/scaffold/general/skills/react/SKILL.md +0 -309
  130. package/scaffold/general/skills/repo-access/SKILL.md +0 -178
  131. package/scaffold/general/skills/repo-access/references/error-patterns.md +0 -116
  132. package/scaffold/general/skills/repo-access/references/platform-matrix.md +0 -142
  133. package/scaffold/general/skills/requirements-clarity/SKILL.md +0 -333
  134. package/scaffold/general/skills/session-handoff/SKILL.md +0 -199
  135. package/scaffold/general/skills/session-handoff/references/handoff-template.md +0 -139
  136. package/scaffold/general/skills/session-handoff/references/resume-checklist.md +0 -80
  137. package/scaffold/general/skills/session-handoff/scripts/check_staleness.js +0 -269
  138. package/scaffold/general/skills/session-handoff/scripts/create_handoff.js +0 -299
  139. package/scaffold/general/skills/session-handoff/scripts/list_handoffs.js +0 -113
  140. package/scaffold/general/skills/session-handoff/scripts/validate_handoff.js +0 -241
  141. package/scaffold/general/skills/typescript/SKILL.md +0 -405
  142. package/scaffold/generate.mjs +0 -82
@@ -1,616 +0,0 @@
1
- ---
2
- name: present
3
- description: "Use the AI Kit `present` tool to display rich interactive dashboards, charts, timelines, status boards, and data visualizations in the browser or in-chat. Covers all block types, chart types, actions, composition patterns, and MCP Apps templates (list-sort, data-table, picker, flame-graph, form, timeline, kanban, tree, diff-view, dashboard). Load this skill before calling the present tool to ensure professional output."
4
- metadata:
5
- category: cross-cutting
6
- domain: general
7
- applicability: always
8
- inputs: [data, analysis]
9
- outputs: [dashboards, charts, reports]
10
- requires: [aikit]
11
- argument-hint: "Content to present — data, analysis results, status report, comparison, or interactive MCP App"
12
- ---
13
-
14
- # Present Tool — Rich Interactive Dashboards
15
-
16
- The `present` tool renders structured content as a professional dark-themed dashboard. It supports two output modes:
17
-
18
- - **`html`** — Renders an embedded UIResource for MCP-UI hosts (in-chat). Best for display-only content.
19
- - **`browser`** — Serves a themed dashboard on a local URL. Best when you need **user interaction** (buttons, selections, form input). The tool blocks until the user clicks an action, then returns their selection.
20
-
21
- ## Format Selection Rules (MUST FOLLOW)
22
-
23
- | Situation | Format | Why |
24
- |-----------|--------|-----|
25
- | Display-only content (tables, charts, reports, status boards) | **`html`** | No interaction needed — render in-chat |
26
- | Need user input back (confirmations, selections, form data) | **`browser`** | Browser supports blocking actions that return data |
27
- | Rich visual dashboards without interaction | **`html`** | Prefer in-chat when no response is needed |
28
- | User explicitly asks for browser | **`browser`** | Respect explicit preference |
29
- | **Running in CLI mode** (no VS Code chat panel) | **`browser`** | `html` UIResource is invisible in CLI — only plain markdown renders. Use `browser` so the system browser opens automatically with full rich visualization. |
30
-
31
- **Rule: If no user interaction is needed, use `format: "html"`. If you need user interaction, use `format: "browser"`.**
32
-
33
- > **⚠️ CLI Mode Override:** When running in CLI mode (terminal, not VS Code chat), **always use `format: "browser"`** regardless of whether interaction is needed. The `html` format relies on UIResource rendering in VS Code's MCP Apps panel — in CLI, only the markdown fallback text is shown, losing all rich visualizations (charts, tables, dashboards). The `browser` format starts a local HTTP server and auto-opens the system browser after 8 seconds, which works reliably in CLI.
34
-
35
- ---
36
-
37
- ## Browser Workflow (IMPORTANT — read carefully)
38
-
39
- When using `format: "browser"`, the tool starts a local HTTP server and returns a URL. **You MUST open the URL** so the user can see and interact with the dashboard.
40
-
41
- ### Steps:
42
- 1. Call `present` with `format: "browser"` and `actions` — it returns text containing `🌐 **Dashboard opened in browser:** http://127.0.0.1:{port}`
43
- 2. **Extract the URL from the response**
44
- 3. **Call `openBrowserPage({ url: "http://127.0.0.1:{port}" })` - PlayWright MCP to open it in VS Code's Simple Browser**
45
-
46
- ```
47
- // Step 1: Call present
48
- result = present({ format: "browser", title: "...", content: [...], actions: [...] })
49
-
50
- // Step 2: MUST open in VS Code Simple Browser
51
- openBrowserPage({ url: "http://127.0.0.1:{port}" }) // PlayWright MCP API to open URL in VS Code's Simple Browser
52
- ```
53
-
54
- > **Fallback**: The server also auto-opens the system browser as a safety net. But you should ALWAYS call `openBrowserPage` - PlayWright MCP yourself so the user sees it inside VS Code.
55
-
56
- **Note:** The HTTP server auto-closes after 5 minutes. Open the page promptly after receiving the URL.
57
-
58
- ---
59
-
60
- ## Content Architecture
61
-
62
- Content is an array of **typed blocks**. Each block has `{ type, title?, value }`. All blocks compose into a single unified page — use multiple blocks for sections.
63
-
64
- ### Core Block Types
65
-
66
- | Type | Value Shape | Renders As |
67
- |------|------------|------------|
68
- | `markdown` | `string` (markdown text) | Rendered HTML with full GFM support |
69
- | `code` | `string` (source code) | Syntax-highlighted code block |
70
- | `mermaid` | `string` (mermaid syntax) | Interactive diagram |
71
- | `table` | `Array<Record<string, unknown>>` | Sortable/filterable table |
72
- | `metrics` | `Array<{ label, value }>` | KPI metric cards grid |
73
- | `cards` | `Array<{ title, body, badge? }>` | Card grid layout |
74
- | `tree` | `Record<string, unknown>` | Expandable tree view |
75
- | `graph` | `{ nodes: [], edges: [] }` | Mermaid graph diagram |
76
-
77
- ### Chart Block
78
-
79
- ```json
80
- {
81
- "type": "chart",
82
- "title": "Revenue Trend",
83
- "value": {
84
- "chartType": "line",
85
- "data": [{"month": "Jan", "revenue": 1200}, {"month": "Feb", "revenue": 1800}],
86
- "xKey": "month",
87
- "yKeys": ["revenue"],
88
- "showLegend": true,
89
- "showGrid": true,
90
- "height": 300
91
- }
92
- }
93
- ```
94
-
95
- **Chart types:** `line`, `area`, `bar`, `horizontal-bar`, `pie`, `donut`, `sparkline`, `heatmap`
96
-
97
- > **⚠️ Chart Format**: Always use the ChartValue format shown above (`chartType`, `data`, `xKey`, `yKeys`). Do **NOT** use Chart.js format (`labels`, `datasets`) — while it will be auto-converted, the native ChartValue format is required for reliable rendering.
98
-
99
- ### New Block Types
100
-
101
- | Type | Value Shape | Renders As |
102
- |------|------------|------------|
103
- | `timeline` | `{ items: [{ phase?, title, description?, status? }] }` | Vertical timeline with status dots (done/active/pending/error) |
104
- | `checklist` | `{ items: [{ label, checked?, note? }] }` | Interactive checklist with checkmarks |
105
- | `comparison` | `{ columns: [{ title, items: [string] }] }` | Side-by-side comparison grid |
106
- | `status-board` | `{ items: [{ label, status, detail? }] }` | Status indicator rows (success/warning/error/info/pending) |
107
- | `prompt` | `{ question, context?, placeholder? }` | Highlighted question/prompt block |
108
- | `progress` | `{ items: [{ label, value, max? }] }` | Progress bars with percentages |
109
-
110
- ---
111
-
112
- ## Actions
113
-
114
- Actions are interactive buttons/selects. In `browser` mode, they render as clickable elements and the tool blocks until the user clicks, returning the selection.
115
-
116
- ```json
117
- {
118
- "actions": [
119
- { "type": "button", "id": "approve", "label": "Approve", "variant": "primary" },
120
- { "type": "button", "id": "reject", "label": "Reject", "variant": "danger" },
121
- { "type": "select", "id": "priority", "label": "Priority", "options": ["Low", "Medium", "High"] }
122
- ]
123
- }
124
- ```
125
-
126
- **Variants:** `primary` (indigo), `danger` (red), `default` (neutral)
127
-
128
- ---
129
-
130
- ## Composition Pattern
131
-
132
- Compose a full dashboard by combining multiple blocks in the `content` array:
133
-
134
- ```json
135
- {
136
- "format": "browser",
137
- "title": "Sprint Review",
138
- "content": [
139
- { "type": "metrics", "title": "Key Metrics", "value": [...] },
140
- { "type": "chart", "title": "Velocity", "value": { "chartType": "area", ... } },
141
- { "type": "timeline", "title": "Milestones", "value": { "items": [...] } },
142
- { "type": "status-board", "title": "Service Health", "value": { "items": [...] } },
143
- { "type": "table", "title": "Tasks", "value": [...] },
144
- { "type": "markdown", "value": "## Notes\n\nAdditional context..." }
145
- ],
146
- "actions": [
147
- { "type": "button", "id": "next-sprint", "label": "Plan Next Sprint", "variant": "primary" }
148
- ]
149
- }
150
- ```
151
-
152
- ---
153
-
154
- ## Design System
155
-
156
- The dashboard uses a professional dark theme:
157
- - **Font:** Plus Jakarta Sans (body), JetBrains Mono (code)
158
- - **Colors:** Deep navy background (`#182030`), indigo primary (`#818cf8`), no gradients
159
- - **12 chart colors** for multi-series data
160
- - **Status colors:** green (success), amber (warning), red (error), sky (info)
161
- - Clean borders, subtle hover states, no visual noise
162
-
163
- ---
164
-
165
- ## Architecture Diagrams
166
-
167
- > **Behavioral rule:** When asked to present, visualize, or display system architecture, infrastructure, or service topology — **always load the `c4-architecture` skill** and use its HTML/SVG format (Method 2 below) for rich visual output via `present`. The Mermaid method (Method 1) is acceptable only for quick in-chat previews or when the user explicitly asks for Mermaid. Default to HTML/SVG for all architecture presentations.
168
-
169
- The `present` tool can render C4-style architecture diagrams in both `html` and `browser` formats. The visual design system is centralized in the `c4-architecture` skill's reference file — load that skill for the full type registry, color palette, and template.
170
-
171
- **Design system source:** `c4-architecture/references/html-design-system.md` (single source of truth for all architecture diagram styling)
172
-
173
- ### When to Use (Auto-Trigger)
174
-
175
- Load the `c4-architecture` skill and use HTML/SVG format when the user:
176
- - Asks to "show architecture", "present the system design", "visualize infrastructure"
177
- - Wants to display service topology, deployment layout, or component relationships
178
- - Requests architecture review output, system overview dashboards, or technical presentations
179
- - Uses words like "architecture diagram", "system diagram", "infrastructure diagram"
180
-
181
- ### Rendering Methods
182
-
183
- | Method | Block Type | Format | When to Use |
184
- |--------|-----------|--------|-------------|
185
- | Mermaid C4 | `mermaid` | html / browser | Quick diagrams, developer-focused, version-controlled |
186
- | HTML/SVG | `markdown` | html / browser | Rich visual presentations, stakeholder reviews, dark-themed dashboards |
187
-
188
- ### Method 1: Mermaid C4 Diagrams
189
-
190
- Use a `mermaid` content block with standard C4 Mermaid syntax:
191
-
192
- present({
193
- format: "html", // or "browser"
194
- title: "System Architecture",
195
- content: [
196
- {
197
- type: "mermaid",
198
- title: "C4 Container Diagram",
199
- value: `C4Container
200
- title Container Diagram - Payment System
201
-
202
- Person(user, "Customer", "Places orders")
203
-
204
- Container_Boundary(app, "Payment Platform") {
205
-
206
- ---
207
-
208
- ## Rendering Troubleshooting
209
-
210
- ### Why `html` format sometimes shows raw text
211
-
212
- The `html` format renders content inside an MCP Apps companion iframe (UIResource). The chat text fallback is intentionally minimal (just the title). When the UIResource fails to load, the user sees only the title or raw JSON — NOT the rendered dashboard.
213
-
214
- **Common causes of UIResource rendering failure:**
215
- 1. **MCP Apps not enabled** — The setting `chat.mcp.apps.enabled` must be `true` in VS Code settings
216
- 2. **Companion app build missing** — The `packages/present` companion app must be built (`npm run build`)
217
- 3. **Content too large** — Very large content arrays (20+ blocks or tables with 50+ rows) may cause the companion iframe to fail silently
218
- 4. **Iframe loading error** — Network issues, CSP restrictions, or extension conflicts can prevent the iframe from loading
219
-
220
- ### When to prefer `browser` over `html`
221
-
222
- Use `format: "browser"` instead of `html` when:
223
- - Content has **10+ blocks** or tables with **20+ rows** (large payloads are more reliable in browser)
224
- - The output must be **guaranteed visible** (browser format always opens, no silent failures)
225
- - You need **charts + tables + markdown** in the same view (browser renders all block types reliably)
226
- - The user reports that `html` format "didn't show anything" or "showed raw text"
227
-
228
- > **Reliability rule:** If content is complex (5+ blocks of mixed types), prefer `format: "browser"` for guaranteed rendering. The `html` format is best for simple, single-block content.
229
-
230
- ### Content formatting tips to avoid rendering issues
231
-
232
- 1. **Use `table` block type** instead of markdown tables inside `markdown` blocks — `table` blocks render natively; markdown pipe-tables may show as raw text in fallback
233
- 2. **Use `cards` and `metrics`** for summary data instead of embedding it in markdown text
234
- 3. **Keep `markdown` blocks for narrative text only** — don't embed HTML, tables, or complex formatting
235
- 4. **Split large content** into multiple smaller `present` calls rather than one massive content array
236
- 5. **For charts:** Always use ChartValue format (`chartType`, `data`, `xKey`, `yKeys`) — NOT Chart.js format (`labels`, `datasets`)
237
-
238
- ---
239
-
240
- Container(api, "API Gateway", "Kong", "Routes requests")
241
- Container(svc, "Payment Service", "Node.js", "Processes payments")
242
- ContainerDb(db, "Payment DB", "PostgreSQL", "Transaction records")
243
- }
244
-
245
- System_Ext(stripe, "Stripe", "Payment processor")
246
-
247
- Rel(user, api, "HTTPS")
248
- Rel(api, svc, "gRPC")
249
- Rel(svc, db, "SQL")
250
- Rel(svc, stripe, "REST")`
251
- }
252
- ]
253
- })
254
- ```
255
-
256
- ### Method 2: HTML/SVG Architecture Diagrams
257
-
258
- For rich visual output, embed the full HTML/SVG diagram in a `markdown` block. Compose with `metrics` and `cards` blocks for a complete dashboard.
259
-
260
- **Both `format: "html"` and `format: "browser"` work with this approach.**
261
-
262
- ```js
263
- present({
264
- format: "html", // or "browser"
265
- title: "System Architecture",
266
- content: [
267
- {
268
- type: "metrics",
269
- title: "Overview",
270
- value: [
271
- { label: "Services", value: "6" },
272
- { label: "Data Stores", value: "2" },
273
- { label: "External Systems", value: "3" }
274
- ]
275
- },
276
- {
277
- type: "markdown",
278
- title: "Architecture Diagram",
279
- value: "<div class='arch-diagram'><style>/* design system CSS from c4-architecture/references/html-design-system.md */</style><svg viewBox='0 0 1000 680'><!-- SVG components using category colors --></svg></div>"
280
- },
281
- {
282
- type: "cards",
283
- title: "Component Summary",
284
- value: [
285
- { title: "Frontend", body: "React SPA + CDN delivery" },
286
- { title: "Backend", body: "3 microservices, gRPC mesh" },
287
- { title: "Data", body: "PostgreSQL + Redis cache" }
288
- ]
289
- }
290
- ]
291
- })
292
- ```
293
-
294
- ### Component Categories (Quick Reference)
295
-
296
- The full type registry with sub-types and icon slots is in `c4-architecture/references/html-design-system.md`. Here is the category summary:
297
-
298
- | Category | Stroke | CSS Class | Use For |
299
- |----------|--------|-----------|---------|
300
- | Frontend | `#22d3ee` | `.cyan` | SPAs, mobile apps, static sites, PWAs |
301
- | Backend | `#34d399` | `.emerald` | API services, workers, microservices, serverless |
302
- | Data | `#a78bfa` | `.violet` | Databases, caches, search engines, warehouses |
303
- | Infrastructure | `#fbbf24` | `.amber` | CDNs, load balancers, DNS, storage |
304
- | Messaging | `#fb923c` | `.orange` | Queues, event buses, streams, pub/sub |
305
- | Security | `#fb7185` | `.rose` | Auth, API gateways, WAF, secret managers |
306
- | External | `#94a3b8` | `.slate` | Third-party APIs, SaaS, legacy systems |
307
- | Monitoring | `#38bdf8` | `.sky` | Logging, metrics, tracing, alerting |
308
-
309
- > **Centralization note:** Do not duplicate colors or type definitions here. The `c4-architecture` skill's design system is the single source of truth. When categories or colors change, they are updated in one place.
310
-
311
- ---
312
-
313
- ## Best Practices
314
-
315
- 1. **Use `browser` format** for data-rich content — charts, tables, dashboards. **Always use `browser` in CLI mode** (the `html` UIResource doesn't render in terminal environments).
316
- 2. **Combine block types** — metrics + charts + tables in one page
317
- 3. **Add titles** to every block for clear section headings
318
- 4. **Use actions** when you need user decisions — the tool returns the selection
319
- 5. **Keep markdown blocks** for narrative context between data sections
320
- 6. **Chart tips:**
321
- - Use `area` for trends over time
322
- - Use `bar` for comparisons between categories
323
- - Use `donut` for proportions/distributions
324
- - Use `sparkline` inline with metrics for mini trends
325
- 7. **Table auto-features:** Tables with 5+ rows get automatic search/filter. Columns are sortable by click.
326
-
327
- ---
328
-
329
- ## Rendering Troubleshooting
330
-
331
- ### Why `html` format sometimes shows raw text
332
-
333
- The `html` format renders content inside an MCP Apps companion iframe (UIResource). The chat text fallback is intentionally minimal (just the title). When the UIResource fails to load, the user sees only the title or raw JSON — NOT the rendered dashboard.
334
-
335
- **Common causes of UIResource rendering failure:**
336
- 1. **MCP Apps not enabled** — The setting `chat.mcp.apps.enabled` must be `true` in VS Code settings
337
- 2. **Companion app build missing** — The `packages/present` companion app must be built (`npm run build`)
338
- 3. **Content too large** — Very large content arrays (20+ blocks or tables with 50+ rows) may cause the companion iframe to fail silently
339
- 4. **Iframe loading error** — Network issues, CSP restrictions, or extension conflicts can prevent the iframe from loading
340
-
341
- ### When to prefer `browser` over `html`
342
-
343
- Use `format: "browser"` instead of `html` when:
344
- - Content has **10+ blocks** or tables with **20+ rows** (large payloads are more reliable in browser)
345
- - The output must be **guaranteed visible** (browser format always opens, no silent failures)
346
- - You need **charts + tables + markdown** in the same view (browser renders all block types reliably)
347
- - The user reports that `html` format "didn't show anything" or "showed raw text"
348
-
349
- > **Reliability rule:** If content is complex (5+ blocks of mixed types), prefer `format: "browser"` for guaranteed rendering. The `html` format is best for simple, single-block content.
350
-
351
- ### Content formatting tips to avoid rendering issues
352
-
353
- 1. **Use `table` block type** instead of markdown tables inside `markdown` blocks — `table` blocks render natively; markdown pipe-tables may show as raw text in fallback
354
- 2. **Use `cards` and `metrics`** for summary data instead of embedding it in markdown text
355
- 3. **Keep `markdown` blocks for narrative text only** — don't embed HTML, tables, or complex formatting
356
- 4. **Split large content** into multiple smaller `present` calls rather than one massive content array
357
- 5. **For charts:** Always use ChartValue format (`chartType`, `data`, `xKey`, `yKeys`) — NOT Chart.js format (`labels`, `datasets`)
358
-
359
- ---
360
-
361
- ## MCP Apps Templates (VS Code Chat Widgets)
362
-
363
- When `chat.mcp.apps.enabled` is true in VS Code settings, the `present` tool can render **interactive widgets directly in the chat panel** using the `template` parameter. These are distinct from the browser/html dashboard modes.
364
-
365
- **Key difference:** Templates use `template` + object `content` (not array of blocks). No `format` parameter needed. The widget renders inline in VS Code chat. User interactions (reorder, select, submit) are returned to the LLM as structured data.
366
-
367
- ### When to use MCP Apps vs Browser Dashboard
368
-
369
- | Use Case | Mode | Why |
370
- |----------|------|-----|
371
- | Quick user input (pick items, reorder, fill form) | **MCP App template** | Inline in chat, no context switch |
372
- | Rich multi-section dashboard with charts | **browser** | Full page layout with all block types |
373
- | Simple confirmation or selection | **Actions** (browser/html) | Buttons/selects in dashboard |
374
-
375
- ### Template: `list-sort`
376
-
377
- Drag-and-drop reorderable list. Use for priority ordering, task sequencing, or ranked preferences.
378
-
379
- ```json
380
- {
381
- "template": "list-sort",
382
- "title": "Priority Order",
383
- "content": {
384
- "items": [
385
- { "id": "task-1", "label": "Fix authentication bug" },
386
- { "id": "task-2", "label": "Add search feature" },
387
- { "id": "task-3", "label": "Update documentation" }
388
- ]
389
- }
390
- }
391
- ```
392
-
393
- **Content schema:** `{ items: Array<{ id: string, label: string }> }`
394
- **Returns:** Reordered array of items after user drags to reorder and submits.
395
-
396
- ### Template: `data-table`
397
-
398
- Filterable, sortable table with optional summary stat cards. Use for structured data review, change summaries, or audit results.
399
-
400
- ```json
401
- {
402
- "template": "data-table",
403
- "title": "File Changes",
404
- "content": {
405
- "columns": [
406
- { "key": "file", "label": "File" },
407
- { "key": "change", "label": "Change" },
408
- { "key": "lines", "label": "Lines" }
409
- ],
410
- "rows": [
411
- { "file": "auth.ts", "change": "Added guard", "lines": 5 },
412
- { "file": "cache.ts", "change": "Fixed bug", "lines": 12 }
413
- ],
414
- "stats": [
415
- { "label": "Files Changed", "value": "2" },
416
- { "label": "Total Lines", "value": "17" }
417
- ]
418
- }
419
- }
420
- ```
421
-
422
- **Content schema:** `{ columns: Array<{ key: string, label: string }>, rows: Array<Record<string, unknown>>, stats?: Array<{ label: string, value: string }> }`
423
- **Returns:** Selected row(s) data when user interacts and submits.
424
-
425
- ### Template: `picker`
426
-
427
- Multi-select with categories and tag-based search. Use for component selection, feature toggles, or module picking.
428
-
429
- ```json
430
- {
431
- "template": "picker",
432
- "title": "Select Modules",
433
- "content": {
434
- "categories": [
435
- { "id": "core", "label": "Core" },
436
- { "id": "plugins", "label": "Plugins" }
437
- ],
438
- "items": [
439
- { "id": "auth", "label": "Authentication", "category": "core", "tags": ["security"] },
440
- { "id": "cache", "label": "Cache Layer", "category": "core", "tags": ["performance"] },
441
- { "id": "sentry", "label": "Sentry Plugin", "category": "plugins", "tags": ["monitoring"] }
442
- ]
443
- }
444
- }
445
- ```
446
-
447
- **Content schema:** `{ categories: Array<{ id: string, label: string }>, items: Array<{ id: string, label: string, category: string, tags?: string[] }> }`
448
- **Returns:** Array of selected item IDs after user checks items and submits.
449
-
450
- ### Template: `flame-graph`
451
-
452
- Hierarchical zoomable visualization. Use for codebase structure, performance profiles, dependency trees, or budget breakdowns.
453
-
454
- ```json
455
- {
456
- "template": "flame-graph",
457
- "title": "Module Hierarchy",
458
- "content": {
459
- "profile": {
460
- "name": "root",
461
- "total": 100,
462
- "children": [
463
- {
464
- "name": "packages/tools",
465
- "total": 60,
466
- "children": [
467
- { "name": "search.ts", "total": 35 },
468
- { "name": "compact.ts", "total": 25 }
469
- ]
470
- },
471
- { "name": "packages/server", "total": 40 }
472
- ]
473
- }
474
- }
475
- }
476
- ```
477
-
478
- **Content schema:** `{ profile: { name: string, total: number, children?: Array<(recursive)> } }`
479
- **Returns:** Clicked node information when user interacts.
480
-
481
- ### Template: `form`
482
-
483
- Input fields with text inputs, selects, and checkboxes. Use for configuration, parameter collection, or setup wizards.
484
-
485
- ```json
486
- {
487
- "template": "form",
488
- "title": "Project Configuration",
489
- "content": {
490
- "fields": [
491
- { "name": "projectName", "label": "Project Name", "type": "text", "value": "my-app" },
492
- { "name": "framework", "label": "Framework", "type": "select", "options": ["React", "Vue", "Svelte"], "value": "React" },
493
- { "name": "typescript", "label": "Use TypeScript", "type": "checkbox", "value": true },
494
- { "name": "description", "label": "Description", "type": "text", "value": "" }
495
- ]
496
- }
497
- }
498
- ```
499
-
500
- **Content schema:** `{ fields: Array<{ name: string, label: string, type: "text" | "select" | "checkbox", value?: string | boolean, options?: string[] }> }`
501
- **Returns:** Object with field name-value pairs after user fills out and submits.
502
-
503
- ### MCP Apps Best Practices
504
-
505
- 1. **Use meaningful `id` values** — they are returned in responses and used for programmatic handling.
506
- 2. **Keep list-sort items under 15** — longer lists become unwieldy for drag-and-drop.
507
- 3. **Always provide `value` defaults** in forms — pre-fill with sensible defaults to reduce user effort.
508
- 4. **Use `tags` in picker** — they power the search/filter functionality.
509
- 5. **Flame-graph `total` values** should be consistent — parent total should equal sum of children.
510
- 6. **Data-table `stats`** are optional — use them for KPI summary cards above the table.
511
- 7. **Combine with LLM logic** — use returned values to drive next steps (e.g., form → generate config, picker → scope analysis).
512
-
513
- #### 6. `timeline` — Vertical Event Timeline (display only)
514
-
515
- ```json
516
- {
517
- "events": [
518
- {"title": "v1.0 Release", "description": "Initial release with core features", "timestamp": "2025-01", "status": "complete"},
519
- {"title": "v2.0 Beta", "description": "MCP Apps support", "timestamp": "2025-07", "status": "active"},
520
- {"title": "v3.0 Planning", "status": "pending"}
521
- ]
522
- }
523
- ```
524
-
525
- Fields: `title` (required), `description?`, `timestamp?`, `status?` (`'complete'|'active'|'pending'|'error'`), `icon?`, `category?`
526
-
527
- #### 7. `kanban` — Drag-Drop Board (interactive — emits on card move)
528
-
529
- ```json
530
- {
531
- "columns": [
532
- {"id": "todo", "label": "To Do"},
533
- {"id": "in-progress", "label": "In Progress", "color": "#3b82f6"},
534
- {"id": "done", "label": "Done", "color": "#22c55e"}
535
- ],
536
- "cards": [
537
- {"id": "c1", "title": "Fix auth bug", "column": "todo", "tags": ["bugfix"], "priority": "high"},
538
- {"id": "c2", "title": "Add search", "column": "in-progress", "tags": ["feature"], "priority": "medium"}
539
- ]
540
- }
541
- ```
542
-
543
- Returns `{cardId, fromColumn, toColumn}` when a card is dragged between columns.
544
-
545
- #### 8. `tree` — Collapsible Tree View (display only)
546
-
547
- ```json
548
- {
549
- "root": {
550
- "label": "packages/",
551
- "children": [
552
- {"label": "server/", "children": [{"label": "index.ts"}, {"label": "tools/", "children": [{"label": "present.ts"}]}]},
553
- {"label": "present/", "children": [{"label": "present-app.ts"}]}
554
- ]
555
- }
556
- }
557
- ```
558
-
559
- Fields: `label` (required), `id?`, `icon?`, `children?: TreeNode[]`, `metadata?: Record<string,string>`. Accepts `root` as single node or array of nodes.
560
-
561
- #### 9. `diff-view` — Side-by-Side Code Diff (display only)
562
-
563
- ```json
564
- {
565
- "files": [{
566
- "path": "auth.ts",
567
- "status": "modified",
568
- "additions": 12,
569
- "deletions": 3,
570
- "hunks": [{
571
- "header": "@@ -10,5 +10,14 @@",
572
- "changes": [
573
- {"type": "context", "content": "const auth = {};"},
574
- {"type": "delete", "content": "// old validation"},
575
- {"type": "add", "content": "// new JWT validation"},
576
- {"type": "add", "content": "const token = verify(jwt);"}
577
- ]
578
- }]
579
- }],
580
- "stats": {"additions": 12, "deletions": 3, "filesChanged": 1}
581
- }
582
- ```
583
-
584
- Status values: `'added'|'modified'|'deleted'|'renamed'`. Change types: `'add'|'delete'|'context'`.
585
-
586
- #### 10. `dashboard` — Metric Cards Grid (display only)
587
-
588
- ```json
589
- {
590
- "metrics": [
591
- {"label": "Uptime", "value": "99.9%", "status": "success", "trend": {"value": "+0.1%", "direction": "up"}},
592
- {"label": "Build Time", "value": "4.2s", "type": "progress", "progress": 42, "status": "warning"},
593
- {"label": "Top Endpoints", "type": "list", "value": "3", "items": [
594
- {"label": "/api/search", "value": "1.2k/day"},
595
- {"label": "/api/present", "value": "890/day"}
596
- ]}
597
- ]
598
- }
599
- ```
600
-
601
- Metric types: `'stat'` (default), `'progress'` (with bar), `'list'` (sub-items). Status: `'success'|'warning'|'error'|'info'`.
602
-
603
- ### Interaction Summary (All 10 Templates)
604
-
605
- | Template | Trigger | Data Returned to LLM |
606
- |----------|---------|---------------------|
607
- | list-sort | Auto on drag-drop | Reordered ID array |
608
- | data-table | Export button | Current filtered rows |
609
- | picker | Apply Selection button | Selected ID array |
610
- | flame-graph | Auto on node click | Clicked node object |
611
- | form | Submit button | Field values object |
612
- | kanban | Auto on card drag | `{cardId, fromColumn, toColumn}` |
613
- | timeline | Display only | — |
614
- | tree | Display only | — |
615
- | diff-view | Display only | — |
616
- | dashboard | Display only | — |