@forbocai/test-game 0.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/cli.mjs ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runGame
4
+ } from "./chunk-4XIOL463.mjs";
5
+
6
+ // src/cli.ts
7
+ var usage = () => {
8
+ console.log(`
9
+ \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
10
+ \u2551 ECHOES OF THE SPIRE // TERMINAL HARNESS \u2551
11
+ \u2551 SYSTEM_OVERRIDE :: NEURAL_LINK_ESTABLISHED \u2551
12
+ \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
13
+
14
+ \u16A0 \u16A2 \u16A6 \u16A8 \u16B1 \u16B2 \u16B7 \u16B9
15
+
16
+ Usage:
17
+ forbocai-test-game --mode autoplay|manual
18
+
19
+ Defaults:
20
+ --mode autoplay
21
+
22
+ [ok] Command completed in shell mode.
23
+ [error] LOG_ERR_CRITICAL - command failed and was recorded.
24
+ `);
25
+ };
26
+ var getArgValue = (name) => {
27
+ const idx = process.argv.findIndex((a) => a === name);
28
+ if (idx === -1) return void 0;
29
+ return process.argv[idx + 1];
30
+ };
31
+ var runCli = async () => {
32
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
33
+ usage();
34
+ return;
35
+ }
36
+ const mode = getArgValue("--mode") || "autoplay";
37
+ if (!["manual", "autoplay"].includes(mode)) {
38
+ throw new Error(`Invalid mode: ${mode}`);
39
+ }
40
+ const result = await runGame({ mode });
41
+ return result;
42
+ };
43
+ var __test = {
44
+ usage,
45
+ getArgValue
46
+ };
47
+ if (process.env.NODE_ENV !== "test") {
48
+ runCli().catch((error) => {
49
+ console.error(error);
50
+ process.exit(1);
51
+ });
52
+ }
53
+ export {
54
+ __test,
55
+ runCli
56
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Shared type contracts for command coverage, transcript, and scenario runtime.
3
+ * In the quiet between turns, the protocol still remembers.
4
+ */
5
+ type ExecutionMode = 'simulate' | 'shell';
6
+ type PlayMode = 'manual' | 'autoplay';
7
+ type CommandGroup = 'status' | 'npc_lifecycle' | 'npc_process_chat' | 'memory_list' | 'memory_recall' | 'memory_store' | 'memory_clear' | 'memory_export' | 'bridge_rules' | 'bridge_validate' | 'bridge_preset' | 'soul_export' | 'soul_import' | 'soul_list' | 'soul_chat' | 'ghost_lifecycle' | 'cortex_init';
8
+ type CommandSpec = {
9
+ group: CommandGroup;
10
+ command: string;
11
+ expectedRoutes: string[];
12
+ };
13
+ type TranscriptStatus = 'ok' | 'error' | 'simulated';
14
+ type TranscriptEntry = {
15
+ id: string;
16
+ scenarioId: string;
17
+ commandGroup: CommandGroup;
18
+ command: string;
19
+ expectedRoutes: string[];
20
+ status: TranscriptStatus;
21
+ output: string;
22
+ at: string;
23
+ };
24
+ type ScenarioStep = {
25
+ id: string;
26
+ title: string;
27
+ description: string;
28
+ eventType: 'stealth' | 'social' | 'escape' | 'persistence';
29
+ commands: CommandSpec[];
30
+ };
31
+ type GameRunResult = {
32
+ complete: boolean;
33
+ missingGroups: CommandGroup[];
34
+ transcript: TranscriptEntry[];
35
+ summary: string;
36
+ };
37
+
38
+ /**
39
+ * Runs a full game session in manual or autoplay mode.
40
+ * The run is marked incomplete if any required CLI command group is missing.
41
+ */
42
+ declare const runGame: ({ mode, execute }: {
43
+ mode: PlayMode;
44
+ execute: ExecutionMode;
45
+ }) => Promise<GameRunResult>;
46
+
47
+ /**
48
+ * Canonical list of command groups required for a complete harness run.
49
+ * Fail-closed doctrine: skipped paths are treated as broken reality.
50
+ */
51
+
52
+ declare const REQUIRED_GROUPS: CommandGroup[];
53
+
54
+ export { type CommandGroup, type ExecutionMode, type GameRunResult, type PlayMode, REQUIRED_GROUPS, type ScenarioStep, runGame };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Shared type contracts for command coverage, transcript, and scenario runtime.
3
+ * In the quiet between turns, the protocol still remembers.
4
+ */
5
+ type ExecutionMode = 'simulate' | 'shell';
6
+ type PlayMode = 'manual' | 'autoplay';
7
+ type CommandGroup = 'status' | 'npc_lifecycle' | 'npc_process_chat' | 'memory_list' | 'memory_recall' | 'memory_store' | 'memory_clear' | 'memory_export' | 'bridge_rules' | 'bridge_validate' | 'bridge_preset' | 'soul_export' | 'soul_import' | 'soul_list' | 'soul_chat' | 'ghost_lifecycle' | 'cortex_init';
8
+ type CommandSpec = {
9
+ group: CommandGroup;
10
+ command: string;
11
+ expectedRoutes: string[];
12
+ };
13
+ type TranscriptStatus = 'ok' | 'error' | 'simulated';
14
+ type TranscriptEntry = {
15
+ id: string;
16
+ scenarioId: string;
17
+ commandGroup: CommandGroup;
18
+ command: string;
19
+ expectedRoutes: string[];
20
+ status: TranscriptStatus;
21
+ output: string;
22
+ at: string;
23
+ };
24
+ type ScenarioStep = {
25
+ id: string;
26
+ title: string;
27
+ description: string;
28
+ eventType: 'stealth' | 'social' | 'escape' | 'persistence';
29
+ commands: CommandSpec[];
30
+ };
31
+ type GameRunResult = {
32
+ complete: boolean;
33
+ missingGroups: CommandGroup[];
34
+ transcript: TranscriptEntry[];
35
+ summary: string;
36
+ };
37
+
38
+ /**
39
+ * Runs a full game session in manual or autoplay mode.
40
+ * The run is marked incomplete if any required CLI command group is missing.
41
+ */
42
+ declare const runGame: ({ mode, execute }: {
43
+ mode: PlayMode;
44
+ execute: ExecutionMode;
45
+ }) => Promise<GameRunResult>;
46
+
47
+ /**
48
+ * Canonical list of command groups required for a complete harness run.
49
+ * Fail-closed doctrine: skipped paths are treated as broken reality.
50
+ */
51
+
52
+ declare const REQUIRED_GROUPS: CommandGroup[];
53
+
54
+ export { type CommandGroup, type ExecutionMode, type GameRunResult, type PlayMode, REQUIRED_GROUPS, type ScenarioStep, runGame };