@seriousgaming/sdk-tools 1.4.0 → 1.6.0
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/bundling/ui-bundler.d.ts +12 -0
- package/dist/cli-25RWY5BQ.js +41 -0
- package/dist/cli-272KBNJH.js +97 -0
- package/dist/cli-2BH7FX27.js +52 -0
- package/dist/cli-2GOFEW26.js +81 -0
- package/dist/cli-3E3MD5U4.js +21 -0
- package/dist/cli-3HE4AVZG.js +115 -0
- package/dist/cli-4AKVLEC4.js +1387 -0
- package/dist/cli-4BV45LBH.js +126 -0
- package/dist/cli-4LKXZQ2B.js +48 -0
- package/dist/cli-4UWFQNGF.js +54 -0
- package/dist/cli-4YB3ROVR.js +78 -0
- package/dist/cli-57RXC3HQ.js +36 -0
- package/dist/cli-5JEGTVTG.js +96 -0
- package/dist/cli-6AMT3BUO.js +97 -0
- package/dist/cli-6RRVEGFB.js +80 -0
- package/dist/cli-6WXLXJVX.js +36 -0
- package/dist/cli-7OGYADZ3.js +97 -0
- package/dist/cli-AK7OIPWY.js +229 -0
- package/dist/cli-B4TN6PJP.js +124 -0
- package/dist/cli-B6YHEKIJ.js +248 -0
- package/dist/cli-BPYMTOUL.js +89 -0
- package/dist/cli-BWX5E7TQ.js +23 -0
- package/dist/cli-BYJWFFCF.js +37 -0
- package/dist/cli-C3NVCKO6.js +43 -0
- package/dist/cli-C47GJATR.js +42 -0
- package/dist/cli-C5QOJJWX.js +46 -0
- package/dist/cli-C6TH5S7K.js +6417 -0
- package/dist/cli-DL2CVMRF.js +89 -0
- package/dist/cli-DMW2OQIJ.js +76 -0
- package/dist/cli-DZW3XD5F.js +143 -0
- package/dist/cli-E2NLWIFE.js +1331 -0
- package/dist/cli-E33CJRRQ.js +36 -0
- package/dist/cli-E6DJIMYD.js +142 -0
- package/dist/cli-EEFJKIGL.js +151 -0
- package/dist/cli-EVFS55WN.js +185 -0
- package/dist/cli-F2D4GGUA.js +549 -0
- package/dist/cli-FBTRTIZJ.js +226 -0
- package/dist/cli-FWFRKQNE.js +11 -0
- package/dist/cli-FYINNRML.js +760 -0
- package/dist/cli-G522CPRL.js +88 -0
- package/dist/cli-G6KELFSX.js +2847 -0
- package/dist/cli-G6UE5NL4.js +90 -0
- package/dist/cli-GBFM76BF.js +16 -0
- package/dist/cli-GDQ6ILJY.js +101 -0
- package/dist/cli-GFBGYFYD.js +50 -0
- package/dist/cli-GGPDQNM3.js +35 -0
- package/dist/cli-GTSGLN3Z.js +307 -0
- package/dist/cli-GUXKQMJ7.js +13641 -0
- package/dist/cli-GXD36NF2.js +60 -0
- package/dist/cli-HCRTYQQS.js +16 -0
- package/dist/cli-HYY64SUD.js +185 -0
- package/dist/cli-I355WTAF.js +463 -0
- package/dist/cli-IDKYF5XB.js +59 -0
- package/dist/cli-ILKCQNM6.js +8 -0
- package/dist/cli-IRZ5KB7D.js +36 -0
- package/dist/cli-IUS2YCD3.js +31 -0
- package/dist/cli-J4DKUUTK.js +138 -0
- package/dist/cli-JFU22EJ2.js +187 -0
- package/dist/cli-JMZLT65J.js +226 -0
- package/dist/cli-JZM7XTNV.js +89 -0
- package/dist/cli-K2B6WHKA.js +81 -0
- package/dist/cli-KL3756X6.js +126 -0
- package/dist/cli-KNOOKGYW.js +88 -0
- package/dist/cli-LFGRFIEO.js +226 -0
- package/dist/cli-LFM7GJHI.js +0 -0
- package/dist/cli-LMDJCHHD.js +304 -0
- package/dist/cli-LXYPE3L5.js +99 -0
- package/dist/cli-M6BCQRID.js +153 -0
- package/dist/cli-MBNMPVDC.js +367 -0
- package/dist/cli-MJUYJIEP.js +13 -0
- package/dist/cli-MMN4BPO4.js +145 -0
- package/dist/cli-MYJGMA6U.js +40 -0
- package/dist/cli-N6H6T2E2.js +616 -0
- package/dist/cli-O5KP4OVN.js +61 -0
- package/dist/cli-O6PWMJTZ.js +25 -0
- package/dist/cli-ORIG557O.js +141 -0
- package/dist/cli-PFFCNGHI.js +243 -0
- package/dist/cli-PNLYX6R6.js +131 -0
- package/dist/cli-PQBXVLEU.js +649 -0
- package/dist/cli-PTT5RGKO.js +62 -0
- package/dist/cli-Q2XJF5AS.js +127 -0
- package/dist/cli-QEVDDBNO.js +60 -0
- package/dist/cli-QEVE5HUM.js +167 -0
- package/dist/cli-QUIJCBYB.js +391 -0
- package/dist/cli-QUNIRH7A.js +57 -0
- package/dist/cli-QVASWX2A.js +187 -0
- package/dist/cli-QWQMPCL6.js +253 -0
- package/dist/cli-R4PCG5YX.js +131 -0
- package/dist/cli-RA673NGF.js +53 -0
- package/dist/cli-RN6IWTL2.js +36 -0
- package/dist/cli-ROT3DRKU.js +145 -0
- package/dist/cli-RZITKPJX.js +367 -0
- package/dist/cli-S5IVGDDD.js +32 -0
- package/dist/cli-S5QDONIQ.js +218 -0
- package/dist/cli-SIPDUBFL.js +36 -0
- package/dist/cli-SMFSZF2G.js +4009 -0
- package/dist/cli-SRHBXZCN.js +159 -0
- package/dist/cli-TCY5LJ7E.js +88 -0
- package/dist/cli-TDSQSCX4.js +131 -0
- package/dist/cli-TIDQ4WUE.js +257 -0
- package/dist/cli-TLLA6KAP.js +79 -0
- package/dist/cli-TPU4TUR6.js +132 -0
- package/dist/cli-U2UE7I7J.js +30 -0
- package/dist/cli-UELGBQG7.js +101 -0
- package/dist/cli-UHSZBKYO.js +97 -0
- package/dist/cli-UJ4UCL2Z.js +38 -0
- package/dist/cli-UKQYZYFK.js +31 -0
- package/dist/cli-UMFFURZ7.js +81 -0
- package/dist/cli-UNAJ2OTE.js +15 -0
- package/dist/cli-UNJ5X6BU.js +89 -0
- package/dist/cli-UTJU4IYG.js +117 -0
- package/dist/cli-V4GHRWOV.js +1837 -0
- package/dist/cli-VCI3CG36.js +73 -0
- package/dist/cli-VCKOC2EV.js +256 -0
- package/dist/cli-VL2P354N.js +46 -0
- package/dist/cli-WAE26SVW.js +72 -0
- package/dist/cli-WOGIAU2E.js +100 -0
- package/dist/cli-WU43JT4T.js +52 -0
- package/dist/cli-XCO2VQOH.js +122 -0
- package/dist/cli-XSVGKI3R.js +39 -0
- package/dist/cli-YOTGR3NB.js +82 -0
- package/dist/cli-YVVXUD2G.js +197 -0
- package/dist/cli-ZISJ36MM.js +89 -0
- package/dist/cli-ZTWOE3ZT.js +65 -0
- package/dist/cli-ZVSFYDPQ.js +205 -0
- package/dist/cli-ZWPYIXNI.js +68 -0
- package/dist/cli.js +171 -42385
- 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 +339 -56
- package/dist/core/session.d.ts +15 -1
- package/dist/dev/console/assets/{index-BvB-LFQZ.js → index-CuMOOH9m.js} +21 -21
- package/dist/dev/console/index.html +1 -1
- package/dist/dev/public-origins.d.ts +61 -0
- package/dist/dev/shell.d.ts +51 -4
- package/dist/dev/surfaces.d.ts +7 -0
- package/dist/docs/ai-agents.md +5 -0
- 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-0.x.md +2 -2
- package/dist/docs/changelog.md +56 -4
- package/dist/docs/cli-and-dev-server.md +79 -0
- package/dist/docs/cli-error-codes.md +39 -36
- package/dist/docs/cli-reference.md +93 -32
- package/dist/docs/environment-variables.md +16 -5
- package/dist/docs/guides/ai-facilitation.md +2 -0
- package/dist/docs/guides/capabilities.md +2 -0
- package/dist/docs/guides/designing-a-game.md +31 -4
- package/dist/docs/guides/designing-screens.md +133 -0
- package/dist/docs/guides/endpoints.md +2 -0
- package/dist/docs/guides/engine-testing.md +5 -1
- package/dist/docs/guides/engine.md +2 -0
- package/dist/docs/guides/file-handling.md +3 -1
- package/dist/docs/guides/games.md +3 -1
- package/dist/docs/guides/global-settings.md +2 -0
- package/dist/docs/guides/guide.md +2 -0
- package/dist/docs/guides/hooks.md +2 -0
- package/dist/docs/guides/index.md +9 -0
- package/dist/docs/guides/internationalization.md +2 -0
- package/dist/docs/guides/llm-integration.md +4 -2
- package/dist/docs/guides/multi-team-games.md +3 -1
- package/dist/docs/guides/patterns.md +2 -0
- package/dist/docs/guides/presentation.md +1 -1
- package/dist/docs/guides/production-constraints.md +2 -0
- package/dist/docs/guides/scenario-editor.md +2 -0
- package/dist/docs/guides/scenarios.md +6 -2
- package/dist/docs/guides/session-game-flow.md +365 -0
- package/dist/docs/guides/session-hooks.md +205 -0
- package/dist/docs/guides/session.md +27 -565
- package/dist/docs/guides/settings.md +2 -0
- package/dist/docs/guides/setup.md +3 -1
- package/dist/docs/guides/speech-generation.md +2 -0
- package/dist/docs/guides/starter-game.md +63 -23
- package/dist/docs/guides/testing.md +35 -18
- package/dist/docs/guides/tick-controller.md +3 -1
- package/dist/docs/guides/type-safety.md +2 -0
- package/dist/docs/guides/ui-files-and-llms.md +328 -0
- package/dist/docs/guides/ui-participants.md +281 -0
- package/dist/docs/guides/ui-styling.md +263 -0
- package/dist/docs/guides/ui-ticks.md +247 -0
- package/dist/docs/guides/ui.md +11 -1092
- package/dist/docs/guides/upgrading.md +2 -0
- package/dist/docs/guides/validators.md +2 -0
- package/dist/docs/guides/waiting-room.md +1 -1
- package/dist/docs/index.md +2 -1
- package/dist/docs/page-index.md +146 -0
- package/dist/docs/recipes/adapt-a-game-for-walkthroughs.md +1 -1
- package/dist/docs/recipes/adapt-ui-for-observers.md +1 -1
- package/dist/docs/recipes/create-presentation.md +11 -0
- package/dist/docs/recipes/create-scenario-editor.md +1 -0
- package/dist/docs/recipes/create-session-ui.md +2 -1
- package/dist/docs/recipes/create-setup.md +1 -0
- package/dist/docs/recipes/create-user-interface.md +1 -0
- package/dist/docs/recipes/create-waiting-room-ui.md +1 -0
- package/dist/docs/recipes/design-state-for-concurrent-writes.md +1 -1
- package/dist/docs/recipes/e2e-testing.md +19 -20
- package/dist/docs/recipes/fix-duplicate-packages.md +2 -2
- package/dist/docs/recipes/index.md +3 -0
- package/dist/docs/recipes/screenshot-a-surface.md +80 -0
- package/dist/docs/recipes/test-a-multi-role-game.md +1 -1
- package/dist/docs/recipes/use-request-tick.md +2 -2
- package/dist/execution/config-resolver.d.ts +4 -1
- package/dist/playwright.js +32232 -0
- package/dist/runtime/manifest-version.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/templates/package/CLAUDE.md.template +14 -5
- package/dist/templates/package/DESIGN.md.liquid +39 -7
- package/dist/templates/package/README.md.liquid +1 -1
- 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/global-setup.ts.template +7 -18
- package/dist/templates/package/playwright.config.ts.liquid +8 -11
- package/dist/templates/package/pnpm-workspace.yaml.template +13 -0
- package/dist/templates/starter-game/capabilities/pacing/capability.sdk.json +18 -0
- package/dist/templates/starter-game/package.json +2 -0
- package/dist/templates/starter-game/playwright.config.ts +8 -11
- package/dist/templates/starter-game/presentation/defaults.ts +52 -0
- package/dist/templates/starter-game/presentation/index.html +20 -0
- package/dist/templates/starter-game/presentation/presentation.sdk.json +10 -0
- package/dist/templates/starter-game/presentation/src/App.tsx +55 -0
- package/dist/templates/starter-game/presentation/src/Band.tsx +40 -0
- package/dist/templates/starter-game/presentation/src/Slides.tsx +415 -0
- package/dist/templates/starter-game/presentation/src/WeatherIcon.tsx +21 -0
- package/dist/templates/starter-game/presentation/src/i18n.ts +88 -0
- package/dist/templates/starter-game/presentation/src/main.tsx +15 -0
- package/dist/templates/starter-game/presentation/src/stalls.test.ts +196 -0
- package/dist/templates/starter-game/presentation/src/stalls.ts +199 -0
- package/dist/templates/starter-game/presentation/types.ts +94 -0
- package/dist/templates/starter-game/seriousgaming.sdk.json +2 -1
- package/dist/templates/starter-game/session/defaults.ts +6 -0
- package/dist/templates/starter-game/session/index.html +1 -1
- package/dist/templates/starter-game/session/session.sdk.json +2 -2
- package/dist/templates/starter-game/session/src/App.test.tsx +436 -115
- package/dist/templates/starter-game/session/src/App.tsx +372 -222
- package/dist/templates/starter-game/session/src/JoinCodes.tsx +184 -0
- package/dist/templates/starter-game/session/src/ManagePanel.tsx +188 -0
- package/dist/templates/starter-game/session/src/Results.tsx +340 -0
- package/dist/templates/starter-game/session/src/SessionBar.tsx +179 -0
- package/dist/templates/starter-game/session/src/SessionPanels.tsx +105 -0
- package/dist/templates/starter-game/session/src/SidePanel.tsx +89 -0
- package/dist/templates/starter-game/session/src/StallCard.tsx +253 -0
- package/dist/templates/starter-game/session/src/TopBar.tsx +36 -0
- package/dist/templates/starter-game/session/src/i18n.ts +91 -24
- package/dist/templates/starter-game/session/src/status.ts +28 -0
- package/dist/templates/starter-game/session/types.ts +8 -2
- package/dist/templates/starter-game/shared/Awning.tsx +31 -0
- package/dist/templates/starter-game/shared/HostLogo.test.tsx +38 -0
- package/dist/templates/starter-game/shared/HostLogo.tsx +48 -0
- package/dist/templates/starter-game/shared/StallIcons.tsx +83 -0
- package/dist/templates/starter-game/shared/days.ts +11 -0
- package/dist/templates/starter-game/shared/format.test.ts +13 -0
- package/dist/templates/starter-game/{ui/src → shared}/format.ts +1 -1
- package/dist/templates/starter-game/testing/e2e/game.spec.ts +43 -9
- package/dist/templates/starter-game/testing/e2e/global-setup.ts +7 -18
- package/dist/templates/starter-game/ui/defaults.ts +3 -0
- package/dist/templates/starter-game/ui/src/App.test.tsx +197 -29
- package/dist/templates/starter-game/ui/src/App.tsx +176 -99
- package/dist/templates/starter-game/ui/src/DayBar.test.tsx +50 -7
- package/dist/templates/starter-game/ui/src/DayBar.tsx +96 -38
- package/dist/templates/starter-game/ui/src/DaysTable.tsx +69 -0
- package/dist/templates/starter-game/ui/src/FirstDay.tsx +37 -0
- package/dist/templates/starter-game/ui/src/Header.tsx +257 -0
- package/dist/templates/starter-game/ui/src/Lesson.tsx +63 -0
- package/dist/templates/starter-game/ui/src/MakeRow.tsx +98 -71
- package/dist/templates/starter-game/ui/src/Notices.tsx +59 -0
- package/dist/templates/starter-game/ui/src/PastDay.tsx +88 -0
- package/dist/templates/starter-game/ui/src/Section.tsx +26 -26
- package/dist/templates/starter-game/ui/src/ThemeToggle.tsx +25 -11
- package/dist/templates/starter-game/ui/src/TodayPanel.test.tsx +37 -33
- package/dist/templates/starter-game/ui/src/TodayPanel.tsx +66 -52
- package/dist/templates/starter-game/ui/src/WeatherCard.tsx +47 -0
- package/dist/templates/starter-game/ui/src/WeekOver.tsx +145 -0
- package/dist/templates/starter-game/ui/src/YesterdayPanel.tsx +65 -114
- package/dist/templates/starter-game/ui/src/days.ts +58 -0
- package/dist/templates/starter-game/ui/src/i18n.ts +86 -32
- package/dist/templates/starter-game/ui/src/test-helpers.ts +1 -0
- package/dist/templates/starter-game/ui/src/theme.ts +8 -8
- package/dist/templates/starter-game/ui/types.ts +6 -0
- package/dist/templates/starter-game/ui/ui.sdk.json +1 -1
- package/dist/templates/starter-game/validators/daylimit/defaults.ts +13 -0
- package/dist/templates/starter-game/validators/daylimit/logic/logic.test.ts +20 -0
- package/dist/templates/starter-game/validators/daylimit/logic/logic.ts +23 -0
- package/dist/templates/starter-game/validators/daylimit/types.ts +23 -0
- package/dist/templates/starter-game/validators/daylimit/validator.sdk.json +10 -0
- package/dist/templates/starter-game/waiting_room/src/App.test.tsx +83 -5
- package/dist/templates/starter-game/waiting_room/src/App.tsx +262 -119
- package/dist/templates/starter-game/waiting_room/src/i18n.ts +8 -4
- package/dist/utils/error-codes.d.ts +12 -0
- package/dist/utils/prompt.d.ts +5 -5
- package/dist/utils/resource-scan.d.ts +39 -0
- package/package.json +15 -4
- package/dist/templates/starter-game/session/src/Section.tsx +0 -37
- package/dist/templates/starter-game/session/src/TeamDoor.tsx +0 -96
- package/dist/templates/starter-game/session/src/format.ts +0 -8
- package/dist/templates/starter-game/ui/src/HistoryPanel.test.tsx +0 -74
- package/dist/templates/starter-game/ui/src/HistoryPanel.tsx +0 -120
- package/dist/templates/starter-game/ui/src/HostLogo.test.tsx +0 -25
- package/dist/templates/starter-game/ui/src/HostLogo.tsx +0 -38
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
connectSession,
|
|
4
|
+
resolveSession
|
|
5
|
+
} from "./cli-GTSGLN3Z.js";
|
|
6
|
+
import "./cli-WU43JT4T.js";
|
|
7
|
+
import {
|
|
8
|
+
DevShell,
|
|
9
|
+
parseRoute
|
|
10
|
+
} from "./cli-G6KELFSX.js";
|
|
11
|
+
import "./cli-BWX5E7TQ.js";
|
|
12
|
+
import "./cli-V4GHRWOV.js";
|
|
13
|
+
import "./cli-ILKCQNM6.js";
|
|
14
|
+
import "./cli-JMZLT65J.js";
|
|
15
|
+
import "./cli-LFM7GJHI.js";
|
|
16
|
+
import "./cli-C6TH5S7K.js";
|
|
17
|
+
import {
|
|
18
|
+
loadEnvironmentConfig
|
|
19
|
+
} from "./cli-TDSQSCX4.js";
|
|
20
|
+
import "./cli-SRHBXZCN.js";
|
|
21
|
+
import "./cli-GUXKQMJ7.js";
|
|
22
|
+
import "./cli-4LKXZQ2B.js";
|
|
23
|
+
import "./cli-MMN4BPO4.js";
|
|
24
|
+
import "./cli-YOTGR3NB.js";
|
|
25
|
+
import "./cli-QUNIRH7A.js";
|
|
26
|
+
import "./cli-VCKOC2EV.js";
|
|
27
|
+
import "./cli-E2NLWIFE.js";
|
|
28
|
+
import "./cli-25RWY5BQ.js";
|
|
29
|
+
import "./cli-QWQMPCL6.js";
|
|
30
|
+
import "./cli-SMFSZF2G.js";
|
|
31
|
+
import "./cli-F2D4GGUA.js";
|
|
32
|
+
import "./cli-4YB3ROVR.js";
|
|
33
|
+
import {
|
|
34
|
+
CliError,
|
|
35
|
+
reportResult
|
|
36
|
+
} from "./cli-N6H6T2E2.js";
|
|
37
|
+
|
|
38
|
+
// cli/commands/screenshot.ts
|
|
39
|
+
import { existsSync } from "fs";
|
|
40
|
+
import { mkdir } from "fs/promises";
|
|
41
|
+
import { createRequire } from "module";
|
|
42
|
+
import { dirname, join, resolve } from "path";
|
|
43
|
+
import { pathToFileURL } from "url";
|
|
44
|
+
|
|
45
|
+
// cli/client/dev-server.ts
|
|
46
|
+
async function startDevServer(options) {
|
|
47
|
+
const environment = loadEnvironmentConfig(options.packagePath);
|
|
48
|
+
const shell = new DevShell({
|
|
49
|
+
packagePath: options.packagePath,
|
|
50
|
+
port: options.port ?? 0,
|
|
51
|
+
isolated: true,
|
|
52
|
+
...options.teams === void 0 ? {} : { teams: options.teams },
|
|
53
|
+
...options.participants === void 0 ? {} : { participants: options.participants },
|
|
54
|
+
...options.scenarioId === void 0 ? {} : { scenarioId: options.scenarioId },
|
|
55
|
+
...options.locale === void 0 ? {} : { locale: options.locale },
|
|
56
|
+
...options.clock === void 0 ? {} : { clock: options.clock },
|
|
57
|
+
...options.callbacks === void 0 ? {} : { callbacks: options.callbacks },
|
|
58
|
+
...options.reinitOnChange ? { reinitOnChange: true } : {},
|
|
59
|
+
...options.builtSurfaces === void 0 ? {} : { builtSurfaces: options.builtSurfaces },
|
|
60
|
+
...environment.seriousGamingApiKey === void 0 ? {} : { seriousGamingApiKey: environment.seriousGamingApiKey },
|
|
61
|
+
...environment.seriousGamingApiHost === void 0 ? {} : { seriousGamingApiHost: environment.seriousGamingApiHost },
|
|
62
|
+
...environment.elevenLabsApiKey === void 0 ? {} : { elevenLabsApiKey: environment.elevenLabsApiKey }
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
await shell.start();
|
|
66
|
+
} catch (error) {
|
|
67
|
+
await shell.stop().catch(() => {
|
|
68
|
+
});
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
let stopping = null;
|
|
72
|
+
return {
|
|
73
|
+
url: shell.url,
|
|
74
|
+
assetUrl: shell.assetUrl,
|
|
75
|
+
stop() {
|
|
76
|
+
stopping ??= shell.stop();
|
|
77
|
+
return stopping;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// cli/commands/screenshot.ts
|
|
83
|
+
var DEFAULT_WIDTH = 1280;
|
|
84
|
+
var DEFAULT_HEIGHT = 800;
|
|
85
|
+
var DEFAULT_TIMEOUT_SECONDS = 30;
|
|
86
|
+
var MAX_DIMENSION = 16384;
|
|
87
|
+
var MISSING_HINT = "Add it to the package with `pnpm add -D @playwright/test`, then run `pnpm exec playwright install chromium`.";
|
|
88
|
+
async function screenshotCommand(path, options, dependencies = {}) {
|
|
89
|
+
const packagePath = resolve(options.workingDir);
|
|
90
|
+
const plan = planScreenshot(path, options, packagePath);
|
|
91
|
+
const chromium = await (dependencies.loadPlaywright ?? loadPlaywright)(packagePath);
|
|
92
|
+
if (!chromium) {
|
|
93
|
+
throw new CliError(
|
|
94
|
+
"BROWSER_MISSING",
|
|
95
|
+
"sdk screenshot drives Playwright, and this package does not depend on it.",
|
|
96
|
+
{ hint: MISSING_HINT }
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
const result = await withServer(packagePath, plan, async (url, server) => {
|
|
100
|
+
const problems = await capture(chromium, `${url}${plan.target}`, plan);
|
|
101
|
+
return {
|
|
102
|
+
path: plan.out,
|
|
103
|
+
url: `${url}${plan.target}`,
|
|
104
|
+
width: plan.width,
|
|
105
|
+
height: plan.height,
|
|
106
|
+
fullPage: plan.fullPage,
|
|
107
|
+
server,
|
|
108
|
+
...problems
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
reportResult(result, () => {
|
|
112
|
+
console.log(`Saved ${result.path} (${result.width}x${result.height}) from ${result.url}`);
|
|
113
|
+
printProblems(result);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function planScreenshot(path, options, packagePath) {
|
|
117
|
+
if (!path.startsWith("/")) {
|
|
118
|
+
throw new CliError(
|
|
119
|
+
"USAGE_BAD_ARGUMENT",
|
|
120
|
+
`"${path}" is not a console path: it starts with /, such as /team/1/player/1`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
const url = new URL(path, "http://localhost");
|
|
124
|
+
const route = parseRoute(url.pathname, url.search);
|
|
125
|
+
if (route.kind === "console" && url.pathname !== "/") {
|
|
126
|
+
throw new CliError(
|
|
127
|
+
"USAGE_BAD_ARGUMENT",
|
|
128
|
+
`"${url.pathname}" names no surface. Use / for the session surface, /team/<n>/player/<n>, /team/<n>/observe, /team/<n>/waiting-room, /walkthrough, /setup, /scenario-editor?scenario=<id>, /presentation, /guide or /print`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
const scheme = options.scheme;
|
|
132
|
+
if (scheme !== void 0 && scheme !== "light" && scheme !== "dark" && scheme !== "system") {
|
|
133
|
+
throw new CliError(
|
|
134
|
+
"USAGE_BAD_FLAG",
|
|
135
|
+
`--scheme takes light, dark or system, and got "${scheme}"`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
url.searchParams.set("bare", "");
|
|
139
|
+
if (scheme !== void 0) url.searchParams.set("scheme", scheme);
|
|
140
|
+
if (options.brand !== void 0) url.searchParams.set("brand", options.brand);
|
|
141
|
+
const width = dimension(options.width, "--width", DEFAULT_WIDTH);
|
|
142
|
+
const height = dimension(options.height, "--height", DEFAULT_HEIGHT);
|
|
143
|
+
const timeout = positive(options.timeout, "--timeout", DEFAULT_TIMEOUT_SECONDS);
|
|
144
|
+
const out = options.out === void 0 ? join(
|
|
145
|
+
packagePath,
|
|
146
|
+
".seriousgaming-sdk",
|
|
147
|
+
"screenshots",
|
|
148
|
+
`${slug(url.pathname)}-${width}x${height}.png`
|
|
149
|
+
) : resolve(packagePath, options.out);
|
|
150
|
+
if (!out.toLowerCase().endsWith(".png")) {
|
|
151
|
+
throw new CliError("USAGE_BAD_FLAG", `--out names a PNG file, and got "${options.out}"`);
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
// `bare` is a flag, not a value: `?bare=` reads as one, as the console's own links avoid.
|
|
155
|
+
target: `${url.pathname}${url.search.replace(/([?&]bare)=(?=&|$)/, "$1")}`,
|
|
156
|
+
route,
|
|
157
|
+
width,
|
|
158
|
+
height,
|
|
159
|
+
...scheme === void 0 ? {} : { scheme },
|
|
160
|
+
...options.brand === void 0 ? {} : { brand: options.brand },
|
|
161
|
+
...options.locale === void 0 ? {} : { locale: options.locale },
|
|
162
|
+
fullPage: options.fullPage === true,
|
|
163
|
+
out,
|
|
164
|
+
timeoutMs: timeout * 1e3
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function dimension(value, flag, fallback) {
|
|
168
|
+
const parsed = positive(value, flag, fallback);
|
|
169
|
+
if (!Number.isInteger(parsed) || parsed > MAX_DIMENSION) {
|
|
170
|
+
throw new CliError(
|
|
171
|
+
"USAGE_BAD_FLAG",
|
|
172
|
+
`${flag} takes a whole number of pixels up to ${MAX_DIMENSION}, and got "${value}"`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
return parsed;
|
|
176
|
+
}
|
|
177
|
+
function positive(value, flag, fallback) {
|
|
178
|
+
if (value === void 0) return fallback;
|
|
179
|
+
const parsed = Number(value);
|
|
180
|
+
if (!/^\d+(\.\d+)?$/.test(value) || parsed <= 0) {
|
|
181
|
+
throw new CliError("USAGE_BAD_FLAG", `${flag} takes a positive number, and got "${value}"`);
|
|
182
|
+
}
|
|
183
|
+
return parsed;
|
|
184
|
+
}
|
|
185
|
+
function slug(pathname) {
|
|
186
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
187
|
+
return parts.length === 0 ? "session" : parts.join("-");
|
|
188
|
+
}
|
|
189
|
+
async function loadPlaywright(packagePath, resolution = {}) {
|
|
190
|
+
const exists = resolution.exists ?? existsSync;
|
|
191
|
+
const requireFrom = resolution.requireFrom ?? createRequire;
|
|
192
|
+
for (const name of ["@playwright/test", "playwright"]) {
|
|
193
|
+
const modules = nodeModulesHolding(packagePath, name, exists);
|
|
194
|
+
if (modules === null) continue;
|
|
195
|
+
let entry;
|
|
196
|
+
try {
|
|
197
|
+
entry = requireFrom(join(modules, "package.json")).resolve(name);
|
|
198
|
+
} catch {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const module = await import(pathToFileURL(entry).href);
|
|
202
|
+
const chromium = module.chromium ?? module.default?.chromium;
|
|
203
|
+
if (chromium) return chromium;
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
function nodeModulesHolding(from, name, exists) {
|
|
208
|
+
let directory = resolve(from);
|
|
209
|
+
for (; ; ) {
|
|
210
|
+
const modules = join(directory, "node_modules");
|
|
211
|
+
if (exists(join(modules, name, "package.json"))) return modules;
|
|
212
|
+
const parent = dirname(directory);
|
|
213
|
+
if (parent === directory) return null;
|
|
214
|
+
directory = parent;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async function launchBrowser(chromium) {
|
|
218
|
+
try {
|
|
219
|
+
return await chromium.launch({ headless: true });
|
|
220
|
+
} catch (error) {
|
|
221
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
222
|
+
if (/Executable doesn't exist|playwright install/i.test(message)) {
|
|
223
|
+
throw new CliError(
|
|
224
|
+
"BROWSER_MISSING",
|
|
225
|
+
"Playwright is installed, but the Chromium it drives is not.",
|
|
226
|
+
{
|
|
227
|
+
hint: "Run `pnpm exec playwright install chromium` in the package.",
|
|
228
|
+
cause: error
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
throw new CliError("BROWSER_MISSING", `Chromium did not start: ${message.split("\n")[0]}`, {
|
|
233
|
+
hint: "Run `pnpm exec playwright install chromium` in the package.",
|
|
234
|
+
cause: error
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
async function withServer(packagePath, plan, work) {
|
|
239
|
+
let found = null;
|
|
240
|
+
try {
|
|
241
|
+
found = await resolveSession({ packagePath, autoStart: false, runKind: plan.route.run });
|
|
242
|
+
} catch (error) {
|
|
243
|
+
if (!(error instanceof CliError && error.code === "NO_SESSION")) throw error;
|
|
244
|
+
}
|
|
245
|
+
if (found?.url) {
|
|
246
|
+
const url = found.url;
|
|
247
|
+
return prepared(url, found, plan, false, () => work(url, "running"));
|
|
248
|
+
}
|
|
249
|
+
console.error("No dev server is running, so one is starting for this capture.");
|
|
250
|
+
const server = await startDevServer({ packagePath });
|
|
251
|
+
try {
|
|
252
|
+
const session = connectSession(server.url, plan.route.run);
|
|
253
|
+
if (plan.route.kind !== "setup" && (await session.state()).session.inSetup) {
|
|
254
|
+
await session.send({ type: "play" });
|
|
255
|
+
}
|
|
256
|
+
return await prepared(server.url, session, plan, true, () => work(server.url, "started"));
|
|
257
|
+
} finally {
|
|
258
|
+
await server.stop();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
async function prepared(url, session, plan, own, work) {
|
|
262
|
+
if (plan.brand !== void 0) {
|
|
263
|
+
const { brands } = await fetchJson(`${url}/api/brands`);
|
|
264
|
+
const ids = brands.map((brand) => brand.id);
|
|
265
|
+
if (!ids.includes(plan.brand)) {
|
|
266
|
+
throw new CliError(
|
|
267
|
+
"USAGE_BAD_FLAG",
|
|
268
|
+
`--brand "${plan.brand}" is not one the dev server offers (${ids.join(", ") || "none"})`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (plan.locale === void 0) return work();
|
|
273
|
+
const locales = await fetchJson(`${url}/api/locales`);
|
|
274
|
+
if (!locales.supported.includes(plan.locale)) {
|
|
275
|
+
throw new CliError(
|
|
276
|
+
"USAGE_BAD_FLAG",
|
|
277
|
+
`--locale "${plan.locale}" is not one of this game's locales (${locales.supported.join(", ")})`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
if (locales.active === plan.locale) return work();
|
|
281
|
+
await setLocale(session, plan.locale);
|
|
282
|
+
try {
|
|
283
|
+
return await work();
|
|
284
|
+
} finally {
|
|
285
|
+
if (!own) await setLocale(session, locales.active).catch(() => {
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async function setLocale(session, locale) {
|
|
290
|
+
const result = await session.send({ type: "setLocale", locale });
|
|
291
|
+
if ("ok" in result && !result.ok) {
|
|
292
|
+
throw new CliError(
|
|
293
|
+
"REFUSED_DENIED",
|
|
294
|
+
result.outcome.message ?? `The session refused the locale "${locale}"`
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
async function fetchJson(url) {
|
|
299
|
+
let response;
|
|
300
|
+
try {
|
|
301
|
+
response = await fetch(url);
|
|
302
|
+
} catch (error) {
|
|
303
|
+
throw new CliError(
|
|
304
|
+
"DEV_SERVER_UNREACHABLE",
|
|
305
|
+
`The dev server at ${new URL(url).origin} did not answer: ${error instanceof Error ? error.message : String(error)}`
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
if (!response.ok) {
|
|
309
|
+
throw new CliError(
|
|
310
|
+
"DEV_SERVER_OUTDATED",
|
|
311
|
+
`The dev server did not answer ${new URL(url).pathname} (HTTP ${response.status})`,
|
|
312
|
+
{ hint: "Restart the dev server: `sdk dev stop`, then run the command again." }
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
return await response.json();
|
|
316
|
+
}
|
|
317
|
+
function readinessScript(route) {
|
|
318
|
+
const content = route.kind === "guide" ? '[data-testid="guide-content"]' : route.kind === "print" ? '[data-testid="print-sheets"]' : null;
|
|
319
|
+
return `(() => {
|
|
320
|
+
const frames = [...document.querySelectorAll('[data-surface-state]')];
|
|
321
|
+
if (frames.some((frame) => frame.dataset.surfaceState === 'lost')) return 'lost';
|
|
322
|
+
if (frames.length > 0) {
|
|
323
|
+
return frames.every((frame) => frame.dataset.surfaceState === 'rendered') ? 'rendered' : false;
|
|
324
|
+
}
|
|
325
|
+
const root = document.getElementById('root');
|
|
326
|
+
if (!root || root.childElementCount === 0) return false;
|
|
327
|
+
if (document.querySelector('[data-testid="console-loading"]')) return false;
|
|
328
|
+
return ${content === null ? "'rendered'" : `document.querySelector(${JSON.stringify(content)}) ? 'rendered' : false`};
|
|
329
|
+
})()`;
|
|
330
|
+
}
|
|
331
|
+
var SURFACE_STATE_SCRIPT = `[...document.querySelectorAll('[data-surface-state]')].map((frame) => frame.dataset.surfaceState)`;
|
|
332
|
+
async function capture(chromium, url, plan) {
|
|
333
|
+
const browser = await launchBrowser(chromium);
|
|
334
|
+
const problems = {
|
|
335
|
+
consoleErrors: [],
|
|
336
|
+
failedRequests: [],
|
|
337
|
+
uncaughtExceptions: []
|
|
338
|
+
};
|
|
339
|
+
try {
|
|
340
|
+
const context = await browser.newContext({
|
|
341
|
+
viewport: { width: plan.width, height: plan.height },
|
|
342
|
+
...plan.scheme === "light" || plan.scheme === "dark" ? { colorScheme: plan.scheme } : {}
|
|
343
|
+
});
|
|
344
|
+
const page = await context.newPage();
|
|
345
|
+
watch(page, problems);
|
|
346
|
+
const deadline = Date.now() + plan.timeoutMs;
|
|
347
|
+
try {
|
|
348
|
+
await page.goto(url, { waitUntil: "load", timeout: plan.timeoutMs });
|
|
349
|
+
const state = await page.waitForFunction(readinessScript(plan.route), void 0, {
|
|
350
|
+
timeout: Math.max(1, deadline - Date.now()),
|
|
351
|
+
polling: 100
|
|
352
|
+
});
|
|
353
|
+
if (await settled(state) === "lost") {
|
|
354
|
+
throw notRendered(
|
|
355
|
+
`The surface at ${plan.target} did not connect to the console. Check its console for an error.`,
|
|
356
|
+
problems
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
} catch (error) {
|
|
360
|
+
if (error instanceof CliError) throw error;
|
|
361
|
+
const states = await page.evaluate(SURFACE_STATE_SCRIPT).catch(() => []);
|
|
362
|
+
throw notRendered(timeoutMessage(plan, states, error), problems);
|
|
363
|
+
}
|
|
364
|
+
if (plan.fullPage) await growToContent(page, plan);
|
|
365
|
+
await mkdir(dirname(plan.out), { recursive: true });
|
|
366
|
+
await page.screenshot({ path: plan.out, fullPage: plan.fullPage, animations: "disabled" });
|
|
367
|
+
return problems;
|
|
368
|
+
} finally {
|
|
369
|
+
await browser.close().catch(() => {
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
async function settled(handle) {
|
|
374
|
+
const value = handle;
|
|
375
|
+
return typeof value?.jsonValue === "function" ? value.jsonValue() : handle;
|
|
376
|
+
}
|
|
377
|
+
function timeoutMessage(plan, states, error) {
|
|
378
|
+
const seconds = plan.timeoutMs / 1e3;
|
|
379
|
+
if (states.includes("unconfirmed")) {
|
|
380
|
+
return `The surface at ${plan.target} connected but did not report its first paint within ${seconds}s. It most likely threw while rendering: see uncaughtExceptions and consoleErrors.`;
|
|
381
|
+
}
|
|
382
|
+
if (states.length > 0) {
|
|
383
|
+
return `The surface at ${plan.target} did not connect within ${seconds}s.`;
|
|
384
|
+
}
|
|
385
|
+
const reason = error instanceof Error ? error.message.split("\n")[0] : String(error);
|
|
386
|
+
return `The page at ${plan.target} did not finish loading within ${seconds}s: ${reason}`;
|
|
387
|
+
}
|
|
388
|
+
function notRendered(message, problems) {
|
|
389
|
+
return new CliError("SURFACE_NOT_RENDERED", message, {
|
|
390
|
+
hint: "Open the same path in a browser to see it, or pass --timeout for a slower surface.",
|
|
391
|
+
details: { ...problems }
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function watch(page, problems) {
|
|
395
|
+
page.on("console", (message) => {
|
|
396
|
+
if (message.type() !== "error") return;
|
|
397
|
+
const url = message.location().url;
|
|
398
|
+
problems.consoleErrors.push({ text: message.text(), ...url ? { url } : {} });
|
|
399
|
+
});
|
|
400
|
+
page.on("pageerror", (error) => {
|
|
401
|
+
problems.uncaughtExceptions.push({
|
|
402
|
+
message: error.message,
|
|
403
|
+
...error.stack ? { stack: error.stack } : {}
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
page.on("requestfailed", (request) => {
|
|
407
|
+
problems.failedRequests.push({
|
|
408
|
+
url: request.url(),
|
|
409
|
+
method: request.method(),
|
|
410
|
+
failure: request.failure()?.errorText ?? "failed"
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
page.on("response", (response) => {
|
|
414
|
+
if (response.status() < 400) return;
|
|
415
|
+
problems.failedRequests.push({
|
|
416
|
+
url: response.url(),
|
|
417
|
+
method: response.request().method(),
|
|
418
|
+
status: response.status()
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
var OVERFLOW_SCRIPT = `(() => {
|
|
423
|
+
let overflow = Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0) - window.innerHeight;
|
|
424
|
+
for (const element of document.querySelectorAll('*')) {
|
|
425
|
+
const scrolls = /^(auto|scroll)$/.test(getComputedStyle(element).overflowY);
|
|
426
|
+
if (scrolls) overflow = Math.max(overflow, element.scrollHeight - element.clientHeight);
|
|
427
|
+
}
|
|
428
|
+
return overflow;
|
|
429
|
+
})()`;
|
|
430
|
+
async function growToContent(page, plan) {
|
|
431
|
+
const frame = page.mainFrame().childFrames()[0];
|
|
432
|
+
if (!frame) return;
|
|
433
|
+
const overflow = await frame.evaluate(OVERFLOW_SCRIPT).catch(() => 0);
|
|
434
|
+
if (overflow <= 0) return;
|
|
435
|
+
await page.setViewportSize({
|
|
436
|
+
width: plan.width,
|
|
437
|
+
height: Math.min(plan.height + overflow, MAX_DIMENSION)
|
|
438
|
+
});
|
|
439
|
+
await frame.evaluate(
|
|
440
|
+
"new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(() => done(true))))"
|
|
441
|
+
).catch(() => {
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function printProblems(problems) {
|
|
445
|
+
const lines = [
|
|
446
|
+
...problems.uncaughtExceptions.map((error) => ` Uncaught: ${error.message}`),
|
|
447
|
+
...problems.consoleErrors.map((error) => ` Console error: ${error.text}`),
|
|
448
|
+
...problems.failedRequests.map(
|
|
449
|
+
(request) => ` Failed request: ${request.method} ${request.url} (${request.status ?? request.failure})`
|
|
450
|
+
)
|
|
451
|
+
];
|
|
452
|
+
if (lines.length === 0) return;
|
|
453
|
+
console.log(`
|
|
454
|
+
The page reported ${lines.length} problem${lines.length === 1 ? "" : "s"}:`);
|
|
455
|
+
for (const line of lines) console.log(line);
|
|
456
|
+
}
|
|
457
|
+
export {
|
|
458
|
+
launchBrowser,
|
|
459
|
+
loadPlaywright,
|
|
460
|
+
planScreenshot,
|
|
461
|
+
readinessScript,
|
|
462
|
+
screenshotCommand
|
|
463
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadConfig
|
|
4
|
+
} from "./cli-SMFSZF2G.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,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
createSettingsEditor
|
|
4
|
+
} from "./cli-AK7OIPWY.js";
|
|
5
|
+
import "./cli-GGPDQNM3.js";
|
|
6
|
+
import "./cli-UJ4UCL2Z.js";
|
|
7
|
+
import "./cli-S5IVGDDD.js";
|
|
8
|
+
import "./cli-YVVXUD2G.js";
|
|
9
|
+
import "./cli-4UWFQNGF.js";
|
|
10
|
+
import "./cli-FYINNRML.js";
|
|
11
|
+
import "./cli-IUS2YCD3.js";
|
|
12
|
+
import "./cli-QUNIRH7A.js";
|
|
13
|
+
import "./cli-BYJWFFCF.js";
|
|
14
|
+
import "./cli-XSVGKI3R.js";
|
|
15
|
+
import "./cli-MBNMPVDC.js";
|
|
16
|
+
import "./cli-GFBGYFYD.js";
|
|
17
|
+
import "./cli-UELGBQG7.js";
|
|
18
|
+
import "./cli-ZTWOE3ZT.js";
|
|
19
|
+
import "./cli-4BV45LBH.js";
|
|
20
|
+
import "./cli-4AKVLEC4.js";
|
|
21
|
+
import "./cli-VCKOC2EV.js";
|
|
22
|
+
import "./cli-E2NLWIFE.js";
|
|
23
|
+
import "./cli-25RWY5BQ.js";
|
|
24
|
+
import "./cli-QWQMPCL6.js";
|
|
25
|
+
import "./cli-SMFSZF2G.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,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
CliError
|
|
4
|
+
} from "./cli-N6H6T2E2.js";
|
|
5
|
+
|
|
6
|
+
// cli/utils/sdk-tools-version.ts
|
|
7
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { dirname, join } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
var PACKAGE_NAME = "@seriousgaming/sdk-tools";
|
|
11
|
+
function readSdkToolsVersion() {
|
|
12
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
try {
|
|
14
|
+
for (const candidate of [join(here, "../../package.json"), join(here, "../package.json")]) {
|
|
15
|
+
if (!existsSync(candidate)) continue;
|
|
16
|
+
const packageJson = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
17
|
+
if (packageJson.name === PACKAGE_NAME) return packageJson.version || "0.0.0";
|
|
18
|
+
}
|
|
19
|
+
} catch (error) {
|
|
20
|
+
throw new CliError(
|
|
21
|
+
"SDK_INCOMPLETE",
|
|
22
|
+
`Error reading version: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
23
|
+
{ cause: error }
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
throw new CliError("SDK_INCOMPLETE", `Error reading version: no ${PACKAGE_NAME} package.json`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
readSdkToolsVersion
|
|
31
|
+
};
|