@kizenapps/cli 1.13.0 → 1.14.0-8ac42d6

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/README.md CHANGED
@@ -57,7 +57,9 @@ The wizard first asks where the plugin should live (the current directory, or a
57
57
 
58
58
  > **Fill in Description and Business ID.** Both are labelled optional in the wizard, but `create` writes them into `kizen.json` as empty strings and the bundler rejects an empty `description` or `developer_business_id` — so a plugin created with those fields skipped fails `appbuilder build` until you edit `kizen.json` by hand. This is tracked internally (KZN-17594); until that fix lands, treat both as required.
59
59
 
60
- `create` writes `kizen.json`, `src/`, `releaseNotes/`, and adds `.kizenapp/` to `.gitignore`.
60
+ It then asks which artifacts to scaffold — Floating frame, Block, Data adornment, Routable page, Toolbar item, Object settings item, JS action — with all seven selected by default (Space toggles, `a` selects all, `n` none). Each selected type gets a working `hello*` directory under `src/`, holding a `config.json` and a script that runs as-is.
61
+
62
+ `create` writes `kizen.json`, `src/`, `releaseNotes/`, a placeholder `src/thumbnail.png` (512×512, colored from the `api_name`), the templates for the artifacts you picked, and the Copilot review files described under [`appbuilder create`](#appbuilder-create). It adds both `.kizenapp/` and `.copilot-docs/` to `.gitignore`.
61
63
 
62
64
  ### 2. Set up credentials
63
65
 
@@ -102,25 +104,38 @@ Writes `.kizenapp/bundle.json` — the same artifact `dev` serves — after runn
102
104
 
103
105
  ### `appbuilder create`
104
106
 
105
- Scaffolds a new Kizen plugin project. Interactive; no flags. See [Quickstart](#1-scaffold-a-plugin) for the fields it collects.
107
+ Scaffolds a new Kizen plugin project. Interactive by default; passing any flag other than `--include-lib` switches it to a non-interactive run, including `--artifacts` to choose the artifact templates up front (`appbuilder create --help` lists them all). Pass `--include-lib` to also write the Kizen data helper library to `src/lib/kizenData.js`; without it, no library is written. See [Quickstart](#1-scaffold-a-plugin) for the fields it collects, the artifact picker, and everything it writes.
108
+
109
+ The scaffold also includes `.github/copilot-instructions.md`, two path-scoped instruction files under `.github/instructions/`, and `.github/workflows/copilot-code-review.yml`. That workflow fetches the Kizen plugin docs from `kizen/app-engine` into `.copilot-docs/` before Copilot code review runs, so reviews cite the current documentation instead of rules copied into the plugin repo. It only takes effect once it is on the repository's default branch, and `.copilot-docs/` is gitignored. Plugins scaffolded before this setup existed can pick it up with `appbuilder setup-copilot`.
110
+
111
+ ### `appbuilder setup-copilot`
112
+
113
+ Writes the same Copilot review files into an existing plugin repo — run it from the repo root (a `kizen.json` must be there). The four files are CLI-owned, so the command overwrites them and prints `created`, `updated`, or `unchanged` per file; a clobbered local customization is recoverable from git. It also adds `.kizenapp/` and `.copilot-docs/` to `.gitignore` if they are missing.
114
+
115
+ | Flag | Default | Purpose |
116
+ | ----------- | ------- | ----------------------------------------------- |
117
+ | `--dry-run` | off | Print the per-file statuses without writing any |
118
+
119
+ As with `create`, the workflow only runs once it has reached the repository's default branch.
106
120
 
107
121
  ### `appbuilder setup-claude`
108
122
 
109
123
  Installs or refreshes the Claude Code skill for building custom blocks (`.claude/skills/kizen-custom-block/SKILL.md`) in the plugin in the current directory. `appbuilder create` writes the skill once; run `setup-claude` in an existing plugin to add it, or after upgrading the CLI to pick up the bundled version.
110
124
 
111
125
  ```sh
112
- appbuilder setup-claude [--dry-run]
126
+ appbuilder setup-claude [--dry-run] [--include-lib]
113
127
  ```
114
128
 
115
- | Flag | Default | Purpose |
116
- | ----------- | ------- | ----------------------------------------------- |
117
- | `--dry-run` | off | Report what would change without writing files. |
129
+ | Flag | Default | Purpose |
130
+ | --------------- | ------- | ------------------------------------------------------------ |
131
+ | `--dry-run` | off | Report what would change without writing files. |
132
+ | `--include-lib` | off | Also install the Kizen data helper library (`kizenData.js`). |
118
133
 
119
- It also installs the skill's design guide (`.claude/skills/kizen-custom-block/design.md`), which tells the agent how to make blocks match native dashlets, and the Kizen data helper library (`src/lib/kizenData.js`) that block scripts import to read records and apply the dashboard's date and team filters. The library goes under the `entry` directory from `kizen.json` (`<entry>/lib/kizenData.js`, one per entry in a multi-plugin `kizen.json`), and under `src/` when `kizen.json` has no usable `entry`. `appbuilder create` writes it to `src/lib/kizenData.js`.
134
+ It also installs the skill's design guide (`.claude/skills/kizen-custom-block/design.md`), which tells the agent how to make blocks match native dashlets. With `--include-lib`, it installs the Kizen data helper library that block scripts import to read records and apply the dashboard's date and team filters. The library goes under the `entry` directory from `kizen.json` (`<entry>/lib/kizenData.js`, one per entry in a multi-plugin `kizen.json`), and under `src/` when `kizen.json` has no usable `entry`. Without the flag, it refreshes only the libraries that already exist. `appbuilder create --include-lib` writes it to `src/lib/kizenData.js`.
120
135
 
121
136
  It prints one line per file (`created`, `updated` or `unchanged`) and a one-line summary. These files are managed by the CLI, so local edits to them, including edits to `kizenData.js`, are replaced when they're `updated`. Don't edit `kizenData.js`; put your own helpers in another file under `src/lib/`. It only writes these files and never touches the `.github/` Copilot files or block code. It fails with exit code 1 when there's no `kizen.json` in the current directory.
122
137
 
123
- `block push` adds the warning `Claude files managed by appbuilder are out of date; run appbuilder setup-claude` when the plugin has the skill and any managed file (the skill, its design guide or `kizenData.js`) is missing or differs from the bundled one. The warning never fails the push.
138
+ `block push` adds the warning `Claude files managed by appbuilder are out of date; run appbuilder setup-claude` when the plugin has the skill and the skill or its design guide is missing or differs from the bundled one, or an existing `kizenData.js` differs from the bundled one. The warning never fails the push.
124
139
 
125
140
  ### `appbuilder build`
126
141
 
@@ -128,6 +143,8 @@ Reads the plugin in the current directory, validates it against the same rules e
128
143
 
129
144
  If validation finds any errors (for example an `api_name` containing hyphens, which the platform rejects) the build fails and prints each issue grouped by file. Fix the reported issues and re-run.
130
145
 
146
+ Automation step configs are validated the same way — parameter data types, secrets that must be declared in the manifest's `base_config.secrets`, fields removed from the publish contract, and `runtime` — against the list of automation data types bundled in `@kizenapps/packager`. The Plugin Wizard applies the same rules at publish, against the live list read from the target environment, so a build that passes locally is expected to publish clean.
147
+
131
148
  ### `appbuilder dev`
132
149
 
133
150
  Starts the dev server and opens the viewer. Watches your plugin directory and rebuilds + hot-reloads the viewer on every change. Each rebuild runs the same validation as `build`.
@@ -205,6 +222,8 @@ Only the block JSON goes to stdout, so it can be piped or redirected (`appbuilde
205
222
 
206
223
  The JSON carries only the sizes the block's `config.json` writes: `min_w`, `max_w`, `min_h`, `max_h`, `default_w` and `default_h`. Sizes it leaves out are left out of the JSON too, rather than filled with packager defaults. `default_w` and `default_h` are the starting size, in grid columns and rows, of a dashlet created from the block. Each size that is set must be a positive integer, each `min_*` must be no greater than its `max_*`, and each `default_*` must fall within whichever of its `min_*` and `max_*` are set (for example `min_w` ≤ `default_w` ≤ `max_w`). Otherwise the export fails as `invalid_block` naming the field.
207
224
 
225
+ If the plugin has components in `src/views/`, the JSON also carries a `views` array: each packaged view's `api_name`, `name`, `type`, `script`/`html`/`css` (each left out when empty) and `event_scripts` (as a `[{ name, script }]` array), so the block can open one with `this.showViewInModal('<api_name>')`. Components in `src/pages/` are not included. Without views, the output is unchanged.
226
+
208
227
  ### `appbuilder block push`
209
228
 
210
229
  Packages the plugin in the current directory (same validation as `block export`) and writes one block into a Custom Block (AI Coded) dashlet on a Kizen dashboard, homepage or chart group: it updates an existing dashlet or creates a new one. Card chrome (background, border, radius, shadow) comes from the dashboard's style settings, like native dashlets.
@@ -240,6 +259,10 @@ It runs headless when stdin or stdout is not a TTY, or when `--json` is passed.
240
259
 
241
260
  **Size.** A dashlet created by `push` starts `default_w` columns wide, or `min_w` when there's no `default_w`, or 6 when neither is set. Its height works the same way with `default_h`, then `min_h`, then 3 rows. That size is clamped into whichever of `min_*`/`max_*` the block's `config.json` sets, then into the grid (2 to 12 columns, 1 to 99 rows). The pushed content carries exactly the sizes `config.json` writes, the same as `block export`. Updating an existing dashlet never changes its layout or size.
242
261
 
262
+ The pushed content includes the plugin's `src/views/` components as `views`, in the same shape as `block export`. They count toward drift detection: a view changed in Kizen since the last push stops the push with `drift_detected`. Blocks in plugins without views push exactly as before, and existing `pushes.json` entries stay valid.
263
+
264
+ `block export` and `block push` fail with `invalid_block` if a view's `api_name`, `name`, `script`, `html`, `css` or event script contains a NUL character or `{__ref:`. The field is reported as `views.<api_name>.<field>`. A warning `appbuilder/views-unmatched` appears if some `src/views/` components couldn't be matched to packaged views.
265
+
243
266
  **Matching.** With `--dashboard` and neither `--dashlet` nor `--create`, the push updates the dashlet recorded in `.kizenapp/pushes.json` for that dashboard, else the single custom code dashlet named `appbuilder:<plugin_api_name>/<block_api_name>` (the name given to every dashlet `push` creates). No match, or several, is `needs_choice`.
244
267
 
245
268
  #### JSON output
@@ -303,7 +326,7 @@ An applied write:
303
326
 
304
327
  `action` is `created` or `updated`. `remembered` is `false` (with a warning) when `.kizenapp/pushes.json` couldn't be written; the push itself still succeeded.
305
328
 
306
- `refresh` is only on applied writes, and only when the dashboard id is a uuid; otherwise it's left out. `script` is exactly `await window.__kizenCustomBlocks?.refresh('<dashboardId>')`. Run it in a Kizen tab that already has `url` open to refetch that dashboard in place instead of reloading the page. The hook is registered on dashboards, homepages and chart groups. When it's available on the page, the script resolves to `{ refreshed: true, dashboardId }`. Otherwise it resolves to `undefined`: that browser's localStorage doesn't have `kizen-flag-custom-code-blocks` set to `'true'`, or the page is an older Kizen build without the hook. `refreshed: true` means the dashboard query was invalidated, not that the target was on screen, which is why the agent matches the tab by `url` and screenshots afterwards. Human output prints the same script on a `Refresh an open tab:` line after the URL.
329
+ `refresh` is only on applied writes, and only when the dashboard id is a uuid; otherwise it's left out. `script` is exactly `await window.__kizenCustomBlocks?.refresh('<dashboardId>')`. Run it in a Kizen tab that already has `url` open to refetch that dashboard in place instead of reloading the page. The hook is registered on dashboards, homepages and chart groups. When it's available on the page, the script resolves to `{ refreshed: true, dashboardId }`. Otherwise it resolves to `undefined`: the page is an older Kizen build without the hook. `refreshed: true` means the dashboard query was invalidated, not that the target was on screen, which is why the agent matches the tab by `url` and screenshots afterwards. Human output prints the same script on a `Refresh an open tab:` line after the URL.
307
330
 
308
331
  A failure exits 1:
309
332