@dreamboard-games/cli 0.1.30-alpha.4 → 0.1.30-alpha.40

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 (156) hide show
  1. package/README.md +32 -113
  2. package/dist/agent-verifier/agent-workspace-verifier.mjs +2084 -57
  3. package/dist/agent-verifier/agent-workspace-verifier.mjs.map +1 -1
  4. package/dist/agent-verifier/{chunk-XQXDOBYB.mjs → chunk-4I2WWAPK.mjs} +27 -10
  5. package/dist/agent-verifier/chunk-4I2WWAPK.mjs.map +1 -0
  6. package/dist/agent-verifier/{chunk-C3VW3DTA.mjs → chunk-BWBN2TDJ.mjs} +535 -633
  7. package/dist/agent-verifier/chunk-BWBN2TDJ.mjs.map +1 -0
  8. package/dist/agent-verifier/{chunk-TAEQKBJB.mjs → chunk-GWRZRWCF.mjs} +1 -1
  9. package/dist/agent-verifier/chunk-GWRZRWCF.mjs.map +1 -0
  10. package/dist/agent-verifier/chunk-HUBV22JQ.mjs +89 -0
  11. package/dist/agent-verifier/chunk-HUBV22JQ.mjs.map +1 -0
  12. package/dist/agent-verifier/{chunk-MW2QIWWA.mjs → chunk-KAA3B4DI.mjs} +215 -223
  13. package/dist/agent-verifier/chunk-KAA3B4DI.mjs.map +1 -0
  14. package/dist/agent-verifier/{chunk-27EEIZCI.mjs → chunk-KDAQ4CZY.mjs} +34 -27
  15. package/dist/agent-verifier/chunk-KDAQ4CZY.mjs.map +1 -0
  16. package/dist/agent-verifier/{chunk-IAYRNVUC.mjs → chunk-LMW66VBH.mjs} +2 -13
  17. package/dist/agent-verifier/{chunk-IAYRNVUC.mjs.map → chunk-LMW66VBH.mjs.map} +1 -1
  18. package/dist/agent-verifier/{chunk-776W3UGV.mjs → chunk-LROY5SN2.mjs} +7 -45
  19. package/dist/agent-verifier/chunk-LROY5SN2.mjs.map +1 -0
  20. package/dist/agent-verifier/{chunk-H76MT5UR.mjs → chunk-M7UVBANQ.mjs} +2 -1
  21. package/dist/agent-verifier/chunk-M7UVBANQ.mjs.map +1 -0
  22. package/dist/agent-verifier/{chunk-5NYBTZB4.mjs → chunk-MIRGCMUC.mjs} +112 -26
  23. package/dist/agent-verifier/chunk-MIRGCMUC.mjs.map +1 -0
  24. package/dist/agent-verifier/{chunk-NAK77WXW.mjs → chunk-MYMVXTZT.mjs} +4 -5
  25. package/dist/agent-verifier/chunk-MYMVXTZT.mjs.map +1 -0
  26. package/dist/agent-verifier/chunk-OJFZVGEL.mjs +492 -0
  27. package/dist/agent-verifier/chunk-OJFZVGEL.mjs.map +1 -0
  28. package/dist/agent-verifier/{chunk-XKCJBIRY.mjs → chunk-QD4SQNUP.mjs} +2 -2
  29. package/dist/agent-verifier/{chunk-QBAF7EYR.mjs → chunk-TTB7AIHZ.mjs} +4 -4
  30. package/dist/agent-verifier/{chunk-QBAF7EYR.mjs.map → chunk-TTB7AIHZ.mjs.map} +1 -1
  31. package/dist/agent-verifier/{chunk-F2DIOJJZ.mjs → chunk-XCQQIPCO.mjs} +5 -46
  32. package/dist/agent-verifier/chunk-XCQQIPCO.mjs.map +1 -0
  33. package/dist/agent-verifier/{global-config-NYCSCAUI.mjs → global-config-2NUESNEQ.mjs} +5 -5
  34. package/dist/agent-verifier/{keychain-backend-A3MRWLPF.mjs → keychain-backend-FF4I6ODB.mjs} +11 -6
  35. package/dist/agent-verifier/keychain-backend-FF4I6ODB.mjs.map +1 -0
  36. package/dist/agent-verifier/{local-files-QVJ2H3MH.mjs → local-files-OF4QFISU.mjs} +8 -8
  37. package/dist/agent-verifier/{chunk-UIOLGH4A.mjs → local-typecheck-DHVLM37Z.mjs} +4 -4
  38. package/dist/agent-verifier/local-typecheck-DHVLM37Z.mjs.map +1 -0
  39. package/dist/agent-verifier/{materialize-workspace-OZKOQCSQ.mjs → materialize-workspace-JBDL6LF4.mjs} +22 -22
  40. package/dist/agent-verifier/materialize-workspace-JBDL6LF4.mjs.map +1 -0
  41. package/dist/agent-verifier/{chunk-Z6OZWUIZ.mjs → reducer-bundle-preflight-GLUJKTWU.mjs} +75 -24
  42. package/dist/agent-verifier/reducer-bundle-preflight-GLUJKTWU.mjs.map +1 -0
  43. package/dist/agent-verifier/{chunk-YDIOW2BO.mjs → reducer-contract-preflight-WVQQPW5F.mjs} +7 -6
  44. package/dist/agent-verifier/reducer-contract-preflight-WVQQPW5F.mjs.map +1 -0
  45. package/dist/agent-verifier/{chunk-ON62IGWK.mjs → reducer-native-test-harness-XQUPIT5D.mjs} +480 -703
  46. package/dist/agent-verifier/reducer-native-test-harness-XQUPIT5D.mjs.map +1 -0
  47. package/dist/agent-verifier/static-scaffold-U5DXE23S.mjs +24 -0
  48. package/dist/agent-verifier/{workspace-codegen-WPZHMATU.mjs → workspace-codegen-SPPVHURX.mjs} +3 -3
  49. package/dist/agent-verifier/{workspace-dependencies-B6A2ZX55.mjs → workspace-dependencies-5HEEKZFP.mjs} +5 -3
  50. package/dist/authoring-compatibility-internal.js +12 -0
  51. package/dist/chunk-5IYJOVUA.js +3902 -0
  52. package/dist/chunk-5IYJOVUA.js.map +1 -0
  53. package/dist/chunk-6NYVJYN4.js +313 -0
  54. package/dist/chunk-6NYVJYN4.js.map +1 -0
  55. package/dist/chunk-EQNBQVIW.js +204 -0
  56. package/dist/chunk-EQNBQVIW.js.map +1 -0
  57. package/dist/{chunk-M4SCKH5M.js → chunk-USZAPMQ4.js} +2488 -4993
  58. package/dist/chunk-USZAPMQ4.js.map +1 -0
  59. package/dist/{global-config-YBFEGJQG.js → global-config-RBMW7IVA.js} +3 -2
  60. package/dist/index.js +3099 -6188
  61. package/dist/index.js.map +1 -1
  62. package/dist/internal.js +35 -9
  63. package/dist/internal.js.map +1 -1
  64. package/dist/{keychain-backend-JHTXAKWC.js → keychain-backend-FSNTNTZE.js} +11 -6
  65. package/dist/keychain-backend-FSNTNTZE.js.map +1 -0
  66. package/package.json +9 -19
  67. package/release/authoring-release-set.json +38 -0
  68. package/skills/dreamboard/SKILL.md +32 -30
  69. package/skills/dreamboard/references/building-your-first-game.md +16 -16
  70. package/skills/dreamboard/references/cli.md +54 -54
  71. package/skills/dreamboard/references/manifest-authoring.md +11 -3
  72. package/skills/dreamboard/references/quickstart.md +19 -16
  73. package/skills/dreamboard/references/testing.md +6 -13
  74. package/dist/agent-verifier/chunk-27EEIZCI.mjs.map +0 -1
  75. package/dist/agent-verifier/chunk-5NYBTZB4.mjs.map +0 -1
  76. package/dist/agent-verifier/chunk-776W3UGV.mjs.map +0 -1
  77. package/dist/agent-verifier/chunk-C3VW3DTA.mjs.map +0 -1
  78. package/dist/agent-verifier/chunk-F2DIOJJZ.mjs.map +0 -1
  79. package/dist/agent-verifier/chunk-G42BGGG2.mjs +0 -70
  80. package/dist/agent-verifier/chunk-G42BGGG2.mjs.map +0 -1
  81. package/dist/agent-verifier/chunk-H76MT5UR.mjs.map +0 -1
  82. package/dist/agent-verifier/chunk-IDVQXGAO.mjs +0 -222
  83. package/dist/agent-verifier/chunk-IDVQXGAO.mjs.map +0 -1
  84. package/dist/agent-verifier/chunk-JO5AMVZU.mjs +0 -1744
  85. package/dist/agent-verifier/chunk-JO5AMVZU.mjs.map +0 -1
  86. package/dist/agent-verifier/chunk-KDBSVLCF.mjs +0 -624
  87. package/dist/agent-verifier/chunk-KDBSVLCF.mjs.map +0 -1
  88. package/dist/agent-verifier/chunk-MW2QIWWA.mjs.map +0 -1
  89. package/dist/agent-verifier/chunk-NAK77WXW.mjs.map +0 -1
  90. package/dist/agent-verifier/chunk-ON62IGWK.mjs.map +0 -1
  91. package/dist/agent-verifier/chunk-QZH6IEZS.mjs +0 -39
  92. package/dist/agent-verifier/chunk-QZH6IEZS.mjs.map +0 -1
  93. package/dist/agent-verifier/chunk-TAEQKBJB.mjs.map +0 -1
  94. package/dist/agent-verifier/chunk-UIOLGH4A.mjs.map +0 -1
  95. package/dist/agent-verifier/chunk-XQXDOBYB.mjs.map +0 -1
  96. package/dist/agent-verifier/chunk-YDIOW2BO.mjs.map +0 -1
  97. package/dist/agent-verifier/chunk-Z6OZWUIZ.mjs.map +0 -1
  98. package/dist/agent-verifier/compile-576O7TYP.mjs +0 -312
  99. package/dist/agent-verifier/compile-576O7TYP.mjs.map +0 -1
  100. package/dist/agent-verifier/keychain-backend-A3MRWLPF.mjs.map +0 -1
  101. package/dist/agent-verifier/local-typecheck-2JWG5IGL.mjs +0 -10
  102. package/dist/agent-verifier/materialize-workspace-OZKOQCSQ.mjs.map +0 -1
  103. package/dist/agent-verifier/reducer-bundle-preflight-7NYZF5ZT.mjs +0 -20
  104. package/dist/agent-verifier/reducer-contract-preflight-COD2CO22.mjs +0 -11
  105. package/dist/agent-verifier/reducer-native-test-harness-QC7HZUK4.mjs +0 -50
  106. package/dist/agent-verifier/static-scaffold-JBUE3ROP.mjs +0 -27
  107. package/dist/agent-verifier/sync-C6S3OGCD.mjs +0 -588
  108. package/dist/agent-verifier/sync-C6S3OGCD.mjs.map +0 -1
  109. package/dist/agent-verifier/test-Y5UGQV7J.mjs +0 -353
  110. package/dist/agent-verifier/test-Y5UGQV7J.mjs.map +0 -1
  111. package/dist/agent-verifier/workspace-codegen-WPZHMATU.mjs.map +0 -1
  112. package/dist/agent-verifier/workspace-dependencies-B6A2ZX55.mjs.map +0 -1
  113. package/dist/chunk-3NRROR4P.js +0 -432
  114. package/dist/chunk-3NRROR4P.js.map +0 -1
  115. package/dist/chunk-M4SCKH5M.js.map +0 -1
  116. package/dist/dev-host/components/drawer.tsx +0 -132
  117. package/dist/dev-host/components/input.tsx +0 -21
  118. package/dist/dev-host/dev-api-proxy-plugin.ts +0 -328
  119. package/dist/dev-host/dev-author-dom-warnings.ts +0 -100
  120. package/dist/dev-host/dev-diagnostics.ts +0 -62
  121. package/dist/dev-host/dev-fallback-stylesheet.ts +0 -53
  122. package/dist/dev-host/dev-hmr-guard-plugin.ts +0 -47
  123. package/dist/dev-host/dev-host-controller.ts +0 -674
  124. package/dist/dev-host/dev-host-player-query.ts +0 -17
  125. package/dist/dev-host/dev-host-session-transport.ts +0 -52
  126. package/dist/dev-host/dev-host-storage.ts +0 -56
  127. package/dist/dev-host/dev-log-relay-plugin.ts +0 -510
  128. package/dist/dev-host/dev-runtime-config.ts +0 -14
  129. package/dist/dev-host/dev-runtime-platform.ts +0 -335
  130. package/dist/dev-host/dev-virtual-modules-plugin.ts +0 -64
  131. package/dist/dev-host/host-main.css +0 -224
  132. package/dist/dev-host/host-main.tsx +0 -948
  133. package/dist/dev-host/index.html +0 -56
  134. package/dist/dev-host/lib/utils.ts +0 -6
  135. package/dist/dev-host/plugin-main.ts +0 -61
  136. package/dist/dev-host/plugin.html +0 -24
  137. package/dist/dev-host/shared-styles.css +0 -144
  138. package/dist/dev-host/start-dev-server.ts +0 -140
  139. package/dist/dev-host/virtual-modules.d.ts +0 -27
  140. package/dist/global-config-YBFEGJQG.js.map +0 -1
  141. package/dist/keychain-backend-JHTXAKWC.js.map +0 -1
  142. package/skills/dreamboard/scripts/events-extract.mjs +0 -218
  143. /package/dist/agent-verifier/{chunk-XKCJBIRY.mjs.map → chunk-QD4SQNUP.mjs.map} +0 -0
  144. /package/dist/agent-verifier/{global-config-NYCSCAUI.mjs.map → global-config-2NUESNEQ.mjs.map} +0 -0
  145. /package/dist/agent-verifier/{local-files-QVJ2H3MH.mjs.map → local-files-OF4QFISU.mjs.map} +0 -0
  146. /package/dist/agent-verifier/{local-typecheck-2JWG5IGL.mjs.map → static-scaffold-U5DXE23S.mjs.map} +0 -0
  147. /package/dist/agent-verifier/{reducer-bundle-preflight-7NYZF5ZT.mjs.map → workspace-codegen-SPPVHURX.mjs.map} +0 -0
  148. /package/dist/agent-verifier/{reducer-contract-preflight-COD2CO22.mjs.map → workspace-dependencies-5HEEKZFP.mjs.map} +0 -0
  149. /package/dist/{agent-verifier/reducer-native-test-harness-QC7HZUK4.mjs.map → authoring-compatibility-internal.js.map} +0 -0
  150. /package/dist/{agent-verifier/static-scaffold-JBUE3ROP.mjs.map → global-config-RBMW7IVA.js.map} +0 -0
  151. /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.framework.json +0 -0
  152. /package/{dist/scaffold → scaffold}/assets/static/app/tsconfig.json +0 -0
  153. /package/{dist/scaffold → scaffold}/assets/static/ui/index.tsx +0 -0
  154. /package/{dist/scaffold → scaffold}/assets/static/ui/style.css +0 -0
  155. /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.framework.json +0 -0
  156. /package/{dist/scaffold → scaffold}/assets/static/ui/tsconfig.json +0 -0
