siltrun 0.1.0 → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joel Brubaker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # `siltrun` — the Silt CLI
2
2
 
3
3
  Run an authoritative multiplayer room on your machine with one command. A room is a
4
- reducer (`tick(state, inputs)`); the server owns the truth. See `archive/rung4-design/hello-room.md`
5
- for the full quickstart.
4
+ reducer (`tick(state, inputs)`); the server owns the truth. The full quickstart is at
5
+ <https://silt.run/docs/quickstart/>.
6
6
 
7
7
  ```bash
8
8
  npx siltrun dev room.ts
@@ -21,13 +21,13 @@ const { state, send } = useRoom("http://localhost:4000", { id: crypto.randomUUID
21
21
 
22
22
  1. **Builds** the Go room-server binary if it is missing or stale (`go build`).
23
23
  2. **Bundles** your contract and its imports into a single module (Bun's bundler).
24
- 3. **Runs the determinism doctor** (CONTRACT §4) if `packages/room-host/doctor.ts` is
25
- present — it replays the tick sequence and reports drift at the exact tick/field. If
26
- the doctor is not present yet, dev prints a notice and keeps running.
24
+ 3. **Runs the determinism doctor** if `@siltrun/room-host` is resolvable — it replays the
25
+ tick sequence and reports drift at the exact tick/field. If the doctor is not present,
26
+ dev prints a notice and keeps running.
27
27
  4. **Boots the room-server in compute mode** (`--contract <bundle> --host <host.ts>`) and
28
28
  scrapes the per-boot dev certificate hash it prints.
29
29
  5. **Serves room-info** on `:4000` — `GET /.well-known/silt` returns
30
- `{ wtEndpoint, certHash, mode }` (SEAM §4) with permissive CORS, so a Vite app on
30
+ `{ wtEndpoint, certHash, mode }` with permissive CORS, so a Vite app on
31
31
  another port can discover the room and dial WebTransport with the cert pinned. **You
32
32
  never touch `serverCertificateHashes`.**
33
33
  6. **Watches** the contract. On save it rebundles, re-runs the doctor, and restarts the
@@ -48,8 +48,8 @@ siltrun dev <contract.ts> [options]
48
48
  --no-doctor skip the determinism check on (re)load
49
49
  ```
50
50
 
51
- Path overrides (mainly for the monorepo / tests): `SILT_ROOM_SERVER_DIR`,
52
- `SILT_ROOM_HOST_ENTRY`, `SILT_DOCTOR_ENTRY`.
51
+ Path overrides (mainly for tests and for running against a local checkout):
52
+ `SILT_ROOM_SERVER_DIR`, `SILT_ROOM_HOST_ENTRY`, `SILT_DOCTOR_ENTRY`.
53
53
 
54
54
  ## `siltrun deploy`
55
55
 
