@kizenapps/cli 1.10.0-0a9fae5 → 1.10.0-e36fedb

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.
Files changed (32) hide show
  1. package/README.md +172 -15
  2. package/dist/THIRD-PARTY-NOTICES.txt +4342 -0
  3. package/dist/index.js +24 -24
  4. package/dist/index.js.map +1 -1
  5. package/dist/viewer/assets/AppDetailPage-D9xr-bY8.js +1 -0
  6. package/dist/viewer/assets/{CodeStepsPage-BjnqiAQX.js → CodeStepsPage-CvCrJCQn.js} +1 -1
  7. package/dist/viewer/assets/{ConfigurationPage-XUysfO8v.js → ConfigurationPage-5qOX-sx0.js} +1 -1
  8. package/dist/viewer/assets/IconReferencePage-BxPfyqlV.js +1 -0
  9. package/dist/viewer/assets/SandboxPage-DuCHX1FY.js +1 -0
  10. package/dist/viewer/assets/{SecretsPage-BwDfBKbY.js → SecretsPage-Da55-e_S.js} +1 -1
  11. package/dist/viewer/assets/{SourceBrowserPage-D9z0jLNw.js → SourceBrowserPage-DluS8U4q.js} +1 -1
  12. package/dist/viewer/assets/blockDimensions-BhWxVVcK.js +1 -0
  13. package/dist/viewer/assets/{index-C570aZ49.js → index-Du4zThGL.js} +2 -2
  14. package/dist/viewer/assets/index-MRuQEa3q.css +2 -0
  15. package/dist/viewer/assets/{useCompleteSetup-3RGdCYrc.js → useCompleteSetup-DUHoBgca.js} +1 -1
  16. package/dist/viewer/assets/{usePluginConfig-XFnehL_S.js → usePluginConfig-C8d13THZ.js} +1 -1
  17. package/dist/viewer/assets/validIcons-D8mhuO5s.js +1 -0
  18. package/dist/viewer/index.html +2 -2
  19. package/package.json +27 -8
  20. package/dist/viewer/assets/AppDetailPage-CKDgNuvS.js +0 -1
  21. package/dist/viewer/assets/IconReferencePage-CN9Tha2W.js +0 -1
  22. package/dist/viewer/assets/SandboxPage-DbMklAzy.js +0 -1
  23. package/dist/viewer/assets/blockDimensions-XngD6WWh.js +0 -1
  24. package/dist/viewer/assets/fa-pro-icons-B6J9phvt.js +0 -1
  25. package/dist/viewer/assets/iconMap-B-cS2yrx.js +0 -1
  26. package/dist/viewer/assets/index-CortCmDi.css +0 -2
  27. /package/dist/viewer/assets/{CodeViewer-DpJLTTab.js → CodeViewer-CVECJY4e.js} +0 -0
  28. /package/dist/viewer/assets/{VersionsPage-CRnStnQ-.js → VersionsPage-yNilRkEf.js} +0 -0
  29. /package/dist/viewer/assets/{WhenBadge-Dm7YHpxd.js → WhenBadge-B7s7fns2.js} +0 -0
  30. /package/dist/viewer/assets/{formatBytes-BV6bvmhE.js → formatBytes-BXYIMbyB.js} +0 -0
  31. /package/dist/viewer/assets/{setupAssistant-C-3V_Vj3.js → setupAssistant-DtI9NWXr.js} +0 -0
  32. /package/dist/viewer/assets/{useLocalStorage-BZr9ZJI5.js → useLocalStorage-wp83IS34.js} +0 -0
