@bitmagic/cli 0.1.8 → 0.1.10

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.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Which package manager a scaffolded project is installed with, and the command lines that
3
+ * follow from it.
4
+ *
5
+ * Every command that tells a creator to install something prints a line meant to be run
6
+ * verbatim — by a person or by the agent driving this CLI. Naming the wrong manager is not
7
+ * cosmetic: running `npm install` in a pnpm project rewrites the tree under a different linker,
8
+ * and the very next `bitmagic build` fails on module resolution. That turns one clear instruction
9
+ * into a second, far more opaque failure — precisely the trap `bitmagic upgrade`'s dependency
10
+ * report and `projectBin`'s missing-binary error both exist to keep creators out of.
11
+ *
12
+ * Kept in `project/` rather than inside a command, because both `commands/upgrade.ts` and
13
+ * `project/context.ts` need it and a command module must not be imported from `project/`.
14
+ */
15
+ import * as fs from 'fs';
16
+ import * as path from 'path';
17
+ /**
18
+ * Decide from the project's lockfile. npm is the fallback: it is what the scaffold's own docs
19
+ * use and what ships with Node, so it is the right guess when there is no lockfile at all.
20
+ *
21
+ * Checked most-specific-first — a repo can carry both a `pnpm-lock.yaml` and a leftover
22
+ * `package-lock.json`, and pnpm is the one actually in use there.
23
+ */
24
+ export function detectPackageManager(root) {
25
+ if (fs.existsSync(path.join(root, 'pnpm-lock.yaml')))
26
+ return 'pnpm';
27
+ if (fs.existsSync(path.join(root, 'yarn.lock')))
28
+ return 'yarn';
29
+ return 'npm';
30
+ }
31
+ /**
32
+ * The command that adds `specs` as (dev) dependencies. yarn's syntax differs from npm's and
33
+ * pnpm's (`yarn add --dev`, not `--save-dev`), which is why this is a function rather than a
34
+ * template string at each call site.
35
+ */
36
+ export function addCommand(manager, dev, specs) {
37
+ const joined = specs.join(' ');
38
+ if (manager === 'yarn')
39
+ return `yarn add ${dev ? '--dev ' : ''}${joined}`;
40
+ if (manager === 'pnpm')
41
+ return `pnpm add ${dev ? '--save-dev ' : ''}${joined}`;
42
+ return `npm install ${dev ? '--save-dev ' : ''}${joined}`;
43
+ }
44
+ /** The command that installs everything already declared in package.json. */
45
+ export function installAllCommand(manager) {
46
+ return `${manager} install`;
47
+ }
48
+ //# sourceMappingURL=package-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../src/project/package-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC;IACpE,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/D,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAuB,EAAE,GAAY,EAAE,KAAe;IAC/E,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,YAAY,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1E,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,YAAY,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;IAC/E,OAAO,eAAe,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;AAC5D,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,OAAuB;IACvD,OAAO,GAAG,OAAO,UAAU,CAAC;AAC9B,CAAC"}
@@ -27,5 +27,11 @@ export declare function readBuildManifest(root: string): BuildManifest | null;
27
27
  *
28
28
  * Exit code 1 on failure, matching the table in the spec: a build failure is the creator's own
29
29
  * code, and the compiler's output has already been printed.
30
+ *
31
+ * The pre-flight below runs BEFORE `tsc`, not after: a project scaffolded before
32
+ * `vite.publish.config.js` existed has no config for vite to load, and without this check the
33
+ * creator pays a full type-check and then reads a raw vite "config not found" that names no
34
+ * remedy. `bitmagic upgrade` is the remedy — it vendors the file without touching game code —
35
+ * so the error says so.
30
36
  */
31
37
  export declare function runBuild(root: string, engineVersion: string): BuildManifest;
