@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.
Files changed (114) hide show
  1. package/README.md +179 -22
  2. package/dist/{chunk-C6UAT6EH.js → chunk-N7XPNNUI.js} +9 -12
  3. package/dist/chunk-N7XPNNUI.js.map +1 -0
  4. package/dist/chunk-SEGVTWSK.js +44 -0
  5. package/dist/{chunk-RS7UXJZV.js → chunk-TAQKH67O.js} +21300 -35881
  6. package/dist/chunk-TAQKH67O.js.map +1 -0
  7. package/dist/{global-config-AGFBDFYD.js → global-config-S4ZIPECE.js} +3 -3
  8. package/dist/index.js +415 -37
  9. package/dist/index.js.map +1 -1
  10. package/dist/internal.js +3 -4
  11. package/dist/{agent-verifier/keychain-backend-TNOPQV3Z.mjs → keychain-backend-HDF4TZDL.js} +2 -1
  12. package/dist/{agent-verifier/prompt-3BAINGAQ.mjs → prompt-NDV3AE5L.js} +2 -1
  13. package/package.json +6 -6
  14. package/skills/dreamboard/references/building-your-first-game.md +510 -0
  15. package/skills/dreamboard/references/cli.md +104 -0
  16. package/skills/dreamboard/references/game-interface.md +548 -0
  17. package/skills/dreamboard/references/manifest-authoring.md +597 -0
  18. package/skills/dreamboard/references/quickstart.md +66 -0
  19. package/skills/dreamboard/references/reducer.md +864 -0
  20. package/skills/dreamboard/references/rule-authoring.md +147 -0
  21. package/skills/dreamboard/references/testing.md +249 -0
  22. package/skills/dreamboard/scripts/events-extract.mjs +218 -0
  23. package/dist/agent-verifier/agent-workspace-verifier.mjs +0 -227
  24. package/dist/agent-verifier/chunk-2E5P5NWG.mjs +0 -835
  25. package/dist/agent-verifier/chunk-2GBBP27W.mjs +0 -301
  26. package/dist/agent-verifier/chunk-2QMNAVV4.mjs +0 -14522
  27. package/dist/agent-verifier/chunk-2SZHMP6F.mjs +0 -264
  28. package/dist/agent-verifier/chunk-4WD3YU2E.mjs +0 -166
  29. package/dist/agent-verifier/chunk-54TAYXUD.mjs +0 -12
  30. package/dist/agent-verifier/chunk-6A5HRJMQ.mjs +0 -3174
  31. package/dist/agent-verifier/chunk-6UUJEYDV.mjs +0 -213
  32. package/dist/agent-verifier/chunk-7653FPGJ.mjs +0 -381
  33. package/dist/agent-verifier/chunk-7E65UQLY.mjs +0 -38
  34. package/dist/agent-verifier/chunk-BVVNBJM4.mjs +0 -221
  35. package/dist/agent-verifier/chunk-CEDUHGNH.mjs +0 -74
  36. package/dist/agent-verifier/chunk-CEQ2VJWN.mjs +0 -149
  37. package/dist/agent-verifier/chunk-CFU5EWIC.mjs +0 -69
  38. package/dist/agent-verifier/chunk-CJEEA6NJ.mjs +0 -730
  39. package/dist/agent-verifier/chunk-EIQWDQWJ.mjs +0 -186
  40. package/dist/agent-verifier/chunk-EOQIV6PS.mjs +0 -649
  41. package/dist/agent-verifier/chunk-HBNDKQT5.mjs +0 -8381
  42. package/dist/agent-verifier/chunk-HJFQDSTU.mjs +0 -225
  43. package/dist/agent-verifier/chunk-JH22JNYD.mjs +0 -1681
  44. package/dist/agent-verifier/chunk-LI3ZR3BI.mjs +0 -41
  45. package/dist/agent-verifier/chunk-LM3OZLZG.mjs +0 -48
  46. package/dist/agent-verifier/chunk-MINCYHXN.mjs +0 -106
  47. package/dist/agent-verifier/chunk-MRCUP5SW.mjs +0 -128
  48. package/dist/agent-verifier/chunk-RBDDIIPM.mjs +0 -19
  49. package/dist/agent-verifier/chunk-SHUMAVAP.mjs +0 -59
  50. package/dist/agent-verifier/chunk-SYPLYRGB.mjs +0 -2812
  51. package/dist/agent-verifier/chunk-U6OJN7XS.mjs +0 -8092
  52. package/dist/agent-verifier/chunk-VYJTHSYR.mjs +0 -44
  53. package/dist/agent-verifier/chunk-XYDL7GY6.mjs +0 -10
  54. package/dist/agent-verifier/compile-5QSPIOUT.mjs +0 -313
  55. package/dist/agent-verifier/global-config-WX3ZZIVU.mjs +0 -17
  56. package/dist/agent-verifier/local-files-MTPLP62S.mjs +0 -46
  57. package/dist/agent-verifier/local-typecheck-QFYYAZOK.mjs +0 -9
  58. package/dist/agent-verifier/materialize-workspace-FKALAE2T.mjs +0 -90
  59. package/dist/agent-verifier/project-state-7GR6BQTQ.mjs +0 -32
  60. package/dist/agent-verifier/reducer-bundle-preflight-C73LEXI2.mjs +0 -23
  61. package/dist/agent-verifier/reducer-contract-preflight-22X7DSZW.mjs +0 -10
  62. package/dist/agent-verifier/reducer-native-test-harness-GMWBUISX.mjs +0 -53
  63. package/dist/agent-verifier/static-scaffold-AJMZZQWS.mjs +0 -28
  64. package/dist/agent-verifier/sync-3DUQH32H.mjs +0 -594
  65. package/dist/agent-verifier/test-P4U5INTD.mjs +0 -356
  66. package/dist/agent-verifier/testing-5K2BJYF2.mjs +0 -674
  67. package/dist/agent-verifier/workspace-codegen-JDZJRSDV.mjs +0 -11
  68. package/dist/agent-verifier/workspace-dependencies-HZ6VVS4G.mjs +0 -14
  69. package/dist/chunk-2H7UOFLK.js +0 -11
  70. package/dist/chunk-7FOO4AJI.js +0 -50
  71. package/dist/chunk-7FOO4AJI.js.map +0 -1
  72. package/dist/chunk-C6UAT6EH.js.map +0 -1
  73. package/dist/chunk-RS7UXJZV.js.map +0 -1
  74. package/dist/internal.d.ts +0 -311
  75. package/dist/keychain-backend-JHTXAKWC.js +0 -135
  76. package/dist/prompt-GMZABCJC.js +0 -756
  77. package/dist/runtime-packages/ui-host-runtime/src/actor-principal.ts +0 -71
  78. package/dist/runtime-packages/ui-host-runtime/src/browser-interaction.ts +0 -139
  79. package/dist/runtime-packages/ui-host-runtime/src/components/host-controls.tsx +0 -374
  80. package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback-toaster.tsx +0 -266
  81. package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback.tsx +0 -212
  82. package/dist/runtime-packages/ui-host-runtime/src/components/host-primitives.tsx +0 -271
  83. package/dist/runtime-packages/ui-host-runtime/src/components/host-session-metadata.tsx +0 -135
  84. package/dist/runtime-packages/ui-host-runtime/src/components/index.ts +0 -5
  85. package/dist/runtime-packages/ui-host-runtime/src/components/perf-overlay.tsx +0 -194
  86. package/dist/runtime-packages/ui-host-runtime/src/gameplay-authority-transport.ts +0 -626
  87. package/dist/runtime-packages/ui-host-runtime/src/host-controls.tsx +0 -1
  88. package/dist/runtime-packages/ui-host-runtime/src/host-feedback.tsx +0 -1
  89. package/dist/runtime-packages/ui-host-runtime/src/host-session-transport.ts +0 -294
  90. package/dist/runtime-packages/ui-host-runtime/src/index.ts +0 -3
  91. package/dist/runtime-packages/ui-host-runtime/src/logger.ts +0 -11
  92. package/dist/runtime-packages/ui-host-runtime/src/perf.ts +0 -324
  93. package/dist/runtime-packages/ui-host-runtime/src/plugin-bridge.ts +0 -195
  94. package/dist/runtime-packages/ui-host-runtime/src/plugin-health-check.ts +0 -138
  95. package/dist/runtime-packages/ui-host-runtime/src/plugin-messages.ts +0 -159
  96. package/dist/runtime-packages/ui-host-runtime/src/plugin-session-gateway.ts +0 -551
  97. package/dist/runtime-packages/ui-host-runtime/src/runtime/index.ts +0 -13
  98. package/dist/runtime-packages/ui-host-runtime/src/screenshot/projection-to-snapshot.ts +0 -122
  99. package/dist/runtime-packages/ui-host-runtime/src/screenshot/static-store-api.ts +0 -26
  100. package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +0 -583
  101. package/dist/runtime-packages/ui-host-runtime/src/session-ingress.ts +0 -219
  102. package/dist/runtime-packages/ui-host-runtime/src/session-live-runtime.ts +0 -117
  103. package/dist/runtime-packages/ui-host-runtime/src/session-model.ts +0 -431
  104. package/dist/runtime-packages/ui-host-runtime/src/session-projection.ts +0 -211
  105. package/dist/runtime-packages/ui-host-runtime/src/session-recovery.ts +0 -80
  106. package/dist/runtime-packages/ui-host-runtime/src/session-state-reducer.ts +0 -1034
  107. package/dist/runtime-packages/ui-host-runtime/src/sse-manager.ts +0 -416
  108. package/dist/runtime-packages/ui-host-runtime/src/unified-session-store.ts +0 -184
  109. package/dist/testing-KLSV6CPJ.js +0 -674
  110. package/dist/testing-KLSV6CPJ.js.map +0 -1
  111. /package/dist/{chunk-2H7UOFLK.js.map → chunk-SEGVTWSK.js.map} +0 -0
  112. /package/dist/{global-config-AGFBDFYD.js.map → global-config-S4ZIPECE.js.map} +0 -0
  113. /package/dist/{keychain-backend-JHTXAKWC.js.map → keychain-backend-HDF4TZDL.js.map} +0 -0
  114. /package/dist/{prompt-GMZABCJC.js.map → prompt-NDV3AE5L.js.map} +0 -0
