@bitmagic/cli 0.1.7 → 0.1.9

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 (52) hide show
  1. package/README.md +140 -0
  2. package/dist/auth/session.js +1 -1
  3. package/dist/auth/session.js.map +1 -1
  4. package/dist/cli.d.ts +29 -0
  5. package/dist/cli.js +6 -0
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/build.d.ts +1 -0
  8. package/dist/commands/build.js +16 -0
  9. package/dist/commands/build.js.map +1 -0
  10. package/dist/commands/publish.d.ts +44 -0
  11. package/dist/commands/publish.js +202 -0
  12. package/dist/commands/publish.js.map +1 -0
  13. package/dist/commands/upgrade.d.ts +36 -0
  14. package/dist/commands/upgrade.js +170 -0
  15. package/dist/commands/upgrade.js.map +1 -0
  16. package/dist/commands/verify.js +8 -9
  17. package/dist/commands/verify.js.map +1 -1
  18. package/dist/forge/apply-modifications.js +7 -13
  19. package/dist/forge/apply-modifications.js.map +1 -1
  20. package/dist/project/context.js +6 -1
  21. package/dist/project/context.js.map +1 -1
  22. package/dist/project/package-manager.d.ts +17 -0
  23. package/dist/project/package-manager.js +48 -0
  24. package/dist/project/package-manager.js.map +1 -0
  25. package/dist/publish/bundle.d.ts +37 -0
  26. package/dist/publish/bundle.js +88 -0
  27. package/dist/publish/bundle.js.map +1 -0
  28. package/dist/publish/client.d.ts +94 -0
  29. package/dist/publish/client.js +150 -0
  30. package/dist/publish/client.js.map +1 -0
  31. package/dist/publish/fingerprint.d.ts +27 -0
  32. package/dist/publish/fingerprint.js +84 -0
  33. package/dist/publish/fingerprint.js.map +1 -0
  34. package/dist/publish/meta-block.d.ts +26 -0
  35. package/dist/publish/meta-block.js +48 -0
  36. package/dist/publish/meta-block.js.map +1 -0
  37. package/dist/scaffold/dependency-diff.d.ts +28 -0
  38. package/dist/scaffold/dependency-diff.js +28 -0
  39. package/dist/scaffold/dependency-diff.js.map +1 -0
  40. package/dist/scaffold/project-files.d.ts +22 -0
  41. package/dist/scaffold/project-files.js +114 -5
  42. package/dist/scaffold/project-files.js.map +1 -1
  43. package/dist/scaffold/project.d.ts +17 -0
  44. package/dist/scaffold/project.js +24 -4
  45. package/dist/scaffold/project.js.map +1 -1
  46. package/dist/scaffold/upgrade-project.d.ts +35 -0
  47. package/dist/scaffold/upgrade-project.js +63 -0
  48. package/dist/scaffold/upgrade-project.js.map +1 -0
  49. package/dist/verify/result.d.ts +60 -0
  50. package/dist/verify/result.js +74 -0
  51. package/dist/verify/result.js.map +1 -0
  52. package/package.json +3 -3
@@ -1,6 +1,13 @@
1
1
  import { tsconfigPaths, importMapEntries, viteAliasEntries } from './aliases.js';