@@ -1,588 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- assertReducerContractPreflight
4
- } from "./chunk-YDIOW2BO.mjs";
5
- import {
6
- assertReducerBundleSmoke
7
- } from "./chunk-Z6OZWUIZ.mjs";
8
- import {
9
- resolveRemoteProject
10
- } from "./chunk-QZH6IEZS.mjs";
11
- import {
12
- CONFIG_FLAG_ARGS,
13
- createGameRevisionSdk,
14
- defineCommand,
15
- mapUpsertBlobContentsByContentHash,
16
- materializeSourceChangeOperations,
17
- parseSyncCommandArgs,
18
- uploadProjectSourceBlobsSdk
19
- } from "./chunk-KDBSVLCF.mjs";
20
- import {
21
- getProjectAuthoringState,
22
- getProjectLocalMaintainerRegistry,
23
- getProjectPendingAuthoringSync,
24
- updateProjectAuthoringState,
25
- updateProjectLocalMaintainerRegistry
26
- } from "./chunk-YE7UAO3T.mjs";
27
- import {
28
- runLocalTypecheck
29
- } from "./chunk-UIOLGH4A.mjs";
30
- import "./chunk-XKCJBIRY.mjs";
31
- import "./chunk-IDVQXGAO.mjs";
32
- import {
33
- assertReleaseEnvironmentPortableDependencies,
34
- consola,
35
- resolveProjectContext
36
- } from "./chunk-JO5AMVZU.mjs";
37
- import "./chunk-5NYBTZB4.mjs";
38
- import {
39
- collectLocalFiles,
40
- getLocalDiff,
41
- loadManifest,
42
- loadRule,
43
- writeSnapshot
44
- } from "./chunk-27EEIZCI.mjs";
45
- import {
46
- assertCliStaticScaffoldComplete,
47
- scaffoldStaticWorkspace
48
- } from "./chunk-MW2QIWWA.mjs";
49
- import "./chunk-F2DIOJJZ.mjs";
50
- import {
51
- BUILD_CHANNEL,
52
- IS_PUBLISHED_BUILD,
53
- updateProjectState
54
- } from "./chunk-776W3UGV.mjs";
55
- import {
56
- computeManifestHash,
57
- isAllowedGamePath,
58
- isDynamicGeneratedPath
59
- } from "./chunk-C3VW3DTA.mjs";
60
- import "./chunk-JZTH3EMV.mjs";
61
- import {
62
- resolveCliRepoRoot
63
- } from "./chunk-QBAF7EYR.mjs";
64
- import "./chunk-NAK77WXW.mjs";
65
- import "./chunk-TAEQKBJB.mjs";
66
- import {
67
- applyWorkspaceCodegen
68
- } from "./chunk-G42BGGG2.mjs";
69
- import "./chunk-IAYRNVUC.mjs";
70
- import {
71
- reconcileWorkspaceDependencies
72
- } from "./chunk-XQXDOBYB.mjs";
73
- import "./chunk-ZEELHSY3.mjs";
74
- import {
75
- ENVIRONMENT_CONFIGS,
76
- RULE_FILE
77
- } from "./chunk-H76MT5UR.mjs";
78
- import "./chunk-H6XDQJ3N.mjs";
79
-
80
- // src/services/project/source-revision-paths.ts
81
- function isSourceRevisionPath(filePath) {
82
- return filePath !== RULE_FILE && isAllowedGamePath(filePath);
83
- }
84
- function shouldAlwaysUpsertSourcePath(filePath) {
85
- return filePath === ".npmrc" || isDynamicGeneratedPath(filePath);
86
- }
87
-
88
- // src/services/project/local-maintainer-registry.ts
89
- import { spawn } from "child_process";
90
- import { existsSync, readFileSync } from "fs";
91
- import path2 from "path";
92
- import { fileURLToPath } from "url";
93
-
94
- // src/services/project/local-maintainer-registry-shared.ts
95
- import crypto from "crypto";
96
- import path from "path";
97
- var localRegistryAddress = readLocalRegistryAddress();
98
- var LOCAL_REGISTRY_HOST = localRegistryAddress.host;
99
- var LOCAL_REGISTRY_PORT = localRegistryAddress.port;
100
- var LOCAL_REGISTRY_URL = `http://${LOCAL_REGISTRY_HOST}:${LOCAL_REGISTRY_PORT}`;
101
- var LOCAL_SCOPE_NPMRC_CONTENT = `@dreamboard-games:registry=${LOCAL_REGISTRY_URL}
102
- `;
103
- function readLocalRegistryAddress() {
104
- const urlOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_URL?.trim();
105
- const hostOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_HOST?.trim();
106
- const portOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_PORT?.trim();
107
- if (urlOverride) {
108
- let parsed;
109
- try {
110
- parsed = new URL(urlOverride);
111
- } catch {
112
- throw new Error(
113
- `Invalid DREAMBOARD_LOCAL_REGISTRY_URL '${urlOverride}'. Expected an http://host:port URL.`
114
- );
115
- }
116
- if (parsed.protocol !== "http:" || !parsed.hostname || !parsed.port) {
117
- throw new Error(
118
- `Invalid DREAMBOARD_LOCAL_REGISTRY_URL '${urlOverride}'. Expected an http://host:port URL.`
119
- );
120
- }
121
- return {
122
- host: hostOverride || parsed.hostname,
123
- port: parseLocalRegistryPort(portOverride || parsed.port)
124
- };
125
- }
126
- return {
127
- host: hostOverride || "127.0.0.1",
128
- port: portOverride ? parseLocalRegistryPort(portOverride) : 4873
129
- };
130
- }
131
- function parseLocalRegistryPort(raw) {
132
- const port = Number.parseInt(raw, 10);
133
- if (!Number.isInteger(port) || port < 1 || port > 65535) {
134
- throw new Error(
135
- `Invalid DREAMBOARD_LOCAL_REGISTRY_PORT '${raw}'. Expected a TCP port from 1 to 65535.`
136
- );
137
- }
138
- return port;
139
- }
140
- function shortHash(value) {
141
- return crypto.createHash("sha256").update(value).digest("hex").slice(0, 12);
142
- }
143
- function isLocalMaintainerRegistryEnabled(apiBaseUrl) {
144
- let isLocalLoopbackUrl = false;
145
- try {
146
- const parsed = new URL(apiBaseUrl);
147
- isLocalLoopbackUrl = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
148
- } catch {
149
- isLocalLoopbackUrl = false;
150
- }
151
- return !IS_PUBLISHED_BUILD && (apiBaseUrl === ENVIRONMENT_CONFIGS.local?.apiBaseUrl || isLocalLoopbackUrl) && BUILD_CHANNEL === "development";
152
- }
153
- function didLocalMaintainerSnapshotChange(previous, next) {
154
- if (!next) {
155
- return false;
156
- }
157
- return previous?.snapshotId !== next.snapshotId;
158
- }
159
-
160
- // src/services/project/local-maintainer-registry.ts
161
- var MODULE_DIR = path2.dirname(fileURLToPath(import.meta.url));
162
- function getCliPackageRoot() {
163
- try {
164
- return path2.join(
165
- resolveCliRepoRoot(import.meta.url),
166
- "apps",
167
- "dreamboard-cli"
168
- );
169
- } catch {
170
- return resolveInstalledCliPackageRoot(MODULE_DIR);
171
- }
172
- }
173
- function resolveInstalledCliPackageRoot(moduleDir) {
174
- let current = moduleDir;
175
- while (true) {
176
- const packageJsonPath = path2.join(current, "package.json");
177
- if (existsSync(packageJsonPath)) {
178
- try {
179
- const packageJson = JSON.parse(
180
- readFileSync(packageJsonPath, "utf8")
181
- );
182
- if (packageJson.name === "@dreamboard-games/cli" || packageJson.name === "dreamboard" || packageJson.name === "dreamboard-cli") {
183
- return current;
184
- }
185
- } catch {
186
- }
187
- }
188
- const parent = path2.dirname(current);
189
- if (parent === current) {
190
- return moduleDir;
191
- }
192
- current = parent;
193
- }
194
- }
195
- function getScriptInvocation() {
196
- const cliPackageRoot = getCliPackageRoot();
197
- const scriptPath = getLocalMaintainerScriptPath(cliPackageRoot);
198
- if (!existsSync(scriptPath)) {
199
- throw new Error(
200
- [
201
- "Dreamboard local maintainer registry support is only available from a source checkout.",
202
- `Expected helper script at ${scriptPath}.`
203
- ].join(" ")
204
- );
205
- }
206
- const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
207
- const args = ["exec", "tsx", scriptPath];
208
- return {
209
- command,
210
- args,
211
- attemptedCommand: `${command} ${args.join(" ")}`,
212
- cwd: cliPackageRoot
213
- };
214
- }
215
- function getLocalMaintainerScriptPath(cliPackageRoot) {
216
- return path2.join(cliPackageRoot, "scripts", "local-maintainer-registry.ts");
217
- }
218
- function isInstalledCliPackageRoot(cliPackageRoot) {
219
- return cliPackageRoot.split(path2.sep).includes("node_modules");
220
- }
221
- function shouldSkipLocalMaintainerHelper() {
222
- const cliPackageRoot = getCliPackageRoot();
223
- const scriptPath = getLocalMaintainerScriptPath(cliPackageRoot);
224
- return !existsSync(scriptPath) && isInstalledCliPackageRoot(cliPackageRoot);
225
- }
226
- function buildInstalledCliLocalMaintainerSnapshot(packageJson, registryUrl = LOCAL_REGISTRY_URL) {
227
- const sdkVersion = packageJson.dependencies?.["@dreamboard-games/sdk"];
228
- if (typeof sdkVersion !== "string" || !sdkVersion.includes("-local.")) {
229
- return null;
230
- }
231
- return {
232
- registryUrl,
233
- snapshotId: shortHash(sdkVersion),
234
- fingerprint: shortHash(sdkVersion),
235
- publishedAt: "",
236
- packages: {
237
- "@dreamboard-games/sdk": sdkVersion
238
- }
239
- };
240
- }
241
- function readInstalledCliLocalMaintainerSnapshot() {
242
- const cliPackageRoot = getCliPackageRoot();
243
- if (!isInstalledCliPackageRoot(cliPackageRoot)) {
244
- return null;
245
- }
246
- const packageJsonPath = path2.join(cliPackageRoot, "package.json");
247
- if (!existsSync(packageJsonPath)) {
248
- return null;
249
- }
250
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
251
- return buildInstalledCliLocalMaintainerSnapshot(packageJson);
252
- }
253
- function buildScriptSetupError(options) {
254
- return new Error(
255
- [
256
- "Dreamboard local maintainer registry support requires the source-checkout CLI tooling.",
257
- options.message,
258
- `Attempted command: ${options.attemptedCommand}`,
259
- options.stderr?.trim() ? `stderr:
260
- ${options.stderr.trim()}` : null
261
- ].filter(Boolean).join("\n")
262
- );
263
- }
264
- function parseJsonPayload(output) {
265
- const payload = output.trim().split(/\r?\n/).map((line) => line.trim()).reverse().find(
266
- (line) => line === "null" || line.startsWith("{") || line.startsWith("[")
267
- );
268
- if (!payload) {
269
- throw new Error("completed without returning a JSON payload");
270
- }
271
- return JSON.parse(payload);
272
- }
273
- async function runLocalMaintainerScript(args) {
274
- const invocation = getScriptInvocation();
275
- return new Promise((resolve, reject) => {
276
- const child = spawn(invocation.command, [...invocation.args, ...args], {
277
- cwd: invocation.cwd,
278
- stdio: ["ignore", "pipe", "pipe"],
279
- env: process.env
280
- });
281
- let stdout = "";
282
- let stderr = "";
283
- child.stdout.on("data", (chunk) => {
284
- stdout += chunk.toString();
285
- });
286
- child.stderr.on("data", (chunk) => {
287
- stderr += chunk.toString();
288
- });
289
- child.on("error", (error) => {
290
- const errnoError = error;
291
- if (errnoError.code === "ENOENT") {
292
- reject(
293
- buildScriptSetupError({
294
- attemptedCommand: invocation.attemptedCommand,
295
- message: "`pnpm` was not found on PATH, so the source-checkout local maintainer helper could not run."
296
- })
297
- );
298
- return;
299
- }
300
- reject(error);
301
- });
302
- child.on("close", (code) => {
303
- if (code !== 0) {
304
- const missingTsx = stderr.includes('Command "tsx" not found') || stderr.includes("tsx: command not found") || stderr.includes("tsx: not found");
305
- reject(
306
- buildScriptSetupError({
307
- attemptedCommand: invocation.attemptedCommand,
308
- message: missingTsx ? "`tsx` is not available for the source-checkout CLI package." : "The source-checkout local maintainer helper failed.",
309
- stderr
310
- })
311
- );
312
- return;
313
- }
314
- const trimmedStdout = stdout.trim();
315
- if (!trimmedStdout) {
316
- reject(
317
- buildScriptSetupError({
318
- attemptedCommand: invocation.attemptedCommand,
319
- message: "The source-checkout local maintainer helper completed without returning JSON.",
320
- stderr
321
- })
322
- );
323
- return;
324
- }
325
- try {
326
- resolve(parseJsonPayload(trimmedStdout));
327
- } catch (error) {
328
- reject(
329
- buildScriptSetupError({
330
- attemptedCommand: invocation.attemptedCommand,
331
- message: `Failed to parse JSON from the source-checkout local maintainer helper: ${error instanceof Error ? error.message : String(error)}`,
332
- stderr: [stderr.trim(), trimmedStdout].filter(Boolean).join("\n")
333
- })
334
- );
335
- }
336
- });
337
- });
338
- }
339
- async function ensureLocalMaintainerSnapshot(apiBaseUrl) {
340
- if (!isLocalMaintainerRegistryEnabled(apiBaseUrl)) {
341
- return null;
342
- }
343
- if (shouldSkipLocalMaintainerHelper()) {
344
- return readInstalledCliLocalMaintainerSnapshot();
345
- }
346
- return runLocalMaintainerScript([
347
- "ensure-snapshot",
348
- "--api-base-url",
349
- apiBaseUrl
350
- ]);
351
- }
352
-
353
- // src/commands/sync.ts
354
- async function runLoggedStep(message, task) {
355
- consola.start(message);
356
- return task();
357
- }
358
- async function persistProjectConfig(options) {
359
- await updateProjectState(options.projectRoot, options.projectConfig);
360
- return options.projectConfig;
361
- }
362
- async function finalizeLocalSync(options) {
363
- const { projectRoot, projectConfig } = options;
364
- await scaffoldStaticWorkspace(projectRoot, "update", {
365
- localMaintainerRegistry: getProjectLocalMaintainerRegistry(projectConfig)
366
- });
367
- await applyWorkspaceCodegen({
368
- projectRoot,
369
- manifest: await loadManifest(projectRoot)
370
- });
371
- const finalizedProjectConfig = await persistProjectConfig({
372
- projectRoot,
373
- projectConfig
374
- });
375
- await writeSnapshot(projectRoot);
376
- return finalizedProjectConfig;
377
- }
378
- function buildSourceSnapshotChanges(localFiles) {
379
- return Object.entries(localFiles).filter(
380
- ([filePath]) => isSourceRevisionPath(filePath) || shouldAlwaysUpsertSourcePath(filePath)
381
- ).sort(([left], [right]) => left.localeCompare(right)).map(([path3, content]) => ({
382
- kind: "upsert",
383
- path: path3,
384
- content
385
- }));
386
- }
387
- var sync_default = defineCommand({
388
- meta: {
389
- name: "sync",
390
- description: "Upload authored changes and advance the remote authoring head"
391
- },
392
- args: {
393
- force: {
394
- type: "boolean",
395
- description: "Replace the full authored source tree, manifest, and rules, overwriting the remote head with the local copy even when the remote has moved",
396
- default: false
397
- },
398
- yes: {
399
- type: "boolean",
400
- alias: "y",
401
- description: "Reserved for non-interactive scaffold flows",
402
- default: false
403
- },
404
- ...CONFIG_FLAG_ARGS
405
- },
406
- async run({ args }) {
407
- const parsedArgs = parseSyncCommandArgs(args);
408
- const { projectRoot, projectConfig, config } = await resolveProjectContext(parsedArgs);
409
- let nextProjectConfig = projectConfig;
410
- await assertReleaseEnvironmentPortableDependencies({
411
- projectRoot,
412
- projectConfig: nextProjectConfig,
413
- environment: config.environment
414
- });
415
- const localMaintainerEnabled = isLocalMaintainerRegistryEnabled(
416
- config.apiBaseUrl
417
- );
418
- const existingLocalMaintainerRegistry = getProjectLocalMaintainerRegistry(projectConfig);
419
- const refreshedLocalMaintainerRegistry = localMaintainerEnabled ? await runLoggedStep(
420
- "Checking local SDK snapshot...",
421
- () => ensureLocalMaintainerSnapshot(config.apiBaseUrl)
422
- ) : await ensureLocalMaintainerSnapshot(config.apiBaseUrl);
423
- const localMaintainerRegistry = refreshedLocalMaintainerRegistry ?? (localMaintainerEnabled ? existingLocalMaintainerRegistry ?? null : null);
424
- const localMaintainerSnapshotChanged = didLocalMaintainerSnapshotChange(
425
- existingLocalMaintainerRegistry,
426
- refreshedLocalMaintainerRegistry
427
- );
428
- if (refreshedLocalMaintainerRegistry) {
429
- nextProjectConfig = updateProjectLocalMaintainerRegistry(
430
- nextProjectConfig,
431
- refreshedLocalMaintainerRegistry
432
- );
433
- consola.info(
434
- localMaintainerSnapshotChanged ? "Local SDK snapshot refreshed." : "Using existing local SDK snapshot."
435
- );
436
- } else if (localMaintainerRegistry) {
437
- consola.info("Using workspace-pinned local SDK snapshot.");
438
- }
439
- await runLoggedStep(
440
- "Refreshing static scaffold...",
441
- () => scaffoldStaticWorkspace(projectRoot, "update", {
442
- localMaintainerRegistry
443
- })
444
- );
445
- const localManifest = await loadManifest(projectRoot);
446
- await runLoggedStep(
447
- "Applying workspace codegen...",
448
- async () => applyWorkspaceCodegen({
449
- projectRoot,
450
- manifest: localManifest
451
- })
452
- );
453
- const dependencyState = await runLoggedStep(
454
- "Reconciling workspace dependencies...",
455
- () => reconcileWorkspaceDependencies(projectRoot)
456
- );
457
- if (dependencyState.packageManagerNormalized || dependencyState.lockfileGenerated || dependencyState.installed || localMaintainerSnapshotChanged) {
458
- consola.info("Workspace dependencies reconciled.");
459
- } else {
460
- consola.info("Workspace dependencies already up to date.");
461
- }
462
- await runLoggedStep(
463
- "Validating reducer contract...",
464
- () => assertReducerContractPreflight(projectRoot)
465
- );
466
- const typecheckResult = await runLoggedStep(
467
- "Running local typecheck...",
468
- () => runLocalTypecheck(projectRoot)
469
- );
470
- if (typecheckResult.skipped) {
471
- if (typecheckResult.output) {
472
- consola.warn(typecheckResult.output);
473
- }
474
- } else if (!typecheckResult.success) {
475
- if (typecheckResult.output) {
476
- consola.error(typecheckResult.output);
477
- }
478
- throw new Error(
479
- "Local typecheck failed. Fix the diagnostics before syncing."
480
- );
481
- }
482
- await runLoggedStep(
483
- "Smoke-testing reducer bundle...",
484
- async () => assertReducerBundleSmoke({
485
- projectRoot,
486
- manifest: localManifest
487
- })
488
- );
489
- consola.success("Reducer bundle smoke test passed.");
490
- const remoteProject = await runLoggedStep(
491
- "Ensuring remote project...",
492
- () => resolveRemoteProject({
493
- projectRoot,
494
- projectConfig: nextProjectConfig,
495
- config
496
- })
497
- );
498
- nextProjectConfig = remoteProject.projectConfig;
499
- const localDiff = await getLocalDiff(projectRoot);
500
- await assertCliStaticScaffoldComplete(projectRoot, localDiff.deleted);
501
- const localAuthoring = getProjectAuthoringState(nextProjectConfig);
502
- const pendingSync = getProjectPendingAuthoringSync(nextProjectConfig);
503
- const remoteHeadDigest = remoteProject.project.head?.revisionDigest;
504
- const localHeadDigest = localAuthoring.revisionDigest ?? nextProjectConfig.remoteHeadDigest;
505
- if (pendingSync && !parsedArgs.force) {
506
- throw new Error(
507
- "This workspace has an unfinished legacy sync checkpoint. Run 'dreamboard sync --force' to replace it with an atomic project revision."
508
- );
509
- }
510
- if (remoteHeadDigest && localHeadDigest && remoteHeadDigest !== localHeadDigest) {
511
- if (parsedArgs.force) {
512
- consola.warn(
513
- `Remote project head has moved to ${remoteHeadDigest}. --force will overwrite it with this workspace's local copy.`
514
- );
515
- } else {
516
- throw new Error(
517
- `Remote project head has moved to ${remoteHeadDigest}. Run 'dreamboard pull' before syncing local changes, or pass --force to overwrite the remote with the local copy.`
518
- );
519
- }
520
- }
521
- if (remoteHeadDigest && !localHeadDigest) {
522
- if (parsedArgs.force) {
523
- consola.warn(
524
- `This workspace has no authored base but the remote project head is ${remoteHeadDigest}. --force will overwrite it with this workspace's local copy.`
525
- );
526
- } else {
527
- throw new Error(
528
- `This workspace has no authored base but the remote project head is ${remoteHeadDigest}. Re-clone, run 'dreamboard pull --force' into a clean workspace, or pass --force to overwrite the remote with the local copy.`
529
- );
530
- }
531
- }
532
- const hasChanges = localDiff.modified.length > 0 || localDiff.added.length > 0 || localDiff.deleted.length > 0;
533
- const localManifestContentHash = computeManifestHash(localManifest);
534
- const manifestOutOfSync = localAuthoring.localManifestContentHash !== localManifestContentHash;
535
- if (!hasChanges && !parsedArgs.force && localHeadDigest != null && remoteHeadDigest === localHeadDigest && !pendingSync && !manifestOutOfSync) {
536
- consola.info("No local authored changes to sync.");
537
- return;
538
- }
539
- const localFiles = await collectLocalFiles(projectRoot);
540
- const sourceChanges = buildSourceSnapshotChanges(localFiles);
541
- const { changes } = await materializeSourceChangeOperations(sourceChanges);
542
- const uploadBlobs = mapUpsertBlobContentsByContentHash(
543
- sourceChanges,
544
- changes
545
- );
546
- await uploadProjectSourceBlobsSdk(
547
- nextProjectConfig.projectId,
548
- Array.from(uploadBlobs.values())
549
- );
550
- const sourceFiles = changes.filter((change) => change.kind === "upsert").map(({ path: path3, contentHash, byteSize }) => ({
551
- path: path3,
552
- contentHash,
553
- byteSize
554
- }));
555
- const revision = await createGameRevisionSdk({
556
- projectId: nextProjectConfig.projectId,
557
- request: {
558
- ...remoteHeadDigest ? { baseRevisionDigest: remoteHeadDigest } : {},
559
- source: { files: sourceFiles },
560
- ruleText: await loadRule(projectRoot),
561
- manifest: localManifest
562
- }
563
- });
564
- nextProjectConfig = await persistProjectConfig({
565
- projectRoot,
566
- projectConfig: {
567
- ...updateProjectAuthoringState(nextProjectConfig, {
568
- revisionDigest: revision.revisionDigest,
569
- sourceTreeHash: revision.sourceTreeHash,
570
- manifestContentHash: revision.manifestContentHash,
571
- localManifestContentHash
572
- }),
573
- remoteHeadDigest: revision.revisionDigest
574
- }
575
- });
576
- nextProjectConfig = await finalizeLocalSync({
577
- projectRoot,
578
- projectConfig: nextProjectConfig
579
- });
580
- consola.success(
581
- `Synced revision ${revision.revisionDigest}. Run 'dreamboard compile' when you're ready.`
582
- );
583
- }
584
- });
585
- export {
586
- sync_default as default
587
- };
588
- //# sourceMappingURL=sync-C6S3OGCD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/services/project/source-revision-paths.ts","../../src/services/project/local-maintainer-registry.ts","../../src/services/project/local-maintainer-registry-shared.ts","../../src/commands/sync.ts"],"sourcesContent":["import { RULE_FILE } from \"../../constants.js\";\nimport {\n isAllowedGamePath,\n isDynamicGeneratedPath,\n} from \"./scaffold-ownership.js\";\n\n/**\n * Single definition of what belongs in an uploaded source revision, shared by\n * `dev` and `sync`. The compiler consumes the uploaded workspace as-is and\n * does not regenerate codegen outputs, so dynamic generated files (manifest\n * contract, ui-contract, framework tsconfigs) must always be included.\n */\nexport function isSourceRevisionPath(filePath: string): boolean {\n return filePath !== RULE_FILE && isAllowedGamePath(filePath);\n}\n\n/**\n * Files that must be upserted on every sync even when the local diff reports\n * them unchanged: registry configuration and regenerated codegen outputs.\n */\nexport function shouldAlwaysUpsertSourcePath(filePath: string): boolean {\n return filePath === \".npmrc\" || isDynamicGeneratedPath(filePath);\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { LocalMaintainerRegistryConfig } from \"../../types.js\";\nimport { resolveCliRepoRoot } from \"../../utils/repo-root.js\";\nimport {\n LOCAL_REGISTRY_URL,\n didLocalMaintainerSnapshotChange,\n getLocalMaintainerNpmrcContent,\n isLocalMaintainerRegistryEnabled,\n isLocalMaintainerRegistryUrl,\n shortHash,\n} from \"./local-maintainer-registry-shared.js\";\n\nexport {\n didLocalMaintainerSnapshotChange,\n getLocalMaintainerNpmrcContent,\n isLocalMaintainerRegistryEnabled,\n isLocalMaintainerRegistryUrl,\n};\n\nconst MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));\n\nfunction getCliPackageRoot(): string {\n try {\n return path.join(\n resolveCliRepoRoot(import.meta.url),\n \"apps\",\n \"dreamboard-cli\",\n );\n } catch {\n return resolveInstalledCliPackageRoot(MODULE_DIR);\n }\n}\n\nfunction resolveInstalledCliPackageRoot(moduleDir: string): string {\n let current = moduleDir;\n while (true) {\n const packageJsonPath = path.join(current, \"package.json\");\n if (existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(\n readFileSync(packageJsonPath, \"utf8\"),\n ) as { name?: unknown };\n if (\n packageJson.name === \"@dreamboard-games/cli\" ||\n packageJson.name === \"dreamboard\" ||\n packageJson.name === \"dreamboard-cli\"\n ) {\n return current;\n }\n } catch {\n // Keep walking upward; a malformed parent package should not hide the\n // installed CLI package root.\n }\n }\n\n const parent = path.dirname(current);\n if (parent === current) {\n return moduleDir;\n }\n current = parent;\n }\n}\n\nfunction getScriptInvocation(): {\n command: string;\n args: string[];\n attemptedCommand: string;\n cwd: string;\n} {\n const cliPackageRoot = getCliPackageRoot();\n const scriptPath = getLocalMaintainerScriptPath(cliPackageRoot);\n if (!existsSync(scriptPath)) {\n throw new Error(\n [\n \"Dreamboard local maintainer registry support is only available from a source checkout.\",\n `Expected helper script at ${scriptPath}.`,\n ].join(\" \"),\n );\n }\n\n const command = process.platform === \"win32\" ? \"pnpm.cmd\" : \"pnpm\";\n const args = [\"exec\", \"tsx\", scriptPath];\n return {\n command,\n args,\n attemptedCommand: `${command} ${args.join(\" \")}`,\n cwd: cliPackageRoot,\n };\n}\n\nfunction getLocalMaintainerScriptPath(cliPackageRoot: string): string {\n return path.join(cliPackageRoot, \"scripts\", \"local-maintainer-registry.ts\");\n}\n\nfunction isInstalledCliPackageRoot(cliPackageRoot: string): boolean {\n return cliPackageRoot.split(path.sep).includes(\"node_modules\");\n}\n\nfunction shouldSkipLocalMaintainerHelper(): boolean {\n const cliPackageRoot = getCliPackageRoot();\n const scriptPath = getLocalMaintainerScriptPath(cliPackageRoot);\n return !existsSync(scriptPath) && isInstalledCliPackageRoot(cliPackageRoot);\n}\n\nexport function buildInstalledCliLocalMaintainerSnapshot(\n packageJson: { dependencies?: Record<string, unknown> },\n registryUrl: string = LOCAL_REGISTRY_URL,\n): LocalMaintainerRegistryConfig | null {\n const sdkVersion = packageJson.dependencies?.[\"@dreamboard-games/sdk\"];\n if (typeof sdkVersion !== \"string\" || !sdkVersion.includes(\"-local.\")) {\n return null;\n }\n\n return {\n registryUrl,\n snapshotId: shortHash(sdkVersion),\n fingerprint: shortHash(sdkVersion),\n publishedAt: \"\",\n packages: {\n \"@dreamboard-games/sdk\": sdkVersion,\n },\n };\n}\n\nexport function readInstalledCliLocalMaintainerSnapshot(): LocalMaintainerRegistryConfig | null {\n const cliPackageRoot = getCliPackageRoot();\n if (!isInstalledCliPackageRoot(cliPackageRoot)) {\n return null;\n }\n\n const packageJsonPath = path.join(cliPackageRoot, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return null;\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n dependencies?: Record<string, unknown>;\n };\n return buildInstalledCliLocalMaintainerSnapshot(packageJson);\n}\n\nfunction buildScriptSetupError(options: {\n attemptedCommand: string;\n message: string;\n stderr?: string;\n}): Error {\n return new Error(\n [\n \"Dreamboard local maintainer registry support requires the source-checkout CLI tooling.\",\n options.message,\n `Attempted command: ${options.attemptedCommand}`,\n options.stderr?.trim() ? `stderr:\\n${options.stderr.trim()}` : null,\n ]\n .filter(Boolean)\n .join(\"\\n\"),\n );\n}\n\nfunction parseJsonPayload<T>(output: string): T {\n const payload = output\n .trim()\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .reverse()\n .find(\n (line) => line === \"null\" || line.startsWith(\"{\") || line.startsWith(\"[\"),\n );\n\n if (!payload) {\n throw new Error(\"completed without returning a JSON payload\");\n }\n\n return JSON.parse(payload) as T;\n}\n\nasync function runLocalMaintainerScript<T>(args: string[]): Promise<T> {\n const invocation = getScriptInvocation();\n\n return new Promise<T>((resolve, reject) => {\n const child = spawn(invocation.command, [...invocation.args, ...args], {\n cwd: invocation.cwd,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n env: process.env,\n });\n let stdout = \"\";\n let stderr = \"\";\n\n child.stdout.on(\"data\", (chunk) => {\n stdout += chunk.toString();\n });\n child.stderr.on(\"data\", (chunk) => {\n stderr += chunk.toString();\n });\n child.on(\"error\", (error) => {\n const errnoError = error as NodeJS.ErrnoException;\n if (errnoError.code === \"ENOENT\") {\n reject(\n buildScriptSetupError({\n attemptedCommand: invocation.attemptedCommand,\n message:\n \"`pnpm` was not found on PATH, so the source-checkout local maintainer helper could not run.\",\n }),\n );\n return;\n }\n reject(error);\n });\n child.on(\"close\", (code) => {\n if (code !== 0) {\n const missingTsx =\n stderr.includes('Command \"tsx\" not found') ||\n stderr.includes(\"tsx: command not found\") ||\n stderr.includes(\"tsx: not found\");\n reject(\n buildScriptSetupError({\n attemptedCommand: invocation.attemptedCommand,\n message: missingTsx\n ? \"`tsx` is not available for the source-checkout CLI package.\"\n : \"The source-checkout local maintainer helper failed.\",\n stderr,\n }),\n );\n return;\n }\n\n const trimmedStdout = stdout.trim();\n if (!trimmedStdout) {\n reject(\n buildScriptSetupError({\n attemptedCommand: invocation.attemptedCommand,\n message:\n \"The source-checkout local maintainer helper completed without returning JSON.\",\n stderr,\n }),\n );\n return;\n }\n\n try {\n resolve(parseJsonPayload<T>(trimmedStdout));\n } catch (error) {\n reject(\n buildScriptSetupError({\n attemptedCommand: invocation.attemptedCommand,\n message: `Failed to parse JSON from the source-checkout local maintainer helper: ${\n error instanceof Error ? error.message : String(error)\n }`,\n stderr: [stderr.trim(), trimmedStdout].filter(Boolean).join(\"\\n\"),\n }),\n );\n }\n });\n });\n}\n\nexport async function ensureLocalMaintainerSnapshot(\n apiBaseUrl: string,\n): Promise<LocalMaintainerRegistryConfig | null> {\n if (!isLocalMaintainerRegistryEnabled(apiBaseUrl)) {\n return null;\n }\n if (shouldSkipLocalMaintainerHelper()) {\n return readInstalledCliLocalMaintainerSnapshot();\n }\n\n return runLocalMaintainerScript<LocalMaintainerRegistryConfig | null>([\n \"ensure-snapshot\",\n \"--api-base-url\",\n apiBaseUrl,\n ]);\n}\n\nexport async function readWorkspaceLocalMaintainerRegistry(\n projectRoot: string,\n fallbackRegistryUrl: string = LOCAL_REGISTRY_URL,\n): Promise<LocalMaintainerRegistryConfig | null> {\n if (shouldSkipLocalMaintainerHelper()) {\n return null;\n }\n return runLocalMaintainerScript<LocalMaintainerRegistryConfig | null>([\n \"read-workspace\",\n \"--project-root\",\n projectRoot,\n \"--fallback-registry-url\",\n fallbackRegistryUrl,\n ]);\n}\n","import crypto from \"node:crypto\";\nimport path from \"node:path\";\nimport { BUILD_CHANNEL, IS_PUBLISHED_BUILD } from \"../../build-target.js\";\nimport { ENVIRONMENT_CONFIGS } from \"../../constants.js\";\nimport type {\n LocalMaintainerRegistryConfig,\n LocalMaintainerRegistryPackages,\n LocalMaintainerSdkPackageName,\n} from \"../../types.js\";\nimport { exists, readJsonFile } from \"../../utils/fs.js\";\n\nconst localRegistryAddress = readLocalRegistryAddress();\nexport const LOCAL_REGISTRY_HOST = localRegistryAddress.host;\nexport const LOCAL_REGISTRY_PORT = localRegistryAddress.port;\nexport const LOCAL_REGISTRY_URL = `http://${LOCAL_REGISTRY_HOST}:${LOCAL_REGISTRY_PORT}`;\nexport const LOCAL_SCOPE_NPMRC_CONTENT = `@dreamboard-games:registry=${LOCAL_REGISTRY_URL}\\n`;\nexport const SDK_PUBLISH_ORDER: readonly LocalMaintainerSdkPackageName[] = [\n \"@dreamboard-games/sdk\",\n];\n\nexport type PackageJsonShape = {\n name?: string;\n version?: string;\n description?: string;\n type?: string;\n main?: string;\n types?: string;\n exports?: unknown;\n typesVersions?: Record<string, unknown>;\n files?: string[];\n bin?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n};\n\nfunction readLocalRegistryAddress(): { host: string; port: number } {\n const urlOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_URL?.trim();\n const hostOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_HOST?.trim();\n const portOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_PORT?.trim();\n if (urlOverride) {\n let parsed: URL;\n try {\n parsed = new URL(urlOverride);\n } catch {\n throw new Error(\n `Invalid DREAMBOARD_LOCAL_REGISTRY_URL '${urlOverride}'. Expected an http://host:port URL.`,\n );\n }\n if (parsed.protocol !== \"http:\" || !parsed.hostname || !parsed.port) {\n throw new Error(\n `Invalid DREAMBOARD_LOCAL_REGISTRY_URL '${urlOverride}'. Expected an http://host:port URL.`,\n );\n }\n return {\n host: hostOverride || parsed.hostname,\n port: parseLocalRegistryPort(portOverride || parsed.port),\n };\n }\n return {\n host: hostOverride || \"127.0.0.1\",\n port: portOverride ? parseLocalRegistryPort(portOverride) : 4873,\n };\n}\n\nfunction parseLocalRegistryPort(raw: string): number {\n const port = Number.parseInt(raw, 10);\n if (!Number.isInteger(port) || port < 1 || port > 65535) {\n throw new Error(\n `Invalid DREAMBOARD_LOCAL_REGISTRY_PORT '${raw}'. Expected a TCP port from 1 to 65535.`,\n );\n }\n return port;\n}\n\nexport function shortHash(value: string): string {\n return crypto.createHash(\"sha256\").update(value).digest(\"hex\").slice(0, 12);\n}\n\nexport function isLocalMaintainerRegistryEnabled(apiBaseUrl: string): boolean {\n let isLocalLoopbackUrl = false;\n try {\n const parsed = new URL(apiBaseUrl);\n isLocalLoopbackUrl =\n parsed.protocol === \"http:\" &&\n (parsed.hostname === \"localhost\" || parsed.hostname === \"127.0.0.1\");\n } catch {\n isLocalLoopbackUrl = false;\n }\n\n return (\n !IS_PUBLISHED_BUILD &&\n (apiBaseUrl === ENVIRONMENT_CONFIGS.local?.apiBaseUrl ||\n isLocalLoopbackUrl) &&\n BUILD_CHANNEL === \"development\"\n );\n}\n\nexport function packageShortName(\n packageName: LocalMaintainerSdkPackageName,\n): string {\n return packageName.replace(/^@dreamboard(?:-games)?\\//, \"\");\n}\n\nexport async function readWorkspaceLocalMaintainerRegistryFromPackageJson(\n projectRoot: string,\n fallbackRegistryUrl: string = LOCAL_REGISTRY_URL,\n): Promise<LocalMaintainerRegistryConfig | null> {\n const packageJsonPath = path.join(projectRoot, \"package.json\");\n if (!(await exists(packageJsonPath))) {\n return null;\n }\n\n const packageJson = await readJsonFile<PackageJsonShape>(packageJsonPath);\n const sdkVersion =\n packageJson.dependencies?.[\"@dreamboard-games/sdk\"] ??\n packageJson.devDependencies?.[\"@dreamboard-games/sdk\"];\n const apiClientVersion =\n packageJson.dependencies?.[\"@dreamboard-games/api-client\"] ??\n packageJson.devDependencies?.[\"@dreamboard-games/api-client\"];\n const sdkDependencyVersion =\n packageJson.dependencies?.[\"@dreamboard-games/sdk\"];\n if (!sdkVersion?.includes(\"-local.\") || !sdkDependencyVersion) {\n return null;\n }\n const localSdkVersion = sdkVersion;\n\n const fingerprintSource = [\n apiClientVersion ?? \"\",\n localSdkVersion,\n fallbackRegistryUrl,\n ].join(\":\");\n return {\n registryUrl: fallbackRegistryUrl,\n snapshotId: shortHash(fingerprintSource),\n fingerprint: shortHash(fingerprintSource),\n publishedAt: \"\",\n packages: {\n \"@dreamboard-games/api-client\": apiClientVersion,\n \"@dreamboard-games/sdk\": localSdkVersion,\n } satisfies LocalMaintainerRegistryPackages,\n };\n}\n\nexport function getLocalMaintainerNpmrcContent(\n localMaintainerRegistry: LocalMaintainerRegistryConfig | null | undefined,\n): string | null {\n if (!localMaintainerRegistry) {\n return null;\n }\n return LOCAL_SCOPE_NPMRC_CONTENT.replace(\n LOCAL_REGISTRY_URL,\n localMaintainerRegistry.registryUrl,\n );\n}\n\nexport function didLocalMaintainerSnapshotChange(\n previous: LocalMaintainerRegistryConfig | undefined,\n next: LocalMaintainerRegistryConfig | null,\n): boolean {\n if (!next) {\n return false;\n }\n return previous?.snapshotId !== next.snapshotId;\n}\n\nexport function isLocalMaintainerRegistryUrl(\n fileContent: string | null,\n): boolean {\n if (!fileContent) {\n return false;\n }\n return /@dreamboard-games:registry=http:\\/\\/127\\.0\\.0\\.1:\\d+/.test(\n fileContent,\n );\n}\n","import { defineCommand } from \"citty\";\nimport consola from \"consola\";\nimport {\n mapUpsertBlobContentsByContentHash,\n materializeSourceChangeOperations,\n type SourceContentChangeOperation,\n} from \"@dreamboard-games/api-client/source-revisions\";\nimport { CONFIG_FLAG_ARGS } from \"../command-args.js\";\nimport { resolveProjectContext } from \"../config/resolve.js\";\nimport { updateProjectState } from \"../config/project-config.js\";\nimport { parseSyncCommandArgs } from \"../flags.js\";\nimport {\n collectLocalFiles,\n computeManifestHash,\n getLocalDiff,\n loadManifest,\n loadRule,\n writeSnapshot,\n} from \"../services/project/local-files.js\";\nimport {\n isSourceRevisionPath,\n shouldAlwaysUpsertSourcePath,\n} from \"../services/project/source-revision-paths.js\";\nimport {\n assertCliStaticScaffoldComplete,\n scaffoldStaticWorkspace,\n} from \"../services/project/static-scaffold.js\";\nimport {\n createGameRevisionSdk,\n uploadProjectSourceBlobsSdk,\n} from \"../services/api/index.js\";\nimport {\n getProjectAuthoringState,\n getProjectLocalMaintainerRegistry,\n getProjectPendingAuthoringSync,\n updateProjectAuthoringState,\n updateProjectLocalMaintainerRegistry,\n} from \"../services/project/project-state.js\";\nimport type { ProjectConfig } from \"../types.js\";\nimport { applyWorkspaceCodegen } from \"../services/project/workspace-codegen.js\";\nimport {\n didLocalMaintainerSnapshotChange,\n ensureLocalMaintainerSnapshot,\n isLocalMaintainerRegistryEnabled,\n} from \"../services/project/local-maintainer-registry.js\";\nimport { reconcileWorkspaceDependencies } from \"../services/project/workspace-dependencies.js\";\nimport { assertReducerContractPreflight } from \"../services/project/reducer-contract-preflight.js\";\nimport { assertReducerBundleSmoke } from \"../services/project/reducer-bundle-preflight.js\";\nimport { runLocalTypecheck } from \"../services/project/local-typecheck.js\";\nimport { resolveRemoteProject } from \"../services/project/remote-project.js\";\nimport { assertReleaseEnvironmentPortableDependencies } from \"../services/project/dependency-portability.js\";\n\nasync function runLoggedStep<T>(\n message: string,\n task: () => Promise<T>,\n): Promise<T> {\n consola.start(message);\n return task();\n}\n\nasync function persistProjectConfig(options: {\n projectRoot: string;\n projectConfig: ProjectConfig;\n}): Promise<ProjectConfig> {\n await updateProjectState(options.projectRoot, options.projectConfig);\n return options.projectConfig;\n}\n\nasync function finalizeLocalSync(options: {\n projectRoot: string;\n projectConfig: ProjectConfig;\n}): Promise<ProjectConfig> {\n const { projectRoot, projectConfig } = options;\n await scaffoldStaticWorkspace(projectRoot, \"update\", {\n localMaintainerRegistry: getProjectLocalMaintainerRegistry(projectConfig),\n });\n await applyWorkspaceCodegen({\n projectRoot,\n manifest: await loadManifest(projectRoot),\n });\n\n const finalizedProjectConfig = await persistProjectConfig({\n projectRoot,\n projectConfig,\n });\n await writeSnapshot(projectRoot);\n return finalizedProjectConfig;\n}\n\nfunction buildSourceSnapshotChanges(\n localFiles: Record<string, string>,\n): SourceContentChangeOperation[] {\n return Object.entries(localFiles)\n .filter(\n ([filePath]) =>\n isSourceRevisionPath(filePath) ||\n shouldAlwaysUpsertSourcePath(filePath),\n )\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([path, content]) => ({\n kind: \"upsert\",\n path,\n content,\n }));\n}\n\nexport default defineCommand({\n meta: {\n name: \"sync\",\n description:\n \"Upload authored changes and advance the remote authoring head\",\n },\n args: {\n force: {\n type: \"boolean\",\n description:\n \"Replace the full authored source tree, manifest, and rules, overwriting the remote head with the local copy even when the remote has moved\",\n default: false,\n },\n yes: {\n type: \"boolean\",\n alias: \"y\",\n description: \"Reserved for non-interactive scaffold flows\",\n default: false,\n },\n ...CONFIG_FLAG_ARGS,\n },\n async run({ args }) {\n const parsedArgs = parseSyncCommandArgs(args);\n const { projectRoot, projectConfig, config } =\n await resolveProjectContext(parsedArgs);\n let nextProjectConfig = projectConfig;\n await assertReleaseEnvironmentPortableDependencies({\n projectRoot,\n projectConfig: nextProjectConfig,\n environment: config.environment,\n });\n const localMaintainerEnabled = isLocalMaintainerRegistryEnabled(\n config.apiBaseUrl,\n );\n const existingLocalMaintainerRegistry =\n getProjectLocalMaintainerRegistry(projectConfig);\n const refreshedLocalMaintainerRegistry = localMaintainerEnabled\n ? await runLoggedStep(\"Checking local SDK snapshot...\", () =>\n ensureLocalMaintainerSnapshot(config.apiBaseUrl),\n )\n : await ensureLocalMaintainerSnapshot(config.apiBaseUrl);\n const localMaintainerRegistry =\n refreshedLocalMaintainerRegistry ??\n (localMaintainerEnabled\n ? (existingLocalMaintainerRegistry ?? null)\n : null);\n const localMaintainerSnapshotChanged = didLocalMaintainerSnapshotChange(\n existingLocalMaintainerRegistry,\n refreshedLocalMaintainerRegistry,\n );\n if (refreshedLocalMaintainerRegistry) {\n nextProjectConfig = updateProjectLocalMaintainerRegistry(\n nextProjectConfig,\n refreshedLocalMaintainerRegistry,\n );\n consola.info(\n localMaintainerSnapshotChanged\n ? \"Local SDK snapshot refreshed.\"\n : \"Using existing local SDK snapshot.\",\n );\n } else if (localMaintainerRegistry) {\n consola.info(\"Using workspace-pinned local SDK snapshot.\");\n }\n\n await runLoggedStep(\"Refreshing static scaffold...\", () =>\n scaffoldStaticWorkspace(projectRoot, \"update\", {\n localMaintainerRegistry,\n }),\n );\n const localManifest = await loadManifest(projectRoot);\n await runLoggedStep(\"Applying workspace codegen...\", async () =>\n applyWorkspaceCodegen({\n projectRoot,\n manifest: localManifest,\n }),\n );\n const dependencyState = await runLoggedStep(\n \"Reconciling workspace dependencies...\",\n () => reconcileWorkspaceDependencies(projectRoot),\n );\n if (\n dependencyState.packageManagerNormalized ||\n dependencyState.lockfileGenerated ||\n dependencyState.installed ||\n localMaintainerSnapshotChanged\n ) {\n consola.info(\"Workspace dependencies reconciled.\");\n } else {\n consola.info(\"Workspace dependencies already up to date.\");\n }\n await runLoggedStep(\"Validating reducer contract...\", () =>\n assertReducerContractPreflight(projectRoot),\n );\n const typecheckResult = await runLoggedStep(\n \"Running local typecheck...\",\n () => runLocalTypecheck(projectRoot),\n );\n if (typecheckResult.skipped) {\n if (typecheckResult.output) {\n consola.warn(typecheckResult.output);\n }\n } else if (!typecheckResult.success) {\n if (typecheckResult.output) {\n consola.error(typecheckResult.output);\n }\n throw new Error(\n \"Local typecheck failed. Fix the diagnostics before syncing.\",\n );\n }\n await runLoggedStep(\"Smoke-testing reducer bundle...\", async () =>\n assertReducerBundleSmoke({\n projectRoot,\n manifest: localManifest,\n }),\n );\n consola.success(\"Reducer bundle smoke test passed.\");\n\n const remoteProject = await runLoggedStep(\"Ensuring remote project...\", () =>\n resolveRemoteProject({\n projectRoot,\n projectConfig: nextProjectConfig,\n config,\n }),\n );\n nextProjectConfig = remoteProject.projectConfig;\n\n const localDiff = await getLocalDiff(projectRoot);\n await assertCliStaticScaffoldComplete(projectRoot, localDiff.deleted);\n\n const localAuthoring = getProjectAuthoringState(nextProjectConfig);\n const pendingSync = getProjectPendingAuthoringSync(nextProjectConfig);\n const remoteHeadDigest = remoteProject.project.head?.revisionDigest;\n const localHeadDigest =\n localAuthoring.revisionDigest ?? nextProjectConfig.remoteHeadDigest;\n\n if (pendingSync && !parsedArgs.force) {\n throw new Error(\n \"This workspace has an unfinished legacy sync checkpoint. Run 'dreamboard sync --force' to replace it with an atomic project revision.\",\n );\n }\n\n if (\n remoteHeadDigest &&\n localHeadDigest &&\n remoteHeadDigest !== localHeadDigest\n ) {\n if (parsedArgs.force) {\n consola.warn(\n `Remote project head has moved to ${remoteHeadDigest}. --force will overwrite it with this workspace's local copy.`,\n );\n } else {\n throw new Error(\n `Remote project head has moved to ${remoteHeadDigest}. Run 'dreamboard pull' before syncing local changes, or pass --force to overwrite the remote with the local copy.`,\n );\n }\n }\n\n if (remoteHeadDigest && !localHeadDigest) {\n if (parsedArgs.force) {\n consola.warn(\n `This workspace has no authored base but the remote project head is ${remoteHeadDigest}. --force will overwrite it with this workspace's local copy.`,\n );\n } else {\n throw new Error(\n `This workspace has no authored base but the remote project head is ${remoteHeadDigest}. Re-clone, run 'dreamboard pull --force' into a clean workspace, or pass --force to overwrite the remote with the local copy.`,\n );\n }\n }\n\n const hasChanges =\n localDiff.modified.length > 0 ||\n localDiff.added.length > 0 ||\n localDiff.deleted.length > 0;\n const localManifestContentHash = computeManifestHash(localManifest);\n const manifestOutOfSync =\n localAuthoring.localManifestContentHash !== localManifestContentHash;\n if (\n !hasChanges &&\n !parsedArgs.force &&\n localHeadDigest != null &&\n remoteHeadDigest === localHeadDigest &&\n !pendingSync &&\n !manifestOutOfSync\n ) {\n consola.info(\"No local authored changes to sync.\");\n return;\n }\n\n const localFiles = await collectLocalFiles(projectRoot);\n const sourceChanges = buildSourceSnapshotChanges(localFiles);\n const { changes } = await materializeSourceChangeOperations(sourceChanges);\n const uploadBlobs = mapUpsertBlobContentsByContentHash(\n sourceChanges,\n changes,\n );\n await uploadProjectSourceBlobsSdk(\n nextProjectConfig.projectId,\n Array.from(uploadBlobs.values()),\n );\n\n const sourceFiles = changes\n .filter((change) => change.kind === \"upsert\")\n .map(({ path, contentHash, byteSize }) => ({\n path,\n contentHash,\n byteSize,\n }));\n const revision = await createGameRevisionSdk({\n projectId: nextProjectConfig.projectId,\n request: {\n ...(remoteHeadDigest ? { baseRevisionDigest: remoteHeadDigest } : {}),\n source: { files: sourceFiles },\n ruleText: await loadRule(projectRoot),\n manifest: localManifest,\n },\n });\n nextProjectConfig = await persistProjectConfig({\n projectRoot,\n projectConfig: {\n ...updateProjectAuthoringState(nextProjectConfig, {\n revisionDigest: revision.revisionDigest,\n sourceTreeHash: revision.sourceTreeHash,\n manifestContentHash: revision.manifestContentHash,\n localManifestContentHash,\n }),\n remoteHeadDigest: revision.revisionDigest,\n },\n });\n nextProjectConfig = await finalizeLocalSync({\n projectRoot,\n projectConfig: nextProjectConfig,\n });\n\n consola.success(\n `Synced revision ${revision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