tutorial-forge-cli 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 John Brecht
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # tutorial-forge-cli
2
+
3
+ CLI for [`tutorial-forge`](https://www.npmjs.com/package/tutorial-forge) — render scripted Playwright walkthroughs into narrated tutorial videos.
4
+
5
+ ```sh
6
+ pnpm add -D tutorial-forge tutorial-forge-cli playwright
7
+
8
+ tutorial-forge render # render every *.tutorial.ts per forge.config.ts
9
+ tutorial-forge list # discovered tutorials
10
+ tutorial-forge doctor # check node / ffmpeg / playwright / TTS env
11
+ tutorial-forge clean --cache # remove work dirs and the TTS cache
12
+ ```
13
+
14
+ Installed as `tutorial-forge` with a shorter `tforge` alias.
15
+
16
+ **Full documentation: [github.com/jbrecht/tutorial-forge](https://github.com/jbrecht/tutorial-forge)**
@@ -0,0 +1,3 @@
1
+ export declare function cleanCommand(opts: {
2
+ cache?: boolean;
3
+ }): Promise<void>;
package/dist/clean.js ADDED
@@ -0,0 +1,14 @@
1
+ import { join } from 'node:path';
2
+ import { rm } from 'node:fs/promises';
3
+ import { defaultCacheDir } from 'tutorial-forge';
4
+ export async function cleanCommand(opts) {
5
+ const workRoot = join(process.cwd(), '.forge');
6
+ await rm(workRoot, { recursive: true, force: true });
7
+ console.log(`removed ${workRoot}`);
8
+ if (opts.cache) {
9
+ const cache = defaultCacheDir();
10
+ await rm(cache, { recursive: true, force: true });
11
+ console.log(`removed ${cache}`);
12
+ }
13
+ }
14
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../src/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAyB;IAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC/C,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,EAAE,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;QAChC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function doctorCommand(): Promise<void>;
package/dist/doctor.js ADDED
@@ -0,0 +1,49 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { ffmpegVersion } from 'tutorial-forge';
3
+ export async function doctorCommand() {
4
+ const checks = [];
5
+ const nodeMajor = parseInt(process.versions.node.split('.')[0], 10);
6
+ checks.push({
7
+ name: 'node',
8
+ ok: nodeMajor >= 20,
9
+ detail: `v${process.versions.node}${nodeMajor >= 20 ? '' : ' (need >= 20)'}`,
10
+ });
11
+ const ffmpeg = await ffmpegVersion('ffmpeg');
12
+ const ffmpegMajor = ffmpeg ? parseInt(ffmpeg, 10) : 0;
13
+ checks.push({
14
+ name: 'ffmpeg',
15
+ ok: !!ffmpeg && (Number.isNaN(ffmpegMajor) || ffmpegMajor >= 6),
16
+ detail: ffmpeg ? `version ${ffmpeg}${!Number.isNaN(ffmpegMajor) && ffmpegMajor < 6 ? ' (need >= 6)' : ''}` : 'not found on PATH',
17
+ });
18
+ const ffprobe = await ffmpegVersion('ffprobe');
19
+ checks.push({ name: 'ffprobe', ok: !!ffprobe, detail: ffprobe ? `version ${ffprobe}` : 'not found on PATH' });
20
+ try {
21
+ const { chromium } = await import('playwright');
22
+ const exe = chromium.executablePath();
23
+ const installed = !!exe && existsSync(exe);
24
+ checks.push({
25
+ name: 'playwright chromium',
26
+ ok: installed,
27
+ detail: installed ? exe : 'not installed — run: npx playwright install chromium',
28
+ });
29
+ }
30
+ catch {
31
+ checks.push({ name: 'playwright chromium', ok: false, detail: 'playwright not installed' });
32
+ }
33
+ for (const env of ['ELEVENLABS_API_KEY', 'OPENAI_API_KEY']) {
34
+ checks.push({
35
+ name: env,
36
+ ok: true, // informational: only needed if that provider is configured
37
+ detail: process.env[env] ? 'set' : 'not set (only needed for that provider)',
38
+ });
39
+ }
40
+ let failed = false;
41
+ for (const c of checks) {
42
+ console.log(`${c.ok ? '✓' : '✗'} ${c.name.padEnd(22)} ${c.detail}`);
43
+ if (!c.ok)
44
+ failed = true;
45
+ }
46
+ if (failed)
47
+ process.exitCode = 1;
48
+ }
49
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQ/C,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,SAAS,IAAI,EAAE;QACnB,MAAM,EAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,GAAG,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;KAC7E,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,WAAW,IAAI,CAAC,CAAC;QAC/D,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,MAAM,CAAC,KAAK,CAA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7E,CAAC,CAAC;IACL,CAAC;IAED,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,CAAC,CAAC,EAAE;YAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,CAAC;IACD,IAAI,MAAM;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACnC,CAAC"}
package/dist/list.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function listCommand(globs: string[], opts: {
2
+ config?: string;
3
+ }): Promise<void>;
package/dist/list.js ADDED
@@ -0,0 +1,15 @@
1
+ import { loadConfig, discoverTutorials } from './load.js';
2
+ export async function listCommand(globs, opts) {
3
+ const cwd = process.cwd();
4
+ const config = await loadConfig(cwd, opts.config);
5
+ const patterns = globs.length > 0 ? globs : config.tutorials ?? ['**/*.tutorial.ts'];
6
+ const discovered = await discoverTutorials(cwd, patterns);
7
+ if (discovered.length === 0) {
8
+ console.log(`No tutorials matched ${patterns.join(', ')}`);
9
+ return;
10
+ }
11
+ for (const { tutorial, file } of discovered) {
12
+ console.log(`${tutorial.id} "${tutorial.title}" ${tutorial.steps.length} steps (${file})`);
13
+ }
14
+ }
15
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAe,EAAE,IAAyB;IAC1E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACrF,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC1D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,wBAAwB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO;IACT,CAAC;IACD,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,YAAY,IAAI,GAAG,CAAC,CAAC;IAChG,CAAC;AACH,CAAC"}
package/dist/load.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { type ForgeConfig, type Tutorial } from 'tutorial-forge';
2
+ export declare function loadConfig(cwd: string, explicitPath?: string): Promise<ForgeConfig>;
3
+ export interface DiscoveredTutorial {
4
+ tutorial: Tutorial;
5
+ file: string;
6
+ }
7
+ export declare function discoverTutorials(cwd: string, globs: string[]): Promise<DiscoveredTutorial[]>;
package/dist/load.js ADDED
@@ -0,0 +1,62 @@
1
+ import { resolve } from 'node:path';
2
+ import { createJiti } from 'jiti';
3
+ import { glob } from 'tinyglobby';
4
+ import { validateConfig, validateTutorial } from 'tutorial-forge';
5
+ import { access } from 'node:fs/promises';
6
+ const jiti = createJiti(import.meta.url, { interopDefault: true });
7
+ const CONFIG_CANDIDATES = ['forge.config.ts', 'forge.config.mts', 'forge.config.js', 'forge.config.mjs'];
8
+ export async function loadConfig(cwd, explicitPath) {
9
+ let path = explicitPath ? resolve(cwd, explicitPath) : null;
10
+ if (!path) {
11
+ for (const candidate of CONFIG_CANDIDATES) {
12
+ const p = resolve(cwd, candidate);
13
+ try {
14
+ await access(p);
15
+ path = p;
16
+ break;
17
+ }
18
+ catch {
19
+ /* try next */
20
+ }
21
+ }
22
+ }
23
+ if (!path) {
24
+ throw new Error(`No forge.config.{ts,js} found in ${cwd}. Create one with defineConfig() from "tutorial-forge".`);
25
+ }
26
+ const mod = await jiti.import(path);
27
+ const config = mod.default ?? mod;
28
+ return validateConfig(config);
29
+ }
30
+ export async function discoverTutorials(cwd, globs) {
31
+ const files = await glob(globs, {
32
+ cwd,
33
+ absolute: true,
34
+ ignore: ['**/node_modules/**', '**/dist/**', '**/.forge/**'],
35
+ });
36
+ files.sort();
37
+ const found = [];
38
+ for (const file of files) {
39
+ const mod = await jiti.import(file);
40
+ const def = mod.default ?? mod;
41
+ const tutorials = Array.isArray(def) ? def : [def];
42
+ for (const t of tutorials) {
43
+ if (!isTutorialLike(t)) {
44
+ throw new Error(`${file}: default export is not a Tutorial (need id, title, steps[])`);
45
+ }
46
+ validateTutorial(t);
47
+ found.push({ tutorial: t, file });
48
+ }
49
+ }
50
+ const ids = new Set();
51
+ for (const { tutorial, file } of found) {
52
+ if (ids.has(tutorial.id))
53
+ throw new Error(`Duplicate tutorial id "${tutorial.id}" (in ${file})`);
54
+ ids.add(tutorial.id);
55
+ }
56
+ return found;
57
+ }
58
+ function isTutorialLike(v) {
59
+ const t = v;
60
+ return !!t && typeof t.id === 'string' && typeof t.title === 'string' && Array.isArray(t.steps);
61
+ }
62
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU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AC,EAAE,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,CAAU;IAChC,MAAM,CAAC,GAAG,CAAa,CAAC;IACxB,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAClG,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/main.js ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { Command } from 'commander';
5
+ import { renderCommand } from './render.js';
6
+ import { listCommand } from './list.js';
7
+ import { doctorCommand } from './doctor.js';
8
+ import { cleanCommand } from './clean.js';
9
+ // Load .env from the invocation directory so TTS keys don't need exporting.
10
+ // Shell-set variables take precedence (loadEnvFile never overrides them).
11
+ const envFile = join(process.cwd(), '.env');
12
+ if (existsSync(envFile)) {
13
+ try {
14
+ process.loadEnvFile(envFile);
15
+ }
16
+ catch {
17
+ /* Node < 20.12 or malformed file — fall back to the shell environment */
18
+ }
19
+ }
20
+ const program = new Command('tutorial-forge')
21
+ .description('tutorial-forge — scripted Playwright walkthroughs to narrated tutorial videos')
22
+ .version('0.1.0');
23
+ program
24
+ .command('render')
25
+ .description('render tutorials to MP4')
26
+ .argument('[globs...]', 'tutorial file globs (default: config or **/*.tutorial.ts)')
27
+ .option('--only <id>', 'render only the tutorial with this id')
28
+ .option('--phase <phase>', 'tts | record | post | all', 'all')
29
+ .option('--headed', 'show the browser while recording')
30
+ .option('--keep-work', 'keep the work directory on success')
31
+ .option('--out-dir <dir>', 'output directory (overrides config)')
32
+ .option('--concurrency <n>', 'TTS synthesis concurrency')
33
+ .option('--config <path>', 'path to forge.config.ts')
34
+ .action(async (globs, opts) => {
35
+ if (!['tts', 'record', 'post', 'all'].includes(opts.phase)) {
36
+ throw new Error(`Invalid --phase "${opts.phase}"`);
37
+ }
38
+ await renderCommand(globs, opts);
39
+ });
40
+ program
41
+ .command('list')
42
+ .description('list discovered tutorials')
43
+ .argument('[globs...]')
44
+ .option('--config <path>', 'path to forge.config.ts')
45
+ .action(listCommand);
46
+ program
47
+ .command('doctor')
48
+ .description('check the environment (node, ffmpeg, playwright, TTS env vars)')
49
+ .action(doctorCommand);
50
+ program
51
+ .command('clean')
52
+ .description('remove .forge/ work dirs')
53
+ .option('--cache', 'also clear the TTS cache')
54
+ .action(cleanCommand);
55
+ program.parseAsync().catch((err) => {
56
+ console.error(err instanceof Error ? err.message : err);
57
+ process.exit(1);
58
+ });
59
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,4EAA4E;AAC5E,0EAA0E;AAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;AAC5C,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IACxB,IAAI,CAAC;QACH,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;AACH,CA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,CAAC,CAAC;AAEzB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC;KAC7C,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC1C,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface RenderCmdOptions {
2
+ only?: string;
3
+ phase: 'tts' | 'record' | 'post' | 'all';
4
+ headed?: boolean;
5
+ keepWork?: boolean;
6
+ outDir?: string;
7
+ concurrency?: string;
8
+ config?: string;
9
+ }
10
+ export declare function renderCommand(globs: string[], opts: RenderCmdOptions): Promise<void>;
package/dist/render.js ADDED
@@ -0,0 +1,45 @@
1
+ import { join, resolve } from 'node:path';
2
+ import { render } from 'tutorial-forge';
3
+ import { loadConfig, discoverTutorials } from './load.js';
4
+ export async function renderCommand(globs, opts) {
5
+ const cwd = process.cwd();
6
+ const config = await loadConfig(cwd, opts.config);
7
+ const patterns = globs.length > 0 ? globs : config.tutorials ?? ['**/*.tutorial.ts'];
8
+ let discovered = await discoverTutorials(cwd, patterns);
9
+ if (opts.only) {
10
+ discovered = discovered.filter((d) => d.tutorial.id === opts.only);
11
+ if (discovered.length === 0)
12
+ throw new Error(`No tutorial with id "${opts.only}" found`);
13
+ }
14
+ if (discovered.length === 0) {
15
+ throw new Error(`No tutorials matched ${patterns.join(', ')}`);
16
+ }
17
+ const outDir = resolve(cwd, opts.outDir ?? config.outDir ?? 'tutorials/dist');
18
+ for (const { tutorial } of discovered) {
19
+ console.log(`\n▶ ${tutorial.id} — ${tutorial.title} (${tutorial.steps.length} steps)`);
20
+ const result = await render(tutorial, config.adapter, {
21
+ tts: config.tts,
22
+ output: join(outDir, `${tutorial.id}.mp4`),
23
+ workDir: join(cwd, '.forge', tutorial.id),
24
+ viewport: config.viewport,
25
+ headless: opts.headed ? false : config.headless ?? true,
26
+ cursor: config.cursor,
27
+ callouts: config.callouts,
28
+ subtitles: config.subtitles,
29
+ leadInMs: config.leadInMs,
30
+ keepWorkDir: opts.keepWork ?? config.keepWorkDir,
31
+ ttsCacheDir: config.ttsCacheDir,
32
+ ttsConcurrency: opts.concurrency ? parseInt(opts.concurrency, 10) : config.ttsConcurrency,
33
+ phase: opts.phase,
34
+ });
35
+ if (opts.phase === 'all' || opts.phase === 'post') {
36
+ console.log(`✓ ${result.output} (${(result.outputDurationMs / 1000).toFixed(1)}s)`);
37
+ if (result.srtPath)
38
+ console.log(` subtitles: ${result.srtPath}`);
39
+ }
40
+ else {
41
+ console.log(`✓ phase "${opts.phase}" complete — work dir: ${result.workDir}`);
42
+ }
43
+ }
44
+ }
45
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAoB,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAY1D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,IAAsB;IACzE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAgB,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,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AAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI;YACvD,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,WAAW,EAAE,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,WAAW;YAChD,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc;YACzF,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACpF,IAAI,MAAM,CAAC,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACpE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,KAAK,0BAA0B,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "tutorial-forge-cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI for tutorial-forge: render scripted Playwright walkthroughs into narrated tutorial videos",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "John Brecht <john.brecht@gmail.com>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/jbrecht/tutorial-forge.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "homepage": "https://github.com/jbrecht/tutorial-forge#readme",
14
+ "bugs": "https://github.com/jbrecht/tutorial-forge/issues",
15
+ "keywords": [
16
+ "playwright",
17
+ "tutorial",
18
+ "video",
19
+ "screen-recording",
20
+ "tts",
21
+ "cli"
22
+ ],
23
+ "bin": {
24
+ "tutorial-forge": "./dist/main.js",
25
+ "tforge": "./dist/main.js"
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "dependencies": {
31
+ "commander": "^13.0.0",
32
+ "jiti": "^2.4.0",
33
+ "tinyglobby": "^0.2.10",
34
+ "tutorial-forge": "0.1.0"
35
+ },
36
+ "devDependencies": {
37
+ "playwright": "^1.59.0"
38
+ },
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.json",
44
+ "typecheck": "tsc -p tsconfig.json --noEmit",
45
+ "test": "echo 'no unit tests in cli'"
46
+ }
47
+ }