create-opentray 0.21.0 → 0.22.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.
Files changed (46) hide show
  1. package/README.md +28 -6
  2. package/dist/avif-DCXcyYJR.mjs +2 -0
  3. package/dist/bin-Dyfucd3C.mjs +20810 -0
  4. package/dist/bin-Dyfucd3C.mjs.map +1 -0
  5. package/dist/bin.mjs +1 -1
  6. package/dist/decode-C4b5NXc_.mjs +1236 -0
  7. package/dist/decode-C4b5NXc_.mjs.map +1 -0
  8. package/dist/decode-Dsj9J0OD.mjs +1214 -0
  9. package/dist/decode-Dsj9J0OD.mjs.map +1 -0
  10. package/dist/decode-FysWS28R.mjs +254 -0
  11. package/dist/decode-FysWS28R.mjs.map +1 -0
  12. package/dist/decode-Xr7mARKr.mjs +1262 -0
  13. package/dist/decode-Xr7mARKr.mjs.map +1 -0
  14. package/dist/decode-ico-D3SL2BXi.mjs +274 -0
  15. package/dist/decode-ico-D3SL2BXi.mjs.map +1 -0
  16. package/dist/full.umd-oM1VUBRH.mjs +3055 -0
  17. package/dist/full.umd-oM1VUBRH.mjs.map +1 -0
  18. package/dist/index.d.mts +491 -11
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +1 -2
  21. package/dist/jpeg-B4tsxG5f.mjs +2 -0
  22. package/dist/png-rD0XEazj.mjs +35 -0
  23. package/dist/png-rD0XEazj.mjs.map +1 -0
  24. package/dist/raster-BQ07mKLu.mjs +493 -0
  25. package/dist/raster-BQ07mKLu.mjs.map +1 -0
  26. package/dist/resize-B47sgoOb.mjs +489 -0
  27. package/dist/resize-B47sgoOb.mjs.map +1 -0
  28. package/dist/resvg-wasm-fcJTLpJs.mjs +522 -0
  29. package/dist/resvg-wasm-fcJTLpJs.mjs.map +1 -0
  30. package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
  31. package/dist/shell/assets/browse.js +1 -1
  32. package/dist/shell/assets/index.css +1 -1
  33. package/dist/shell/assets/main.js +17 -17
  34. package/dist/skill/SKILL.md +46 -17
  35. package/dist/skill/references/cli-reference.md +8 -3
  36. package/dist/skill/references/how-it-works.md +30 -0
  37. package/dist/webp-CcbaCrQ7.mjs +2 -0
  38. package/dist/webui/assets/browse.js +1 -1
  39. package/dist/webui/assets/index.css +1 -1
  40. package/dist/webui/assets/main.js +17 -17
  41. package/package.json +7 -8
  42. package/skill/SKILL.md +46 -17
  43. package/skill/references/cli-reference.md +8 -3
  44. package/skill/references/how-it-works.md +30 -0
  45. package/dist/bin-Dl6P1QjJ.mjs +0 -2213
  46. package/dist/bin-Dl6P1QjJ.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-opentray",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Turn any start command that serves HTTP locally into an OpenTray-hosted desktop app.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,13 +26,10 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "sharp": "^0.33.5",
30
29
  "yargs": "^18.0.0",
31
- "@create-opentray/core": "0.1.2",
32
- "@opentray/packaging": "0.21.0",
33
- "@opentray/spec": "0.21.0",
34
- "@opentray/vite-plugin": "0.21.0",
35
- "@create-opentray/cli": "0.1.2"
30
+ "@opentray/packaging": "0.22.0",
31
+ "@opentray/spec": "0.22.0",
32
+ "@opentray/vite-plugin": "0.22.0"
36
33
  },
37
34
  "optionalDependencies": {
38
35
  "@lydell/node-pty": "^1.1.0"
@@ -42,7 +39,9 @@
42
39
  "ghostty-web": "^0.4.0",
43
40
  "tsdown": "^0.22.1",
44
41
  "typescript": "^6.0.3",
45
- "vitest": "^4.1.7"
42
+ "vitest": "^4.1.7",
43
+ "@create-opentray/core": "0.1.4",
44
+ "@create-opentray/cli": "0.1.4"
46
45
  },
