@sharpee/ext-testing 0.9.61-beta

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 (121) hide show
  1. package/LICENSE +21 -0
  2. package/dist/annotations/context.d.ts +16 -0
  3. package/dist/annotations/context.d.ts.map +1 -0
  4. package/dist/annotations/context.js +42 -0
  5. package/dist/annotations/context.js.map +1 -0
  6. package/dist/annotations/index.d.ts +6 -0
  7. package/dist/annotations/index.d.ts.map +1 -0
  8. package/dist/annotations/index.js +12 -0
  9. package/dist/annotations/index.js.map +1 -0
  10. package/dist/annotations/store.d.ts +11 -0
  11. package/dist/annotations/store.d.ts.map +1 -0
  12. package/dist/annotations/store.js +191 -0
  13. package/dist/annotations/store.js.map +1 -0
  14. package/dist/checkpoints/index.d.ts +3 -0
  15. package/dist/checkpoints/index.d.ts.map +1 -0
  16. package/dist/checkpoints/index.js +12 -0
  17. package/dist/checkpoints/index.js.map +1 -0
  18. package/dist/checkpoints/serializer.d.ts +21 -0
  19. package/dist/checkpoints/serializer.d.ts.map +1 -0
  20. package/dist/checkpoints/serializer.js +95 -0
  21. package/dist/checkpoints/serializer.js.map +1 -0
  22. package/dist/checkpoints/store.d.ts +20 -0
  23. package/dist/checkpoints/store.d.ts.map +1 -0
  24. package/dist/checkpoints/store.js +193 -0
  25. package/dist/checkpoints/store.js.map +1 -0
  26. package/dist/commands/index.d.ts +2 -0
  27. package/dist/commands/index.d.ts.map +1 -0
  28. package/dist/commands/index.js +8 -0
  29. package/dist/commands/index.js.map +1 -0
  30. package/dist/commands/registry.d.ts +28 -0
  31. package/dist/commands/registry.d.ts.map +1 -0
  32. package/dist/commands/registry.js +70 -0
  33. package/dist/commands/registry.js.map +1 -0
  34. package/dist/context/debug-context.d.ts +21 -0
  35. package/dist/context/debug-context.d.ts.map +1 -0
  36. package/dist/context/debug-context.js +172 -0
  37. package/dist/context/debug-context.js.map +1 -0
  38. package/dist/context/index.d.ts +2 -0
  39. package/dist/context/index.d.ts.map +1 -0
  40. package/dist/context/index.js +8 -0
  41. package/dist/context/index.js.map +1 -0
  42. package/dist/extension.d.ts +78 -0
  43. package/dist/extension.d.ts.map +1 -0
  44. package/dist/extension.js +938 -0
  45. package/dist/extension.js.map +1 -0
  46. package/dist/index.d.ts +40 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +63 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/types.d.ts +375 -0
  51. package/dist/types.d.ts.map +1 -0
  52. package/dist/types.js +8 -0
  53. package/dist/types.js.map +1 -0
  54. package/dist-npm/annotations/context.d.ts +16 -0
  55. package/dist-npm/annotations/context.d.ts.map +1 -0
  56. package/dist-npm/annotations/context.js +42 -0
  57. package/dist-npm/annotations/context.js.map +1 -0
  58. package/dist-npm/annotations/index.d.ts +6 -0
  59. package/dist-npm/annotations/index.d.ts.map +1 -0
  60. package/dist-npm/annotations/index.js +12 -0
  61. package/dist-npm/annotations/index.js.map +1 -0
  62. package/dist-npm/annotations/store.d.ts +11 -0
  63. package/dist-npm/annotations/store.d.ts.map +1 -0
  64. package/dist-npm/annotations/store.js +191 -0
  65. package/dist-npm/annotations/store.js.map +1 -0
  66. package/dist-npm/checkpoints/index.d.ts +3 -0
  67. package/dist-npm/checkpoints/index.d.ts.map +1 -0
  68. package/dist-npm/checkpoints/index.js +12 -0
  69. package/dist-npm/checkpoints/index.js.map +1 -0
  70. package/dist-npm/checkpoints/serializer.d.ts +21 -0
  71. package/dist-npm/checkpoints/serializer.d.ts.map +1 -0
  72. package/dist-npm/checkpoints/serializer.js +95 -0
  73. package/dist-npm/checkpoints/serializer.js.map +1 -0
  74. package/dist-npm/checkpoints/store.d.ts +20 -0
  75. package/dist-npm/checkpoints/store.d.ts.map +1 -0
  76. package/dist-npm/checkpoints/store.js +193 -0
  77. package/dist-npm/checkpoints/store.js.map +1 -0
  78. package/dist-npm/commands/index.d.ts +2 -0
  79. package/dist-npm/commands/index.d.ts.map +1 -0
  80. package/dist-npm/commands/index.js +8 -0
  81. package/dist-npm/commands/index.js.map +1 -0
  82. package/dist-npm/commands/registry.d.ts +28 -0
  83. package/dist-npm/commands/registry.d.ts.map +1 -0
  84. package/dist-npm/commands/registry.js +70 -0
  85. package/dist-npm/commands/registry.js.map +1 -0
  86. package/dist-npm/context/debug-context.d.ts +21 -0
  87. package/dist-npm/context/debug-context.d.ts.map +1 -0
  88. package/dist-npm/context/debug-context.js +172 -0
  89. package/dist-npm/context/debug-context.js.map +1 -0
  90. package/dist-npm/context/index.d.ts +2 -0
  91. package/dist-npm/context/index.d.ts.map +1 -0
  92. package/dist-npm/context/index.js +8 -0
  93. package/dist-npm/context/index.js.map +1 -0
  94. package/dist-npm/extension.d.ts +78 -0
  95. package/dist-npm/extension.d.ts.map +1 -0
  96. package/dist-npm/extension.js +938 -0
  97. package/dist-npm/extension.js.map +1 -0
  98. package/dist-npm/index.d.ts +40 -0
  99. package/dist-npm/index.d.ts.map +1 -0
  100. package/dist-npm/index.js +63 -0
  101. package/dist-npm/index.js.map +1 -0
  102. package/dist-npm/types.d.ts +375 -0
  103. package/dist-npm/types.d.ts.map +1 -0
  104. package/dist-npm/types.js +8 -0
  105. package/dist-npm/types.js.map +1 -0
  106. package/package.json +42 -0
  107. package/src/annotations/context.ts +47 -0
  108. package/src/annotations/index.ts +6 -0
  109. package/src/annotations/store.ts +219 -0
  110. package/src/checkpoints/index.ts +2 -0
  111. package/src/checkpoints/serializer.ts +121 -0
  112. package/src/checkpoints/store.ts +188 -0
  113. package/src/commands/index.ts +1 -0
  114. package/src/commands/registry.ts +81 -0
  115. package/src/context/debug-context.ts +209 -0
  116. package/src/context/index.ts +1 -0
  117. package/src/extension.ts +1089 -0
  118. package/src/index.ts +69 -0
  119. package/src/types.ts +469 -0
  120. package/tsconfig.json +16 -0
  121. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Command Registry
