@dreamboard-games/cli 0.1.30-alpha.10 → 0.1.30-alpha.12
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/dist/agent-verifier/agent-workspace-verifier.mjs +4 -4
- package/dist/agent-verifier/{chunk-MGXX4WFR.mjs → chunk-UIJ2NDG6.mjs} +7 -3
- package/dist/agent-verifier/{chunk-MGXX4WFR.mjs.map → chunk-UIJ2NDG6.mjs.map} +1 -1
- package/dist/agent-verifier/{compile-C2VIP6VC.mjs → compile-WZ7X6I2A.mjs} +2 -2
- package/dist/agent-verifier/{sync-UTL2IIZV.mjs → sync-ELLJEWMB.mjs} +8 -2
- package/dist/agent-verifier/{sync-UTL2IIZV.mjs.map → sync-ELLJEWMB.mjs.map} +1 -1
- package/dist/agent-verifier/{test-H26XCBFA.mjs → test-OSXBPLSP.mjs} +2 -2
- package/dist/dev-host/host-main.tsx +10 -4
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- /package/dist/agent-verifier/{compile-C2VIP6VC.mjs.map → compile-WZ7X6I2A.mjs.map} +0 -0
- /package/dist/agent-verifier/{test-H26XCBFA.mjs.map → test-OSXBPLSP.mjs.map} +0 -0
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
assertReleaseEnvironmentPortableDependencies,
|
|
27
27
|
consola,
|
|
28
28
|
resolveProjectContext
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-UIJ2NDG6.mjs";
|
|
30
30
|
import {
|
|
31
31
|
updateProjectState
|
|
32
32
|
} from "./chunk-3IJBOLGT.mjs";
|
|
@@ -310,4 +310,4 @@ var compile_default = defineCommand({
|
|
|
310
310
|
export {
|
|
311
311
|
compile_default as default
|
|
312
312
|
};
|
|
313
|
-
//# sourceMappingURL=compile-
|
|
313
|
+
//# sourceMappingURL=compile-WZ7X6I2A.mjs.map
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
assertReleaseEnvironmentPortableDependencies,
|
|
34
34
|
consola,
|
|
35
35
|
resolveProjectContext
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-UIJ2NDG6.mjs";
|
|
37
37
|
import {
|
|
38
38
|
updateProjectState
|
|
39
39
|
} from "./chunk-3IJBOLGT.mjs";
|
|
@@ -418,6 +418,12 @@ var sync_default = defineCommand({
|
|
|
418
418
|
config.apiBaseUrl
|
|
419
419
|
);
|
|
420
420
|
const existingLocalMaintainerRegistry = getProjectLocalMaintainerRegistry(projectConfig);
|
|
421
|
+
if (!localMaintainerEnabled && existingLocalMaintainerRegistry) {
|
|
422
|
+
nextProjectConfig = updateProjectLocalMaintainerRegistry(
|
|
423
|
+
nextProjectConfig,
|
|
424
|
+
void 0
|
|
425
|
+
);
|
|
426
|
+
}
|
|
421
427
|
const refreshedLocalMaintainerRegistry = localMaintainerEnabled ? await runLoggedStep(
|
|
422
428
|
"Checking local SDK snapshot...",
|
|
423
429
|
() => ensureLocalMaintainerSnapshot(config.apiBaseUrl)
|
|
@@ -587,4 +593,4 @@ var sync_default = defineCommand({
|
|
|
587
593
|
export {
|
|
588
594
|
sync_default as default
|
|
589
595
|
};
|
|
590
|
-
//# sourceMappingURL=sync-
|
|
596
|
+
//# sourceMappingURL=sync-ELLJEWMB.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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.revisionDigest}. Run 'dreamboard compile' when you're ready.`,\n );\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,SAAS,qBAAqB,UAA2B;AAC9D,SAAO,aAAa,aAAa,kBAAkB,QAAQ;AAC7D;AAMO,SAAS,6BAA6B,UAA2B;AACtE,SAAO,aAAa,YAAY,uBAAuB,QAAQ;AACjE;;;ACtBA,SAAS,aAAa;AACtB,SAAS,YAAY,oBAAoB;AACzC,OAAOA,WAAU;AACjB,SAAS,qBAAqB;;;ACH9B,OAAO,YAAY;AACnB,OAAO,UAAU;AAUjB,IAAM,uBAAuB,yBAAyB;AAC/C,IAAM,sBAAsB,qBAAqB;AACjD,IAAM,sBAAsB,qBAAqB;AACjD,IAAM,qBAAqB,UAAU,mBAAmB,IAAI,mBAAmB;AAC/E,IAAM,4BAA4B,8BAA8B,kBAAkB;AAAA;AAsBzF,SAAS,2BAA2D;AACl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"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 if (!localMaintainerEnabled && existingLocalMaintainerRegistry) {\n nextProjectConfig = updateProjectLocalMaintainerRegistry(\n nextProjectConfig,\n undefined,\n );\n }\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.revisionDigest}. Run 'dreamboard compile' when you're ready.`,\n );\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAY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iB,IAAI,CAAC;AAAA,QACnE,QAAQ,EAAE,OAAO,YAAY;AAAA,QAC7B,UAAU,MAAM,SAAS,WAAW;AAAA,QACpC,UAAU;AAAA,MACZ;AAAA,IACF,CAAC;AACD,wBAAoB,MAAM,qBAAqB;AAAA,MAC7C;AAAA,MACA,eAAe;AAAA,QACb,GAAG,4BAA4B,mBAAmB;AAAA,UAChD,gBAAgB,SAAS;AAAA,UACzB,gBAAgB,SAAS;AAAA,UACzB,qBAAqB,SAAS;AAAA,UAC9B;AAAA,QACF,CAAC;AAAA,QACD,kBAAkB,SAAS;AAAA,MAC7B;AAAA,IACF,CAAC;AACD,wBAAoB,MAAM,kBAAkB;AAAA,MAC1C;AAAA,MACA,eAAe;AAAA,IACjB,CAAC;AAED,YAAQ;AAAA,MACN,mBAAmB,SAAS,cAAc;AAAA,IAC5C;AAAA,EACF;AACF,CAAC;","names":["path","path","path"]}
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
configureClient,
|
|
30
30
|
consola,
|
|
31
31
|
resolveProjectContext
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-UIJ2NDG6.mjs";
|
|
33
33
|
import "./chunk-3IJBOLGT.mjs";
|
|
34
34
|
import "./chunk-W2MDP5ZN.mjs";
|
|
35
35
|
import "./chunk-UWJIZML3.mjs";
|
|
@@ -351,4 +351,4 @@ export {
|
|
|
351
351
|
resolveRequestedRunner,
|
|
352
352
|
resolveTestRunExitCode
|
|
353
353
|
};
|
|
354
|
-
//# sourceMappingURL=test-
|
|
354
|
+
//# sourceMappingURL=test-OSXBPLSP.mjs.map
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
DrawerTrigger,
|
|
22
22
|
} from "./components/drawer.js";
|
|
23
23
|
import { Input } from "./components/input.js";
|
|
24
|
+
import { createGameplayCapability } from "@dreamboard-games/api-client";
|
|
24
25
|
import { client } from "@dreamboard-games/api-client/client.gen";
|
|
25
26
|
import {
|
|
26
27
|
HostFeedbackToaster,
|
|
@@ -61,10 +62,19 @@ import { resolveInitialDevHostPlayerId } from "./dev-host-player-query.js";
|
|
|
61
62
|
const diagnosticsLevel = resolveDevDiagnosticsLevel(devConfig.debug);
|
|
62
63
|
const devLogger = createDevDiagnosticsLogger(diagnosticsLevel);
|
|
63
64
|
const storage = new SessionStorageDevHostStorage(window.sessionStorage);
|
|
65
|
+
// The browser never sees the bearer token. All backend traffic is
|
|
66
|
+
// same-origin and the CLI's reverse-proxy middleware (`/api/*`) injects
|
|
67
|
+
// `Authorization: Bearer <fresh>` on the wire.
|
|
68
|
+
client.setConfig({ baseUrl: "" });
|
|
69
|
+
const createDevHostGameplayCapability = (
|
|
70
|
+
options: Parameters<typeof createGameplayCapability>[0],
|
|
71
|
+
): ReturnType<typeof createGameplayCapability> =>
|
|
72
|
+
createGameplayCapability({ ...options, client });
|
|
64
73
|
// Gameplay streaming and submits go through the Gameplay Authority WebSocket
|
|
65
74
|
// (the backend's event-batches stream is removed); snapshot/start/dev-session
|
|
66
75
|
// requests fall back to the dev-server endpoints.
|
|
67
76
|
const hostSessionTransport = createGameplayAuthorityTransport({
|
|
77
|
+
capabilityRequester: createDevHostGameplayCapability,
|
|
68
78
|
fallbackTransport: createDevHostSessionTransport(),
|
|
69
79
|
getCurrentSessionContext: () =>
|
|
70
80
|
unifiedSessionSelectors.sessionContext(store.getState()),
|
|
@@ -132,10 +142,6 @@ const controller = new DevHostController(
|
|
|
132
142
|
devLogger,
|
|
133
143
|
);
|
|
134
144
|
|
|
135
|
-
// The browser never sees the bearer token. All backend traffic is
|
|
136
|
-
// same-origin and the CLI's reverse-proxy middleware (`/api/*`) injects
|
|
137
|
-
// `Authorization: Bearer <fresh>` on the wire.
|
|
138
|
-
client.setConfig({ baseUrl: "" });
|
|
139
145
|
installProxyAuthErrorInterceptor();
|
|
140
146
|
|
|
141
147
|
const app = document.getElementById("app");
|
package/dist/index.js
CHANGED
|
@@ -4166,11 +4166,15 @@ var UNPORTABLE_SPECIFIER_PATTERN = /^(file|link|portal|workspace):/;
|
|
|
4166
4166
|
async function buildSourceDependencyProfile(options) {
|
|
4167
4167
|
const packageJson = await readProjectPackageJson(options.projectRoot);
|
|
4168
4168
|
const packages = collectDreamboardPackageSpecifiers(packageJson);
|
|
4169
|
+
const hasLocalSnapshotPackage = Object.values(packages).some(
|
|
4170
|
+
(value) => value.includes("-local.")
|
|
4171
|
+
);
|
|
4172
|
+
const localMaintainerRegistry = hasLocalSnapshotPackage ? options.projectConfig?.localMaintainerRegistry : void 0;
|
|
4169
4173
|
return {
|
|
4170
4174
|
kind: "npm-registry",
|
|
4171
4175
|
packageManager: packageJson.packageManager,
|
|
4172
|
-
dreamboardRegistryUrl: await readDreamboardRegistryFromNpmrc(options.projectRoot) ??
|
|
4173
|
-
localSnapshotId:
|
|
4176
|
+
dreamboardRegistryUrl: await readDreamboardRegistryFromNpmrc(options.projectRoot) ?? localMaintainerRegistry?.registryUrl,
|
|
4177
|
+
localSnapshotId: localMaintainerRegistry?.snapshotId,
|
|
4174
4178
|
packages
|
|
4175
4179
|
};
|
|
4176
4180
|
}
|
|
@@ -6711,6 +6715,12 @@ async function ensureDevCompiledResult(options) {
|
|
|
6711
6715
|
const existingLocalMaintainerRegistry = getProjectLocalMaintainerRegistry(
|
|
6712
6716
|
options.projectConfig
|
|
6713
6717
|
);
|
|
6718
|
+
if (!localMaintainerEnabled && existingLocalMaintainerRegistry) {
|
|
6719
|
+
await updateProjectState(
|
|
6720
|
+
options.projectRoot,
|
|
6721
|
+
updateProjectLocalMaintainerRegistry(options.projectConfig, void 0)
|
|
6722
|
+
);
|
|
6723
|
+
}
|
|
6714
6724
|
const refreshedLocalMaintainerRegistry = localMaintainerEnabled ? await runLoggedStep(
|
|
6715
6725
|
"Checking local SDK snapshot...",
|
|
6716
6726
|
() => ensureLocalMaintainerSnapshot(options.config.apiBaseUrl)
|
|
@@ -8670,6 +8680,12 @@ var sync_default = defineCommand({
|
|
|
8670
8680
|
config.apiBaseUrl
|
|
8671
8681
|
);
|
|
8672
8682
|
const existingLocalMaintainerRegistry = getProjectLocalMaintainerRegistry(projectConfig);
|
|
8683
|
+
if (!localMaintainerEnabled && existingLocalMaintainerRegistry) {
|
|
8684
|
+
nextProjectConfig = updateProjectLocalMaintainerRegistry(
|
|
8685
|
+
nextProjectConfig,
|
|
8686
|
+
void 0
|
|
8687
|
+
);
|
|
8688
|
+
}
|
|
8673
8689
|
const refreshedLocalMaintainerRegistry = localMaintainerEnabled ? await runLoggedStep2(
|
|
8674
8690
|
"Checking local SDK snapshot...",
|
|
8675
8691
|
() => ensureLocalMaintainerSnapshot(config.apiBaseUrl)
|