@@ -41,8 +41,19 @@ export function readBuildManifest(root) {
41
41
  *
42
42
  * Exit code 1 on failure, matching the table in the spec: a build failure is the creator's own
43
43
  * code, and the compiler's output has already been printed.
44
+ *
45
+ * The pre-flight below runs BEFORE `tsc`, not after: a project scaffolded before
46
+ * `vite.publish.config.js` existed has no config for vite to load, and without this check the
47
+ * creator pays a full type-check and then reads a raw vite "config not found" that names no
48
+ * remedy. `bitmagic upgrade` is the remedy — it vendors the file without touching game code —
49
+ * so the error says so.
44
50
  */
45
51
  export function runBuild(root, engineVersion) {
52
+ if (!fs.existsSync(path.join(root, VITE_PUBLISH_CONFIG))) {
53
+ throw new CliError(`This project has no ${VITE_PUBLISH_CONFIG}, which \`bitmagic build\` needs to bundle it. ` +
54
+ 'It was added to the scaffold after this project was created — run `bitmagic upgrade` to ' +
55
+ 'vendor it (your game code is not touched), then build again.', 1);
56
+ }
46
57
  const tsc = projectBin(root, 'tsc');
47
58
  const compile = spawnSync(tsc, [], { cwd: root, stdio: 'inherit' });
48
59
  if (compile.error)
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/publish/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,e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CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3D,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAClC,CAAC;IACF,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,94 @@
1
+ import type { Environment } from '../config/environments.js';
2
+ export interface ApiDeps {
3
+ fetch: typeof globalThis.fetch;
4
+ }
5
+ /**
6
+ * One status→exit-code mapping for both publish calls.
7
+ *
8
+ * The distinction that matters is 4 vs 5: "your engine is too old" is self-serve
9
+ * (`bitmagic upgrade`), while a ban or an ownership mismatch is not. An agent that cannot
10
+ * tell them apart will either loop on upgrade or give up on a fixable problem.
11
+ */
12
+ export declare function publishExitCode(status: number, body: {
13
+ code?: string;
14
+ }): number;
15
+ export interface BeginPublishRequest {
16
+ gameId: string;
17
+ visibility: 'public' | 'private';
18
+ name?: string;
19
+ description?: string;
20
+ engineVersion: string;
21
+ thumbnailUrl: string;
22
+ }
23
+ export interface BeginPublishResponse {
24
+ signedUrl: string;
25
+ key: string;
26
+ publishVersion: number;
27
+ metaBlock: string;
28
+ cacheControl: string;
29
+ }
30
+ export declare function beginPublish(environment: Environment, accessToken: string, body: BeginPublishRequest, deps: ApiDeps): Promise<BeginPublishResponse>;
31
+ export interface CompletePublishRequest {
32
+ gameId: string;
33
+ key: string;
34
+ publishVersion: number;
35
+ visibility: 'public' | 'private';
36
+ name?: string;
37
+ description?: string;
38
+ thumbnailUrl: string;
39
+ bundleBytes: number;
40
+ sha256: string;
41
+ /**
42
+ * The audit trail the spec calls for: `engineVersion`, `fingerprint` and `sha256` recorded
43
+ * together for the publish that actually landed. All three are declarative — the server logs
44
+ * them, it does not verify them (there is no column for any of them today, and verifying the
45
+ * hash would mean reading bytes this design deliberately never reads).
46
+ *
47
+ * `engineVersion` is NOT a second floor gate. It cannot be: `begin` is the only step that
48
+ * mints the signed URL, so its floor check is already unavoidable, and a value re-declared
49
+ * here proves nothing about what the bundle was built with. It is sent so the log line that
50
+ * records a publish says which engine produced it — without it, the only record of a bundle's
51
+ * engine is a `begin` log entry that may belong to an abandoned attempt.
52
+ *
53
+ * `fingerprint` is the same hash `verify` recorded and `publish` gated on, so a support
54
+ * question about a published bundle can be tied back to the exact project state that produced
55
+ * it. Nothing else on the wire identifies the source.
56
+ */
57
+ engineVersion: string;
58
+ fingerprint: string;
59
+ }
60
+ export interface CompletePublishResponse {
61
+ url: string;
62
+ publishVersion: number;
63
+ visibility: 'public' | 'private';
64
+ }
65
+ export declare function completePublish(environment: Environment, accessToken: string, body: CompletePublishRequest, deps: ApiDeps): Promise<CompletePublishResponse>;
66
+ /**
67
+ * `begin` always signs `text/html` for the entry HTML (cli-publish.ts's `getSignedUrl` call) but
68
+ * does not echo a `contentType` field back in its response — there is nothing to echo, so this
69
+ * fixed value is the one Content-Type that can ever be correct for the PUT.
70
+ */
71
+ export declare const PUBLISH_BUNDLE_CONTENT_TYPE = "text/html";
72
+ /** PUT the built (and meta-block-injected) bundle to the signed URL `begin` minted. */
73
+ export declare function putBundle(signedUrl: string, html: string, cacheControl: string, deps: ApiDeps): Promise<void>;
74
+ export interface ThumbnailUploadRequest {
75
+ gameId: string;
76
+ filename: string;
77
+ contentType: string;
78
+ }
79
+ /** `cli-uploads.ts`'s `generateUploadSignedUrl` response shape, the fields this lane uses. */
80
+ export interface ThumbnailUploadUrl {
81
+ signedUrl: string;
82
+ publicUrl: string;
83
+ cacheControl: string;
84
+ contentEncoding?: string;
85
+ }
86
+ export declare function requestThumbnailUploadUrl(environment: Environment, accessToken: string, body: ThumbnailUploadRequest, deps: ApiDeps): Promise<ThumbnailUploadUrl>;
87
+ /**
88
+ * PUT the thumbnail bytes to the signed URL `requestThumbnailUploadUrl` minted. `contentType` is
89
+ * the SAME value this lane requested (the server never echoes it back — see
90
+ * `PUBLISH_BUNDLE_CONTENT_TYPE`'s doc comment for why that is fine: the caller already knows it),
91
+ * while `cacheControl` and `contentEncoding` are read back from the signed-URL response, because
92
+ * the server — not this lane — decides both.
93
+ */
94
+ export declare function putThumbnail(signed: ThumbnailUploadUrl, bytes: Uint8Array, contentType: string, deps: ApiDeps): Promise<void>;
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The HTTP client for `bitmagic publish`: the two authorizing calls to api-server
3
+ * (`publish/begin`, `publish/complete`), the thumbnail's signed-upload lane
4
+ * (`uploads/signed-url`, the same route `forge/upload-proxy.ts` bridges for the browser), and the
5
+ * two raw PUTs against the signed GCS URLs those calls mint.
6
+ *
7
+ * `publishExitCode` is the one status→exit-code mapping every call above shares, so `publish.ts`
8
+ * never has to duplicate the 401/403/409 distinctions per call site.
9
+ */
10
+ import { CliError } from '../errors.js';
11
+ function isRecord(value) {
12
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
13
+ }
14
+ function stringField(value) {
15
+ return typeof value === 'string' ? value : undefined;
16
+ }
17
+ async function readJsonBody(response) {
18
+ try {
19
+ const parsed = await response.json();
20
+ return isRecord(parsed) ? parsed : {};
21
+ }
22
+ catch {
23
+ return {};
24
+ }
25
+ }
26
+ /**
27
+ * One status→exit-code mapping for both publish calls.
28
+ *
29
+ * The distinction that matters is 4 vs 5: "your engine is too old" is self-serve
30
+ * (`bitmagic upgrade`), while a ban or an ownership mismatch is not. An agent that cannot
31
+ * tell them apart will either loop on upgrade or give up on a fixable problem.
32
+ */
33
+ export function publishExitCode(status, body) {
34
+ if (status === 401)
35
+ return 2;
36
+ if (status === 403)
37
+ return 5;
38
+ if (status === 409 && body.code === 'engine-below-floor')
39
+ return 4;
40
+ return 6;
41
+ }
42
+ /**
43
+ * POST `path` as JSON with a bearer token, and map a non-2xx response through `publishExitCode`.
44
+ * Shared by every authenticated JSON call this module makes — begin, complete, and the thumbnail
45
+ * signed-URL mint — so the three cannot drift on how a failure is reported.
46
+ */
47
+ async function postJson(url, accessToken, body, deps) {
48
+ let response;
49
+ try {
50
+ response = await deps.fetch(url, {
51
+ method: 'POST',
52
+ headers: {
53
+ Authorization: `Bearer ${accessToken}`,
54
+ Accept: 'application/json',
55
+ 'Content-Type': 'application/json',
56
+ },
57
+ body: JSON.stringify(body),
58
+ });
59
+ }
60
+ catch {
61
+ // A transport failure and an error status send people to very different places.
62
+ throw new CliError(`Cannot reach api-server at ${url}.`, 6);
63
+ }
64
+ // A 2xx response MUST parse as a JSON object — this is the one branch that feeds its result
65
+ // straight back to the caller as `T` with no further validation (`beginPublish`'s `signedUrl`,
66
+ // `completePublish`'s `url`, ...). Falling back to `{}` here the way the error branch below
67
+ // does would silently turn a malformed 200 into every field of `T` being `undefined` — e.g. a
68
+ // PUT sent to the literal string `"undefined"` — instead of a clear failure at the point the
69
+ // bad response actually arrived.
70
+ if (response.ok) {
71
+ let parsed;
72
+ try {
73
+ parsed = await response.json();
74
+ }
75
+ catch {
76
+ throw new CliError(`api-server returned a ${response.status} from ${url} with a body that is not valid JSON.`, 6);
77
+ }
78
+ if (!isRecord(parsed)) {
79
+ throw new CliError(`api-server returned an unexpected response shape from ${url}.`, 6);
80
+ }
81
+ return parsed;
82
+ }
83
+ // The error path can tolerate an unparsable/absent body — the fallback is just a generic
84
+ // message, not a value silently flowing on to become someone else's `undefined`.
85
+ const parsedError = await readJsonBody(response);
86
+ const code = stringField(parsedError.code);
87
+ const message = stringField(parsedError.error) ?? `api-server returned HTTP ${response.status} for ${url}.`;
88
+ throw new CliError(message, publishExitCode(response.status, { code }));
89
+ }
90
+ /**
91
+ * Raw PUT of already-prepared bytes to a GCS V4 signed URL.
92
+ *
93
+ * `headers` must match exactly what the URL's signature bound (Cache-Control, and — for the
94
+ * thumbnail lane — Content-Encoding when the server chose to gzip). A mismatch is a 403 from GCS,
95
+ * not a stale-cache symptom; see cli-publish.ts's and cli-uploads.ts's own doc comments for why.
96
+ */
97
+ async function putSignedUrl(url, body, headers, deps) {
98
+ let response;
99
+ try {
100
+ // `@types/node`'s ambient `Uint8Array` (generic over `ArrayBufferLike` since TS 5.7) does not
101
+ // structurally match this project's `BodyInit` (this tsconfig's `"DOM"` lib pulls in lib.dom's
102
+ // own copy, which `@types/node`'s conditional global-augmentation defers to whenever DOM
103
+ // globals are present — see node_modules/@types/node/web-globals/fetch.d.ts). Deriving the
104
+ // body type from `Parameters<typeof fetch>[1]` instead of naming `BodyInit` was tried and hits
105
+ // the identical mismatch, because it resolves to the same lib.dom type in THIS project. Both a
106
+ // `string` and a `Uint8Array` are valid `fetch` bodies at runtime regardless.
107
+ response = await deps.fetch(url, { method: 'PUT', headers, body: body });
108
+ }
109
+ catch (error) {
110
+ const message = error instanceof Error ? error.message : String(error);
111
+ throw new CliError(`Could not upload to storage: ${message}`, 6);
112
+ }
113
+ if (!response.ok) {
114
+ const text = await response.text().catch(() => '');
115
+ throw new CliError(`Upload to storage failed: HTTP ${response.status}${text ? ` — ${text.slice(0, 200)}` : ''}`, 6);
116
+ }
117
+ }
118
+ export async function beginPublish(environment, accessToken, body, deps) {
119
+ return postJson(`${environment.apiUrl}/api/cli/v1/publish/begin`, accessToken, body, deps);
120
+ }
121
+ export async function completePublish(environment, accessToken, body, deps) {
122
+ return postJson(`${environment.apiUrl}/api/cli/v1/publish/complete`, accessToken, body, deps);
123
+ }
124
+ /**
125
+ * `begin` always signs `text/html` for the entry HTML (cli-publish.ts's `getSignedUrl` call) but
126
+ * does not echo a `contentType` field back in its response — there is nothing to echo, so this
127
+ * fixed value is the one Content-Type that can ever be correct for the PUT.
128
+ */
129
+ export const PUBLISH_BUNDLE_CONTENT_TYPE = 'text/html';
130
+ /** PUT the built (and meta-block-injected) bundle to the signed URL `begin` minted. */
131
+ export async function putBundle(signedUrl, html, cacheControl, deps) {
132
+ await putSignedUrl(signedUrl, html, { 'Content-Type': PUBLISH_BUNDLE_CONTENT_TYPE, 'Cache-Control': cacheControl }, deps);
133
+ }
134
+ export async function requestThumbnailUploadUrl(environment, accessToken, body, deps) {
135
+ return postJson(`${environment.apiUrl}/api/cli/v1/uploads/signed-url`, accessToken, body, deps);
136
+ }
137
+ /**
138
+ * PUT the thumbnail bytes to the signed URL `requestThumbnailUploadUrl` minted. `contentType` is
139
+ * the SAME value this lane requested (the server never echoes it back — see
140
+ * `PUBLISH_BUNDLE_CONTENT_TYPE`'s doc comment for why that is fine: the caller already knows it),
141
+ * while `cacheControl` and `contentEncoding` are read back from the signed-URL response, because
142
+ * the server — not this lane — decides both.
143
+ */
144
+ export async function putThumbnail(signed, bytes, contentType, deps) {
145
+ const headers = { 'Content-Type': contentType, 'Cache-Control': signed.cacheControl };
146
+ if (signed.contentEncoding)
147
+ headers['Content-Encoding'] = signed.contentEncoding;
148
+ await putSignedUrl(signed.signedUrl, bytes, headers, deps);
149
+ }
150
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/publish/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAYxC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,QAAuB;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM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CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA0B,EAC1B,KAAiB,EACjB,WAAmB,EACnB,IAAa;IAEb,MAAM,OAAO,GAA2B,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;IAC9G,IAAI,MAAM,CAAC,eAAe;QAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC;IACjF,MAAM,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAC7D,CAAC"}
@@ -4,10 +4,28 @@ import * as path from 'path';
4
4
  /**
5
5
  * Directories whose contents never change what the bundle contains: our own artifacts
6
6
  * (`.bitmagic/`, `dist/`), the dependency tree (`node_modules/` — pinned by the lockfile the
7
- * scaffold writes), and vite's cache. Including any of them would make the fingerprint change
8
- * on every build, which would make the staleness gate reject every publish.
7
+ * scaffold writes), vite's cache, and git's object store. Including any of them would make the
8
+ * fingerprint change on something other than an edit, which would make the staleness gate reject
9
+ * a publish of an unchanged project.
10
+ *
11
+ * `.git` is the one that bit in practice. Hashing it means an EMPTY `git commit` — no source
12
+ * change at all — flips the fingerprint, because the commit writes new objects, a new ref value
13
+ * and a new reflog entry. That turns the ordinary `bitmagic verify` → `git commit` →
14
+ * `bitmagic publish` sequence into exit 3 ("The project has changed since it was last verified"),
15
+ * and `bitmagic upgrade` actively pushes creators into git by refusing a dirty tree. The
16
+ * scaffolded AGENTS.md's "do not edit any tracked file between verifying and publishing" cannot
17
+ * prevent it either: committing is not editing. It also made every publish rebuild, since the
18
+ * build manifest's own recorded fingerprint could never still match by the time publish ran.
19
+ *
20
+ * `.DS_Store` is excluded for the same reason at file granularity: on macOS, Finder writes it
21
+ * merely for opening the project folder, and no build tool ever reads it — so it is another way
22
+ * to flip the fingerprint without editing anything. It is the only excluded FILE; the list is
23
+ * deliberately not a general ignore mechanism, because a false "fresh" ships an unverified
24
+ * bundle while a false "stale" only costs one `bitmagic verify`.
9
25
  */
10
- const EXCLUDED_DIRS = new Set(['.bitmagic', 'node_modules', 'dist', '.vite-cache']);
26
+ const EXCLUDED_DIRS = new Set(['.bitmagic', 'node_modules', 'dist', '.vite-cache', '.git']);
27
+ /** See EXCLUDED_DIRS: tool-written files that can never change what the bundle contains. */
28
+ const EXCLUDED_FILES = new Set(['.DS_Store']);
11
29
  /**
12
30
  * A relative path as the fingerprint hashes it: always forward-slashed.
13
31
  *
@@ -27,6 +45,8 @@ function walk(dir, root, out) {
27
45
  walk(path.join(dir, entry.name), root, out);
28
46
  }
29
47
  else if (entry.isFile()) {
48
+ if (EXCLUDED_FILES.has(entry.name))
49
+ continue;
30
50
  const relPath = path.relative(root, path.join(dir, entry.name));
31
51
  out.push(toPosixPath(relPath));
32
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../src/publish/fingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,YAAoB,EAAE,MAAc,IAAI,CAAC,GAAG;IACtE,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,IAAI,CAAC,GAAW,EAAE,IAAY,EAAE,GAAa;IACpD,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CA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,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAChE,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACxB,KAAK,CAAC,IAAI,EAAE,CAAC;IAEb,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { VerifyRunRecord } from '../verify/result.js';
2
+ /**
3
+ * Put the server-issued block immediately after `<head>`, matching where the web lane puts its
4
+ * own meta tags — and close enough to the start of the file that the server's 64KB range read
5
+ * always covers it.
6
+ *
7
+ * String insertion, not DOM parsing: this HTML carries the whole inlined engine.
8
+ */
9
+ export declare function injectMetaBlock(html: string, block: string): string;
10
+ export type VerifyGate = {
11
+ ok: true;
12
+ } | {
13
+ ok: false;
14
+ message: string;
15
+ };
16
+ /**
17
+ * May this project be published?
18
+ *
19
+ * Three distinct answers, deliberately: "never verified", "verified then edited", and "verified
20
+ * and broken" have three different fixes, and collapsing them into "run verify" is how an agent
21
+ * ends up looping verify against a game that is genuinely broken.
22
+ *
23
+ * `force` overrides the VERDICT and STALENESS, not the existence of a record: the thumbnail comes
24
+ * from the verify screenshot, so with no verify there is nothing to publish a thumbnail from.
25
+ */
26
+ export declare function checkVerifyGate(record: VerifyRunRecord | null, fingerprint: string, force: boolean): VerifyGate;
@@ -0,0 +1,48 @@
1
+ import { CliError } from '../errors.js';
2
+ const HEAD_OPEN = '<head>';
3
+ /**
4
+ * Put the server-issued block immediately after `<head>`, matching where the web lane puts its
5
+ * own meta tags — and close enough to the start of the file that the server's 64KB range read
6
+ * always covers it.
7
+ *
8
+ * String insertion, not DOM parsing: this HTML carries the whole inlined engine.
9
+ */
10
+ export function injectMetaBlock(html, block) {
11
+ if (html.includes('<!--bitmagic:meta:v1-->')) {
12
+ throw new CliError('This bundle already carries a meta block. Run `bitmagic build` again.', 6);
13
+ }
14
+ const at = html.indexOf(HEAD_OPEN);
15
+ if (at === -1) {
16
+ throw new CliError('The built bundle has no <head> to inject into.', 1);
17
+ }
18
+ const cut = at + HEAD_OPEN.length;
19
+ return html.slice(0, cut) + block + html.slice(cut);
20
+ }
21
+ /**
22
+ * May this project be published?
23
+ *
24
+ * Three distinct answers, deliberately: "never verified", "verified then edited", and "verified
25
+ * and broken" have three different fixes, and collapsing them into "run verify" is how an agent
26
+ * ends up looping verify against a game that is genuinely broken.
27
+ *
28
+ * `force` overrides the VERDICT and STALENESS, not the existence of a record: the thumbnail comes
29
+ * from the verify screenshot, so with no verify there is nothing to publish a thumbnail from.
30
+ */
31
+ export function checkVerifyGate(record, fingerprint, force) {
32
+ if (record === null) {
33
+ return { ok: false, message: 'This game has not been verified. Run `bitmagic verify` first.' };
34
+ }
35
+ if (force)
36
+ return { ok: true };
37
+ if (record.fingerprint !== fingerprint) {
38
+ return { ok: false, message: 'The project has changed since it was last verified. Run `bitmagic verify` again.' };
39
+ }
40
+ if (!record.ok) {
41
+ return {
42
+ ok: false,
43
+ message: `The last verify failed:\n${record.failures.map((f) => ` ✗ ${f}`).join('\n')}\nFix these, or publish with --force.`,
44
+ };
45
+ }
46
+ return { ok: true };
47
+ }
48
+ //# sourceMappingURL=meta-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta-block.js","sourceRoot":"","sources":["../../src/publish/meta-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IACzD,IAAI,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,QAAQ,CAAC,uEAAuE,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACd,MAAM,IAAI,QAAQ,CAAC,gDAAgD,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,GAAG,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAID;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA8B,EAC9B,WAAmB,EACnB,KAAc;IAEd,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,+DAA+D,EAAE,CAAC;IACjG,CAAC;IACD,IAAI,KAAK;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IAC/B,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,kFAAkF,EAAE,CAAC;IACpH,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE,4BAA4B,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,uCAAuC;SAC9H,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -252,6 +252,19 @@ import { viteSingleFile } from 'vite-plugin-singlefile';
252
252
  // since Rollup then just treats the unmatched id as an unresolved bare specifier and fails the
253
253
  // build. Verified against a real \`vite build\` before trusting the plain-string form.
254
254
  export default defineConfig({
255
+ // The engine serves world.json/game.json two different ways, and this flag is how it chooses.
256
+ // \`utils/worldDataLoader.ts\` reads \`typeof __BUNDLED__ !== 'undefined' && __BUNDLED__\`: true
257
+ // means "the data is inlined in this bundle, import it", false means "fetch it as separate
258
+ // files". A single-file published bundle has no separate files to fetch, so omitting this
259
+ // define does not degrade gracefully — the game boots, then dies at runtime with 404s on
260
+ // src/work/world.json and "world.json not found (neither bundle nor fetch available)".
261
+ //
262
+ // The typeof guard is why nothing catches it at build time: the identifier is genuinely
263
+ // undeclared when /dist is served raw in live-edit mode, so the engine cannot just read it.
264
+ // That makes a missing define invisible until a published game is opened in a browser.
265
+ //
266
+ // Deliberately NOT set in the dev config — live-edit serving must take the fetch path.
267
+ define: { __BUNDLED__: true },
255
268
  resolve: {
256
269
  alias: {
257
270
  ${entries}
@@ -326,6 +339,54 @@ compile that dies on load — a missing asset, a bad \`world.json\` value, a nul
326
339
  \`bitmagic verify\` after a change you cannot eyeball: it loads the game in a headless browser and
327
340
  fails with what actually broke, leaving a console log and a screenshot in \`.bitmagic/verify/\`.
328
341
 
342
+ ## Publishing
343
+
344
+ \`\`\`
345
+ bitmagic build # bundle into .bitmagic/build/index.html + .bitmagic/build/manifest.json
346
+ bitmagic publish # verify-gate, build if needed, and ship to bitmagic.ai
347
+ \`\`\`
348
+
349
+ Follow this order; \`publish\` enforces it and refuses otherwise:
350
+
351
+ 1. Run \`bitmagic verify\` and get it passing. It writes \`.bitmagic/verify/result.json\`,
352
+ \`.bitmagic/verify/screenshot.png\` (becomes the publish thumbnail) and
353
+ \`.bitmagic/verify/console.log\`.
354
+ 2. Do not edit any tracked file between verifying and publishing. Staleness is decided by a
355
+ content fingerprint of every tracked file, not a clock — one edit after verifying invalidates
356
+ it immediately, and an untouched project stays fresh no matter how long it has been. There is
357
+ no way to check freshness except running \`bitmagic verify\` again. Git operations are safe:
358
+ \`.git/\` is excluded from the fingerprint, so committing (or branching, or stashing) between
359
+ verifying and publishing changes nothing. So are \`node_modules/\`, \`dist/\`, \`.bitmagic/\`
360
+ and \`.vite-cache/\`.
361
+ 3. Run \`bitmagic publish\`. It rebuilds automatically if the project changed since the last
362
+ build, so a manual \`bitmagic build\` first is optional.
363
+
364
+ **A bare \`bitmagic publish\` does not make the game public.** Every publish uploads and
365
+ registers the game, but \`visibility\` defaults to \`private\` — reachable by URL, not listed on
366
+ bitmagic.ai. Pass \`--visibility public\` explicitly, on that call, to list it; omit it on a later
367
+ publish and the game goes back to private — its \`/play/\` page stops serving too, so a public
368
+ game you re-publish bare disappears from bitmagic.ai entirely until the next
369
+ \`--visibility public\`.
370
+
371
+ \`--force\` overrides a **stale or failed** verify verdict, never a **missing** one — the
372
+ thumbnail comes from the verify screenshot, so \`bitmagic verify\` must have produced one at least
373
+ once before \`--force\` has anything to publish from.
374
+
375
+ \`--name\`/\`--description\` apply to that one publish call only; they are never written back to
376
+ \`src/work/game.json\` (doing so by hand would change the fingerprint and invalidate the verify
377
+ you just checked).
378
+
379
+ If \`bitmagic publish\` exits non-zero, branch on the exit code rather than parsing the message:
380
+
381
+ | Code | Meaning | Fix |
382
+ |---|---|---|
383
+ | 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\` |
384
+ | 2 | Not logged in | \`bitmagic login\` |
385
+ | 3 | Verify missing, stale, or failed | \`bitmagic verify\` (then publish again, or add \`--force\` for a stale/failed record) |
386
+ | 4 | Engine below the publish floor | \`bitmagic upgrade\` |
387
+ | 5 | Not this game's owner, or the account/game is banned | Not self-serve — stop and report it |
388
+ | 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 |
389
+
329
390
  ## Generating assets
330
391
 
331
392
  You can create game content from here — no web editor needed:
@@ -1 +1 @@
1
- {"version":3,"file":"project-files.js","sourceRoot":"","sources":["../../src/scaffold/project-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,2BAA2B,EAAE,SAAS;IACtC,2BAA2B,EAAE,SAAS;IACtC,kBAAkB,EAAE,QAAQ;IAC5B,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,kCAAkC,EAAE,QAAQ;IAC5C,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,aAAa,EAAE,UAAU;IACzB,cAAc,EAAE,UAAU;IAC1B,8FAA8F;IAC9F,cAAc,EAAE,QAAQ;IACxB,4FAA4F;IAC5F,mFAAmF;IACnF,eAAe,EAAE,SAAS;IAC1B,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,QAAQ;IACd,wBAAwB,EAAE,QAAQ;CACnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,aAAa,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AC9B,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitmagic/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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/world-forger": "0.1.3",
23
- "@bitmagic/asset-core": "0.1.0"
22
+ "@bitmagic/asset-core": "0.1.0",
23
+ "@bitmagic/world-forger": "0.1.3"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@eslint/js": "^9.38.0",