@dreamboard-games/cli 0.1.30-alpha.1 → 0.1.30-alpha.2
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.
- package/README.md +179 -22
- package/dist/{chunk-C6UAT6EH.js → chunk-N7XPNNUI.js} +9 -12
- package/dist/chunk-N7XPNNUI.js.map +1 -0
- package/dist/chunk-SEGVTWSK.js +44 -0
- package/dist/{chunk-RS7UXJZV.js → chunk-TAQKH67O.js} +21300 -35881
- package/dist/chunk-TAQKH67O.js.map +1 -0
- package/dist/{global-config-AGFBDFYD.js → global-config-S4ZIPECE.js} +3 -3
- package/dist/index.js +415 -37
- package/dist/index.js.map +1 -1
- package/dist/internal.js +3 -4
- package/dist/{agent-verifier/keychain-backend-TNOPQV3Z.mjs → keychain-backend-HDF4TZDL.js} +2 -1
- package/dist/{agent-verifier/prompt-3BAINGAQ.mjs → prompt-NDV3AE5L.js} +2 -1
- package/package.json +6 -6
- package/skills/dreamboard/references/building-your-first-game.md +510 -0
- package/skills/dreamboard/references/cli.md +104 -0
- package/skills/dreamboard/references/game-interface.md +548 -0
- package/skills/dreamboard/references/manifest-authoring.md +597 -0
- package/skills/dreamboard/references/quickstart.md +66 -0
- package/skills/dreamboard/references/reducer.md +864 -0
- package/skills/dreamboard/references/rule-authoring.md +147 -0
- package/skills/dreamboard/references/testing.md +249 -0
- package/skills/dreamboard/scripts/events-extract.mjs +218 -0
- package/dist/agent-verifier/agent-workspace-verifier.mjs +0 -227
- package/dist/agent-verifier/chunk-2E5P5NWG.mjs +0 -835
- package/dist/agent-verifier/chunk-2GBBP27W.mjs +0 -301
- package/dist/agent-verifier/chunk-2QMNAVV4.mjs +0 -14522
- package/dist/agent-verifier/chunk-2SZHMP6F.mjs +0 -264
- package/dist/agent-verifier/chunk-4WD3YU2E.mjs +0 -166
- package/dist/agent-verifier/chunk-54TAYXUD.mjs +0 -12
- package/dist/agent-verifier/chunk-6A5HRJMQ.mjs +0 -3174
- package/dist/agent-verifier/chunk-6UUJEYDV.mjs +0 -213
- package/dist/agent-verifier/chunk-7653FPGJ.mjs +0 -381
- package/dist/agent-verifier/chunk-7E65UQLY.mjs +0 -38
- package/dist/agent-verifier/chunk-BVVNBJM4.mjs +0 -221
- package/dist/agent-verifier/chunk-CEDUHGNH.mjs +0 -74
- package/dist/agent-verifier/chunk-CEQ2VJWN.mjs +0 -149
- package/dist/agent-verifier/chunk-CFU5EWIC.mjs +0 -69
- package/dist/agent-verifier/chunk-CJEEA6NJ.mjs +0 -730
- package/dist/agent-verifier/chunk-EIQWDQWJ.mjs +0 -186
- package/dist/agent-verifier/chunk-EOQIV6PS.mjs +0 -649
- package/dist/agent-verifier/chunk-HBNDKQT5.mjs +0 -8381
- package/dist/agent-verifier/chunk-HJFQDSTU.mjs +0 -225
- package/dist/agent-verifier/chunk-JH22JNYD.mjs +0 -1681
- package/dist/agent-verifier/chunk-LI3ZR3BI.mjs +0 -41
- package/dist/agent-verifier/chunk-LM3OZLZG.mjs +0 -48
- package/dist/agent-verifier/chunk-MINCYHXN.mjs +0 -106
- package/dist/agent-verifier/chunk-MRCUP5SW.mjs +0 -128
- package/dist/agent-verifier/chunk-RBDDIIPM.mjs +0 -19
- package/dist/agent-verifier/chunk-SHUMAVAP.mjs +0 -59
- package/dist/agent-verifier/chunk-SYPLYRGB.mjs +0 -2812
- package/dist/agent-verifier/chunk-U6OJN7XS.mjs +0 -8092
- package/dist/agent-verifier/chunk-VYJTHSYR.mjs +0 -44
- package/dist/agent-verifier/chunk-XYDL7GY6.mjs +0 -10
- package/dist/agent-verifier/compile-5QSPIOUT.mjs +0 -313
- package/dist/agent-verifier/global-config-WX3ZZIVU.mjs +0 -17
- package/dist/agent-verifier/local-files-MTPLP62S.mjs +0 -46
- package/dist/agent-verifier/local-typecheck-QFYYAZOK.mjs +0 -9
- package/dist/agent-verifier/materialize-workspace-FKALAE2T.mjs +0 -90
- package/dist/agent-verifier/project-state-7GR6BQTQ.mjs +0 -32
- package/dist/agent-verifier/reducer-bundle-preflight-C73LEXI2.mjs +0 -23
- package/dist/agent-verifier/reducer-contract-preflight-22X7DSZW.mjs +0 -10
- package/dist/agent-verifier/reducer-native-test-harness-GMWBUISX.mjs +0 -53
- package/dist/agent-verifier/static-scaffold-AJMZZQWS.mjs +0 -28
- package/dist/agent-verifier/sync-3DUQH32H.mjs +0 -594
- package/dist/agent-verifier/test-P4U5INTD.mjs +0 -356
- package/dist/agent-verifier/testing-5K2BJYF2.mjs +0 -674
- package/dist/agent-verifier/workspace-codegen-JDZJRSDV.mjs +0 -11
- package/dist/agent-verifier/workspace-dependencies-HZ6VVS4G.mjs +0 -14
- package/dist/chunk-2H7UOFLK.js +0 -11
- package/dist/chunk-7FOO4AJI.js +0 -50
- package/dist/chunk-7FOO4AJI.js.map +0 -1
- package/dist/chunk-C6UAT6EH.js.map +0 -1
- package/dist/chunk-RS7UXJZV.js.map +0 -1
- package/dist/internal.d.ts +0 -311
- package/dist/keychain-backend-JHTXAKWC.js +0 -135
- package/dist/prompt-GMZABCJC.js +0 -756
- package/dist/runtime-packages/ui-host-runtime/src/actor-principal.ts +0 -71
- package/dist/runtime-packages/ui-host-runtime/src/browser-interaction.ts +0 -139
- package/dist/runtime-packages/ui-host-runtime/src/components/host-controls.tsx +0 -374
- package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback-toaster.tsx +0 -266
- package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback.tsx +0 -212
- package/dist/runtime-packages/ui-host-runtime/src/components/host-primitives.tsx +0 -271
- package/dist/runtime-packages/ui-host-runtime/src/components/host-session-metadata.tsx +0 -135
- package/dist/runtime-packages/ui-host-runtime/src/components/index.ts +0 -5
- package/dist/runtime-packages/ui-host-runtime/src/components/perf-overlay.tsx +0 -194
- package/dist/runtime-packages/ui-host-runtime/src/gameplay-authority-transport.ts +0 -626
- package/dist/runtime-packages/ui-host-runtime/src/host-controls.tsx +0 -1
- package/dist/runtime-packages/ui-host-runtime/src/host-feedback.tsx +0 -1
- package/dist/runtime-packages/ui-host-runtime/src/host-session-transport.ts +0 -294
- package/dist/runtime-packages/ui-host-runtime/src/index.ts +0 -3
- package/dist/runtime-packages/ui-host-runtime/src/logger.ts +0 -11
- package/dist/runtime-packages/ui-host-runtime/src/perf.ts +0 -324
- package/dist/runtime-packages/ui-host-runtime/src/plugin-bridge.ts +0 -195
- package/dist/runtime-packages/ui-host-runtime/src/plugin-health-check.ts +0 -138
- package/dist/runtime-packages/ui-host-runtime/src/plugin-messages.ts +0 -159
- package/dist/runtime-packages/ui-host-runtime/src/plugin-session-gateway.ts +0 -551
- package/dist/runtime-packages/ui-host-runtime/src/runtime/index.ts +0 -13
- package/dist/runtime-packages/ui-host-runtime/src/screenshot/projection-to-snapshot.ts +0 -122
- package/dist/runtime-packages/ui-host-runtime/src/screenshot/static-store-api.ts +0 -26
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +0 -583
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress.ts +0 -219
- package/dist/runtime-packages/ui-host-runtime/src/session-live-runtime.ts +0 -117
- package/dist/runtime-packages/ui-host-runtime/src/session-model.ts +0 -431
- package/dist/runtime-packages/ui-host-runtime/src/session-projection.ts +0 -211
- package/dist/runtime-packages/ui-host-runtime/src/session-recovery.ts +0 -80
- package/dist/runtime-packages/ui-host-runtime/src/session-state-reducer.ts +0 -1034
- package/dist/runtime-packages/ui-host-runtime/src/sse-manager.ts +0 -416
- package/dist/runtime-packages/ui-host-runtime/src/unified-session-store.ts +0 -184
- package/dist/testing-KLSV6CPJ.js +0 -674
- package/dist/testing-KLSV6CPJ.js.map +0 -1
- /package/dist/{chunk-2H7UOFLK.js.map → chunk-SEGVTWSK.js.map} +0 -0
- /package/dist/{global-config-AGFBDFYD.js.map → global-config-S4ZIPECE.js.map} +0 -0
- /package/dist/{keychain-backend-JHTXAKWC.js.map → keychain-backend-HDF4TZDL.js.map} +0 -0
- /package/dist/{prompt-GMZABCJC.js.map → prompt-NDV3AE5L.js.map} +0 -0
|
@@ -1,594 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
assertReducerContractPreflight
|
|
4
|
-
} from "./chunk-VYJTHSYR.mjs";
|
|
5
|
-
import {
|
|
6
|
-
assertReducerBundleSmoke
|
|
7
|
-
} from "./chunk-2SZHMP6F.mjs";
|
|
8
|
-
import "./chunk-HBNDKQT5.mjs";
|
|
9
|
-
import "./chunk-CEDUHGNH.mjs";
|
|
10
|
-
import {
|
|
11
|
-
resolveRemoteProject
|
|
12
|
-
} from "./chunk-7E65UQLY.mjs";
|
|
13
|
-
import {
|
|
14
|
-
CONFIG_FLAG_ARGS,
|
|
15
|
-
createGameRevisionSdk,
|
|
16
|
-
mapUpsertBlobContentsByContentHash,
|
|
17
|
-
materializeSourceChangeOperations,
|
|
18
|
-
parseSyncCommandArgs,
|
|
19
|
-
uploadProjectSourceBlobsSdk
|
|
20
|
-
} from "./chunk-EOQIV6PS.mjs";
|
|
21
|
-
import "./chunk-BVVNBJM4.mjs";
|
|
22
|
-
import {
|
|
23
|
-
getProjectAuthoringState,
|
|
24
|
-
getProjectLocalMaintainerRegistry,
|
|
25
|
-
getProjectPendingAuthoringSync,
|
|
26
|
-
updateProjectAuthoringState,
|
|
27
|
-
updateProjectLocalMaintainerRegistry
|
|
28
|
-
} from "./chunk-MRCUP5SW.mjs";
|
|
29
|
-
import {
|
|
30
|
-
runLocalTypecheck
|
|
31
|
-
} from "./chunk-CEQ2VJWN.mjs";
|
|
32
|
-
import "./chunk-LI3ZR3BI.mjs";
|
|
33
|
-
import {
|
|
34
|
-
assertReleaseEnvironmentPortableDependencies,
|
|
35
|
-
consola,
|
|
36
|
-
resolveProjectContext
|
|
37
|
-
} from "./chunk-JH22JNYD.mjs";
|
|
38
|
-
import "./chunk-HJFQDSTU.mjs";
|
|
39
|
-
import {
|
|
40
|
-
collectLocalFiles,
|
|
41
|
-
getLocalDiff,
|
|
42
|
-
loadManifest,
|
|
43
|
-
loadRule,
|
|
44
|
-
writeSnapshot
|
|
45
|
-
} from "./chunk-EIQWDQWJ.mjs";
|
|
46
|
-
import {
|
|
47
|
-
assertCliStaticScaffoldComplete,
|
|
48
|
-
scaffoldStaticWorkspace
|
|
49
|
-
} from "./chunk-CJEEA6NJ.mjs";
|
|
50
|
-
import "./chunk-2GBBP27W.mjs";
|
|
51
|
-
import {
|
|
52
|
-
BUILD_CHANNEL,
|
|
53
|
-
IS_PUBLISHED_BUILD,
|
|
54
|
-
updateProjectState
|
|
55
|
-
} from "./chunk-4WD3YU2E.mjs";
|
|
56
|
-
import {
|
|
57
|
-
computeManifestHash
|
|
58
|
-
} from "./chunk-SYPLYRGB.mjs";
|
|
59
|
-
import "./chunk-2QMNAVV4.mjs";
|
|
60
|
-
import {
|
|
61
|
-
resolveCliRepoRoot
|
|
62
|
-
} from "./chunk-6UUJEYDV.mjs";
|
|
63
|
-
import "./chunk-2E5P5NWG.mjs";
|
|
64
|
-
import "./chunk-MINCYHXN.mjs";
|
|
65
|
-
import {
|
|
66
|
-
applyWorkspaceCodegen
|
|
67
|
-
} from "./chunk-CFU5EWIC.mjs";
|
|
68
|
-
import {
|
|
69
|
-
isAllowedGamePath,
|
|
70
|
-
isAuthoritativeGeneratedPath
|
|
71
|
-
} from "./chunk-U6OJN7XS.mjs";
|
|
72
|
-
import "./chunk-54TAYXUD.mjs";
|
|
73
|
-
import "./chunk-LM3OZLZG.mjs";
|
|
74
|
-
import {
|
|
75
|
-
reconcileWorkspaceDependencies
|
|
76
|
-
} from "./chunk-7653FPGJ.mjs";
|
|
77
|
-
import "./chunk-RBDDIIPM.mjs";
|
|
78
|
-
import {
|
|
79
|
-
ENVIRONMENT_CONFIGS,
|
|
80
|
-
RULE_FILE
|
|
81
|
-
} from "./chunk-SHUMAVAP.mjs";
|
|
82
|
-
import "./chunk-XYDL7GY6.mjs";
|
|
83
|
-
|
|
84
|
-
// src/commands/sync.ts
|
|
85
|
-
import { defineCommand } from "citty";
|
|
86
|
-
|
|
87
|
-
// src/services/project/source-revision-paths.ts
|
|
88
|
-
function isSourceRevisionPath(filePath) {
|
|
89
|
-
return filePath !== RULE_FILE && isAllowedGamePath(filePath);
|
|
90
|
-
}
|
|
91
|
-
function shouldAlwaysUpsertSourcePath(filePath) {
|
|
92
|
-
return filePath === ".npmrc" || isAuthoritativeGeneratedPath(filePath);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// src/services/project/local-maintainer-registry.ts
|
|
96
|
-
import { spawn } from "child_process";
|
|
97
|
-
import { existsSync, readFileSync } from "fs";
|
|
98
|
-
import path2 from "path";
|
|
99
|
-
import { fileURLToPath } from "url";
|
|
100
|
-
|
|
101
|
-
// src/services/project/local-maintainer-registry-shared.ts
|
|
102
|
-
import crypto from "crypto";
|
|
103
|
-
import path from "path";
|
|
104
|
-
var localRegistryAddress = readLocalRegistryAddress();
|
|
105
|
-
var LOCAL_REGISTRY_HOST = localRegistryAddress.host;
|
|
106
|
-
var LOCAL_REGISTRY_PORT = localRegistryAddress.port;
|
|
107
|
-
var LOCAL_REGISTRY_URL = `http://${LOCAL_REGISTRY_HOST}:${LOCAL_REGISTRY_PORT}`;
|
|
108
|
-
var LOCAL_SCOPE_NPMRC_CONTENT = `@dreamboard-games:registry=${LOCAL_REGISTRY_URL}
|
|
109
|
-
`;
|
|
110
|
-
function readLocalRegistryAddress() {
|
|
111
|
-
const urlOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_URL?.trim();
|
|
112
|
-
const hostOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_HOST?.trim();
|
|
113
|
-
const portOverride = process.env.DREAMBOARD_LOCAL_REGISTRY_PORT?.trim();
|
|
114
|
-
if (urlOverride) {
|
|
115
|
-
let parsed;
|
|
116
|
-
try {
|
|
117
|
-
parsed = new URL(urlOverride);
|
|
118
|
-
} catch {
|
|
119
|
-
throw new Error(
|
|
120
|
-
`Invalid DREAMBOARD_LOCAL_REGISTRY_URL '${urlOverride}'. Expected an http://host:port URL.`
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
if (parsed.protocol !== "http:" || !parsed.hostname || !parsed.port) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`Invalid DREAMBOARD_LOCAL_REGISTRY_URL '${urlOverride}'. Expected an http://host:port URL.`
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
host: hostOverride || parsed.hostname,
|
|
130
|
-
port: parseLocalRegistryPort(portOverride || parsed.port)
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
host: hostOverride || "127.0.0.1",
|
|
135
|
-
port: portOverride ? parseLocalRegistryPort(portOverride) : 4873
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function parseLocalRegistryPort(raw) {
|
|
139
|
-
const port = Number.parseInt(raw, 10);
|
|
140
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
141
|
-
throw new Error(
|
|
142
|
-
`Invalid DREAMBOARD_LOCAL_REGISTRY_PORT '${raw}'. Expected a TCP port from 1 to 65535.`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
return port;
|
|
146
|
-
}
|
|
147
|
-
function shortHash(value) {
|
|
148
|
-
return crypto.createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
149
|
-
}
|
|
150
|
-
function isLocalMaintainerRegistryEnabled(apiBaseUrl) {
|
|
151
|
-
let isLocalLoopbackUrl = false;
|
|
152
|
-
try {
|
|
153
|
-
const parsed = new URL(apiBaseUrl);
|
|
154
|
-
isLocalLoopbackUrl = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
|
|
155
|
-
} catch {
|
|
156
|
-
isLocalLoopbackUrl = false;
|
|
157
|
-
}
|
|
158
|
-
return !IS_PUBLISHED_BUILD && (apiBaseUrl === ENVIRONMENT_CONFIGS.local?.apiBaseUrl || isLocalLoopbackUrl) && BUILD_CHANNEL === "development";
|
|
159
|
-
}
|
|
160
|
-
function didLocalMaintainerSnapshotChange(previous, next) {
|
|
161
|
-
if (!next) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
return previous?.snapshotId !== next.snapshotId;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// src/services/project/local-maintainer-registry.ts
|
|
168
|
-
var MODULE_DIR = path2.dirname(fileURLToPath(import.meta.url));
|
|
169
|
-
function getCliPackageRoot() {
|
|
170
|
-
try {
|
|
171
|
-
return path2.join(
|
|
172
|
-
resolveCliRepoRoot(import.meta.url),
|
|
173
|
-
"apps",
|
|
174
|
-
"dreamboard-cli"
|
|
175
|
-
);
|
|
176
|
-
} catch {
|
|
177
|
-
return resolveInstalledCliPackageRoot(MODULE_DIR);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function resolveInstalledCliPackageRoot(moduleDir) {
|
|
181
|
-
let current = moduleDir;
|
|
182
|
-
while (true) {
|
|
183
|
-
const packageJsonPath = path2.join(current, "package.json");
|
|
184
|
-
if (existsSync(packageJsonPath)) {
|
|
185
|
-
try {
|
|
186
|
-
const packageJson = JSON.parse(
|
|
187
|
-
readFileSync(packageJsonPath, "utf8")
|
|
188
|
-
);
|
|
189
|
-
if (packageJson.name === "@dreamboard-games/cli" || packageJson.name === "dreamboard" || packageJson.name === "dreamboard-cli") {
|
|
190
|
-
return current;
|
|
191
|
-
}
|
|
192
|
-
} catch {
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const parent = path2.dirname(current);
|
|
196
|
-
if (parent === current) {
|
|
197
|
-
return moduleDir;
|
|
198
|
-
}
|
|
199
|
-
current = parent;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function getScriptInvocation() {
|
|
203
|
-
const cliPackageRoot = getCliPackageRoot();
|
|
204
|
-
const scriptPath = getLocalMaintainerScriptPath(cliPackageRoot);
|
|
205
|
-
if (!existsSync(scriptPath)) {
|
|
206
|
-
throw new Error(
|
|
207
|
-
[
|
|
208
|
-
"Dreamboard local maintainer registry support is only available from a source checkout.",
|
|
209
|
-
`Expected helper script at ${scriptPath}.`
|
|
210
|
-
].join(" ")
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
|
|
214
|
-
const args = ["exec", "tsx", scriptPath];
|
|
215
|
-
return {
|
|
216
|
-
command,
|
|
217
|
-
args,
|
|
218
|
-
attemptedCommand: `${command} ${args.join(" ")}`,
|
|
219
|
-
cwd: cliPackageRoot
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
function getLocalMaintainerScriptPath(cliPackageRoot) {
|
|
223
|
-
return path2.join(cliPackageRoot, "scripts", "local-maintainer-registry.ts");
|
|
224
|
-
}
|
|
225
|
-
function isInstalledCliPackageRoot(cliPackageRoot) {
|
|
226
|
-
return cliPackageRoot.split(path2.sep).includes("node_modules");
|
|
227
|
-
}
|
|
228
|
-
function shouldSkipLocalMaintainerHelper() {
|
|
229
|
-
const cliPackageRoot = getCliPackageRoot();
|
|
230
|
-
const scriptPath = getLocalMaintainerScriptPath(cliPackageRoot);
|
|
231
|
-
return !existsSync(scriptPath) && isInstalledCliPackageRoot(cliPackageRoot);
|
|
232
|
-
}
|
|
233
|
-
function buildInstalledCliLocalMaintainerSnapshot(packageJson, registryUrl = LOCAL_REGISTRY_URL) {
|
|
234
|
-
const sdkVersion = packageJson.dependencies?.["@dreamboard-games/sdk"];
|
|
235
|
-
if (typeof sdkVersion !== "string" || !sdkVersion.includes("-local.")) {
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
return {
|
|
239
|
-
registryUrl,
|
|
240
|
-
snapshotId: shortHash(sdkVersion),
|
|
241
|
-
fingerprint: shortHash(sdkVersion),
|
|
242
|
-
publishedAt: "",
|
|
243
|
-
packages: {
|
|
244
|
-
"@dreamboard-games/sdk": sdkVersion
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
function readInstalledCliLocalMaintainerSnapshot() {
|
|
249
|
-
const cliPackageRoot = getCliPackageRoot();
|
|
250
|
-
if (!isInstalledCliPackageRoot(cliPackageRoot)) {
|
|
251
|
-
return null;
|
|
252
|
-
}
|
|
253
|
-
const packageJsonPath = path2.join(cliPackageRoot, "package.json");
|
|
254
|
-
if (!existsSync(packageJsonPath)) {
|
|
255
|
-
return null;
|
|
256
|
-
}
|
|
257
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
258
|
-
return buildInstalledCliLocalMaintainerSnapshot(packageJson);
|
|
259
|
-
}
|
|
260
|
-
function buildScriptSetupError(options) {
|
|
261
|
-
return new Error(
|
|
262
|
-
[
|
|
263
|
-
"Dreamboard local maintainer registry support requires the source-checkout CLI tooling.",
|
|
264
|
-
options.message,
|
|
265
|
-
`Attempted command: ${options.attemptedCommand}`,
|
|
266
|
-
options.stderr?.trim() ? `stderr:
|
|
267
|
-
${options.stderr.trim()}` : null
|
|
268
|
-
].filter(Boolean).join("\n")
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
function parseJsonPayload(output) {
|
|
272
|
-
const payload = output.trim().split(/\r?\n/).map((line) => line.trim()).reverse().find(
|
|
273
|
-
(line) => line === "null" || line.startsWith("{") || line.startsWith("[")
|
|
274
|
-
);
|
|
275
|
-
if (!payload) {
|
|
276
|
-
throw new Error("completed without returning a JSON payload");
|
|
277
|
-
}
|
|
278
|
-
return JSON.parse(payload);
|
|
279
|
-
}
|
|
280
|
-
async function runLocalMaintainerScript(args) {
|
|
281
|
-
const invocation = getScriptInvocation();
|
|
282
|
-
return new Promise((resolve, reject) => {
|
|
283
|
-
const child = spawn(invocation.command, [...invocation.args, ...args], {
|
|
284
|
-
cwd: invocation.cwd,
|
|
285
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
286
|
-
env: process.env
|
|
287
|
-
});
|
|
288
|
-
let stdout = "";
|
|
289
|
-
let stderr = "";
|
|
290
|
-
child.stdout.on("data", (chunk) => {
|
|
291
|
-
stdout += chunk.toString();
|
|
292
|
-
});
|
|
293
|
-
child.stderr.on("data", (chunk) => {
|
|
294
|
-
stderr += chunk.toString();
|
|
295
|
-
});
|
|
296
|
-
child.on("error", (error) => {
|
|
297
|
-
const errnoError = error;
|
|
298
|
-
if (errnoError.code === "ENOENT") {
|
|
299
|
-
reject(
|
|
300
|
-
buildScriptSetupError({
|
|
301
|
-
attemptedCommand: invocation.attemptedCommand,
|
|
302
|
-
message: "`pnpm` was not found on PATH, so the source-checkout local maintainer helper could not run."
|
|
303
|
-
})
|
|
304
|
-
);
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
reject(error);
|
|
308
|
-
});
|
|
309
|
-
child.on("close", (code) => {
|
|
310
|
-
if (code !== 0) {
|
|
311
|
-
const missingTsx = stderr.includes('Command "tsx" not found') || stderr.includes("tsx: command not found") || stderr.includes("tsx: not found");
|
|
312
|
-
reject(
|
|
313
|
-
buildScriptSetupError({
|
|
314
|
-
attemptedCommand: invocation.attemptedCommand,
|
|
315
|
-
message: missingTsx ? "`tsx` is not available for the source-checkout CLI package." : "The source-checkout local maintainer helper failed.",
|
|
316
|
-
stderr
|
|
317
|
-
})
|
|
318
|
-
);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
const trimmedStdout = stdout.trim();
|
|
322
|
-
if (!trimmedStdout) {
|
|
323
|
-
reject(
|
|
324
|
-
buildScriptSetupError({
|
|
325
|
-
attemptedCommand: invocation.attemptedCommand,
|
|
326
|
-
message: "The source-checkout local maintainer helper completed without returning JSON.",
|
|
327
|
-
stderr
|
|
328
|
-
})
|
|
329
|
-
);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
try {
|
|
333
|
-
resolve(parseJsonPayload(trimmedStdout));
|
|
334
|
-
} catch (error) {
|
|
335
|
-
reject(
|
|
336
|
-
buildScriptSetupError({
|
|
337
|
-
attemptedCommand: invocation.attemptedCommand,
|
|
338
|
-
message: `Failed to parse JSON from the source-checkout local maintainer helper: ${error instanceof Error ? error.message : String(error)}`,
|
|
339
|
-
stderr: [stderr.trim(), trimmedStdout].filter(Boolean).join("\n")
|
|
340
|
-
})
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
async function ensureLocalMaintainerSnapshot(apiBaseUrl) {
|
|
347
|
-
if (!isLocalMaintainerRegistryEnabled(apiBaseUrl)) {
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
if (shouldSkipLocalMaintainerHelper()) {
|
|
351
|
-
return readInstalledCliLocalMaintainerSnapshot();
|
|
352
|
-
}
|
|
353
|
-
return runLocalMaintainerScript([
|
|
354
|
-
"ensure-snapshot",
|
|
355
|
-
"--api-base-url",
|
|
356
|
-
apiBaseUrl
|
|
357
|
-
]);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// src/commands/sync.ts
|
|
361
|
-
async function runLoggedStep(message, task) {
|
|
362
|
-
consola.start(message);
|
|
363
|
-
return task();
|
|
364
|
-
}
|
|
365
|
-
async function persistProjectConfig(options) {
|
|
366
|
-
await updateProjectState(options.projectRoot, options.projectConfig);
|
|
367
|
-
return options.projectConfig;
|
|
368
|
-
}
|
|
369
|
-
async function finalizeLocalSync(options) {
|
|
370
|
-
const { projectRoot, projectConfig } = options;
|
|
371
|
-
await scaffoldStaticWorkspace(projectRoot, "update", {
|
|
372
|
-
localMaintainerRegistry: getProjectLocalMaintainerRegistry(projectConfig)
|
|
373
|
-
});
|
|
374
|
-
await applyWorkspaceCodegen({
|
|
375
|
-
projectRoot,
|
|
376
|
-
manifest: await loadManifest(projectRoot)
|
|
377
|
-
});
|
|
378
|
-
const finalizedProjectConfig = await persistProjectConfig({
|
|
379
|
-
projectRoot,
|
|
380
|
-
projectConfig
|
|
381
|
-
});
|
|
382
|
-
await writeSnapshot(projectRoot);
|
|
383
|
-
return finalizedProjectConfig;
|
|
384
|
-
}
|
|
385
|
-
function buildSourceSnapshotChanges(localFiles) {
|
|
386
|
-
return Object.entries(localFiles).filter(
|
|
387
|
-
([filePath]) => isSourceRevisionPath(filePath) || shouldAlwaysUpsertSourcePath(filePath)
|
|
388
|
-
).sort(([left], [right]) => left.localeCompare(right)).map(([path3, content]) => ({
|
|
389
|
-
kind: "upsert",
|
|
390
|
-
path: path3,
|
|
391
|
-
content
|
|
392
|
-
}));
|
|
393
|
-
}
|
|
394
|
-
var sync_default = defineCommand({
|
|
395
|
-
meta: {
|
|
396
|
-
name: "sync",
|
|
397
|
-
description: "Upload authored changes and advance the remote authoring head"
|
|
398
|
-
},
|
|
399
|
-
args: {
|
|
400
|
-
force: {
|
|
401
|
-
type: "boolean",
|
|
402
|
-
description: "Replace the full authored source tree, manifest, and rules, overwriting the remote head with the local copy even when the remote has moved",
|
|
403
|
-
default: false
|
|
404
|
-
},
|
|
405
|
-
yes: {
|
|
406
|
-
type: "boolean",
|
|
407
|
-
alias: "y",
|
|
408
|
-
description: "Reserved for non-interactive scaffold flows",
|
|
409
|
-
default: false
|
|
410
|
-
},
|
|
411
|
-
...CONFIG_FLAG_ARGS
|
|
412
|
-
},
|
|
413
|
-
async run({ args }) {
|
|
414
|
-
const parsedArgs = parseSyncCommandArgs(args);
|
|
415
|
-
const { projectRoot, projectConfig, config } = await resolveProjectContext(parsedArgs);
|
|
416
|
-
let nextProjectConfig = projectConfig;
|
|
417
|
-
await assertReleaseEnvironmentPortableDependencies({
|
|
418
|
-
projectRoot,
|
|
419
|
-
projectConfig: nextProjectConfig,
|
|
420
|
-
environment: config.environment
|
|
421
|
-
});
|
|
422
|
-
const localMaintainerEnabled = isLocalMaintainerRegistryEnabled(
|
|
423
|
-
config.apiBaseUrl
|
|
424
|
-
);
|
|
425
|
-
const existingLocalMaintainerRegistry = getProjectLocalMaintainerRegistry(projectConfig);
|
|
426
|
-
const refreshedLocalMaintainerRegistry = localMaintainerEnabled ? await runLoggedStep(
|
|
427
|
-
"Checking local SDK snapshot...",
|
|
428
|
-
() => ensureLocalMaintainerSnapshot(config.apiBaseUrl)
|
|
429
|
-
) : await ensureLocalMaintainerSnapshot(config.apiBaseUrl);
|
|
430
|
-
const localMaintainerRegistry = refreshedLocalMaintainerRegistry ?? (localMaintainerEnabled ? existingLocalMaintainerRegistry ?? null : null);
|
|
431
|
-
const localMaintainerSnapshotChanged = didLocalMaintainerSnapshotChange(
|
|
432
|
-
existingLocalMaintainerRegistry,
|
|
433
|
-
refreshedLocalMaintainerRegistry
|
|
434
|
-
);
|
|
435
|
-
if (refreshedLocalMaintainerRegistry) {
|
|
436
|
-
nextProjectConfig = updateProjectLocalMaintainerRegistry(
|
|
437
|
-
nextProjectConfig,
|
|
438
|
-
refreshedLocalMaintainerRegistry
|
|
439
|
-
);
|
|
440
|
-
consola.info(
|
|
441
|
-
localMaintainerSnapshotChanged ? "Local SDK snapshot refreshed." : "Using existing local SDK snapshot."
|
|
442
|
-
);
|
|
443
|
-
} else if (localMaintainerRegistry) {
|
|
444
|
-
consola.info("Using workspace-pinned local SDK snapshot.");
|
|
445
|
-
}
|
|
446
|
-
await runLoggedStep(
|
|
447
|
-
"Refreshing static scaffold...",
|
|
448
|
-
() => scaffoldStaticWorkspace(projectRoot, "update", {
|
|
449
|
-
localMaintainerRegistry
|
|
450
|
-
})
|
|
451
|
-
);
|
|
452
|
-
const localManifest = await loadManifest(projectRoot);
|
|
453
|
-
await runLoggedStep(
|
|
454
|
-
"Applying workspace codegen...",
|
|
455
|
-
async () => applyWorkspaceCodegen({
|
|
456
|
-
projectRoot,
|
|
457
|
-
manifest: localManifest
|
|
458
|
-
})
|
|
459
|
-
);
|
|
460
|
-
const dependencyState = await runLoggedStep(
|
|
461
|
-
"Reconciling workspace dependencies...",
|
|
462
|
-
() => reconcileWorkspaceDependencies(projectRoot)
|
|
463
|
-
);
|
|
464
|
-
if (dependencyState.packageManagerNormalized || dependencyState.lockfileGenerated || dependencyState.installed || localMaintainerSnapshotChanged) {
|
|
465
|
-
consola.info("Workspace dependencies reconciled.");
|
|
466
|
-
} else {
|
|
467
|
-
consola.info("Workspace dependencies already up to date.");
|
|
468
|
-
}
|
|
469
|
-
await runLoggedStep(
|
|
470
|
-
"Validating reducer contract...",
|
|
471
|
-
() => assertReducerContractPreflight(projectRoot)
|
|
472
|
-
);
|
|
473
|
-
const typecheckResult = await runLoggedStep(
|
|
474
|
-
"Running local typecheck...",
|
|
475
|
-
() => runLocalTypecheck(projectRoot)
|
|
476
|
-
);
|
|
477
|
-
if (typecheckResult.skipped) {
|
|
478
|
-
if (typecheckResult.output) {
|
|
479
|
-
consola.warn(typecheckResult.output);
|
|
480
|
-
}
|
|
481
|
-
} else if (!typecheckResult.success) {
|
|
482
|
-
if (typecheckResult.output) {
|
|
483
|
-
consola.error(typecheckResult.output);
|
|
484
|
-
}
|
|
485
|
-
throw new Error(
|
|
486
|
-
"Local typecheck failed. Fix the diagnostics before syncing."
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
await runLoggedStep(
|
|
490
|
-
"Smoke-testing reducer bundle...",
|
|
491
|
-
async () => assertReducerBundleSmoke({
|
|
492
|
-
projectRoot,
|
|
493
|
-
manifest: localManifest
|
|
494
|
-
})
|
|
495
|
-
);
|
|
496
|
-
consola.success("Reducer bundle smoke test passed.");
|
|
497
|
-
const remoteProject = await runLoggedStep(
|
|
498
|
-
"Ensuring remote project...",
|
|
499
|
-
() => resolveRemoteProject({
|
|
500
|
-
projectRoot,
|
|
501
|
-
projectConfig: nextProjectConfig,
|
|
502
|
-
config
|
|
503
|
-
})
|
|
504
|
-
);
|
|
505
|
-
nextProjectConfig = remoteProject.projectConfig;
|
|
506
|
-
const localDiff = await getLocalDiff(projectRoot);
|
|
507
|
-
await assertCliStaticScaffoldComplete(projectRoot, localDiff.deleted);
|
|
508
|
-
const localAuthoring = getProjectAuthoringState(nextProjectConfig);
|
|
509
|
-
const pendingSync = getProjectPendingAuthoringSync(nextProjectConfig);
|
|
510
|
-
const remoteHeadDigest = remoteProject.project.head?.revisionDigest;
|
|
511
|
-
const localHeadDigest = localAuthoring.revisionDigest ?? nextProjectConfig.remoteHeadDigest;
|
|
512
|
-
if (pendingSync && !parsedArgs.force) {
|
|
513
|
-
throw new Error(
|
|
514
|
-
"This workspace has an unfinished legacy sync checkpoint. Run 'dreamboard sync --force' to replace it with an atomic project revision."
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
if (remoteHeadDigest && localHeadDigest && remoteHeadDigest !== localHeadDigest) {
|
|
518
|
-
if (parsedArgs.force) {
|
|
519
|
-
consola.warn(
|
|
520
|
-
`Remote project head has moved to ${remoteHeadDigest}. --force will overwrite it with this workspace's local copy.`
|
|
521
|
-
);
|
|
522
|
-
} else {
|
|
523
|
-
throw new Error(
|
|
524
|
-
`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.`
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
if (remoteHeadDigest && !localHeadDigest) {
|
|
529
|
-
if (parsedArgs.force) {
|
|
530
|
-
consola.warn(
|
|
531
|
-
`This workspace has no authored base but the remote project head is ${remoteHeadDigest}. --force will overwrite it with this workspace's local copy.`
|
|
532
|
-
);
|
|
533
|
-
} else {
|
|
534
|
-
throw new Error(
|
|
535
|
-
`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.`
|
|
536
|
-
);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
const hasChanges = localDiff.modified.length > 0 || localDiff.added.length > 0 || localDiff.deleted.length > 0;
|
|
540
|
-
const localManifestContentHash = computeManifestHash(localManifest);
|
|
541
|
-
const manifestOutOfSync = localAuthoring.localManifestContentHash !== localManifestContentHash;
|
|
542
|
-
if (!hasChanges && !parsedArgs.force && localHeadDigest != null && remoteHeadDigest === localHeadDigest && !pendingSync && !manifestOutOfSync) {
|
|
543
|
-
consola.info("No local authored changes to sync.");
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
const localFiles = await collectLocalFiles(projectRoot);
|
|
547
|
-
const sourceChanges = buildSourceSnapshotChanges(localFiles);
|
|
548
|
-
const { changes } = await materializeSourceChangeOperations(sourceChanges);
|
|
549
|
-
const uploadBlobs = mapUpsertBlobContentsByContentHash(
|
|
550
|
-
sourceChanges,
|
|
551
|
-
changes
|
|
552
|
-
);
|
|
553
|
-
await uploadProjectSourceBlobsSdk(
|
|
554
|
-
nextProjectConfig.projectId,
|
|
555
|
-
Array.from(uploadBlobs.values())
|
|
556
|
-
);
|
|
557
|
-
const sourceFiles = changes.filter((change) => change.kind === "upsert").map(({ path: path3, contentHash, byteSize }) => ({
|
|
558
|
-
path: path3,
|
|
559
|
-
contentHash,
|
|
560
|
-
byteSize
|
|
561
|
-
}));
|
|
562
|
-
const revision = await createGameRevisionSdk({
|
|
563
|
-
projectId: nextProjectConfig.projectId,
|
|
564
|
-
request: {
|
|
565
|
-
...remoteHeadDigest ? { baseRevisionDigest: remoteHeadDigest } : {},
|
|
566
|
-
source: { files: sourceFiles },
|
|
567
|
-
ruleText: await loadRule(projectRoot),
|
|
568
|
-
manifest: localManifest
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
nextProjectConfig = await persistProjectConfig({
|
|
572
|
-
projectRoot,
|
|
573
|
-
projectConfig: {
|
|
574
|
-
...updateProjectAuthoringState(nextProjectConfig, {
|
|
575
|
-
revisionDigest: revision.revisionDigest,
|
|
576
|
-
sourceTreeHash: revision.sourceTreeHash,
|
|
577
|
-
manifestContentHash: revision.manifestContentHash,
|
|
578
|
-
localManifestContentHash
|
|
579
|
-
}),
|
|
580
|
-
remoteHeadDigest: revision.revisionDigest
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
nextProjectConfig = await finalizeLocalSync({
|
|
584
|
-
projectRoot,
|
|
585
|
-
projectConfig: nextProjectConfig
|
|
586
|
-
});
|
|
587
|
-
consola.success(
|
|
588
|
-
`Synced revision ${revision.revisionDigest}. Run 'dreamboard compile' when you're ready.`
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
export {
|
|
593
|
-
sync_default as default
|
|
594
|
-
};
|