@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,143 @@
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
+ createUserInterfaceFiles
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
+ validateSDKUserInterface
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/ui/new.ts
53
+ async function createUserInterface(definitionInput, options) {
54
+ logger.info("\nCreating new user interface...\n");
55
+ loadPackageContext(options.workingDir, {
56
+ suggestNewPackage: true
57
+ });
58
+ const inputSource = await resolveInputSource(definitionInput, options.file);
59
+ const jsonDefinition = inputSource.kind === "json" ? inputSource.json : null;
60
+ if (jsonDefinition) {
61
+ const uiInput = readAuthoredBundle({
62
+ json: jsonDefinition,
63
+ type: "ui",
64
+ command: "new",
65
+ validate: validateSDKUserInterface
66
+ });
67
+ logger.info("Creating user interface files...\n");
68
+ const result2 = await createUserInterfaceFiles({
69
+ packagePath: options.workingDir,
70
+ name: "Dashboard",
71
+ definition: uiInput.definition
72
+ });
73
+ if (!result2.success) {
74
+ throw operationError(result2, "Failed to create user interface files");
75
+ }
76
+ logger.success("User interface created successfully!");
77
+ printOperationResult(result2);
78
+ await generateTypes(options.workingDir);
79
+ logger.info("Next steps:");
80
+ logger.info(" 1. Edit the UI components: ui/src/App.tsx");
81
+ logger.info(` 2. Run "${BUILD_COMMAND}" to build your package`);
82
+ return;
83
+ }
84
+ logger.info("No JSON definition provided. Starting interactive mode...\n");
85
+ const name = await input({
86
+ message: "Display name (human-readable):",
87
+ default: "Dashboard"
88
+ });
89
+ logger.info("");
90
+ const availableCapabilities = loadResourceIdentifiers(options.workingDir, "capability");
91
+ const reads = [];
92
+ const writes = [];
93
+ if (availableCapabilities.length > 0) {
94
+ logger.info("Select capabilities for this user interface.\n");
95
+ logger.info("Tip: Use arrow keys to navigate, space to select, enter to continue.\n");
96
+ const readCapabilities = await checkbox({
97
+ message: "Capabilities this UI reads from (required dependencies):",
98
+ choices: availableCapabilities.map((id) => ({
99
+ name: id,
100
+ value: id
101
+ })),
102
+ pageSize: 10
103
+ });
104
+ reads.push(...readCapabilities);
105
+ const remainingForWrites = availableCapabilities.filter(
106
+ (id) => !readCapabilities.includes(id)
107
+ );
108
+ if (remainingForWrites.length > 0) {
109
+ const writeCapabilities = await checkbox({
110
+ message: "Capabilities this UI writes to (provides):",
111
+ choices: remainingForWrites.map((id) => ({
112
+ name: id,
113
+ value: id
114
+ })),
115
+ pageSize: 10
116
+ });
117
+ writes.push(...writeCapabilities);
118
+ }
119
+ logger.info("");
120
+ } else {
121
+ logger.info("No existing capabilities found in this package.");
122
+ logger.info('You can add capabilities using "seriousgaming-sdk new capability".\n');
123
+ }
124
+ const settings = await promptForSettings(options.workingDir, "user interface");
125
+ logger.info("Creating user interface files...\n");
126
+ const result = await createUserInterfaceFiles({
127
+ packagePath: options.workingDir,
128
+ name,
129
+ definition: presentFields({ reads, writes, settings })
130
+ });
131
+ if (!result.success) {
132
+ throw operationError(result, "Failed to create user interface files");
133
+ }
134
+ logger.success("User interface created successfully!");
135
+ printOperationResult(result);
136
+ await generateTypes(options.workingDir);
137
+ logger.info("Next steps:");
138
+ logger.info(" 1. Edit the UI components: ui/src/App.tsx");
139
+ logger.info(` 2. Run "${BUILD_COMMAND}" to build your package`);
140
+ }
141
+ export {
142
+ createUserInterface
143
+ };
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CliError
4
+ } from "./cli-N6H6T2E2.js";
5
+
6
+ // cli/utils/global-settings.ts
7
+ import {
8
+ chmodSync,
9
+ existsSync,
10
+ mkdirSync,
11
+ readFileSync,
12
+ renameSync,
13
+ rmSync,
14
+ writeFileSync
15
+ } from "fs";
16
+ import { homedir } from "os";
17
+ import { dirname, isAbsolute, join } from "path";
18
+ var GLOBAL_SETTINGS_ENV_VAR = "SERIOUSGAMING_SDK_CONFIG";
19
+ var SECRETS_FILE_MODE = 384;
20
+ var GLOBAL_SETTINGS_KEYS = [
21
+ "elevenLabs.apiKey",
22
+ "platform.apiHost",
23
+ "platform.apiKey",
24
+ "platform.defaultPublisher"
25
+ ];
26
+ function resolveGlobalSettingsPath() {
27
+ const override = process.env[GLOBAL_SETTINGS_ENV_VAR];
28
+ if (override) {
29
+ if (!isAbsolute(override)) {
30
+ throw new CliError(
31
+ "SETTINGS_FILE_INVALID",
32
+ `${GLOBAL_SETTINGS_ENV_VAR} must be an absolute path, received: ${override}`
33
+ );
34
+ }
35
+ return override;
36
+ }
37
+ return join(homedir(), ".seriousgaming-sdk", "config.json");
38
+ }
39
+ function loadGlobalSettings(path = resolveGlobalSettingsPath()) {
40
+ if (!existsSync(path)) {
41
+ return {};
42
+ }
43
+ try {
44
+ const content = readFileSync(path, "utf-8");
45
+ const parsed = JSON.parse(content);
46
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
47
+ console.warn(`Warning: ${path} is not a JSON object; ignoring global settings.`);
48
+ return {};
49
+ }
50
+ return parsed;
51
+ } catch (error) {
52
+ console.warn(
53
+ `Warning: Failed to read global settings at ${path}:`,
54
+ error instanceof Error ? error.message : "Unknown error"
55
+ );
56
+ return {};
57
+ }
58
+ }
59
+ function loadGlobalSettingsForWrite(path = resolveGlobalSettingsPath()) {
60
+ if (!existsSync(path)) {
61
+ return {};
62
+ }
63
+ let parsed;
64
+ try {
65
+ parsed = JSON.parse(readFileSync(path, "utf-8"));
66
+ } catch (error) {
67
+ throw new CliError(
68
+ "SETTINGS_FILE_INVALID",
69
+ `${path} could not be parsed: ${error instanceof Error ? error.message : "Unknown error"}
70
+ Refusing to write, because that would discard the settings already in the file. Fix or remove the file, then try again.`
71
+ );
72
+ }
73
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
74
+ throw new CliError(
75
+ "SETTINGS_FILE_INVALID",
76
+ `${path} is not a JSON object.
77
+ Refusing to write, because that would discard the contents of the file. Fix or remove the file, then try again.`
78
+ );
79
+ }
80
+ return parsed;
81
+ }
82
+ function saveGlobalSettings(settings, path = resolveGlobalSettingsPath()) {
83
+ mkdirSync(dirname(path), { recursive: true });
84
+ const content = JSON.stringify(settings, null, 4) + "\n";
85
+ const temporaryPath = `${path}.${process.pid}.tmp`;
86
+ try {
87
+ if (process.platform === "win32") {
88
+ writeFileSync(temporaryPath, content, "utf-8");
89
+ } else {
90
+ writeFileSync(temporaryPath, content, {
91
+ encoding: "utf-8",
92
+ mode: SECRETS_FILE_MODE
93
+ });
94
+ chmodSync(temporaryPath, SECRETS_FILE_MODE);
95
+ }
96
+ renameSync(temporaryPath, path);
97
+ } catch (error) {
98
+ rmSync(temporaryPath, { force: true });
99
+ throw error;
100
+ }
101
+ }
102
+ function assertKnownKey(key) {
103
+ if (!GLOBAL_SETTINGS_KEYS.includes(key)) {
104
+ throw new CliError(
105
+ "USAGE_BAD_ARGUMENT",
106
+ `Unknown setting "${key}". Valid keys: ${GLOBAL_SETTINGS_KEYS.join(", ")}`
107
+ );
108
+ }
109
+ }
110
+ function getGlobalSetting(settings, key) {
111
+ assertKnownKey(key);
112
+ let node = settings;
113
+ for (const segment of key.split(".")) {
114
+ if (typeof node !== "object" || node === null) {
115
+ return void 0;
116
+ }
117
+ node = node[segment];
118
+ }
119
+ return typeof node === "string" ? node : void 0;
120
+ }
121
+ function setGlobalSetting(settings, key, value) {
122
+ assertKnownKey(key);
123
+ const segments = key.split(".");
124
+ const leaf = segments.pop() ?? key;
125
+ const next = structuredClone(settings);
126
+ let node = next;
127
+ for (const segment of segments) {
128
+ const existing = node[segment];
129
+ if (typeof existing !== "object" || existing === null) {
130
+ node[segment] = {};
131
+ }
132
+ node = node[segment];
133
+ }
134
+ node[leaf] = value;
135
+ return next;
136
+ }
137
+
138
+ export {
139
+ resolveGlobalSettingsPath,
140
+ loadGlobalSettings,
141
+ loadGlobalSettingsForWrite,
142
+ saveGlobalSettings,
143
+ getGlobalSetting,
144
+ setGlobalSetting
145
+ };
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ deleteValidatorFiles,
4
+ findValidatorReferences
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/validator/delete.ts
37
+ async function deleteValidator(identifier, options) {
38
+ logger.info("\nDeleting validator...\n");
39
+ loadPackageContext(options.workingDir);
40
+ const references = findValidatorReferences({
41
+ packagePath: options.workingDir,
42
+ identifier
43
+ });
44
+ logger.info(`Validator: ${identifier}`);
45
+ if (references.length > 0) {
46
+ logger.info("\nThis validator is referenced in:");
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 this validator?" },
54
+ options.yes
55
+ );
56
+ if (!confirmed) {
57
+ logger.info("\nDeletion cancelled.\n");
58
+ return;
59
+ }
60
+ logger.info("");
61
+ const result = deleteValidatorFiles({
62
+ packagePath: options.workingDir,
63
+ identifier
64
+ });
65
+ if (!result.success) {
66
+ throw operationError(result, "Failed to delete validator 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
+ logger.info("\nRegenerating TypeScript types...\n");
77
+ try {
78
+ await generateCommand({ workingDir: options.workingDir });
79
+ logger.success("TypeScript types regenerated successfully!");
80
+ } catch (error) {
81
+ logger.warn("\nWarning: Failed to regenerate TypeScript types:");
82
+ logger.warn(error instanceof Error ? error.message : "Unknown error");
83
+ }
84
+ logger.success("Validator deleted successfully!");
85
+ }
86
+ export {
87
+ deleteValidator
88
+ };
@@ -0,0 +1,136 @@
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
+ createSessionUserInterfaceFiles
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
+ validateSDKSessionUserInterface
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/session/new.ts
53
+ async function createSessionUserInterface(definitionInput, options) {
54
+ logger.info("\nCreating new session user interface...\n");
55
+ loadPackageContext(options.workingDir, {
56
+ suggestNewPackage: true
57
+ });
58
+ const inputSource = await resolveInputSource(definitionInput, options.file);
59
+ const jsonDefinition = inputSource.kind === "json" ? inputSource.json : null;
60
+ if (jsonDefinition) {
61
+ const uiInput = readAuthoredBundle({
62
+ json: jsonDefinition,
63
+ type: "session",
64
+ command: "new",
65
+ validate: validateSDKSessionUserInterface
66
+ });
67
+ logger.info("Creating session user interface files...\n");
68
+ const result2 = await createSessionUserInterfaceFiles({
69
+ packagePath: options.workingDir,
70
+ name: "Session",
71
+ definition: uiInput.definition
72
+ });
73
+ if (!result2.success) {
74
+ throw operationError(result2, "Failed to create session user interface files");
75
+ }
76
+ logger.success("Session user interface created successfully!");
77
+ printOperationResult(result2);
78
+ await generateTypes(options.workingDir);
79
+ logger.info("Next steps:");
80
+ logger.info(" 1. Edit the UI components: session/src/App.tsx");
81
+ logger.info(` 2. Run "${BUILD_COMMAND}" to build your package`);
82
+ return;
83
+ }
84
+ logger.info("No JSON definition provided. Starting interactive mode...\n");
85
+ const name = await input({
86
+ message: "Display name (human-readable):",
87
+ default: "Session"
88
+ });
89
+ logger.info("");
90
+ const availableCapabilities = loadResourceIdentifiers(options.workingDir, "capability");
91
+ const reads = [];
92
+ const writes = [];
93
+ if (availableCapabilities.length > 0) {
94
+ logger.info("Select capabilities for this session user interface.\n");
95
+ logger.info("Tip: Use arrow keys to navigate, space to select, enter to continue.\n");
96
+ const readCapabilities = await checkbox({
97
+ message: "Capabilities this UI reads from:",
98
+ choices: availableCapabilities.map((id) => ({ name: id, value: id })),
99
+ pageSize: 10
100
+ });
101
+ reads.push(...readCapabilities);
102
+ const remainingForWrites = availableCapabilities.filter(
103
+ (id) => !readCapabilities.includes(id)
104
+ );
105
+ if (remainingForWrites.length > 0) {
106
+ const writeCapabilities = await checkbox({
107
+ message: "Capabilities this UI writes to:",
108
+ choices: remainingForWrites.map((id) => ({ name: id, value: id })),
109
+ pageSize: 10
110
+ });
111
+ writes.push(...writeCapabilities);
112
+ }
113
+ logger.info("");
114
+ } else {
115
+ logger.info("No existing capabilities found in this package.\n");
116
+ }
117
+ const settings = await promptForSettings(options.workingDir, "session user interface");
118
+ logger.info("Creating session user interface files...\n");
119
+ const result = await createSessionUserInterfaceFiles({
120
+ packagePath: options.workingDir,
121
+ name,
122
+ definition: presentFields({ reads, writes, settings })
123
+ });
124
+ if (!result.success) {
125
+ throw operationError(result, "Failed to create session user interface files");
126
+ }
127
+ logger.success("Session user interface created successfully!");
128
+ printOperationResult(result);
129
+ await generateTypes(options.workingDir);
130
+ logger.info("Next steps:");
131
+ logger.info(" 1. Edit the UI components: session/src/App.tsx");
132
+ logger.info(` 2. Run "${BUILD_COMMAND}" to build your package`);
133
+ }
134
+ export {
135
+ createSessionUserInterface
136
+ };
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolveDocsPath
4
+ } from "./cli-UNAJ2OTE.js";
5
+ import {
6
+ CliError,
7
+ reportResult
8
+ } from "./cli-N6H6T2E2.js";
9
+
10
+ // cli/commands/docs-export.ts
11
+ import { cpSync, existsSync } from "fs";
12
+ import { resolve } from "path";
13
+ async function docsExportCommand(outputDir) {
14
+ const targetDir = outputDir || ".seriousgaming-sdk/docs";
15
+ const docsPath = resolveDocsPath();
16
+ if (!existsSync(docsPath)) {
17
+ throw new CliError(
18
+ "SDK_INCOMPLETE",
19
+ "Documentation files not found. Make sure the SDK is properly installed."
20
+ );
21
+ }
22
+ console.error(`Exporting documentation to ${targetDir}...`);
23
+ try {
24
+ cpSync(docsPath, targetDir, { recursive: true });
25
+ } catch (error) {
26
+ throw new CliError(
27
+ "WRITE_FAILED",
28
+ `Error exporting documentation: ${error.message}`,
29
+ { cause: error }
30
+ );
31
+ }
32
+ reportResult({ directory: resolve(targetDir) }, () => {
33
+ console.log(`\u2713 Documentation exported successfully to ${targetDir}`);
34
+ console.log(`
35
+ You can now use these docs with Claude Code for context.`);
36
+ });
37
+ }
38
+ export {
39
+ docsExportCommand
40
+ };
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createSettingsEditor
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/new.ts
31
+ function createScenarioEditor(definitionInput, options) {
32
+ return createSettingsEditor("scenario_editor", definitionInput, options);
33
+ }
34
+ export {
35
+ createScenarioEditor
36
+ };
@@ -0,0 +1,99 @@
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
+ updateUserInterfaceFiles
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
+ validateSDKUserInterface
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/ui/update.ts
46
+ async function updateUserInterface(definitionInput, options) {
47
+ logger.info("\nUpdating user interface...\n");
48
+ const identifier = "ui";
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: "ui",
56
+ identifier,
57
+ resourceLabel: "User interface"
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 uiInput = readAuthoredBundle({
65
+ json: jsonDefinition,
66
+ type: "ui",
67
+ command: "update",
68
+ validate: validateSDKUserInterface,
69
+ identifier,
70
+ validationHint: "Full replacement requires all fields to be specified."
71
+ });
72
+ logger.info("Updating user interface files...\n");
73
+ const result = updateUserInterfaceFiles({
74
+ packagePath: options.workingDir,
75
+ oldIdentifier: identifier,
76
+ newDefinition: uiInput.definition
77
+ });
78
+ if (!result.success) {
79
+ throw operationError(result, "Failed to update user interface files");
80
+ }
81
+ logger.success("User interface updated successfully!");
82
+ printOperationResult(result);
83
+ await regenerateTypes(options.workingDir);
84
+ logger.info("");
85
+ return;
86
+ }
87
+ throw new CliError(
88
+ "USAGE_MISSING_INPUT",
89
+ `A user interface takes no interactive input: a game holds one, so there is
90
+ nothing to name and nothing to pick.
91
+
92
+ Edit it with a definition or a patch:
93
+ $ seriousgaming-sdk update user-interface '{"definition":{...}}'
94
+ $ seriousgaming-sdk update user-interface --patch '[...]'`
95
+ );
96
+ }
97
+ export {
98
+ updateUserInterface
99
+ };