@zenera/cli 1.3.25 → 1.3.27
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/package.json +6 -6
- package/templates/project/agents/skills/html-page/SKILL.md +14 -4
- package/templates/project/agents/skills/html-page/assets/app/app.tsx +1 -0
- package/templates/project/agents/skills/html-page/assets/dashboard.tsx +2 -0
- package/templates/project/agents/skills/html-page/kit/shell.html +1 -0
- package/templates/project/agents/skills/html-page/scripts/build.ts +28 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenera/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.27",
|
|
4
4
|
"description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"@google/genai": "^2.30.0",
|
|
57
57
|
"@inkjs/ui": "^2.0.0",
|
|
58
58
|
"@openrouter/sdk": "^1.4.25",
|
|
59
|
-
"@zenera/engine": "^1.3.
|
|
60
|
-
"@zenera/neo": "^1.3.
|
|
61
|
-
"@zenera/sandbox": "^1.3.
|
|
62
|
-
"@zenera/server": "^1.3.
|
|
63
|
-
"@zenera/view": "^1.3.
|
|
59
|
+
"@zenera/engine": "^1.3.27",
|
|
60
|
+
"@zenera/neo": "^1.3.27",
|
|
61
|
+
"@zenera/sandbox": "^1.3.27",
|
|
62
|
+
"@zenera/server": "^1.3.27",
|
|
63
|
+
"@zenera/view": "^1.3.27",
|
|
64
64
|
"google-auth-library": "^10.0.0",
|
|
65
65
|
"ink": "^7.1.1",
|
|
66
66
|
"openai": "^6.0.0",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: html-page
|
|
3
3
|
description: Building an interactive page the user opens from the chat - a dashboard or report with charts, tables, filters and headline numbers, or a small app whose page calls Python functions to read and change data (a tracker, a CRUD tool, a mail or ticket view, a form that saves, a page that queries a database each time it opens). The page is a React component in TypeScript (app.tsx) that a build checks and turns into one HTML file. Where to write it, how it gets its data, the kit of components, the layout that works in the chat's side panel and full page, and how to build and check it. Load when an answer has more than one chart or table, data the user will want to filter or explore, or the user wants something to use and change.
|
|
4
4
|
tags: [html, react, typescript, dashboard, report, app, charts, api, python, ui]
|
|
5
|
-
version: 2.
|
|
5
|
+
version: 2.1.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Interactive pages
|
|
@@ -197,8 +197,15 @@ How, with the kit:
|
|
|
197
197
|
|
|
198
198
|
## Page code
|
|
199
199
|
|
|
200
|
-
- `export default function App()` in `app.tsx
|
|
201
|
-
|
|
200
|
+
- `export default function App()` in `app.tsx`. The build mounts `App` -
|
|
201
|
+
never call `createRoot`.
|
|
202
|
+
- `export const title = '...'` names the page: the browser tab and the
|
|
203
|
+
chat's card for it ("Gmail simulation", "Sales Q1 dashboard").
|
|
204
|
+
- `export const description = '...'`: one sentence, in the user's words, on
|
|
205
|
+
what the page shows or lets them do ("Inbox with search, folders, stars
|
|
206
|
+
and drafts; demo messages only."). The chat shows it on the page's card
|
|
207
|
+
under the title. No "built with", file or function names. The build
|
|
208
|
+
reminds you when it is missing.
|
|
202
209
|
- State lives in hooks; everything on the page is drawn from it, so the
|
|
203
210
|
numbers, charts and lists always agree. Derive filtered rows and chart
|
|
204
211
|
options with `useMemo` from the data and the filters.
|
|
@@ -246,7 +253,10 @@ message`. Fix each one and build again until it prints `✓ wrote index.html`.
|
|
|
246
253
|
- The main findings with their numbers in two to four sentences, or for an
|
|
247
254
|
app what it does - the reply must stand on its own for someone who never
|
|
248
255
|
opens the page.
|
|
249
|
-
- Then the page as a link, alone in its own paragraph (the build prints it)
|
|
256
|
+
- Then the page as a link, alone in its own paragraph (the build prints it).
|
|
257
|
+
The link's text is the page's name, as its `title` - not an instruction
|
|
258
|
+
("Open the …", "Click here"): the chat shows it as a card with the title,
|
|
259
|
+
the description and buttons to open it.
|
|
250
260
|
|
|
251
261
|
[Sales Q1 dashboard](file:///workspace/pages/sales-q1/index.html)
|
|
252
262
|
|
|
@@ -42,6 +42,8 @@ interface Report {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export const title = 'Dashboard';
|
|
45
|
+
export const description =
|
|
46
|
+
'Amounts by category, region and date, with filters and the rows behind them.';
|
|
45
47
|
|
|
46
48
|
const columns: Column[] = [
|
|
47
49
|
{ title: 'Date', field: 'date', headerFilter: 'input', minWidth: 100 },
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
// 2. rules what a sandboxed page cannot do: storage, dialogs, other hosts, raw html, ...
|
|
12
12
|
// 3. bundle esbuild: React, the kit and the page's modules in one script
|
|
13
13
|
// 4. render App rendered once in Node, so a crash on first render is caught here
|
|
14
|
-
// 5. write the html: shell.html with the css and js inlined,
|
|
15
|
-
//
|
|
14
|
+
// 5. write the html: shell.html with the css and js inlined, the page's `title` and
|
|
15
|
+
// `description` exports in <title> and <meta name="description"> (the chat's
|
|
16
|
+
// card for the page shows them), stamped with a hash of the sources. Nothing is written unless every step passed.
|
|
16
17
|
// --check runs 1, 2 and 4 and says whether each page's html is out of date with its sources.
|
|
17
18
|
//
|
|
18
19
|
// Runs where esbuild, typescript, react, react-dom and their types are installed: in the zen
|
|
@@ -68,6 +69,8 @@ interface Entry {
|
|
|
68
69
|
/** the html it builds, absolute */
|
|
69
70
|
html: string;
|
|
70
71
|
title: string;
|
|
72
|
+
/** `export const description`, or '' when the page has none */
|
|
73
|
+
description: string;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
interface Tools {
|
|
@@ -143,6 +146,15 @@ function titleOf(text: string, fallback: string): string {
|
|
|
143
146
|
return words ? words[0]!.toUpperCase() + words.slice(1) : 'Page';
|
|
144
147
|
}
|
|
145
148
|
|
|
149
|
+
/** `export const description = '...'`: one sentence the chat's card shows under the title. */
|
|
150
|
+
function descriptionOf(text: string): string {
|
|
151
|
+
const m =
|
|
152
|
+
/export\s+const\s+description(?:\s*:\s*string)?\s*=\s*(['"`])((?:(?!\1)[^\n\\])+)\1/.exec(
|
|
153
|
+
text,
|
|
154
|
+
);
|
|
155
|
+
return m ? m[2]!.trim() : '';
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
function entriesOf(dir: string): { entries: Entry[]; problems: Problem[] } {
|
|
147
159
|
const problems: Problem[] = [];
|
|
148
160
|
const entries: Entry[] = [];
|
|
@@ -176,7 +188,12 @@ function entriesOf(dir: string): { entries: Entry[]; problems: Problem[] } {
|
|
|
176
188
|
continue;
|
|
177
189
|
}
|
|
178
190
|
const fallback = htmlName === 'index.html' ? basename(dir) : base;
|
|
179
|
-
entries.push({
|
|
191
|
+
entries.push({
|
|
192
|
+
source,
|
|
193
|
+
html: join(dir, htmlName),
|
|
194
|
+
title: titleOf(text, fallback),
|
|
195
|
+
description: descriptionOf(text),
|
|
196
|
+
});
|
|
180
197
|
}
|
|
181
198
|
if (!entries.length && !problems.length) {
|
|
182
199
|
problems.push({
|
|
@@ -852,12 +869,13 @@ function pageHtml(dir: string, entry: Entry, built: Bundle, hash: string): strin
|
|
|
852
869
|
const parts: Record<string, string> = {
|
|
853
870
|
STAMP: stamp,
|
|
854
871
|
TITLE: escapeHtml(entry.title),
|
|
872
|
+
DESCRIPTION: escapeHtml(entry.description),
|
|
855
873
|
HEAD: head.join('\n '),
|
|
856
874
|
CSS: css,
|
|
857
875
|
JS: js,
|
|
858
876
|
};
|
|
859
877
|
return readFileSync(SHELL, 'utf8').replace(
|
|
860
|
-
/<!--(STAMP|TITLE|HEAD|CSS|JS)-->/g,
|
|
878
|
+
/<!--(STAMP|TITLE|DESCRIPTION|HEAD|CSS|JS)-->/g,
|
|
861
879
|
(_, key: string) => parts[key]!,
|
|
862
880
|
);
|
|
863
881
|
}
|
|
@@ -972,6 +990,12 @@ async function main(argv: string[]): Promise<number> {
|
|
|
972
990
|
console.log(
|
|
973
991
|
`✓ wrote ${rel(dir, entry.html)} (${kb} KB) from ${rel(dir, entry.source)}`,
|
|
974
992
|
);
|
|
993
|
+
if (!entry.description) {
|
|
994
|
+
console.log(
|
|
995
|
+
` ${rel(dir, entry.source)} has no description: add export const description = '...' ` +
|
|
996
|
+
`(one sentence on what the page shows or lets the user do; the chat shows it on the page's card) and build again`,
|
|
997
|
+
);
|
|
998
|
+
}
|
|
975
999
|
}
|
|
976
1000
|
const link = pages.find((p) => basename(p.entry.html) === 'index.html') ?? pages[0]!;
|
|
977
1001
|
console.log(
|