@bitmagic/cli 0.1.41 → 0.1.43

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.
@@ -37,6 +37,12 @@ export function publishExitCode(status, body) {
37
37
  return 5;
38
38
  if (status === 409 && body.code === 'engine-below-floor')
39
39
  return 4;
40
+ // "What you uploaded is not an engine build" is a BUILD failure, not a transient upload one.
41
+ // Mapping it to 6 alongside network errors would tell an agent to retry, and a retry re-uploads
42
+ // the identical bytes and gets the identical refusal — a loop with no exit. Exit 1 is the code
43
+ // whose documented remedy is "look at the build", which is the only thing that can fix this.
44
+ if (status === 409 && body.code === 'not-an-engine-build')
45
+ return 1;
40
46
  return 6;
41
47
  }
42
48
  /**
@@ -131,6 +137,16 @@ export const PUBLISH_BUNDLE_CONTENT_TYPE = 'text/html';
131
137
  export async function putBundle(signedUrl, html, cacheControl, deps) {
132
138
  await putSignedUrl(signedUrl, html, { 'Content-Type': PUBLISH_BUNDLE_CONTENT_TYPE, 'Cache-Control': cacheControl }, deps);
133
139
  }
140
+ /**
141
+ * `begin` signs the source archive as `application/zip`. Fixed here for the same reason as
142
+ * PUBLISH_BUNDLE_CONTENT_TYPE: the response echoes no content type because there is nothing to
143
+ * echo — this is the one value the signature can have been minted with.
144
+ */
145
+ export const PUBLISH_SOURCE_CONTENT_TYPE = 'application/zip';
146
+ /** PUT the source archive to the signed URL `begin` minted. */
147
+ export async function putSourceArchive(signedUrl, body, cacheControl, deps) {
148
+ await putSignedUrl(signedUrl, body, { 'Content-Type': PUBLISH_SOURCE_CONTENT_TYPE, 'Cache-Control': cacheControl }, deps);
149
+ }
134
150
  export async function requestThumbnailUploadUrl(environment, accessToken, body, deps) {
135
151
  return postJson(`${environment.apiUrl}/api/cli/v1/uploads/signed-url`, accessToken, body, deps);
136
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/publish/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;A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,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"}
@@ -1,27 +1,33 @@
1
+ import { type SourceIndex } from '@bitmagic/asset-core/publish-source';
2
+ export { SOURCE_INDEX_ALGO } from '@bitmagic/asset-core/publish-source';
3
+ export type { SourceIndex, SourceIndexEntry } from '@bitmagic/asset-core/publish-source';
1
4
  /**
2
5
  * A relative path as the fingerprint hashes it: always forward-slashed.
3
6
  *
4
- * `sep` is a parameter rather than a direct `path.sep` read so this is testable on any
5
- * platform the Windows behaviour that makes normalization necessary cannot otherwise be
6
- * exercised on the POSIX runners CI uses, which is exactly how a vacuous test gets written.
7
+ * Re-exported through this module (rather than having callers reach into the shared package) so
8
+ * the CLI keeps one import site for path normalisation, and defaults to the host's separator —
9
+ * the shared version defaults to '/' because it is given already-normalised zip entry names.
7
10
  */
8
11
  export declare function toPosixPath(relativePath: string, sep?: string): string;
9
12
  /**
10
- * A hash of everything that determines the published bundle.
13
+ * Every fingerprinted file in the project, hashed, plus the fingerprint they roll up to.
11
14
  *
12
- * This is what lets `publish` decide whether a `verify` is too stale to trust, by CONTENT
13
- * rather than by clock: a timestamp policy would accept an edit made one second after
14
- * verifying and reject an untouched project that merely sat overnight.
15
- *
16
- * The path is hashed alongside the content so that moving a file — which changes what the
17
- * bundle imports — changes the fingerprint even though no byte of any file did.
18
- *
19
- * Kept deliberately coarse (every tracked file, not a module graph): a false "stale" costs one
20
- * `bitmagic verify`, while a false "fresh" ships an unverified bundle.
15
+ * One walk per publish. `runPublish` calls this once and feeds the SAME result to both the
16
+ * staleness gate and the source archive previously the tree was walked twice (once to
17
+ * fingerprint, once to build the artifact), which opened a window for an edit to land between
18
+ * them and gave the exclusion rules two call sites that could drift.
21
19
  *
22
20
  * Any filesystem error (unreadable directory, permission denied, etc.) propagates immediately
23
21
  * rather than being silently omitted: the project source is the creator's own files, so an
24
22
  * unreadable subtree is a real problem worth surfacing, not something to hide. An omitted
25
23
  * directory would produce a fingerprint that matches a stale project — the costly failure mode.
26
24
  */
25
+ export declare function buildSourceIndex(root: string): SourceIndex;
26
+ /**
27
+ * The project's fingerprint on its own.
28
+ *
29
+ * Kept as the entry point for the callers that only need the hash (`verify`, `build`), so they
30
+ * do not have to know an index exists. `publish` uses `buildSourceIndex` directly because it
31
+ * needs both halves.
32
+ */
27
33
  export declare function computeFingerprint(root: string): string;
@@ -1,99 +1,103 @@
1
- import { createHash } from 'crypto';
2
- import * as fs from 'fs';
3
- import * as path from 'path';
4
1
  /**
5
- * Directories whose contents never change what the bundle contains: our own artifacts
6
- * (`.bitmagic/`, `dist/`), the dependency tree (`node_modules/` pinned by the lockfile the
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. The list is deliberately not a general ignore
23
- * mechanism, because a false "fresh" ships an unverified bundle while a false "stale" only costs
24
- * one `bitmagic verify`.
25
- *
26
- * `mechanics-plan.md` earns its place the same way, and for a sharper version of the reason: the
27
- * agent is told to rewrite it after every slice — moving shipped items out of the backlog and
28
- * re-ranking the rest is the whole point of the file. Left in, the ordinary
29
- * `bitmagic verify` → update the backlog → `bitmagic publish` sequence exits 3 over prose, which
30
- * teaches agents to reach for `--force`, the one flag that also waves through a genuinely stale
31
- * verify. Nothing imports it and `vite.publish.config.js` cannot put prose in the bundle.
2
+ * The filesystem half of "what is this project's source": one walk, producing both the
3
+ * per-file index the source archive ships and the fingerprint the verify gate compares.
32
4
  *
33
- * `GAME-DESIGN.md` earns its place on the same "no build tool reads it" test: nothing imports it,
34
- * `vite.publish.config.js` cannot put prose in the bundle, and it exists to be REWRITTEN as the
35
- * game evolves it is the input `bitmagic cover` reads. Left in, the ordinary
36
- * `bitmagic verify` refine the design doc `bitmagic publish` sequence exits 3 over a paragraph
37
- * of prose, which teaches agents to reach for `--force` (the one flag that also waves through a
38
- * genuinely stale verify). Excluded at basename granularity like `.DS_Store`, so a design doc kept
39
- * in a subdirectory counts the same way.
5
+ * The rules themselves which directories and files are excluded, how a path is normalised,
6
+ * how the per-file hashes fold into one fingerprint live in
7
+ * `@bitmagic/asset-core/publish-source`, because api-server has to reproduce them exactly when it
8
+ * re-derives the fingerprint from an uploaded archive. Only the `fs` walk is here; that package
9
+ * deliberately touches no filesystem so it stays usable from both sides.
40
10
  */
41
- const EXCLUDED_DIRS = new Set(['.bitmagic', 'node_modules', 'dist', '.vite-cache', '.git']);
42
- /** See EXCLUDED_DIRS: files that can never change what the bundle contains. */
43
- const EXCLUDED_FILES = new Set(['.DS_Store', 'GAME-DESIGN.md', 'mechanics-plan.md']);
11
+ import { createHash } from 'crypto';
12
+ import * as fs from 'fs';
13
+ import * as path from 'path';
14
+ import { ARCHIVED_UNFINGERPRINTED_FILES, EXCLUDED_DIRS, EXCLUDED_FILES, SOURCE_INDEX_ALGO, VENDORED_ENGINE_PREFIX, engineComparisonHash, fingerprintFromIndex, toPosixPath as toPosixPathShared, } from '@bitmagic/asset-core/publish-source';
15
+ export { SOURCE_INDEX_ALGO } from '@bitmagic/asset-core/publish-source';
44
16
  /**
45
17
  * A relative path as the fingerprint hashes it: always forward-slashed.
46
18
  *
47
- * `sep` is a parameter rather than a direct `path.sep` read so this is testable on any
48
- * platform the Windows behaviour that makes normalization necessary cannot otherwise be
49
- * exercised on the POSIX runners CI uses, which is exactly how a vacuous test gets written.
19
+ * Re-exported through this module (rather than having callers reach into the shared package) so
20
+ * the CLI keeps one import site for path normalisation, and defaults to the host's separator —
21
+ * the shared version defaults to '/' because it is given already-normalised zip entry names.
50
22
  */
51
23
  export function toPosixPath(relativePath, sep = path.sep) {
52
- return relativePath.split(sep).join('/');
24
+ return toPosixPathShared(relativePath, sep);
53
25
  }
54
- function walk(dir, root, out) {
26
+ /**
27
+ * Collect every fingerprinted file under `root`.
28
+ *
29
+ * Symlinks are skipped: `entry.isFile()` is false for a symlink Dirent. That is long-standing
30
+ * behaviour rather than a decision made here, but it is now load-bearing in a second place —
31
+ * api-server walks the uploaded archive and must arrive at the same file set — so it is called
32
+ * out rather than left as an implicit property of the Dirent API.
33
+ */
34
+ function walk(dir, root, out, archivedOnly) {
55
35
  const entries = fs.readdirSync(dir, { withFileTypes: true });
56
36
  for (const entry of entries) {
57
37
  if (entry.isDirectory()) {
58
38
  if (EXCLUDED_DIRS.has(entry.name))
59
39
  continue;
60
- walk(path.join(dir, entry.name), root, out);
40
+ walk(path.join(dir, entry.name), root, out, archivedOnly);
61
41
  }
62
42
  else if (entry.isFile()) {
63
- if (EXCLUDED_FILES.has(entry.name))
43
+ const relPath = toPosixPath(path.relative(root, path.join(dir, entry.name)));
44
+ if (EXCLUDED_FILES.has(entry.name)) {
45
+ // Excluded from the fingerprint, but a design doc or backlog is exactly what makes the
46
+ // source archive readable — collected separately so it can never reach the fold.
47
+ if (ARCHIVED_UNFINGERPRINTED_FILES.has(entry.name))
48
+ archivedOnly.push(relPath);
64
49
  continue;
65
- const relPath = path.relative(root, path.join(dir, entry.name));
66
- out.push(toPosixPath(relPath));
50
+ }
51
+ out.push(relPath);
67
52
  }
68
53
  }
69
54
  }
70
55
  /**
71
- * A hash of everything that determines the published bundle.
72
- *
73
- * This is what lets `publish` decide whether a `verify` is too stale to trust, by CONTENT
74
- * rather than by clock: a timestamp policy would accept an edit made one second after
75
- * verifying and reject an untouched project that merely sat overnight.
76
- *
77
- * The path is hashed alongside the content so that moving a file — which changes what the
78
- * bundle imports — changes the fingerprint even though no byte of any file did.
56
+ * Every fingerprinted file in the project, hashed, plus the fingerprint they roll up to.
79
57
  *
80
- * Kept deliberately coarse (every tracked file, not a module graph): a false "stale" costs one
81
- * `bitmagic verify`, while a false "fresh" ships an unverified bundle.
58
+ * One walk per publish. `runPublish` calls this once and feeds the SAME result to both the
59
+ * staleness gate and the source archive previously the tree was walked twice (once to
60
+ * fingerprint, once to build the artifact), which opened a window for an edit to land between
61
+ * them and gave the exclusion rules two call sites that could drift.
82
62
  *
83
63
  * Any filesystem error (unreadable directory, permission denied, etc.) propagates immediately
84
64
  * rather than being silently omitted: the project source is the creator's own files, so an
85
65
  * unreadable subtree is a real problem worth surfacing, not something to hide. An omitted
86
66
  * directory would produce a fingerprint that matches a stale project — the costly failure mode.
87
67
  */
88
- export function computeFingerprint(root) {
89
- const files = [];
90
- walk(root, root, files);
91
- files.sort();
92
- const hash = createHash('sha256');
93
- for (const rel of files) {
68
+ export function buildSourceIndex(root) {
69
+ const paths = [];
70
+ const archivedOnlyPaths = [];
71
+ walk(root, root, paths, archivedOnlyPaths);
72
+ paths.sort();
73
+ archivedOnlyPaths.sort();
74
+ const hashFile = (rel) => {
94
75
  const content = fs.readFileSync(path.join(root, rel));
95
- hash.update(`${rel}:${createHash('sha256').update(content).digest('hex')}\n`);
96
- }
97
- return hash.digest('hex');
76
+ return {
77
+ path: rel,
78
+ sha256: createHash('sha256').update(content).digest('hex'),
79
+ bytes: content.byteLength,
80
+ // Only for the vendored engine, and only because the server compares those against the
81
+ // official release without ever receiving their bytes — it cannot normalise after the fact.
82
+ ...(rel.startsWith(VENDORED_ENGINE_PREFIX) ? { engineSha256: engineComparisonHash(content) } : {}),
83
+ };
84
+ };
85
+ const files = paths.map(hashFile);
86
+ return {
87
+ algo: SOURCE_INDEX_ALGO,
88
+ files,
89
+ fingerprint: fingerprintFromIndex(files),
90
+ archivedOnly: archivedOnlyPaths.map(hashFile),
91
+ };
92
+ }
93
+ /**
94
+ * The project's fingerprint on its own.
95
+ *
96
+ * Kept as the entry point for the callers that only need the hash (`verify`, `build`), so they
97
+ * do not have to know an index exists. `publish` uses `buildSourceIndex` directly because it
98
+ * needs both halves.
99
+ */
100
+ export function computeFingerprint(root) {
101
+ return buildSourceIndex(root).fingerprint;
98
102
  }
99
103
  //# sourceMappingURL=fingerprint.js.map
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5F,+EAA+E;AAC/E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAErF;;;;;;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,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GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnG,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,KAAK;QACL,WAAW,EAAE,oBAAoB,CAAC,KAAK,CAAC;QACxC,YAAY,EAAE,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { type SourceIndex } from '@bitmagic/asset-core/publish-source';
2
+ /** Where the archive is written. Inside `.bitmagic/`, so it can never affect the fingerprint. */
3
+ export declare function sourceArchivePath(root: string): string;
4
+ export interface SourceArchive {
5
+ /** Absolute path to the written archive. */
6
+ filePath: string;
7
+ bytes: number;
8
+ /** sha256 of the archive as written — the value that gets bound into the meta block. */
9
+ sha256: string;
10
+ /** Fingerprinted paths deliberately not carried in the payload (engine + anything secret). */
11
+ omitted: string[];
12
+ /** Secret-shaped paths among `omitted`, so `publish` can tell the creator what it withheld. */
13
+ secretsOmitted: string[];
14
+ }
15
+ export interface BuildSourceArchiveOptions {
16
+ root: string;
17
+ index: SourceIndex;
18
+ gameId: string;
19
+ engineVersion: string;
20
+ genre: string;
21
+ /** Injected so tests get a stable manifest; production passes the real clock. */
22
+ now?: () => Date;
23
+ }
24
+ /**
25
+ * Build the archive and return what `publish` needs to upload and declare.
26
+ *
27
+ * The manifest is written FIRST so a reader (and the server) hits it before streaming past
28
+ * megabytes of payload, and `files` covers the fingerprint's entire set — including the paths the
29
+ * payload omits — because that is what lets the server re-derive the fingerprint from an archive
30
+ * that does not physically contain every file.
31
+ *
32
+ * Note the payload is read from disk again here rather than being buffered during
33
+ * `buildSourceIndex`: holding every file's bytes to avoid a second read would mean holding the
34
+ * whole project in memory, and the index already carries the hashes that make a re-read safe to
35
+ * detect. A file edited between the two reads changes the archive but not the manifest, which the
36
+ * server's per-entry hash check reports — the honest outcome, and the reason that check exists.
37
+ */
38
+ export declare function buildSourceArchive(options: BuildSourceArchiveOptions): Promise<SourceArchive>;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * The source archive a publish leaves behind: what a human opens from the Slack link, and what
3
+ * api-server audits against the fingerprint the publish declared.
4
+ *
5
+ * Three things it is deliberately NOT:
6
+ *
7
+ * - **Not the whole project.** The vendored `engine/` tree is ~14MB of platform code, byte-
8
+ * identical for everyone on a given engine version. Shipping it on every publish would upload
9
+ * several MB to store the same bytes repeatedly, and it is not what someone opening the archive
10
+ * wants to read. It is hashed into the manifest instead, which is all the server needs to check
11
+ * it against the official release.
12
+ * - **Not a secret carrier.** The archive lands in a bucket with a bucket-level
13
+ * `allUsers:objectViewer` grant. Anything matching `SECRET_FILE_PATTERNS` is hashed and listed
14
+ * but never included. See that constant for why this is a deny-list and what that costs.
15
+ * - **Not the fingerprint's file set.** `GAME-DESIGN.md` and `mechanics-plan.md` are excluded
16
+ * from the fingerprint (they are rewritten constantly and no build tool reads them) but ARE
17
+ * included here, because a design document is exactly what makes an archive readable. The
18
+ * manifest records the fingerprint's set, not the payload's, so the two never have to agree.
19
+ *
20
+ * Written to disk rather than held in memory: the payload is small but a creator's `world.json`
21
+ * can be large, the file is genuinely useful to inspect when an audit warns, and `.bitmagic/` is
22
+ * already both gitignored and fingerprint-excluded so it cannot perturb the next publish.
23
+ */
24
+ import { createHash } from 'crypto';
25
+ import * as fs from 'fs';
26
+ import * as path from 'path';
27
+ import { Zip, ZipDeflate } from 'fflate';
28
+ import { SOURCE_MANIFEST_NAME, VENDORED_ENGINE_PREFIX, isSecretPath, } from '@bitmagic/asset-core/publish-source';
29
+ import { CliError } from '../errors.js';
30
+ /** Where the archive is written. Inside `.bitmagic/`, so it can never affect the fingerprint. */
31
+ export function sourceArchivePath(root) {
32
+ return path.join(root, '.bitmagic', 'publish', 'source.zip');
33
+ }
34
+ /** Is this fingerprinted path one the payload carries, or one only the manifest records? */
35
+ function isPayloadPath(relPath) {
36
+ if (relPath.startsWith(VENDORED_ENGINE_PREFIX))
37
+ return false;
38
+ return !isSecretPath(relPath);
39
+ }
40
+ /**
41
+ * Build the archive and return what `publish` needs to upload and declare.
42
+ *
43
+ * The manifest is written FIRST so a reader (and the server) hits it before streaming past
44
+ * megabytes of payload, and `files` covers the fingerprint's entire set — including the paths the
45
+ * payload omits — because that is what lets the server re-derive the fingerprint from an archive
46
+ * that does not physically contain every file.
47
+ *
48
+ * Note the payload is read from disk again here rather than being buffered during
49
+ * `buildSourceIndex`: holding every file's bytes to avoid a second read would mean holding the
50
+ * whole project in memory, and the index already carries the hashes that make a re-read safe to
51
+ * detect. A file edited between the two reads changes the archive but not the manifest, which the
52
+ * server's per-entry hash check reports — the honest outcome, and the reason that check exists.
53
+ */
54
+ export async function buildSourceArchive(options) {
55
+ const { root, index, gameId, engineVersion, genre } = options;
56
+ const now = options.now ?? (() => new Date());
57
+ const omitted = index.files.map((f) => f.path).filter((p) => !isPayloadPath(p));
58
+ const secretsOmitted = omitted.filter((p) => !p.startsWith(VENDORED_ENGINE_PREFIX));
59
+ const manifest = {
60
+ algo: index.algo,
61
+ gameId,
62
+ engineVersion,
63
+ genre,
64
+ exportedAt: now().toISOString(),
65
+ fingerprint: index.fingerprint,
66
+ files: Object.fromEntries(index.files.map((f) => [f.path, f.sha256])),
67
+ omitted,
68
+ engineHashes: Object.fromEntries(index.files.filter((f) => f.engineSha256 !== undefined).map((f) => [f.path, f.engineSha256])),
69
+ };
70
+ const filePath = sourceArchivePath(root);
71
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
72
+ const hash = createHash('sha256');
73
+ let bytes = 0;
74
+ const out = fs.createWriteStream(filePath);
75
+ await new Promise((resolve, reject) => {
76
+ let failed = false;
77
+ const fail = (error) => {
78
+ if (failed)
79
+ return;
80
+ failed = true;
81
+ reject(error instanceof Error ? error : new Error(String(error)));
82
+ };
83
+ out.on('error', fail);
84
+ // fflate's Zip pushes chunks synchronously as entries are fed in. Tee each one into the hash
85
+ // so the archive is hashed as it is produced — reading the finished file back to hash it would
86
+ // both double the I/O and leave a window where the bytes on disk are not the bytes hashed.
87
+ const zip = new Zip((err, chunk, final) => {
88
+ if (err) {
89
+ fail(err);
90
+ return;
91
+ }
92
+ hash.update(chunk);
93
+ bytes += chunk.length;
94
+ out.write(chunk);
95
+ if (final)
96
+ out.end();
97
+ });
98
+ out.on('finish', () => {
99
+ if (!failed)
100
+ resolve();
101
+ });
102
+ try {
103
+ const addFile = (name, content) => {
104
+ // ZipDeflate, not AsyncZipDeflate: synchronous deflate keeps this a single pass with no
105
+ // worker pool, and the payload is source text, which compresses about four to one — 476KB
106
+ // stored versus ~120KB deflated on a real project. Worth it on every publish, since the
107
+ // creator waits for the upload.
108
+ const entry = new ZipDeflate(name, { level: 6 });
109
+ zip.add(entry);
110
+ entry.push(content, true);
111
+ };
112
+ addFile(SOURCE_MANIFEST_NAME, Buffer.from(`${JSON.stringify(manifest, null, 2)}\n`, 'utf8'));
113
+ // The fingerprinted files, then the ones the fingerprint deliberately ignores but a reader
114
+ // wants (GAME-DESIGN.md, mechanics-plan.md). Both go through the same secret filter — a
115
+ // credential does not become safe to ship by being unfingerprinted.
116
+ for (const file of [...index.files, ...index.archivedOnly]) {
117
+ if (!isPayloadPath(file.path))
118
+ continue;
119
+ addFile(file.path, fs.readFileSync(path.join(root, file.path)));
120
+ }
121
+ zip.end();
122
+ }
123
+ catch (error) {
124
+ fail(error);
125
+ }
126
+ }).catch((error) => {
127
+ throw new CliError(`Could not write the source archive at ${filePath}: ${error.message}`, 1);
128
+ });
129
+ return { filePath, bytes, sha256: hash.digest('hex'), omitted, secretsOmitted };
130
+ }
131
+ //# sourceMappingURL=source-zip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-zip.js","sourceRoot":"","sources":["../../src/publish/source-zip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,GAGb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AAC/D,CAAC;AAcD,4FAA4F;AAC5F,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7D,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAYD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAkC;IACzE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAE9C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAA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| 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\` |
649
+ | 1 | Build failed, or what was uploaded was not an engine build | 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\`. Do NOT retry an unchanged bundle; the refusal is deterministic |
650
650
  | 2 | Not logged in | \`bitmagic login\` |
651
651
  | 3 | Verify missing, stale, or failed | \`bitmagic verify\` (then publish again, or add \`--force\` for a stale/failed record) |
652
652
  | 5 | Not this game's owner, or the account/game is banned | Not self-serve — stop and report it |
@@ -661,6 +661,12 @@ a bundle that cannot find its own world.json, a canvas nothing ever draws into.
661
661
  Pass \`--skip-smoke\` to skip it. The publish still happens; it is simply not confirmed to render,
662
662
  and the output says so.
663
663
 
664
+ Every publish also uploads a **source archive** of this project to a **publicly readable** (though
665
+ unguessable) URL, which Bitmagic checks against the bundle and against an unmodified \`engine/\`;
666
+ findings print as \`warning:\` lines and never block a publish. Credential-shaped files (\`.env*\`,
667
+ \`*.pem\`, \`*.key\`, \`.npmrc\`, service-account JSON) are excluded and named in the output — but
668
+ that list cannot be exhaustive, so never keep a secret in this directory.
669
+
664
670
  Publishing is never refused because the vendored engine is old. When a newer engine exists,
665
671
  \`bitmagic dev\` and \`bitmagic publish\` say so and suggest \`bitmagic upgrade\` — upgrade while you
666
672
  are developing, when rebuilding is cheap, rather than being blocked at the moment you ship.
@@ -1 +1 @@
1
- {"version":3,"file":"project-files.js","sourceRoot":"","sources":["../../src/scaffold/project-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,2BAA2B,EAAE,SAAS;IACtC,2BAA2B,EAAE,SAAS;IACtC,kB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AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;;;;;;;;;;;;;;;CAsBR,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitmagic/cli",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "Build Bitmagic games from your own agent tool",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,9 +17,10 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "citty": "^0.2.2",
20
+ "fflate": "^0.8.2",
20
21
  "playwright-core": "^1.59.1",
21
22
  "tar": "^7.4.3",
22
- "@bitmagic/asset-core": "0.1.2",
23
+ "@bitmagic/asset-core": "0.1.3",
23
24
  "@bitmagic/world-forger": "0.1.5"
24
25
  },
25
26
  "devDependencies": {