@zenera/cli 1.3.11 → 1.3.12
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 +3622 -1755
- package/dist/scaffold.js +12 -0
- package/dist/validate.js +15 -1
- package/package.json +6 -6
- package/templates/editor/.github/copilot-instructions.md +9 -5
- package/templates/editor/.github/skills/finetune/SKILL.md +3 -1
- package/templates/editor/.github/skills/zen-analyze-run/SKILL.md +3 -1
- package/templates/editor/.github/skills/zen-cli/references/projects.md +3 -1
- package/templates/editor/.github/skills/zen-finetune-apply/SKILL.md +4 -2
- package/templates/editor/.github/skills/zen-inspect-ask/SKILL.md +2 -1
- package/templates/editor/.github/skills/zen-instructions/SKILL.md +6 -4
- package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +4 -3
- package/templates/editor/.github/skills/zen-spec-sync/scripts/snapshot.sh +1 -1
- package/templates/project/agents/a2ui-instructions.md +32 -0
- package/templates/project/agents/instructions.md +6 -5
- package/templates/project/agents/markdown-instructions.md +26 -0
- package/templates/project/agents/memory-instructions.md +24 -8
- package/templates/project/agents/skills/a2ui/SKILL.md +267 -0
- package/templates/project/agents/skills/a2ui_charts/SKILL.md +111 -0
- package/templates/project/agents.yaml.tmpl +4 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: a2ui
|
|
3
|
+
description: How to answer with an A2UI v1.0 surface (forms, cards, layouts) - message format, components, data binding and actions. Load before writing any A2UI.
|
|
4
|
+
tags: [ui, a2ui]
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# A2UI surfaces
|
|
9
|
+
|
|
10
|
+
A2UI is a JSON description of UI that the chat renders in place of your text.
|
|
11
|
+
You write it; the user sees and uses it.
|
|
12
|
+
|
|
13
|
+
## Emitting it
|
|
14
|
+
|
|
15
|
+
Put the messages in a fenced block tagged `a2ui` as a JSON array. The block may
|
|
16
|
+
sit between ordinary Markdown paragraphs:
|
|
17
|
+
|
|
18
|
+
````markdown
|
|
19
|
+
Here is the booking form.
|
|
20
|
+
|
|
21
|
+
```a2ui
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
"version": "1.0",
|
|
25
|
+
"createSurface": {
|
|
26
|
+
"surfaceId": "main",
|
|
27
|
+
"catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
|
|
28
|
+
"components": []
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
```
|
|
33
|
+
````
|
|
34
|
+
|
|
35
|
+
- The array contains complete JSON objects, each with `"version": "1.0"` and
|
|
36
|
+
exactly one of `createSurface`, `updateComponents`, `updateDataModel`,
|
|
37
|
+
`deleteSurface`.
|
|
38
|
+
- Use strict JSON: no comments or trailing commas.
|
|
39
|
+
- Prefer a single `createSurface` that carries both `components` and
|
|
40
|
+
`dataModel`. Send `updateComponents` / `updateDataModel` only to change a
|
|
41
|
+
surface you already created.
|
|
42
|
+
|
|
43
|
+
## The surface
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"version": "1.0",
|
|
48
|
+
"createSurface": {
|
|
49
|
+
"surfaceId": "trip_booking_1",
|
|
50
|
+
"catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
|
|
51
|
+
"sendDataModel": true,
|
|
52
|
+
"components": [],
|
|
53
|
+
"dataModel": {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- `surfaceId` is unique for the whole conversation: never reuse one without a
|
|
59
|
+
`deleteSurface` first. Use a descriptive name plus a counter.
|
|
60
|
+
- `catalogId` is always the basic catalog above. Zenera components add their
|
|
61
|
+
own `@catalogId` (see below).
|
|
62
|
+
- Set `sendDataModel: true` on forms, so the user's input reaches you with the
|
|
63
|
+
action.
|
|
64
|
+
- `components` is a **flat** list. Each has a unique `id` and a `component`
|
|
65
|
+
type; containers refer to children by id. Exactly one component has
|
|
66
|
+
`"id": "root"` — that is what is shown.
|
|
67
|
+
- `dataModel` is a plain JSON object. Bind to it with `{"@path": "/pointer"}`
|
|
68
|
+
(JSON Pointer) wherever a property accepts a dynamic value.
|
|
69
|
+
|
|
70
|
+
## Components
|
|
71
|
+
|
|
72
|
+
Basic catalog (A2UI v1.0). Only these, and only these properties:
|
|
73
|
+
|
|
74
|
+
| Component | Required | Optional |
|
|
75
|
+
| --------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
76
|
+
| `Text` | `text` | `variant`: `body` \| `caption` |
|
|
77
|
+
| `Image` | `url` | `description`, `fit`, `variant`: `icon` \| `avatar` \| `smallFeature` \| `mediumFeature` \| `largeFeature` \| `header` |
|
|
78
|
+
| `Icon` | `name` (e.g. `check`, `warning`) | — |
|
|
79
|
+
| `Video` | `url` | `posterUrl` |
|
|
80
|
+
| `AudioPlayer` | `url` | `description` |
|
|
81
|
+
| `Row`, `Column` | `children` | `justify`, `align` |
|
|
82
|
+
| `List` | `children` | `direction`: `vertical` \| `horizontal`, `align` |
|
|
83
|
+
| `Card` | `child` (exactly one id) | — |
|
|
84
|
+
| `Tabs` | `tabs`: `[{title, child}]` | — |
|
|
85
|
+
| `Divider` | — | `axis` |
|
|
86
|
+
| `Modal` | `trigger`, `content` | — |
|
|
87
|
+
| `Button` | `child`, `action` | `variant`: `default` \| `primary` \| `borderless` |
|
|
88
|
+
| `TextField` | `label`, `value` | `placeholder`, `variant`: `shortText` \| `longText` \| `number` \| `obscured` |
|
|
89
|
+
| `CheckBox` | `label`, `value` (boolean) | — |
|
|
90
|
+
| `ChoicePicker` | `options`: `[{label, value}]`, `value` (string array) | `label`, `variant`: `mutuallyExclusive` \| `multipleSelection`, `displayStyle`: `checkbox` \| `chips`, `filterable` |
|
|
91
|
+
| `Slider` | `value`, `max` | `label`, `min`, `steps` |
|
|
92
|
+
| `DateTimeInput` | `value` (ISO 8601, `""` if unset) | `enableDate`, `enableTime`, `min`, `max` |
|
|
93
|
+
|
|
94
|
+
Zenera catalog — each instance must carry
|
|
95
|
+
`"@catalogId": "https://zenera.ai/a2ui/catalogs/zenera/v1_0/catalog.json"`:
|
|
96
|
+
|
|
97
|
+
| Component | Required | Optional | Notes |
|
|
98
|
+
| ----------- | -------- | ------------------ | --------------------------------------------- |
|
|
99
|
+
| `EChart` | `apiUrl` | — | Load the `a2ui_charts` skill before using it. |
|
|
100
|
+
| `DataTable` | `apiUrl` | `pageSize` (1–100) | Not fully supported yet; see below. |
|
|
101
|
+
|
|
102
|
+
Rules that catch most mistakes:
|
|
103
|
+
|
|
104
|
+
- A `Card` holds one child — wrap several in a `Column`.
|
|
105
|
+
- `children` is an array of ids, or a template
|
|
106
|
+
`{"componentId": "row_tpl", "path": "/items"}` that repeats one component per
|
|
107
|
+
array element; inside the template, bind relative to the element.
|
|
108
|
+
- A `Button` shows its `child` (usually a `Text`), never a `label`.
|
|
109
|
+
- Media URLs are `https:` or `data:` ones you actually have. Never invent one;
|
|
110
|
+
omit the component instead.
|
|
111
|
+
|
|
112
|
+
## Forms
|
|
113
|
+
|
|
114
|
+
Pick the input by the value you need:
|
|
115
|
+
|
|
116
|
+
| Value | Component |
|
|
117
|
+
| ------------------------------ | ------------------------------------------- |
|
|
118
|
+
| Short / long free text | `TextField` `shortText` / `longText` |
|
|
119
|
+
| Number without a natural range | `TextField` `number` |
|
|
120
|
+
| Number within a known range | `Slider` |
|
|
121
|
+
| Yes / no, consent | `CheckBox` |
|
|
122
|
+
| One of a fixed set | `ChoicePicker` `mutuallyExclusive` |
|
|
123
|
+
| Several of a fixed set | `ChoicePicker` `multipleSelection` |
|
|
124
|
+
| Date, time, or both | `DateTimeInput` (enable only what you need) |
|
|
125
|
+
|
|
126
|
+
- Bind every input's `value` to its own path in `dataModel`, and give that path
|
|
127
|
+
a starting value: `""`, `false`, `[]`, a number, or what you already know.
|
|
128
|
+
Never ask for something you already have — prefill it.
|
|
129
|
+
- Use `displayStyle: "chips"` for up to ~6 short options, `filterable: true`
|
|
130
|
+
for more than ~10.
|
|
131
|
+
- Validate with `@checks`, e.g.
|
|
132
|
+
`"@checks": [{"condition": {"@call": "required", "args": {"value": {"@path": "/email"}}}, "message": "Email is required"}]`.
|
|
133
|
+
Available checks: `required`, `email`, `regex`, `length`, `numeric`, and
|
|
134
|
+
`and` / `or` / `not` to combine them.
|
|
135
|
+
- Ask only for what the next step needs; past 5–6 fields, split the form.
|
|
136
|
+
- End with one `primary` `Button` whose label names the outcome ("Book
|
|
137
|
+
flight", not "Submit"). Secondary actions are `default` or `borderless`.
|
|
138
|
+
|
|
139
|
+
## Actions
|
|
140
|
+
|
|
141
|
+
A `Button` sends an event back to you as the user's next message:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
"action": {
|
|
145
|
+
"event": {
|
|
146
|
+
"name": "book_flight",
|
|
147
|
+
"context": { "from": { "@path": "/from" }, "date": { "@path": "/date" } }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
- `name` is a snake_case verb you will recognise when it comes back.
|
|
153
|
+
- Put in `context` exactly what you need to act — bound paths for user input,
|
|
154
|
+
literals for fixed ids.
|
|
155
|
+
- When the event arrives, act on it. Then update the same surface with
|
|
156
|
+
`updateDataModel` / `updateComponents`, or reply in text — do not create a
|
|
157
|
+
second copy of the form.
|
|
158
|
+
- Put destructive actions behind a `Modal` whose content asks for
|
|
159
|
+
confirmation.
|
|
160
|
+
|
|
161
|
+
## Tables
|
|
162
|
+
|
|
163
|
+
`DataTable` is not fully supported yet. Show tabular data as a Markdown table
|
|
164
|
+
unless you were explicitly asked for `DataTable`. If you use it, write one page
|
|
165
|
+
of JSON to a file under `/workspace` and point `apiUrl` at it as a
|
|
166
|
+
`file:///workspace/...` URL:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"columns": [{ "key": "name", "label": "Name", "type": "string" }],
|
|
171
|
+
"rows": [{ "name": "Ada" }],
|
|
172
|
+
"total": 1,
|
|
173
|
+
"page": 1,
|
|
174
|
+
"pageSize": 10
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`type` is `string`, `number`, `date` or `boolean`.
|
|
179
|
+
|
|
180
|
+
## Example: a form
|
|
181
|
+
|
|
182
|
+
```a2ui
|
|
183
|
+
[
|
|
184
|
+
{
|
|
185
|
+
"version": "1.0",
|
|
186
|
+
"createSurface": {
|
|
187
|
+
"surfaceId": "meeting_request_1",
|
|
188
|
+
"catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
|
|
189
|
+
"sendDataModel": true,
|
|
190
|
+
"dataModel": {
|
|
191
|
+
"topic": "",
|
|
192
|
+
"when": "",
|
|
193
|
+
"length": 30,
|
|
194
|
+
"remote": false
|
|
195
|
+
},
|
|
196
|
+
"components": [
|
|
197
|
+
{ "id": "root", "component": "Card", "child": "form" },
|
|
198
|
+
{
|
|
199
|
+
"id": "form",
|
|
200
|
+
"component": "Column",
|
|
201
|
+
"children": ["title", "topic", "when", "length", "remote", "submit"]
|
|
202
|
+
},
|
|
203
|
+
{ "id": "title", "component": "Text", "text": "Request a meeting" },
|
|
204
|
+
{
|
|
205
|
+
"id": "topic",
|
|
206
|
+
"component": "TextField",
|
|
207
|
+
"label": "Topic",
|
|
208
|
+
"value": { "@path": "/topic" },
|
|
209
|
+
"@checks": [
|
|
210
|
+
{
|
|
211
|
+
"condition": {
|
|
212
|
+
"@call": "required",
|
|
213
|
+
"args": { "value": { "@path": "/topic" } }
|
|
214
|
+
},
|
|
215
|
+
"message": "Give the meeting a topic"
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"id": "when",
|
|
221
|
+
"component": "DateTimeInput",
|
|
222
|
+
"value": { "@path": "/when" },
|
|
223
|
+
"enableDate": true,
|
|
224
|
+
"enableTime": true
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"id": "length",
|
|
228
|
+
"component": "Slider",
|
|
229
|
+
"label": "Minutes",
|
|
230
|
+
"min": 15,
|
|
231
|
+
"max": 120,
|
|
232
|
+
"steps": 7,
|
|
233
|
+
"value": { "@path": "/length" }
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "remote",
|
|
237
|
+
"component": "CheckBox",
|
|
238
|
+
"label": "Remote",
|
|
239
|
+
"value": { "@path": "/remote" }
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "submit",
|
|
243
|
+
"component": "Button",
|
|
244
|
+
"variant": "primary",
|
|
245
|
+
"child": "submit_label",
|
|
246
|
+
"action": {
|
|
247
|
+
"event": {
|
|
248
|
+
"name": "request_meeting",
|
|
249
|
+
"context": {
|
|
250
|
+
"topic": { "@path": "/topic" },
|
|
251
|
+
"when": { "@path": "/when" },
|
|
252
|
+
"length": { "@path": "/length" },
|
|
253
|
+
"remote": { "@path": "/remote" }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"id": "submit_label",
|
|
260
|
+
"component": "Text",
|
|
261
|
+
"text": "Request meeting"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
```
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: a2ui_charts
|
|
3
|
+
description: How to show a chart in an A2UI surface with Zenera's EChart component - choosing the chart type and writing the ECharts option file it loads. Load together with a2ui.
|
|
4
|
+
tags: [ui, a2ui, charts]
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Charts in A2UI (Zenera `EChart`)
|
|
9
|
+
|
|
10
|
+
`EChart` draws an [Apache ECharts](https://echarts.apache.org) chart. It does
|
|
11
|
+
not take data inline: it loads an ECharts **option** — the object
|
|
12
|
+
`echarts.setOption` takes, data included — as JSON from `apiUrl`. So a chart is
|
|
13
|
+
two steps:
|
|
14
|
+
|
|
15
|
+
1. Write the option to a JSON file under `/workspace` with `write_file`.
|
|
16
|
+
2. Emit a surface whose `EChart` points at it as a `file:///workspace/...` URL.
|
|
17
|
+
|
|
18
|
+
Without `write_file` you cannot make a chart: answer with a Markdown table
|
|
19
|
+
instead. Load the `a2ui` skill too — it has the message format.
|
|
20
|
+
|
|
21
|
+
## When a chart helps
|
|
22
|
+
|
|
23
|
+
Draw one only for numbers you actually have — from a tool, a file, or the user.
|
|
24
|
+
Never invent, round off or "illustrate" data. A single number, or two or three
|
|
25
|
+
values, reads better as a sentence.
|
|
26
|
+
|
|
27
|
+
## Choosing the type
|
|
28
|
+
|
|
29
|
+
| The question | `series.type` |
|
|
30
|
+
| --------------------------------- | ----------------------------------------------------- |
|
|
31
|
+
| How does it change over time? | `line` (`area` = `line` with `areaStyle: {}`) |
|
|
32
|
+
| How do categories compare? | `bar` (horizontal bars when labels are long) |
|
|
33
|
+
| How is a whole split? (≤ 6 parts) | `pie` — otherwise a sorted `bar` |
|
|
34
|
+
| How do two measures relate? | `scatter` |
|
|
35
|
+
| How are values distributed? | `bar` over bucketed ranges |
|
|
36
|
+
| Parts of a whole over time | `bar` or `line` with `stack: "total"` on every series |
|
|
37
|
+
| Two dimensions × intensity | `heatmap` with `visualMap` |
|
|
38
|
+
| Progress against one target | `gauge` |
|
|
39
|
+
|
|
40
|
+
Keep it readable: at most ~5 series, ~12 pie/bar categories (group the rest as
|
|
41
|
+
"Other"), and sort bars by value unless the categories have a natural order.
|
|
42
|
+
|
|
43
|
+
## The option file
|
|
44
|
+
|
|
45
|
+
Write strict JSON — no JavaScript. Function-valued options (`formatter`
|
|
46
|
+
functions, callbacks) cannot be expressed; use string templates such as
|
|
47
|
+
`"{b}: {c}"` instead.
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"title": { "text": "Monthly revenue, 2026", "subtext": "USD thousands" },
|
|
52
|
+
"tooltip": { "trigger": "axis" },
|
|
53
|
+
"legend": {},
|
|
54
|
+
"xAxis": { "type": "category", "data": ["Jan", "Feb", "Mar", "Apr"] },
|
|
55
|
+
"yAxis": { "type": "value", "name": "USD k" },
|
|
56
|
+
"series": [
|
|
57
|
+
{ "name": "Online", "type": "line", "data": [120, 132, 101, 134] },
|
|
58
|
+
{ "name": "Retail", "type": "line", "data": [220, 182, 191, 234] }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- Always a `title`, and units in the subtitle or axis `name`.
|
|
64
|
+
- `tooltip.trigger`: `axis` for line/bar, `item` for pie/scatter.
|
|
65
|
+
- Add `legend` only with more than one series (or for a pie).
|
|
66
|
+
- Pie and gauge take no `xAxis`/`yAxis`; pie data is `[{"name", "value"}]`.
|
|
67
|
+
- Leave colours and fonts to the theme.
|
|
68
|
+
- Name the file after what it shows: `/workspace/charts/revenue_2026.json`.
|
|
69
|
+
Write a new file for a changed chart rather than rewriting one already shown.
|
|
70
|
+
|
|
71
|
+
## The surface
|
|
72
|
+
|
|
73
|
+
```a2ui
|
|
74
|
+
[
|
|
75
|
+
{
|
|
76
|
+
"version": "1.0",
|
|
77
|
+
"createSurface": {
|
|
78
|
+
"surfaceId": "revenue_chart_1",
|
|
79
|
+
"catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
|
|
80
|
+
"components": [
|
|
81
|
+
{ "id": "root", "component": "Card", "child": "body" },
|
|
82
|
+
{
|
|
83
|
+
"id": "body",
|
|
84
|
+
"component": "Column",
|
|
85
|
+
"children": ["chart", "note"]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "chart",
|
|
89
|
+
"component": "EChart",
|
|
90
|
+
"@catalogId": "https://zenera.ai/a2ui/catalogs/zenera/v1_0/catalog.json",
|
|
91
|
+
"apiUrl": "file:///workspace/charts/revenue_2026.json"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "note",
|
|
95
|
+
"component": "Text",
|
|
96
|
+
"variant": "caption",
|
|
97
|
+
"text": "Source: sales ledger, Jan–Apr 2026"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Every `EChart` carries the Zenera `@catalogId`; the surface keeps the basic
|
|
106
|
+
`catalogId`.
|
|
107
|
+
- Put a caption `Text` under the chart naming the data source.
|
|
108
|
+
- Several charts: one `EChart` each, stacked in a `Column` — or in `Tabs` when
|
|
109
|
+
they are alternative views of the same data.
|
|
110
|
+
- In your text, state the one finding the chart shows; do not list its numbers
|
|
111
|
+
again.
|