@zaflun/lumio-cli 0.10.0 → 0.10.8

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/CHANGELOG.md ADDED
@@ -0,0 +1,190 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@zaflun/lumio-cli` are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 0.10.8
9
+
10
+ ### Added
11
+
12
+ - **`CHANGELOG.md` ships in the package.**
13
+
14
+ ### Changed
15
+
16
+ - **`lumio deploy --system` requires a changelog entry** — a system
17
+ extension deploy fails when `CHANGELOG.md` has no non-empty
18
+ `## [x.y.z]` section for the deployed version, in CI too, and `-d` does not
19
+ replace the entry. Third-party deploys keep their rule: a missing entry
20
+ stops the deploy only outside CI.
21
+ - **`lumio dev` targets protocol 0.10.0** — the CLI warns when the project's
22
+ `@zaflun/lumio-sdk` or `@zaflun/lumio-devkit` speaks an older protocol, so
23
+ the Shopify event types (`shopify:order`, `shopify:order_paid`,
24
+ `shopify:product`) are not missing from the sandbox and `lumio trigger`.
25
+ - **The sandbox preview follows the dashboard's URL rule** — images and links
26
+ in the extension UI load only from the sandbox page itself and the hosts in
27
+ `egress.allowHosts` of `lumio.config.json`. Anything else is dropped, as it
28
+ is on the dashboard.
29
+ - **`lumio init` scaffolds React 19.3** — new projects get `react` and
30
+ `@types/react` `^19.3.0`, matching the SDK's renderer.
31
+ - **Sandbox stylesheet rebuilt with Tailwind CSS 4.3.4.**
32
+ - **Dependencies** — `inquirer` 14.2.5, `ora` 10 and `eventsource` 5.
33
+
34
+ ### Fixed
35
+
36
+ - **`lumio deploy` from Windows** — bundle file paths are uploaded with `/`
37
+ separators instead of `\`, so the uploaded files are served under the
38
+ paths the extension references.
39
+ - **`lumio logs` sends the token again** — the log stream authenticates with
40
+ the stored token through `eventsource` 5's `fetch` hook.
41
+
42
+ ## 0.10.0
43
+
44
+ ### Added
45
+
46
+ - **A real `lumio dev`** — one session that builds the project with esbuild
47
+ in watch mode (the same pipeline as `lumio build`), serves a sandbox page on
48
+ `127.0.0.1:3100` and opens a REPL. The sandbox renders the editor and layer
49
+ surfaces and has panels for chat, events, channel point rewards, music,
50
+ scenarios, server functions, extension data and the log. Bot modules run
51
+ their chat, event, reward and timer handlers in the same session; the old
52
+ chat simulator is gone. New flags: `--platform`, `--role`, `--seed`,
53
+ `--no-cooldown`, `--view <target>` and `--open`; `--bot-module` now only
54
+ opens the chat first. Needs `@zaflun/lumio-devkit` in the project.
55
+ - **`lumio trigger`** — sends an event, chat message, reward, music command,
56
+ timer, storage write or scenario to the running `lumio dev` from a second
57
+ terminal (`--field a.b=v`, `--tier`, `--data`, `--file`,
58
+ `--user` / `--role` / `--platform`, `--timer`, `--storage`). Load flags
59
+ `--count N`, `--rate 5/s` and `--random` send many at once.
60
+ - **`dist/functions.json`** — `lumio build` writes a manifest of the named
61
+ functions in `server/functions.ts`, and bundles handler functions
62
+ (`query()` / `mutation()` / `action()`) into `dist/server.js`. Bot modules
63
+ can expose server functions too. `lumio deploy` refuses to upload when
64
+ `server/functions.ts` exists but the manifest was not built.
65
+ - **Data schema upload** — `lumio deploy` sends `server/schema.ts` with the
66
+ version as its data schema (tables are provisioned on approval) and lists
67
+ schema errors the API rejects line by line.
68
+ - **`lumio init` adds `@zaflun/lumio-devkit`** to new projects (except
69
+ automation nodes).
70
+
71
+ ### Changed
72
+
73
+ - **The `interactive` target is gone** — `lumio.config.json` accepts only
74
+ `editor`, `layer` and `designer` and rejects any other target. Viewer input
75
+ comes through chat commands and channel point rewards handled by a bot
76
+ module. Breaking.
77
+ - **`lumio env set`** stores a secret with `PUT …/secrets/{key}` and checks
78
+ the API's rules first: the key matches `^[A-Z0-9_]{1,64}$`, the value is
79
+ 1 to 4096 bytes.
80
+ - **Developer links** point to `/dashboard/settings/developer` (application)
81
+ and `/dashboard/settings/developer/limits` (limit increases).
82
+ - **The `server/functions.ts` scaffold** orders `getItems` by `created_at`.
83
+
84
+ ## 0.6.2
85
+
86
+ ### Added
87
+
88
+ - **Developer keys** — `lumio login --token` and `lumio deploy --token`
89
+ accept a developer key (`lm_dev_*`), the key to use for publishing. Without
90
+ `--token`, `lumio login` reads `LUMIO_TOKEN`.
91
+ - **`lumio login` options** — `--id-url` and `--port` for the browser flow.
92
+ - **Server bundle** — `lumio build` compiles `server/handler.ts` (or
93
+ `server/index.ts`) to `dist/server.js` for extensions with `"server": true`.
94
+ - **Sound limit pre-flight** — `lumio deploy` checks the number, per-file size
95
+ and total size of declared sounds against your developer limits before it
96
+ uploads.
97
+ - **`lumio env set <KEY> [VALUE]`** — without a value it reads `LUMIO_SECRET`
98
+ or prompts with hidden input, so the secret stays out of shell history.
99
+
100
+ ### Changed
101
+
102
+ - **Browser login uses the ID app** — `lumio login` opens the Lumio login page
103
+ and exchanges the code at `/v1/auth/token/exchange`; it stores the session
104
+ and its refresh token. The callback server listens on `127.0.0.1` only and
105
+ exits as soon as the login finishes.
106
+ - **Stricter config validation** — `extensionId` may contain only letters,
107
+ digits, `-` and `_` (max 64); bot-module platforms, automation `nodeType`
108
+ and `node.triggerMode` are checked against the shared lists.
109
+ - **`lumio build` fails when Tailwind CSS fails** instead of shipping without
110
+ styles, and uses the project's own `@tailwindcss/cli` instead of `npx`.
111
+ - **The source archive leaves out secrets** — `.env` files (except
112
+ `.env.example`), `.npmrc`, `.yarnrc` and `.lumio/`.
113
+ - **Trovo is no longer a platform** — `lumio init` no longer offers it and the
114
+ config validator rejects it.
115
+ - **`lumio --version`** prints the package version.
116
+ - **Node.js 22.13 or newer is required.** Breaking.
117
+ - **Dependencies** — `archiver` 8, `chalk` 6, `commander` 15, `esbuild` 0.28,
118
+ `eventsource` 4, `inquirer` 14, `open` 11.
119
+
120
+ ### Fixed
121
+
122
+ - **`lumio deploy` error hints** — the HTTP status reaches the deploy command
123
+ again, so 409 / 413 / 401 failures print their guidance.
124
+ - **`lumio run`** reports malformed JSON arguments instead of crashing.
125
+ - **The credentials directory** is created readable by its owner only.
126
+
127
+ ## 0.5.2
128
+
129
+ ### Added
130
+
131
+ - **Automation nodes** — `lumio init` scaffolds an `automation_node`
132
+ (action, trigger with webhook / polling, or logic), and `lumio dev` starts an
133
+ automation node simulator for it (`--automation-node`).
134
+ - **`lumio init` wizard options** — editor approach (config schema, custom
135
+ `editor.tsx` or both), an optional visual designer for widgets and overlays,
136
+ and the styling (Tailwind CSS v4, plain CSS or inline). `lumio init` checks
137
+ for a developer profile first.
138
+ - **CSS and assets in `lumio build`** — compiles `src/globals.css` (or
139
+ `style.css` / `index.css`) with Tailwind CSS v4 or copies it to
140
+ `dist/styles.css`, and emits imported images, media and fonts to
141
+ `dist/assets/`.
142
+ - **`lumio deploy` options** — `--token` for CI and `--system` for system
143
+ extensions; `LUMIO_API_URL` overrides the API URL.
144
+ - **Sound checks** — `lumio deploy` validates the sounds declared in
145
+ `lumio.config.json` (format, presence in `dist/sounds/`, size warning).
146
+
147
+ ### Changed
148
+
149
+ - **`lumio deploy` uploads every file of `dist/`** individually (allowed
150
+ types only; max 200 files, 10 MB per file, 50 MB in total) instead of a
151
+ single bundle, and prints actionable hints for 409, 413 and 401 / 403.
152
+ - **UI targets build as IIFE** with React and the SDK as runtime externals.
153
+ - **The source archive** contains the whole project, minus `node_modules`,
154
+ `dist` and `.git`.
155
+
156
+ ## 0.3.0
157
+
158
+ ### Added
159
+
160
+ - **Bot modules** — `lumio init` scaffolds a `bot_module` with platforms, a
161
+ `hello` command and `chat:read` / `chat:send`; `lumio dev` opens a chat
162
+ simulator for it (`--bot-module`); `lumio build` packs its `server/`.
163
+ - **Bot handler types in `lumio run`** — `command`, `keyword`, `pattern`,
164
+ `event`, `timer` and `moderate`, with `--user`, `--role`, `--message` and
165
+ `--platform` for the mock chat user.
166
+ - **`platforms` and `triggers`** in `lumio.config.json`; bot modules need at
167
+ least one platform.
168
+
169
+ ## 0.2.0
170
+
171
+ ### Added
172
+
173
+ - **Browser login with PKCE** — `lumio login` without `--token` opens the
174
+ browser and waits for the callback on a local port.
175
+
176
+ ### Changed
177
+
178
+ - **`lumio deploy`** writes the deployed version into the uploaded manifest.
179
+ - **`lumio init`** points `$schema` at
180
+ `https://lumio.vision/schemas/lumio.config.schema.json`.
181
+
182
+ ## 0.1.0
183
+
184
+ Initial release.
185
+
186
+ ### Added
187
+
188
+ - **The `lumio` CLI** — `login`, `logout`, `whoami`, `init`, `dev`, `build`,
189
+ `deploy`, `status`, `logs`, `env`, `run` and `dashboard` for building,
190
+ testing and publishing Lumio extensions.
package/dist/index.js CHANGED
@@ -591,13 +591,13 @@ function registerInit(program2) {
591
591
  },
