@sharpee/sharpee 1.0.0 → 1.1.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.
@@ -1,208 +0,0 @@
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
- '--define:process.env.PARSER_DEBUG=\\"false\\"',
129
- '--define:process.env.DEBUG_PRONOUNS=\\"\\"',
130
- ];
131
- if (minify) {
132
- esbuildArgs.push('--minify');
133
- }
134
- if (sourcemap) {
135
- esbuildArgs.push('--sourcemap');
136
- }
137
- try {
138
- (0, child_process_1.execSync)(`npx esbuild ${esbuildArgs.join(' ')}`, {
139
- cwd: projectDir,
140
- stdio: 'pipe',
141
- });
142
- console.log(` ✓ Built ${info.storyId}.js`);
143
- }
144
- catch (error) {
145
- console.error(' ✗ Build failed');
146
- if (error.stderr) {
147
- console.error(error.stderr.toString());
148
- }
149
- process.exit(1);
150
- }
151
- // Copy HTML template
152
- const browserHtmlPath = path.join(projectDir, 'browser', 'index.html');
153
- const defaultHtmlPath = path.join(__dirname, '..', '..', 'templates', 'browser', 'index.html');
154
- const htmlSource = fs.existsSync(browserHtmlPath) ? browserHtmlPath : defaultHtmlPath;
155
- if (fs.existsSync(htmlSource)) {
156
- let htmlContent = fs.readFileSync(htmlSource, 'utf-8');
157
- htmlContent = processTemplate(htmlContent, info);
158
- fs.writeFileSync(path.join(outDir, 'index.html'), htmlContent);
159
- console.log(' ✓ Copied index.html');
160
- }
161
- else {
162
- console.warn(' ⚠ HTML template not found');
163
- }
164
- // Copy CSS
165
- const browserCssPath = path.join(projectDir, 'browser', 'styles.css');
166
- const defaultCssPath = path.join(__dirname, '..', '..', 'templates', 'browser', 'styles.css');
167
- const cssSource = fs.existsSync(browserCssPath) ? browserCssPath : defaultCssPath;
168
- if (fs.existsSync(cssSource)) {
169
- fs.copyFileSync(cssSource, path.join(outDir, 'styles.css'));
170
- console.log(' ✓ Copied styles.css');
171
- }
172
- else {
173
- console.warn(' ⚠ CSS file not found');
174
- }
175
- // Report bundle size
176
- const bundlePath = path.join(outDir, info.storyId + '.js');
177
- if (fs.existsSync(bundlePath)) {
178
- const stats = fs.statSync(bundlePath);
179
- const sizeKb = (stats.size / 1024).toFixed(1);
180
- console.log(`\n Bundle size: ${sizeKb} KB`);
181
- }
182
- console.log('\n✅ Build complete!\n');
183
- console.log(`Output: ${path.relative(projectDir, outDir)}/`);
184
- console.log('');
185
- console.log('To test locally:');
186
- console.log(` npx serve ${path.relative(projectDir, outDir)}`);
187
- console.log('');
188
- }
189
- function showHelp() {
190
- console.log(`
191
- sharpee build-browser - Build a web browser bundle
192
-
193
- Usage: sharpee build-browser [options]
194
-
195
- Options:
196
- --no-minify Skip minification
197
- --no-sourcemap Skip source map generation
198
-
199
- Output:
200
- dist/web/
201
- index.html HTML page
202
- <story-id>.js JavaScript bundle
203
- styles.css Stylesheet
204
-
205
- The bundle includes your story, the Sharpee engine, and all dependencies.
206
- `);
207
- }
208
- //# sourceMappingURL=build-browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-browser.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/sharpee/src/cli/build-browser.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DH,wDAgHC;AAzKD,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,KAA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qBAAqB;IACrB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;IAC3D,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,oBAAoB,MAAM,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,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 DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * CLI: sharpee build
3
- *
4
- * Builds a .sharpee story bundle and browser client from a story project.
5
- * With --test, also compiles the story and runs transcript tests.
6
- */
7
- export declare function runBuildCommand(args: string[]): Promise<void>;
8
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/sharpee/src/cli/build.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiDH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoInE"}
package/cli/build.js DELETED
@@ -1,318 +0,0 @@
1
- "use strict";
2
- /**
3
- * CLI: sharpee build
4
- *
5
- * Builds a .sharpee story bundle and browser client from a story project.
6
- * With --test, also compiles the story and runs transcript tests.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.runBuildCommand = runBuildCommand;
43
- const fs = __importStar(require("fs"));
44
- const path = __importStar(require("path"));
45
- const child_process_1 = require("child_process");
46
- const fflate_1 = require("fflate");
47
- const build_browser_1 = require("./build-browser");
48
- function readRecursive(dir, base = '') {
49
- const entries = {};
50
- for (const item of fs.readdirSync(dir)) {
51
- const full = path.join(dir, item);
52
- const rel = base ? `${base}/${item}` : item;
53
- if (fs.statSync(full).isDirectory()) {
54
- Object.assign(entries, readRecursive(full, rel));
55
- }
56
- else {
57
- entries[rel] = new Uint8Array(fs.readFileSync(full));
58
- }
59
- }
60
- return entries;
61
- }
62
- /**
63
- * Find transcript files matching a glob pattern in a directory.
64
- * Returns sorted file paths.
65
- */
66
- function findTranscriptFiles(dir, pattern) {
67
- if (!fs.existsSync(dir))
68
- return [];
69
- const files = [];
70
- for (const entry of fs.readdirSync(dir)) {
71
- if (entry.endsWith('.transcript')) {
72
- // Simple glob: 'wt-*.transcript' matches files starting with 'wt-'
73
- if (!pattern || entry.match(new RegExp('^' + pattern.replace(/\*/g, '.*') + '$'))) {
74
- files.push(path.join(dir, entry));
75
- }
76
- }
77
- }
78
- return files.sort();
79
- }
80
- async function runBuildCommand(args) {
81
- if (args.includes('--help') || args.includes('-h')) {
82
- showHelp();
83
- return;
84
- }
85
- const runTests = args.includes('--test');
86
- const verbose = args.includes('--verbose') || args.includes('-v');
87
- const stopOnFailure = args.includes('--stop-on-failure');
88
- const projectDir = process.cwd();
89
- const packagePath = path.join(projectDir, 'package.json');
90
- if (!fs.existsSync(packagePath)) {
91
- console.error('Error: No package.json found. Run from a story project directory.');
92
- process.exit(1);
93
- }
94
- const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
95
- const config = pkg.sharpee || {};
96
- const storyName = config.title?.toLowerCase().replace(/\s+/g, '-') || pkg.name?.replace(/^@.*\//, '') || 'story';
97
- const storySrc = path.join(projectDir, 'src', 'index.ts');
98
- if (!fs.existsSync(storySrc)) {
99
- console.error('Error: src/index.ts not found.');
100
- process.exit(1);
101
- }
102
- console.log(`\nBuilding: ${config.title || storyName}\n`);
103
- // --- Compile TypeScript (needed for both bundle and testing) ---
104
- console.log('--- Compiling TypeScript ---\n');
105
- const tsconfigPath = path.join(projectDir, 'tsconfig.json');
106
- try {
107
- (0, child_process_1.execSync)('npx tsc', { cwd: projectDir, stdio: 'pipe' });
108
- console.log(' TypeScript compiled successfully\n');
109
- }
110
- catch (error) {
111
- console.error(' TypeScript compilation failed');
112
- if (error.stdout)
113
- console.error(error.stdout.toString());
114
- if (error.stderr)
115
- console.error(error.stderr.toString());
116
- process.exit(1);
117
- }
118
- // --- .sharpee bundle ---
119
- console.log('--- Story Bundle (.sharpee) ---\n');
120
- const distDir = path.join(projectDir, 'dist');
121
- fs.mkdirSync(distDir, { recursive: true });
122
- // 1. esbuild story → ESM with @sharpee/* external
123
- const storyJsPath = path.join(distDir, 'story.js');
124
- const tsconfigArg = fs.existsSync(tsconfigPath) ? `--tsconfig=${tsconfigPath}` : '';
125
- try {
126
- (0, child_process_1.execSync)(`npx esbuild "${storySrc}" --bundle --platform=browser --format=esm --target=es2020 --outfile="${storyJsPath}" --external:@sharpee/* ${tsconfigArg}`, { cwd: projectDir, stdio: 'pipe' });
127
- console.log(' story.js');
128
- }
129
- catch (error) {
130
- console.error(' Failed to build story.js');
131
- if (error.stderr)
132
- console.error(error.stderr.toString());
133
- process.exit(1);
134
- }
135
- // 2. Generate meta.json
136
- const meta = {
137
- format: 'sharpee-story',
138
- formatVersion: 1,
139
- id: pkg.name,
140
- title: config.title || pkg.name,
141
- author: config.author || 'Unknown',
142
- version: pkg.version,
143
- description: config.headline || pkg.description || '',
144
- sharpeeVersion: '>=0.9.0',
145
- ifid: config.ifid || '',
146
- hasAssets: fs.existsSync(path.join(projectDir, 'assets')),
147
- hasTheme: fs.existsSync(path.join(projectDir, 'theme.css')),
148
- preferredTheme: config.preferredTheme || 'classic-light',
149
- };
150
- // 3. Assemble zip contents
151
- const zipEntries = {};
152
- zipEntries['story.js'] = new Uint8Array(fs.readFileSync(storyJsPath));
153
- zipEntries['meta.json'] = (0, fflate_1.strToU8)(JSON.stringify(meta, null, 2) + '\n');
154
- const assetsDir = path.join(projectDir, 'assets');
155
- if (fs.existsSync(assetsDir)) {
156
- const assetEntries = readRecursive(assetsDir, 'assets');
157
- Object.assign(zipEntries, assetEntries);
158
- console.log(` assets/ (${Object.keys(assetEntries).length} files)`);
159
- }
160
- const themePath = path.join(projectDir, 'theme.css');
161
- if (fs.existsSync(themePath)) {
162
- zipEntries['theme.css'] = new Uint8Array(fs.readFileSync(themePath));
163
- console.log(' theme.css');
164
- }
165
- // 4. Create .sharpee zip
166
- const zipped = (0, fflate_1.zipSync)(zipEntries);
167
- const outFile = path.join(distDir, `${storyName}.sharpee`);
168
- fs.writeFileSync(outFile, zipped);
169
- const sizeKb = (fs.statSync(outFile).size / 1024).toFixed(1);
170
- console.log(` meta.json`);
171
- console.log(`\n Output: ${path.relative(projectDir, outFile)} (${sizeKb} KB)\n`);
172
- // Clean up temp story.js
173
- fs.unlinkSync(storyJsPath);
174
- // --- Browser client ---
175
- console.log('--- Browser Client ---\n');
176
- const browserEntry = path.join(projectDir, 'src', 'browser-entry.ts');
177
- if (fs.existsSync(browserEntry)) {
178
- await (0, build_browser_1.runBuildBrowserCommand)(args.filter(a => a !== '--help' && a !== '-h' && a !== '--test' && a !== '--verbose' && a !== '-v' && a !== '--stop-on-failure'));
179
- }
180
- else {
181
- console.log(' Skipped (no src/browser-entry.ts)\n');
182
- console.log(' Run "sharpee init-browser" to add browser support.\n');
183
- }
184
- // --- Run transcript tests ---
185
- if (runTests) {
186
- console.log('--- Running Transcript Tests ---\n');
187
- await runTranscriptTests(projectDir, { verbose, stopOnFailure });
188
- }
189
- console.log('Build complete!\n');
190
- }
191
- /**
192
- * Run transcript tests for a story project.
193
- * Loads the compiled story from dist/, finds transcript files, and runs them.
194
- */
195
- async function runTranscriptTests(projectDir, options) {
196
- // Lazy-load transcript-tester to avoid import issues when not testing
197
- const { loadStory, parseTranscriptFile, runTranscript, reportTranscript, reportTestRun, getExitCode } = require("../../transcript-tester/index.js");
198
- const { TranscriptResult, TestRunResult } = require("../../transcript-tester/index.js");
199
- // Find transcript files
200
- const walkthroughDir = path.join(projectDir, 'walkthroughs');
201
- const unitTestDir = path.join(projectDir, 'tests', 'transcripts');
202
- const walkthroughs = findTranscriptFiles(walkthroughDir, 'wt-*.transcript');
203
- const unitTests = findTranscriptFiles(unitTestDir, '*.transcript');
204
- if (walkthroughs.length === 0 && unitTests.length === 0) {
205
- console.log(' No transcript files found.\n');
206
- console.log(' Place walkthroughs in walkthroughs/wt-*.transcript');
207
- console.log(' Place unit tests in tests/transcripts/*.transcript\n');
208
- return;
209
- }
210
- // Load the story from compiled dist/
211
- let game;
212
- try {
213
- game = await loadStory(projectDir);
214
- }
215
- catch (error) {
216
- console.error(` Failed to load story: ${error.message}`);
217
- console.error(' Make sure TypeScript compiled successfully (dist/index.js exists).\n');
218
- process.exit(1);
219
- }
220
- const allResults = [];
221
- let totalPassed = 0;
222
- let totalFailed = 0;
223
- let totalExpectedFailures = 0;
224
- let totalSkipped = 0;
225
- let totalDuration = 0;
226
- // Run walkthrough chain (state persists between transcripts)
227
- if (walkthroughs.length > 0) {
228
- console.log(` Walkthroughs: ${walkthroughs.length} files (chained)\n`);
229
- for (const wtPath of walkthroughs) {
230
- const transcript = parseTranscriptFile(wtPath);
231
- const result = await runTranscript(transcript, game, {
232
- verbose: options.verbose,
233
- stopOnFailure: options.stopOnFailure,
234
- savesDirectory: path.join(projectDir, '.test-saves'),
235
- });
236
- reportTranscript(result, { verbose: options.verbose });
237
- allResults.push(result);
238
- totalPassed += result.passed;
239
- totalFailed += result.failed;
240
- totalExpectedFailures += result.expectedFailures;
241
- totalSkipped += result.skipped;
242
- totalDuration += result.duration;
243
- if (options.stopOnFailure && result.failed > 0) {
244
- break;
245
- }
246
- }
247
- }
248
- // Run unit tests (each gets a fresh game instance)
249
- if (unitTests.length > 0 && !(options.stopOnFailure && totalFailed > 0)) {
250
- console.log(`\n Unit tests: ${unitTests.length} files\n`);
251
- for (const utPath of unitTests) {
252
- // Create fresh game for each unit test
253
- let unitGame;
254
- try {
255
- unitGame = await loadStory(projectDir);
256
- }
257
- catch (error) {
258
- console.error(` Failed to reload story for unit test: ${error.message}`);
259
- continue;
260
- }
261
- const transcript = parseTranscriptFile(utPath);
262
- const result = await runTranscript(transcript, unitGame, {
263
- verbose: options.verbose,
264
- stopOnFailure: options.stopOnFailure,
265
- savesDirectory: path.join(projectDir, '.test-saves'),
266
- });
267
- reportTranscript(result, { verbose: options.verbose });
268
- allResults.push(result);
269
- totalPassed += result.passed;
270
- totalFailed += result.failed;
271
- totalExpectedFailures += result.expectedFailures;
272
- totalSkipped += result.skipped;
273
- totalDuration += result.duration;
274
- if (options.stopOnFailure && result.failed > 0) {
275
- break;
276
- }
277
- }
278
- }
279
- // Report summary
280
- const testRunResult = {
281
- transcripts: allResults,
282
- totalPassed,
283
- totalFailed,
284
- totalExpectedFailures,
285
- totalSkipped,
286
- totalDuration,
287
- };
288
- reportTestRun(testRunResult);
289
- if (totalFailed > 0) {
290
- process.exit(1);
291
- }
292
- }
293
- function showHelp() {
294
- console.log(`
295
- sharpee build - Build story bundle, browser client, and run tests
296
-
297
- Usage: sharpee build [options]
298
-
299
- Options:
300
- --test Compile story and run transcript tests after building
301
- --verbose, -v Show detailed test output
302
- --stop-on-failure Stop on first test failure
303
- --no-minify Skip minification (browser client)
304
- --no-sourcemap Skip source map generation (browser client)
305
-
306
- Output:
307
- dist/<story>.sharpee Story bundle for Zifmia runner
308
- dist/web/ Browser client (if browser-entry.ts exists)
309
-
310
- Test files:
311
- walkthroughs/wt-*.transcript Walkthrough chain (state persists between files)
312
- tests/transcripts/*.transcript Unit tests (fresh game per file)
313
-
314
- Run from a story project directory with a package.json containing
315
- a "sharpee" config block.
316
- `);
317
- }
318
- //# sourceMappingURL=build.js.map
package/cli/build.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/sharpee/src/cli/build.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,gBAAgB,CAAC;YACjD,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC;YAC/B,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC;YAEjC,IAAI,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/C,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,iBAAiB;IACjB,MAAM,aAAa,GAAG;QACpB,WAAW,EAAE,UAAU;QACvB,WAAW;QACX,WAAW;QACX,qBAAqB;QACrB,YAAY;QACZ,aAAa;KACd,CAAC;IAEF,aAAa,CAAC,aAAa,CAAC,CAAC;IAE7B,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;CAsBb,CAAC,CAAC;AACH,CAAC"}
package/cli/ifid.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function runIfidCommand(args: string[]): void;
2
- //# sourceMappingURL=ifid.d.ts.map
package/cli/ifid.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ifid.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/sharpee/src/cli/ifid.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAmBnD"}
package/cli/ifid.js DELETED
@@ -1,71 +0,0 @@
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("../../core/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
package/cli/ifid.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ifid.js","sourceRoot":"","sources":["../../../../../../../repos/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,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;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 DELETED
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/sharpee/src/cli/index.ts"],"names":[],"mappings":";AACA;;;;GAIG"}