47
46
  "engines": {
48
47
  "node": ">=20"
package/skill/SKILL.md CHANGED
@@ -1,16 +1,17 @@
1
1
  ---
2
2
  name: create-opentray
3
- description: create-opentray guide for turning any HTTP-serving start command into an OpenTray-hosted desktop application — WebUI wizard, non-interactive CLI creation, the v1 create-opentray.json configuration authority, the fixed ~/.opentray/create registry, application lifecycle (edit, copy, export, uninstall), icon handling including pixel-art smoothing, developer mode, and platform limitations. Use when scaffolding or managing applications created by create-opentray.
3
+ description: create-opentray guide for turning any HTTP-serving start command — or any http(s) URL — into an OpenTray-hosted desktop application — WebUI wizard, non-interactive CLI creation, the v1 create-opentray.json configuration authority, the fixed ~/.opentray/create registry, application lifecycle (edit, copy, export, uninstall), icon handling including pixel-art smoothing, developer mode, and platform limitations. Use when scaffolding or managing applications created by create-opentray.
4
4
  ---
5
5
 
6
6
  # create-opentray
7
7
 
8
8
  ## Overview
9
9
 
10
- `create-opentray` packages a start command that serves HTTP locally into an
11
- OpenTray-hosted desktop application: a real tray icon, a webview window, and a
12
- supervised child process. This skill explains how it works, how to drive it
13
- non-interactively, and how to manage created applications.
10
+ `create-opentray` packages a start command that serves HTTP locally — or a
11
+ plain http(s) URL — into an OpenTray-hosted desktop application: a real tray
12
+ icon, a webview window, and (for command apps) a supervised child process.
13
+ This skill explains how it works, how to drive it non-interactively, and how
14
+ to manage created applications.
14
15
 
15
16
  Three adapter surfaces share one Core:
16
17
 
@@ -18,8 +19,9 @@ Three adapter surfaces share one Core:
18
19
  WebUI wizard. It can run your command once, discover the HTTP ports it
19
20
  owns, and suggest a name/icon from the served page.
20
21
  2. `create-opentray create …` — fully non-interactive creation. No browser,
21
- no prompts, no sniffing: identity, icons, and the command vector are all
22
- explicit.
22
+ no prompts, no sniffing: identity, icons, and the command vector (or the
23
+ `--url` address) are all explicit; under `--url` the identity derives
24
+ from the address offline.
23
25
  3. `create-opentray app …` — manage registered applications: list, edit,
24
26
  copy, export, uninstall.
25
27
 
@@ -29,10 +31,12 @@ OpenTray is a desktop status platform: your application calls `createTray()`
29
31
  and owns its own foreground/background lifetime. A created application is a
30
32
  small generated project whose entry (`main.mjs`):
31
33
 
32
- - spawns your recorded start command as a supervised child,
33
- - discovers the command's owned HTTP listening ports at runtime,
34
- - hosts each verified port in an application-mode webview window, and
35
- - owns the tray session with a Quit menu item.
34
+ - command app: spawns your recorded start command as a supervised child,
35
+ discovers the command's owned HTTP listening ports at runtime, and hosts
36
+ each verified port in an application-mode webview window;
37
+ - URL app (`--url`): opens exactly one application-mode webview window at
38
+ the frozen address and supervises nothing;
39
+ - both own the tray session with a Quit menu item.
36
40
 
37
41
  The generated project depends only on published packages (`opentray`,
38
42
  `@opentray/ext-webview`) — never on the create-opentray tool itself.
@@ -49,12 +53,13 @@ Every registered application has exactly one editable desired-state document:
49
53
  tray-icon.<ext>
50
54
  ```
51
55
 
52
- `create-opentray.json` records app identity and name, the exact command
53
- vector (executable, args, cwd, env overlay), package-manager choice, icon
54
- resource references with content hashes and provenance, icon-rendering
55
- options (including `imageSmoothingEnabled`), window options, and
56
- `developerMode`. Generated files are derived output — editing them is
57
- overwritten on the next apply; edit the JSON instead.
56
+ `create-opentray.json` records app identity and name, exactly ONE source
57
+ (the command vector — executable, args, cwd, env overlay — or a `url`
58
+ address), package-manager choice, icon resource references with content
59
+ hashes and provenance, icon-rendering options (including
60
+ `imageSmoothingEnabled`), window options, and `developerMode`. Generated
61
+ files are derived output — editing them is overwritten on the next apply;
62
+ edit the JSON instead.
58
63
 
59
64
  Key rules:
60
65
 
@@ -81,6 +86,30 @@ npx create-opentray create \
81
86
 
82
87
  - `--arg` is repeatable and each value is ONE exact argv element — never a
83
88
  shell string. Metacharacters like `&&` stay literal.
89
+ - `--url <address>` packages an http(s) URL directly (no command):
90
+
91
+ ```sh
92
+ npx create-opentray create --url https://example.com/app
93
+ ```
94
+
95
+ Identity derives offline from the address (`app.com.example` / `App`);
96
+ override with `--app-id`/`--app-name`. It is mutually exclusive with
97
+ `--exec`/`--arg`/`--cwd`/`--env`. Because the address is known up front,
98
+ creation scrapes the page once and adopts its `<title>` and best favicon
99
+ as DEFAULTS (explicit flags win; failures fall back silently; `--no-scrape`
100
+ skips the fetch). `app edit <id> --url <new-address>` changes it later;
101
+ export emits `--url`.
102
+ - URL app window behavior (all persisted in v1 config, export round-trips):
103
+ `--toolbar` wraps the address in the shared address-bar page (back/forward/
104
+ reload buttons + ⌘/Ctrl+←→, ⌘/Ctrl+[] , ⌘/Ctrl+R, F5, ⌘/Ctrl+L shortcuts
105
+ while the wrapper has focus). Embedding-hostile targets (X-Frame-Options /
106
+ CSP frame-ancestors refusing third-party iframes) are detected during the
107
+ creation scrape and degrade to the direct window with a notice — e.g.
108
+ news.ycombinator.com sends `X-Frame-Options: DENY`, so HN always runs
109
+ direct;
110
+ the tray menu always offers Reload; the window title follows the document
111
+ by default (`--no-title-follow` opts out) and favicon following is opt-in
112
+ (`--icon-follow`).
84
113
  - Icon sources may be local files, `http(s)` URLs, or `data:` URLs. The CLI
85
114
  never scrapes names or favicons — everything is explicit.
86
115
  - `--dry-run` prints the Core plan (effects, warnings, blocks) without
@@ -11,13 +11,15 @@ loopback port), `--no-open` (do not launch the default browser).
11
11
 
12
12
  ## `create-opentray create`
13
13
 
14
- Non-interactive creation. Options:
14
+ Non-interactive creation. A v1 application carries exactly one source: the
15
+ command flags (`--exec` family) OR `--url`. Options:
15
16
 
16
17
  | Option | Meaning |
17
18
  | ------ | ------- |
18
19
  | `--config <file>` | base v1 document; explicit flags override named fields only |
19
- | `--app-id <id>` | immutable reverse-dotted identity (required without `--config`) |
20
- | `--app-name <name>` | display name (required without `--config`) |
20
+ | `--app-id <id>` | immutable reverse-dotted identity (required without `--config`/`--url`) |
21
+ | `--app-name <name>` | display name (required without `--config`/`--url`) |
22
+ | `--url <address>` | URL source: open this http(s) address directly (no command); scrapes the page for default name/icon unless `--no-scrape`; mutually exclusive with `--exec`/`--arg`/`--cwd`/`--env` |
21
23
  | `--exec <executable>` | command executable |
22
24
  | `--arg <value>` | one exact argv element (repeatable) |
23
25
  | `--cwd <dir>` | command working directory (default: current) |
@@ -31,6 +33,9 @@ Non-interactive creation. Options:
31
33
  | `--tray-template` | treat the tray source as a darwin template |
32
34
  | `--developer-mode` | admit WebView DevTools (default false) |
33
35
  | `--window <WxH>` | window size (default 1200x800) |
36
+ | `--toolbar` | URL apps: host the address-bar wrapper (back/forward/reload + shortcuts) |
37
+ | `--title-follow <bool>` | window title follows document.title (default true; negate with `--no-title-follow`) |
38
+ | `--icon-follow <bool>` | runtime favicon→window-icon following (default off) |
34
39
  | `--force` | replace a VERIFIED existing payload |
35
40
  | `--stop-running` | stop a verified running instance first |
36
41
  | `--skip-install` | write the project without installing |
@@ -1,5 +1,20 @@
1
1
  # How create-opentray works
2
2
 
3
+ ## The two application sources
4
+
5
+ A v1 application carries exactly ONE source:
6
+
7
+ - **Command** — `--exec/--arg/--cwd/--env`: create-opentray supervises a local
8
+ start command and hosts the HTTP services it owns.
9
+ - **URL** — `--url <http(s) address>`: no command at all. The generated app
10
+ opens one window directly at the frozen address. The address is known up
11
+ front (unlike a command that must run first), so creation scrapes the page
12
+ once and adopts its `<title>` and best favicon as DEFAULTS — explicit flags
13
+ win, failures fall back silently to the address-derived name and a glyph
14
+ icon, and `--no-scrape` skips the fetch. appId always derives from the
15
+ address text, never from page content. URL apps carry no PTY, no
16
+ terminal/address-bar shell, and no env overlay.
17
+
3
18
  ## The creation pipeline
4
19
 
5
20
  1. **Desired state** — CLI flags or the WebUI form compile into one v1
@@ -15,6 +30,8 @@
15
30
 
16
31
  ## What the generated app does at runtime
17
32
 
33
+ Command apps:
34
+
18
35
  - Reads the frozen command vector from its derived config and spawns the
19
36
  command with an absolute, PATH-independent executable.
20
37
  - Continuously monitors the command's OWNED listening ports (ownership is
@@ -25,6 +42,19 @@
25
42
  - Publishes a tray with Quit; optional startup-terminal and address-bar
26
43
  shells when configured.
27
44
 
45
+ URL apps:
46
+
47
+ - Publish the tray (Show/Reload/Quit) and one application-mode webview
48
+ window at the frozen URL. The title follows the page document by default
49
+ (one-way); runtime favicon→icon following is opt-in (`--icon-follow`).
50
+ - Toolbar mode (`--toolbar`) wraps the address in the shared address-bar
51
+ page: back/forward/reload buttons, an address input, and the ⌘/Ctrl
52
+ navigation shortcuts while the wrapper has focus (keystrokes inside a
53
+ cross-origin embedded page are not observable by the wrapper; the tray
54
+ Reload item always works). Sites that forbid embedding cannot be wrapped.
55
+ - Supervise nothing: no child process, no port monitor; Quit destroys the
56
+ window and tray session and exits.
57
+
28
58
  ## Force and ownership
29
59
 
30
60
  `--force` is not "overwrite anything": it may only replace a payload whose