@zenera/cli 1.3.19 → 1.3.21
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.
- package/assets/chat.html +920 -835
- package/package.json +6 -6
- package/templates/editor/.github/skills/zen-cli/references/projects.md +2 -2
- package/templates/editor/.github/skills/zen-review/SKILL.md +3 -1
- package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +6 -1
- package/templates/project/SPECIFICATION.md.tmpl +3 -2
- package/templates/project/agents/mcp-instructions.md +12 -8
- package/templates/project/agents/prompts/default.md.tmpl +4 -2
- package/templates/project/agents/skills/data-analysis/SKILL.md +1 -1
- package/templates/project/agents/skills/html-page/SKILL.md +147 -0
- package/templates/project/agents/skills/html-page/assets/api.js +87 -0
- package/templates/project/agents/skills/html-page/assets/app/api/items.api.py +84 -0
- package/templates/project/agents/skills/html-page/assets/app/index.html +278 -0
- package/templates/project/agents/skills/{html-dashboard/assets/template.html → html-page/assets/dashboard.html} +2 -0
- package/templates/project/agents/skills/html-page/references/charts-and-tables.md +71 -0
- package/templates/project/agents/skills/html-page/references/python-functions.md +200 -0
- package/templates/project/agents.yaml.tmpl +2 -1
- package/templates/project/agents/skills/html-dashboard/SKILL.md +0 -163
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: html-dashboard
|
|
3
|
-
description: Building an interactive HTML page - a dashboard or a report with charts, tables, filters and headline numbers - that the user opens from the chat. Where to write it, how it loads its data, the layout that works both in the chat's side panel and full page, and which libraries to use. Load when an answer has more than one chart or table, or data the user will want to filter or explore.
|
|
4
|
-
tags: [html, dashboard, report, charts, ui]
|
|
5
|
-
version: 1.0.0
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Interactive HTML pages
|
|
9
|
-
|
|
10
|
-
A page is the answer when a reply would be too long or too static: several
|
|
11
|
-
related charts and tables, a breakdown the user will want to filter, sort or
|
|
12
|
-
drill into. One chart or a short table is better inline in the chat (load
|
|
13
|
-
`a2ui` and `a2ui-charts`).
|
|
14
|
-
|
|
15
|
-
Compute first (load `data-analysis`): the page only shows numbers your script
|
|
16
|
-
produced. It never invents, estimates or hard-codes a value.
|
|
17
|
-
|
|
18
|
-
## Where it goes
|
|
19
|
-
|
|
20
|
-
One folder per page, under `/workspace/reports/`:
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
/workspace/reports/sales-q1/
|
|
24
|
-
├── index.html the page
|
|
25
|
-
└── data.json the data it shows, written by your script
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Name the folder after the content (`sales-q1`, `churn-by-plan`), lowercase
|
|
29
|
-
with dashes. Rewriting a page keeps its folder and link.
|
|
30
|
-
- Keep the script that builds `data.json` under `/workspace/.tmp/` so the page
|
|
31
|
-
can be refreshed by running it again.
|
|
32
|
-
|
|
33
|
-
## Start from the template
|
|
34
|
-
|
|
35
|
-
Copy the starter page and edit it rather than writing one from scratch:
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
mkdir -p /workspace/reports/sales-q1
|
|
39
|
-
cp /skills/html-dashboard/assets/template.html /workspace/reports/sales-q1/index.html
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
It already has the layout, light and dark themes, a chart helper, a table
|
|
43
|
-
helper, KPI cards, filters and number formatting, all tested in the chat's
|
|
44
|
-
panel and full page. Keep the helpers; replace the part marked
|
|
45
|
-
`The page: replace from here` with the real fields, charts and columns.
|
|
46
|
-
|
|
47
|
-
## How it is shown, and what that allows
|
|
48
|
-
|
|
49
|
-
The chat opens the page in a side panel next to the conversation (often 400 -
|
|
50
|
-
600 px wide) or in a full browser tab. Either way it runs sandboxed:
|
|
51
|
-
|
|
52
|
-
- It reads files of this session **by a path relative to the page**:
|
|
53
|
-
`fetch('data.json')`, `<img src="logo.png">`, and `..` to go up a folder.
|
|
54
|
-
Never `file:///`, `/workspace/...` or `http://localhost`.
|
|
55
|
-
- Scripts, styles and fonts load only from `cdn.jsdelivr.net`, `unpkg.com`
|
|
56
|
-
and `cdnjs.cloudflare.com`. Any other host is blocked - no external APIs,
|
|
57
|
-
images, map tiles or analytics.
|
|
58
|
-
- No `localStorage`, `sessionStorage`, cookies or `IndexedDB` (the page has
|
|
59
|
-
no origin of its own; touching them throws). Keep state in variables or in
|
|
60
|
-
`location.hash`.
|
|
61
|
-
- No `<form>` submission: use inputs and `change` listeners.
|
|
62
|
-
- Links to other sites need `target="_blank" rel="noopener"`.
|
|
63
|
-
- The page cannot call the agent or any tool. Everything it shows must be in
|
|
64
|
-
its files when you link it.
|
|
65
|
-
|
|
66
|
-
## Loading data
|
|
67
|
-
|
|
68
|
-
- Default: `data.json` beside the page, loaded with `fetch` (the template's
|
|
69
|
-
`loadData()`).
|
|
70
|
-
- Very small data (a few KB) may be inlined instead, in a JSON `<script>`
|
|
71
|
-
block with `id="data"` - `loadData()` uses it when present.
|
|
72
|
-
- Ship the data the page needs, not the raw source: aggregate in Python or
|
|
73
|
-
DuckDB first. Keep `data.json` under ~5 MB; past ~20 000 rows send
|
|
74
|
-
aggregates plus the top rows, and say so on the page.
|
|
75
|
-
- Plain JSON shapes the page can use directly: `{ "title", "subtitle",
|
|
76
|
-
"source", "updated", "kpis": [...], "rows": [{...}] }`, or one array per
|
|
77
|
-
chart. Numbers as numbers, dates as ISO strings (`2026-03-31`), no `NaN`
|
|
78
|
-
(write `null`).
|
|
79
|
-
- Several pages can share one data file by a relative path that starts with `..`.
|
|
80
|
-
|
|
81
|
-
## Layout - always adaptive
|
|
82
|
-
|
|
83
|
-
Every page must work at 360 px (narrow panel) and 1600 px (wide tab) without
|
|
84
|
-
horizontal scrolling. The template does this; keep to its rules when you
|
|
85
|
-
change it:
|
|
86
|
-
|
|
87
|
-
- `<meta name="viewport" content="width=device-width, initial-scale=1">`.
|
|
88
|
-
- No fixed widths. Use CSS grid that reflows:
|
|
89
|
-
`grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr))` for
|
|
90
|
-
chart cards, `minmax(150px, 1fr)` for KPI cards. `.wide` spans the full row.
|
|
91
|
-
- Every grid or flex child gets `min-width: 0` (the template's `.card` has it),
|
|
92
|
-
or a chart or table will push the page wider than the panel.
|
|
93
|
-
- Charts: width 100% of their card, a fixed height (`320px`, `260px` under
|
|
94
|
-
520 px). Never size charts in `vh` or by the window. The template's
|
|
95
|
-
`chart()` resizes them with a `ResizeObserver`, so they follow the panel
|
|
96
|
-
being dragged, not only the window.
|
|
97
|
-
- Tables: the template's `table()` collapses columns that do not fit and
|
|
98
|
-
paginates. Put the most important columns first.
|
|
99
|
-
- Filters sit in one wrapping row at the top; KPIs below them; then charts;
|
|
100
|
-
the detailed table last.
|
|
101
|
-
- Let the page scroll; do not lock the body to `100vh`.
|
|
102
|
-
- Light and dark: colours come from the CSS variables in `:root`, switched by
|
|
103
|
-
`prefers-color-scheme`. Use `var(--fg)`, `var(--muted)` and the rest - no
|
|
104
|
-
hard-coded colours in new elements. Charts re-theme on their own.
|
|
105
|
-
|
|
106
|
-
## Components
|
|
107
|
-
|
|
108
|
-
Use these, from the CDN URLs in the template, pinned to the version shown
|
|
109
|
-
there:
|
|
110
|
-
|
|
111
|
-
| Need | Use |
|
|
112
|
-
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
113
|
-
| Charts of any kind - bar, line, area, pie, scatter, heatmap, treemap, sankey, funnel, gauge | ECharts (`chart()` helper). Same library as the chat's charts, so `a2ui-charts` advice on choosing a chart type applies. |
|
|
114
|
-
| Tables - sort, filter per column, pagination, many rows | Tabulator (`table()` helper) |
|
|
115
|
-
| Headline numbers with change vs. a previous period | KPI cards (`kpis()` helper) |
|
|
116
|
-
| Filters across the whole page | `<select>` per field (`filters()` helper); `<input type="date">` or `type="range"` for ranges |
|
|
117
|
-
| Number, money, percent and date formatting | `Intl.NumberFormat` and `Intl.DateTimeFormat` (`fmt` helper) - never format by hand |
|
|
118
|
-
| Long time series | ECharts `dataZoom` (`inside`, plus `slider` on wide pages) |
|
|
119
|
-
| Text sections, notes, method | Plain HTML in a `.card`; `<details>` for anything secondary |
|
|
120
|
-
| Tabs between views | Buttons that show and hide sections; keep the active tab in `location.hash` |
|
|
121
|
-
|
|
122
|
-
Avoid: CSS frameworks and Tailwind's browser build (heavy, and the template
|
|
123
|
-
styles are enough), React or Vue (no build step here), Leaflet or any map
|
|
124
|
-
with tiles (blocked - use an ECharts `map` with GeoJSON you write to the
|
|
125
|
-
folder), Plotly unless a chart type ECharts lacks is needed (it is ~3 MB).
|
|
126
|
-
|
|
127
|
-
Every chart and table has a short heading saying what it shows, with units.
|
|
128
|
-
The page footer names the source file and the date of the data.
|
|
129
|
-
|
|
130
|
-
## Interactivity
|
|
131
|
-
|
|
132
|
-
- One `render(state)` function draws everything from the filtered rows;
|
|
133
|
-
every control just updates `state` and calls it. KPIs, charts and table
|
|
134
|
-
then always agree.
|
|
135
|
-
- Tooltips on every chart (on by default in `chart()`), `confine: true` so
|
|
136
|
-
they stay inside a narrow panel.
|
|
137
|
-
- Clicking a bar or slice may set a filter: `bar.on('click', (p) => ...)`
|
|
138
|
-
with `p.name` the category clicked; the handler survives a theme switch.
|
|
139
|
-
- Show "No data for these filters" rather than an empty chart.
|
|
140
|
-
|
|
141
|
-
## Check before you link it
|
|
142
|
-
|
|
143
|
-
Run these and fix what they find:
|
|
144
|
-
|
|
145
|
-
```sh
|
|
146
|
-
cd /workspace/reports/sales-q1
|
|
147
|
-
python -c "import json; json.load(open('data.json'))" && echo "data ok"
|
|
148
|
-
grep -nE "file://|/workspace|localhost|localStorage|sessionStorage|<form" index.html || echo "paths ok"
|
|
149
|
-
grep -noE "(src|href)=\"https?://[^\"]+" index.html | grep -vE "cdn.jsdelivr.net|unpkg.com|cdnjs.cloudflare.com" || echo "hosts ok"
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
And confirm every relative file the page loads exists in its folder.
|
|
153
|
-
|
|
154
|
-
## Hand it over
|
|
155
|
-
|
|
156
|
-
- Two to four sentences with the main findings and their numbers - the reply
|
|
157
|
-
must stand on its own for someone who never opens the page.
|
|
158
|
-
- Then the page as a link, alone in its own paragraph:
|
|
159
|
-
|
|
160
|
-
[Sales Q1 dashboard](file:///workspace/reports/sales-q1/index.html)
|
|
161
|
-
|
|
162
|
-
- Say what the user can do there ("filter by region, sort the deals table")
|
|
163
|
-
and what is left out (rows dropped, periods missing).
|