@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,89 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ deleteWaitingRoomUserInterfaceFiles,
4
+ findWaitingRoomUserInterfaceReferences
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
+ } from "./cli-KSGB2ZLK.js";
18
+ import {
19
+ confirmAction
20
+ } from "./cli-ZTWOE3ZT.js";
21
+ import {
22
+ generateCommand
23
+ } from "./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 "./cli-VQ6HVQW4.js";
30
+ import "./cli-F2D4GGUA.js";
31
+ import {
32
+ logger
33
+ } from "./cli-4YB3ROVR.js";
34
+ import "./cli-N6H6T2E2.js";
35
+
36
+ // cli/commands/resources/waiting-room/delete.ts
37
+ async function deleteWaitingRoomUserInterface(options) {
38
+ logger.info("\nDeleting waiting room user interface...\n");
39
+ const identifier = "waiting_room";
40
+ loadPackageContext(options.workingDir);
41
+ const references = findWaitingRoomUserInterfaceReferences({
42
+ packagePath: options.workingDir,
43
+ identifier
44
+ });
45
+ logger.info(`Waiting Room User Interface: ${identifier}`);
46
+ if (references.length > 0) {
47
+ logger.info("\nThis waiting room user interface is used in games:");
48
+ for (const ref of references) {
49
+ logger.info(` - ${ref}`);
50
+ }
51
+ logger.info("\nThese references will be removed.");
52
+ }
53
+ const confirmed = await confirmAction(
54
+ { message: "Are you sure you want to delete this waiting room user interface?" },
55
+ options.yes
56
+ );
57
+ if (!confirmed) {
58
+ logger.info("\nDeletion cancelled.\n");
59
+ return;
60
+ }
61
+ logger.info("");
62
+ const result = deleteWaitingRoomUserInterfaceFiles({
63
+ packagePath: options.workingDir,
64
+ identifier
65
+ });
66
+ if (!result.success) {
67
+ throw operationError(result, "Failed to delete waiting room user interface files");
68
+ }
69
+ recordOperationResult(result);
70
+ for (const file of result.filesDeleted || []) {
71
+ logger.info(` \u2713 Deleted: ${file}`);
72
+ }
73
+ for (const ref of result.referencesRemoved || []) {
74
+ logger.info(` \u2713 Removed reference from: ${ref}`);
75
+ }
76
+ logger.info(" \u2713 Updated seriousgaming.sdk.json");
77
+ logger.info("\nRegenerating TypeScript types...\n");
78
+ try {
79
+ await generateCommand({ workingDir: options.workingDir });
80
+ logger.success("TypeScript types regenerated successfully!");
81
+ } catch (error) {
82
+ logger.warn("\nWarning: Failed to regenerate TypeScript types:");
83
+ logger.warn(error instanceof Error ? error.message : "Unknown error");
84
+ }
85
+ logger.success("Waiting room user interface deleted successfully!");
86
+ }
87
+ export {
88
+ deleteWaitingRoomUserInterface
89
+ };
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ generateCommand
4
+ } from "./cli-LQOHATY2.js";
5
+ import {
6
+ logger
7
+ } from "./cli-4YB3ROVR.js";
8
+ import {
9
+ CliError
10
+ } from "./cli-N6H6T2E2.js";
11
+
12
+ // cli/commands/resources/shared/operation-output.ts
13
+ var captured = null;
14
+ function beginOperationCapture() {
15
+ captured = [];
16
+ }
17
+ function endOperationCapture() {
18
+ const results = captured ?? [];
19
+ captured = null;
20
+ return results;
21
+ }
22
+ function recordOperationResult(result) {
23
+ captured?.push(result);
24
+ }
25
+ function operationError(result, fallback) {
26
+ const message = result.error ?? fallback;
27
+ return new CliError(operationErrorCode(message), message);
28
+ }
29
+ function operationErrorCode(message) {
30
+ if (/seriousgaming\.sdk\.json not found/.test(message)) return "MANIFEST_NOT_FOUND";
31
+ if (/already (exists|has)/.test(message)) return "RESOURCE_EXISTS";
32
+ if (/not found|has no name to change/.test(message)) return "RESOURCE_NOT_FOUND";
33
+ if (message.startsWith("Could not read")) return "BUNDLE_INVALID";
34
+ if (message.startsWith("Validation failed")) return "INPUT_INVALID";
35
+ return "WRITE_FAILED";
36
+ }
37
+ function printOperationResult(result) {
38
+ recordOperationResult(result);
39
+ if (result.filesCreated && result.filesCreated.length > 0) {
40
+ logger.info("Files created:");
41
+ for (const file of result.filesCreated) logger.info(` \u2713 ${file}`);
42
+ }
43
+ if (result.filesUpdated && result.filesUpdated.length > 0) {
44
+ logger.info("Files updated:");
45
+ for (const file of result.filesUpdated) logger.info(` \u2713 ${file}`);
46
+ }
47
+ if (result.filesDeleted && result.filesDeleted.length > 0) {
48
+ logger.info("Files deleted:");
49
+ for (const file of result.filesDeleted) logger.info(` \u2713 ${file}`);
50
+ }
51
+ if (result.referencesUpdated && result.referencesUpdated.length > 0) {
52
+ logger.info("\nReferences updated:");
53
+ for (const ref of result.referencesUpdated) logger.info(` \u2713 ${ref}`);
54
+ }
55
+ if (result.referencesRemoved && result.referencesRemoved.length > 0) {
56
+ logger.info("\nReferences removed:");
57
+ for (const ref of result.referencesRemoved) logger.info(` \u2713 ${ref}`);
58
+ }
59
+ if (result.directoriesRenamed && result.directoriesRenamed.length > 0) {
60
+ logger.info("\nDirectories renamed:");
61
+ for (const rename of result.directoriesRenamed) {
62
+ logger.info(` \u2713 ${rename.from} \u2192 ${rename.to}`);
63
+ }
64
+ }
65
+ }
66
+ var GENERATE_COMMAND = "pnpm run generate";
67
+ var BUILD_COMMAND = "pnpm run build";
68
+ async function generateTypes(workingDir) {
69
+ logger.info("\nGenerating TypeScript types...\n");
70
+ try {
71
+ await generateCommand({ workingDir });
72
+ logger.success("TypeScript types generated successfully!");
73
+ } catch (error) {
74
+ logger.warn("Failed to generate TypeScript types:");
75
+ logger.warn(error instanceof Error ? error.message : "Unknown error");
76
+ logger.info(`You can run "${GENERATE_COMMAND}" manually to generate types.
77
+ `);
78
+ }
79
+ }
80
+ async function regenerateTypes(workingDir) {
81
+ logger.info("\nRegenerating TypeScript types...\n");
82
+ try {
83
+ await generateCommand({ workingDir });
84
+ logger.success("TypeScript types regenerated successfully!");
85
+ } catch (error) {
86
+ logger.warn("\nWarning: Failed to regenerate TypeScript types:");
87
+ logger.warn(error instanceof Error ? error.message : "Unknown error");
88
+ logger.info(`You can run "${GENERATE_COMMAND}" manually to regenerate types.`);
89
+ }
90
+ }
91
+
92
+ export {
93
+ beginOperationCapture,
94
+ endOperationCapture,
95
+ recordOperationResult,
96
+ operationError,
97
+ printOperationResult,
98
+ BUILD_COMMAND,
99
+ generateTypes,
100
+ regenerateTypes
101
+ };
@@ -0,0 +1,243 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ packageScenarioIdentifiers
4
+ } from "./cli-FQRVFGN6.js";
5
+ import {
6
+ PENDING_CHANGES_HINT,
7
+ describePendingChanges,
8
+ hasPendingChanges,
9
+ pendingHeadline
10
+ } from "./cli-XSLNH5PR.js";
11
+ import {
12
+ LLM_NOT_CONFIGURED_HINT,
13
+ logicErrorOf
14
+ } from "./cli-BYCHKSSH.js";
15
+ import {
16
+ CliError,
17
+ hasWarning,
18
+ printJson,
19
+ recordWarning,
20
+ reportResult
21
+ } from "./cli-N6H6T2E2.js";
22
+
23
+ // cli/commands/session-report.ts
24
+ function participantsFromArgument(value) {
25
+ const counts = value.split(",").map((part) => part.trim());
26
+ const parsed = counts.map((part) => /^\d+$/.test(part) ? Number(part) : NaN);
27
+ if (parsed.some((count) => Number.isNaN(count))) {
28
+ throw new CliError(
29
+ "USAGE_BAD_ARGUMENT",
30
+ `"${value}" is not a participant count. Give a whole number, zero or more, or one per team separated by commas, e.g. 3,0,2`
31
+ );
32
+ }
33
+ return counts.length === 1 ? parsed[0] : parsed;
34
+ }
35
+ function wholeNumberFromFlag(flag, value, min) {
36
+ const trimmed = value.trim();
37
+ if (!/^\d+$/.test(trimmed) || Number(trimmed) < min) {
38
+ throw new CliError(
39
+ "USAGE_BAD_FLAG",
40
+ `${flag} takes a whole number, ${min} or more, and got "${value}"`
41
+ );
42
+ }
43
+ return Number(trimmed);
44
+ }
45
+ function teamCountFromFlag(value) {
46
+ return wholeNumberFromFlag("--teams", value, 1);
47
+ }
48
+ function requireScenario(packagePath, identifier) {
49
+ const known = packageScenarioIdentifiers(packagePath);
50
+ if (!known.includes(identifier)) {
51
+ throw new CliError(
52
+ "RESOURCE_NOT_FOUND",
53
+ known.length === 0 ? `No scenario "${identifier}": this package has no scenarios.` : `No scenario "${identifier}" in this package. Scenarios: ${known.join(", ")}`
54
+ );
55
+ }
56
+ return identifier;
57
+ }
58
+ function teamIndexFromArgument(state, team) {
59
+ if (team === void 0) return void 0;
60
+ const index = wholeNumberFromFlag("--team", team, 1) - 1;
61
+ if (!state.teams.some((candidate) => candidate.index === index)) {
62
+ const valid = state.teams.map((candidate) => candidate.index + 1).join(", ");
63
+ throw new CliError(
64
+ "USAGE_BAD_ARGUMENT",
65
+ `There is no team ${team} in this session. Teams: ${valid}`
66
+ );
67
+ }
68
+ return index;
69
+ }
70
+ function sessionSummary(state) {
71
+ return {
72
+ gameId: state.game.identifier,
73
+ completedTicks: state.session.completedTicks,
74
+ maxTicks: state.session.maxTicks ?? void 0,
75
+ complete: state.session.complete
76
+ };
77
+ }
78
+ function tickReport(state) {
79
+ const ordered = [...state.teams].sort((a, b) => a.index - b.index);
80
+ const multiTeam = ordered.length > 1;
81
+ return {
82
+ ...sessionSummary(state),
83
+ context: ordered[0]?.context ?? {},
84
+ ...multiTeam ? { teamContexts: ordered.map((team) => team.context) } : {},
85
+ ...Object.keys(state.shared).length > 0 ? { sharedContext: state.shared } : {}
86
+ };
87
+ }
88
+ function roster(team) {
89
+ return [...team?.participants ?? []].sort((a, b) => a.index - b.index);
90
+ }
91
+ function viewReport(state, teamIndex) {
92
+ const ordered = [...state.teams].sort((a, b) => a.index - b.index);
93
+ const head = {
94
+ gameId: state.game.identifier,
95
+ completedTicks: state.session.completedTicks,
96
+ maxTicks: state.session.maxTicks ?? void 0
97
+ };
98
+ const shared = Object.keys(state.shared).length > 0 ? { sharedContext: state.shared } : {};
99
+ const stale = staleField(state);
100
+ if (ordered.length <= 1 && teamIndex === void 0) {
101
+ return { ...tickReport(state), participants: roster(ordered[0]), ...stale };
102
+ }
103
+ if (teamIndex !== void 0) {
104
+ const team = ordered.find((candidate) => candidate.index === teamIndex);
105
+ return {
106
+ ...head,
107
+ team: teamIndex + 1,
108
+ name: team?.name,
109
+ completedTicks: team?.completedTicks,
110
+ complete: team?.complete,
111
+ context: team?.context ?? {},
112
+ participants: roster(team),
113
+ ...shared,
114
+ ...stale
115
+ };
116
+ }
117
+ return {
118
+ ...head,
119
+ teams: ordered.map((team) => ({
120
+ team: team.index + 1,
121
+ name: team.name,
122
+ completedTicks: team.completedTicks,
123
+ complete: team.complete,
124
+ context: team.context,
125
+ participants: roster(team)
126
+ })),
127
+ ...shared,
128
+ ...stale
129
+ };
130
+ }
131
+ function viewSummary(state, teamIndex) {
132
+ const summary = sessionSummary(state);
133
+ if (teamIndex === void 0) return summary;
134
+ const team = state.teams.find((candidate) => candidate.index === teamIndex);
135
+ return {
136
+ ...summary,
137
+ team: teamIndex + 1,
138
+ name: team?.name,
139
+ completedTicks: team?.completedTicks ?? summary.completedTicks,
140
+ complete: team?.complete ?? summary.complete
141
+ };
142
+ }
143
+ var OUTCOME_CODES = {
144
+ denied: "REFUSED_DENIED",
145
+ "validation-rejected": "REFUSED_VALIDATION",
146
+ conflict: "REFUSED_CONFLICT",
147
+ superseded: "REFUSED_SUPERSEDED",
148
+ "tick-failed": "TICK_FAILED",
149
+ error: "SESSION_ERROR"
150
+ };
151
+ function raiseIfRefused(result) {
152
+ if (!("ok" in result) || result.ok) return;
153
+ const stale = staleOf(result);
154
+ if (stale) throw staleError(stale);
155
+ throw refusalError(result.outcome, logicErrorOf(result));
156
+ }
157
+ function staleOf(result) {
158
+ if (typeof result !== "object" || result === null || !("stale" in result)) return void 0;
159
+ return result.stale;
160
+ }
161
+ function staleError(pending) {
162
+ return new CliError(
163
+ "SETTINGS_STALE",
164
+ `${pendingHeadline(pending)}. ${describePendingChanges(pending)}`,
165
+ { hint: PENDING_CHANGES_HINT, details: { stale: pending } }
166
+ );
167
+ }
168
+ function warnIfStale(state) {
169
+ const pending = state.session.pending;
170
+ if (!hasPendingChanges(pending) || hasWarning("SETTINGS_STALE")) return;
171
+ const message = `${pendingHeadline(pending)}. ${describePendingChanges(pending)}`;
172
+ recordWarning(message, "SETTINGS_STALE");
173
+ console.error(`Warning: ${message}.
174
+ ${PENDING_CHANGES_HINT}`);
175
+ }
176
+ function staleField(state) {
177
+ const pending = state.session.pending;
178
+ if (!hasPendingChanges(pending)) return {};
179
+ const stale = Object.fromEntries(
180
+ Object.entries(pending).filter(([, ids]) => ids.length > 0)
181
+ );
182
+ return { stale };
183
+ }
184
+ function refusalError(outcome, logicError) {
185
+ return new CliError(
186
+ logicError?.errorCode ?? OUTCOME_CODES[outcome.kind],
187
+ refusalMessage(outcome),
188
+ {
189
+ ...environmentHint(logicError),
190
+ details: { ...outcome },
191
+ diagnostics: logicError ? [logicDiagnostic(logicError)] : []
192
+ }
193
+ );
194
+ }
195
+ function environmentHint(logicError) {
196
+ return logicError?.errorCode === "LLM_NOT_CONFIGURED" ? { hint: LLM_NOT_CONFIGURED_HINT } : {};
197
+ }
198
+ function logicDiagnostic(failure) {
199
+ return {
200
+ severity: "error",
201
+ code: "LOGIC_ERROR",
202
+ message: failure.message,
203
+ ...failure.file === void 0 ? {} : { file: failure.file },
204
+ ...failure.line === void 0 ? {} : { line: failure.line },
205
+ ...failure.column === void 0 ? {} : { column: failure.column },
206
+ resource: failure.resource,
207
+ ...failure.tick === void 0 ? {} : { tick: failure.tick },
208
+ ...failure.team === void 0 ? {} : { team: failure.team }
209
+ };
210
+ }
211
+ function refusalMessage(outcome) {
212
+ switch (outcome.kind) {
213
+ case "conflict":
214
+ return outcome.message ?? "The write conflicted with a concurrent tick";
215
+ case "validation-rejected":
216
+ return outcome.message ?? outcome.rejections[0]?.message ?? "The write was rejected by a validator";
217
+ default:
218
+ return outcome.message;
219
+ }
220
+ }
221
+ function emit(value) {
222
+ reportResult(value, () => printJson(value));
223
+ }
224
+
225
+ export {
226
+ participantsFromArgument,
227
+ wholeNumberFromFlag,
228
+ teamCountFromFlag,
229
+ requireScenario,
230
+ teamIndexFromArgument,
231
+ sessionSummary,
232
+ tickReport,
233
+ viewReport,
234
+ viewSummary,
235
+ OUTCOME_CODES,
236
+ raiseIfRefused,
237
+ staleOf,
238
+ staleError,
239
+ warnIfStale,
240
+ environmentHint,
241
+ logicDiagnostic,
242
+ emit
243
+ };
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ updateSettingsEditor
4
+ } from "./cli-AV2FYC5G.js";
5
+ import "./cli-Q6ZBZYK2.js";
6
+ import "./cli-5IAW3LIF.js";
7
+ import "./cli-S5IVGDDD.js";
8
+ import "./cli-4VFZHLDG.js";
9
+ import "./cli-4UWFQNGF.js";
10
+ import "./cli-4SIWLHQO.js";
11
+ import "./cli-IUS2YCD3.js";
12
+ import "./cli-QUNIRH7A.js";
13
+ import "./cli-J4UBELKF.js";
14
+ import "./cli-XSVGKI3R.js";
15
+ import "./cli-TT36JCU5.js";
16
+ import "./cli-OXAUOWCN.js";
17
+ import "./cli-KSGB2ZLK.js";
18
+ import "./cli-ZTWOE3ZT.js";
19
+ import "./cli-LQOHATY2.js";
20
+ import "./cli-IEMKI7J7.js";
21
+ import "./cli-OMWC75CC.js";
22
+ import "./cli-BYCHKSSH.js";
23
+ import "./cli-25RWY5BQ.js";
24
+ import "./cli-QWQMPCL6.js";
25
+ import "./cli-VQ6HVQW4.js";
26
+ import "./cli-F2D4GGUA.js";
27
+ import "./cli-4YB3ROVR.js";
28
+ import "./cli-N6H6T2E2.js";
29
+
30
+ // cli/commands/resources/scenario-editor/update.ts
31
+ function updateScenarioEditor(definitionInput, options) {
32
+ return updateSettingsEditor("scenario_editor", definitionInput, options);
33
+ }
34
+ export {
35
+ updateScenarioEditor
36
+ };
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ generateAllTypes
4
+ } from "./cli-IEMKI7J7.js";
5
+ import {
6
+ loadConfig
7
+ } from "./cli-VQ6HVQW4.js";
8
+ import {
9
+ logger
10
+ } from "./cli-4YB3ROVR.js";
11
+
12
+ // cli/commands/generate.ts
13
+ import { resolve } from "path";
14
+ async function generateCommand(options) {
15
+ const configPath = resolve(options.workingDir, "seriousgaming.sdk.json");
16
+ const config = await loadConfig(configPath);
17
+ const capabilities = config.capabilities || [];
18
+ const engines = config.engine ? [config.engine] : [];
19
+ const userInterfaces = config.ui ? [config.ui] : [];
20
+ const settingsEditors = [config.setup, config.scenario_editor].filter(
21
+ (editor) => editor !== void 0
22
+ );
23
+ const sessionUserInterfaces = config.session ? [config.session] : [];
24
+ const waitingRoomUserInterfaces = config.waiting_room ? [config.waiting_room] : [];
25
+ const tickControllers = config.tick_controller ? [config.tick_controller] : [];
26
+ const hooks = config.hooks || [];
27
+ const validators = config.validators || [];
28
+ const endpoints = config.endpoints || [];
29
+ logger.section(`Found ${capabilities.length} capabilities:`);
30
+ for (const cap of capabilities) {
31
+ logger.debug(` - ${cap.definition.identifier}`);
32
+ }
33
+ logger.newline();
34
+ logger.section(`Found ${engines.length === 1 ? "the engine" : "no engine"}:`);
35
+ for (const engine of engines) {
36
+ logger.debug(` - ${engine.definition.identifier}`);
37
+ }
38
+ logger.newline();
39
+ logger.section(`Found ${userInterfaces.length} user interfaces:`);
40
+ for (const ui of userInterfaces) {
41
+ logger.debug(` - ${ui.definition.identifier}`);
42
+ }
43
+ logger.newline();
44
+ logger.section(`Found ${settingsEditors.length} settings editors:`);
45
+ for (const editor of settingsEditors) {
46
+ logger.debug(` - ${editor.definition.identifier}`);
47
+ }
48
+ logger.newline();
49
+ logger.section(`Found ${sessionUserInterfaces.length} session user interfaces:`);
50
+ for (const sessionUI of sessionUserInterfaces) {
51
+ logger.debug(` - ${sessionUI.definition.identifier}`);
52
+ }
53
+ logger.newline();
54
+ logger.section(`Found ${waitingRoomUserInterfaces.length} waiting room user interfaces:`);
55
+ for (const waitingRoomUI of waitingRoomUserInterfaces) {
56
+ logger.debug(` - ${waitingRoomUI.definition.identifier}`);
57
+ }
58
+ logger.newline();
59
+ logger.section(`Found ${tickControllers.length} tick controllers:`);
60
+ for (const tc of tickControllers) {
61
+ logger.debug(` - ${tc.definition.identifier}`);
62
+ }
63
+ logger.newline();
64
+ logger.section(`Found ${hooks.length} hooks:`);
65
+ for (const hook of hooks) {
66
+ logger.debug(` - ${hook.definition.identifier} (signal: ${hook.definition.signal})`);
67
+ }
68
+ logger.newline();
69
+ logger.section(`Found ${validators.length} validators:`);
70
+ for (const validator of validators) {
71
+ logger.debug(` - ${validator.definition.identifier}`);
72
+ }
73
+ logger.newline();
74
+ logger.section(`Found ${endpoints.length} endpoints:`);
75
+ for (const endpoint of endpoints) {
76
+ logger.debug(` - ${endpoint.definition.identifier}`);
77
+ }
78
+ logger.newline();
79
+ logger.section("Engine capability usage:");
80
+ for (const engine of engines) {
81
+ logger.debug(`
82
+ ${engine.definition.identifier}:`);
83
+ const reads = engine.definition.reads || [];
84
+ const writes = engine.definition.writes || [];
85
+ if (reads.length > 0) {
86
+ logger.debug(` Reads:`);
87
+ for (const read of reads) {
88
+ logger.debug(` - ${read}`);
89
+ }
90
+ }
91
+ if (writes.length > 0) {
92
+ logger.debug(` Writes:`);
93
+ for (const write of writes) {
94
+ logger.debug(` - ${write}`);
95
+ }
96
+ }
97
+ }
98
+ logger.newline();
99
+ logger.section("User interface capability usage:");
100
+ for (const ui of userInterfaces) {
101
+ logger.debug(`
102
+ ${ui.definition.identifier}:`);
103
+ const reads = ui.definition.reads || [];
104
+ const writes = ui.definition.writes || [];
105
+ if (reads.length > 0) {
106
+ logger.debug(` Reads:`);
107
+ for (const read of reads) {
108
+ logger.debug(` - ${read}`);
109
+ }
110
+ }
111
+ if (writes.length > 0) {
112
+ logger.debug(` Writes:`);
113
+ for (const write of writes) {
114
+ logger.debug(` - ${write}`);
115
+ }
116
+ }
117
+ }
118
+ logger.newline();
119
+ logger.section("Generating types...");
120
+ await generateAllTypes(config, { workingDir: options.workingDir });
121
+ logger.success("Type generation complete!");
122
+ }
123
+
124
+ export {
125
+ generateCommand
126
+ };
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ bundlePackage,
4
+ includeBundleEntry,
5
+ packageBundleCommand
6
+ } from "./cli-J4DKUUTK.js";
7
+ import "./cli-4YB3ROVR.js";
8
+ import "./cli-N6H6T2E2.js";
9
+ export {
10
+ bundlePackage,
11
+ includeBundleEntry,
12
+ packageBundleCommand
13
+ };