592
592
  dependencies: {
593
593
  "@zaflun/lumio-sdk": "latest",
594
- ...needsReact ? { "react": "^19.2.5" } : {}
594
+ ...needsReact ? { "react": "^19.3.0" } : {}
595
595
  },
596
596
  devDependencies: {
597
597
  "typescript": "^6.0.3",
598
598
  // `lumio dev` runs the extension on the devkit's mock host.
599
599
  ...!isAutomationNode ? { "@zaflun/lumio-devkit": "latest" } : {},
600
- ...needsReact ? { "@types/react": "^19.1.0" } : {},
600
+ ...needsReact ? { "@types/react": "^19.3.0" } : {},
601
601
  ...useTailwind ? { "tailwindcss": "^4.3.0" } : {}
602
602
  }
603
603
  };
@@ -1655,7 +1655,7 @@ function compareVersions(a, b) {
1655
1655
  }
1656
1656
 
1657
1657
  // src/dev/version.ts
1658
- var CLI_PROTOCOL_VERSION = "0.9.0";
1658
+ var CLI_PROTOCOL_VERSION = "0.10.0";
1659
1659
 
1660
1660
  // src/dev/project-modules.ts
1661
1661
  var MissingPackageError = class extends Error {
@@ -2607,6 +2607,7 @@ var DevSession = class {
2607
2607
  mounted: h.mounted,
2608
2608
  mountError: this.mountError,
2609
2609
  tree: h.tree,
2610
+ egressHosts: egressHosts(cfg),
2610
2611
  themeMode: this.themeMode,
2611
2612
  cssVersion: this.cssVersion,
2612
2613
  build: this.buildStatus,
@@ -2989,6 +2990,10 @@ function describe(cmd) {
2989
2990
  return `/${cmd.kind}`;
2990
2991
  }
2991
2992
  }
2993
+ function egressHosts(cfg) {
2994
+ const egress = cfg.egress;
2995
+ return Array.isArray(egress?.allowHosts) ? egress.allowHosts.filter((h) => typeof h === "string") : [];
2996
+ }
2992
2997
 
2993
2998
  // src/dev/server.ts
2994
2999
  import * as fs8 from "fs";
@@ -3878,6 +3883,33 @@ function getVersionEntry(changelog, version) {
3878
3883
  return entries.find((e) => e.version === version) ?? null;
3879
3884
  }
3880
3885
 
3886
+ // src/changelog/release-notes.ts
3887
+ function resolveReleaseNotes(input) {
3888
+ const { changelog, version, description, system, ci } = input;
3889
+ const entry = changelog === null ? null : getVersionEntry(changelog, version);
3890
+ if (system && !entry?.content) {
3891
+ return {
3892
+ ok: false,
3893
+ error: [
3894
+ `No CHANGELOG.md entry found for version ${version}.`,
3895
+ `System extensions must document every deployed version: add a "## [${version}] - YYYY-MM-DD" section to CHANGELOG.md.`
3896
+ ]
3897
+ };
3898
+ }
3899
+ if (description) return { ok: true, notes: description };
3900
+ if (entry) return { ok: true, notes: entry.content };
3901
+ if (changelog !== null && !ci) {
3902
+ return {
3903
+ ok: false,
3904
+ error: [
3905
+ `No changelog entry found for version ${version}.`,
3906
+ "Add an entry to CHANGELOG.md or use -d to provide release notes."
3907
+ ]
3908
+ };
3909
+ }
3910
+ return { ok: true, notes: "" };
3911
+ }
3912
+
3881
3913
  // src/commands/deploy.ts
3882
3914
  function collectFiles(dir, base = dir) {
3883
3915
  const entries = fs12.readdirSync(dir, { withFileTypes: true });
@@ -3887,7 +3919,7 @@ function collectFiles(dir, base = dir) {
3887
3919
  if (entry.isDirectory()) {
3888
3920
  files.push(...collectFiles(fullPath, base));
3889
3921
  } else if (entry.isFile()) {
3890
- files.push(path13.relative(base, fullPath));
3922
+ files.push(path13.relative(base, fullPath).split(path13.sep).join("/"));
3891
3923
  }
3892
3924
  }
3893
3925
  return files;
@@ -4029,21 +4061,19 @@ function registerDeploy(program2) {
4029
4061
  }
4030
4062
  }
4031
4063
  const version = options.version ?? config.version;
4032
- let releaseNotes = options.description ?? "";
4033
- if (!releaseNotes) {
4034
- const changelogPath = path13.resolve("CHANGELOG.md");
4035
- if (fs12.existsSync(changelogPath)) {
4036
- const changelog = fs12.readFileSync(changelogPath, "utf-8");
4037
- const entry = getVersionEntry(changelog, version);
4038
- if (entry) {
4039
- releaseNotes = entry.content;
4040
- } else if (!LumioApiClient.isCI() && !options.system) {
4041
- console.error(`No changelog entry found for version ${version}.`);
4042
- console.error("Add an entry to CHANGELOG.md or use -d to provide release notes.");
4043
- process.exit(1);
4044
- }
4045
- }
4064
+ const changelogPath = path13.resolve("CHANGELOG.md");
4065
+ const notes = resolveReleaseNotes({
4066
+ changelog: fs12.existsSync(changelogPath) ? fs12.readFileSync(changelogPath, "utf-8") : null,
4067
+ version,
4068
+ description: options.description,
4069
+ system: !!options.system,
4070
+ ci: LumioApiClient.isCI()
4071
+ });
4072
+ if (!notes.ok) {
4073
+ for (const line of notes.error) console.error(line);
4074
+ process.exit(1);
4046
4075
  }
4076
+ const releaseNotes = notes.notes;
4047
4077
  let dataSchema;
4048
4078
  try {
4049
4079
  dataSchema = await loadDataSchema(process.cwd());
@@ -4223,10 +4253,12 @@ function registerLogs(program2) {
4223
4253
  console.log(`Streaming logs for ${config.name}...`);
4224
4254
  console.log("Press Ctrl+C to stop.\n");
4225
4255
  try {
4226
- const eventsource = await import("eventsource");
4227
- const EventSource = "default" in eventsource ? eventsource.default : eventsource;
4256
+ const { EventSource } = await import("eventsource");
4228
4257
  const es = new EventSource(logsUrl, {
4229
- headers: { "Authorization": `Bearer ${token}` }
4258
+ fetch: (input, init) => fetch(input, {
4259
+ ...init,
4260
+ headers: { ...init.headers, Authorization: `Bearer ${token}` }
4261
+ })
4230
4262
  });
4231
4263
  es.onmessage = (event) => {
4232
4264
  try {