create-bridgething 0.11.0 → 0.12.1

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 (37) hide show
  1. package/README.md +16 -12
  2. package/dist/index.mjs +476 -142
  3. package/package.json +20 -5
  4. package/template/_claude/skills/bridgething/SKILL.md +12 -17
  5. package/template/_claude/skills/bridgething/reference/develop.md +86 -66
  6. package/template/_claude/skills/bridgething/reference/extension.md +183 -0
  7. package/template/_claude/skills/bridgething/reference/sdk.md +86 -105
  8. package/template/_claude/skills/bridgething/reference/ship.md +19 -38
  9. package/template/_gitignore +1 -0
  10. package/template/package.json +6 -5
  11. package/template/scripts/bridgething.ts +1086 -0
  12. package/template/scripts/push.ts +212 -193
  13. package/template/settings/main.tsx +14 -13
  14. package/template/src/App.tsx +3 -6
  15. package/template/src/daemon.ts +14 -0
  16. package/template/tsconfig.json +1 -1
  17. package/template/vite.config.ts +5 -3
  18. package/template/vite.settings.config.ts +3 -3
  19. package/template-extension/_claude_append.md +23 -0
  20. package/template-extension/extension/main.ts +20 -0
  21. package/template-launcher/_claude_append.md +14 -30
  22. package/template-launcher/src/App.tsx +2 -5
  23. package/template-overlay/_claude_append.md +31 -45
  24. package/template-overlay/vite.overlay.config.ts +1 -1
  25. package/template-source/CLAUDE.md +104 -0
  26. package/template-source/README.md +57 -0
  27. package/template-source/_bunversion +1 -0
  28. package/template-source/_github/workflows/ci.yml +28 -0
  29. package/template-source/_github/workflows/publish.yml +33 -0
  30. package/template-source/_gitignore +7 -0
  31. package/template-source/_prettierrc.js +10 -0
  32. package/template-source/apps/.gitkeep +0 -0
  33. package/template-source/package.json +27 -0
  34. package/template-source/source.json +8 -0
  35. package/template-versions.json +6 -0
  36. package/template/CLAUDE.md +0 -95
  37. package/template/README.md +0 -70
