@seriousgaming/sdk-tools 1.5.0 → 1.6.1
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/guidance.md +350 -0
- package/dist/bundling/ui-bundler.d.ts +12 -0
- package/dist/cli-25RWY5BQ.js +41 -0
- package/dist/cli-2BH7FX27.js +52 -0
- package/dist/cli-2GZYGRVL.js +36 -0
- package/dist/cli-2NU2LPEE.js +97 -0
- package/dist/cli-3BRC32CP.js +132 -0
- package/dist/cli-3D3ZXWOV.js +111 -0
- package/dist/cli-3ZKWV3PN.js +96 -0
- package/dist/cli-45OCBG53.js +60 -0
- package/dist/cli-4LKXZQ2B.js +48 -0
- package/dist/cli-4PXNOJQX.js +81 -0
- package/dist/cli-4SIWLHQO.js +717 -0
- package/dist/cli-4UWFQNGF.js +54 -0
- package/dist/cli-4VFZHLDG.js +202 -0
- package/dist/cli-4YB3ROVR.js +78 -0
- package/dist/cli-5ACDPCXI.js +21 -0
- package/dist/cli-5IAW3LIF.js +38 -0
- package/dist/cli-5SM367K7.js +30 -0
- package/dist/cli-64AB62PM.js +25 -0
- package/dist/cli-6K3VQQUS.js +307 -0
- package/dist/cli-6QB2VFPY.js +80 -0
- package/dist/cli-6SGCYEEC.js +649 -0
- package/dist/cli-6UTPHWRQ.js +207 -0
- package/dist/cli-6VNKQ3OX.js +391 -0
- package/dist/cli-72XDEFU3.js +61 -0
- package/dist/cli-7A6MKCUJ.js +463 -0
- package/dist/cli-7XLHO2FE.js +226 -0
- package/dist/cli-AV2FYC5G.js +225 -0
- package/dist/cli-B6YHEKIJ.js +248 -0
- package/dist/cli-BJMS3VX3.js +1837 -0
- package/dist/cli-BUQI5UU4.js +43 -0
- package/dist/cli-BWX5E7TQ.js +23 -0
- package/dist/cli-BYCHKSSH.js +1331 -0
- package/dist/cli-C3CMJSNL.js +89 -0
- package/dist/cli-C47GJATR.js +42 -0
- package/dist/cli-C5QOJJWX.js +46 -0
- package/dist/cli-C6ZLPK2U.js +124 -0
- package/dist/cli-CD5CIJZI.js +72 -0
- package/dist/cli-DDJYUKQG.js +36 -0
- package/dist/cli-DFBTZEBX.js +167 -0
- package/dist/cli-DOXRQ3S5.js +60 -0
- package/dist/cli-EVI36HEM.js +79 -0
- package/dist/cli-F2D4GGUA.js +549 -0
- package/dist/cli-FQRVFGN6.js +0 -0
- package/dist/cli-FWFRKQNE.js +11 -0
- package/dist/cli-G6CANSPL.js +88 -0
- package/dist/cli-GFNDW2DL.js +124 -0
- package/dist/cli-HCRTYQQS.js +16 -0
- package/dist/cli-HFX3YPUL.js +76 -0
- package/dist/cli-HKORECAG.js +53 -0
- package/dist/cli-HOE3WLFH.js +73 -0
- package/dist/cli-HSIHDN6K.js +187 -0
- package/dist/cli-HW53ICZC.js +89 -0
- package/dist/cli-IDVUHGKG.js +218 -0
- package/dist/cli-IEMKI7J7.js +1387 -0
- package/dist/cli-ILFDANBR.js +101 -0
- package/dist/cli-ILKCQNM6.js +8 -0
- package/dist/cli-IP4RXGHM.js +2847 -0
- package/dist/cli-IUS2YCD3.js +31 -0
- package/dist/cli-J4DKUUTK.js +138 -0
- package/dist/cli-J4UBELKF.js +37 -0
- package/dist/cli-JJSWBW4H.js +89 -0
- package/dist/cli-JVI24FI6.js +68 -0
- package/dist/cli-JZCLIT3O.js +135 -0
- package/dist/cli-JZOZOEZM.js +131 -0
- package/dist/cli-KGM6RRQW.js +185 -0
- package/dist/cli-KGT5L7VZ.js +13641 -0
- package/dist/cli-KOGRWFN7.js +89 -0
- package/dist/cli-KSGB2ZLK.js +101 -0
- package/dist/cli-L7VYSXQK.js +243 -0
- package/dist/cli-LK3V4RI5.js +36 -0
- package/dist/cli-LQOHATY2.js +126 -0
- package/dist/cli-MJUYJIEP.js +13 -0
- package/dist/cli-MJV47HKI.js +143 -0
- package/dist/cli-MMN4BPO4.js +145 -0
- package/dist/cli-MOPSZ3CS.js +88 -0
- package/dist/cli-MU5LB43S.js +136 -0
- package/dist/cli-MYJGMA6U.js +40 -0
- package/dist/cli-N24OHSAN.js +36 -0
- package/dist/cli-N45DREM4.js +99 -0
- package/dist/cli-N6H6T2E2.js +616 -0
- package/dist/cli-NROTDF5Y.js +182 -0
- package/dist/cli-O5ABH2WK.js +226 -0
- package/dist/cli-OMWC75CC.js +256 -0
- package/dist/cli-OXAUOWCN.js +50 -0
- package/dist/cli-PGCIHPU7.js +143 -0
- package/dist/cli-Q6ZBZYK2.js +35 -0
- package/dist/cli-QUNIRH7A.js +57 -0
- package/dist/cli-QUSCIUOM.js +142 -0
- package/dist/cli-QVASWX2A.js +187 -0
- package/dist/cli-QWQMPCL6.js +253 -0
- package/dist/cli-QY5NZAR7.js +97 -0
- package/dist/cli-R2MUZQE2.js +62 -0
- package/dist/cli-RCIWBCXD.js +36 -0
- package/dist/cli-RLEGRWFM.js +81 -0
- package/dist/cli-RSW6EBBD.js +89 -0
- package/dist/cli-RZITKPJX.js +367 -0
- package/dist/cli-S5IVGDDD.js +32 -0
- package/dist/cli-SRHBXZCN.js +159 -0
- package/dist/cli-TDSQSCX4.js +131 -0
- package/dist/cli-TIDQ4WUE.js +257 -0
- package/dist/cli-TT36JCU5.js +370 -0
- package/dist/cli-TTKICM5P.js +100 -0
- package/dist/cli-TTMBBEJC.js +131 -0
- package/dist/cli-UMEBPAZQ.js +16 -0
- package/dist/cli-UNAJ2OTE.js +15 -0
- package/dist/cli-UZZFNXRX.js +226 -0
- package/dist/cli-VDBW23SS.js +81 -0
- package/dist/cli-VL2P354N.js +46 -0
- package/dist/cli-VPRRICZA.js +304 -0
- package/dist/cli-VQ6HVQW4.js +4010 -0
- package/dist/cli-WR3NOY74.js +36 -0
- package/dist/cli-WU43JT4T.js +52 -0
- package/dist/cli-XAT25PRU.js +117 -0
- package/dist/cli-XOTNXEJA.js +124 -0
- package/dist/cli-XSLNH5PR.js +6417 -0
- package/dist/cli-XSVGKI3R.js +39 -0
- package/dist/cli-XZCJIKIV.js +124 -0
- package/dist/cli-Y3DDNMPX.js +97 -0
- package/dist/cli-Y3O5F4JN.js +90 -0
- package/dist/cli-YOTGR3NB.js +82 -0
- package/dist/cli-Z56ZIVA6.js +97 -0
- package/dist/cli-ZBN5KAIB.js +59 -0
- package/dist/cli-ZDOTXEKL.js +31 -0
- package/dist/cli-ZDUADFBY.js +88 -0
- package/dist/cli-ZJFQ7EEA.js +131 -0
- package/dist/cli-ZTWOE3ZT.js +65 -0
- package/dist/cli.js +148 -43093
- package/dist/client/build-surfaces.d.ts +33 -0
- package/dist/client/dev-server.d.ts +6 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/playwright.d.ts +62 -0
- package/dist/client.js +228 -48
- package/dist/core/session.d.ts +15 -1
- package/dist/dev/console/assets/{index-BVF8exas.js → index-CuMOOH9m.js} +1 -1
- package/dist/dev/console/index.html +1 -1
- package/dist/dev/shell.d.ts +19 -0
- package/dist/dev/surfaces.d.ts +7 -0
- package/dist/docs/ai-agents.md +1 -1
- package/dist/docs/api/index.md +14 -12
- package/dist/docs/api/sdk-tools-client.md +29 -0
- package/dist/docs/api/sdk-tools-playwright.md +104 -0
- package/dist/docs/changelog.md +34 -0
- package/dist/docs/cli-and-dev-server.md +21 -0
- package/dist/docs/cli-reference.md +45 -31
- package/dist/docs/environment-variables.md +6 -0
- package/dist/docs/getting-started.md +1 -1
- package/dist/docs/guides/designing-a-game.md +29 -4
- package/dist/docs/guides/starter-game.md +3 -3
- package/dist/docs/guides/testing.md +33 -18
- package/dist/docs/guides/upgrading.md +19 -2
- package/dist/docs/page-index.md +10 -9
- package/dist/docs/recipes/e2e-testing.md +19 -20
- package/dist/playwright.js +32232 -0
- package/dist/templates/package/CLAUDE.md.template +7 -346
- package/dist/templates/package/claude/rules/workflow-create-engine.md +2 -2
- package/dist/templates/package/claude/rules/workflow-create-guide.md +2 -2
- package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
- package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
- package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +3 -3
- package/dist/templates/package/global-setup.ts.template +7 -18
- package/dist/templates/package/playwright.config.ts.liquid +8 -11
- package/dist/templates/starter-game/playwright.config.ts +8 -11
- package/dist/templates/starter-game/testing/e2e/game.spec.ts +1 -1
- package/dist/templates/starter-game/testing/e2e/global-setup.ts +7 -18
- package/dist/utils/prompt.d.ts +5 -5
- package/dist/utils/resource-scan.d.ts +39 -0
- package/package.json +7 -3
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
resolvePatchedDefinition
|
|
4
|
+
} from "./cli-5IAW3LIF.js";
|
|
5
|
+
import "./cli-S5IVGDDD.js";
|
|
6
|
+
import {
|
|
7
|
+
getResourceIdentifierError,
|
|
8
|
+
readAuthoredBundle
|
|
9
|
+
} from "./cli-4VFZHLDG.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveInputSource
|
|
12
|
+
} from "./cli-4UWFQNGF.js";
|
|
13
|
+
import {
|
|
14
|
+
updateHookFiles
|
|
15
|
+
} from "./cli-4SIWLHQO.js";
|
|
16
|
+
import "./cli-IUS2YCD3.js";
|
|
17
|
+
import "./cli-QUNIRH7A.js";
|
|
18
|
+
import "./cli-J4UBELKF.js";
|
|
19
|
+
import {
|
|
20
|
+
loadPackageContext
|
|
21
|
+
} from "./cli-XSVGKI3R.js";
|
|
22
|
+
import "./cli-TT36JCU5.js";
|
|
23
|
+
import {
|
|
24
|
+
findBundleFile
|
|
25
|
+
} from "./cli-OXAUOWCN.js";
|
|
26
|
+
import {
|
|
27
|
+
operationError,
|
|
28
|
+
printOperationResult,
|
|
29
|
+
regenerateTypes
|
|
30
|
+
} from "./cli-KSGB2ZLK.js";
|
|
31
|
+
import {
|
|
32
|
+
input
|
|
33
|
+
} from "./cli-ZTWOE3ZT.js";
|
|
34
|
+
import "./cli-LQOHATY2.js";
|
|
35
|
+
import "./cli-IEMKI7J7.js";
|
|
36
|
+
import "./cli-OMWC75CC.js";
|
|
37
|
+
import "./cli-BYCHKSSH.js";
|
|
38
|
+
import "./cli-25RWY5BQ.js";
|
|
39
|
+
import "./cli-QWQMPCL6.js";
|
|
40
|
+
import {
|
|
41
|
+
validateSDKHook
|
|
42
|
+
} from "./cli-VQ6HVQW4.js";
|
|
43
|
+
import "./cli-F2D4GGUA.js";
|
|
44
|
+
import {
|
|
45
|
+
logger
|
|
46
|
+
} from "./cli-4YB3ROVR.js";
|
|
47
|
+
import {
|
|
48
|
+
CliError
|
|
49
|
+
} from "./cli-N6H6T2E2.js";
|
|
50
|
+
|
|
51
|
+
// cli/commands/resources/hook/update.ts
|
|
52
|
+
import { readFileSync } from "fs";
|
|
53
|
+
async function updateHook(identifier, definitionInput, options) {
|
|
54
|
+
logger.info("\nUpdating hook...\n");
|
|
55
|
+
loadPackageContext(options.workingDir);
|
|
56
|
+
let jsonDefinition = null;
|
|
57
|
+
if (options.patch) {
|
|
58
|
+
jsonDefinition = resolvePatchedDefinition({
|
|
59
|
+
patch: options.patch,
|
|
60
|
+
workingDir: options.workingDir,
|
|
61
|
+
type: "hook",
|
|
62
|
+
identifier,
|
|
63
|
+
resourceLabel: "Hook"
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
const inputSource = await resolveInputSource(definitionInput, options.file);
|
|
67
|
+
if (inputSource.kind === "json") jsonDefinition = inputSource.json;
|
|
68
|
+
}
|
|
69
|
+
if (jsonDefinition) {
|
|
70
|
+
const hookInput = readAuthoredBundle({
|
|
71
|
+
json: jsonDefinition,
|
|
72
|
+
type: "hook",
|
|
73
|
+
command: "update",
|
|
74
|
+
validate: validateSDKHook,
|
|
75
|
+
identifier
|
|
76
|
+
});
|
|
77
|
+
logger.info("Updating hook files...\n");
|
|
78
|
+
const result2 = updateHookFiles({
|
|
79
|
+
packagePath: options.workingDir,
|
|
80
|
+
oldIdentifier: identifier,
|
|
81
|
+
newDefinition: hookInput.definition,
|
|
82
|
+
newIdentifier: hookInput.definition?.identifier
|
|
83
|
+
});
|
|
84
|
+
if (!result2.success) {
|
|
85
|
+
throw operationError(result2, "Failed to update hook files");
|
|
86
|
+
}
|
|
87
|
+
logger.success("Hook updated successfully!");
|
|
88
|
+
printOperationResult(result2);
|
|
89
|
+
await regenerateTypes(options.workingDir);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
logger.info("No JSON definition provided. Starting interactive mode...\n");
|
|
93
|
+
const hookFilePath = findBundleFile(options.workingDir, "hook", identifier);
|
|
94
|
+
if (!hookFilePath) {
|
|
95
|
+
throw new CliError("RESOURCE_NOT_FOUND", `Hook "${identifier}" not found`);
|
|
96
|
+
}
|
|
97
|
+
let existingBundle;
|
|
98
|
+
try {
|
|
99
|
+
existingBundle = JSON.parse(readFileSync(hookFilePath, "utf-8"));
|
|
100
|
+
} catch {
|
|
101
|
+
throw new CliError("BUNDLE_INVALID", "Could not read hook file");
|
|
102
|
+
}
|
|
103
|
+
const existingDef = { ...existingBundle.definition, identifier };
|
|
104
|
+
logger.info("Current values:");
|
|
105
|
+
logger.info(` Identifier: ${existingDef.identifier}`);
|
|
106
|
+
logger.info(` Signal: ${existingDef.signal}`);
|
|
107
|
+
logger.info("");
|
|
108
|
+
const newIdentifier = await input({
|
|
109
|
+
message: "Hook name:",
|
|
110
|
+
default: existingDef.identifier,
|
|
111
|
+
validate: (value) => {
|
|
112
|
+
const error = getResourceIdentifierError(value);
|
|
113
|
+
return error || true;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
if (newIdentifier !== existingDef.identifier) {
|
|
117
|
+
logger.info("\n\u26A0\uFE0F Changing the identifier will update all game references.\n");
|
|
118
|
+
}
|
|
119
|
+
const result = updateHookFiles({
|
|
120
|
+
packagePath: options.workingDir,
|
|
121
|
+
oldIdentifier: identifier,
|
|
122
|
+
newDefinition: { ...existingDef, identifier: newIdentifier }
|
|
123
|
+
});
|
|
124
|
+
if (!result.success) {
|
|
125
|
+
throw operationError(result, "Failed to update hook files");
|
|
126
|
+
}
|
|
127
|
+
logger.success("Hook updated successfully!");
|
|
128
|
+
await regenerateTypes(options.workingDir);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
updateHook
|
|
132
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
promptForSettings
|
|
4
|
+
} from "./cli-ZDOTXEKL.js";
|
|
5
|
+
import {
|
|
6
|
+
loadResourceIdentifiers
|
|
7
|
+
} from "./cli-Q6ZBZYK2.js";
|
|
8
|
+
import {
|
|
9
|
+
readAuthoredBundle
|
|
10
|
+
} from "./cli-4VFZHLDG.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveInputSource
|
|
13
|
+
} from "./cli-4UWFQNGF.js";
|
|
14
|
+
import {
|
|
15
|
+
createTickControllerFiles
|
|
16
|
+
} from "./cli-4SIWLHQO.js";
|
|
17
|
+
import "./cli-IUS2YCD3.js";
|
|
18
|
+
import "./cli-QUNIRH7A.js";
|
|
19
|
+
import "./cli-J4UBELKF.js";
|
|
20
|
+
import {
|
|
21
|
+
loadPackageContext
|
|
22
|
+
} from "./cli-XSVGKI3R.js";
|
|
23
|
+
import {
|
|
24
|
+
presentFields
|
|
25
|
+
} from "./cli-TT36JCU5.js";
|
|
26
|
+
import "./cli-OXAUOWCN.js";
|
|
27
|
+
import {
|
|
28
|
+
BUILD_COMMAND,
|
|
29
|
+
generateTypes,
|
|
30
|
+
operationError,
|
|
31
|
+
printOperationResult
|
|
32
|
+
} from "./cli-KSGB2ZLK.js";
|
|
33
|
+
import {
|
|
34
|
+
checkbox
|
|
35
|
+
} from "./cli-ZTWOE3ZT.js";
|
|
36
|
+
import "./cli-LQOHATY2.js";
|
|
37
|
+
import "./cli-IEMKI7J7.js";
|
|
38
|
+
import "./cli-OMWC75CC.js";
|
|
39
|
+
import "./cli-BYCHKSSH.js";
|
|
40
|
+
import "./cli-25RWY5BQ.js";
|
|
41
|
+
import "./cli-QWQMPCL6.js";
|
|
42
|
+
import {
|
|
43
|
+
validateSDKTickController
|
|
44
|
+
} from "./cli-VQ6HVQW4.js";
|
|
45
|
+
import "./cli-F2D4GGUA.js";
|
|
46
|
+
import {
|
|
47
|
+
logger
|
|
48
|
+
} from "./cli-4YB3ROVR.js";
|
|
49
|
+
import "./cli-N6H6T2E2.js";
|
|
50
|
+
|
|
51
|
+
// cli/commands/resources/tick-controller/new.ts
|
|
52
|
+
async function createTickController(definitionInput, options) {
|
|
53
|
+
logger.info("\nCreating new tick controller...\n");
|
|
54
|
+
loadPackageContext(options.workingDir);
|
|
55
|
+
const inputSource = await resolveInputSource(definitionInput, options.file);
|
|
56
|
+
const jsonDefinition = inputSource.kind === "json" ? inputSource.json : null;
|
|
57
|
+
if (jsonDefinition) {
|
|
58
|
+
const tcInput = readAuthoredBundle({
|
|
59
|
+
json: jsonDefinition,
|
|
60
|
+
type: "tick_controller",
|
|
61
|
+
command: "new",
|
|
62
|
+
validate: validateSDKTickController
|
|
63
|
+
});
|
|
64
|
+
logger.info("Creating tick controller files...\n");
|
|
65
|
+
const result2 = await createTickControllerFiles({
|
|
66
|
+
packagePath: options.workingDir,
|
|
67
|
+
definition: tcInput.definition
|
|
68
|
+
});
|
|
69
|
+
if (!result2.success) {
|
|
70
|
+
throw operationError(result2, "Failed to create tick controller files");
|
|
71
|
+
}
|
|
72
|
+
logger.success("Tick controller created successfully!");
|
|
73
|
+
printOperationResult(result2);
|
|
74
|
+
await generateTypes(options.workingDir);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
logger.info("No JSON definition provided. Starting interactive mode...\n");
|
|
78
|
+
const availableCapabilities = loadResourceIdentifiers(options.workingDir, "capability");
|
|
79
|
+
const reads = [];
|
|
80
|
+
if (availableCapabilities.length > 0) {
|
|
81
|
+
logger.info("Select capabilities this tick controller reads.\n");
|
|
82
|
+
const readCapabilities = await checkbox({
|
|
83
|
+
message: "Capabilities this tick controller reads from:",
|
|
84
|
+
choices: availableCapabilities.map((id) => ({
|
|
85
|
+
name: id,
|
|
86
|
+
value: id
|
|
87
|
+
})),
|
|
88
|
+
pageSize: 10
|
|
89
|
+
});
|
|
90
|
+
reads.push(...readCapabilities);
|
|
91
|
+
logger.info("");
|
|
92
|
+
}
|
|
93
|
+
const settings = await promptForSettings(options.workingDir, "tick controller");
|
|
94
|
+
logger.info("Creating tick controller files...\n");
|
|
95
|
+
const result = await createTickControllerFiles({
|
|
96
|
+
packagePath: options.workingDir,
|
|
97
|
+
definition: presentFields({ reads, settings })
|
|
98
|
+
});
|
|
99
|
+
if (!result.success) {
|
|
100
|
+
throw operationError(result, "Failed to create tick controller files");
|
|
101
|
+
}
|
|
102
|
+
logger.success("Tick controller created successfully!");
|
|
103
|
+
printOperationResult(result);
|
|
104
|
+
await generateTypes(options.workingDir);
|
|
105
|
+
logger.info("Next steps:");
|
|
106
|
+
logger.info(" 1. Edit the tick controller logic: tick_controller/logic.ts");
|
|
107
|
+
logger.info(` 2. Run "${BUILD_COMMAND}" to build your package`);
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
createTickController
|
|
111
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
createFacilitatorGuideFiles
|
|
4
|
+
} from "./cli-HKORECAG.js";
|
|
5
|
+
import {
|
|
6
|
+
readAuthoredBundle
|
|
7
|
+
} from "./cli-4VFZHLDG.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveInputSource
|
|
10
|
+
} from "./cli-4UWFQNGF.js";
|
|
11
|
+
import {
|
|
12
|
+
loadPackageContext
|
|
13
|
+
} from "./cli-XSVGKI3R.js";
|
|
14
|
+
import "./cli-TT36JCU5.js";
|
|
15
|
+
import "./cli-OXAUOWCN.js";
|
|
16
|
+
import {
|
|
17
|
+
operationError,
|
|
18
|
+
printOperationResult
|
|
19
|
+
} from "./cli-KSGB2ZLK.js";
|
|
20
|
+
import {
|
|
21
|
+
input
|
|
22
|
+
} from "./cli-ZTWOE3ZT.js";
|
|
23
|
+
import "./cli-LQOHATY2.js";
|
|
24
|
+
import "./cli-IEMKI7J7.js";
|
|
25
|
+
import "./cli-OMWC75CC.js";
|
|
26
|
+
import "./cli-BYCHKSSH.js";
|
|
27
|
+
import "./cli-25RWY5BQ.js";
|
|
28
|
+
import "./cli-QWQMPCL6.js";
|
|
29
|
+
import {
|
|
30
|
+
validateSDKFacilitatorGuide
|
|
31
|
+
} from "./cli-VQ6HVQW4.js";
|
|
32
|
+
import "./cli-F2D4GGUA.js";
|
|
33
|
+
import {
|
|
34
|
+
logger
|
|
35
|
+
} from "./cli-4YB3ROVR.js";
|
|
36
|
+
import "./cli-N6H6T2E2.js";
|
|
37
|
+
|
|
38
|
+
// cli/commands/resources/guide/new.ts
|
|
39
|
+
async function createFacilitatorGuide(definitionInput, options) {
|
|
40
|
+
logger.info("\nCreating new facilitator guide...\n");
|
|
41
|
+
loadPackageContext(options.workingDir, {
|
|
42
|
+
suggestNewPackage: true
|
|
43
|
+
});
|
|
44
|
+
const inputSource = await resolveInputSource(definitionInput, options.file);
|
|
45
|
+
const jsonDefinition = inputSource.kind === "json" ? inputSource.json : null;
|
|
46
|
+
if (jsonDefinition) {
|
|
47
|
+
const guideInput = readAuthoredBundle({
|
|
48
|
+
json: jsonDefinition,
|
|
49
|
+
type: "guide",
|
|
50
|
+
command: "new",
|
|
51
|
+
validate: validateSDKFacilitatorGuide
|
|
52
|
+
});
|
|
53
|
+
logger.info("Creating facilitator guide files...\n");
|
|
54
|
+
const result2 = await createFacilitatorGuideFiles({
|
|
55
|
+
packagePath: options.workingDir,
|
|
56
|
+
definition: guideInput.definition,
|
|
57
|
+
rootDirectory: guideInput.rootDirectory
|
|
58
|
+
});
|
|
59
|
+
if (!result2.success) {
|
|
60
|
+
throw operationError(result2, "Failed to create facilitator guide files");
|
|
61
|
+
}
|
|
62
|
+
logger.success("Facilitator guide created successfully!");
|
|
63
|
+
printOperationResult(result2);
|
|
64
|
+
logger.info("\nNext steps:");
|
|
65
|
+
logger.info(" 1. Edit the chapters in guide/content/<locale>/");
|
|
66
|
+
logger.info(" 2. Add images to guide/assets/");
|
|
67
|
+
logger.info(" 3. Reference this guide from a game via facilitatorGuides");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
logger.info("No JSON definition provided. Starting interactive mode...\n");
|
|
71
|
+
const displayName = await input({
|
|
72
|
+
message: "Display name (English), shown as the guide title:",
|
|
73
|
+
default: "Facilitator guide"
|
|
74
|
+
});
|
|
75
|
+
const locales = {
|
|
76
|
+
en: { name: displayName }
|
|
77
|
+
};
|
|
78
|
+
logger.info("\nCreating facilitator guide files...\n");
|
|
79
|
+
const result = await createFacilitatorGuideFiles({
|
|
80
|
+
packagePath: options.workingDir,
|
|
81
|
+
definition: { locales },
|
|
82
|
+
rootDirectory: "."
|
|
83
|
+
});
|
|
84
|
+
if (!result.success) {
|
|
85
|
+
throw operationError(result, "Failed to create facilitator guide files");
|
|
86
|
+
}
|
|
87
|
+
logger.success("Facilitator guide created successfully!");
|
|
88
|
+
printOperationResult(result);
|
|
89
|
+
logger.info("\nNext steps:");
|
|
90
|
+
logger.info(" 1. Edit the chapters in guide/content/<locale>/");
|
|
91
|
+
logger.info(" 2. Add images to guide/assets/");
|
|
92
|
+
logger.info(" 3. Reference this guide from a game via facilitatorGuides");
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
createFacilitatorGuide
|
|
96
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runResourceCommand
|
|
4
|
+
} from "./cli-HFX3YPUL.js";
|
|
5
|
+
import {
|
|
6
|
+
RESOURCE_DESCRIPTORS_BY_TYPE,
|
|
7
|
+
supportedTypes
|
|
8
|
+
} from "./cli-VPRRICZA.js";
|
|
9
|
+
import "./cli-KSGB2ZLK.js";
|
|
10
|
+
import "./cli-ZTWOE3ZT.js";
|
|
11
|
+
import "./cli-LQOHATY2.js";
|
|
12
|
+
import "./cli-IEMKI7J7.js";
|
|
13
|
+
import "./cli-OMWC75CC.js";
|
|
14
|
+
import "./cli-BYCHKSSH.js";
|
|
15
|
+
import "./cli-25RWY5BQ.js";
|
|
16
|
+
import "./cli-QWQMPCL6.js";
|
|
17
|
+
import "./cli-VQ6HVQW4.js";
|
|
18
|
+
import "./cli-F2D4GGUA.js";
|
|
19
|
+
import "./cli-4YB3ROVR.js";
|
|
20
|
+
import {
|
|
21
|
+
CliError
|
|
22
|
+
} from "./cli-N6H6T2E2.js";
|
|
23
|
+
|
|
24
|
+
// cli/commands/delete.ts
|
|
25
|
+
async function deleteCommand(resourceType, identifier, options) {
|
|
26
|
+
const descriptor = RESOURCE_DESCRIPTORS_BY_TYPE.get(resourceType);
|
|
27
|
+
const isUnidentified = descriptor?.delete?.kind === "unidentified";
|
|
28
|
+
await runResourceCommand(
|
|
29
|
+
{
|
|
30
|
+
command: "delete",
|
|
31
|
+
resourceType,
|
|
32
|
+
packagePath: options.workingDir,
|
|
33
|
+
identifier: isUnidentified ? void 0 : identifier
|
|
34
|
+
},
|
|
35
|
+
async () => {
|
|
36
|
+
if (!descriptor || !descriptor.delete) {
|
|
37
|
+
throw new CliError(
|
|
38
|
+
"RESOURCE_TYPE_UNKNOWN",
|
|
39
|
+
`Resource type "${resourceType}" is not supported for deletion
|
|
40
|
+
Supported types: ${supportedTypes("delete")}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (descriptor.delete.kind === "unidentified") {
|
|
44
|
+
await descriptor.delete.run(options);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!identifier) {
|
|
48
|
+
throw new CliError(
|
|
49
|
+
"USAGE_MISSING_ARGUMENT",
|
|
50
|
+
`Resource identifier is required.
|
|
51
|
+
Usage: seriousgaming-sdk delete ${resourceType} <identifier>`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
await descriptor.delete.run(identifier, options);
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
deleteCommand
|
|
60
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// cli/runtime/tick-validation.ts
|
|
4
|
+
var MIN_EFFECTIVE_TICK_INTERVAL_MS = 3e4;
|
|
5
|
+
var MAX_EFFECTIVE_TICK_INTERVAL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
6
|
+
function validateTickControllerResult(result, options) {
|
|
7
|
+
const { intervalMs, nextTickAt } = result;
|
|
8
|
+
if (nextTickAt !== void 0 && (typeof nextTickAt !== "number" || !Number.isFinite(nextTickAt))) {
|
|
9
|
+
return `Tick controller nextTickAt must be a finite timestamp in milliseconds; got ${describe(nextTickAt)}. See the tick controller guide.`;
|
|
10
|
+
}
|
|
11
|
+
const now = options?.now ?? Date.now();
|
|
12
|
+
const effectiveMs = nextTickAt !== void 0 ? nextTickAt - now : intervalMs ?? NaN;
|
|
13
|
+
if (nextTickAt !== void 0 && effectiveMs <= 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if ((nextTickAt === void 0 || intervalMs !== void 0) && (typeof intervalMs !== "number" || !Number.isFinite(intervalMs) || !Number.isInteger(intervalMs) || intervalMs < 1)) {
|
|
17
|
+
return `Tick intervalMs must be a finite, positive, whole number of milliseconds; got ${describe(intervalMs)}. Build interval-based results with intervalTick(intervalMs). See the tick controller guide.`;
|
|
18
|
+
}
|
|
19
|
+
if (effectiveMs < MIN_EFFECTIVE_TICK_INTERVAL_MS) {
|
|
20
|
+
return `Effective tick cadence of ${duration(effectiveMs)} is below the 30-second minimum (${MIN_EFFECTIVE_TICK_INTERVAL_MS} ms). Use intervalTick(intervalMs) with at least ${MIN_EFFECTIVE_TICK_INTERVAL_MS}, or schedule nextTickAt further out. See the tick controller guide.`;
|
|
21
|
+
}
|
|
22
|
+
if (effectiveMs > MAX_EFFECTIVE_TICK_INTERVAL_MS) {
|
|
23
|
+
return `Effective tick cadence of ${duration(effectiveMs)} exceeds the 7-day maximum (${MAX_EFFECTIVE_TICK_INTERVAL_MS} ms). For longer gaps, set enabled: false and drive ticks by another means. See the tick controller guide.`;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function describe(value) {
|
|
28
|
+
if (value === void 0) return "undefined";
|
|
29
|
+
if (typeof value === "number") {
|
|
30
|
+
if (Number.isNaN(value)) return "NaN";
|
|
31
|
+
if (!Number.isFinite(value)) return value > 0 ? "Infinity" : "-Infinity";
|
|
32
|
+
return String(value);
|
|
33
|
+
}
|
|
34
|
+
return typeof value;
|
|
35
|
+
}
|
|
36
|
+
function duration(ms) {
|
|
37
|
+
const rounded = Number.isInteger(ms) ? String(ms) : ms.toFixed(1);
|
|
38
|
+
const seconds = ms / 1e3;
|
|
39
|
+
const human = seconds >= 86400 ? `${round(seconds / 86400)} days` : seconds >= 3600 ? `${round(seconds / 3600)} hours` : seconds >= 1 ? `${round(seconds)} seconds` : "under a second";
|
|
40
|
+
return `${rounded} ms (${human})`;
|
|
41
|
+
}
|
|
42
|
+
function round(value) {
|
|
43
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
validateTickControllerResult
|
|
48
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
deleteEngineFiles,
|
|
4
|
+
findEngineReferences
|
|
5
|
+
} from "./cli-4SIWLHQO.js";
|
|
6
|
+
import "./cli-IUS2YCD3.js";
|
|
7
|
+
import "./cli-QUNIRH7A.js";
|
|
8
|
+
import "./cli-J4UBELKF.js";
|
|
9
|
+
import {
|
|
10
|
+
loadPackageContext
|
|
11
|
+
} from "./cli-XSVGKI3R.js";
|
|
12
|
+
import "./cli-TT36JCU5.js";
|
|
13
|
+
import "./cli-OXAUOWCN.js";
|
|
14
|
+
import {
|
|
15
|
+
operationError,
|
|
16
|
+
recordOperationResult,
|
|
17
|
+
regenerateTypes
|
|
18
|
+
} from "./cli-KSGB2ZLK.js";
|
|
19
|
+
import {
|
|
20
|
+
confirmAction
|
|
21
|
+
} from "./cli-ZTWOE3ZT.js";
|
|
22
|
+
import "./cli-LQOHATY2.js";
|
|
23
|
+
import "./cli-IEMKI7J7.js";
|
|
24
|
+
import "./cli-OMWC75CC.js";
|
|
25
|
+
import "./cli-BYCHKSSH.js";
|
|
26
|
+
import "./cli-25RWY5BQ.js";
|
|
27
|
+
import "./cli-QWQMPCL6.js";
|
|
28
|
+
import "./cli-VQ6HVQW4.js";
|
|
29
|
+
import "./cli-F2D4GGUA.js";
|
|
30
|
+
import {
|
|
31
|
+
logger
|
|
32
|
+
} from "./cli-4YB3ROVR.js";
|
|
33
|
+
import "./cli-N6H6T2E2.js";
|
|
34
|
+
|
|
35
|
+
// cli/commands/resources/engine/delete.ts
|
|
36
|
+
async function deleteEngine(options) {
|
|
37
|
+
logger.info("\nDeleting engine...\n");
|
|
38
|
+
const identifier = "engine";
|
|
39
|
+
loadPackageContext(options.workingDir);
|
|
40
|
+
const references = findEngineReferences({
|
|
41
|
+
packagePath: options.workingDir,
|
|
42
|
+
identifier
|
|
43
|
+
});
|
|
44
|
+
logger.info(`Engine: ${identifier}`);
|
|
45
|
+
if (references.length > 0) {
|
|
46
|
+
logger.info("\nThe engine is referenced by:");
|
|
47
|
+
for (const ref of references) {
|
|
48
|
+
logger.info(` - ${ref}`);
|
|
49
|
+
}
|
|
50
|
+
logger.info("\nThese references will be removed.");
|
|
51
|
+
}
|
|
52
|
+
const confirmed = await confirmAction(
|
|
53
|
+
{ message: "Are you sure you want to delete the engine?" },
|
|
54
|
+
options.yes
|
|
55
|
+
);
|
|
56
|
+
if (!confirmed) {
|
|
57
|
+
logger.info("\nDeletion cancelled.\n");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
logger.info("");
|
|
61
|
+
const result = deleteEngineFiles({
|
|
62
|
+
packagePath: options.workingDir,
|
|
63
|
+
identifier
|
|
64
|
+
});
|
|
65
|
+
if (!result.success) {
|
|
66
|
+
throw operationError(result, "Failed to delete engine files");
|
|
67
|
+
}
|
|
68
|
+
recordOperationResult(result);
|
|
69
|
+
for (const file of result.filesDeleted || []) {
|
|
70
|
+
logger.info(` \u2713 Deleted: ${file}`);
|
|
71
|
+
}
|
|
72
|
+
for (const ref of result.referencesRemoved || []) {
|
|
73
|
+
logger.info(` \u2713 Removed reference from: ${ref}`);
|
|
74
|
+
}
|
|
75
|
+
logger.info(" \u2713 Updated seriousgaming.sdk.json");
|
|
76
|
+
await regenerateTypes(options.workingDir);
|
|
77
|
+
logger.success("Engine deleted successfully!");
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
deleteEngine
|
|
81
|
+
};
|