@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.
Files changed (169) hide show
  1. package/dist/agent/guidance.md +350 -0
  2. package/dist/bundling/ui-bundler.d.ts +12 -0
  3. package/dist/cli-25RWY5BQ.js +41 -0
  4. package/dist/cli-2BH7FX27.js +52 -0
  5. package/dist/cli-2GZYGRVL.js +36 -0
  6. package/dist/cli-2NU2LPEE.js +97 -0
  7. package/dist/cli-3BRC32CP.js +132 -0
  8. package/dist/cli-3D3ZXWOV.js +111 -0
  9. package/dist/cli-3ZKWV3PN.js +96 -0
  10. package/dist/cli-45OCBG53.js +60 -0
  11. package/dist/cli-4LKXZQ2B.js +48 -0
  12. package/dist/cli-4PXNOJQX.js +81 -0
  13. package/dist/cli-4SIWLHQO.js +717 -0
  14. package/dist/cli-4UWFQNGF.js +54 -0
  15. package/dist/cli-4VFZHLDG.js +202 -0
  16. package/dist/cli-4YB3ROVR.js +78 -0
  17. package/dist/cli-5ACDPCXI.js +21 -0
  18. package/dist/cli-5IAW3LIF.js +38 -0
  19. package/dist/cli-5SM367K7.js +30 -0
  20. package/dist/cli-64AB62PM.js +25 -0
  21. package/dist/cli-6K3VQQUS.js +307 -0
  22. package/dist/cli-6QB2VFPY.js +80 -0
  23. package/dist/cli-6SGCYEEC.js +649 -0
  24. package/dist/cli-6UTPHWRQ.js +207 -0
  25. package/dist/cli-6VNKQ3OX.js +391 -0
  26. package/dist/cli-72XDEFU3.js +61 -0
  27. package/dist/cli-7A6MKCUJ.js +463 -0
  28. package/dist/cli-7XLHO2FE.js +226 -0
  29. package/dist/cli-AV2FYC5G.js +225 -0
  30. package/dist/cli-B6YHEKIJ.js +248 -0
  31. package/dist/cli-BJMS3VX3.js +1837 -0
  32. package/dist/cli-BUQI5UU4.js +43 -0
  33. package/dist/cli-BWX5E7TQ.js +23 -0
  34. package/dist/cli-BYCHKSSH.js +1331 -0
  35. package/dist/cli-C3CMJSNL.js +89 -0
  36. package/dist/cli-C47GJATR.js +42 -0
  37. package/dist/cli-C5QOJJWX.js +46 -0
  38. package/dist/cli-C6ZLPK2U.js +124 -0
  39. package/dist/cli-CD5CIJZI.js +72 -0
  40. package/dist/cli-DDJYUKQG.js +36 -0
  41. package/dist/cli-DFBTZEBX.js +167 -0
  42. package/dist/cli-DOXRQ3S5.js +60 -0
  43. package/dist/cli-EVI36HEM.js +79 -0
  44. package/dist/cli-F2D4GGUA.js +549 -0
  45. package/dist/cli-FQRVFGN6.js +0 -0
  46. package/dist/cli-FWFRKQNE.js +11 -0
  47. package/dist/cli-G6CANSPL.js +88 -0
  48. package/dist/cli-GFNDW2DL.js +124 -0
  49. package/dist/cli-HCRTYQQS.js +16 -0
  50. package/dist/cli-HFX3YPUL.js +76 -0
  51. package/dist/cli-HKORECAG.js +53 -0
  52. package/dist/cli-HOE3WLFH.js +73 -0
  53. package/dist/cli-HSIHDN6K.js +187 -0
  54. package/dist/cli-HW53ICZC.js +89 -0
  55. package/dist/cli-IDVUHGKG.js +218 -0
  56. package/dist/cli-IEMKI7J7.js +1387 -0
  57. package/dist/cli-ILFDANBR.js +101 -0
  58. package/dist/cli-ILKCQNM6.js +8 -0
  59. package/dist/cli-IP4RXGHM.js +2847 -0
  60. package/dist/cli-IUS2YCD3.js +31 -0
  61. package/dist/cli-J4DKUUTK.js +138 -0
  62. package/dist/cli-J4UBELKF.js +37 -0
  63. package/dist/cli-JJSWBW4H.js +89 -0
  64. package/dist/cli-JVI24FI6.js +68 -0
  65. package/dist/cli-JZCLIT3O.js +135 -0
  66. package/dist/cli-JZOZOEZM.js +131 -0
  67. package/dist/cli-KGM6RRQW.js +185 -0
  68. package/dist/cli-KGT5L7VZ.js +13641 -0
  69. package/dist/cli-KOGRWFN7.js +89 -0
  70. package/dist/cli-KSGB2ZLK.js +101 -0
  71. package/dist/cli-L7VYSXQK.js +243 -0
  72. package/dist/cli-LK3V4RI5.js +36 -0
  73. package/dist/cli-LQOHATY2.js +126 -0
  74. package/dist/cli-MJUYJIEP.js +13 -0
  75. package/dist/cli-MJV47HKI.js +143 -0
  76. package/dist/cli-MMN4BPO4.js +145 -0
  77. package/dist/cli-MOPSZ3CS.js +88 -0
  78. package/dist/cli-MU5LB43S.js +136 -0
  79. package/dist/cli-MYJGMA6U.js +40 -0
  80. package/dist/cli-N24OHSAN.js +36 -0
  81. package/dist/cli-N45DREM4.js +99 -0
  82. package/dist/cli-N6H6T2E2.js +616 -0
  83. package/dist/cli-NROTDF5Y.js +182 -0
  84. package/dist/cli-O5ABH2WK.js +226 -0
  85. package/dist/cli-OMWC75CC.js +256 -0
  86. package/dist/cli-OXAUOWCN.js +50 -0
  87. package/dist/cli-PGCIHPU7.js +143 -0
  88. package/dist/cli-Q6ZBZYK2.js +35 -0
  89. package/dist/cli-QUNIRH7A.js +57 -0
  90. package/dist/cli-QUSCIUOM.js +142 -0
  91. package/dist/cli-QVASWX2A.js +187 -0
  92. package/dist/cli-QWQMPCL6.js +253 -0
  93. package/dist/cli-QY5NZAR7.js +97 -0
  94. package/dist/cli-R2MUZQE2.js +62 -0
  95. package/dist/cli-RCIWBCXD.js +36 -0
  96. package/dist/cli-RLEGRWFM.js +81 -0
  97. package/dist/cli-RSW6EBBD.js +89 -0
  98. package/dist/cli-RZITKPJX.js +367 -0
  99. package/dist/cli-S5IVGDDD.js +32 -0
  100. package/dist/cli-SRHBXZCN.js +159 -0
  101. package/dist/cli-TDSQSCX4.js +131 -0
  102. package/dist/cli-TIDQ4WUE.js +257 -0
  103. package/dist/cli-TT36JCU5.js +370 -0
  104. package/dist/cli-TTKICM5P.js +100 -0
  105. package/dist/cli-TTMBBEJC.js +131 -0
  106. package/dist/cli-UMEBPAZQ.js +16 -0
  107. package/dist/cli-UNAJ2OTE.js +15 -0
  108. package/dist/cli-UZZFNXRX.js +226 -0
  109. package/dist/cli-VDBW23SS.js +81 -0
  110. package/dist/cli-VL2P354N.js +46 -0
  111. package/dist/cli-VPRRICZA.js +304 -0
  112. package/dist/cli-VQ6HVQW4.js +4010 -0
  113. package/dist/cli-WR3NOY74.js +36 -0
  114. package/dist/cli-WU43JT4T.js +52 -0
  115. package/dist/cli-XAT25PRU.js +117 -0
  116. package/dist/cli-XOTNXEJA.js +124 -0
  117. package/dist/cli-XSLNH5PR.js +6417 -0
  118. package/dist/cli-XSVGKI3R.js +39 -0
  119. package/dist/cli-XZCJIKIV.js +124 -0
  120. package/dist/cli-Y3DDNMPX.js +97 -0
  121. package/dist/cli-Y3O5F4JN.js +90 -0
  122. package/dist/cli-YOTGR3NB.js +82 -0
  123. package/dist/cli-Z56ZIVA6.js +97 -0
  124. package/dist/cli-ZBN5KAIB.js +59 -0
  125. package/dist/cli-ZDOTXEKL.js +31 -0
  126. package/dist/cli-ZDUADFBY.js +88 -0
  127. package/dist/cli-ZJFQ7EEA.js +131 -0
  128. package/dist/cli-ZTWOE3ZT.js +65 -0
  129. package/dist/cli.js +148 -43093
  130. package/dist/client/build-surfaces.d.ts +33 -0
  131. package/dist/client/dev-server.d.ts +6 -0
  132. package/dist/client/index.d.ts +1 -0
  133. package/dist/client/playwright.d.ts +62 -0
  134. package/dist/client.js +228 -48
  135. package/dist/core/session.d.ts +15 -1
  136. package/dist/dev/console/assets/{index-BVF8exas.js → index-CuMOOH9m.js} +1 -1
  137. package/dist/dev/console/index.html +1 -1
  138. package/dist/dev/shell.d.ts +19 -0
  139. package/dist/dev/surfaces.d.ts +7 -0
  140. package/dist/docs/ai-agents.md +1 -1
  141. package/dist/docs/api/index.md +14 -12
  142. package/dist/docs/api/sdk-tools-client.md +29 -0
  143. package/dist/docs/api/sdk-tools-playwright.md +104 -0
  144. package/dist/docs/changelog.md +34 -0
  145. package/dist/docs/cli-and-dev-server.md +21 -0
  146. package/dist/docs/cli-reference.md +45 -31
  147. package/dist/docs/environment-variables.md +6 -0
  148. package/dist/docs/getting-started.md +1 -1
  149. package/dist/docs/guides/designing-a-game.md +29 -4
  150. package/dist/docs/guides/starter-game.md +3 -3
  151. package/dist/docs/guides/testing.md +33 -18
  152. package/dist/docs/guides/upgrading.md +19 -2
  153. package/dist/docs/page-index.md +10 -9
  154. package/dist/docs/recipes/e2e-testing.md +19 -20
  155. package/dist/playwright.js +32232 -0
  156. package/dist/templates/package/CLAUDE.md.template +7 -346
  157. package/dist/templates/package/claude/rules/workflow-create-engine.md +2 -2
  158. package/dist/templates/package/claude/rules/workflow-create-guide.md +2 -2
  159. package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
  160. package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
  161. package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +3 -3
  162. package/dist/templates/package/global-setup.ts.template +7 -18
  163. package/dist/templates/package/playwright.config.ts.liquid +8 -11
  164. package/dist/templates/starter-game/playwright.config.ts +8 -11
  165. package/dist/templates/starter-game/testing/e2e/game.spec.ts +1 -1
  166. package/dist/templates/starter-game/testing/e2e/global-setup.ts +7 -18
  167. package/dist/utils/prompt.d.ts +5 -5
  168. package/dist/utils/resource-scan.d.ts +39 -0
  169. package/package.json +7 -3
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CliError
4
+ } from "./cli-N6H6T2E2.js";
5
+
6
+ // cli/utils/package-context.ts
7
+ import { existsSync, readFileSync } from "fs";
8
+ import { join } from "path";
9
+ function loadPackageContext(workingDir, options = {}) {
10
+ const configPath = join(workingDir, "seriousgaming.sdk.json");
11
+ if (!existsSync(configPath)) {
12
+ let message = "seriousgaming.sdk.json not found.\nThis command must be run in a Serious Gaming package directory.";
13
+ if (options.suggestNewPackage) {
14
+ message += '\nUse "new package" to create a new package first.';
15
+ }
16
+ throw new CliError("MANIFEST_NOT_FOUND", message);
17
+ }
18
+ let config;
19
+ try {
20
+ config = JSON.parse(readFileSync(configPath, "utf-8"));
21
+ } catch (error) {
22
+ throw new CliError(
23
+ "MANIFEST_INVALID",
24
+ "Could not read seriousgaming.sdk.json\n" + (error instanceof Error ? error.message : "Unknown error")
25
+ );
26
+ }
27
+ const packageIdentifier = config?.identifier;
28
+ if (typeof packageIdentifier !== "string" || !packageIdentifier) {
29
+ throw new CliError(
30
+ "MANIFEST_INVALID",
31
+ "Could not read package identifier from seriousgaming.sdk.json"
32
+ );
33
+ }
34
+ return { configPath, packageIdentifier };
35
+ }
36
+
37
+ export {
38
+ loadPackageContext
39
+ };
@@ -0,0 +1,124 @@
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
+ createValidatorFiles
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
+ input
36
+ } from "./cli-ZTWOE3ZT.js";
37
+ import "./cli-LQOHATY2.js";
38
+ import "./cli-IEMKI7J7.js";
39
+ import "./cli-OMWC75CC.js";
40
+ import "./cli-BYCHKSSH.js";
41
+ import "./cli-25RWY5BQ.js";
42
+ import "./cli-QWQMPCL6.js";
43
+ import {
44
+ validateSDKValidator
45
+ } from "./cli-VQ6HVQW4.js";
46
+ import "./cli-F2D4GGUA.js";
47
+ import {
48
+ logger
49
+ } from "./cli-4YB3ROVR.js";
50
+ import "./cli-N6H6T2E2.js";
51
+
52
+ // cli/commands/resources/validator/new.ts
53
+ async function createValidator(definitionInput, options) {
54
+ logger.info("\nCreating new validator...\n");
55
+ loadPackageContext(options.workingDir);
56
+ const inputSource = await resolveInputSource(definitionInput, options.file);
57
+ const jsonDefinition = inputSource.kind === "json" ? inputSource.json : null;
58
+ if (jsonDefinition) {
59
+ const validatorInput = readAuthoredBundle({
60
+ json: jsonDefinition,
61
+ type: "validator",
62
+ command: "new",
63
+ validate: validateSDKValidator
64
+ });
65
+ logger.info("Creating validator files...\n");
66
+ const result2 = await createValidatorFiles({
67
+ packagePath: options.workingDir,
68
+ identifier: validatorInput.definition.identifier,
69
+ definition: validatorInput.definition
70
+ });
71
+ if (!result2.success) {
72
+ throw operationError(result2, "Failed to create validator files");
73
+ }
74
+ logger.success("Validator created successfully!");
75
+ printOperationResult(result2);
76
+ await generateTypes(options.workingDir);
77
+ return;
78
+ }
79
+ logger.info("No JSON definition provided. Starting interactive mode...\n");
80
+ const shortIdentifier = await input({
81
+ message: 'Validator identifier (short name, e.g., "decisionlimit"):',
82
+ validate: (value) => {
83
+ if (!value.trim()) return "Identifier is required";
84
+ if (value.includes(".")) {
85
+ return 'In interactive mode, use short identifier (e.g., "decisionlimit" instead of "com.example.decisionlimit")';
86
+ }
87
+ if (!/^[a-z][a-z0-9_]*$/.test(value)) {
88
+ return "Identifier must start with lowercase letter and contain only lowercase letters, numbers, and underscores";
89
+ }
90
+ return true;
91
+ }
92
+ });
93
+ const identifier = shortIdentifier.trim();
94
+ const availableCapabilities = loadResourceIdentifiers(options.workingDir, "capability");
95
+ const reads = [];
96
+ if (availableCapabilities.length > 0) {
97
+ const readCapabilities = await checkbox({
98
+ message: "Capabilities this validator reads from:",
99
+ choices: availableCapabilities.map((id) => ({ name: id, value: id })),
100
+ pageSize: 10
101
+ });
102
+ reads.push(...readCapabilities);
103
+ logger.info("");
104
+ }
105
+ const settings = await promptForSettings(options.workingDir, "validator");
106
+ logger.info("Creating validator files...\n");
107
+ const result = await createValidatorFiles({
108
+ packagePath: options.workingDir,
109
+ identifier,
110
+ definition: presentFields({ reads, settings })
111
+ });
112
+ if (!result.success) {
113
+ throw operationError(result, "Failed to create validator files");
114
+ }
115
+ logger.success("Validator created successfully!");
116
+ printOperationResult(result);
117
+ await generateTypes(options.workingDir);
118
+ logger.info("Next steps:");
119
+ logger.info(` 1. Edit the validator logic: validators/${identifier}/logic/logic.ts`);
120
+ logger.info(` 2. Run "${BUILD_COMMAND}" to build your package`);
121
+ }
122
+ export {
123
+ createValidator
124
+ };
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolvePatchedDefinition
4
+ } from "./cli-5IAW3LIF.js";
5
+ import "./cli-S5IVGDDD.js";
6
+ import {
7
+ readAuthoredBundle
8
+ } from "./cli-4VFZHLDG.js";
9
+ import {
10
+ resolveInputSource
11
+ } from "./cli-4UWFQNGF.js";
12
+ import {
13
+ updatePresentationFiles
14
+ } from "./cli-4SIWLHQO.js";
15
+ import "./cli-IUS2YCD3.js";
16
+ import "./cli-QUNIRH7A.js";
17
+ import "./cli-J4UBELKF.js";
18
+ import {
19
+ loadPackageContext
20
+ } from "./cli-XSVGKI3R.js";
21
+ import "./cli-TT36JCU5.js";
22
+ import "./cli-OXAUOWCN.js";
23
+ import {
24
+ operationError,
25
+ printOperationResult,
26
+ regenerateTypes
27
+ } from "./cli-KSGB2ZLK.js";
28
+ import "./cli-LQOHATY2.js";
29
+ import "./cli-IEMKI7J7.js";
30
+ import "./cli-OMWC75CC.js";
31
+ import "./cli-BYCHKSSH.js";
32
+ import "./cli-25RWY5BQ.js";
33
+ import "./cli-QWQMPCL6.js";
34
+ import {
35
+ validateSDKPresentation
36
+ } from "./cli-VQ6HVQW4.js";
37
+ import "./cli-F2D4GGUA.js";
38
+ import {
39
+ logger
40
+ } from "./cli-4YB3ROVR.js";
41
+ import {
42
+ CliError
43
+ } from "./cli-N6H6T2E2.js";
44
+
45
+ // cli/commands/resources/presentation/update.ts
46
+ async function updatePresentation(definitionInput, options) {
47
+ logger.info("\nUpdating presentation...\n");
48
+ const identifier = "presentation";
49
+ loadPackageContext(options.workingDir);
50
+ let jsonDefinition = null;
51
+ if (options.patch) {
52
+ jsonDefinition = resolvePatchedDefinition({
53
+ patch: options.patch,
54
+ workingDir: options.workingDir,
55
+ type: "presentation",
56
+ identifier,
57
+ resourceLabel: "Presentation"
58
+ });
59
+ } else {
60
+ const inputSource = await resolveInputSource(definitionInput, options.file);
61
+ if (inputSource.kind === "json") jsonDefinition = inputSource.json;
62
+ }
63
+ if (jsonDefinition) {
64
+ const presentationInput = readAuthoredBundle({
65
+ json: jsonDefinition,
66
+ type: "presentation",
67
+ command: "update",
68
+ validate: validateSDKPresentation,
69
+ identifier
70
+ });
71
+ logger.info("Updating presentation files...\n");
72
+ const result = updatePresentationFiles({
73
+ packagePath: options.workingDir,
74
+ oldIdentifier: identifier,
75
+ newDefinition: presentationInput.definition
76
+ });
77
+ if (!result.success) {
78
+ throw operationError(result, "Failed to update presentation files");
79
+ }
80
+ logger.success("Presentation updated successfully!");
81
+ printOperationResult(result);
82
+ await regenerateTypes(options.workingDir);
83
+ return;
84
+ }
85
+ throw new CliError(
86
+ "USAGE_MISSING_INPUT",
87
+ `A presentation takes no interactive input: a game holds one, so there is
88
+ nothing to name and nothing to pick.
89
+
90
+ Edit it with a definition or a patch:
91
+ $ seriousgaming-sdk update presentation '{"definition":{...}}'
92
+ $ seriousgaming-sdk update presentation --patch '[...]'`
93
+ );
94
+ }
95
+ export {
96
+ updatePresentation
97
+ };
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ updateFacilitatorGuideFiles
4
+ } from "./cli-HKORECAG.js";
5
+ import {
6
+ resolvePatchedDefinition
7
+ } from "./cli-5IAW3LIF.js";
8
+ import "./cli-S5IVGDDD.js";
9
+ import {
10
+ readAuthoredBundle
11
+ } from "./cli-4VFZHLDG.js";
12
+ import {
13
+ resolveInputSource
14
+ } from "./cli-4UWFQNGF.js";
15
+ import {
16
+ loadPackageContext
17
+ } from "./cli-XSVGKI3R.js";
18
+ import "./cli-TT36JCU5.js";
19
+ import "./cli-OXAUOWCN.js";
20
+ import {
21
+ operationError,
22
+ printOperationResult
23
+ } from "./cli-KSGB2ZLK.js";
24
+ import "./cli-LQOHATY2.js";
25
+ import "./cli-IEMKI7J7.js";
26
+ import "./cli-OMWC75CC.js";
27
+ import "./cli-BYCHKSSH.js";
28
+ import "./cli-25RWY5BQ.js";
29
+ import "./cli-QWQMPCL6.js";
30
+ import {
31
+ validateSDKFacilitatorGuide
32
+ } from "./cli-VQ6HVQW4.js";
33
+ import "./cli-F2D4GGUA.js";
34
+ import {
35
+ logger
36
+ } from "./cli-4YB3ROVR.js";
37
+ import {
38
+ CliError
39
+ } from "./cli-N6H6T2E2.js";
40
+
41
+ // cli/commands/resources/guide/update.ts
42
+ async function updateFacilitatorGuide(definitionInput, options) {
43
+ logger.info("\nUpdating facilitator guide...\n");
44
+ const identifier = "guide";
45
+ loadPackageContext(options.workingDir);
46
+ let jsonDefinition = null;
47
+ if (options.patch) {
48
+ jsonDefinition = resolvePatchedDefinition({
49
+ patch: options.patch,
50
+ workingDir: options.workingDir,
51
+ type: "guide",
52
+ identifier,
53
+ resourceLabel: "Facilitator guide"
54
+ });
55
+ } else {
56
+ const inputSource = await resolveInputSource(definitionInput, options.file);
57
+ if (inputSource.kind === "json") jsonDefinition = inputSource.json;
58
+ }
59
+ if (jsonDefinition) {
60
+ const guideInput = readAuthoredBundle({
61
+ json: jsonDefinition,
62
+ type: "guide",
63
+ command: "update",
64
+ validate: validateSDKFacilitatorGuide,
65
+ identifier
66
+ });
67
+ logger.info("Updating facilitator guide files...\n");
68
+ const result = updateFacilitatorGuideFiles({
69
+ packagePath: options.workingDir,
70
+ oldIdentifier: identifier,
71
+ newDefinition: guideInput.definition,
72
+ newIdentifier: guideInput.definition?.identifier
73
+ });
74
+ if (!result.success) {
75
+ throw operationError(result, "Failed to update facilitator guide files");
76
+ }
77
+ logger.success("Facilitator guide updated successfully!");
78
+ printOperationResult(result);
79
+ return;
80
+ }
81
+ throw new CliError(
82
+ "USAGE_MISSING_INPUT",
83
+ `JSON definition or --patch is required for facilitator guide updates.
84
+ Usage: sdk update facilitator-guide <id> '{"definition": {...}}'
85
+ or: sdk update facilitator-guide <id> --patch '[{"op":"replace","path":"/definition/locales/en/name","value":"New Name"}]'`
86
+ );
87
+ }
88
+ export {
89
+ updateFacilitatorGuide
90
+ };
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CliError
4
+ } from "./cli-N6H6T2E2.js";
5
+
6
+ // cli/dev/public-origins.ts
7
+ var PUBLIC_URL_ENV_VAR = "SERIOUSGAMING_DEV_PUBLIC_URL";
8
+ var PUBLIC_ASSET_URL_ENV_VAR = "SERIOUSGAMING_DEV_PUBLIC_ASSET_URL";
9
+ var PUBLIC_HMR_URL_ENV_VAR = "SERIOUSGAMING_DEV_PUBLIC_HMR_URL";
10
+ function parsePublicOrigin(value, flag, kind) {
11
+ const allowed = kind === "http" ? ["http:", "https:"] : ["http:", "https:", "ws:", "wss:"];
12
+ let url;
13
+ try {
14
+ url = new URL(value.trim());
15
+ } catch {
16
+ throw badOrigin(value, flag, kind);
17
+ }
18
+ if (!allowed.includes(url.protocol) || url.pathname !== "/" && url.pathname !== "") {
19
+ throw badOrigin(value, flag, kind);
20
+ }
21
+ if (url.search || url.hash || url.username || url.password) throw badOrigin(value, flag, kind);
22
+ if (kind === "ws") {
23
+ const secure = url.protocol === "https:" || url.protocol === "wss:";
24
+ return `${secure ? "wss" : "ws"}://${url.host}`;
25
+ }
26
+ return url.origin;
27
+ }
28
+ function badOrigin(value, flag, kind) {
29
+ const example = kind === "http" ? "https://game.example.com" : "wss://hmr.example.com";
30
+ return new CliError(
31
+ "USAGE_BAD_FLAG",
32
+ `"${value}" is not an origin ${flag} can take. Pass a scheme, a host and, where it is not the default, a port, with no path: ${example}.`
33
+ );
34
+ }
35
+ function resolvePublicOrigins(flags, env = process.env) {
36
+ const pick = (flag, name) => flag || env[name] || void 0;
37
+ const publicUrl = pick(flags.publicUrl, PUBLIC_URL_ENV_VAR);
38
+ const publicAssetUrl = pick(flags.publicAssetUrl, PUBLIC_ASSET_URL_ENV_VAR);
39
+ const publicHmrUrl = pick(flags.publicHmrUrl, PUBLIC_HMR_URL_ENV_VAR);
40
+ return {
41
+ ...publicUrl ? { publicUrl: parsePublicOrigin(publicUrl, "--public-url", "http") } : {},
42
+ ...publicAssetUrl ? {
43
+ publicAssetUrl: parsePublicOrigin(publicAssetUrl, "--public-asset-url", "http")
44
+ } : {},
45
+ ...publicHmrUrl ? { publicHmrUrl: parsePublicOrigin(publicHmrUrl, "--public-hmr-url", "ws") } : {}
46
+ };
47
+ }
48
+ function publicAssetOrigin(origins, assetPort) {
49
+ if (origins.publicAssetUrl) return origins.publicAssetUrl;
50
+ if (!origins.publicUrl) return null;
51
+ const url = new URL(origins.publicUrl);
52
+ return `${url.protocol}//${url.hostname}:${assetPort}`;
53
+ }
54
+ function publicHmrOrigin(origins, assetPort, vitePort) {
55
+ if (origins.publicHmrUrl) return origins.publicHmrUrl;
56
+ const asset = publicAssetOrigin(origins, assetPort);
57
+ if (!asset) return null;
58
+ const url = new URL(asset);
59
+ return `${url.protocol === "https:" ? "wss" : "ws"}://${url.hostname}:${vitePort}`;
60
+ }
61
+ function hmrClientTarget(origin) {
62
+ const url = new URL(origin);
63
+ const protocol = url.protocol === "wss:" ? "wss" : "ws";
64
+ const clientPort = url.port ? Number(url.port) : protocol === "wss" ? 443 : 80;
65
+ return { protocol, host: url.hostname, clientPort };
66
+ }
67
+ function publicHostnames(origins) {
68
+ return [
69
+ ...new Set(origins.filter((o) => Boolean(o)).map((o) => new URL(o).hostname))
70
+ ];
71
+ }
72
+
73
+ export {
74
+ PUBLIC_URL_ENV_VAR,
75
+ PUBLIC_ASSET_URL_ENV_VAR,
76
+ PUBLIC_HMR_URL_ENV_VAR,
77
+ resolvePublicOrigins,
78
+ publicAssetOrigin,
79
+ publicHmrOrigin,
80
+ hmrClientTarget,
81
+ publicHostnames
82
+ };
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolvePatchedDefinition
4
+ } from "./cli-5IAW3LIF.js";
5
+ import "./cli-S5IVGDDD.js";
6
+ import {
7
+ readAuthoredBundle
8
+ } from "./cli-4VFZHLDG.js";
9
+ import {
10
+ resolveInputSource
11
+ } from "./cli-4UWFQNGF.js";
12
+ import {
13
+ updateTickControllerFiles
14
+ } from "./cli-4SIWLHQO.js";
15
+ import "./cli-IUS2YCD3.js";
16
+ import "./cli-QUNIRH7A.js";
17
+ import "./cli-J4UBELKF.js";
18
+ import {
19
+ loadPackageContext
20
+ } from "./cli-XSVGKI3R.js";
21
+ import "./cli-TT36JCU5.js";
22
+ import "./cli-OXAUOWCN.js";
23
+ import {
24
+ operationError,
25
+ printOperationResult,
26
+ regenerateTypes
27
+ } from "./cli-KSGB2ZLK.js";
28
+ import "./cli-LQOHATY2.js";
29
+ import "./cli-IEMKI7J7.js";
30
+ import "./cli-OMWC75CC.js";
31
+ import "./cli-BYCHKSSH.js";
32
+ import "./cli-25RWY5BQ.js";
33
+ import "./cli-QWQMPCL6.js";
34
+ import {
35
+ validateSDKTickController
36
+ } from "./cli-VQ6HVQW4.js";
37
+ import "./cli-F2D4GGUA.js";
38
+ import {
39
+ logger
40
+ } from "./cli-4YB3ROVR.js";
41
+ import {
42
+ CliError
43
+ } from "./cli-N6H6T2E2.js";
44
+
45
+ // cli/commands/resources/tick-controller/update.ts
46
+ async function updateTickController(definitionInput, options) {
47
+ logger.info("\nUpdating tick controller...\n");
48
+ const identifier = "tick_controller";
49
+ loadPackageContext(options.workingDir);
50
+ let jsonDefinition = null;
51
+ if (options.patch) {
52
+ jsonDefinition = resolvePatchedDefinition({
53
+ patch: options.patch,
54
+ workingDir: options.workingDir,
55
+ type: "tick_controller",
56
+ identifier,
57
+ resourceLabel: "Tick controller"
58
+ });
59
+ } else {
60
+ const inputSource = await resolveInputSource(definitionInput, options.file);
61
+ if (inputSource.kind === "json") jsonDefinition = inputSource.json;
62
+ }
63
+ if (jsonDefinition) {
64
+ const tcInput = readAuthoredBundle({
65
+ json: jsonDefinition,
66
+ type: "tick_controller",
67
+ command: "update",
68
+ validate: validateSDKTickController,
69
+ identifier
70
+ });
71
+ logger.info("Updating tick controller files...\n");
72
+ const result = updateTickControllerFiles({
73
+ packagePath: options.workingDir,
74
+ oldIdentifier: identifier,
75
+ newDefinition: tcInput.definition
76
+ });
77
+ if (!result.success) {
78
+ throw operationError(result, "Failed to update tick controller files");
79
+ }
80
+ logger.success("Tick controller updated successfully!");
81
+ printOperationResult(result);
82
+ await regenerateTypes(options.workingDir);
83
+ return;
84
+ }
85
+ throw new CliError(
86
+ "USAGE_MISSING_INPUT",
87
+ `A tick controller takes no interactive input: a game holds one, so there is
88
+ nothing to name and nothing to pick.
89
+
90
+ Edit it with a definition or a patch:
91
+ $ seriousgaming-sdk update tick-controller '{"definition":{...}}'
92
+ $ seriousgaming-sdk update tick-controller --patch '[...]'`
93
+ );
94
+ }
95
+ export {
96
+ updateTickController
97
+ };
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ loadConfig
4
+ } from "./cli-VQ6HVQW4.js";
5
+ import "./cli-F2D4GGUA.js";
6
+ import "./cli-4YB3ROVR.js";
7
+ import {
8
+ reportResult
9
+ } from "./cli-N6H6T2E2.js";
10
+
11
+ // cli/commands/endpoint-list.ts
12
+ import { resolve } from "path";
13
+ async function endpointListCommand(options) {
14
+ const config = await loadConfig(resolve(options.workingDir, "seriousgaming.sdk.json"));
15
+ const endpoints = (config.endpoints ?? []).map((endpoint) => endpoint.definition).filter((definition) => !options.external || definition.visibility === "external").map((definition) => ({
16
+ identifier: definition.identifier,
17
+ displayName: definition.displayName ?? null,
18
+ description: definition.description ?? null,
19
+ scope: definition.scope ?? "team",
20
+ visibility: definition.visibility ?? "internal",
21
+ reads: definition.reads ?? [],
22
+ writes: definition.writes ?? [],
23
+ actions: definition.actions ?? [],
24
+ responds: definition.responds === true,
25
+ uses: definition.uses ?? [],
26
+ requestSchema: definition.requestSchema,
27
+ responseSchema: definition.responseSchema
28
+ })).sort((a, b) => a.identifier.localeCompare(b.identifier));
29
+ reportResult(endpoints, () => {
30
+ if (endpoints.length === 0) {
31
+ console.log(
32
+ options.external ? "This package declares no external endpoints." : "This package declares no endpoints."
33
+ );
34
+ return;
35
+ }
36
+ for (const endpoint of endpoints) {
37
+ const marks = [
38
+ endpoint.scope,
39
+ endpoint.writes.length > 0 ? "writes" : "read-only",
40
+ ...endpoint.actions.length > 0 ? ["acts"] : [],
41
+ ...endpoint.responds ? ["responds after"] : [],
42
+ ...endpoint.visibility === "external" ? ["external"] : []
43
+ ];
44
+ console.log(`${endpoint.identifier} (${marks.join(", ")})`);
45
+ if (endpoint.displayName) console.log(` ${endpoint.displayName}`);
46
+ if (endpoint.description) console.log(` ${endpoint.description}`);
47
+ if (endpoint.reads.length > 0) console.log(` reads: ${endpoint.reads.join(", ")}`);
48
+ if (endpoint.writes.length > 0) console.log(` writes: ${endpoint.writes.join(", ")}`);
49
+ if (endpoint.actions.length > 0) {
50
+ console.log(` actions: ${endpoint.actions.join(", ")}`);
51
+ }
52
+ if (endpoint.uses.length > 0) console.log(` uses: ${endpoint.uses.join(", ")}`);
53
+ console.log("");
54
+ }
55
+ });
56
+ }
57
+ export {
58
+ endpointListCommand
59
+ };
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ loadResourceIdentifiers
4
+ } from "./cli-Q6ZBZYK2.js";
5
+ import {
6
+ checkbox
7
+ } from "./cli-ZTWOE3ZT.js";
8
+ import {
9
+ logger
10
+ } from "./cli-4YB3ROVR.js";
11
+
12
+ // cli/commands/resources/shared/settings-prompt.ts
13
+ async function promptForSettings(workingDir, resourceLabel, current = []) {
14
+ const available = loadResourceIdentifiers(workingDir, "settings");
15
+ if (available.length === 0) {
16
+ logger.info("No settings resources found in this package.");
17
+ logger.info('You can add one using "seriousgaming-sdk new settings".\n');
18
+ return [];
19
+ }
20
+ const selected = await checkbox({
21
+ message: `Settings this ${resourceLabel} reads:`,
22
+ choices: available.map((id) => ({ name: id, value: id, checked: current.includes(id) })),
23
+ pageSize: 10
24
+ });
25
+ logger.info("");
26
+ return selected;
27
+ }
28
+
29
+ export {
30
+ promptForSettings
31
+ };