3
+ *
4
+ * Central registry for debug and test commands.
5
+ * Commands can be looked up by GDT code or test syntax.
6
+ */
7
+ import type { CommandRegistry } from '../types.js';
8
+ /**
9
+ * Create a new command registry
10
+ */
11
+ export declare function createCommandRegistry(): CommandRegistry;
12
+ /**
13
+ * Parse a GDT-style command input
14
+ * Format: "CODE arg1 arg2" or just "CODE"
15
+ */
16
+ export declare function parseGdtInput(input: string): {
17
+ code: string;
18
+ args: string[];
19
+ };
20
+ /**
21
+ * Parse a test command input
22
+ * Format: "$command arg1 arg2" or just "$command"
23
+ */
24
+ export declare function parseTestInput(input: string): {
25
+ syntax: string;
26
+ args: string[];
27
+ } | undefined;
28
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiC,eAAe,EAAE,MAAM,aAAa,CAAC;AAElF;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAoCvD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAO7E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAa5F"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * Command Registry
4
+ *
5
+ * Central registry for debug and test commands.
6
+ * Commands can be looked up by GDT code or test syntax.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createCommandRegistry = createCommandRegistry;
10
+ exports.parseGdtInput = parseGdtInput;
11
+ exports.parseTestInput = parseTestInput;
12
+ /**
13
+ * Create a new command registry
14
+ */
15
+ function createCommandRegistry() {
16
+ const byCode = new Map();
17
+ const byTestSyntax = new Map();
18
+ const allCommands = [];
19
+ const registry = {
20
+ register(command) {
21
+ // Register by code (uppercase for case-insensitive lookup)
22
+ byCode.set(command.code.toUpperCase(), command);
23
+ // Register by test syntax if provided
24
+ if (command.testSyntax) {
25
+ byTestSyntax.set(command.testSyntax.toLowerCase(), command);
26
+ }
27
+ allCommands.push(command);
28
+ },
29
+ getByCode(code) {
30
+ return byCode.get(code.toUpperCase());
31
+ },
32
+ getByTestSyntax(syntax) {
33
+ return byTestSyntax.get(syntax.toLowerCase());
34
+ },
35
+ getAll() {
36
+ return [...allCommands];
37
+ },
38
+ getByCategory(category) {
39
+ return allCommands.filter((cmd) => cmd.category === category);
40
+ },
41
+ };
42
+ return registry;
43
+ }
44
+ /**
45
+ * Parse a GDT-style command input
46
+ * Format: "CODE arg1 arg2" or just "CODE"
47
+ */
48
+ function parseGdtInput(input) {
49
+ const trimmed = input.trim();
50
+ const parts = trimmed.split(/\s+/);
51
+ const code = parts[0] || '';
52
+ const args = parts.slice(1);
53
+ return { code: code.toUpperCase(), args };
54
+ }
55
+ /**
56
+ * Parse a test command input
57
+ * Format: "$command arg1 arg2" or just "$command"
58
+ */
59
+ function parseTestInput(input) {
60
+ const trimmed = input.trim();
61
+ if (!trimmed.startsWith('$')) {
62
+ return undefined;
63
+ }
64
+ const withoutPrefix = trimmed.slice(1);
65
+ const parts = withoutPrefix.split(/\s+/);
66
+ const syntax = parts[0] || '';
67
+ const args = parts.slice(1);
68
+ return { syntax: syntax.toLowerCase(), args };
69
+ }
70
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAOH,sDAoCC;AAMD,sCAOC;AAMD,wCAaC;AAvED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC/C,MAAM,YAAY,GAAG,IAAI,GAAG,EA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EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAa;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Debug Context Implementation
3
+ *
4
+ * Provides a unified context for debug and test commands to interact with the game world.
5
+ * Generalizes the pattern from Dungeo's GDTContext.
6
+ */
7
+ import type { WorldModel, IFEntity } from '@sharpee/world-model';
8
+ import type { DebugContext } from '../types.js';
9
+ /**
10
+ * Create a debug context for the given world
11
+ */
12
+ export declare function createDebugContext(world: WorldModel): DebugContext;
13
+ /**
14
+ * Format entity for debug display
15
+ */
16
+ export declare function formatEntity(entity: IFEntity): string;
17
+ /**
18
+ * Format location chain for an entity
19
+ */
20
+ export declare function formatLocationChain(entity: IFEntity, world: WorldModel): string;
21
+ //# sourceMappingURL=debug-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-context.d.ts","sourceRoot":"","sources":["../../src/context/debug-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAiKlE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAKrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAkB/E"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ /**
3
+ * Debug Context Implementation
4
+ *
5
+ * Provides a unified context for debug and test commands to interact with the game world.
6
+ * Generalizes the pattern from Dungeo's GDTContext.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createDebugContext = createDebugContext;
10
+ exports.formatEntity = formatEntity;
11
+ exports.formatLocationChain = formatLocationChain;
12
+ const world_model_1 = require("@sharpee/world-model");
13
+ /**
14
+ * Create a debug context for the given world
15
+ */
16
+ function createDebugContext(world) {
17
+ // Create AuthorModel for bypassing game rules
18
+ const author = new world_model_1.AuthorModel(world.getDataStore(), world);
19
+ // Debug flags storage
20
+ const flags = new Map();
21
+ // Find player entity
22
+ const player = world.getPlayer();
23
+ if (!player) {
24
+ throw new Error('Cannot create debug context: no player entity found');
25
+ }
26
+ const context = {
27
+ world,
28
+ author,
29
+ player,
30
+ flags,
31
+ // ========================================================================
32
+ // Entity Lookup
33
+ // ========================================================================
34
+ findEntity(idOrName) {
35
+ // Try exact ID match first
36
+ const byId = world.getEntity(idOrName);
37
+ if (byId)
38
+ return byId;
39
+ // Normalize search term: lowercase, convert hyphens to spaces
40
+ const searchLower = idOrName.toLowerCase();
41
+ const searchNormalized = searchLower.replace(/-/g, ' ');
42
+ const allEntities = world.getAllEntities();
43
+ // Exact name match (with normalized search)
44
+ const exactMatch = allEntities.find((e) => e.name?.toLowerCase() === searchNormalized ||
45
+ e.name?.toLowerCase() === searchLower);
46
+ if (exactMatch)
47
+ return exactMatch;
48
+ // Partial name match (with normalized search)
49
+ const partialMatch = allEntities.find((e) => e.name?.toLowerCase().includes(searchNormalized) ||
50
+ e.name?.toLowerCase().includes(searchLower));
51
+ if (partialMatch)
52
+ return partialMatch;
53
+ // ID contains search term
54
+ const idMatch = allEntities.find((e) => e.id.toLowerCase().includes(searchLower));
55
+ return idMatch;
56
+ },
57
+ findRoom(idOrName) {
58
+ const entity = context.findEntity(idOrName);
59
+ if (entity && entity.type === 'room') {
60
+ return entity;
61
+ }
62
+ // Search only rooms
63
+ const searchLower = idOrName.toLowerCase();
64
+ const rooms = world.getAllEntities().filter((e) => e.type === 'room');
65
+ const exactMatch = rooms.find((r) => r.name?.toLowerCase() === searchLower);
66
+ if (exactMatch)
67
+ return exactMatch;
68
+ const partialMatch = rooms.find((r) => r.name?.toLowerCase().includes(searchLower) ||
69
+ r.id.toLowerCase().includes(searchLower));
70
+ return partialMatch;
71
+ },
72
+ findEntities(predicate) {
73
+ return world.getAllEntities().filter(predicate);
74
+ },
75
+ // ========================================================================
76
+ // Location Queries
77
+ // ========================================================================
78
+ getPlayerLocation() {
79
+ const locationId = world.getLocation(player.id);
80
+ if (!locationId)
81
+ return undefined;
82
+ return world.getEntity(locationId);
83
+ },
84
+ getInventory() {
85
+ return world.getContents(player.id);
86
+ },
87
+ getContents(locationId) {
88
+ return world.getContents(locationId);
89
+ },
90
+ // ========================================================================
91
+ // Mutations (bypass game rules via AuthorModel)
92
+ // ========================================================================
93
+ teleportPlayer(roomId) {
94
+ const room = context.findRoom(roomId);
95
+ if (!room)
96
+ return false;
97
+ author.moveEntity(player.id, room.id);
98
+ return true;
99
+ },
100
+ moveObject(objectId, locationId) {
101
+ const object = context.findEntity(objectId);
102
+ const location = context.findEntity(locationId);
103
+ if (!object || !location)
104
+ return false;
105
+ author.moveEntity(object.id, location.id);
106
+ return true;
107
+ },
108
+ takeObject(objectId) {
109
+ const object = context.findEntity(objectId);
110
+ if (!object)
111
+ return false;
112
+ author.moveEntity(object.id, player.id);
113
+ return true;
114
+ },
115
+ removeObject(objectId) {
116
+ const object = context.findEntity(objectId);
117
+ if (!object)
118
+ return false;
119
+ // Move to limbo (null location)
120
+ author.moveEntity(object.id, 'limbo');
121
+ return true;
122
+ },
123
+ spawnObject(objectId, locationId) {
124
+ const object = context.findEntity(objectId);
125
+ const location = context.findEntity(locationId);
126
+ if (!object || !location)
127
+ return false;
128
+ author.moveEntity(object.id, location.id);
129
+ return true;
130
+ },
131
+ // ========================================================================
132
+ // Flag Operations
133
+ // ========================================================================
134
+ setFlag(name, value) {
135
+ flags.set(name, value);
136
+ },
137
+ getFlag(name) {
138
+ return flags.get(name) ?? false;
139
+ },
140
+ };
141
+ return context;
142
+ }
143
+ /**
144
+ * Format entity for debug display
145
+ */
146
+ function formatEntity(entity) {
147
+ const traitTypes = entity.traits
148
+ ? Array.from(entity.traits.values()).map((t) => t.type.split('.').pop()).join(', ')
149
+ : 'none';
150
+ return `${entity.id} (${entity.name || 'unnamed'}) [${traitTypes}]`;
151
+ }
152
+ /**
153
+ * Format location chain for an entity
154
+ */
155
+ function formatLocationChain(entity, world) {
156
+ const chain = [entity.id];
157
+ let current = entity;
158
+ let depth = 0;
159
+ while (depth < 10) {
160
+ const locationId = world.getLocation(current.id);
161
+ if (!locationId)
162
+ break;
163
+ chain.push(locationId);
164
+ const location = world.getEntity(locationId);
165
+ if (!location)
166
+ break;
167
+ current = location;
168
+ depth++;
169
+ }
170
+ return chain.join(' -> ');
171
+ }
172
+ //# sourceMappingURL=debug-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-context.js","sourceRoot":"","sources":["../../src/context/debug-context.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AASH,gDAiKC;AAKD,oCAKC;AAKD,kDAkBC;AAxMD,sDAAmD;AAGnD;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAiB;IAClD,8CAA8C;IAC9C,MAAM,MAAM,GAA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,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnF,CAAC,CAAC,MAAM,CAAC;IACX,OAAO,GAAG,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,IAAI,IAAI,SAAS,MAAM,UAAU,GAAG,CAAC;AACtE,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAgB,EAAE,KAAiB;IACrE,MAAM,KAAK,GAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpC,IAAI,OAAO,GAAG,MAAM,CAAC;IACrB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,EAAE,EAAE,CAAC;QAClB,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU;YAAE,MAAM;QAEvB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvB,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ;YAAE,MAAM;QAErB,OAAO,GAAG,QAAQ,CAAC;QACnB,KAAK,EAAE,CAAC;IACV,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createDebugContext, formatEntity, formatLocationChain } from './debug-context.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatLocationChain = exports.formatEntity = exports.createDebugContext = void 0;
4
+ var debug_context_js_1 = require("./debug-context.js");
5
+ Object.defineProperty(exports, "createDebugContext", { enumerable: true, get: function () { return debug_context_js_1.createDebugContext; } });
6
+ Object.defineProperty(exports, "formatEntity", { enumerable: true, get: function () { return debug_context_js_1.formatEntity; } });
7
+ Object.defineProperty(exports, "formatLocationChain", { enumerable: true, get: function () { return debug_context_js_1.formatLocationChain; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":";;;AAAA,uDAA2F;AAAlF,sHAAA,kBAAkB,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,uHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Testing Extension
3
+ *
4
+ * Main extension class that provides debug and testing capabilities.
5
+ * Implements the ITestingExtension interface.
6
+ */
7
+ import type { WorldModel } from '@sharpee/world-model';
8
+ import type { TestingExtensionConfig, ITestingExtension, CommandRegistry, CheckpointStore, DebugContext, CommandResult, AnnotationStore, AnnotationType, Annotation } from './types.js';
9
+ /**
10
+ * Testing Extension implementation
11
+ */
12
+ export declare class TestingExtension implements ITestingExtension {
13
+ readonly config: TestingExtensionConfig;
14
+ readonly commands: CommandRegistry;
15
+ readonly checkpoints: CheckpointStore;
16
+ readonly annotations: AnnotationStore;
17
+ private isDebugModeActive;
18
+ private lastCommand;
19
+ private lastResponse;
20
+ constructor(config?: TestingExtensionConfig);
21
+ /**
22
+ * Register built-in debug commands
23
+ */
24
+ private registerBuiltInCommands;
25
+ /**
26
+ * Execute a GDT-style command
27
+ */
28
+ executeGdtCommand(input: string, world: WorldModel): CommandResult;
29
+ /**
30
+ * Execute a test command ($command syntax)
31
+ */
32
+ executeTestCommand(input: string, world: WorldModel): CommandResult;
33
+ /**
34
+ * Create a debug context for the world
35
+ */
36
+ createContext(world: WorldModel): DebugContext;
37
+ /**
38
+ * Save a checkpoint
39
+ */
40
+ saveCheckpoint(name: string, world: WorldModel): Promise<void>;
41
+ /**
42
+ * Restore from a checkpoint
43
+ */
44
+ restoreCheckpoint(name: string, world: WorldModel): Promise<boolean>;
45
+ /**
46
+ * Set context for annotation commands (called by transcript-tester after each command)
47
+ */
48
+ setCommandContext(command: string, response: string): void;
49
+ /**
50
+ * Add an annotation directly (for # comments from transcript-tester)
51
+ */
52
+ addAnnotation(type: AnnotationType, text: string, world: WorldModel): Annotation;
53
+ private cmdHelp;
54
+ private cmdTeleport;
55
+ private cmdTake;
56
+ private cmdMove;
57
+ private cmdRemove;
58
+ private cmdDisplayPlayer;
59
+ private cmdDisplayRoom;
60
+ private cmdDisplayObject;
61
+ private cmdListSaves;
62
+ private cmdDescribeEntity;
63
+ private cmdDisplayState;
64
+ private cmdDisplayExits;
65
+ private cmdNoDeaths;
66
+ private cmdRestoreDeaths;
67
+ private cmdKillEntity;
68
+ private cmdExit;
69
+ private cmdBug;
70
+ private cmdNote;
71
+ private cmdConfusing;
72
+ private cmdExpected;
73
+ private cmdBookmark;
74
+ private cmdSession;
75
+ private cmdReview;
76
+ private cmdExport;
77
+ }
78
+ //# sourceMappingURL=extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,aAAa,EAEb,eAAe,EACf,cAAc,EACd,UAAU,EACX,MAAM,YAAY,CAAC;AA2BpB;;GAEG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAA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