2
- /** Mirrors game/package.json so the pro lane resolves exactly what CI builds against. */
3
- const DEPENDENCIES = {
2
+ /**
3
+ * Mirrors game/package.json so the pro lane resolves exactly what CI builds against.
4
+ *
5
+ * Exported so `bitmagic upgrade` can diff a project's actual package.json against what the
6
+ * vendored engine currently needs — package.json itself is never rewritten (see
7
+ * PLATFORM_GENERATED_FILES in project.ts), so this is the only source of truth upgrade has for
8
+ * telling a creator what to add by hand.
9
+ */
10
+ export const DEPENDENCIES = {
4
11
  '@dimforge/rapier2d-compat': '^0.19.3',
5
12
  '@dimforge/rapier3d-compat': '^0.19.3',
6
13
  '@msgpack/msgpack': '^3.1.3',
@@ -10,7 +17,7 @@ const DEPENDENCIES = {
10
17
  jszip: '^3.10.1',
11
18
  three: '^0.185.1',
12
19
  };
13
- const DEV_DEPENDENCIES = {
20
+ export const DEV_DEPENDENCIES = {
14
21
  '@types/node': '^24.10.0',
15
22
  '@types/three': '^0.185.4',
16
23
  // engine/types/ammo.d.ts opens with a triple-slash reference to this package's ambient types.
@@ -20,6 +27,7 @@ const DEV_DEPENDENCIES = {
20
27
  '@webgpu/types': '^0.1.69',
21
28
  typescript: '^5.9.2',
22
29
  vite: '^7.3.1',
30
+ 'vite-plugin-singlefile': '^2.3.3',
23
31
  };
24
32
  /**
25
33
  * The three.js release every `three*` import map entry below resolves to. Written once because
@@ -185,10 +193,19 @@ ${JSON.stringify({ imports }, null, 8).replace(/^/gm, ' ')}
185
193
  </html>
186
194
  `;
187
195
  }
188
- export function renderViteConfig() {
189
- const entries = Object.entries(viteAliasEntries())
196
+ /**
197
+ * The `resolve.alias` body shared by both vendored vite configs (this one and the publish
198
+ * config below): one `'key': 'target'` line per alias, comma-joined, indented to sit inside a
199
+ * template literal's `alias: { ... }` block. Kept in one place so the two configs' aliases
200
+ * cannot drift into two different renderings of the same `viteAliasEntries()` data.
201
+ */
202
+ function renderAliasEntries() {
203
+ return Object.entries(viteAliasEntries())
190
204
  .map(([key, target]) => ` '${key}': '${target}'`)
191
205
  .join(',\n');
206
+ }
207
+ export function renderViteConfig() {
208
+ const entries = renderAliasEntries();
192
209
  return `import { defineConfig } from 'vite';
193
210
 
194
211
  // Aliases mirror tsconfig paths but point at the COMPILED output: tsc emits to dist/ and the
@@ -209,6 +226,50 @@ ${entries}
209
226
  });
210
227
  `;
211
228
  }
229
+ /**
230
+ * The production bundle config, vendored into the project next to `engine/`.
231
+ *
232
+ * One self-contained HTML: `viteSingleFile` with an effectively unlimited inline limit, so the
233
+ * engine and all JS/CSS land inside index.html. Game ASSETS are deliberately NOT inlined — they
234
+ * already live on the CDN with absolute URLs, and inlining them is what produced multi-hundred-MB
235
+ * bundles and OOM-killed the web publish pod.
236
+ *
237
+ * Vendored rather than generated per-build so a creator can read exactly what ships, and so it
238
+ * versions with the engine it was written for.
239
+ */
240
+ export function renderVitePublishConfig() {
241
+ const entries = renderAliasEntries();
242
+ return `import { defineConfig } from 'vite';
243
+ import { viteSingleFile } from 'vite-plugin-singlefile';
244
+
245
+ // Aliases mirror vite.config.js's, deliberately NOT wrapped in path.resolve(): every target here
246
+ // already starts with '/', which Vite resolves as project-root-relative in both serve and build
247
+ // mode. A path.resolve(__dirname, target) wrapper looks more "correct" but is actively wrong —
248
+ // Node's path.resolve() drops the trailing slash from an already-absolute second argument, and
249
+ // Vite's directory-style alias substitution needs that slash to join the replacement with the
250
+ // rest of the specifier. Strip it and 'engine/GameTemplate.js' resolves to the nonexistent
251
+ // 'dist/engine/engineGameTemplate.js' instead of 'dist/engine/engine/GameTemplate.js' — silently,
252
+ // since Rollup then just treats the unmatched id as an unresolved bare specifier and fails the
253
+ // build. Verified against a real \`vite build\` before trusting the plain-string form.
254
+ export default defineConfig({
255
+ resolve: {
256
+ alias: {
257
+ ${entries}
258
+ }
259
+ },
260
+ build: {
261
+ // Effectively unlimited: everything the bundle references locally is inlined so the
262
+ // published artifact is a single file. CDN assets are absolute URLs and are untouched.
263
+ assetsInlineLimit: 100000000,
264
+ cssCodeSplit: false,
265
+ rollupOptions: {
266
+ output: { inlineDynamicImports: true },
267
+ },
268
+ },
269
+ plugins: [viteSingleFile()],
270
+ });
271
+ `;
272
+ }
212
273
  export function renderGitignore() {
213
274
  return ['dist/', 'node_modules/', '.bitmagic/', '.vite-cache/', ''].join('\n');
214
275
  }
@@ -265,6 +326,54 @@ compile that dies on load — a missing asset, a bad \`world.json\` value, a nul
265
326
  \`bitmagic verify\` after a change you cannot eyeball: it loads the game in a headless browser and
266
327
  fails with what actually broke, leaving a console log and a screenshot in \`.bitmagic/verify/\`.
267
328
 
329
+ ## Publishing
330
+
331
+ \`\`\`
332
+ bitmagic build # bundle into .bitmagic/build/index.html + .bitmagic/build/manifest.json
333
+ bitmagic publish # verify-gate, build if needed, and ship to bitmagic.ai
334
+ \`\`\`
335
+
336
+ Follow this order; \`publish\` enforces it and refuses otherwise:
337
+
338
+ 1. Run \`bitmagic verify\` and get it passing. It writes \`.bitmagic/verify/result.json\`,
339
+ \`.bitmagic/verify/screenshot.png\` (becomes the publish thumbnail) and
340
+ \`.bitmagic/verify/console.log\`.
341
+ 2. Do not edit any tracked file between verifying and publishing. Staleness is decided by a
342
+ content fingerprint of every tracked file, not a clock — one edit after verifying invalidates
343
+ it immediately, and an untouched project stays fresh no matter how long it has been. There is
344
+ no way to check freshness except running \`bitmagic verify\` again. Git operations are safe:
345
+ \`.git/\` is excluded from the fingerprint, so committing (or branching, or stashing) between
346
+ verifying and publishing changes nothing. So are \`node_modules/\`, \`dist/\`, \`.bitmagic/\`
347
+ and \`.vite-cache/\`.
348
+ 3. Run \`bitmagic publish\`. It rebuilds automatically if the project changed since the last
349
+ build, so a manual \`bitmagic build\` first is optional.
350
+
351
+ **A bare \`bitmagic publish\` does not make the game public.** Every publish uploads and
352
+ registers the game, but \`visibility\` defaults to \`private\` — reachable by URL, not listed on
353
+ bitmagic.ai. Pass \`--visibility public\` explicitly, on that call, to list it; omit it on a later
354
+ publish and the game goes back to private — its \`/play/\` page stops serving too, so a public
355
+ game you re-publish bare disappears from bitmagic.ai entirely until the next
356
+ \`--visibility public\`.
357
+
358
+ \`--force\` overrides a **stale or failed** verify verdict, never a **missing** one — the
359
+ thumbnail comes from the verify screenshot, so \`bitmagic verify\` must have produced one at least
360
+ once before \`--force\` has anything to publish from.
361
+
362
+ \`--name\`/\`--description\` apply to that one publish call only; they are never written back to
363
+ \`src/work/game.json\` (doing so by hand would change the fingerprint and invalidate the verify
364
+ you just checked).
365
+
366
+ If \`bitmagic publish\` exits non-zero, branch on the exit code rather than parsing the message:
367
+
368
+ | Code | Meaning | Fix |
369
+ |---|---|---|
370
+ | 1 | Build failed | Run \`bitmagic check\` to see the error, fix it. If the message says \`vite.publish.config.js\` is missing, this project predates it — run \`bitmagic upgrade\` |
371
+ | 2 | Not logged in | \`bitmagic login\` |
372
+ | 3 | Verify missing, stale, or failed | \`bitmagic verify\` (then publish again, or add \`--force\` for a stale/failed record) |
373
+ | 4 | Engine below the publish floor | \`bitmagic upgrade\` |
374
+ | 5 | Not this game's owner, or the account/game is banned | Not self-serve — stop and report it |
375
+ | 6 | Upload or finalize failed | Usually transient (network/storage). Retry once; if it fails identically, stop and report it — this code also covers permanent failures such as an unknown game or a rejected request |
376
+
268
377
  ## Generating assets
269
378
 
270
379
  You can create game content from here — no web editor needed:
@@ -1 +1 @@
1
- {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AC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IACrC,OAAO;;;;;;;;;;;;;;;EAeP,OAAO;;;;;;;;;;;;;;CAcR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AASD,MAAM,UAAU,kBAAkB,CAAC,QAAyB;IAC1D,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiKR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;CAIR,CAAC;AACF,CAAC"}
@@ -15,6 +15,23 @@ export interface TemplateEntry {
15
15
  * parallel copy that silently goes stale when an entry is added here.
16
16
  */
17
17
  export declare const VENDORED_DIRS: string[];
18
+ /**
19
+ * The subset of the generated files that are pure platform output: regenerated byte-for-byte
20
+ * from these renderers with no creator content ever entering them. `bitmagic upgrade` overwrites
21
+ * exactly this list (plus bitmagic.json, handled separately since only its engineVersion field is
22
+ * platform-owned, and engine/ + sw-cache-buster.js, handled separately since they are copied, not
23
+ * rendered).
24
+ *
25
+ * Deliberately excludes package.json (creators add dependencies to it), AGENTS.md/CLAUDE.md (the
26
+ * creator's own agent reads and may edit them), and .gitignore (same reasoning) — those are
27
+ * generated once by `scaffoldProject` but are creator-owned from that point on.
28
+ *
29
+ * Exported so `scaffoldProject` and `upgradeProject` share one definition instead of two lists
30
+ * that can drift — the exact failure that motivated this: `vite.publish.config.js` was added
31
+ * to init's inline list with no equivalent path for existing projects to ever receive it, because
32
+ * `upgrade` didn't exist yet.
33
+ */
34
+ export declare const PLATFORM_GENERATED_FILES: Array<[string, () => string]>;
18
35
  export declare function resolveTemplate(templatesDir: string, requestedId?: string): TemplateEntry;
19
36
  export interface ScaffoldOptions {
20
37
  targetDir: string;
@@ -2,7 +2,7 @@ import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { CliError } from '../errors.js';
4
4
  import { aliasSourceDir } from './aliases.js';
5
- import { renderPackageJson, renderTsconfig, renderIndexHtml, renderViteConfig, renderGitignore, renderBitmagicJson, renderAgentsMd, renderClaudeMd, renderSkillsReadme, renderGenerateSkill, } from './project-files.js';
5
+ import { renderPackageJson, renderTsconfig, renderIndexHtml, renderViteConfig, renderVitePublishConfig, renderGitignore, renderBitmagicJson, renderAgentsMd, renderClaudeMd, renderSkillsReadme, renderGenerateSkill, } from './project-files.js';
6
6
  /**
7
7
  * Directories moved out of the extracted tree into the project's vendored engine/.
8
8
  *
@@ -24,6 +24,28 @@ export const VENDORED_DIRS = [
24
24
  'utils',
25
25
  'core',
26
26
  ];
27
+ /**
28
+ * The subset of the generated files that are pure platform output: regenerated byte-for-byte
29
+ * from these renderers with no creator content ever entering them. `bitmagic upgrade` overwrites
30
+ * exactly this list (plus bitmagic.json, handled separately since only its engineVersion field is
31
+ * platform-owned, and engine/ + sw-cache-buster.js, handled separately since they are copied, not
32
+ * rendered).
33
+ *
34
+ * Deliberately excludes package.json (creators add dependencies to it), AGENTS.md/CLAUDE.md (the
35
+ * creator's own agent reads and may edit them), and .gitignore (same reasoning) — those are
36
+ * generated once by `scaffoldProject` but are creator-owned from that point on.
37
+ *
38
+ * Exported so `scaffoldProject` and `upgradeProject` share one definition instead of two lists
39
+ * that can drift — the exact failure that motivated this: `vite.publish.config.js` was added
40
+ * to init's inline list with no equivalent path for existing projects to ever receive it, because
41
+ * `upgrade` didn't exist yet.
42
+ */
43
+ export const PLATFORM_GENERATED_FILES = [
44
+ ['tsconfig.json', renderTsconfig],
45
+ ['vite.config.js', renderViteConfig],
46
+ ['vite.publish.config.js', renderVitePublishConfig],
47
+ ['index.html', renderIndexHtml],
48
+ ];
27
49
  export function resolveTemplate(templatesDir, requestedId) {
28
50
  const indexPath = path.join(templatesDir, 'index.json');
29
51
  let raw;
@@ -98,9 +120,7 @@ export function scaffoldProject(options) {
98
120
  }
99
121
  const files = [
100
122
  ['package.json', renderPackageJson(projectName)],
101
- ['tsconfig.json', renderTsconfig()],
102
- ['vite.config.js', renderViteConfig()],
103
- ['index.html', renderIndexHtml()],
123
+ ...PLATFORM_GENERATED_FILES.map((entry) => [entry[0], entry[1]()]),
104
124
  ['bitmagic.json', renderBitmagicJson(metadata)],
105
125
  ['AGENTS.md', renderAgentsMd()],
106
126
  ['CLAUDE.md', renderClaudeMd()],
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/scaffold/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC;AAY5B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IA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IAC1E,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,KAAK,GAA4B;QACrC,CAAC,cAAc,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAChD,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC,eAAe,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC;QAC/B,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC;QAC/B,CAAC,YAAY,EAAE,eAAe,EAAE,CAAC;QACjC,CAAC,0BAA0B,EAAE,kBAAkB,EAAE,CAAC;QAClD,CAAC,2CAA2C,EAAE,mBAAmB,EAAE,CAAC;KACrE,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5C,wFAAwF;QACxF,+EAA+E;QAC/E,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ export interface UpgradeOptions {
2
+ root: string;
3
+ /** Where extractEngine unpacked the new engine tree, same shape scaffoldProject reads from. */
4
+ extractedEngineDir: string;
5
+ /** The engine version being upgraded to, written into bitmagic.json's engineVersion field. */
6
+ engineVersion: string;
7
+ }
8
+ export interface UpgradeResult {
9
+ engineVersion: string;
10
+ previousEngineVersion: string;
11
+ /** Every top-level path this run actually rewrote, in the order it rewrote them. */
12
+ replaced: string[];
13
+ }
14
+ /**
15
+ * Refreshes the platform-owned parts of a scaffolded project in place, and nothing else. This is
16
+ * the file-boundary described in the task brief: `engine/` (every VENDORED_DIRS entry) and
17
+ * sw-cache-buster.js are wholesale-replaced, the config files in PLATFORM_GENERATED_FILES are
18
+ * re-rendered, and bitmagic.json is read-modified-written so only its engineVersion field
19
+ * changes. Everything else on disk — src/, world.json, game.json, package.json, AGENTS.md,
20
+ * CLAUDE.md, .claude/, .gitignore — is never opened.
21
+ *
22
+ * Mirrors scaffoldProject's copy behaviour (same VENDORED_DIRS loop, same corrupt-tarball error
23
+ * when a directory is missing from the extracted tree), except it clears engine/ first: unlike a
24
+ * brand new project's empty target, an existing engine/ may hold files a since-removed
25
+ * VENDORED_DIRS entry left behind, or a leftover from a bad manual edit, and cpSync alone would
26
+ * merge over those rather than remove them.
27
+ *
28
+ * That "clear first" step is exactly why every VENDORED_DIRS source is validated to exist
29
+ * *before* engine/ is touched at all, in its own pass below: scaffoldProject can afford to check
30
+ * existence inside its copy loop because its target starts empty, so a missing source just leaves
31
+ * a partially-populated (but otherwise harmless) new directory. Here the target is a live
32
+ * project's engine/, already rm'd — the same ordering would demolish it and fail partway through
33
+ * repopulating it, and a project not under version control has no way to recover that.
34
+ */
35
+ export declare function upgradeProject(options: UpgradeOptions): UpgradeResult;
@@ -0,0 +1,63 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { CliError } from '../errors.js';
4
+ import { VENDORED_DIRS, PLATFORM_GENERATED_FILES } from './project.js';
5
+ /**
6
+ * Refreshes the platform-owned parts of a scaffolded project in place, and nothing else. This is
7
+ * the file-boundary described in the task brief: `engine/` (every VENDORED_DIRS entry) and
8
+ * sw-cache-buster.js are wholesale-replaced, the config files in PLATFORM_GENERATED_FILES are
9
+ * re-rendered, and bitmagic.json is read-modified-written so only its engineVersion field
10
+ * changes. Everything else on disk — src/, world.json, game.json, package.json, AGENTS.md,
11
+ * CLAUDE.md, .claude/, .gitignore — is never opened.
12
+ *
13
+ * Mirrors scaffoldProject's copy behaviour (same VENDORED_DIRS loop, same corrupt-tarball error
14
+ * when a directory is missing from the extracted tree), except it clears engine/ first: unlike a
15
+ * brand new project's empty target, an existing engine/ may hold files a since-removed
16
+ * VENDORED_DIRS entry left behind, or a leftover from a bad manual edit, and cpSync alone would
17
+ * merge over those rather than remove them.
18
+ *
19
+ * That "clear first" step is exactly why every VENDORED_DIRS source is validated to exist
20
+ * *before* engine/ is touched at all, in its own pass below: scaffoldProject can afford to check
21
+ * existence inside its copy loop because its target starts empty, so a missing source just leaves
22
+ * a partially-populated (but otherwise harmless) new directory. Here the target is a live
23
+ * project's engine/, already rm'd — the same ordering would demolish it and fail partway through
24
+ * repopulating it, and a project not under version control has no way to recover that.
25
+ */
26
+ export function upgradeProject(options) {
27
+ const { root, extractedEngineDir, engineVersion } = options;
28
+ const replaced = [];
29
+ for (const dir of VENDORED_DIRS) {
30
+ const source = path.join(extractedEngineDir, dir);
31
+ if (!fs.existsSync(source)) {
32
+ throw new CliError(`The engine bundle has no "${dir}" directory at ${source}. The tarball is incomplete or corrupt.`);
33
+ }
34
+ }
35
+ const engineDir = path.join(root, 'engine');
36
+ fs.rmSync(engineDir, { recursive: true, force: true });
37
+ fs.mkdirSync(engineDir, { recursive: true });
38
+ for (const dir of VENDORED_DIRS) {
39
+ fs.cpSync(path.join(extractedEngineDir, dir), path.join(engineDir, dir), { recursive: true });
40
+ }
41
+ replaced.push('engine/');
42
+ // Same "missing is not corrupt" allowance as scaffoldProject: a tarball published before this
43
+ // feature shipped simply won't have it, and upgrade must not fail a project onto that tarball.
44
+ const serviceWorker = path.join(extractedEngineDir, 'sw-cache-buster.js');
45
+ if (fs.existsSync(serviceWorker)) {
46
+ fs.cpSync(serviceWorker, path.join(root, 'sw-cache-buster.js'));
47
+ replaced.push('sw-cache-buster.js');
48
+ }
49
+ for (const [name, render] of PLATFORM_GENERATED_FILES) {
50
+ fs.writeFileSync(path.join(root, name), render());
51
+ replaced.push(name);
52
+ }
53
+ // Read-modify-write, not re-rendered from renderBitmagicJson: re-rendering would discard any
54
+ // field a later CLI/engine version adds to the metadata that this version doesn't know about.
55
+ const bitmagicJsonPath = path.join(root, 'bitmagic.json');
56
+ const meta = JSON.parse(fs.readFileSync(bitmagicJsonPath, 'utf-8'));
57
+ const previousEngineVersion = typeof meta.engineVersion === 'string' ? meta.engineVersion : '';
58
+ meta.engineVersion = engineVersion;
59
+ fs.writeFileSync(bitmagicJsonPath, `${JSON.stringify(meta, null, 2)}\n`);
60
+ replaced.push('bitmagic.json');
61
+ return { engineVersion, previousEngineVersion, replaced };
62
+ }
63
+ //# sourceMappingURL=upgrade-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade-project.js","sourceRoot":"","sources":["../../src/scaffold/upgrade-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAiBvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAAC,OAAuB;IACpD,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAC5D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAA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AC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,6FAA6F;IAC7F,8FAA8F;IAC9F,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAA4B,CAAC;IAC/F,MAAM,qBAAqB,GAAG,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/F,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACnC,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACzE,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE/B,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { VerifyResult } from './classify.js';
2
+ export declare const VERIFY_RESULT_FILENAME = "result.json";
3
+ /**
4
+ * What `bitmagic verify` observed, written so `bitmagic publish` can gate on it.
5
+ *
6
+ * `fingerprint` is what makes the record trustworthy later: it names the exact project state
7
+ * that was verified, so publish can tell "verified and unchanged" from "verified, then edited".
8
+ */
9
+ export interface VerifyRunRecord {
10
+ ok: boolean;
11
+ failures: string[];
12
+ warnings: string[];
13
+ fingerprint: string;
14
+ /** ISO 8601. Reported to the creator; never used to decide staleness. */
15
+ at: string;
16
+ }
17
+ export declare function writeVerifyRecord(artifactDir: string, record: VerifyRunRecord): void;
18
+ /**
19
+ * The last recorded run, or `null` if there is none to trust.
20
+ *
21
+ * Unreadable and malformed both read as null on purpose. This is not swallowing an error: the
22
+ * caller's next move is identical in all three cases — tell the creator to run `bitmagic
23
+ * verify` — and a partially-parsed record would be a worse thing to gate a publish on than no
24
+ * record at all.
25
+ */
26
+ export declare function readVerifyRecord(artifactDir: string): VerifyRunRecord | null;
27
+ /**
28
+ * What a classified verify run produces: the record to write, and whether the command then
29
+ * fails.
30
+ *
31
+ * Split out of the command so the ORDER is testable. The record must be written even when the
32
+ * run failed — publish distinguishes "verify failed" from "verify never ran", and those have
33
+ * different messages and different remedies. Inside `run()` that ordering is only observable by
34
+ * spawning vite and a browser, which is why it went unguarded.
35
+ */
36
+ export declare function decideVerifyOutcome(result: VerifyResult, fingerprint: string, at: string): {
37
+ record: VerifyRunRecord;
38
+ shouldThrow: boolean;
39
+ };
40
+ export interface VerifyReporter {
41
+ write: (artifactDir: string, record: VerifyRunRecord) => void;
42
+ info: (line: string) => void;
43
+ error: (line: string) => void;
44
+ }
45
+ /**
46
+ * Record the run, report it, and fail the command if it did not pass.
47
+ *
48
+ * The record is written BEFORE the throw and regardless of the verdict, because publish
49
+ * distinguishes "verify failed" from "verify never ran" and those have different remedies.
50
+ * That ordering lives here, behind injectable seams, precisely so a test can prove the record
51
+ * survives a failing run — inside `run()` it was observable only by spawning vite and a browser,
52
+ * which is why it went unguarded.
53
+ */
54
+ export declare function recordAndGateVerify(artifactDir: string, outcome: {
55
+ record: VerifyRunRecord;
56
+ shouldThrow: boolean;
57
+ }, paths: {
58
+ consolePath: string;
59
+ screenshotPath: string;
60
+ }, reporter: VerifyReporter): void;
@@ -0,0 +1,74 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { CliError } from '../errors.js';
4
+ export const VERIFY_RESULT_FILENAME = 'result.json';
5
+ export function writeVerifyRecord(artifactDir, record) {
6
+ fs.mkdirSync(artifactDir, { recursive: true });
7
+ fs.writeFileSync(path.join(artifactDir, VERIFY_RESULT_FILENAME), `${JSON.stringify(record, null, 2)}\n`);
8
+ }
9
+ function isRecord(value) {
10
+ if (typeof value !== 'object' || value === null)
11
+ return false;
12
+ const r = value;
13
+ return (typeof r.ok === 'boolean'
14
+ && Array.isArray(r.failures)
15
+ && r.failures.every((f) => typeof f === 'string')
16
+ && Array.isArray(r.warnings)
17
+ && r.warnings.every((w) => typeof w === 'string')
18
+ && typeof r.fingerprint === 'string'
19
+ && typeof r.at === 'string');
20
+ }
21
+ /**
22
+ * The last recorded run, or `null` if there is none to trust.
23
+ *
24
+ * Unreadable and malformed both read as null on purpose. This is not swallowing an error: the
25
+ * caller's next move is identical in all three cases — tell the creator to run `bitmagic
26
+ * verify` — and a partially-parsed record would be a worse thing to gate a publish on than no
27
+ * record at all.
28
+ */
29
+ export function readVerifyRecord(artifactDir) {
30
+ try {
31
+ const parsed = JSON.parse(fs.readFileSync(path.join(artifactDir, VERIFY_RESULT_FILENAME), 'utf-8'));
32
+ return isRecord(parsed) ? parsed : null;
33
+ }
34
+ catch {
35
+ return null;
36
+ }
37
+ }
38
+ /**
39
+ * What a classified verify run produces: the record to write, and whether the command then
40
+ * fails.
41
+ *
42
+ * Split out of the command so the ORDER is testable. The record must be written even when the
43
+ * run failed — publish distinguishes "verify failed" from "verify never ran", and those have
44
+ * different messages and different remedies. Inside `run()` that ordering is only observable by
45
+ * spawning vite and a browser, which is why it went unguarded.
46
+ */
47
+ export function decideVerifyOutcome(result, fingerprint, at) {
48
+ return {
49
+ record: { ok: result.ok, failures: result.failures, warnings: result.warnings, fingerprint, at },
50
+ shouldThrow: !result.ok,
51
+ };
52
+ }
53
+ /**
54
+ * Record the run, report it, and fail the command if it did not pass.
55
+ *
56
+ * The record is written BEFORE the throw and regardless of the verdict, because publish
57
+ * distinguishes "verify failed" from "verify never ran" and those have different remedies.
58
+ * That ordering lives here, behind injectable seams, precisely so a test can prove the record
59
+ * survives a failing run — inside `run()` it was observable only by spawning vite and a browser,
60
+ * which is why it went unguarded.
61
+ */
62
+ export function recordAndGateVerify(artifactDir, outcome, paths, reporter) {
63
+ reporter.write(artifactDir, outcome.record);
64
+ for (const warning of outcome.record.warnings)
65
+ reporter.info(`warning: ${warning}`);
66
+ if (outcome.shouldThrow) {
67
+ for (const failure of outcome.record.failures)
68
+ reporter.error(`✗ ${failure}`);
69
+ reporter.error(`\nArtifacts: ${paths.consolePath}, ${paths.screenshotPath}`);
70
+ throw new CliError('Verification failed.');
71
+ }
72
+ reporter.info(`Verification passed. Artifacts in ${artifactDir}`);
73
+ }
74
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/verify/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAiBpD,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,MAAuB;IAC5E,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,sBAAsB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3G,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,CACL,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS;WACtB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;WACxB,CAAC,CAAC,QAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;WAC7D,KAAK,CAAC,OAAO,CA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AY,OAAO,EAAE,CAAC,CAAC;IACpF,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ;YAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9E,QAAQ,CAAC,KAAK,CAAC,gBAAgB,KAAK,CAAC,WAAW,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC;QAC7E,MAAM,IAAI,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,qCAAqC,WAAW,EAAE,CAAC,CAAC;AACpE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitmagic/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Build Bitmagic games from your own agent tool",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,8 +19,8 @@
19
19
  "citty": "^0.2.2",
20
20
  "playwright-core": "^1.59.1",
21
21
  "tar": "^7.4.3",
22
- "@bitmagic/asset-core": "0.1.0",
23
- "@bitmagic/world-forger": "0.1.3"
22
+ "@bitmagic/world-forger": "0.1.3",
23
+ "@bitmagic/asset-core": "0.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@eslint/js": "^9.38.0",