@@ -1,95 +0,0 @@
1
- # Building this bridgething webapp
2
-
3
- You are helping build a **bridgething webapp**: a single-page web UI for the
4
- Spotify Car Thing. It runs full-screen in a chromium kiosk on the device and
5
- talks to the on-device daemon over a local WebSocket using `@bridgething/client`.
6
- This file is always loaded; it holds the constraints. The `/bridgething` skill
7
- goes deep on the how-to: the client API, running and driving the app, and
8
- shipping it.
9
-
10
- ## The device you are targeting
11
-
12
- - **Screen: 800x480, landscape.** Fixed. Design for exactly this. The window
13
- never resizes; there is no responsive breakpoint to chase.
14
- - **One page.** The kiosk shows exactly one webapp at a time. In-app views are
15
- fine, but there are no browser tabs, popups, or second windows.
16
- - **Physical controls arrive as ordinary browser events.** Listen with a
17
- `keydown` handler and a `wheel` handler on `window`.
18
- - Preset buttons **1 2 3 4** -> `keydown` key `"1"` `"2"` `"3"` `"4"`.
19
- - **Mode** button -> `keydown` key `"m"`. (Pressing it 5 times fast is a
20
- system gesture that jumps back to the launcher, so do not build anything
21
- that depends on rapid repeated `m`.)
22
- - **Back** button -> `keydown` key `"Escape"`.
23
- - **Rotary wheel** -> horizontal scroll: `wheel` events with `deltaX`. This is
24
- the primary way users move through lists; make horizontal wheel scroll work.
25
- - **Touch** works normally (pointer/touch events).
26
- - **No keyboard, no mouse.** Those five controls plus touch are the whole input
27
- surface. There is no text entry unless you build an on-screen one.
28
-
29
- ## The SDK: `@bridgething/client`
30
-
31
- ```ts
32
- import { BridgethingClient } from '@bridgething/client';
33
- const client = new BridgethingClient(); // auto-connects to the daemon, auto-reconnects
34
- ```
35
-
36
- Construct it once and reuse it. It defaults to the on-device daemon; in dev you
37
- point it at your device with `VITE_BRIDGETHING_URL` (the starter `App.tsx`
38
- already does this). Do not hardcode a WebSocket URL.
39
-
40
- It is fully typed with a doc comment on every surface, method, and field. Read
41
- those declarations directly - you have no editor to hover in:
42
-
43
- - `node_modules/@bridgething/client/dist/dispatch.generated.d.ts` - every
44
- `client.<surface>.<method>` and event, with docs.
45
- - `node_modules/@bridgething/lib/dist/bindings/*.d.ts` - the payload and reply
46
- types (`PlayerState`, `MediaItem`, ...), with per-field docs.
47
-
48
- 18 surfaces: `player asset config store capabilities library audio notifications
49
- phone geo net hardware bluetooth system time voice webapp forward`. Each method
50
- is one of three shapes:
51
-
52
- - **events**: `client.<s>.onXxx(handler)` returns an unsubscribe fn; or
53
- `client.<s>.subscribe({ onXxx, ... })`.
54
- - **requests**: `await client.<s>.xxx(req)` returns `{ ok: true, response }` or
55
- `{ ok: false, kind, error }` - always check `.ok`.
56
- - **commands**: `await client.<s>.xxx(payload)` returns `void` (fire-and-forget).
57
-
58
- Now-playing and library data come from the **connected phone's** Spotify. Assume
59
- a phone may not be connected: handle the empty/disconnected state gracefully (the
60
- starter shows a "connect a phone" placeholder). Fetch artwork by opaque asset id
61
- via `client.asset.get`; never build image URLs by hand.
62
-
63
- Run `/bridgething` for the cookbook, the dev loop, and shipping; grep the `.d.ts`
64
- files for a specific method or type.
65
-
66
- ## `manifest.json` (in `public/`)
67
-
68
- - `id` - baked in at scaffold, unique to this project. **Never change it.**
69
- - `name`, `version`, `description`, `icon` - cosmetic / store metadata.
70
- - `config` - user-tunable settings (each becomes a `client.config` value).
71
- - `permissions` - capabilities you need (e.g. `net.fetch`, `net.proxy`, `geo`).
72
- - `art: { heroPx, thumbPx }` - the pixel sizes you want artwork delivered at.
73
- - `settings` - one self-contained HTML file (built from `settings/`) the
74
- companion phone app renders as this webapp's settings page. It talks to the
75
- companion over `@bridgething/client/settings`, not the on-device SDK. Capped
76
- at 1 MiB at install. It loads from a `file://` origin: websocket APIs work
77
- from it, but plain HTTP fetch is CORS-gated (`Origin: null`) - see the
78
- network caveat in the `/bridgething` skill's sdk reference.
79
-
80
- ## Workflow
81
-
82
- - `bun run dev` - vite dev server. Iterate here. Use `/bridgething` for the loop
83
- of seeing the screen and pressing the buttons.
84
- - `bun run build` - production bundle into `dist/`.
85
- - `bun run push` - build + install onto a connected Car Thing (see `/bridgething`).
86
- - `bun run update` - update the connected device to the latest bridgething release
87
- (device firmware, not your webapp; see `/bridgething`).
88
-
89
- ## Do not
90
-
91
- - Fight the 800x480 viewport or assume any other size.
92
- - Hardcode `ws://...`; use the SDK default + `VITE_BRIDGETHING_URL`.
93
- - Assume a phone is always connected.
94
- - Build image URLs by hand; fetch by opaque asset id.
95
- - Rely on rapid repeated `m` (system launcher gesture).
@@ -1,70 +0,0 @@
1
- # **PROJECT_NAME**
2
-
3
- A bridgething webapp scaffolded with `create-bridgething`.
4
-
5
- Stack: React 19 + Vite + Tailwind v4 + TypeScript strict, with
6
- [`@bridgething/client`](https://github.com/JoeyEamigh/bridgething) preinstalled.
7
-
8
- ## Building with an agent
9
-
10
- Open this folder with your coding agent (Claude Code, Codex, opencode, ...). It
11
- reads `CLAUDE.md` / `AGENTS.md` and the `/bridgething` skill.
12
-
13
- ## Develop
14
-
15
- ```bash
16
- bun install
17
- bun run dev
18
- ```
19
-
20
- Opens at http://localhost:5173/. The starter `App.tsx` connects to
21
- `ws://<host>/` (the daemon's local WebSocket on port 8891 of the device
22
- itself). To dev against a remote device, set:
23
-
24
- ```bash
25
- VITE_BRIDGETHING_URL=ws://<device-ip>:8891/ bun run dev
26
- ```
27
-
28
- ## Push to a device
29
-
30
- ```bash
31
- bun run push
32
- ```
33
-
34
- `push` builds `dist/`, rsyncs it into `/var/bridgething/webapps/<manifest-id>/`
35
- on the Car Thing, and switches the kiosk to your app. Pass an IP address to target
36
- something other than `bridgething.local` over USB.
37
-
38
- ## Share
39
-
40
- ```bash
41
- bun run build
42
- bun run share
43
- ```
44
-
45
- `share` writes `<name>-<version>.zip` from `dist/`. Anyone with a bridgething Car
46
- Thing installs it from the app.
47
-
48
- ## Update the device
49
-
50
- ```bash
51
- bun run update
52
- ```
53
-
54
- `update` runs [`@bridgething/updater`](https://www.npmjs.com/package/@bridgething/updater)
55
- to bring the connected Car Thing to the latest bridgething release. Multiple devices: `bun run update -- --host ws://bridgething-<serial>.local:8892/`.
56
-
57
- ## Layout
58
-
59
- - `src/App.tsx` - starter UI: subscribes to `client.player.onSnapshot`,
60
- fetches artwork via `client.asset.get`, exposes transport controls.
61
- - `src/index.css` - `@import "tailwindcss";`.
62
- - `vite.config.ts` - vite + tailwind plugin, `es2022` target.
63
- - `index.html` - 800x480 viewport, no overscroll, no tap highlight.
64
- - `settings/` - the companion-side settings page (preact), built by
65
- `vite.settings.config.ts` into a single self-contained `dist/settings.html`.
66
- It reads and writes settings over `@bridgething/client/settings`.
67
-
68
- `bun run build` runs both configs: the main app into `dist/`, then the settings
69
- page as `dist/settings.html`. `manifest.json`'s `settings` field points the
70
- companion at it.