package/README.md CHANGED
@@ -4,44 +4,197 @@ A local development environment for [Kizen](https://www.kizen.com) plugin apps.
4
4
 
5
5
  `appbuilder` scaffolds a new plugin, bundles it, and runs a live viewer in a dedicated Chromium window so you can iterate on your plugin against any Kizen environment without having to publish, deploy, or reload by hand.
6
6
 
7
- ## Usage
7
+ ## Requirements
8
8
 
9
- Change directories to a directory containing plugin code, and run:
9
+ | Requirement | Version | Why |
10
+ | ------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | Node.js | `>=20` | Enforced by `engines` in `package.json`. |
12
+ | Google Chrome or Chromium | any recent release | The viewer is launched via [`chrome-launcher`](https://github.com/GoogleChrome/chrome-launcher) against a locally installed browser. No browser is bundled. |
13
+ | Python | 3.12 or 3.13 | Only needed to execute code steps locally. The dev server builds a virtualenv with the interpreter the step's runtime asks for (`python-3-12` / `python-3-13`), matching the runtime images the hosted Kizen code-runner ships. |
14
+
15
+ `chrome-launcher` auto-discovers an installed Chrome/Chromium; if yours lives somewhere unusual, set `CHROME_PATH` to the executable and it will be preferred.
16
+
17
+ Python is resolved lazily — the CLI only looks for an interpreter the first time a plugin actually runs a code step, so you can build UI-only plugins without it.
18
+
19
+ ## Installation
20
+
21
+ Run it without installing:
10
22
 
11
23
  ```sh
12
24
  npx @kizenapps/cli dev
13
25
  ```
14
26
 
27
+ Or install it globally. The published binary is named `appbuilder`:
28
+
29
+ ```sh
30
+ npm install -g @kizenapps/cli
31
+ appbuilder dev
32
+ ```
33
+
34
+ Every commit to `main` publishes a prerelease under the `next` dist-tag (versioned `<version>-<short-sha>`); tagged releases go to `latest`. To pick up an unreleased fix:
35
+
36
+ ```sh
37
+ npm install -g @kizenapps/cli@next
38
+ ```
39
+
40
+ ## Quickstart
41
+
42
+ ### 1. Scaffold a plugin
43
+
44
+ ```sh
45
+ appbuilder create
46
+ ```
47
+
48
+ The wizard first asks where the plugin should live (the current directory, or a new sub-directory named after the API name), then collects five fields:
49
+
50
+ | Field | Required | Notes |
51
+ | ------------- | -------- | ------------------------------------------------------------------------------------ |
52
+ | Name | yes | Human-readable plugin name. |
53
+ | API name | yes | Defaults to a snake_cased version of the name. Hyphens are rejected by the platform. |
54
+ | External link | no | Documentation or marketing URL for the plugin. |
55
+ | Description | no\* | See the note below. |
56
+ | Business ID | no\* | Prefilled from your stored credentials' business ID, when one exists. |
57
+
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
+
60
+ `create` writes `kizen.json`, `src/`, `releaseNotes/`, and adds `.kizenapp/` to `.gitignore`.
61
+
62
+ ### 2. Set up credentials
63
+
64
+ `appbuilder dev` talks to a real Kizen environment on your behalf, so it needs four things:
65
+
66
+ | Field | Where it comes from |
67
+ | ----------- | --------------------------------------------------------------------------------------------------- |
68
+ | API Key | An API key issued for your Kizen user, from the Kizen app. |
69
+ | User ID | The UUID of your Kizen user. |
70
+ | Business ID | The UUID of the Kizen business you are developing against. |
71
+ | Environment | One of `go`, `fmo`, `staging`, `integration`, `test1` — which Kizen deployment the above belong to. |
72
+
73
+ They are sent as `X-API-KEY` / `X-USER-ID` / `X-BUSINESS-ID` headers on every proxied request, so they must all belong to the same environment.
74
+
75
+ On the first `appbuilder dev` in a plugin directory you are prompted to pick a credential mode:
76
+
77
+ - **Global** — credentials are written to `~/.kizenappbuilder/credentials.json` (directory `0700`, file `0600`) and shared across every plugin on the machine. You can keep additional named profiles alongside it as `~/.kizenappbuilder/<profile>.json` and switch between them with `c` in the TUI.
78
+ - **Local** — nothing is written to disk by the CLI; you enter credentials inside the viewer, and they live in the browser profile under `.kizenapp/`.
79
+
80
+ The choice and the active profile name are remembered in `.kizenapp/config.json`, so subsequent runs load silently. `--credentials <path>` bypasses all of this and reads a specific JSON file.
81
+
82
+ ### 3. Run the dev server
83
+
84
+ ```sh
85
+ cd my-plugin
86
+ appbuilder dev
87
+ ```
88
+
89
+ This builds the plugin, starts the local server on port 3121, and opens the viewer in a dedicated Chromium window. Every file change rebuilds and hot-reloads; if validation fails, the error appears in the TUI and the viewer keeps the last good bundle.
90
+
91
+ TUI keys: `v` launches the viewer (useful with `--no-viewer`), `c` switches credential profile, `q` quits.
92
+
93
+ ### 4. Produce a bundle
94
+
95
+ ```sh
96
+ appbuilder build
97
+ ```
98
+
99
+ Writes `.kizenapp/bundle.json` — the same artifact `dev` serves — after running the full validation pass. Use this in CI or whenever you want a bundle without starting a server.
100
+
15
101
  ## Commands
16
102
 
17
- ### `@kizenapps/cli create`
103
+ ### `appbuilder create`
18
104
 
19
- Scaffolds a new plugin project. Interactive — prompts for the plugin name, API name, external link, description, and developer business ID, then writes a starter `kizen.json`, `src/`, and `releaseNotes/` into either the current directory or a subdirectory.
105
+ Scaffolds a new Kizen plugin project. Interactive; no flags. See [Quickstart](#1-scaffold-a-plugin) for the fields it collects.
20
106
 
21
- ### `@kizenapps/cli build`
107
+ ### `appbuilder build`
22
108
 
23
- Reads the plugin in the current directory, validates it against the same rules enforced by the Kizen platform and Plugin Wizard, minifies sources, and writes `.kizenapp/bundle.json`. No flags. Run this if you want to produce a bundle without starting the dev server.
109
+ Reads the plugin in the current directory, validates it against the same rules enforced by the Kizen platform and Plugin Wizard, minifies sources, and writes `.kizenapp/bundle.json`. No flags.
24
110
 
25
111
  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.
26
112
 
27
- ### `@kizenapps/cli dev`
113
+ ### `appbuilder dev`
28
114
 
29
- 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`; if it fails, the error is shown in the TUI and the viewer keeps the last good bundle until you fix it.
115
+ 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`.
30
116
 
31
117
  | Flag | Default | Purpose |
32
118
  | -------------------------- | ------- | ---------------------------------------------------------------- |
33
119
  | `-p, --port <port>` | `3121` | Port the local dev server listens on |
34
120
  | `-c, --credentials <path>` | — | Use a specific credentials JSON file instead of a stored profile |
35
121
  | `-d, --debug` | off | Show a CDP event panel in the TUI |
36
- | `-v, --verbose` | off | Log every CDP event (implies `--debug`) |
37
- | `--no-viewer` | off | Don't auto-launch the viewer on startup (press `v` to launch it) |
38
- | `--no-cache` | off | Disable the network proxy cache (always fetch upstream) |
122
+ | `-v, --verbose` | off | Log every CDP event and handled error (implies `--debug`) |
123
+ | `--no-viewer` | — | Don't auto-launch the viewer on startup (press `v` to launch it) |
124
+ | `--no-cache` | — | Disable the network proxy cache (always fetch upstream) |
125
+
126
+ The viewer and the proxy cache are both on by default; the two `--no-*` flags turn them off.
127
+
128
+ ### `appbuilder encrypt`
129
+
130
+ Encrypts a secret against a plugin's encryption keys and prints the envelope you paste into a `kizen.json` secret value:
131
+
132
+ ```json
133
+ { "encrypted": true, "value": "<base64>" }
134
+ ```
135
+
136
+ The command talks to the Plugin Wizard host directly — `appbuilder dev` does **not** need to be running.
137
+
138
+ | Flag | Default | Purpose |
139
+ | -------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
140
+ | `-c, --credentials <path>` | global credentials | Path to a credentials JSON file |
141
+ | `-a, --api-name <name>` | `api_name` from `kizen.json` in the cwd | Plugin the secret belongs to |
142
+ | `-v, --value <value>` | — | Plaintext secret. Prefer piping on stdin — a flag value is visible in `ps`. |
143
+ | `-s, --stage <dev\|prod>` | `prod` | Which encryption API to use. Defaulting is announced on stderr. |
144
+ | `--remote` | off (encrypt locally) | Have the wizard's `/encrypt` endpoint do the crypto with the keypair it holds, instead of fetching the public key and encrypting in-process. |
145
+ | `-o, --out <path>` | — | Also write the envelope to a file as pretty JSON |
146
+
147
+ Interactive by default. When either stdin or stdout is not a TTY (CI, a redirect, a pipe) it switches to a headless flow: everything must come from flags, the secret may be piped in, and the compact single-line envelope goes to stdout with all diagnostics on stderr.
148
+
149
+ ```sh
150
+ printf %s "$SECRET" | appbuilder encrypt -a my_plugin -s prod > secret.json
151
+ ```
152
+
153
+ A failed `--out` write is a non-fatal warning — stdout already carries the envelope — but sets a non-zero exit code.
39
154
 
40
- On first run you'll be prompted to set up credentials — either stored globally at `~/.kizenappbuilder/` or kept locally in your browser instance in `.kizenapp/`. Subsequent runs read from the stored profile silently. Press `c` in the TUI at any time to switch profiles.
155
+ ### `appbuilder report`
41
156
 
42
- Supported environments: `go`, `fmo`, `staging`, `integration`, `test1`.
157
+ Generates a self-contained, browsable report of the plugin in the current directory: the `kizen.json` config, a file tree, and every source file. Two files are written — an HTML report and a Markdown one (same path with a `.md` extension), the latter being useful as LLM context.
43
158
 
44
- ## Navigation context
159
+ | Flag | Default | Purpose |
160
+ | --------------------- | --------------------------------------------- | ---------------- |
161
+ | `-o, --output <path>` | `~/.kizenappbuilder/examples/<api_name>.html` | Output file path |
162
+
163
+ `developer_business_id` is stripped and every service's `auth_credentials` is redacted before rendering, so a report is safe to share.
164
+
165
+ ### `appbuilder icons`
166
+
167
+ Prints every valid icon name accepted by toolbar items, pages, and adornments, one per line. No flags — pipe it to a pager or grep it.
168
+
169
+ ```sh
170
+ appbuilder icons | grep calendar
171
+ ```
172
+
173
+ ## Reference
174
+
175
+ ### Environment variables
176
+
177
+ The CLI reads four environment variables, all of which point it at a different Plugin Wizard (encryption API) host. Precedence for the `dev` target:
178
+
179
+ 1. **`PLUGIN_WIZARD_URL`** — forces a single host for **all** targets, dev and prod alike.
180
+ 2. **`PLUGIN_WIZARD_URL_DEV`** — explicit dev host.
181
+ 3. **`APPBUILDER_LOCAL_DEV`** — any non-empty value routes the dev target to `http://localhost:9823`.
182
+ 4. Default: `https://plugin-wizard.kizen.dev`.
183
+
184
+ Prod follows the same order minus step 3: `PLUGIN_WIZARD_URL`, then **`PLUGIN_WIZARD_URL_PROD`**, then the default `https://plugin-wizard.kizen.com`. An empty-string value is treated as unset at every level.
185
+
186
+ ### The `.kizenapp/` directory
187
+
188
+ `build` and `dev` create `.kizenapp/` next to your `kizen.json` and add it to `.gitignore` automatically. It holds machine-local state only — **keep it gitignored**:
189
+
190
+ | Path | Contents |
191
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
192
+ | `bundle.json` | The packaged, minified, validated plugin bundle the viewer loads. |
193
+ | `config.json` | Per-project preferences: credential mode, active profile name, last viewed path, encryption target. |
194
+ | `.chrome/` | The dedicated Chromium user-data directory for the viewer — cookies and session state included. |
195
+ | `venv/` | The Python virtualenv used to execute code steps locally. Rebuilt when its interpreter is too old for the bundled requirements. |
196
+
197
+ ### Navigation context
45
198
 
46
199
  Plugin scripts can attach a JSON context payload to an in-app navigation:
47
200
 
@@ -66,6 +219,10 @@ How the two navigation targets behave:
66
219
 
67
220
  **Error surfacing:** if `sessionStorage` writes fail (e.g. quota exceeded, storage disabled), the engine navigates without context and reports a message through the same `onError` path every script artifact already uses — it shows in that artifact's result UI and the DevTools console, not as a separate log entry, because on failure the URL carries no key for the harness to detect. Note also that context is serialized with `JSON.stringify` inside the worker script: circular references and `BigInt` values throw there before any navigation happens, while functions, `undefined` values, and symbols are silently dropped.
68
221
 
222
+ ## Contributing
223
+
224
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for repository layout and build scripts.
225
+
69
226
  ## License
70
227
 
71
- GPL-3.0. See [LICENSE.md](./LICENSE.md).
228
+ GPL-3.0-only. See [LICENSE.md](./LICENSE.md).