@@ -1,221 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- CLIENT_PROBLEM_TYPES,
4
- SERVER_PROBLEM_TYPES,
5
- zProblemDetails
6
- } from "./chunk-SYPLYRGB.mjs";
7
-
8
- // src/utils/problem-types.ts
9
- var CLI_PROBLEM_TYPES = {
10
- ...SERVER_PROBLEM_TYPES,
11
- ...CLIENT_PROBLEM_TYPES
12
- };
13
-
14
- // src/utils/errors.ts
15
- var STALE_CONTRACT_ARTIFACT_CODE = "STALE_CONTRACT_ARTIFACT";
16
- var STALE_CONTRACT_ARTIFACT_EXIT_CODE = 42;
17
- function isProblemViolationArray(value) {
18
- return Array.isArray(value) && value.every(
19
- (entry) => typeof entry === "object" && entry !== null && typeof entry.message === "string"
20
- );
21
- }
22
- function isProblemDetails(value) {
23
- return zProblemDetails.safeParse(value).success;
24
- }
25
- function coerceViolations(value) {
26
- if (isProblemViolationArray(value)) {
27
- return value;
28
- }
29
- if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
30
- return value.map((message) => ({ message }));
31
- }
32
- return void 0;
33
- }
34
- function getRequestId(response) {
35
- return response?.headers?.get?.("X-Correlation-ID") ?? response?.headers?.get?.("x-correlation-id") ?? void 0;
36
- }
37
- function toApiProblem(error, response, fallback) {
38
- if (isProblemDetails(error)) {
39
- return {
40
- ...error,
41
- status: error.status || response?.status || 0,
42
- requestId: error.requestId ?? getRequestId(response)
43
- };
44
- }
45
- if (error instanceof Error) {
46
- return {
47
- type: CLI_PROBLEM_TYPES.TRANSPORT_ERROR,
48
- title: response?.statusText || "API error",
49
- status: response?.status ?? 0,
50
- detail: error.message || fallback,
51
- requestId: getRequestId(response)
52
- };
53
- }
54
- if (error && typeof error === "object") {
55
- const obj = error;
56
- const detail2 = typeof obj.detail === "string" ? obj.detail : typeof obj.message === "string" ? obj.message : void 0;
57
- const title = typeof obj.title === "string" ? obj.title : response?.statusText || "API error";
58
- const violations = coerceViolations(obj.violations) ?? coerceViolations(obj.errors);
59
- if (detail2) {
60
- return {
61
- type: typeof obj.type === "string" ? obj.type : CLI_PROBLEM_TYPES.UNKNOWN_API_ERROR,
62
- title,
63
- status: typeof obj.status === "number" ? obj.status : response?.status ?? 0,
64
- detail: detail2,
65
- requestId: typeof obj.requestId === "string" ? obj.requestId : getRequestId(response),
66
- retryable: typeof obj.retryable === "boolean" ? obj.retryable : void 0,
67
- context: typeof obj.context === "object" && obj.context !== null ? obj.context : void 0,
68
- violations,
69
- timestamp: typeof obj.timestamp === "string" ? obj.timestamp : void 0,
70
- instance: typeof obj.instance === "string" ? obj.instance : void 0
71
- };
72
- }
73
- }
74
- const detail = typeof error === "string" ? error.trim() || fallback : fallback;
75
- return {
76
- type: CLI_PROBLEM_TYPES.UNKNOWN_API_ERROR,
77
- title: response?.statusText || "API error",
78
- status: response?.status ?? 0,
79
- detail,
80
- requestId: getRequestId(response)
81
- };
82
- }
83
- function formatProblem(problem) {
84
- const base = problem.detail || problem.title;
85
- const violations = problem.violations && problem.violations.length > 0 ? ` (${problem.violations.map((entry) => entry.message).join("; ")})` : "";
86
- const statusSuffix = problem.status && problem.status > 0 ? ` (HTTP ${problem.status})` : "";
87
- return `${base}${violations}${statusSuffix}`;
88
- }
89
- var DreamboardApiError = class extends Error {
90
- problem;
91
- status;
92
- requestId;
93
- retryable;
94
- constructor(problem, cause) {
95
- super(formatProblem(problem), { cause });
96
- this.name = "DreamboardApiError";
97
- this.problem = problem;
98
- this.status = problem.status;
99
- this.requestId = problem.requestId;
100
- this.retryable = problem.retryable;
101
- }
102
- };
103
- function toDreamboardApiError(error, response, fallback) {
104
- return new DreamboardApiError(toApiProblem(error, response, fallback), error);
105
- }
106
- function isDreamboardApiError(error) {
107
- return error instanceof DreamboardApiError;
108
- }
109
- function getObjectStringProperty(value, property) {
110
- return value && typeof value === "object" && typeof value[property] === "string" ? value[property] : void 0;
111
- }
112
- function isStaleContractArtifactMessage(message) {
113
- return message.includes(STALE_CONTRACT_ARTIFACT_CODE) || message.includes("StaleContractArtifactError") || message.toLowerCase().includes("stale contract artifact");
114
- }
115
- function isStaleContractArtifactError(error) {
116
- if (getObjectStringProperty(error, "code") === STALE_CONTRACT_ARTIFACT_CODE) {
117
- return true;
118
- }
119
- if (getObjectStringProperty(error, "name") === "StaleContractArtifactError") {
120
- return true;
121
- }
122
- const message = getObjectStringProperty(error, "message");
123
- return message ? isStaleContractArtifactMessage(message) : false;
124
- }
125
- function isGameNotFoundProblem(problem) {
126
- return problem.status === 404 && (problem.detail?.startsWith("Game not found: ") === true || problem.instance?.includes("/source-blobs/upload-sessions") === true);
127
- }
128
- function getProblemResolution(problem) {
129
- if (isGameNotFoundProblem(problem)) {
130
- return [
131
- "Run `dreamboard sync --force` to recreate the remote game state from your current local files if this is a local workspace.",
132
- "If you meant to use an existing remote game, check that your selected `--env` points at the backend that has that game."
133
- ].join(" ");
134
- }
135
- switch (problem.type) {
136
- case CLI_PROBLEM_TYPES.UNAUTHORIZED:
137
- return "Run `dreamboard login` to authenticate again.";
138
- case CLI_PROBLEM_TYPES.FORBIDDEN:
139
- return "Check that the signed-in account has access to this game, or run `dreamboard login` with the correct account.";
140
- case CLI_PROBLEM_TYPES.TOO_MANY_REQUESTS:
141
- return "Wait a moment, then retry the command.";
142
- case CLI_PROBLEM_TYPES.TRANSPORT_ERROR:
143
- return "Check that the selected Dreamboard server is reachable and try again later.";
144
- case CLI_PROBLEM_TYPES.VALIDATION_FAILED:
145
- return "Fix the validation issue above, then retry the command.";
146
- case CLI_PROBLEM_TYPES.ACTIVE_JOB_CONFLICT:
147
- return "Wait for the active job to finish, then retry the command.";
148
- case CLI_PROBLEM_TYPES.GAME_SLUG_CONFLICT:
149
- return "Choose a different game slug, or use the existing workspace for that slug.";
150
- case CLI_PROBLEM_TYPES.SOURCE_REVISION_NOT_FOUND:
151
- return "Run `dreamboard sync --force` to recreate the remote source revision from your current local files.";
152
- case CLI_PROBLEM_TYPES.SOURCE_REVISION_DRIFT:
153
- case CLI_PROBLEM_TYPES.AUTHORING_STATE_DRIFT:
154
- case CLI_PROBLEM_TYPES.STATE_CONFLICT:
155
- return "Run `dreamboard pull` to reconcile remote changes before retrying. If this local workspace is the source of truth, rerun the command with `--force` when supported.";
156
- case CLI_PROBLEM_TYPES.SOURCE_REVISION_BASE_MISSING:
157
- case CLI_PROBLEM_TYPES.AUTHORING_STATE_BASE_MISSING:
158
- return "Run `dreamboard pull --force` in a clean workspace to recover the remote authored state. If the remote has no authored state, run `dreamboard sync --force` from the local source-of-truth workspace.";
159
- case CLI_PROBLEM_TYPES.INTERNAL_ERROR:
160
- return "Retry the command. If it still fails, include the request id when asking for help.";
161
- default:
162
- return void 0;
163
- }
164
- }
165
- function getProblemDetails(problem) {
166
- return [
167
- `Problem: ${problem.type}`,
168
- problem.instance ? `Endpoint: ${problem.instance}` : void 0,
169
- problem.requestId ? `Request ID: ${problem.requestId}` : void 0,
170
- problem.timestamp ? `Timestamp: ${problem.timestamp}` : void 0
171
- ].filter((detail) => Boolean(detail));
172
- }
173
- function presentCliError(error) {
174
- if (isDreamboardApiError(error)) {
175
- return {
176
- message: formatProblem(error.problem),
177
- resolution: getProblemResolution(error.problem),
178
- details: getProblemDetails(error.problem)
179
- };
180
- }
181
- if (error instanceof Error) {
182
- return {
183
- message: error.message,
184
- details: []
185
- };
186
- }
187
- if (typeof error === "object" && error !== null) {
188
- let serialized;
189
- try {
190
- serialized = JSON.stringify(error);
191
- } catch {
192
- serialized = String(error);
193
- }
194
- return {
195
- message: serialized,
196
- details: []
197
- };
198
- }
199
- return {
200
- message: String(error),
201
- details: []
202
- };
203
- }
204
- function formatCliError(error) {
205
- const presentation = presentCliError(error);
206
- return [
207
- presentation.message,
208
- presentation.resolution ? `Resolution: ${presentation.resolution}` : void 0,
209
- ...presentation.details
210
- ].filter((line) => Boolean(line)).join("\n");
211
- }
212
-
213
- export {
214
- STALE_CONTRACT_ARTIFACT_CODE,
215
- STALE_CONTRACT_ARTIFACT_EXIT_CODE,
216
- toDreamboardApiError,
217
- isDreamboardApiError,
218
- isStaleContractArtifactMessage,
219
- isStaleContractArtifactError,
220
- formatCliError
221
- };
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- createRepoLocalPackageResolutionPlugin,
4
- resolveCliRepoRoot
5
- } from "./chunk-6UUJEYDV.mjs";
6
-
7
- // src/utils/ts-module-loader.ts
8
- import { mkdtemp, rm, writeFile } from "fs/promises";
9
- import { tmpdir } from "os";
10
- import path from "path";
11
- import { pathToFileURL } from "url";
12
- import { build } from "esbuild";
13
- var ESBUILD_EXTERNALS = [
14
- "playwright",
15
- "playwright-core",
16
- "chromium-bidi",
17
- "electron"
18
- ];
19
- function resolveSourceCheckoutBuildContext() {
20
- try {
21
- const repoRoot = resolveCliRepoRoot(import.meta.url);
22
- return {
23
- nodePaths: [
24
- path.join(repoRoot, "apps", "dreamboard-cli", "node_modules"),
25
- path.join(repoRoot, "node_modules")
26
- ],
27
- plugins: [createRepoLocalPackageResolutionPlugin({ repoRoot })]
28
- };
29
- } catch {
30
- return {
31
- nodePaths: [path.join(process.cwd(), "node_modules")],
32
- plugins: []
33
- };
34
- }
35
- }
36
- async function bundleTypeScriptModuleText(entryPath, options = {}) {
37
- const sourceCheckoutContext = resolveSourceCheckoutBuildContext();
38
- const result = await build({
39
- entryPoints: [entryPath],
40
- bundle: true,
41
- format: "esm",
42
- platform: "node",
43
- target: "node24",
44
- sourcemap: "inline",
45
- external: [...ESBUILD_EXTERNALS, ...options.external ?? []],
46
- nodePaths: sourceCheckoutContext.nodePaths,
47
- plugins: sourceCheckoutContext.plugins,
48
- write: false
49
- });
50
- const output = result.outputFiles?.[0];
51
- if (!output) {
52
- throw new Error(`Failed to bundle TypeScript module '${entryPath}'.`);
53
- }
54
- return output.text;
55
- }
56
- async function importTypeScriptModule(entryPath) {
57
- const tempDir = await mkdtemp(path.join(tmpdir(), "dreamboard-ts-module-"));
58
- const outfile = path.join(
59
- tempDir,
60
- `${path.basename(entryPath).replace(/\.[^.]+$/u, "")}.mjs`
61
- );
62
- try {
63
- const bundledText = await bundleTypeScriptModuleText(entryPath);
64
- await writeFile(outfile, bundledText);
65
- return await import(pathToFileURL(outfile).href);
66
- } finally {
67
- await rm(tempDir, { recursive: true, force: true });
68
- }
69
- }
70
-
71
- export {
72
- bundleTypeScriptModuleText,
73
- importTypeScriptModule
74
- };
@@ -1,149 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- MANIFEST_TYPECHECK_CONFIG_FILE
4
- } from "./chunk-SHUMAVAP.mjs";
5
-
6
- // src/services/project/local-typecheck.ts
7
- import { spawn } from "child_process";
8
- import { lstat } from "fs/promises";
9
- import { createRequire } from "module";
10
- import path from "path";
11
- var TYPESCRIPT_BIN_PATH_SEGMENTS = [
12
- "node_modules",
13
- "typescript",
14
- "bin",
15
- "tsc"
16
- ];
17
- var CLI_PACKAGE_TYPESCRIPT_CLI = resolveCliPackageTypescriptCli();
18
- function resolveCliPackageTypescriptCli() {
19
- try {
20
- const require2 = createRequire(import.meta.url);
21
- return require2.resolve("typescript/bin/tsc");
22
- } catch {
23
- return null;
24
- }
25
- }
26
- function getProjectNodeModules(projectRoot) {
27
- return path.join(projectRoot, "node_modules");
28
- }
29
- function getProjectTypescriptCli(projectRoot) {
30
- return path.join(projectRoot, ...TYPESCRIPT_BIN_PATH_SEGMENTS);
31
- }
32
- async function pathExists(targetPath) {
33
- try {
34
- await lstat(targetPath);
35
- return true;
36
- } catch {
37
- return false;
38
- }
39
- }
40
- async function ensureTypecheckDependencies(projectRoot) {
41
- if (await pathExists(getProjectNodeModules(projectRoot))) {
42
- return null;
43
- }
44
- return `Skipping local typecheck: workspace dependencies are not installed at ${getProjectNodeModules(projectRoot)}. Run \`dreamboard sync\` to reconcile workspace dependencies first.`;
45
- }
46
- async function resolveTypecheckRunner(projectRoot) {
47
- const localTypescriptCli = getProjectTypescriptCli(projectRoot);
48
- if (await pathExists(localTypescriptCli)) {
49
- return {
50
- command: process.execPath,
51
- argsPrefix: [localTypescriptCli]
52
- };
53
- }
54
- if (CLI_PACKAGE_TYPESCRIPT_CLI && await pathExists(CLI_PACKAGE_TYPESCRIPT_CLI)) {
55
- return {
56
- command: process.execPath,
57
- argsPrefix: [CLI_PACKAGE_TYPESCRIPT_CLI]
58
- };
59
- }
60
- const globalTscAvailable = await new Promise((resolve) => {
61
- const child = spawn("tsc", ["--version"], {
62
- env: process.env,
63
- stdio: "ignore"
64
- });
65
- child.on("error", () => {
66
- resolve(false);
67
- });
68
- child.on("close", (code) => {
69
- resolve(code === 0);
70
- });
71
- });
72
- if (!globalTscAvailable) {
73
- return null;
74
- }
75
- return {
76
- command: "tsc",
77
- argsPrefix: []
78
- };
79
- }
80
- async function runTypecheckProject(runner, projectRoot, projectPath) {
81
- return new Promise((resolve, reject) => {
82
- const child = spawn(
83
- runner.command,
84
- [...runner.argsPrefix, "--noEmit", "-p", projectPath],
85
- {
86
- cwd: projectRoot,
87
- env: process.env,
88
- stdio: ["ignore", "pipe", "pipe"]
89
- }
90
- );
91
- let stdout = "";
92
- let stderr = "";
93
- child.stdout.on("data", (chunk) => {
94
- stdout += chunk.toString();
95
- });
96
- child.stderr.on("data", (chunk) => {
97
- stderr += chunk.toString();
98
- });
99
- child.on("error", (error) => {
100
- reject(new Error(`Failed to start local typecheck. ${error.message}`));
101
- });
102
- child.on("close", (code) => {
103
- const output = [stdout, stderr].filter(Boolean).join("\n").trim();
104
- resolve({
105
- success: code === 0,
106
- output
107
- });
108
- });
109
- });
110
- }
111
- async function runLocalTypecheck(projectRoot) {
112
- const dependencySkipReason = await ensureTypecheckDependencies(projectRoot);
113
- if (dependencySkipReason) {
114
- return {
115
- success: true,
116
- skipped: true,
117
- output: dependencySkipReason
118
- };
119
- }
120
- const runner = await resolveTypecheckRunner(projectRoot);
121
- if (!runner) {
122
- return {
123
- success: true,
124
- skipped: true,
125
- output: "Skipping local typecheck: TypeScript CLI was not found in workspace dependencies or on PATH."
126
- };
127
- }
128
- const results = await Promise.all(
129
- [
130
- MANIFEST_TYPECHECK_CONFIG_FILE,
131
- "app/tsconfig.json",
132
- "ui/tsconfig.json"
133
- ].map(
134
- (projectPath) => runTypecheckProject(runner, projectRoot, projectPath)
135
- )
136
- );
137
- const firstFailure = results.find((result) => !result.success);
138
- if (firstFailure) {
139
- return firstFailure;
140
- }
141
- return {
142
- success: true,
143
- output: ""
144
- };
145
- }
146
-
147
- export {
148
- runLocalTypecheck
149
- };
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- generateAuthoritativeFiles,
4
- generateSeedFiles,
5
- isFrameworkOwnedSetupProfilesSeed
6
- } from "./chunk-U6OJN7XS.mjs";
7
- import {
8
- readTextFileIfExists,
9
- writeTextFile
10
- } from "./chunk-LM3OZLZG.mjs";
11
-
12
- // src/services/project/workspace-codegen.ts
13
- var STARTER_UI_SEED_FILES = /* @__PURE__ */ new Set([
14
- "ui/interaction-routes.tsx",
15
- "ui/setup-screen.tsx",
16
- "ui/styles.ts",
17
- "ui/ui-contract-typing-smoke.tsx"
18
- ]);
19
- async function applyWorkspaceCodegen(options) {
20
- const { projectRoot, manifest } = options;
21
- const authoritativeFiles = generateAuthoritativeFiles(manifest);
22
- const seedFiles = generateSeedFiles(manifest);
23
- const written = [];
24
- const skipped = [];
25
- const merged = [];
26
- const existingUiAppBeforeSeeds = await readTextFileIfExists(
27
- `${projectRoot}/ui/App.tsx`
28
- );
29
- const shouldWriteStarterUiSeedFiles = existingUiAppBeforeSeeds === null || existingUiAppBeforeSeeds.trim().length === 0;
30
- for (const [relativePath, content] of Object.entries(authoritativeFiles)) {
31
- const filePath = `${projectRoot}/${relativePath}`;
32
- const existingContent = await readTextFileIfExists(filePath);
33
- await writeTextFile(filePath, content);
34
- if (existingContent !== content) {
35
- written.push(relativePath);
36
- }
37
- }
38
- for (const [relativePath, content] of Object.entries(seedFiles)) {
39
- const filePath = `${projectRoot}/${relativePath}`;
40
- const existingContent = await readTextFileIfExists(filePath);
41
- if (STARTER_UI_SEED_FILES.has(relativePath) && !shouldWriteStarterUiSeedFiles && existingContent === null) {
42
- skipped.push(relativePath);
43
- continue;
44
- }
45
- const shouldRefreshFrameworkSeed = relativePath === "app/setup-profiles.ts" && isFrameworkOwnedSetupProfilesSeed(existingContent);
46
- if (shouldRefreshFrameworkSeed) {
47
- await writeTextFile(filePath, content);
48
- if (existingContent !== content) {
49
- written.push(relativePath);
50
- }
51
- continue;
52
- }
53
- const hasExistingContent = existingContent !== null && existingContent.trim().length > 0;
54
- if (hasExistingContent) {
55
- skipped.push(relativePath);
56
- continue;
57
- }
58
- await writeTextFile(filePath, content);
59
- written.push(relativePath);
60
- }
61
- written.sort();
62
- skipped.sort();
63
- merged.sort();
64
- return { written, skipped, merged };
65
- }
66
-
67
- export {
68
- applyWorkspaceCodegen
69
- };