@vpxa/aikit 0.1.157 → 0.1.158

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.
@@ -1,603 +1 @@
1
- function e({blockDocs:e}={}){return[{file:`SKILL.md`,content:`---
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
- ## Quick Reference
17
-
18
- **Transport rule:**
19
- - No \`actions\` array — renders inline as an MCP App surface in the host client.
20
- - \`actions\` array present — switches to browser transport and opens the system browser.
21
-
22
- **Content blocks** (pass as \`blocks\` array of \`{ type, title?, value }\`):
23
- | Type | Value shape | Use for |
24
- |------|-------------|---------|
25
- | \`markdown\` | string | Prose, headings, code — **never tables** |
26
- | \`table\` | \`Record[]\` or \`{headers,rows}\` | **All tabular data** (NEVER put tables in markdown blocks) |
27
- | \`chart\` | \`{chartType,data,xKey,yKeys}\` | Bar, line, area, pie, radar, scatter |
28
- | \`metrics\` | \`[{label,value,trend?,status?}]\` | KPI cards |
29
- | \`cards\` | \`[{title,body?,badge?,status?}]\` | Info cards |
30
- | \`mermaid\` | string | Diagrams |
31
- | \`tree\` | \`{name,children?}\` | Hierarchical data |
32
- | \`timeline\` | \`[{title,description?,timestamp?,status?}]\` | Event sequences |
33
- | \`checklist\` | \`[{label,checked}]\` | Todo/check lists |
34
- | \`code\` | string | Code blocks |
35
-
36
- **Actions** (interactive buttons/selects; adding them switches transport to browser):
37
- \`\`\`json
38
- { "actions": [{ "type": "button", "id": "approve", "label": "Approve", "variant": "primary" }] }
39
- \`\`\`
40
-
41
- **Anti-patterns:**
42
- - ❌ Tables inside \`markdown\` blocks → renders as raw pipe text
43
- - ❌ Assuming a \`format\` field exists → transport is inferred from \`actions\`
44
- - ❌ Unicode escapes in \`title\` param (\`\\u2014\`) → literal text (use actual — character)
45
- - ❌ Chart.js format (\`{labels,datasets}\`) → use \`{chartType,data,xKey,yKeys}\`
46
-
47
- The \`present\` tool renders structured content as a professional dark-themed dashboard. Transport is determined automatically:
48
-
49
- - **Inline MCP App transport** — No \`actions\`. Best for display-only content rendered inline in the host client.
50
- - **Browser transport** — \`actions\` present. Best when you need user interaction or full-page rendering outside the chat surface.
51
-
52
- ## Transport Selection Rules (MUST FOLLOW)
53
-
54
- | Situation | Include \`actions\`? | Transport | Why |
55
- |-----------|----------------------|-----------|-----|
56
- | Display-only content (tables, charts, reports, status boards) | **No** | **Inline MCP App** | No interaction needed — render inline in the host client |
57
- | Need user input back (confirmations, selections, form data) | **Yes** | **Browser** | Actions trigger browser transport and return structured results |
58
- | Rich visual dashboards without interaction | **No** | **Inline MCP App** | Keep the result in-chat when no response is needed |
59
- | User explicitly asks for browser | **Yes** | **Browser** | Add at least one action to force browser transport |
60
- | **Running in CLI mode** and need a full visual surface | **Yes** | **Browser** | Inline MCP App rendering is IDE-hosted; add a minimal action so the browser opens |
61
-
62
- **Rule: Omit \`actions\` for inline rendering. Add \`actions\` when you need browser transport or interaction back from the user.**
63
-
64
- > **⚠️ CLI Note:** CLI environments do not host inline MCP App surfaces. If you need a full visual dashboard from CLI, include a minimal \`actions\` array such as an \`Acknowledge\` button so the tool uses browser transport.
65
-
66
- ---
67
-
68
- ## Browser Transport Workflow (IMPORTANT — read carefully)
69
-
70
- When \`actions\` is present, the tool uses browser transport and opens the system browser. The selected action is returned to the model as structured data.
71
-
72
- ### Steps:
73
- 1. Call \`present\` with \`actions\` and your \`blocks\`
74
- 2. Let the tool open the browser transport automatically
75
- 3. Wait for the user's action result before continuing
76
-
77
- \`\`\`
78
- result = present({
79
- schemaVersion: 1,
80
- title: "Review Dashboard",
81
- blocks: [...],
82
- actions: [{ id: "ack", type: "button", label: "Acknowledge" }]
83
- })
84
- \`\`\`
85
-
86
- > **Important:** Do not document or call a separate \`browser({ action: 'open' })\` step for a \`present\` surface. Browser transport is selected by \`actions\`, not by a \`format\` parameter.
87
-
88
- ---
89
-
90
- ## Content Architecture
91
-
92
- 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.
93
-
94
- ${e?.bySkill?.present||``}
95
-
96
- ---
97
-
98
- ## Actions
99
-
100
- Actions are interactive buttons/selects. In \`browser\` mode, they render as clickable elements and the tool blocks until the user clicks, returning the selection.
101
-
102
- \`\`\`json
103
- {
104
- "actions": [
105
- { "type": "button", "id": "approve", "label": "Approve", "variant": "primary" },
106
- { "type": "button", "id": "reject", "label": "Reject", "variant": "danger" },
107
- { "type": "select", "id": "priority", "label": "Priority", "options": ["Low", "Medium", "High"] }
108
- ]
109
- }
110
- \`\`\`
111
-
112
- **Variants:** \`primary\` (indigo), \`danger\` (red), \`default\` (neutral)
113
-
114
- ---
115
-
116
- ## Composition Pattern
117
-
118
- Compose a full dashboard by combining multiple blocks in the \`blocks\` array:
119
-
120
- \`\`\`json
121
- {
122
- "schemaVersion": 1,
123
- "title": "Sprint Review",
124
- "blocks": [
125
- { "type": "metrics", "title": "Key Metrics", "value": [...] },
126
- { "type": "chart", "title": "Velocity", "value": { "chartType": "area", ... } },
127
- { "type": "timeline", "title": "Milestones", "value": { "items": [...] } },
128
- { "type": "status-board", "title": "Service Health", "value": { "items": [...] } },
129
- { "type": "table", "title": "Tasks", "value": [...] },
130
- { "type": "markdown", "value": "## Notes\n\nAdditional context..." }
131
- ],
132
- "actions": [
133
- { "type": "button", "id": "next-sprint", "label": "Plan Next Sprint", "variant": "primary" }
134
- ]
135
- }
136
- \`\`\`
137
-
138
- ---
139
-
140
- ## Design System
141
-
142
- The dashboard uses a professional dark theme:
143
- - **Font:** Plus Jakarta Sans (body), JetBrains Mono (code)
144
- - **Colors:** Deep navy background (\`#182030\`), indigo primary (\`#818cf8\`), no gradients
145
- - **12 chart colors** for multi-series data
146
- - **Status colors:** green (success), amber (warning), red (error), sky (info)
147
- - Clean borders, subtle hover states, no visual noise
148
-
149
- ---
150
-
151
- ## Architecture Diagrams
152
-
153
- > **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 approach (Method 2 below) for rich visual output via \`present\`. The Mermaid method (Method 1) is acceptable only for quick inline previews or when the user explicitly asks for Mermaid. Default to HTML/SVG for all architecture presentations.
154
-
155
- The \`present\` tool can render C4-style architecture diagrams in either transport. Omit \`actions\` for inline rendering, or add \`actions\` when you need browser transport. 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.
156
-
157
- **Design system source:** \`c4-architecture/references/html-design-system.md\` (single source of truth for all architecture diagram styling)
158
-
159
- ### When to Use (Auto-Trigger)
160
-
161
- Load the \`c4-architecture\` skill and use the HTML/SVG approach when the user:
162
- - Asks to "show architecture", "present the system design", "visualize infrastructure"
163
- - Wants to display service topology, deployment layout, or component relationships
164
- - Requests architecture review output, system overview dashboards, or technical presentations
165
- - Uses words like "architecture diagram", "system diagram", "infrastructure diagram"
166
-
167
- ### Rendering Methods
168
-
169
- | Method | Block Type | Transport | When to Use |
170
- |--------|-----------|-----------|-------------|
171
- | Mermaid C4 | \`mermaid\` | Inline by default, browser if \`actions\` are present | Quick diagrams, developer-focused, version-controlled |
172
- | HTML/SVG | \`markdown\` | Inline by default, browser if \`actions\` are present | Rich visual presentations, stakeholder reviews, dark-themed dashboards |
173
-
174
- ### Method 1: Mermaid C4 Diagrams
175
-
176
- Use a \`mermaid\` content block with standard C4 Mermaid syntax:
177
-
178
- present({
179
- schemaVersion: 1,
180
- title: "System Architecture",
181
- blocks: [
182
- {
183
- type: "mermaid",
184
- title: "C4 Container Diagram",
185
- value: \`C4Container
186
- title Container Diagram - Payment System
187
-
188
- Person(user, "Customer", "Places orders")
189
-
190
- Container_Boundary(app, "Payment Platform") {
191
-
192
- ---
193
-
194
- ## Rendering Troubleshooting
195
-
196
- ### Why inline MCP App rendering sometimes shows raw text
197
-
198
- Without \`actions\`, the surface renders inline through the MCP App host in the client. The chat text fallback is intentionally minimal. When the inline host fails to load, the user may see only the title or raw JSON instead of the rendered dashboard.
199
-
200
- **Common causes of UIResource rendering failure:**
201
- 1. **MCP Apps not enabled** — The host client must support MCP Apps (e.g., \`chat.mcp.apps.enabled\` in VS Code)
202
- 2. **Companion app build missing** — The \`packages/present\` companion app must be built (\`npm run build\`)
203
- 3. **Content too large** — Very large content arrays (20+ blocks or tables with 50+ rows) may cause the companion iframe to fail silently
204
- 4. **Iframe loading error** — Network issues, CSP restrictions, or extension conflicts can prevent the iframe from loading
205
-
206
- ### When to use browser transport instead of inline rendering
207
-
208
- Add \`actions\` to force browser transport when:
209
- - Content has **10+ blocks** or tables with **20+ rows** (large payloads are often easier to review in a full page)
210
- - The output must be **guaranteed visible outside the IDE chat panel**
211
- - You need **charts + tables + markdown** in the same view and inline rendering is failing
212
- - The user reports that the inline surface "didn't show anything" or only showed fallback text
213
-
214
- > **Reliability rule:** If content is complex (5+ blocks of mixed types) or the inline surface is failing, add a minimal \`actions\` array to force browser transport. Otherwise keep \`actions\` absent for inline rendering.
215
-
216
- ### Content formatting tips to avoid rendering issues
217
-
218
- 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
219
- 2. **Use \`cards\` and \`metrics\`** for summary data instead of embedding it in markdown text
220
- 3. **Keep \`markdown\` blocks for narrative text only** — don't embed HTML, tables, or complex formatting
221
- 4. **Split large content** into multiple smaller \`present\` calls rather than one massive \`blocks\` array
222
- 5. **For charts:** Always use ChartValue format (\`chartType\`, \`data\`, \`xKey\`, \`yKeys\`) — NOT Chart.js format (\`labels\`, \`datasets\`)
223
-
224
- ---
225
-
226
- Container(api, "API Gateway", "Kong", "Routes requests")
227
- Container(svc, "Payment Service", "Node.js", "Processes payments")
228
- ContainerDb(db, "Payment DB", "PostgreSQL", "Transaction records")
229
- }
230
-
231
- System_Ext(stripe, "Stripe", "Payment processor")
232
-
233
- Rel(user, api, "HTTPS")
234
- Rel(api, svc, "gRPC")
235
- Rel(svc, db, "SQL")
236
- Rel(svc, stripe, "REST")\`
237
- }
238
- ]
239
- })
240
- \`\`\`
241
-
242
- ### Method 2: HTML/SVG Architecture Diagrams
243
-
244
- For rich visual output, embed the full HTML/SVG diagram in a \`markdown\` block. Compose with \`metrics\` and \`cards\` blocks for a complete dashboard.
245
-
246
- **This approach works inline by default. Add \`actions\` only when you need browser transport.**
247
-
248
- \`\`\`js
249
- present({
250
- schemaVersion: 1,
251
- title: "System Architecture",
252
- blocks: [
253
- {
254
- type: "metrics",
255
- title: "Overview",
256
- value: [
257
- { label: "Services", value: "6" },
258
- { label: "Data Stores", value: "2" },
259
- { label: "External Systems", value: "3" }
260
- ]
261
- },
262
- {
263
- type: "markdown",
264
- title: "Architecture Diagram",
265
- 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>"
266
- },
267
- {
268
- type: "cards",
269
- title: "Component Summary",
270
- value: [
271
- { title: "Frontend", body: "React SPA + CDN delivery" },
272
- { title: "Backend", body: "3 microservices, gRPC mesh" },
273
- { title: "Data", body: "PostgreSQL + Redis cache" }
274
- ]
275
- }
276
- ]
277
- })
278
- \`\`\`
279
-
280
- ### Component Categories (Quick Reference)
281
-
282
- The full type registry with sub-types and icon slots is in \`c4-architecture/references/html-design-system.md\`. Here is the category summary:
283
-
284
- | Category | Stroke | CSS Class | Use For |
285
- |----------|--------|-----------|---------|
286
- | Frontend | \`#22d3ee\` | \`.cyan\` | SPAs, mobile apps, static sites, PWAs |
287
- | Backend | \`#34d399\` | \`.emerald\` | API services, workers, microservices, serverless |
288
- | Data | \`#a78bfa\` | \`.violet\` | Databases, caches, search engines, warehouses |
289
- | Infrastructure | \`#fbbf24\` | \`.amber\` | CDNs, load balancers, DNS, storage |
290
- | Messaging | \`#fb923c\` | \`.orange\` | Queues, event buses, streams, pub/sub |
291
- | Security | \`#fb7185\` | \`.rose\` | Auth, API gateways, WAF, secret managers |
292
- | External | \`#94a3b8\` | \`.slate\` | Third-party APIs, SaaS, legacy systems |
293
- | Monitoring | \`#38bdf8\` | \`.sky\` | Logging, metrics, tracing, alerting |
294
-
295
- > **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.
296
-
297
- ---
298
-
299
- ## Best Practices
300
-
301
- 1. **Use inline rendering by default** for display-only charts, tables, and dashboards. Add \`actions\` when you need browser transport, or when CLI requires a full visual surface.
302
- 2. **Combine block types** — metrics + charts + tables in one page
303
- 3. **Add titles** to every block for clear section headings
304
- 4. **Use actions** when you need user decisions — the tool returns the selection
305
- 5. **Keep markdown blocks** for narrative context between data sections
306
- 6. **Chart tips:**
307
- - Use \`area\` for trends over time
308
- - Use \`bar\` for comparisons between categories
309
- - Use \`donut\` for proportions/distributions
310
- - Use \`sparkline\` inline with metrics for mini trends
311
- 7. **Table auto-features:** Tables with 5+ rows get automatic search/filter. Columns are sortable by click.
312
-
313
- ---
314
-
315
- ## Rendering Troubleshooting
316
-
317
- ### Why inline MCP App rendering sometimes shows raw text
318
-
319
- Without \`actions\`, the surface renders inline through the MCP App host in the client. The chat text fallback is intentionally minimal. When the inline host fails to load, the user may see only the title or raw JSON instead of the rendered dashboard.
320
-
321
- **Common causes of UIResource rendering failure:**
322
- 1. **MCP Apps not enabled** — The host client must support MCP Apps (e.g., \`chat.mcp.apps.enabled\` in VS Code)
323
- 2. **Companion app build missing** — The \`packages/present\` companion app must be built (\`npm run build\`)
324
- 3. **Content too large** — Very large content arrays (20+ blocks or tables with 50+ rows) may cause the companion iframe to fail silently
325
- 4. **Iframe loading error** — Network issues, CSP restrictions, or extension conflicts can prevent the iframe from loading
326
-
327
- ### When to use browser transport instead of inline rendering
328
-
329
- Add \`actions\` to force browser transport when:
330
- - Content has **10+ blocks** or tables with **20+ rows** (large payloads are often easier to review in a full page)
331
- - The output must be **guaranteed visible outside the IDE chat panel**
332
- - You need **charts + tables + markdown** in the same view and inline rendering is failing
333
- - The user reports that the inline surface "didn't show anything" or only showed fallback text
334
-
335
- > **Reliability rule:** If content is complex (5+ blocks of mixed types) or the inline surface is failing, add a minimal \`actions\` array to force browser transport. Otherwise keep \`actions\` absent for inline rendering.
336
-
337
- ### Content formatting tips to avoid rendering issues
338
-
339
- 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
340
- 2. **Use \`cards\` and \`metrics\`** for summary data instead of embedding it in markdown text
341
- 3. **Keep \`markdown\` blocks for narrative text only** — don't embed HTML, tables, or complex formatting
342
- 4. **Split large content** into multiple smaller \`present\` calls rather than one massive \`blocks\` array
343
- 5. **For charts:** Always use ChartValue format (\`chartType\`, \`data\`, \`xKey\`, \`yKeys\`) — NOT Chart.js format (\`labels\`, \`datasets\`)
344
-
345
- ---
346
-
347
- ## MCP Apps Templates
348
-
349
- When the host client supports MCP Apps, the \`present\` tool can render **interactive widgets directly in the chat panel** using the \`template\` parameter. These are distinct from block-based surfaces rendered inline or in the browser.
350
-
351
- **Key difference:** Templates use \`template\` + object \`data\` (not a \`blocks\` array). No \`format\` parameter exists. Templates render inline in the host client unless a separate \`actions\` array is added at the top level.
352
-
353
- ### When to use MCP Apps vs Browser Dashboard
354
-
355
- | Use Case | Mode | Why |
356
- |----------|------|-----|
357
- | Quick user input (pick items, reorder, fill form) | **MCP App template** | Inline in chat, no context switch |
358
- | Rich multi-section dashboard with charts | **Browser transport** | Add \`actions\` for a full page layout |
359
- | Simple confirmation or selection | **Actions-enabled surface** | Adding \`actions\` switches transport to browser |
360
-
361
- ### Template: \`list-sort\`
362
-
363
- Drag-and-drop reorderable list. Use for priority ordering, task sequencing, or ranked preferences.
364
-
365
- \`\`\`json
366
- {
367
- "template": "list-sort",
368
- "title": "Priority Order",
369
- "data": {
370
- "items": [
371
- { "id": "task-1", "label": "Fix authentication bug" },
372
- { "id": "task-2", "label": "Add search feature" },
373
- { "id": "task-3", "label": "Update documentation" }
374
- ]
375
- }
376
- }
377
- \`\`\`
378
-
379
- **Content schema:** \`{ items: Array<{ id: string, label: string }> }\`
380
- **Returns:** Reordered array of items after user drags to reorder and submits.
381
-
382
- ### Template: \`data-table\`
383
-
384
- Filterable, sortable table with optional summary stat cards. Use for structured data review, change summaries, or audit results.
385
-
386
- \`\`\`json
387
- {
388
- "template": "data-table",
389
- "title": "File Changes",
390
- "data": {
391
- "columns": [
392
- { "key": "file", "label": "File" },
393
- { "key": "change", "label": "Change" },
394
- { "key": "lines", "label": "Lines" }
395
- ],
396
- "rows": [
397
- { "file": "auth.ts", "change": "Added guard", "lines": 5 },
398
- { "file": "cache.ts", "change": "Fixed bug", "lines": 12 }
399
- ],
400
- "stats": [
401
- { "label": "Files Changed", "value": "2" },
402
- { "label": "Total Lines", "value": "17" }
403
- ]
404
- }
405
- }
406
- \`\`\`
407
-
408
- **Content schema:** \`{ columns: Array<{ key: string, label: string }>, rows: Array<Record<string, unknown>>, stats?: Array<{ label: string, value: string }> }\`
409
- **Returns:** Selected row(s) data when user interacts and submits.
410
-
411
- ### Template: \`picker\`
412
-
413
- Multi-select with categories and tag-based search. Use for component selection, feature toggles, or module picking.
414
-
415
- \`\`\`json
416
- {
417
- "template": "picker",
418
- "title": "Select Modules",
419
- "data": {
420
- "categories": [
421
- { "id": "core", "label": "Core" },
422
- { "id": "plugins", "label": "Plugins" }
423
- ],
424
- "items": [
425
- { "id": "auth", "label": "Authentication", "category": "core", "tags": ["security"] },
426
- { "id": "cache", "label": "Cache Layer", "category": "core", "tags": ["performance"] },
427
- { "id": "sentry", "label": "Sentry Plugin", "category": "plugins", "tags": ["monitoring"] }
428
- ]
429
- }
430
- }
431
- \`\`\`
432
-
433
- **Content schema:** \`{ categories: Array<{ id: string, label: string }>, items: Array<{ id: string, label: string, category: string, tags?: string[] }> }\`
434
- **Returns:** Array of selected item IDs after user checks items and submits.
435
-
436
- ### Template: \`flame-graph\`
437
-
438
- Hierarchical zoomable visualization. Use for codebase structure, performance profiles, dependency trees, or budget breakdowns.
439
-
440
- \`\`\`json
441
- {
442
- "template": "flame-graph",
443
- "title": "Module Hierarchy",
444
- "data": {
445
- "profile": {
446
- "name": "root",
447
- "total": 100,
448
- "children": [
449
- {
450
- "name": "packages/tools",
451
- "total": 60,
452
- "children": [
453
- { "name": "search.ts", "total": 35 },
454
- { "name": "compact.ts", "total": 25 }
455
- ]
456
- },
457
- { "name": "packages/server", "total": 40 }
458
- ]
459
- }
460
- }
461
- }
462
- \`\`\`
463
-
464
- **Content schema:** \`{ profile: { name: string, total: number, children?: Array<(recursive)> } }\`
465
- **Returns:** Clicked node information when user interacts.
466
-
467
- ### Template: \`form\`
468
-
469
- Input fields with text inputs, selects, and checkboxes. Use for configuration, parameter collection, or setup wizards.
470
-
471
- \`\`\`json
472
- {
473
- "template": "form",
474
- "title": "Project Configuration",
475
- "data": {
476
- "fields": [
477
- { "name": "projectName", "label": "Project Name", "type": "text", "value": "my-app" },
478
- { "name": "framework", "label": "Framework", "type": "select", "options": ["React", "Vue", "Svelte"], "value": "React" },
479
- { "name": "typescript", "label": "Use TypeScript", "type": "checkbox", "value": true },
480
- { "name": "description", "label": "Description", "type": "text", "value": "" }
481
- ]
482
- }
483
- }
484
- \`\`\`
485
-
486
- **Content schema:** \`{ fields: Array<{ name: string, label: string, type: "text" | "select" | "checkbox", value?: string | boolean, options?: string[] }> }\`
487
- **Returns:** Object with field name-value pairs after user fills out and submits.
488
-
489
- ### MCP Apps Best Practices
490
-
491
- 1. **Use meaningful \`id\` values** — they are returned in responses and used for programmatic handling.
492
- 2. **Keep list-sort items under 15** — longer lists become unwieldy for drag-and-drop.
493
- 3. **Always provide \`value\` defaults** in forms — pre-fill with sensible defaults to reduce user effort.
494
- 4. **Use \`tags\` in picker** — they power the search/filter functionality.
495
- 5. **Flame-graph \`total\` values** should be consistent — parent total should equal sum of children.
496
- 6. **Data-table \`stats\`** are optional — use them for KPI summary cards above the table.
497
- 7. **Combine with LLM logic** — use returned values to drive next steps (e.g., form → generate config, picker → scope analysis).
498
-
499
- #### 6. \`timeline\` — Vertical Event Timeline (display only)
500
-
501
- \`\`\`json
502
- {
503
- "events": [
504
- {"title": "v1.0 Release", "description": "Initial release with core features", "timestamp": "2025-01", "status": "complete"},
505
- {"title": "v2.0 Beta", "description": "MCP Apps support", "timestamp": "2025-07", "status": "active"},
506
- {"title": "v3.0 Planning", "status": "pending"}
507
- ]
508
- }
509
- \`\`\`
510
-
511
- Fields: \`title\` (required), \`description?\`, \`timestamp?\`, \`status?\` (\`'complete'|'active'|'pending'|'error'\`), \`icon?\`, \`category?\`
512
-
513
- #### 7. \`kanban\` — Drag-Drop Board (interactive — emits on card move)
514
-
515
- \`\`\`json
516
- {
517
- "columns": [
518
- {"id": "todo", "label": "To Do"},
519
- {"id": "in-progress", "label": "In Progress", "color": "#3b82f6"},
520
- {"id": "done", "label": "Done", "color": "#22c55e"}
521
- ],
522
- "cards": [
523
- {"id": "c1", "title": "Fix auth bug", "column": "todo", "tags": ["bugfix"], "priority": "high"},
524
- {"id": "c2", "title": "Add search", "column": "in-progress", "tags": ["feature"], "priority": "medium"}
525
- ]
526
- }
527
- \`\`\`
528
-
529
- Returns \`{cardId, fromColumn, toColumn}\` when a card is dragged between columns.
530
-
531
- #### 8. \`tree\` — Collapsible Tree View (display only)
532
-
533
- \`\`\`json
534
- {
535
- "root": {
536
- "label": "packages/",
537
- "children": [
538
- {"label": "server/", "children": [{"label": "index.ts"}, {"label": "tools/", "children": [{"label": "present.ts"}]}]},
539
- {"label": "present/", "children": [{"label": "present-app.ts"}]}
540
- ]
541
- }
542
- }
543
- \`\`\`
544
-
545
- Fields: \`label\` (required), \`id?\`, \`icon?\`, \`children?: TreeNode[]\`, \`metadata?: Record<string,string>\`. Accepts \`root\` as single node or array of nodes.
546
-
547
- #### 9. \`diff-view\` — Side-by-Side Code Diff (display only)
548
-
549
- \`\`\`json
550
- {
551
- "files": [{
552
- "path": "auth.ts",
553
- "status": "modified",
554
- "additions": 12,
555
- "deletions": 3,
556
- "hunks": [{
557
- "header": "@@ -10,5 +10,14 @@",
558
- "changes": [
559
- {"type": "context", "content": "const auth = {};"},
560
- {"type": "delete", "content": "// old validation"},
561
- {"type": "add", "content": "// new JWT validation"},
562
- {"type": "add", "content": "const token = verify(jwt);"}
563
- ]
564
- }]
565
- }],
566
- "stats": {"additions": 12, "deletions": 3, "filesChanged": 1}
567
- }
568
- \`\`\`
569
-
570
- Status values: \`'added'|'modified'|'deleted'|'renamed'\`. Change types: \`'add'|'delete'|'context'\`.
571
-
572
- #### 10. \`dashboard\` — Metric Cards Grid (display only)
573
-
574
- \`\`\`json
575
- {
576
- "metrics": [
577
- {"label": "Uptime", "value": "99.9%", "status": "success", "trend": {"value": "+0.1%", "direction": "up"}},
578
- {"label": "Build Time", "value": "4.2s", "type": "progress", "progress": 42, "status": "warning"},
579
- {"label": "Top Endpoints", "type": "list", "value": "3", "items": [
580
- {"label": "/api/search", "value": "1.2k/day"},
581
- {"label": "/api/present", "value": "890/day"}
582
- ]}
583
- ]
584
- }
585
- \`\`\`
586
-
587
- Metric types: \`'stat'\` (default), \`'progress'\` (with bar), \`'list'\` (sub-items). Status: \`'success'|'warning'|'error'|'info'\`.
588
-
589
- ### Interaction Summary (All 10 Templates)
590
-
591
- | Template | Trigger | Data Returned to LLM |
592
- |----------|---------|---------------------|
593
- | list-sort | Auto on drag-drop | Reordered ID array |
594
- | data-table | Export button | Current filtered rows |
595
- | picker | Apply Selection button | Selected ID array |
596
- | flame-graph | Auto on node click | Clicked node object |
597
- | form | Submit button | Field values object |
598
- | kanban | Auto on card drag | \`{cardId, fromColumn, toColumn}\` |
599
- | timeline | Display only | — |
600
- | tree | Display only | — |
601
- | diff-view | Display only | — |
602
- | dashboard | Display only | — |
603
- `}]}export{e as default};
1
+ function e(){return[{file:`SKILL.md`,content:'---\nname: present\ndescription: "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."\nmetadata:\n category: cross-cutting\n domain: general\n applicability: always\n inputs: [data, analysis]\n outputs: [dashboards, charts, reports]\n requires: [aikit]\nargument-hint: "Content to present — data, analysis results, status report, comparison, or interactive MCP App"\n---\n\n# Present Tool — Rich Interactive Dashboards\n\n## 1. API Shape\n\n- `schemaVersion: 1` is always required.\n- `title: string` is always required; do not use unicode escapes like `\\u2014`, use the actual character.\n- Mode 1: block surface with `blocks: [{ type, title?, value }]`.\n- Mode 2: MCP App template with `template` + `data`.\n- Mode 3: viewer template with `template` + `data` for richer diagrams or flows.\n- No `actions` array means inline MCP App transport in the host client.\n- Any `actions` array means browser transport and opens the system browser.\n- CLI has no inline host; add a minimal action if you need the browser to open.\n\n```json\n{ "schemaVersion": 1, "title": "Release Review", "blocks": [{ "type": "metrics", "value": [] }] }\n```\n\n## 2. Content Blocks\n\nPass content as a `blocks` array of `{ type, title?, value }` objects.\n\n| Type | Value shape | Use for |\n|------|-------------|---------|\n| `markdown` | string | Prose, headings, code snippets |\n| `table` | `Record[]` or `{ headers, rows }` | Tabular data |\n| `chart` | `{ chartType, data, xKey?, yKeys? }` | Bar, line, area, pie, radar, scatter |\n| `metrics` | `[{ label, value, trend?, status? }]` | KPI cards |\n| `cards` | `[{ title, body?, badge?, status? }]` | Summary cards |\n| `mermaid` | string | Diagrams authored as Mermaid |\n| `tree` | `{ name, children? }` | Hierarchies |\n| `timeline` | `[{ title, description?, timestamp?, status? }]` | Event sequences |\n| `checklist` | `[{ label, checked }]` | Task lists |\n| `code` | string | Code or diff excerpts |\n| `comparison` | `[{title, items}]` or `{columns: [{title, items}]}` | Side-by-side option comparisons |\n| `status-board` | `[{category, items}]` or `{items: [{category, items}]}` | Service health boards |\n| `progress` | `{label, value, max?}` or `{items: [{label, value, max?, color?}]}` | Progress bars |\n| `graph` | `{ nodes: [{id, label?}], edges: [{from, to, label?}] }` | Network graphs |\n| `docs-browser` | `{ files: [{path, title?, content?, status?}], title? }` | Documentation indexes |\n\n> Anti-patterns:\n> - No tables in `markdown`; use a `table` block.\n> - Use `{ chartType, data, xKey, yKeys }`, not Chart.js `{ labels, datasets }`.\n> - Keep `markdown` for prose, headings, and code, not UI structure.\n\n## 3. Actions\n\nAction shape: `{ type, id, label, variant?, options? }`\n\n- Types: `button` | `select` | `multi-select` | `form-submit` | `text-submit` | `confirm` | `custom`\n- Variants: `primary` (indigo) | `danger` (red) | `default` (neutral)\n\n```json\n{ "actions": [{ "type": "button", "id": "ack", "label": "Acknowledge", "variant": "primary" }] }\n```\n\n## 4. MCP App Templates\n\nUse templates for structured interactive widgets. They take `template` + `data`; returns depend on the widget.\n\n| Template | Purpose | Data shape | Returns |\n|----------|---------|------------|---------|\n| `list-sort` | Reorder a ranked list | `{ items: [{ id, label }] }` | Reordered items or IDs |\n| `data-table` | Inspect structured rows | `{ columns, rows, stats? }` | Current selection or filtered rows |\n| `picker` | Choose items from categories | `{ categories, items }` | Selected item IDs |\n| `flame-graph` | Explore hierarchical totals | `{ profile }` | Clicked node |\n| `form` | Collect field values | `{ fields }` | Submitted field map |\n| `kanban` | Move cards across columns | `{ columns, cards }` | Card move payload |\n| `timeline` | Show ordered milestones | `{ events }` | Display only |\n| `tree` | Browse nested nodes | `{ root }` | Display only |\n| `diff-view` | Show file diffs | `{ files, stats? }` | Display only |\n| `dashboard` | Show metric cards | `{ metrics }` | Display only |\n\n### `list-sort`\n`data`: `{ "items": [{ "id": "task-1", "label": "Fix auth bug" }] }`\n\n### `data-table`\n`data`: `{ "columns": [{ "key": "file", "label": "File" }], "rows": [{ "file": "auth.ts" }], "stats": [{ "label": "Files", "value": "1" }] }`\n\n### `picker`\n`data`: `{ "categories": [{ "id": "core", "label": "Core" }], "items": [{ "id": "auth", "label": "Auth", "category": "core", "tags": ["security"] }] }`\n\n### `flame-graph`\n`data`: `{ "profile": { "name": "root", "total": 100, "children": [{ "name": "packages/server", "total": 60 }] } }`\n\n### `form`\n`data`: `{ "fields": [{ "name": "projectName", "label": "Project Name", "type": "text", "value": "my-app" }] }`\n\n### `kanban`\n`data`: `{ "columns": [{ "id": "todo", "label": "To Do" }], "cards": [{ "id": "c1", "title": "Fix auth bug", "column": "todo" }] }`\n\n### `timeline`\n`data`: `{ "events": [{ "title": "v1.0 Release", "timestamp": "2026-05", "status": "complete" }] }`\n\n### `tree`\n`data`: `{ "root": { "label": "packages/", "children": [{ "label": "server/" }] } }`\n\n### `diff-view`\n`data`: `{ "files": [{ "path": "auth.ts", "status": "modified", "hunks": [{ "header": "@@ -1 +1 @@", "changes": [{ "type": "add", "content": "const ok = true;" }] }] }], "stats": { "filesChanged": 1 } }`\n\n### `dashboard`\n`data`: `{ "metrics": [{ "label": "Uptime", "value": "99.9%", "status": "success" }] }`\n\n## 5. Viewer Templates\n\nViewer templates render richer visual surfaces from `template` + `data`.\n\n| Template | Transport | Purpose |\n|----------|-----------|---------|\n| `c4-static@1` | mcp-app | Static architecture diagram |\n| `c4@1` | browser | Interactive architecture diagram |\n| `process-flow-static@1` | mcp-app | Static process flow |\n| `process-flow@1` | browser | Interactive process flow |\n| `tour@1` | browser | Guided walkthrough or code tour |\n\n`c4`: `{ "nodes": [{ "id": "web", "type": "container", "label": "Web App", "technology?": "React" }], "edges": [{ "source": "web", "target": "api", "label": "HTTPS" }] }`\n\n`process-flow`: `{ "nodes": [{ "id": "start", "label": "Start", "type": "start-end" }], "edges": [{ "source": "start", "target": "review" }] }`\n\n`tour`: `{ "steps": [{ "id": "overview", "title": "Overview", "file": "src/index.ts", "explanation": "Entry point", "code?": "...", "line?": 1 }] }`\n\nGotcha: edges use `source` and `target`, not `from` and `to`.\n\nDecision tree:\n- Architecture, systems, containers, deployments: load the `c4-architecture` skill and use `c4@1` or `c4-static@1`.\n- Stateful workflows, approvals, or branching processes: use `process-flow@1` or `process-flow-static@1`.\n- Ordered walkthroughs, onboarding, or narrated analysis: use `tour@1`.\n\n## 6. Rules\n\n- Pick transport once: no `actions` for inline, any `actions` for browser.\n- Combine block types in one `blocks` array; metrics + chart + table + markdown is the normal composition pattern.\n- Use concise schemas in docs; do not expand to full `present()` calls unless behavior depends on them.\n- Use `table`, `comparison`, and `status-board` for structured data instead of formatting it inside markdown.\n- Architecture requests are delegated: load the `c4-architecture` skill for diagram guidance and data contracts.\n- If inline rendering only shows a title, raw JSON, or fallback text, switch to browser transport with a minimal action.\n- For large or mixed-content surfaces, browser transport is usually easier to review and more reliable.\n'}]}export{e as default};