@sharpee/sharpee 0.9.66-beta → 0.9.69-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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI: sharpee build-browser
3
+ *
4
+ * Bundles a Sharpee story for web browser deployment.
5
+ */
6
+ /**
7
+ * Run the build-browser command
8
+ */
9
+ export declare function runBuildBrowserCommand(args: string[]): Promise<void>;
10
+ //# sourceMappingURL=build-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-browser.d.ts","sourceRoot":"","sources":["../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/build-browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwDH;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8G1E"}
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ /**
3
+ * CLI: sharpee build-browser
4
+ *
5
+ * Bundles a Sharpee story for web browser deployment.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.runBuildBrowserCommand = runBuildBrowserCommand;
42
+ const fs = __importStar(require("fs"));
43
+ const path = __importStar(require("path"));
44
+ const child_process_1 = require("child_process");
45
+ /**
46
+ * Read story info from package.json or index.ts
47
+ */
48
+ function getProjectInfo(projectDir) {
49
+ // Try package.json first
50
+ const packagePath = path.join(projectDir, 'package.json');
51
+ if (fs.existsSync(packagePath)) {
52
+ try {
53
+ const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
54
+ return {
55
+ storyId: pkg.name || 'my-story',
56
+ storyTitle: pkg.description || pkg.name || 'My Story',
57
+ };
58
+ }
59
+ catch {
60
+ // Fall through
61
+ }
62
+ }
63
+ // Try reading from src/index.ts
64
+ const indexPath = path.join(projectDir, 'src', 'index.ts');
65
+ if (fs.existsSync(indexPath)) {
66
+ const content = fs.readFileSync(indexPath, 'utf-8');
67
+ const idMatch = content.match(/id:\s*['"]([^'"]+)['"]/);
68
+ const titleMatch = content.match(/title:\s*['"]([^'"]+)['"]/);
69
+ if (idMatch || titleMatch) {
70
+ return {
71
+ storyId: idMatch?.[1] || 'my-story',
72
+ storyTitle: titleMatch?.[1] || 'My Story',
73
+ };
74
+ }
75
+ }
76
+ return null;
77
+ }
78
+ /**
79
+ * Process template placeholders
80
+ */
81
+ function processTemplate(content, info) {
82
+ return content
83
+ .replace(/\{\{STORY_ID\}\}/g, info.storyId)
84
+ .replace(/\{\{STORY_TITLE\}\}/g, info.storyTitle);
85
+ }
86
+ /**
87
+ * Run the build-browser command
88
+ */
89
+ async function runBuildBrowserCommand(args) {
90
+ // Check for help
91
+ if (args.includes('--help') || args.includes('-h')) {
92
+ showHelp();
93
+ return;
94
+ }
95
+ const projectDir = process.cwd();
96
+ const minify = !args.includes('--no-minify');
97
+ const sourcemap = !args.includes('--no-sourcemap');
98
+ console.log('\n🔨 Building browser bundle\n');
99
+ // Check if this is a Sharpee project
100
+ const info = getProjectInfo(projectDir);
101
+ if (!info) {
102
+ console.error('Error: This does not appear to be a Sharpee project.');
103
+ console.error('Make sure you have a package.json or src/index.ts with story config.');
104
+ process.exit(1);
105
+ }
106
+ console.log(` Story: ${info.storyTitle} (${info.storyId})`);
107
+ // Check for browser-entry.ts
108
+ const browserEntryPath = path.join(projectDir, 'src', 'browser-entry.ts');
109
+ if (!fs.existsSync(browserEntryPath)) {
110
+ console.error('\nError: src/browser-entry.ts not found.');
111
+ console.error('Run "sharpee init-browser" first to add browser support.');
112
+ process.exit(1);
113
+ }
114
+ // Create output directory
115
+ const outDir = path.join(projectDir, 'dist', 'web');
116
+ fs.mkdirSync(outDir, { recursive: true });
117
+ // Build with esbuild
118
+ console.log(' Building...');
119
+ const esbuildArgs = [
120
+ browserEntryPath,
121
+ '--bundle',
122
+ '--platform=browser',
123
+ '--target=es2020',
124
+ '--format=iife',
125
+ `--global-name=SharpeeGame`,
126
+ `--outfile=${path.join(outDir, info.storyId + '.js')}`,
127
+ '--define:process.env.NODE_ENV=\\"production\\"',
128
+ ];
129
+ if (minify) {
130
+ esbuildArgs.push('--minify');
131
+ }
132
+ if (sourcemap) {
133
+ esbuildArgs.push('--sourcemap');
134
+ }
135
+ try {
136
+ (0, child_process_1.execSync)(`npx esbuild ${esbuildArgs.join(' ')}`, {
137
+ cwd: projectDir,
138
+ stdio: 'pipe',
139
+ });
140
+ console.log(` ✓ Built ${info.storyId}.js`);
141
+ }
142
+ catch (error) {
143
+ console.error(' ✗ Build failed');
144
+ if (error.stderr) {
145
+ console.error(error.stderr.toString());
146
+ }
147
+ process.exit(1);
148
+ }
149
+ // Copy HTML template
150
+ const browserHtmlPath = path.join(projectDir, 'browser', 'index.html');
151
+ const defaultHtmlPath = path.join(__dirname, '..', '..', 'templates', 'browser', 'index.html');
152
+ const htmlSource = fs.existsSync(browserHtmlPath) ? browserHtmlPath : defaultHtmlPath;
153
+ if (fs.existsSync(htmlSource)) {
154
+ let htmlContent = fs.readFileSync(htmlSource, 'utf-8');
155
+ htmlContent = processTemplate(htmlContent, info);
156
+ fs.writeFileSync(path.join(outDir, 'index.html'), htmlContent);
157
+ console.log(' ✓ Copied index.html');
158
+ }
159
+ else {
160
+ console.warn(' ⚠ HTML template not found');
161
+ }
162
+ // Copy CSS
163
+ const browserCssPath = path.join(projectDir, 'browser', 'styles.css');
164
+ const defaultCssPath = path.join(__dirname, '..', '..', 'templates', 'browser', 'styles.css');
165
+ const cssSource = fs.existsSync(browserCssPath) ? browserCssPath : defaultCssPath;
166
+ if (fs.existsSync(cssSource)) {
167
+ fs.copyFileSync(cssSource, path.join(outDir, 'styles.css'));
168
+ console.log(' ✓ Copied styles.css');
169
+ }
170
+ else {
171
+ console.warn(' ⚠ CSS file not found');
172
+ }
173
+ // Report bundle size
174
+ const bundlePath = path.join(outDir, info.storyId + '.js');
175
+ if (fs.existsSync(bundlePath)) {
176
+ const stats = fs.statSync(bundlePath);
177
+ const sizeKb = (stats.size / 1024).toFixed(1);
178
+ console.log(`\n Bundle size: ${sizeKb} KB`);
179
+ }
180
+ console.log('\n✅ Build complete!\n');
181
+ console.log(`Output: ${path.relative(projectDir, outDir)}/`);
182
+ console.log('');
183
+ console.log('To test locally:');
184
+ console.log(` npx serve ${path.relative(projectDir, outDir)}`);
185
+ console.log('');
186
+ }
187
+ function showHelp() {
188
+ console.log(`
189
+ sharpee build-browser - Build a web browser bundle
190
+
191
+ Usage: sharpee build-browser [options]
192
+
193
+ Options:
194
+ --no-minify Skip minification
195
+ --no-sourcemap Skip source map generation
196
+
197
+ Output:
198
+ dist/web/
199
+ index.html HTML page
200
+ <story-id>.js JavaScript bundle
201
+ styles.css Stylesheet
202
+
203
+ The bundle includes your story, the Sharpee engine, and all dependencies.
204
+ `);
205
+ }
206
+ //# sourceMappingURL=build-browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-browser.js","sourceRoot":"","sources":["../../../../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/build-browser.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DH,wDA8GC;AAvKD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAyC;AAOzC;;GAEG;AACH,SAAS,cAAc,CAAC,UAAkB;IACxC,yBAAyB;IACzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC1D,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAC9D,OAAO;gBACL,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,UAAU;gBAC/B,UAAU,EAAE,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,IAAI,UAAU;aACtD,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,eAAe;QACjB,CAAC;IACH,CAAC;IAED,gCAAgC;IAChC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAC3D,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACx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OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;CAgBb,CAAC,CAAC;AACH,CAAC"}
package/cli/build.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CLI: sharpee build
3
+ *
4
+ * Builds a .sharpee story bundle and browser client from a story project.
5
+ */
6
+ export declare function runBuildCommand(args: string[]): Promise<void>;
7
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8BH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2GnE"}
package/cli/build.js ADDED
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ /**
3
+ * CLI: sharpee build
4
+ *
5
+ * Builds a .sharpee story bundle and browser client from a story project.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.runBuildCommand = runBuildCommand;
42
+ const fs = __importStar(require("fs"));
43
+ const path = __importStar(require("path"));
44
+ const child_process_1 = require("child_process");
45
+ const fflate_1 = require("fflate");
46
+ const build_browser_1 = require("./build-browser");
47
+ function readRecursive(dir, base = '') {
48
+ const entries = {};
49
+ for (const item of fs.readdirSync(dir)) {
50
+ const full = path.join(dir, item);
51
+ const rel = base ? `${base}/${item}` : item;
52
+ if (fs.statSync(full).isDirectory()) {
53
+ Object.assign(entries, readRecursive(full, rel));
54
+ }
55
+ else {
56
+ entries[rel] = new Uint8Array(fs.readFileSync(full));
57
+ }
58
+ }
59
+ return entries;
60
+ }
61
+ async function runBuildCommand(args) {
62
+ if (args.includes('--help') || args.includes('-h')) {
63
+ showHelp();
64
+ return;
65
+ }
66
+ const projectDir = process.cwd();
67
+ const packagePath = path.join(projectDir, 'package.json');
68
+ if (!fs.existsSync(packagePath)) {
69
+ console.error('Error: No package.json found. Run from a story project directory.');
70
+ process.exit(1);
71
+ }
72
+ const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
73
+ const config = pkg.sharpee || {};
74
+ const storyName = config.title?.toLowerCase().replace(/\s+/g, '-') || pkg.name?.replace(/^@.*\//, '') || 'story';
75
+ const storySrc = path.join(projectDir, 'src', 'index.ts');
76
+ if (!fs.existsSync(storySrc)) {
77
+ console.error('Error: src/index.ts not found.');
78
+ process.exit(1);
79
+ }
80
+ console.log(`\nBuilding: ${config.title || storyName}\n`);
81
+ // --- .sharpee bundle ---
82
+ console.log('--- Story Bundle (.sharpee) ---\n');
83
+ const distDir = path.join(projectDir, 'dist');
84
+ fs.mkdirSync(distDir, { recursive: true });
85
+ // 1. esbuild story → ESM with @sharpee/* external
86
+ const storyJsPath = path.join(distDir, 'story.js');
87
+ const tsconfigPath = path.join(projectDir, 'tsconfig.json');
88
+ const tsconfigArg = fs.existsSync(tsconfigPath) ? `--tsconfig=${tsconfigPath}` : '';
89
+ try {
90
+ (0, child_process_1.execSync)(`npx esbuild "${storySrc}" --bundle --platform=browser --format=esm --target=es2020 --outfile="${storyJsPath}" --external:@sharpee/* ${tsconfigArg}`, { cwd: projectDir, stdio: 'pipe' });
91
+ console.log(' story.js');
92
+ }
93
+ catch (error) {
94
+ console.error(' Failed to build story.js');
95
+ if (error.stderr)
96
+ console.error(error.stderr.toString());
97
+ process.exit(1);
98
+ }
99
+ // 2. Generate meta.json
100
+ const meta = {
101
+ format: 'sharpee-story',
102
+ formatVersion: 1,
103
+ title: config.title || pkg.name,
104
+ author: config.author || 'Unknown',
105
+ version: pkg.version,
106
+ description: config.headline || pkg.description || '',
107
+ sharpeeVersion: '>=0.9.0',
108
+ ifid: config.ifid || '',
109
+ hasAssets: fs.existsSync(path.join(projectDir, 'assets')),
110
+ hasTheme: fs.existsSync(path.join(projectDir, 'theme.css')),
111
+ preferredTheme: config.preferredTheme || 'classic-light',
112
+ };
113
+ // 3. Assemble zip contents
114
+ const zipEntries = {};
115
+ zipEntries['story.js'] = new Uint8Array(fs.readFileSync(storyJsPath));
116
+ zipEntries['meta.json'] = (0, fflate_1.strToU8)(JSON.stringify(meta, null, 2) + '\n');
117
+ const assetsDir = path.join(projectDir, 'assets');
118
+ if (fs.existsSync(assetsDir)) {
119
+ const assetEntries = readRecursive(assetsDir, 'assets');
120
+ Object.assign(zipEntries, assetEntries);
121
+ console.log(` assets/ (${Object.keys(assetEntries).length} files)`);
122
+ }
123
+ const themePath = path.join(projectDir, 'theme.css');
124
+ if (fs.existsSync(themePath)) {
125
+ zipEntries['theme.css'] = new Uint8Array(fs.readFileSync(themePath));
126
+ console.log(' theme.css');
127
+ }
128
+ // 4. Create .sharpee zip
129
+ const zipped = (0, fflate_1.zipSync)(zipEntries);
130
+ const outFile = path.join(distDir, `${storyName}.sharpee`);
131
+ fs.writeFileSync(outFile, zipped);
132
+ const sizeKb = (fs.statSync(outFile).size / 1024).toFixed(1);
133
+ console.log(` meta.json`);
134
+ console.log(`\n Output: ${path.relative(projectDir, outFile)} (${sizeKb} KB)\n`);
135
+ // Clean up temp story.js
136
+ fs.unlinkSync(storyJsPath);
137
+ // --- Browser client ---
138
+ console.log('--- Browser Client ---\n');
139
+ const browserEntry = path.join(projectDir, 'src', 'browser-entry.ts');
140
+ if (fs.existsSync(browserEntry)) {
141
+ await (0, build_browser_1.runBuildBrowserCommand)(args.filter(a => a !== '--help' && a !== '-h'));
142
+ }
143
+ else {
144
+ console.log(' Skipped (no src/browser-entry.ts)\n');
145
+ console.log(' Run "sharpee init-browser" to add browser support.\n');
146
+ }
147
+ console.log('Build complete!\n');
148
+ }
149
+ function showHelp() {
150
+ console.log(`
151
+ sharpee build - Build story bundle and browser client
152
+
153
+ Usage: sharpee build [options]
154
+
155
+ Options:
156
+ --no-minify Skip minification (browser client)
157
+ --no-sourcemap Skip source map generation (browser client)
158
+
159
+ Output:
160
+ dist/<story>.sharpee Story bundle for Zifmia runner
161
+ dist/web/ Browser client (if browser-entry.ts exists)
162
+
163
+ Run from a story project directory with a package.json containing
164
+ a "sharpee" config block.
165
+ `);
166
+ }
167
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../../../../../../mnt/c/repotemp/sharpee/packages/sharpee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AAC,CAAC;IAClC,MAAM,MAAM,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,MAAM,QAAQ,CAAC,CAAC;IAElF,yBAAyB;IACzB,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAE3B,yBAAyB;IAEzB,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAExC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACtE,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAChC,MAAM,IAAA,sCAAsB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;CAeb,CAAC,CAAC;AACH,CAAC"}
package/cli/ifid.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function runIfidCommand(args: string[]): void;
2
+ //# sourceMappingURL=ifid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifid.d.ts","sourceRoot":"","sources":["../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/ifid.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAmBnD"}
package/cli/ifid.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // packages/sharpee/src/cli/ifid.ts
3
+ // IFID CLI commands
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.runIfidCommand = runIfidCommand;
6
+ const core_1 = require("../src/index.js");
7
+ function runIfidCommand(args) {
8
+ const subcommand = args[0];
9
+ switch (subcommand) {
10
+ case 'generate':
11
+ handleGenerate();
12
+ break;
13
+ case 'validate':
14
+ handleValidate(args.slice(1));
15
+ break;
16
+ case undefined:
17
+ case 'help':
18
+ showHelp();
19
+ break;
20
+ default:
21
+ console.error(`Unknown ifid subcommand: ${subcommand}`);
22
+ showHelp();
23
+ process.exit(1);
24
+ }
25
+ }
26
+ function handleGenerate() {
27
+ const ifid = (0, core_1.generateIfid)();
28
+ console.log(ifid);
29
+ }
30
+ function handleValidate(args) {
31
+ const ifid = args[0];
32
+ if (!ifid) {
33
+ console.error('Usage: sharpee ifid validate <ifid>');
34
+ process.exit(1);
35
+ }
36
+ const isValid = (0, core_1.validateIfid)(ifid);
37
+ if (isValid) {
38
+ console.log(`Valid IFID: ${ifid}`);
39
+ }
40
+ else {
41
+ // Try normalizing (uppercase conversion)
42
+ const normalized = (0, core_1.normalizeIfid)(ifid);
43
+ if (normalized) {
44
+ console.log(`Valid after normalization:`);
45
+ console.log(` Original: ${ifid}`);
46
+ console.log(` Normalized: ${normalized}`);
47
+ }
48
+ else {
49
+ console.error(`Invalid IFID: ${ifid}`);
50
+ console.error('IFID requirements:');
51
+ console.error(' - Length: 8-63 characters');
52
+ console.error(' - Characters: A-Z, 0-9, and hyphens only');
53
+ console.error(' - Recommended: UUID format (uppercase)');
54
+ process.exit(1);
55
+ }
56
+ }
57
+ }
58
+ function showHelp() {
59
+ console.log(`
60
+ sharpee ifid - IFID utilities
61
+
62
+ Commands:
63
+ generate Generate a new IFID (UUID format)
64
+ validate <ifid> Validate an IFID string
65
+
66
+ Examples:
67
+ sharpee ifid generate
68
+ sharpee ifid validate A1B2C3D4-E5F6-7890-ABCD-EF1234567890
69
+ `);
70
+ }
71
+ //# sourceMappingURL=ifid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifid.js","sourceRoot":"","sources":["../../../../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/ifid.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,oBAAoB;;AAIpB,wCAmBC;AArBD,wCAA0E;AAE1E,SAAgB,cAAc,CAAC,IAAc;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3B,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU;YACb,cAAc,EAAE,CAAC;YACjB,MAAM;QACR,KAAK,UAAU;YACb,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM;QACR,KAAK,SAAS,CAAC;QACf,KAAK,MAAM;YACT,QAAQ,EAAE,CAAC;YACX,MAAM;QACR;YACE,OAAO,CAAC,KAAK,CAAC,4BAA4B,UAAU,EAAE,CAAC,CAAC;YACxD,QAAQ,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,IAAI,GAAG,IAAA,mBAAY,GAAE,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAED,SAAS,cAAc,CAAC,IAAc;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAErB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,mBAAY,EAAC,IAAI,CAAC,CAAC;IAEnC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,yCAAyC;QACzC,MAAM,UAAU,GAAG,IAAA,oBAAa,EAAC,IAAI,CAAC,CAAC;QACvC,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,iBAAiB,UAAU,EAAE,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;YACvC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACpC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAC5D,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;CAUb,CAAC,CAAC;AACH,CAAC"}
package/cli/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Sharpee CLI
4
+ *
5
+ * Command-line tools for creating and building Sharpee interactive fiction.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/index.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
package/cli/index.js ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Sharpee CLI
5
+ *
6
+ * Command-line tools for creating and building Sharpee interactive fiction.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const ifid_1 = require("./ifid");
10
+ const init_1 = require("./init");
11
+ const init_browser_1 = require("./init-browser");
12
+ const build_browser_1 = require("./build-browser");
13
+ const build_1 = require("./build");
14
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
15
+ const { version: VERSION } = require('../../package.json');
16
+ async function main() {
17
+ const args = process.argv.slice(2);
18
+ const command = args[0];
19
+ try {
20
+ switch (command) {
21
+ case 'init':
22
+ await (0, init_1.runInitCommand)(args.slice(1));
23
+ break;
24
+ case 'init-browser':
25
+ await (0, init_browser_1.runInitBrowserCommand)(args.slice(1));
26
+ break;
27
+ case 'build':
28
+ await (0, build_1.runBuildCommand)(args.slice(1));
29
+ break;
30
+ case 'build-browser':
31
+ await (0, build_browser_1.runBuildBrowserCommand)(args.slice(1));
32
+ break;
33
+ case 'ifid':
34
+ (0, ifid_1.runIfidCommand)(args.slice(1));
35
+ break;
36
+ case 'version':
37
+ case '-v':
38
+ case '--version':
39
+ console.log(`sharpee ${VERSION}`);
40
+ break;
41
+ case 'help':
42
+ case '-h':
43
+ case '--help':
44
+ case undefined:
45
+ showHelp();
46
+ break;
47
+ default:
48
+ console.error(`Unknown command: ${command}`);
49
+ showHelp();
50
+ process.exit(1);
51
+ }
52
+ }
53
+ catch (error) {
54
+ console.error('Error:', error instanceof Error ? error.message : error);
55
+ process.exit(1);
56
+ }
57
+ }
58
+ function showHelp() {
59
+ console.log(`
60
+ sharpee - Interactive Fiction Engine CLI
61
+
62
+ Usage: sharpee <command> [options]
63
+
64
+ Commands:
65
+ init Create a new Sharpee story project
66
+ init-browser Add browser client to an existing project
67
+ build Build .sharpee bundle and browser client
68
+ build-browser Build a web browser bundle only
69
+ ifid IFID utilities (generate, validate)
70
+ version Show version
71
+ help Show this help
72
+
73
+ Examples:
74
+ sharpee init my-adventure Create new project in ./my-adventure/
75
+ sharpee init-browser Add browser support to current project
76
+ sharpee build Build story bundle + browser client
77
+ sharpee build-browser Build web bundle only in dist/web/
78
+
79
+ Run 'sharpee <command> --help' for command-specific help.
80
+ `);
81
+ }
82
+ main();
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/index.ts"],"names":[],"mappings":";;AACA;;;;GAIG;;AAEH,iCAAwC;AACxC,iCAAwC;AACxC,iDAAuD;AACvD,mDAAyD;AACzD,mCAA0C;AAE1C,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE3D,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,CAAC;QACH,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,MAAM;gBACT,MAAM,IAAA,qBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpC,MAAM;YACR,KAAK,cAAc;gBACjB,MAAM,IAAA,oCAAqB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3C,MAAM;YACR,KAAK,OAAO;gBACV,MAAM,IAAA,uBAAe,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrC,MAAM;YACR,KAAK,eAAe;gBAClB,MAAM,IAAA,sCAAsB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5C,MAAM;YACR,KAAK,MAAM;gBACT,IAAA,qBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9B,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,IAAI,CAAC;YACV,KAAK,WAAW;gBACd,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;gBAClC,MAAM;YACR,KAAK,MAAM,CAAC;YACZ,KAAK,IAAI,CAAC;YACV,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS;gBACZ,QAAQ,EAAE,CAAC;gBACX,MAAM;YACR;gBACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;gBAC7C,QAAQ,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBb,CAAC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI: sharpee init-browser
3
+ *
4
+ * Adds browser client files to an existing Sharpee story project.
5
+ */
6
+ /**
7
+ * Run the init-browser command
8
+ */
9
+ export declare function runInitBrowserCommand(args: string[]): Promise<void>;
10
+ //# sourceMappingURL=init-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-browser.d.ts","sourceRoot":"","sources":["../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/init-browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2DH;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgGzE"}
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ /**
3
+ * CLI: sharpee init-browser
4
+ *
5
+ * Adds browser client files to an existing Sharpee story project.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.runInitBrowserCommand = runInitBrowserCommand;
42
+ const fs = __importStar(require("fs"));
43
+ const path = __importStar(require("path"));
44
+ // Template directory relative to this file (will be in dist/cli after build)
45
+ const TEMPLATES_DIR = path.join(__dirname, '..', '..', 'templates', 'browser');
46
+ /**
47
+ * Read story info from package.json or index.ts
48
+ */
49
+ function getProjectInfo(projectDir) {
50
+ // Try package.json first
51
+ const packagePath = path.join(projectDir, 'package.json');
52
+ if (fs.existsSync(packagePath)) {
53
+ try {
54
+ const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
55
+ return {
56
+ storyId: pkg.name || 'my-story',
57
+ storyTitle: pkg.description || pkg.name || 'My Story',
58
+ };
59
+ }
60
+ catch {
61
+ // Fall through
62
+ }
63
+ }
64
+ // Try reading from src/index.ts
65
+ const indexPath = path.join(projectDir, 'src', 'index.ts');
66
+ if (fs.existsSync(indexPath)) {
67
+ const content = fs.readFileSync(indexPath, 'utf-8');
68
+ const idMatch = content.match(/id:\s*['"]([^'"]+)['"]/);
69
+ const titleMatch = content.match(/title:\s*['"]([^'"]+)['"]/);
70
+ if (idMatch || titleMatch) {
71
+ return {
72
+ storyId: idMatch?.[1] || 'my-story',
73
+ storyTitle: titleMatch?.[1] || 'My Story',
74
+ };
75
+ }
76
+ }
77
+ return null;
78
+ }
79
+ /**
80
+ * Read template file and replace placeholders
81
+ */
82
+ function processTemplate(templatePath, info) {
83
+ const content = fs.readFileSync(templatePath, 'utf-8');
84
+ return content
85
+ .replace(/\{\{STORY_ID\}\}/g, info.storyId)
86
+ .replace(/\{\{STORY_TITLE\}\}/g, info.storyTitle);
87
+ }
88
+ /**
89
+ * Run the init-browser command
90
+ */
91
+ async function runInitBrowserCommand(args) {
92
+ // Check for help
93
+ if (args.includes('--help') || args.includes('-h')) {
94
+ showHelp();
95
+ return;
96
+ }
97
+ const projectDir = process.cwd();
98
+ console.log('\n🌐 Adding browser client to your Sharpee project\n');
99
+ // Check if this is a Sharpee project
100
+ const info = getProjectInfo(projectDir);
101
+ if (!info) {
102
+ console.error('Error: This does not appear to be a Sharpee project.');
103
+ console.error('Make sure you have a package.json or src/index.ts with story config.');
104
+ console.error('\nRun "sharpee init" first to create a project.');
105
+ process.exit(1);
106
+ }
107
+ console.log(` Story: ${info.storyTitle} (${info.storyId})`);
108
+ // Check if browser-entry.ts already exists
109
+ const browserEntryPath = path.join(projectDir, 'src', 'browser-entry.ts');
110
+ if (fs.existsSync(browserEntryPath)) {
111
+ console.error('\nError: src/browser-entry.ts already exists.');
112
+ console.error('Remove it first if you want to regenerate.');
113
+ process.exit(1);
114
+ }
115
+ // Create browser directory for templates (optional, for customization)
116
+ const browserDir = path.join(projectDir, 'browser');
117
+ fs.mkdirSync(browserDir, { recursive: true });
118
+ // Copy browser-entry.ts template
119
+ const browserEntryTemplate = path.join(TEMPLATES_DIR, 'browser-entry.ts.template');
120
+ if (fs.existsSync(browserEntryTemplate)) {
121
+ const content = processTemplate(browserEntryTemplate, info);
122
+ fs.writeFileSync(browserEntryPath, content);
123
+ console.log(' ✓ Created src/browser-entry.ts');
124
+ }
125
+ else {
126
+ console.error(' ✗ Template not found: browser-entry.ts.template');
127
+ process.exit(1);
128
+ }
129
+ // Copy HTML template
130
+ const htmlTemplate = path.join(TEMPLATES_DIR, 'index.html');
131
+ if (fs.existsSync(htmlTemplate)) {
132
+ const content = processTemplate(htmlTemplate, info);
133
+ fs.writeFileSync(path.join(browserDir, 'index.html'), content);
134
+ console.log(' ✓ Created browser/index.html');
135
+ }
136
+ // Copy CSS
137
+ const cssTemplate = path.join(TEMPLATES_DIR, 'styles.css');
138
+ if (fs.existsSync(cssTemplate)) {
139
+ fs.copyFileSync(cssTemplate, path.join(browserDir, 'styles.css'));
140
+ console.log(' ✓ Created browser/styles.css');
141
+ }
142
+ // Update package.json to add esbuild dev dependency and build script
143
+ const packagePath = path.join(projectDir, 'package.json');
144
+ if (fs.existsSync(packagePath)) {
145
+ try {
146
+ const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
147
+ // Add esbuild to devDependencies
148
+ pkg.devDependencies = pkg.devDependencies || {};
149
+ if (!pkg.devDependencies.esbuild) {
150
+ pkg.devDependencies.esbuild = '^0.20.0';
151
+ }
152
+ // Add build:browser script
153
+ pkg.scripts = pkg.scripts || {};
154
+ if (!pkg.scripts['build:browser']) {
155
+ pkg.scripts['build:browser'] = 'npx sharpee build-browser';
156
+ }
157
+ fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n');
158
+ console.log(' ✓ Updated package.json');
159
+ }
160
+ catch (e) {
161
+ console.warn(' ⚠ Could not update package.json');
162
+ }
163
+ }
164
+ console.log('\n✅ Browser client added!\n');
165
+ console.log('Next steps:');
166
+ console.log(' npm install # Install esbuild');
167
+ console.log(' npm run build:browser # Build web bundle');
168
+ console.log('');
169
+ console.log('Output will be in dist/web/');
170
+ console.log('');
171
+ console.log('Customize the UI:');
172
+ console.log(' browser/index.html # HTML template');
173
+ console.log(' browser/styles.css # Styles');
174
+ console.log('');
175
+ }
176
+ function showHelp() {
177
+ console.log(`
178
+ sharpee init-browser - Add browser client to a Sharpee project
179
+
180
+ Usage: sharpee init-browser
181
+
182
+ This command adds the files needed to build a web browser version
183
+ of your interactive fiction game:
184
+
185
+ src/browser-entry.ts Entry point for browser bundle
186
+ browser/index.html HTML template
187
+ browser/styles.css Infocom-style CSS
188
+
189
+ Run this in the root of your Sharpee project directory.
190
+ `);
191
+ }
192
+ //# sourceMappingURL=init-browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-browser.js","sourceRoot":"","sources":["../../../../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/init-browser.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DH,sDAgGC;AA5JD,uCAAyB;AACzB,2CAA6B;AAE7B,6EAA6E;AAC7E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAO/E;;GAEG;AACH,SAAS,cAAc,CAAC,UAAkB;IACxC,yBAAyB;IACzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC1D,IAAI,E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C;IAC3D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;CAab,CAAC,CAAC;AACH,CAAC"}
package/cli/init.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI: sharpee init
3
+ *
4
+ * Creates a new Sharpee story project with the basic structure.
5
+ */
6
+ /**
7
+ * Run the init command
8
+ */
9
+ export declare function runInitCommand(args: string[]): Promise<void>;
10
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/cli/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwDH;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuFlE"}
package/cli/init.js ADDED
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ /**
3
+ * CLI: sharpee init
4
+ *
5
+ * Creates a new Sharpee story project with the basic structure.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.runInitCommand = runInitCommand;
42
+ const fs = __importStar(require("fs"));
43
+ const path = __importStar(require("path"));
44
+ const readline = __importStar(require("readline"));
45
+ // Template directory relative to this file (will be in dist/cli after build)
46
+ const TEMPLATES_DIR = path.join(__dirname, '..', '..', 'templates', 'story');
47
+ /**
48
+ * Prompt user for input
49
+ */
50
+ async function prompt(question, defaultValue) {
51
+ const rl = readline.createInterface({
52
+ input: process.stdin,
53
+ output: process.stdout,
54
+ });
55
+ return new Promise((resolve) => {
56
+ const defaultHint = defaultValue ? ` (${defaultValue})` : '';
57
+ rl.question(`${question}${defaultHint}: `, (answer) => {
58
+ rl.close();
59
+ resolve(answer.trim() || defaultValue || '');
60
+ });
61
+ });
62
+ }
63
+ /**
64
+ * Convert title to kebab-case ID
65
+ */
66
+ function toStoryId(title) {
67
+ return title
68
+ .toLowerCase()
69
+ .replace(/[^a-z0-9]+/g, '-')
70
+ .replace(/^-|-$/g, '');
71
+ }
72
+ /**
73
+ * Read template file and replace placeholders
74
+ */
75
+ function processTemplate(templatePath, options) {
76
+ const content = fs.readFileSync(templatePath, 'utf-8');
77
+ return content
78
+ .replace(/\{\{STORY_ID\}\}/g, options.storyId)
79
+ .replace(/\{\{STORY_TITLE\}\}/g, options.storyTitle)
80
+ .replace(/\{\{AUTHOR\}\}/g, options.author)
81
+ .replace(/\{\{DESCRIPTION\}\}/g, options.description);
82
+ }
83
+ /**
84
+ * Run the init command
85
+ */
86
+ async function runInitCommand(args) {
87
+ // Check for help
88
+ if (args.includes('--help') || args.includes('-h')) {
89
+ showHelp();
90
+ return;
91
+ }
92
+ // Check for non-interactive mode
93
+ const useDefaults = args.includes('-y') || args.includes('--yes');
94
+ const filteredArgs = args.filter(a => a !== '-y' && a !== '--yes');
95
+ // Get target directory
96
+ const targetDir = filteredArgs[0] || '.';
97
+ const absoluteTarget = path.resolve(process.cwd(), targetDir);
98
+ console.log('\n📖 Create a new Sharpee story\n');
99
+ // Check if directory exists and is not empty
100
+ if (fs.existsSync(absoluteTarget)) {
101
+ const files = fs.readdirSync(absoluteTarget);
102
+ if (files.length > 0 && !files.every(f => f.startsWith('.'))) {
103
+ console.error(`Error: Directory "${targetDir}" is not empty.`);
104
+ console.error('Please use an empty directory or specify a new one.');
105
+ process.exit(1);
106
+ }
107
+ }
108
+ // Gather project info (use defaults if -y flag)
109
+ const defaultTitle = path.basename(absoluteTarget) || 'My Adventure';
110
+ const storyTitle = useDefaults ? defaultTitle : await prompt('Story title', defaultTitle);
111
+ const storyId = useDefaults ? toStoryId(storyTitle) : await prompt('Story ID (package name)', toStoryId(storyTitle));
112
+ const author = useDefaults ? (process.env.USER || 'Anonymous') : await prompt('Author name', process.env.USER || 'Anonymous');
113
+ const description = useDefaults ? 'An interactive fiction adventure' : await prompt('Description', 'An interactive fiction adventure');
114
+ const options = {
115
+ storyId,
116
+ storyTitle,
117
+ author,
118
+ description,
119
+ };
120
+ console.log('\nCreating project...\n');
121
+ // Create directory structure
122
+ fs.mkdirSync(absoluteTarget, { recursive: true });
123
+ fs.mkdirSync(path.join(absoluteTarget, 'src'), { recursive: true });
124
+ // Copy and process templates
125
+ const templates = [
126
+ { src: 'index.ts.template', dest: 'src/index.ts' },
127
+ { src: 'package.json.template', dest: 'package.json' },
128
+ { src: 'tsconfig.json.template', dest: 'tsconfig.json' },
129
+ ];
130
+ for (const template of templates) {
131
+ const srcPath = path.join(TEMPLATES_DIR, template.src);
132
+ const destPath = path.join(absoluteTarget, template.dest);
133
+ if (fs.existsSync(srcPath)) {
134
+ const content = processTemplate(srcPath, options);
135
+ fs.writeFileSync(destPath, content);
136
+ console.log(` ✓ Created ${template.dest}`);
137
+ }
138
+ else {
139
+ console.warn(` ⚠ Template not found: ${template.src}`);
140
+ }
141
+ }
142
+ // Create .gitignore
143
+ const gitignore = `node_modules/
144
+ dist/
145
+ *.log
146
+ .DS_Store
147
+ `;
148
+ fs.writeFileSync(path.join(absoluteTarget, '.gitignore'), gitignore);
149
+ console.log(' ✓ Created .gitignore');
150
+ console.log('\n✅ Project created!\n');
151
+ console.log('Next steps:');
152
+ if (targetDir !== '.') {
153
+ console.log(` cd ${targetDir}`);
154
+ }
155
+ console.log(' npm install');
156
+ console.log(' npm run build');
157
+ console.log('');
158
+ console.log('To add a browser client:');
159
+ console.log(' npx sharpee init-browser');
160
+ console.log('');
161
+ }
162
+ function showHelp() {
163
+ console.log(`
164
+ sharpee init - Create a new Sharpee story project
165
+
166
+ Usage: sharpee init [directory] [options]
167
+
168
+ Arguments:
169
+ directory Target directory (default: current directory)
170
+
171
+ Options:
172
+ -y, --yes Use defaults without prompting
173
+
174
+ Examples:
175
+ sharpee init Create in current directory (interactive)
176
+ sharpee init my-adventure Create in ./my-adventure/ (interactive)
177
+ sharpee init my-adventure -y Create with defaults (non-interactive)
178
+ `);
179
+ }
180
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../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3B,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,QAAQ,SAAS,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;CAeb,CAAC,CAAC;AACH,CAAC"}
package/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Sharpee - Interactive Fiction Engine
3
+ *
4
+ * Main entry point that aggregates all packages for easy consumption
5
+ */
6
+ export { GameEngine, type Story, type SequencedEvent, type StoryConfig } from "./src/index";
7
+ export { type WorldModel, type IFEntity } from "./src/index";
8
+ export { QueryManager, createQueryManager, type IPendingQuery as PendingQuery, type IQueryResponse as QueryResponse, type IQueryHandler as QueryHandler, type QueryValidator, QuerySource, QueryType, PlatformEventType, type IPlatformEvent as PlatformEvent, type ISaveContext as SaveContext, type IRestoreContext as RestoreContext, type IQuitContext as QuitContext, type IRestartContext as RestartContext, type ISemanticEvent as SemanticEvent, isPlatformRequestEvent, createSaveCompletedEvent, createRestoreCompletedEvent, createQuitConfirmedEvent, createQuitCancelledEvent, createRestartCompletedEvent } from "./src/index";
9
+ export { Parser, type Token, type ValidatedCommand, type ParseError, CommandValidator } from "./src/index";
10
+ export { EnglishLanguageProvider } from "./src/index";
11
+ export { EnglishParser } from "./src/index";
12
+ export { type ITextService, createTextService, renderToString, renderStatusLine, } from "./src/index";
13
+ export type { ITextBlock, IDecoration, TextContent } from "./src/index";
14
+ export { TestingExtension, createDebugContext } from "./src/index";
15
+ export { TurnPlugin, TurnPluginContext, TurnPluginActionResult, PluginRegistry } from "./src/index";
16
+ export { NpcPlugin } from "./src/index";
17
+ export { SchedulerPlugin } from "./src/index";
18
+ export { StateMachinePlugin } from "./src/index";
19
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,UAAU,EACV,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,aAAa,IAAI,YAAY,EAClC,KAAK,cAAc,IAAI,aAAa,EACpC,KAAK,aAAa,IAAI,YAAY,EAClC,KAAK,cAAc,EACnB,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,KAAK,cAAc,IAAI,aAAa,EACpC,KAAK,YAAY,IAAI,WAAW,EAChC,KAAK,eAAe,IAAI,cAAc,EACtC,KAAK,YAAY,IAAI,WAAW,EAChC,KAAK,eAAe,IAAI,cAAc,EACtC,KAAK,cAAc,IAAI,aAAa,EACpC,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EACL,KAAK,YAAY,EACjB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGjF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG5E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
package/index.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * Sharpee - Interactive Fiction Engine
4
+ *
5
+ * Main entry point that aggregates all packages for easy consumption
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.StateMachinePlugin = exports.SchedulerPlugin = exports.NpcPlugin = exports.PluginRegistry = exports.createDebugContext = exports.TestingExtension = exports.renderStatusLine = exports.renderToString = exports.createTextService = exports.EnglishParser = exports.EnglishLanguageProvider = exports.CommandValidator = exports.createRestartCompletedEvent = exports.createQuitCancelledEvent = exports.createQuitConfirmedEvent = exports.createRestoreCompletedEvent = exports.createSaveCompletedEvent = exports.isPlatformRequestEvent = exports.PlatformEventType = exports.QueryType = exports.QuerySource = exports.createQueryManager = exports.QueryManager = exports.GameEngine = void 0;
9
+ // Re-export main types and classes that platforms need
10
+ var engine_1 = require("./src/index.js");
11
+ Object.defineProperty(exports, "GameEngine", { enumerable: true, get: function () { return engine_1.GameEngine; } });
12
+ // Query system and platform events from core
13
+ var core_1 = require("./src/index.js");
14
+ Object.defineProperty(exports, "QueryManager", { enumerable: true, get: function () { return core_1.QueryManager; } });
15
+ Object.defineProperty(exports, "createQueryManager", { enumerable: true, get: function () { return core_1.createQueryManager; } });
16
+ Object.defineProperty(exports, "QuerySource", { enumerable: true, get: function () { return core_1.QuerySource; } });
17
+ Object.defineProperty(exports, "QueryType", { enumerable: true, get: function () { return core_1.QueryType; } });
18
+ Object.defineProperty(exports, "PlatformEventType", { enumerable: true, get: function () { return core_1.PlatformEventType; } });
19
+ Object.defineProperty(exports, "isPlatformRequestEvent", { enumerable: true, get: function () { return core_1.isPlatformRequestEvent; } });
20
+ Object.defineProperty(exports, "createSaveCompletedEvent", { enumerable: true, get: function () { return core_1.createSaveCompletedEvent; } });
21
+ Object.defineProperty(exports, "createRestoreCompletedEvent", { enumerable: true, get: function () { return core_1.createRestoreCompletedEvent; } });
22
+ Object.defineProperty(exports, "createQuitConfirmedEvent", { enumerable: true, get: function () { return core_1.createQuitConfirmedEvent; } });
23
+ Object.defineProperty(exports, "createQuitCancelledEvent", { enumerable: true, get: function () { return core_1.createQuitCancelledEvent; } });
24
+ Object.defineProperty(exports, "createRestartCompletedEvent", { enumerable: true, get: function () { return core_1.createRestartCompletedEvent; } });
25
+ var stdlib_1 = require("./src/index.js");
26
+ Object.defineProperty(exports, "CommandValidator", { enumerable: true, get: function () { return stdlib_1.CommandValidator; } });
27
+ // Language support
28
+ var lang_en_us_1 = require("./src/index.js");
29
+ Object.defineProperty(exports, "EnglishLanguageProvider", { enumerable: true, get: function () { return lang_en_us_1.EnglishLanguageProvider; } });
30
+ // Parser support
31
+ var parser_en_us_1 = require("./src/index.js");
32
+ Object.defineProperty(exports, "EnglishParser", { enumerable: true, get: function () { return parser_en_us_1.EnglishParser; } });
33
+ // Text services (ADR-096)
34
+ var text_service_1 = require("./src/index.js");
35
+ Object.defineProperty(exports, "createTextService", { enumerable: true, get: function () { return text_service_1.createTextService; } });
36
+ Object.defineProperty(exports, "renderToString", { enumerable: true, get: function () { return text_service_1.renderToString; } });
37
+ Object.defineProperty(exports, "renderStatusLine", { enumerable: true, get: function () { return text_service_1.renderStatusLine; } });
38
+ // Testing extension (ADR-109/110)
39
+ var ext_testing_1 = require("./src/index.js");
40
+ Object.defineProperty(exports, "TestingExtension", { enumerable: true, get: function () { return ext_testing_1.TestingExtension; } });
41
+ Object.defineProperty(exports, "createDebugContext", { enumerable: true, get: function () { return ext_testing_1.createDebugContext; } });
42
+ // Plugin system (ADR-120)
43
+ var plugins_1 = require("./src/index.js");
44
+ Object.defineProperty(exports, "PluginRegistry", { enumerable: true, get: function () { return plugins_1.PluginRegistry; } });
45
+ var plugin_npc_1 = require("./src/index.js");
46
+ Object.defineProperty(exports, "NpcPlugin", { enumerable: true, get: function () { return plugin_npc_1.NpcPlugin; } });
47
+ var plugin_scheduler_1 = require("./src/index.js");
48
+ Object.defineProperty(exports, "SchedulerPlugin", { enumerable: true, get: function () { return plugin_scheduler_1.SchedulerPlugin; } });
49
+ var plugin_state_machine_1 = require("./src/index.js");
50
+ Object.defineProperty(exports, "StateMachinePlugin", { enumerable: true, get: function () { return plugin_state_machine_1.StateMachinePlugin; } });
51
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../mnt/c/repotemp/sharpee/packages/sharpee/src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uDAAuD;AACvD,0CAKyB;AAJvB,oGAAA,UAAU,OAAA;AAWZ,6CAA6C;AAC7C,sCAsBuB;AArBrB,oGAAA,YAAY,OAAA;AACZ,0GAAA,kBAAkB,OAAA;AAKlB,mGAAA,WAAW,OAAA;AACX,iGAAA,SAAS,OAAA;AACT,yGAAA,iBAAiB,OAAA;AAOjB,8GAAA,sBAAsB,OAAA;AACtB,gHAAA,wBAAwB,OAAA;AACxB,mHAAA,2BAA2B,OAAA;AAC3B,gHAAA,wBAAwB,OAAA;AACxB,gHAAA,wBAAwB,OAAA;AACxB,mHAAA,2BAA2B,OAAA;AAG7B,0CAMyB;AADvB,0GAAA,gBAAgB,OAAA;AAGlB,mBAAmB;AACnB,kDAA8D;AAArD,qHAAA,uBAAuB,OAAA;AAEhC,iBAAiB;AACjB,sDAAsD;AAA7C,6GAAA,aAAa,OAAA;AAEtB,0BAA0B;AAC1B,sDAK+B;AAH7B,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA;AACd,gHAAA,gBAAgB,OAAA;AAMlB,kCAAkC;AAClC,oDAA4E;AAAnE,+GAAA,gBAAgB,OAAA;AAAE,iHAAA,kBAAkB,OAAA;AAE7C,0BAA0B;AAC1B,4CAAyG;AAAzC,yGAAA,cAAc,OAAA;AAC9E,kDAAgD;AAAvC,uGAAA,SAAS,OAAA;AAClB,8DAA4D;AAAnD,mHAAA,eAAe,OAAA;AACxB,sEAAmE;AAA1D,0HAAA,kBAAkB,OAAA"}
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@sharpee/sharpee",
3
- "version": "0.9.66-beta",
3
+ "version": "0.9.69-beta",
4
4
  "description": "Sharpee - Interactive Fiction Engine for TypeScript",
5
5
  "main": "./index.js",
6
- "module": "dist-npm/index.js",
7
6
  "types": "./index.d.ts",
8
7
  "bin": {
9
- "sharpee": "./dist-npm/cli/index.js"
8
+ "sharpee": "./cli/index.js"
10
9
  },
11
10
  "exports": {
12
11
  ".": {
@@ -15,18 +14,9 @@
15
14
  "default": "./index.js"
16
15
  }
17
16
  },
18
- "scripts": {
19
- "build": "tsc",
20
- "clean": "rimraf dist",
21
- "build:npm": "tsc --outDir dist-npm"
22
- },
23
17
  "dependencies": {
24
18
  "fflate": "^0.8.2"
25
19
  },
26
- "files": [
27
- "dist-npm",
28
- "templates"
29
- ],
30
20
  "keywords": [
31
21
  "interactive-fiction",
32
22
  "if",