@onceworlds/cli 0.6.0 → 0.8.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 (3) hide show
  1. package/README.md +24 -3
  2. package/dist/cli.js +1562 -511
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -60,6 +60,10 @@ with the link) or Public (also listed on Onceworlds).
60
60
  }
61
61
  ```
62
62
 
63
+ `engine` (`"1"`, `"1.2"` or an exact `"1.2.3"`) makes a game run on the engine the platform hosts: it adds an import map
64
+ so `import { createGame } from '@onceworlds/engine'` works in a page with no build step. `"1"` is the newest 1.x, which gets
65
+ fixes without a redeploy; an exact version never changes. A deploy fails, saying what is available, for a version that doesn't exist.
66
+
63
67
  `dir` is the folder to publish (for example `dist` after a build); it must contain
64
68
  `index.html`. `productionBranch` (default `main`) picks the branch that goes live;
65
69
  the dashboard can change it too, and the file wins again only when this value changes.
@@ -79,6 +83,21 @@ from the running game and commit them under `store/`. `onceworlds doctor` says w
79
83
 
80
84
  ## Commands
81
85
 
86
+ - `onceworlds new [folder] --kit <name>` starts a game from a kit: a complete game on the engine, one per kind of game
87
+ (`--list` shows them). It writes the kit with an `onceworlds.json` for your game (`--name`, `--slug`, `--description`;
88
+ the folder's name by default), the engine guide as `AGENTS.md` and `CLAUDE.md`, and the kit's own notes (what each file
89
+ does, what to change, its tests) as `KIT.md`. `--template party` or `starter` starts a small game on the SDK alone.
90
+ - `onceworlds check [dir]` is what to run before a deploy: doctor's findings and, for an engine game, the game's own tests
91
+ (`npm test`) and simulated matches played with no browser, with a reloaded host, a dropped player, the host changing (also while
92
+ paused), a late joiner and garbage messages. A failing test or a match with errors exits with an error. The game's config is
93
+ read from `game.config.js` (or `src/game.config.js`, or `--config <file>`): `export const config = {...}`, and `export const actions`
94
+ lets check compare "How to play" with the action map exactly. Needs `npm install` in the game folder. Simulated players only ready
95
+ up, so a game with long rounds or turn timers may not reach its results in the time check has: `export const quick = ...` from
96
+ the same file (the game with one short round and short timers) and check plays that. A process that outlives its time limit
97
+ is killed with everything it started.
98
+ - `onceworlds posters [dir]` draws each `game.poster()` scene of your latest draft (`?poster=<name>`) in a browser on this
99
+ computer and saves the pictures into `store/` (a poster name is letters, digits, dashes, underscores and dots, as in the engine), naming them in `onceworlds.json` when it has no icon or thumbnails.
100
+ `--only cover,icon` picks some.
82
101
  - `onceworlds init [dir]` sets a game folder up, with the files the dashboard's import commits. It writes
83
102
  `onceworlds.json` (the link and name come from `package.json`'s name or the folder's; `dir` is your build's
84
103
  output folder when `package.json` has a build script, else `.` or the folder with your `index.html`),
@@ -87,15 +106,17 @@ from the running game and commit them under `store/`. `onceworlds doctor` says w
87
106
  overwrites a file you have: `--force` replaces only what init writes, never your own `AGENTS.md` or `CLAUDE.md`.
88
107
  Then commit, push, and import the repo at https://onceworlds.com/dashboard/new.
89
108
  - `onceworlds deploy [dir]` uploads only the files that changed and publishes the game
90
- (the workflow runs it). It lists every file it skipped because Onceworlds can't serve it.
109
+ (the workflow runs it). It lists every file it skipped because Onceworlds can't serve it. A game's tests never go up: `*.test.js`, `vitest.config.*` and the `test/` folder at the top of the game.
91
110
  - `onceworlds dev [dir]` deploys to a local Onceworlds platform (for platform development)
92
111
  and redeploys on every save. `--players 3` also prints links for players 2 and 3 (`?player=N`): on a
93
112
  local platform each is another player, so one person can fill a lobby.
94
113
  - `onceworlds doctor [dir]` looks through the game's files for what games often ship with: no viewport
95
114
  tag, text fields under 16px (Safari zooms the page when one is focused), `confirm()` and other dialogs
96
115
  (blocked in the game frame), localStorage (gone on reload), and, for games with rooms, `Date.now()` for
97
- shared time and no use of the platform's lobby. It only suggests: nothing in it stops a deploy
98
- (`--strict` exits with an error on likely bugs, for CI).
116
+ shared time and no use of the platform's lobby. For an engine game it also reads the action map
117
+ and offers the `controls` it implies: `--fix` writes them into `onceworlds.json` when it has none. For an installed engine
118
+ game the list is the engine's own (`controlsFromActions` on the `actions` that `game.config.js` exports); otherwise it is read
119
+ from the source text (`Input.axis2d`, `Input.button`) and may differ. It only suggests: nothing in it stops a deploy (`--strict` exits with an error on likely bugs, for CI).
99
120
 
100
121
  Games talk to the platform through the injected `window.onceworlds` SDK. The
101
122
  starter template's `AGENTS.md` documents it for AI coding tools.