scenri 0.8.3 → 0.9.0

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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.0](https://github.com/tonygorb/Scenri/compare/v0.8.3...v0.9.0) (2026-09-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * **cli:** a desktop icon that starts Scenri without a terminal ([35e8160](https://github.com/tonygorb/Scenri/commit/35e816086b3d2e10b32e454b4f40e93f4c95082a))
9
+ * **cli:** desktop status, install and quit routes for Settings ([c8478e1](https://github.com/tonygorb/Scenri/commit/c8478e1b2059ba40c85779469e97251c5669152b))
10
+ * **cli:** install, repair, remove and report the desktop launcher on macOS and Windows ([ee03601](https://github.com/tonygorb/Scenri/commit/ee036017dd5be738aff40b1adf2b04b7c45548fc))
11
+ * **cli:** launcher support paths, rotating logs, and adopting the running install into app/versions ([abde8cc](https://github.com/tonygorb/Scenri/commit/abde8cc23a0dd7eccb1e55d4aada1603108b68da))
12
+ * **cli:** offer the desktop icon once at a terminal, and keep an installed one current on every start ([5f56bb9](https://github.com/tonygorb/Scenri/commit/5f56bb9a45432df605c295b8893638cd75c0a2a0))
13
+ * **cli:** scenri desktop and the hidden open command, with a console-less supervisor ([fbe3fcf](https://github.com/tonygorb/Scenri/commit/fbe3fcf7ef16573448c22cd222c0cd6a37ca909c))
14
+ * **cli:** scenri open reuses a running Scenri or starts the supervisor detached and waits for it ([713e4f8](https://github.com/tonygorb/Scenri/commit/713e4f8f12014ceeff36bcea23718b2aac19ccec))
15
+ * **cli:** ship the desktop launcher's icons, an icns and an ico cut from the brand mark ([ef104e2](https://github.com/tonygorb/Scenri/commit/ef104e28654c31350dd103850a22dfa34f54b26e))
16
+ * **cli:** the frozen desktop bootstrap and the starting page ([151b2b9](https://github.com/tonygorb/Scenri/commit/151b2b92445a5f6b7602bedb4cc07c7131a85d61))
17
+ * **studio:** after Shut down the tab closes instead of showing a card ([42bdf89](https://github.com/tonygorb/Scenri/commit/42bdf896d9e6ed7a4cfc98e21b201372097e3c8c))
18
+ * **studio:** Desktop shortcut and Quit rows in About, and a verify hop before a build is adopted ([1587567](https://github.com/tonygorb/Scenri/commit/15875670bb5c3810437f19393440ecbffe51e68d))
19
+ * **studio:** Reuse setup is back under the record, beside Try again ([abe6b03](https://github.com/tonygorb/Scenri/commit/abe6b034490733701b6c990eb6688f0147dd81bc))
20
+ * **studio:** Reuse setup is back, and the shot sidebar and colour chips line up ([13345f2](https://github.com/tonygorb/Scenri/commit/13345f2a24d46cf3ae3f7c7d47ecd6c8a24a6665))
21
+ * **studio:** Shut down Scenri lives at the bottom of the brand menu, not in a Settings pane ([d21914b](https://github.com/tonygorb/Scenri/commit/d21914b9dd1b4e712120e1d1c42208e48f8833fa))
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **cli:** a browser that cannot be opened gets the address in a dialog instead of silence ([ef3d6a1](https://github.com/tonygorb/Scenri/commit/ef3d6a11a963611aa73ff025630bf55fc1a92fa5))
27
+ * **cli:** a double-click answers at once, and every click stops paying for node probing ([25685e7](https://github.com/tonygorb/Scenri/commit/25685e7b8087bb1f794b1b5d30cd1252b4ea9b32))
28
+ * **cli:** scenri open logs the sentence it shows, so support reads the log instead of the screen ([b52350c](https://github.com/tonygorb/Scenri/commit/b52350ce16cd67dc8a0f8931d3f7db71975ece07))
29
+ * **cli:** the boot refresh heals node-path and node-major against the record ([4d09985](https://github.com/tonygorb/Scenri/commit/4d09985accf05b9eacd238249a2c61c697710b07))
30
+ * **cli:** the rendered starting page is not a support file, so the boot refresh leaves it alone ([d3b1396](https://github.com/tonygorb/Scenri/commit/d3b13966b778c4c51a49922984f394ac9d0e146d))
31
+ * **cli:** the starting page carries the studio URL in a meta, because open(1) drops a file URL's fragment ([4fa6c68](https://github.com/tonygorb/Scenri/commit/4fa6c682d09c34de76ef00256fb1c0bdd8f84133))
32
+ * **cli:** when the recorded node is gone the icon prefers a node of the same major, and a native-module death says so ([aa1dba0](https://github.com/tonygorb/Scenri/commit/aa1dba06d0d48c2a6ff3c4adcc47409f31f69311))
33
+ * **studio:** a colour chip wears its colour as the thumbnail's circle, and its menu hugs the chip ([e5970c1](https://github.com/tonygorb/Scenri/commit/e5970c14116f9721e5596167b3e821bcd45908b3))
34
+ * **studio:** the lifecycle overlays cover a Settings dialog instead of hiding behind it ([1e89433](https://github.com/tonygorb/Scenri/commit/1e894337948f1feb4816a67584098e4658d63244))
35
+ * **studio:** the shot record clamps by rows, its release is a verb, and its colour chip is the thumbnail's circle ([20da7a1](https://github.com/tonygorb/Scenri/commit/20da7a154272004db5cd22e0185bc08452e0a132))
36
+ * **studio:** the shot sidebar's composer, hairlines and copy control share one inset ([d5c4a99](https://github.com/tonygorb/Scenri/commit/d5c4a99e9bcc1cc43fd8673547cfdb73923b0d8b))
37
+
3
38
  ## [0.8.3](https://github.com/tonygorb/Scenri/compare/v0.8.2...v0.8.3) (2026-09-06)
4
39
 
5
40
 
package/README.md CHANGED
@@ -65,6 +65,8 @@ npx scenri
65
65
 
66
66
  That is the whole install. npm asks once whether to proceed, downloads the current release, and opens `http://127.0.0.1:4747`. Keep the terminal window open while you work; closing it stops Scenri. Tomorrow the same command opens it again, with everything where you left it.
67
67
 
68
+ On macOS and Windows, Scenri then asks once whether to put a **Scenri icon on your desktop**. Say yes and from then on a double-click starts Scenri and opens it in your browser, no terminal needed; the icon works offline and keeps working across updates. Said no? Settings, then About, then **Add to desktop**, or `npx scenri desktop` in a terminal. Scenri stays what it is, a local server and your browser: the icon is a launcher, not an app.
69
+
68
70
  Generation runs on **Codex CLI**, an official helper from OpenAI that draws on your own ChatGPT plan. No API key to paste, and Scenri never charges you. Each image draws on your plan's Codex usage. You do not have to set it up by hand: if it is missing, Scenri offers to install it and to sign you in, both from the app. No ChatGPT plan? Add your own key from an image provider in Settings instead, see [Engines](#engines).
69
71
 
70
72
  Two dependencies (`better-sqlite3` and `sharp`) ship native binaries, so on recent npm you may be asked to approve their install scripts once. Something not starting? See [troubleshooting](https://github.com/tonygorb/scenri/blob/main/docs/INSTALL.md#troubleshooting).
@@ -0,0 +1,55 @@
1
+ import { readFileSync, mkdirSync, writeFileSync, renameSync, existsSync } from 'fs';
2
+ import { join } from 'path';
3
+
4
+ // src/desktop/paths.ts
5
+ var LAUNCHER_SCHEMA = 1;
6
+ var launcherDir = (homedir) => join(homedir, ".scenri", "launcher");
7
+ var logsDir = (home) => join(home, "logs");
8
+ var launcherRecordPath = (homedir) => join(launcherDir(homedir), "launcher.json");
9
+ function readLauncherRecord(homedir) {
10
+ try {
11
+ const raw = JSON.parse(readFileSync(launcherRecordPath(homedir), "utf8"));
12
+ if (typeof raw?.schema !== "number" || typeof raw.home !== "string" || typeof raw.nodePath !== "string" || typeof raw.artifact?.path !== "string") {
13
+ return null;
14
+ }
15
+ return raw;
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+ function writeLauncherRecord(homedir, record) {
21
+ const path = launcherRecordPath(homedir);
22
+ mkdirSync(launcherDir(homedir), { recursive: true });
23
+ const tmp = `${path}.tmp`;
24
+ writeFileSync(tmp, `${JSON.stringify(record, null, 2)}
25
+ `);
26
+ renameSync(tmp, path);
27
+ }
28
+ var REPLAYED = ["SCENRI_PORT", "SCENRI_HOST"];
29
+ function recordedEnv(env) {
30
+ const out = {};
31
+ for (const key of REPLAYED) if (env[key]) out[key] = env[key];
32
+ return out;
33
+ }
34
+ var KNOWN_FOLDER_DESKTOP = "[Environment]::GetFolderPath('Desktop')";
35
+ async function desktopDir(deps) {
36
+ if (deps.env.SCENRI_DESKTOP_DIR) return deps.env.SCENRI_DESKTOP_DIR;
37
+ if (deps.platform === "darwin") return join(deps.homedir, "Desktop");
38
+ if (deps.platform === "win32") {
39
+ const out = await deps.runImpl("powershell.exe", [
40
+ "-NoProfile",
41
+ "-NonInteractive",
42
+ "-Command",
43
+ KNOWN_FOLDER_DESKTOP
44
+ ]);
45
+ const dir = out.trim();
46
+ return dir || null;
47
+ }
48
+ return null;
49
+ }
50
+ var isSupportedPlatform = (platform) => platform === "darwin" || platform === "win32";
51
+ var launcherInstalled = (homedir) => existsSync(launcherRecordPath(homedir));
52
+
53
+ export { LAUNCHER_SCHEMA, desktopDir, isSupportedPlatform, launcherDir, launcherInstalled, launcherRecordPath, logsDir, readLauncherRecord, recordedEnv, writeLauncherRecord };
54
+ //# sourceMappingURL=chunk-4NQKRVO2.js.map
55
+ //# sourceMappingURL=chunk-4NQKRVO2.js.map
@@ -0,0 +1,246 @@
1
+ import { isSupportedPlatform, desktopDir, launcherDir, LAUNCHER_SCHEMA, writeLauncherRecord, recordedEnv, readLauncherRecord } from './chunk-4NQKRVO2.js';
2
+ import { existsSync, rmSync, mkdirSync, writeFileSync, chmodSync, copyFileSync, renameSync, utimesSync } from 'fs';
3
+ import { join, dirname } from 'path';
4
+
5
+ var MAC_BUNDLE_ID = "co.scenri.desktop-launcher";
6
+ var MAC_MARKER = "scenri-launcher.json";
7
+ var MAC_SCRIPT = `#!/bin/sh
8
+ # Scenri desktop launcher. Written by Scenri; deleting it removes only this icon.
9
+ L="$HOME/.scenri/launcher"
10
+ say() {
11
+ if [ "$SCENRI_NO_DIALOG" = "1" ]; then return 0; fi
12
+ /usr/bin/osascript -e 'on run argv' \\
13
+ -e 'display dialog (item 1 of argv) with title "Scenri" buttons {"OK"} default button 1 with icon stop' \\
14
+ -e 'end run' -- "$1"
15
+ }
16
+ if [ ! -f "$L/launch.mjs" ]; then
17
+ say "Scenri's launcher files are missing. Open Terminal and run: npx scenri desktop"
18
+ exit 1
19
+ fi
20
+ # The node that installed the icon, while it still exists: no probing, no delay.
21
+ NODE=""
22
+ if [ -r "$L/node-path" ]; then IFS= read -r NODE < "$L/node-path" || NODE=""; fi
23
+ if [ -z "$NODE" ] || [ ! -x "$NODE" ]; then
24
+ MAJOR=""
25
+ if [ -r "$L/node-major" ]; then IFS= read -r MAJOR < "$L/node-major" || MAJOR=""; fi
26
+ # Native modules were built for that node's major and another major refuses
27
+ # them: every candidate once demanding the same major, then once taking any.
28
+ candidates() {
29
+ command -v node 2>/dev/null || true
30
+ echo /opt/homebrew/bin/node
31
+ echo /usr/local/bin/node
32
+ echo "$HOME/.volta/bin/node"
33
+ echo "$HOME/.local/share/fnm/aliases/default/bin/node"
34
+ echo "$HOME/Library/Application Support/fnm/aliases/default/bin/node"
35
+ for c in "$HOME"/.nvm/versions/node/*/bin/node; do echo "$c"; done
36
+ }
37
+ pick() {
38
+ want="$1"
39
+ candidates | while IFS= read -r c; do
40
+ [ -n "$c" ] && [ -x "$c" ] || continue
41
+ if [ -n "$want" ]; then
42
+ v="$("$c" -p 'process.versions.node.split(".")[0]' 2>/dev/null)" || continue
43
+ [ "$v" = "$want" ] || continue
44
+ fi
45
+ echo "$c"
46
+ done | tail -n 1
47
+ }
48
+ NODE=""
49
+ if [ -n "$MAJOR" ]; then NODE="$(pick "$MAJOR")"; fi
50
+ if [ -z "$NODE" ]; then NODE="$(pick "")"; fi
51
+ fi
52
+ if [ -z "$NODE" ] || [ ! -x "$NODE" ]; then
53
+ say "Scenri needs Node.js, and none was found on this Mac. Install it from nodejs.org, then open Terminal and run: npx scenri"
54
+ exit 1
55
+ fi
56
+ exec "$NODE" "$L/launch.mjs"
57
+ `;
58
+ function macPlist(opts) {
59
+ return `<?xml version="1.0" encoding="UTF-8"?>
60
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
61
+ <plist version="1.0">
62
+ <dict>
63
+ <key>CFBundleDevelopmentRegion</key>
64
+ <string>en</string>
65
+ <key>CFBundleDisplayName</key>
66
+ <string>Scenri</string>
67
+ <key>CFBundleExecutable</key>
68
+ <string>Scenri</string>
69
+ <key>CFBundleIconFile</key>
70
+ <string>Scenri.icns</string>
71
+ <key>CFBundleIdentifier</key>
72
+ <string>${MAC_BUNDLE_ID}</string>
73
+ <key>CFBundleInfoDictionaryVersion</key>
74
+ <string>6.0</string>
75
+ <key>CFBundleName</key>
76
+ <string>Scenri</string>
77
+ <key>CFBundlePackageType</key>
78
+ <string>APPL</string>
79
+ <key>CFBundleShortVersionString</key>
80
+ <string>${opts.version}</string>
81
+ <key>CFBundleVersion</key>
82
+ <string>${opts.schema}</string>
83
+ <key>LSMinimumSystemVersion</key>
84
+ <string>12.0</string>
85
+ <key>NSHighResolutionCapable</key>
86
+ <true/>
87
+ </dict>
88
+ </plist>
89
+ `;
90
+ }
91
+ var isOurMacBundle = (bundle) => existsSync(join(bundle, "Contents", "Resources", MAC_MARKER));
92
+ function writeMacBundle(opts) {
93
+ const tmp = `${opts.path}.tmp-${process.pid}`;
94
+ rmSync(tmp, { recursive: true, force: true });
95
+ const contents = join(tmp, "Contents");
96
+ mkdirSync(join(contents, "MacOS"), { recursive: true });
97
+ mkdirSync(join(contents, "Resources"), { recursive: true });
98
+ writeFileSync(join(contents, "Info.plist"), macPlist(opts));
99
+ writeFileSync(join(contents, "PkgInfo"), "APPL????");
100
+ const script = join(contents, "MacOS", "Scenri");
101
+ writeFileSync(script, MAC_SCRIPT);
102
+ chmodSync(script, 493);
103
+ copyFileSync(opts.icns, join(contents, "Resources", "Scenri.icns"));
104
+ writeFileSync(
105
+ join(contents, "Resources", MAC_MARKER),
106
+ `${JSON.stringify({ scenri: "desktop-launcher", schema: opts.schema, version: opts.version }, null, 2)}
107
+ `
108
+ );
109
+ rmSync(opts.path, { recursive: true, force: true });
110
+ mkdirSync(dirname(opts.path), { recursive: true });
111
+ renameSync(tmp, opts.path);
112
+ const now = /* @__PURE__ */ new Date();
113
+ utimesSync(opts.path, now, now);
114
+ }
115
+
116
+ // src/desktop/windows.ts
117
+ var POWERSHELL = "powershell.exe";
118
+ var POWERSHELL_ARGS = ["-NoProfile", "-NonInteractive", "-Command"];
119
+ var CREATE_LNK_COMMAND = "$s = New-Object -ComObject WScript.Shell; $l = $s.CreateShortcut($env:SCENRI_LNK); $l.TargetPath = $env:SCENRI_TARGET; $l.Arguments = $env:SCENRI_ARGS; $l.WorkingDirectory = $env:SCENRI_WORKDIR; $l.IconLocation = $env:SCENRI_ICON; $l.Description = 'Open Scenri'; $l.WindowStyle = 7; $l.Save()";
120
+ var READ_LNK_COMMAND = "$s = New-Object -ComObject WScript.Shell; $l = $s.CreateShortcut($env:SCENRI_LNK); Write-Output $l.TargetPath; Write-Output $l.Arguments";
121
+ async function readLnk(runImpl, path) {
122
+ const out = await runImpl(POWERSHELL, [...POWERSHELL_ARGS, READ_LNK_COMMAND], { env: { SCENRI_LNK: path } });
123
+ const [target = "", args = ""] = out.split(/\r?\n/);
124
+ return { target: target.trim(), args: args.trim() };
125
+ }
126
+ async function isOurLnk(runImpl, path, bootstrap) {
127
+ try {
128
+ const { args } = await readLnk(runImpl, path);
129
+ return args.toLowerCase().includes(bootstrap.toLowerCase());
130
+ } catch {
131
+ return false;
132
+ }
133
+ }
134
+ async function writeLnk(runImpl, opts) {
135
+ await runImpl(POWERSHELL, [...POWERSHELL_ARGS, CREATE_LNK_COMMAND], {
136
+ env: {
137
+ SCENRI_LNK: opts.path,
138
+ SCENRI_TARGET: opts.target,
139
+ SCENRI_ARGS: opts.args,
140
+ SCENRI_WORKDIR: opts.workdir,
141
+ SCENRI_ICON: opts.icon
142
+ }
143
+ });
144
+ }
145
+
146
+ // src/desktop/install.ts
147
+ var UNSUPPORTED = "Desktop shortcuts are not available on this system yet.";
148
+ var NO_DESKTOP = "Your Desktop folder could not be found.";
149
+ var COLLISION = "Something else named Scenri is already on your desktop. Move or rename it, then try again.";
150
+ var DENIED = "macOS did not allow writing to your Desktop. Allow it under System Settings > Privacy & Security > Files and Folders, then try again.";
151
+ var SUPPORT_FILES = ["launch.mjs", "Scenri.icns", "scenri.ico"];
152
+ async function installDesktop(deps) {
153
+ if (!isSupportedPlatform(deps.platform)) return { ok: false, reason: "unsupported", message: UNSUPPORTED };
154
+ const desktop = await desktopDir(deps);
155
+ if (!desktop) return { ok: false, reason: "no-desktop", message: NO_DESKTOP };
156
+ const darwin = deps.platform === "darwin";
157
+ const support = launcherDir(deps.homedir);
158
+ const bootstrap = join(support, "launch.mjs");
159
+ const kind = darwin ? "macos-app" : "windows-lnk";
160
+ const artifact = join(desktop, darwin ? "Scenri.app" : "Scenri.lnk");
161
+ if (existsSync(artifact)) {
162
+ const ours = darwin ? isOurMacBundle(artifact) : await isOurLnk(deps.runImpl, artifact, bootstrap);
163
+ if (!ours) return { ok: false, reason: "collision", message: COLLISION };
164
+ }
165
+ const nodeMajor = runningNodeMajor();
166
+ writeSupportFiles({ ...deps, nodeMajor }, support);
167
+ try {
168
+ if (darwin) {
169
+ writeMacBundle({
170
+ path: artifact,
171
+ icns: join(support, "Scenri.icns"),
172
+ version: deps.version,
173
+ schema: LAUNCHER_SCHEMA
174
+ });
175
+ } else {
176
+ await writeLnk(deps.runImpl, {
177
+ path: artifact,
178
+ target: deps.execPath,
179
+ args: `"${bootstrap}"`,
180
+ workdir: support,
181
+ icon: `${join(support, "scenri.ico")},0`
182
+ });
183
+ }
184
+ } catch (err) {
185
+ const code = err.code;
186
+ if (darwin && (code === "EPERM" || code === "EACCES"))
187
+ return { ok: false, reason: "desktop-denied", message: DENIED };
188
+ const detail = err instanceof Error ? err.message.split("\n")[0] : String(err);
189
+ return { ok: false, reason: "failed", message: `Scenri could not write ${artifact} (${detail}).` };
190
+ }
191
+ writeLauncherRecord(deps.homedir, {
192
+ schema: LAUNCHER_SCHEMA,
193
+ createdBy: deps.version,
194
+ home: deps.home,
195
+ nodePath: deps.execPath,
196
+ nodeMajor,
197
+ env: recordedEnv(deps.env),
198
+ artifact: { kind, path: artifact }
199
+ });
200
+ return { ok: true, kind, path: artifact };
201
+ }
202
+ var runningNodeMajor = () => Number(process.versions.node.split(".")[0]);
203
+ function writeSupportFiles(deps, support) {
204
+ mkdirSync(support, { recursive: true });
205
+ for (const f of SUPPORT_FILES) copyFileSync(join(deps.assetsDir, f), join(support, f));
206
+ if (deps.platform === "darwin") {
207
+ writeFileSync(join(support, "node-path"), `${deps.execPath}
208
+ `);
209
+ writeFileSync(join(support, "node-major"), `${deps.nodeMajor}
210
+ `);
211
+ }
212
+ }
213
+ async function removeDesktop(deps) {
214
+ const record = readLauncherRecord(deps.homedir);
215
+ const support = launcherDir(deps.homedir);
216
+ let removed = false;
217
+ let message;
218
+ const path = record?.artifact.path;
219
+ if (path && existsSync(path)) {
220
+ const ours = record.artifact.kind === "macos-app" ? isOurMacBundle(path) : await isOurLnk(deps.runImpl, path, join(support, "launch.mjs"));
221
+ if (ours) {
222
+ rmSync(path, { recursive: true, force: true });
223
+ removed = true;
224
+ } else {
225
+ message = `${path} is not the launcher Scenri made, so it was left alone.`;
226
+ }
227
+ }
228
+ rmSync(support, { recursive: true, force: true });
229
+ return { removed, path, message };
230
+ }
231
+ async function desktopStatus(deps) {
232
+ const supported = isSupportedPlatform(deps.platform);
233
+ const record = readLauncherRecord(deps.homedir);
234
+ let installed = false;
235
+ let path = null;
236
+ if (supported && record && existsSync(record.artifact.path)) {
237
+ installed = record.artifact.kind === "macos-app" ? isOurMacBundle(record.artifact.path) : true;
238
+ path = installed ? record.artifact.path : null;
239
+ }
240
+ const current = installed && record !== null && record.schema === LAUNCHER_SCHEMA && (existsSync(record.nodePath) || record.nodePath === deps.execPath);
241
+ return { supported, platform: deps.platform, installed, path, current, record };
242
+ }
243
+
244
+ export { MAC_SCRIPT, POWERSHELL, POWERSHELL_ARGS, UNSUPPORTED, desktopStatus, installDesktop, isOurMacBundle, macPlist, removeDesktop, runningNodeMajor, writeLnk, writeMacBundle, writeSupportFiles };
245
+ //# sourceMappingURL=chunk-HLMR33DT.js.map
246
+ //# sourceMappingURL=chunk-HLMR33DT.js.map