@dreamboard-games/cli 0.1.30-alpha.0 → 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-TSJVWTJO.js → chunk-N7XPNNUI.js} +14 -12
- package/dist/chunk-N7XPNNUI.js.map +1 -0
- package/dist/chunk-SEGVTWSK.js +44 -0
- package/dist/{chunk-3XNJT3RK.js → chunk-TAQKH67O.js} +21279 -35845
- package/dist/chunk-TAQKH67O.js.map +1 -0
- package/dist/{global-config-UKSWNDTX.js → global-config-S4ZIPECE.js} +3 -3
- package/dist/index.js +955 -230
- 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-2NZNKIND.mjs +0 -166
- package/dist/agent-verifier/chunk-2QMNAVV4.mjs +0 -14522
- package/dist/agent-verifier/chunk-2SZHMP6F.mjs +0 -264
- 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-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-DTMJCPS4.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-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-PM3SVG6R.mjs +0 -38
- package/dist/agent-verifier/chunk-RBDDIIPM.mjs +0 -19
- package/dist/agent-verifier/chunk-RJBLBYHX.mjs +0 -1681
- 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-WNCQQVOF.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-EWGZIVOY.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-4YEQME5N.mjs +0 -28
- package/dist/agent-verifier/sync-LOQAH4RC.mjs +0 -594
- package/dist/agent-verifier/test-YOJERVHN.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-3XNJT3RK.js.map +0 -1
- package/dist/chunk-7FOO4AJI.js +0 -50
- package/dist/chunk-7FOO4AJI.js.map +0 -1
- package/dist/chunk-TSJVWTJO.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-UKSWNDTX.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,301 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/templates/testing-types-content.ts
|
|
4
|
-
var DEFAULT_REJECTION_CODES = [
|
|
5
|
-
"NOT_YOUR_TURN",
|
|
6
|
-
"action-unavailable",
|
|
7
|
-
"invalid-action-params",
|
|
8
|
-
"prompt-not-owned"
|
|
9
|
-
];
|
|
10
|
-
function renderLiteralUnion(values) {
|
|
11
|
-
if (values.length === 0) {
|
|
12
|
-
return "never";
|
|
13
|
-
}
|
|
14
|
-
return values.map((value) => JSON.stringify(value)).join(" | ");
|
|
15
|
-
}
|
|
16
|
-
var REDUCER_TESTING_TYPES_WRAPPER_CONTENT = `// Generated by dreamboard \u2014 do not edit by hand.
|
|
17
|
-
import game from "../app/game";
|
|
18
|
-
import {
|
|
19
|
-
contractFingerprint,
|
|
20
|
-
createReducerBundle,
|
|
21
|
-
} from "@dreamboard-games/sdk/reducer";
|
|
22
|
-
import { createTestRuntime as createDreamboardTestRuntime } from "@dreamboard-games/sdk/testing";
|
|
23
|
-
import type { CreateTestRuntimeOptions } from "@dreamboard-games/sdk/testing";
|
|
24
|
-
import { literals } from "../shared/manifest-contract";
|
|
25
|
-
import type { PhaseName } from "../shared/generated/ui-contract";
|
|
26
|
-
import {
|
|
27
|
-
BASE_STATES,
|
|
28
|
-
BASE_STATES_CONTRACT_FINGERPRINT,
|
|
29
|
-
} from "./generated/base-states.generated";
|
|
30
|
-
import type {
|
|
31
|
-
BaseDefinition,
|
|
32
|
-
ScenarioDefinition,
|
|
33
|
-
TestRunner,
|
|
34
|
-
} from "./generated/testing-contract";
|
|
35
|
-
|
|
36
|
-
export * from "./generated/testing-contract";
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Workspace-narrowed \`defineBase\` wrapper. Accepts the generated
|
|
40
|
-
* \`BaseDefinition\` so \`setup({ seat, game })\` is typed against the
|
|
41
|
-
* workspace's player ids and interaction contract.
|
|
42
|
-
*/
|
|
43
|
-
export function defineBase<const Definition extends BaseDefinition>(
|
|
44
|
-
definition: Definition,
|
|
45
|
-
): Definition {
|
|
46
|
-
return definition;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Workspace-narrowed \`defineScenario\` wrapper. The generated
|
|
51
|
-
* \`ScenarioDefinition\` narrows \`ctx.view(playerId)\` in \`then\` based on
|
|
52
|
-
* the declared \`phase\`, keeps \`when\` union-typed, and constrains
|
|
53
|
-
* \`phase\` / \`stage\` to the manifest-derived literal types.
|
|
54
|
-
*/
|
|
55
|
-
export function defineScenario<
|
|
56
|
-
const Runners extends readonly TestRunner[] = readonly ["reducer"],
|
|
57
|
-
const Phase extends PhaseName | undefined = undefined,
|
|
58
|
-
>(
|
|
59
|
-
definition: ScenarioDefinition<Runners, Phase>,
|
|
60
|
-
): ScenarioDefinition<Runners, Phase> {
|
|
61
|
-
return definition;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function createTestRuntime(options: {
|
|
65
|
-
baseId: keyof typeof BASE_STATES & string;
|
|
66
|
-
phase?: PhaseName;
|
|
67
|
-
controllingPlayerId?: (typeof literals.playerIds)[number];
|
|
68
|
-
userId?: string | null;
|
|
69
|
-
}) {
|
|
70
|
-
const reducerBundle =
|
|
71
|
-
createReducerBundle(game) satisfies CreateTestRuntimeOptions["bundle"];
|
|
72
|
-
const baseStates =
|
|
73
|
-
BASE_STATES satisfies CreateTestRuntimeOptions["baseStates"];
|
|
74
|
-
const runtime = createDreamboardTestRuntime({
|
|
75
|
-
baseId: options.baseId,
|
|
76
|
-
baseStates,
|
|
77
|
-
bundle: reducerBundle,
|
|
78
|
-
contractFingerprint: contractFingerprint(game).value,
|
|
79
|
-
expectedBaseStateFingerprint: BASE_STATES_CONTRACT_FINGERPRINT,
|
|
80
|
-
phase: options.phase,
|
|
81
|
-
userId: options.userId ?? "test-user",
|
|
82
|
-
playerIds: literals.playerIds.slice(
|
|
83
|
-
0,
|
|
84
|
-
BASE_STATES[options.baseId]?.fingerprint.players ?? literals.playerIds.length,
|
|
85
|
-
),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (options.controllingPlayerId) {
|
|
89
|
-
runtime.setControllingPlayer(options.controllingPlayerId);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return runtime;
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
|
-
function buildReducerTestingContractContent(options = {}) {
|
|
96
|
-
const rejectionCodes = Array.from(
|
|
97
|
-
/* @__PURE__ */ new Set([...options.rejectionCodes ?? [], ...DEFAULT_REJECTION_CODES])
|
|
98
|
-
).sort((left, right) => left.localeCompare(right));
|
|
99
|
-
return `// Generated by dreamboard \u2014 do not edit by hand.
|
|
100
|
-
import type game from "../../app/game";
|
|
101
|
-
import { literals, type SetupProfileId } from "../../shared/manifest-contract";
|
|
102
|
-
import {
|
|
103
|
-
type GameView,
|
|
104
|
-
type InteractionId,
|
|
105
|
-
type InteractionKey,
|
|
106
|
-
type InteractionParamsOf,
|
|
107
|
-
type PhaseName,
|
|
108
|
-
type StageName as WorkspaceStageName,
|
|
109
|
-
} from "../../shared/generated/ui-contract";
|
|
110
|
-
import type {
|
|
111
|
-
ExpectFn as SharedExpectFn,
|
|
112
|
-
TestRunner as SharedTestRunner,
|
|
113
|
-
} from "@dreamboard-games/sdk/testing";
|
|
114
|
-
import type { InteractionDescriptor } from "@dreamboard-games/sdk/runtime";
|
|
115
|
-
import { BASE_STATES } from "./base-states.generated";
|
|
116
|
-
|
|
117
|
-
export type GameDefinition = typeof game;
|
|
118
|
-
export type PlayerId = (typeof literals.playerIds)[number];
|
|
119
|
-
export type StateName = PhaseName;
|
|
120
|
-
export type BaseId = keyof typeof BASE_STATES & string;
|
|
121
|
-
export type InteractionDescriptorFor<Id extends string = string> =
|
|
122
|
-
InteractionDescriptor<Id>;
|
|
123
|
-
export type InteractionExplanation = {
|
|
124
|
-
interactionId: string;
|
|
125
|
-
phase: string;
|
|
126
|
-
step: string | null;
|
|
127
|
-
availability:
|
|
128
|
-
| "available"
|
|
129
|
-
| "notYourTurn"
|
|
130
|
-
| "wrongPhase"
|
|
131
|
-
| "wrongStep"
|
|
132
|
-
| "blocked";
|
|
133
|
-
rules: ReadonlyArray<{
|
|
134
|
-
ruleId: string;
|
|
135
|
-
outcome: "passed" | "failed" | "notEvaluated";
|
|
136
|
-
errorCode?: string;
|
|
137
|
-
message?: string;
|
|
138
|
-
}>;
|
|
139
|
-
actor: { required: readonly string[]; playerIsActor: boolean };
|
|
140
|
-
inputs: ReadonlyArray<{
|
|
141
|
-
key: string;
|
|
142
|
-
kind: string;
|
|
143
|
-
eligibleCount: number | "lazy";
|
|
144
|
-
}>;
|
|
145
|
-
};
|
|
146
|
-
export type TestRunner = SharedTestRunner;
|
|
147
|
-
export type ExpectFn = SharedExpectFn;
|
|
148
|
-
export type KnownRejectionCode = ${renderLiteralUnion(rejectionCodes)};
|
|
149
|
-
export type RejectionCode = [KnownRejectionCode] extends [never]
|
|
150
|
-
? string
|
|
151
|
-
: KnownRejectionCode;
|
|
152
|
-
|
|
153
|
-
type DefaultRunners = readonly ["reducer"];
|
|
154
|
-
type PhaseTaggedView<Phase extends PhaseName> = Extract<
|
|
155
|
-
GameView,
|
|
156
|
-
{ phase: Phase } | { currentPhase: Phase } | { state: Phase }
|
|
157
|
-
>;
|
|
158
|
-
type NarrowedView<Phase extends PhaseName> = [PhaseTaggedView<Phase>] extends [never]
|
|
159
|
-
? GameView
|
|
160
|
-
: PhaseTaggedView<Phase>;
|
|
161
|
-
|
|
162
|
-
export type ViewByPhase = {
|
|
163
|
-
[Phase in PhaseName]: NarrowedView<Phase>;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
type InteractionKeyForId<Id extends InteractionId> = Extract<
|
|
167
|
-
InteractionKey,
|
|
168
|
-
\`\${string}.\${Id}\`
|
|
169
|
-
>;
|
|
170
|
-
type InteractionParamsForKey<Key extends InteractionKey> =
|
|
171
|
-
Key extends InteractionKey ? InteractionParamsOf<Key> : never;
|
|
172
|
-
type InteractionParamsOfId<Id extends InteractionId> =
|
|
173
|
-
InteractionParamsForKey<InteractionKeyForId<Id>>;
|
|
174
|
-
|
|
175
|
-
export interface BrowserRunnerSnapshot {
|
|
176
|
-
sessionId: string | null;
|
|
177
|
-
shortCode: string | null;
|
|
178
|
-
version: number;
|
|
179
|
-
currentPhase: string | null;
|
|
180
|
-
controllingPlayerId: string;
|
|
181
|
-
controllablePlayerIds: string[];
|
|
182
|
-
view: unknown;
|
|
183
|
-
availableInteractions?: string[];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export interface BrowserRunnerBridge {
|
|
187
|
-
snapshot(): Promise<BrowserRunnerSnapshot>;
|
|
188
|
-
submitInteraction(
|
|
189
|
-
playerId: PlayerId,
|
|
190
|
-
interactionId: string,
|
|
191
|
-
params: unknown,
|
|
192
|
-
): Promise<void>;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface BrowserRunnerDriver {
|
|
196
|
-
onReady?(bridge: BrowserRunnerBridge): Promise<void> | void;
|
|
197
|
-
interaction?(
|
|
198
|
-
bridge: BrowserRunnerBridge,
|
|
199
|
-
input: { playerId: PlayerId; interactionId: string; params: unknown },
|
|
200
|
-
): Promise<boolean | void> | boolean | void;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface ScenarioGameApi {
|
|
204
|
-
start(): Promise<void>;
|
|
205
|
-
/**
|
|
206
|
-
* Patch the reducer snapshot for deterministic setup-heavy scenarios.
|
|
207
|
-
* This is limited to reducer snapshot materialization and is rejected by
|
|
208
|
-
* live replay/browser runners so authored gameplay verification still
|
|
209
|
-
* submits real interactions.
|
|
210
|
-
*/
|
|
211
|
-
patchState(mutator: (state: Record<string, unknown>) => void): Promise<void>;
|
|
212
|
-
/**
|
|
213
|
-
* Submit a player interaction (action-kind or prompt-kind) to the game.
|
|
214
|
-
* The \`interactionId\` matches an \`InteractionId\` from the generated
|
|
215
|
-
* \`ui-contract\`; \`params\` is typed per interaction id.
|
|
216
|
-
*/
|
|
217
|
-
submit<Id extends InteractionId>(
|
|
218
|
-
playerId: PlayerId,
|
|
219
|
-
interactionId: Id,
|
|
220
|
-
params?: InteractionParamsOfId<Id>,
|
|
221
|
-
): Promise<void>;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export interface BaseContext {
|
|
225
|
-
game: ScenarioGameApi;
|
|
226
|
-
players(): readonly PlayerId[];
|
|
227
|
-
/**
|
|
228
|
-
* Resolve the seat at \`index\` in the base's players list.
|
|
229
|
-
* Throws if the index is out of range. Prefer \`seat(0)\`/\`seat(1)\` over
|
|
230
|
-
* literal player ids so bases stay portable across player counts and
|
|
231
|
-
* we never hard-code wire-shape assumptions like "player-1".
|
|
232
|
-
*/
|
|
233
|
-
seat(index: number): PlayerId;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export interface SharedScenarioContext {
|
|
237
|
-
game: ScenarioGameApi;
|
|
238
|
-
players(): readonly PlayerId[];
|
|
239
|
-
/**
|
|
240
|
-
* Resolve the seat at \`index\` in the current scenario's players list.
|
|
241
|
-
* Throws if the index is out of range. Prefer \`seat(0)\`/\`seat(1)\` over
|
|
242
|
-
* literal player ids so scenarios stay portable across player counts and
|
|
243
|
-
* we never hard-code wire-shape assumptions like "player-1".
|
|
244
|
-
*/
|
|
245
|
-
seat(index: number): PlayerId;
|
|
246
|
-
state(): StateName;
|
|
247
|
-
view(playerId: PlayerId): GameView;
|
|
248
|
-
interactions(playerId: PlayerId): readonly InteractionDescriptorFor[];
|
|
249
|
-
explain(playerId: PlayerId, interactionId: InteractionId): InteractionExplanation;
|
|
250
|
-
expect: ExpectFn;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export type ScenarioContext<
|
|
254
|
-
Phase extends PhaseName | undefined = undefined,
|
|
255
|
-
> = Omit<SharedScenarioContext, "state" | "view"> & {
|
|
256
|
-
state(): Phase extends PhaseName ? Phase : StateName;
|
|
257
|
-
view(playerId: PlayerId): Phase extends PhaseName ? ViewByPhase[Phase] : GameView;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export type ScenarioThenContext<
|
|
261
|
-
_Runners extends readonly TestRunner[] = DefaultRunners,
|
|
262
|
-
Phase extends PhaseName | undefined = undefined,
|
|
263
|
-
> = ScenarioContext<Phase>;
|
|
264
|
-
|
|
265
|
-
export interface BaseDefinition {
|
|
266
|
-
id: string;
|
|
267
|
-
seed?: number;
|
|
268
|
-
players?: number;
|
|
269
|
-
setupProfileId?: SetupProfileId;
|
|
270
|
-
extends?: BaseId | string;
|
|
271
|
-
setup: (ctx: BaseContext) => void | Promise<void>;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
export interface ScenarioDefinition<
|
|
275
|
-
Runners extends readonly TestRunner[] = DefaultRunners,
|
|
276
|
-
Phase extends PhaseName | undefined = undefined,
|
|
277
|
-
> {
|
|
278
|
-
id: string;
|
|
279
|
-
description?: string;
|
|
280
|
-
from: BaseId | string;
|
|
281
|
-
runners?: Runners;
|
|
282
|
-
phase?: Phase;
|
|
283
|
-
stage?: Phase extends PhaseName ? WorkspaceStageName<Phase> : never;
|
|
284
|
-
when: (ctx: ScenarioContext<Phase>) => void | Promise<void>;
|
|
285
|
-
then: (ctx: ScenarioThenContext<Runners, Phase>) => void | Promise<void>;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export type {
|
|
289
|
-
GameView,
|
|
290
|
-
InteractionId,
|
|
291
|
-
InteractionParamsOf,
|
|
292
|
-
PhaseName,
|
|
293
|
-
WorkspaceStageName,
|
|
294
|
-
};
|
|
295
|
-
`;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export {
|
|
299
|
-
REDUCER_TESTING_TYPES_WRAPPER_CONTENT,
|
|
300
|
-
buildReducerTestingContractContent
|
|
301
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
atomicWriteFile
|
|
4
|
-
} from "./chunk-MINCYHXN.mjs";
|
|
5
|
-
import {
|
|
6
|
-
ensureDir,
|
|
7
|
-
exists,
|
|
8
|
-
readJsonFile
|
|
9
|
-
} from "./chunk-LM3OZLZG.mjs";
|
|
10
|
-
import {
|
|
11
|
-
PROJECT_CONFIG_FILE,
|
|
12
|
-
PROJECT_DIR_NAME,
|
|
13
|
-
PROJECT_STATE_FILE
|
|
14
|
-
} from "./chunk-SHUMAVAP.mjs";
|
|
15
|
-
|
|
16
|
-
// src/build-target.ts
|
|
17
|
-
var injectedBuildChannel = true ? "published" : void 0;
|
|
18
|
-
var BUILD_CHANNEL = injectedBuildChannel === "published" ? "published" : "development";
|
|
19
|
-
var IS_PUBLISHED_BUILD = BUILD_CHANNEL === "published";
|
|
20
|
-
var PUBLISHED_ENVIRONMENT = "prod";
|
|
21
|
-
|
|
22
|
-
// src/config/project-config.ts
|
|
23
|
-
import path from "path";
|
|
24
|
-
var LEGACY_DEFAULT_DEPLOYMENT_ID = "legacy";
|
|
25
|
-
var LEGACY_DEFAULT_OWNER_SCOPE_ID = "default";
|
|
26
|
-
var LEGACY_DEFAULT_BINDING_KEY = `${LEGACY_DEFAULT_DEPLOYMENT_ID}:${LEGACY_DEFAULT_OWNER_SCOPE_ID}`;
|
|
27
|
-
function normalizeProjectManifest(config) {
|
|
28
|
-
return {
|
|
29
|
-
schemaVersion: 2,
|
|
30
|
-
projectId: config.projectId,
|
|
31
|
-
slug: config.slug
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function normalizeProjectBinding(config) {
|
|
35
|
-
return {
|
|
36
|
-
deploymentId: config.deploymentId ?? LEGACY_DEFAULT_DEPLOYMENT_ID,
|
|
37
|
-
ownerScopeId: config.ownerScopeId ?? LEGACY_DEFAULT_OWNER_SCOPE_ID,
|
|
38
|
-
gameId: config.gameId,
|
|
39
|
-
remoteHeadDigest: config.remoteHeadDigest,
|
|
40
|
-
jobId: config.jobId,
|
|
41
|
-
agentManaged: config.agentManaged,
|
|
42
|
-
workspacePrepared: config.workspacePrepared,
|
|
43
|
-
allowCreateGame: config.allowCreateGame,
|
|
44
|
-
environment: config.environment,
|
|
45
|
-
authoring: config.authoring,
|
|
46
|
-
compile: config.compile,
|
|
47
|
-
localMaintainerRegistry: config.localMaintainerRegistry,
|
|
48
|
-
apiBaseUrl: config.apiBaseUrl,
|
|
49
|
-
webBaseUrl: config.webBaseUrl,
|
|
50
|
-
packageManifest: config.packageManifest,
|
|
51
|
-
environmentManifest: config.environmentManifest
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function normalizeProjectState(config, existing) {
|
|
55
|
-
const binding = normalizeProjectBinding(config);
|
|
56
|
-
const bindingKey = config.bindingKey || `${binding.deploymentId}:${binding.ownerScopeId}`;
|
|
57
|
-
return {
|
|
58
|
-
schemaVersion: 1,
|
|
59
|
-
bindings: {
|
|
60
|
-
...existing?.bindings ?? {},
|
|
61
|
-
[bindingKey]: binding
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function mergeManifestAndBinding(manifest, binding, bindingKey) {
|
|
66
|
-
return {
|
|
67
|
-
...manifest,
|
|
68
|
-
...binding ?? {
|
|
69
|
-
deploymentId: LEGACY_DEFAULT_DEPLOYMENT_ID,
|
|
70
|
-
ownerScopeId: LEGACY_DEFAULT_OWNER_SCOPE_ID
|
|
71
|
-
},
|
|
72
|
-
gameId: binding?.gameId ?? manifest.projectId,
|
|
73
|
-
bindingKey: bindingKey ?? `${binding?.deploymentId ?? LEGACY_DEFAULT_DEPLOYMENT_ID}:${binding?.ownerScopeId ?? LEGACY_DEFAULT_OWNER_SCOPE_ID}`
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function isProjectManifestV2(value) {
|
|
77
|
-
const candidate = value;
|
|
78
|
-
return candidate?.schemaVersion === 2 && typeof candidate.projectId === "string" && typeof candidate.slug === "string";
|
|
79
|
-
}
|
|
80
|
-
function normalizeLegacyProjectConfig(config) {
|
|
81
|
-
return {
|
|
82
|
-
schemaVersion: 2,
|
|
83
|
-
projectId: config.projectId ?? config.gameId,
|
|
84
|
-
slug: config.slug,
|
|
85
|
-
bindingKey: LEGACY_DEFAULT_BINDING_KEY,
|
|
86
|
-
deploymentId: LEGACY_DEFAULT_DEPLOYMENT_ID,
|
|
87
|
-
ownerScopeId: LEGACY_DEFAULT_OWNER_SCOPE_ID,
|
|
88
|
-
gameId: config.gameId,
|
|
89
|
-
jobId: config.jobId,
|
|
90
|
-
agentManaged: config.agentManaged,
|
|
91
|
-
workspacePrepared: config.workspacePrepared,
|
|
92
|
-
allowCreateGame: config.allowCreateGame,
|
|
93
|
-
environment: config.environment,
|
|
94
|
-
authoring: config.authoring,
|
|
95
|
-
compile: config.compile,
|
|
96
|
-
localMaintainerRegistry: config.localMaintainerRegistry,
|
|
97
|
-
apiBaseUrl: config.apiBaseUrl,
|
|
98
|
-
webBaseUrl: config.webBaseUrl,
|
|
99
|
-
packageManifest: config.packageManifest,
|
|
100
|
-
environmentManifest: config.environmentManifest
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
async function loadProjectEnvironmentState(rootDir) {
|
|
104
|
-
const filePath = path.join(rootDir, PROJECT_DIR_NAME, PROJECT_STATE_FILE);
|
|
105
|
-
if (!await exists(filePath)) {
|
|
106
|
-
return { schemaVersion: 1, bindings: {} };
|
|
107
|
-
}
|
|
108
|
-
const state = await readJsonFile(filePath);
|
|
109
|
-
return state.schemaVersion === 1 && state.bindings ? state : { schemaVersion: 1, bindings: {} };
|
|
110
|
-
}
|
|
111
|
-
async function loadProjectConfig(rootDir) {
|
|
112
|
-
const filePath = path.join(rootDir, PROJECT_DIR_NAME, PROJECT_CONFIG_FILE);
|
|
113
|
-
const rawConfig = await readJsonFile(
|
|
114
|
-
filePath
|
|
115
|
-
);
|
|
116
|
-
if (!isProjectManifestV2(rawConfig)) {
|
|
117
|
-
const migrated = normalizeLegacyProjectConfig(
|
|
118
|
-
rawConfig
|
|
119
|
-
);
|
|
120
|
-
await updateProjectState(rootDir, migrated);
|
|
121
|
-
return migrated;
|
|
122
|
-
}
|
|
123
|
-
const state = await loadProjectEnvironmentState(rootDir);
|
|
124
|
-
const entries = Object.entries(state.bindings);
|
|
125
|
-
const [bindingKey, binding] = entries.find(([key]) => key !== LEGACY_DEFAULT_BINDING_KEY) ?? entries.find(([key]) => key === LEGACY_DEFAULT_BINDING_KEY) ?? [];
|
|
126
|
-
return mergeManifestAndBinding(rawConfig, binding, bindingKey);
|
|
127
|
-
}
|
|
128
|
-
async function updateProjectState(rootDir, config) {
|
|
129
|
-
const dir = path.join(rootDir, PROJECT_DIR_NAME);
|
|
130
|
-
await ensureDir(dir);
|
|
131
|
-
const existingState = await loadProjectEnvironmentState(rootDir);
|
|
132
|
-
await atomicWriteFile(
|
|
133
|
-
path.join(dir, PROJECT_CONFIG_FILE),
|
|
134
|
-
`${JSON.stringify(normalizeProjectManifest(config), null, 2)}
|
|
135
|
-
`,
|
|
136
|
-
{ mode: 420 }
|
|
137
|
-
);
|
|
138
|
-
await atomicWriteFile(
|
|
139
|
-
path.join(dir, PROJECT_STATE_FILE),
|
|
140
|
-
`${JSON.stringify(normalizeProjectState(config, existingState), null, 2)}
|
|
141
|
-
`,
|
|
142
|
-
{ mode: 384 }
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
async function findProjectRoot(startDir) {
|
|
146
|
-
let current = path.resolve(startDir);
|
|
147
|
-
for (let i = 0; i < 25; i++) {
|
|
148
|
-
const candidate = path.join(current, PROJECT_DIR_NAME, PROJECT_CONFIG_FILE);
|
|
149
|
-
if (await exists(candidate)) {
|
|
150
|
-
return current;
|
|
151
|
-
}
|
|
152
|
-
const parent = path.dirname(current);
|
|
153
|
-
if (parent === current) break;
|
|
154
|
-
current = parent;
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export {
|
|
160
|
-
BUILD_CHANNEL,
|
|
161
|
-
IS_PUBLISHED_BUILD,
|
|
162
|
-
PUBLISHED_ENVIRONMENT,
|
|
163
|
-
loadProjectConfig,
|
|
164
|
-
updateProjectState,
|
|
165
|
-
findProjectRoot
|
|
166
|
-
};
|