@@ -58,76 +58,50 @@ npx siltrun deploy room.ts
58
58
  ```
59
59
 
60
60
  Ships a contract to the hosted beta: bundle → local determinism doctor → upload
61
- (`SILT_DEPLOY_TOKEN` required; see `src/deploy.ts`). Prints the room endpoint and the
62
- check page on success.
63
-
64
- Deployed room names are capped at **12 chars** (charset `[A-Za-z0-9._-]`): the box
65
- maps each room to a Linux tap device `tap<room>`, and IFNAMSIZ caps interface names
66
- at 15. The CLI enforces this client-side, before upload, with the same reason the
67
- intake worker gives (DIG-676). Local `siltrun dev` has no length cap — no tap device.
68
-
69
- ## Distribution — how the npm package is shaped
70
-
71
- `npm install siltrun` must work from an empty directory with **Node as the only
72
- prerequisite** (the wrangler/workerd bar). Three runtimes ship as packages:
73
-
74
- - **The CLI itself** runs on Bun, but its `bin` is a plain-Node shim
75
- (`bin/silt.mjs`) that locates Bun and re-execs `src/cli.ts` under it. Bun arrives
76
- through the official `bun` npm package (a dependency); the shim resolves it in
77
- order: `SILT_BUN` env → the `bun` package's populated `bin/bun.exe` → the
78
- `@oven/bun-<platform>` package directly (covers `--ignore-scripts` installs) →
79
- `bun` on PATH. The resolved path is exported as `SILT_BUN` so every downstream
80
- spawn (doctor, and the Go server spawning the room-host) uses the same runtime.
81
- - **The Go room-server** ships prebuilt in per-platform packages
82
- (`@siltrun/room-server-<os>-<arch>`, `optionalDependencies` with `os`/`cpu` fields —
83
- npm installs exactly the matching one). `paths.ts` resolves the installed binary;
84
- in the monorepo the sibling Go source wins and is built/rebuilt from source.
85
- - **The Bun room-host** (host.ts, doctor, deterministic realm) ships as
86
- `@siltrun/room-host` — plain TS source, zero runtime deps; the CLI resolves it from
87
- node_modules, or from the sibling package in-repo.
88
-
89
- `create-siltrun` (`npm create siltrun my-game`) scaffolds the consumer project: `room.ts`
90
- at the root, a `src/Game.tsx` React client, and a `dev` script that runs
91
- `siltrun dev room.ts` + vite together.
92
-
93
- ### Releasing
61
+ (`SILT_DEPLOY_TOKEN` required). Prints the room endpoint and the check page on success.
94
62
 
95
- ```bash
96
- bun tools/pack-release.ts # build dist + platform binaries, pack ALL tarballs
97
- bun tools/pack-release.ts --current # this machine's platform binary only
98
- ```
63
+ Deployed room names are capped at **12 chars**, charset `[A-Za-z0-9._-]`. The CLI
64
+ enforces this before upload, so an over-long name fails on your machine in a second
65
+ instead of after a round trip. Local `siltrun dev` has no length cap.
99
66
 
100
- Tarballs land in `dist-tarballs/`, with `workspace:*` deps mechanically rewritten to
101
- real versions by `bun pm pack` and verified by the script (it fails on any leaked
102
- `workspace:` and on a platform tarball missing its binary). Publishing is
103
- `npm publish <tarball>` per file. QA without touching the npm registry: publish the
104
- tarballs to a local registry (verdaccio) and walk `npm create siltrun` against it.
67
+ ## What gets installed
105
68
 
106
- ## North star: the Vite-plugin blend (future)
69
+ `npm install siltrun` works from an empty directory with **Node as the only
70
+ prerequisite**. Three runtimes arrive as packages, and you do not install any of them
71
+ yourself:
107
72
 
108
- `npx siltrun dev` is the standalone path. The tracked north star (CONTRACT §10, open item 3)
109
- is a **Vite plugin** so the room runs inside your existing `npm run dev` — one project,
110
- one terminal, one reload story, exactly how Next.js made API routes feel. `room.ts` should
111
- feel like adding a route, not running a game server. The plugin would host the room-info
112
- endpoint on the Vite dev server itself and own the same supervise/bundle/doctor pipeline
113
- this CLI implements today, so the standalone path stays the reference implementation.
73
+ - **The CLI** runs on Bun, but its `bin` is a plain-Node shim that locates Bun and
74
+ re-execs under it. Bun arrives through the official `bun` npm package, a dependency.
75
+ Set `SILT_BUN` to point at a specific Bun binary if you need to; otherwise the shim
76
+ finds one, and every downstream spawn reuses the same runtime.
77
+ - **The room-server** ships prebuilt in per-platform packages
78
+ (`@siltrun/room-server-<os>-<arch>`), declared as `optionalDependencies` with `os`
79
+ and `cpu` fields, so npm installs exactly the one matching your machine.
80
+ - **The room-host** (the contract runtime, the doctor, and the deterministic realm)
81
+ ships as `@siltrun/room-host`, plain TypeScript source with zero runtime deps.
114
82
 
115
- ## Notes for the reference build
83
+ To start a project rather than add the CLI to one, `npm create siltrun@latest my-game`
84
+ scaffolds `room.ts`, a React client, and a `dev` script that runs the room and Vite
85
+ together.
116
86
 
117
- - **Runtime:** Bun. The room-host runs on Bun and the contract is bundled with Bun, so
118
- Bun is the toolchain regardless; the CLI's own code runs under it (via the Node
119
- shim above — never assume `bun` is on the user's PATH).
120
- - **Room route:** `/room/<name>` — named by `--room`, `SILT_ROOM`, or derived from the
121
- contract path (generic basenames like `room.ts` defer to the parent directory). The
122
- dev never types this path — only the room-info URL.
87
+ ## Where this is heading
123
88
 
124
- ## Development
89
+ `npx siltrun dev` is the standalone path. The intended future is a **Vite plugin**, so
90
+ the room runs inside your existing `npm run dev`: one project, one terminal, one reload
91
+ story, the way API routes feel in a web framework. `room.ts` should feel like adding a
92
+ route rather than running a game server. The plugin would host the room-info endpoint on
93
+ the Vite dev server itself and own the same supervise, bundle, and doctor pipeline this
94
+ CLI implements today, so the standalone path stays the reference implementation.
125
95
 
126
- ```bash
127
- bun install
128
- bun test # room-info shape, bundling, arg parsing, cert-scrape
129
- bun run typecheck
130
- ```
96
+ ## Notes
97
+
98
+ - **Runtime:** Bun. The room-host runs on Bun and the contract is bundled with Bun, so
99
+ Bun is the toolchain either way. The CLI's own code runs under it through the Node
100
+ shim above, and never assumes `bun` is on your PATH.
101
+ - **Room route:** `/room/<name>`, named by `--room`, `SILT_ROOM`, or derived from the
102
+ contract path (generic basenames like `room.ts` defer to the parent directory). You
103
+ never type this path yourself, only the room-info URL.
104
+
105
+ ## Docs
131
106
 
132
- End-to-end proof (a browser actually joining and moving a ship) belongs to the integration
133
- phase. These tests cover the pieces the CLI owns standalone.
107
+ Full guides and API reference: <https://silt.run/docs/>
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "siltrun",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
+ "license": "MIT",
4
5
  "description": "The Silt CLI — run an authoritative multiplayer room locally with `siltrun dev`.",
5
6
  "type": "module",
6
7
  "bin": {
7
8
  "siltrun": "bin/silt.mjs"
8
9
  },
9
- "files": ["bin", "src"],
10
+ "files": [
11
+ "bin",
12
+ "src"
13
+ ],
10
14
  "scripts": {
11
15
  "test": "bun test",
12
16
  "typecheck": "tsc --noEmit"
13
17
  },
14
- "repository": "https://github.com/digitalpine/silt",
15
18
  "dependencies": {
16
19
  "@siltrun/room-host": "0.1.0",
17
20
  "bun": "^1.3.0"
@@ -28,5 +31,6 @@
28
31
  "devDependencies": {
29
32
  "@types/bun": "^1.2.0",
30
33
  "typescript": "^5.6.0"
31
- }
34
+ },
35
+ "homepage": "https://silt.run"
32
36
  }
package/src/deploy.ts CHANGED
@@ -36,8 +36,12 @@ import { log, paint } from "./log.ts";
36
36
  // any time via SILT_DEPLOY_URL for local mocks / miniflare.
37
37
  export const DEFAULT_INTAKE_URL = "https://silt-deploy-intake.ai-chat-game.workers.dev";
38
38
 
39
- // Where a tester gets a token. Kept as a pointer so the "no token" error is actionable.
40
- const ONBOARDING_DOC = "https://silt.digitalpine.io/beta";
39
+ // Where a logged-out user goes next. Kept as a pointer so the "no credential" error is
40
+ // actionable. This is the FIRST thing a stranger sees when they run `deploy` before
41
+ // `login`, so it must resolve: the old https://silt.digitalpine.io/beta 404s (verified
42
+ // 2026-08-02), and so does /beta on the current host. The docs quickstart is the live,
43
+ // honest target and documents the login step this error is telling them to run.
44
+ const ONBOARDING_DOC = "https://silt.run/docs/quickstart/";
41
45
 
42
46
  // Where a tester reports a failure that isn't theirs to fix (docs/SUPPORT.md — Discord
43
47
  // #support is THE channel; there is no support email).
@@ -221,7 +225,7 @@ export async function runDeploy(
221
225
  const token = envToken || (sessionUsable ? creds!.token : undefined);
222
226
  if (!token) {
223
227
  logger.error("no deploy credential — run `siltrun login` (or set SILT_DEPLOY_TOKEN to a beta token)");
224
- logger.plain(paint.dim(` Beta info: ${ONBOARDING_DOC}`));
228
+ logger.plain(paint.dim(` Getting started: ${ONBOARDING_DOC}`));
225
229
  return { ok: false, status: "aborted", error: "no token" };
226
230
  }
227
231
  if (usingSession) {