@contractspec/example.video-docs-terminal 2.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/.turbo/turbo-build.log +38 -0
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +14 -0
- package/dist/browser/build-tutorial.js +60 -0
- package/dist/browser/docs/index.js +89 -0
- package/dist/browser/docs/video-docs-terminal.docblock.js +89 -0
- package/dist/browser/example.js +33 -0
- package/dist/browser/generate-narration.js +18 -0
- package/dist/browser/index.js +389 -0
- package/dist/browser/sample-tutorials.js +192 -0
- package/dist/build-tutorial.d.ts +44 -0
- package/dist/build-tutorial.js +61 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +90 -0
- package/dist/docs/video-docs-terminal.docblock.d.ts +1 -0
- package/dist/docs/video-docs-terminal.docblock.js +90 -0
- package/dist/example.d.ts +2 -0
- package/dist/example.js +34 -0
- package/dist/generate-narration.d.ts +42 -0
- package/dist/generate-narration.js +19 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +390 -0
- package/dist/node/build-tutorial.js +60 -0
- package/dist/node/docs/index.js +89 -0
- package/dist/node/docs/video-docs-terminal.docblock.js +89 -0
- package/dist/node/example.js +33 -0
- package/dist/node/generate-narration.js +18 -0
- package/dist/node/index.js +389 -0
- package/dist/node/sample-tutorials.js +192 -0
- package/dist/sample-tutorials.d.ts +40 -0
- package/dist/sample-tutorials.js +193 -0
- package/package.json +159 -0
- package/src/build-tutorial.ts +120 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/video-docs-terminal.docblock.ts +93 -0
- package/src/example.ts +32 -0
- package/src/generate-narration.ts +70 -0
- package/src/index.ts +7 -0
- package/src/sample-tutorials.ts +241 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.js +3 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
$ contractspec-bun-build prebuild
|
|
2
|
+
$ bun run prebuild && bun run build:bundle && bun run build:types
|
|
3
|
+
$ contractspec-bun-build prebuild
|
|
4
|
+
$ contractspec-bun-build transpile
|
|
5
|
+
[contractspec-bun-build] transpile target=bun root=src entries=7
|
|
6
|
+
Bundled 7 modules in 28ms
|
|
7
|
+
|
|
8
|
+
./build-tutorial.js 1.87 KB (entry point)
|
|
9
|
+
./index.js 14.53 KB (entry point)
|
|
10
|
+
docs/index.js 3.77 KB (entry point)
|
|
11
|
+
docs/video-docs-terminal.docblock.js 3.77 KB (entry point)
|
|
12
|
+
./example.js 1.0 KB (entry point)
|
|
13
|
+
./generate-narration.js 0.69 KB (entry point)
|
|
14
|
+
./sample-tutorials.js 7.26 KB (entry point)
|
|
15
|
+
|
|
16
|
+
[contractspec-bun-build] transpile target=node root=src entries=7
|
|
17
|
+
Bundled 7 modules in 31ms
|
|
18
|
+
|
|
19
|
+
./build-tutorial.js 1.86 KB (entry point)
|
|
20
|
+
./index.js 14.42 KB (entry point)
|
|
21
|
+
docs/index.js 3.76 KB (entry point)
|
|
22
|
+
docs/video-docs-terminal.docblock.js 3.76 KB (entry point)
|
|
23
|
+
./example.js 1.00 KB (entry point)
|
|
24
|
+
./generate-narration.js 0.68 KB (entry point)
|
|
25
|
+
./sample-tutorials.js 7.15 KB (entry point)
|
|
26
|
+
|
|
27
|
+
[contractspec-bun-build] transpile target=browser root=src entries=7
|
|
28
|
+
Bundled 7 modules in 17ms
|
|
29
|
+
|
|
30
|
+
./build-tutorial.js 1.86 KB (entry point)
|
|
31
|
+
./index.js 14.42 KB (entry point)
|
|
32
|
+
docs/index.js 3.76 KB (entry point)
|
|
33
|
+
docs/video-docs-terminal.docblock.js 3.76 KB (entry point)
|
|
34
|
+
./example.js 1.00 KB (entry point)
|
|
35
|
+
./generate-narration.js 0.68 KB (entry point)
|
|
36
|
+
./sample-tutorials.js 7.15 KB (entry point)
|
|
37
|
+
|
|
38
|
+
$ contractspec-bun-build types
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ contractspec-bun-build prebuild
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @contractspec/example.video-docs-terminal
|
|
2
|
+
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ac88935: chore: add examples
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [57e2819]
|
|
12
|
+
- @contractspec/lib.contracts-spec@2.1.1
|
|
13
|
+
- @contractspec/lib.content-gen@2.1.1
|
|
14
|
+
- @contractspec/lib.video-gen@1.42.1
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/build-tutorial.ts
|
|
2
|
+
import { VIDEO_FORMATS } from "@contractspec/lib.video-gen/design/layouts";
|
|
3
|
+
var DEFAULT_FPS = 30;
|
|
4
|
+
var DEFAULT_SCENE_DURATION_SECONDS = 12;
|
|
5
|
+
function buildTutorialVideo(tutorial, options) {
|
|
6
|
+
const fps = options?.fps ?? DEFAULT_FPS;
|
|
7
|
+
const sceneDuration = options?.sceneDurationSeconds ?? DEFAULT_SCENE_DURATION_SECONDS;
|
|
8
|
+
const durationInFrames = sceneDuration * fps;
|
|
9
|
+
return {
|
|
10
|
+
id: `tutorial-${tutorial.id}-${Date.now().toString(36)}`,
|
|
11
|
+
scenes: [
|
|
12
|
+
{
|
|
13
|
+
id: `scene-${tutorial.id}`,
|
|
14
|
+
compositionId: "TerminalDemo",
|
|
15
|
+
props: {
|
|
16
|
+
title: tutorial.title,
|
|
17
|
+
subtitle: tutorial.subtitle,
|
|
18
|
+
lines: tutorial.lines,
|
|
19
|
+
terminalTitle: tutorial.terminalTitle,
|
|
20
|
+
prompt: options?.prompt ?? "$ ",
|
|
21
|
+
summary: tutorial.summary
|
|
22
|
+
},
|
|
23
|
+
durationInFrames
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
totalDurationInFrames: durationInFrames,
|
|
27
|
+
fps,
|
|
28
|
+
format: VIDEO_FORMATS.landscape
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function buildTutorialSuite(tutorials, options) {
|
|
32
|
+
const fps = options?.fps ?? DEFAULT_FPS;
|
|
33
|
+
const sceneDuration = options?.sceneDurationSeconds ?? DEFAULT_SCENE_DURATION_SECONDS;
|
|
34
|
+
const durationInFrames = sceneDuration * fps;
|
|
35
|
+
const scenes = tutorials.map((tutorial) => ({
|
|
36
|
+
id: `scene-${tutorial.id}`,
|
|
37
|
+
compositionId: "TerminalDemo",
|
|
38
|
+
props: {
|
|
39
|
+
title: tutorial.title,
|
|
40
|
+
subtitle: tutorial.subtitle,
|
|
41
|
+
lines: tutorial.lines,
|
|
42
|
+
terminalTitle: tutorial.terminalTitle,
|
|
43
|
+
prompt: options?.prompt ?? "$ ",
|
|
44
|
+
summary: tutorial.summary
|
|
45
|
+
},
|
|
46
|
+
durationInFrames
|
|
47
|
+
}));
|
|
48
|
+
const totalDurationInFrames = scenes.reduce((sum, s) => sum + s.durationInFrames, 0);
|
|
49
|
+
return {
|
|
50
|
+
id: `tutorial-suite-${Date.now().toString(36)}`,
|
|
51
|
+
scenes,
|
|
52
|
+
totalDurationInFrames,
|
|
53
|
+
fps,
|
|
54
|
+
format: VIDEO_FORMATS.landscape
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
buildTutorialVideo,
|
|
59
|
+
buildTutorialSuite
|
|
60
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/docs/video-docs-terminal.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.video-docs-terminal",
|
|
6
|
+
title: "Video Docs Terminal (example)",
|
|
7
|
+
summary: "Generate terminal demo videos from CLI walkthroughs using the TerminalDemo composition and ScriptGenerator.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/video-docs-terminal",
|
|
11
|
+
tags: ["video", "documentation", "terminal", "cli", "example"],
|
|
12
|
+
body: `## What this example shows
|
|
13
|
+
|
|
14
|
+
- Defining CLI tutorials as structured \`CliTutorial\` objects with \`TerminalLine\` arrays.
|
|
15
|
+
- Building single-scene and multi-scene \`VideoProject\` instances using the \`TerminalDemo\` composition.
|
|
16
|
+
- Using \`ScriptGenerator\` (deterministic, no LLM) to generate narration from tutorial content briefs.
|
|
17
|
+
- Assembling a full documentation video covering init, build, validate, and deploy workflows.
|
|
18
|
+
|
|
19
|
+
## Key concepts
|
|
20
|
+
|
|
21
|
+
- **CliTutorial**: Combines \`TerminalLine[]\` (commands + output) with a \`ContentBrief\` for narration.
|
|
22
|
+
- **TerminalDemo**: The Remotion composition that renders animated terminal sessions.
|
|
23
|
+
- **ScriptGenerator**: Produces narration scripts from content briefs. Deterministic by default.
|
|
24
|
+
- **VideoProject**: The output scene graph -- one scene per tutorial, ready for rendering or preview.
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
- No LLM or voice provider is needed -- the pipeline is fully deterministic.
|
|
29
|
+
- Each tutorial maps to one \`TerminalDemo\` scene in the final video project.
|
|
30
|
+
- The example produces the \`VideoProject\` data structure, not rendered MP4. Use \`LocalRenderer\` for final output.
|
|
31
|
+
`
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "docs.examples.video-docs-terminal.usage",
|
|
35
|
+
title: "Video Docs Terminal -- Usage",
|
|
36
|
+
summary: "How to generate terminal demo videos and narration from CLI tutorials.",
|
|
37
|
+
kind: "usage",
|
|
38
|
+
visibility: "public",
|
|
39
|
+
route: "/docs/examples/video-docs-terminal/usage",
|
|
40
|
+
tags: ["video", "terminal", "usage"],
|
|
41
|
+
body: `## Usage
|
|
42
|
+
|
|
43
|
+
### Build a single tutorial video
|
|
44
|
+
|
|
45
|
+
\`\`\`ts
|
|
46
|
+
import { buildTutorialVideo } from "@contractspec/example.video-docs-terminal/build-tutorial";
|
|
47
|
+
import { initTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
|
|
48
|
+
|
|
49
|
+
const project = buildTutorialVideo(initTutorial);
|
|
50
|
+
|
|
51
|
+
console.log(project.scenes.length); // 1
|
|
52
|
+
console.log(project.scenes[0].compositionId); // "TerminalDemo"
|
|
53
|
+
console.log(project.totalDurationInFrames); // 360 (12s × 30fps)
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
### Build a multi-scene tutorial suite
|
|
57
|
+
|
|
58
|
+
\`\`\`ts
|
|
59
|
+
import { buildTutorialSuite } from "@contractspec/example.video-docs-terminal/build-tutorial";
|
|
60
|
+
import { allTutorials } from "@contractspec/example.video-docs-terminal/sample-tutorials";
|
|
61
|
+
|
|
62
|
+
const project = buildTutorialSuite(allTutorials);
|
|
63
|
+
|
|
64
|
+
console.log(project.scenes.length); // 4 (init, build, validate, deploy)
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
### Generate narration
|
|
68
|
+
|
|
69
|
+
\`\`\`ts
|
|
70
|
+
import { generateTutorialNarration } from "@contractspec/example.video-docs-terminal/generate-narration";
|
|
71
|
+
import { buildTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
|
|
72
|
+
|
|
73
|
+
const narration = await generateTutorialNarration(buildTutorial);
|
|
74
|
+
|
|
75
|
+
console.log(narration.fullText); // Full narration text
|
|
76
|
+
console.log(narration.segments.length); // Per-scene segments
|
|
77
|
+
console.log(narration.estimatedDurationSeconds); // ~12s
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
## Guardrails
|
|
81
|
+
|
|
82
|
+
- Keep terminal lines concise -- long output slows the typing animation.
|
|
83
|
+
- Target 10-15 lines per tutorial for optimal pacing at 12 seconds per scene.
|
|
84
|
+
- The \`summary\` field is displayed as a call-out after the terminal completes -- keep it to one sentence.
|
|
85
|
+
- Use \`"technical"\` narration style for documentation videos and \`"professional"\` for marketing.
|
|
86
|
+
`
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/docs/video-docs-terminal.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.video-docs-terminal",
|
|
6
|
+
title: "Video Docs Terminal (example)",
|
|
7
|
+
summary: "Generate terminal demo videos from CLI walkthroughs using the TerminalDemo composition and ScriptGenerator.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/video-docs-terminal",
|
|
11
|
+
tags: ["video", "documentation", "terminal", "cli", "example"],
|
|
12
|
+
body: `## What this example shows
|
|
13
|
+
|
|
14
|
+
- Defining CLI tutorials as structured \`CliTutorial\` objects with \`TerminalLine\` arrays.
|
|
15
|
+
- Building single-scene and multi-scene \`VideoProject\` instances using the \`TerminalDemo\` composition.
|
|
16
|
+
- Using \`ScriptGenerator\` (deterministic, no LLM) to generate narration from tutorial content briefs.
|
|
17
|
+
- Assembling a full documentation video covering init, build, validate, and deploy workflows.
|
|
18
|
+
|
|
19
|
+
## Key concepts
|
|
20
|
+
|
|
21
|
+
- **CliTutorial**: Combines \`TerminalLine[]\` (commands + output) with a \`ContentBrief\` for narration.
|
|
22
|
+
- **TerminalDemo**: The Remotion composition that renders animated terminal sessions.
|
|
23
|
+
- **ScriptGenerator**: Produces narration scripts from content briefs. Deterministic by default.
|
|
24
|
+
- **VideoProject**: The output scene graph -- one scene per tutorial, ready for rendering or preview.
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
- No LLM or voice provider is needed -- the pipeline is fully deterministic.
|
|
29
|
+
- Each tutorial maps to one \`TerminalDemo\` scene in the final video project.
|
|
30
|
+
- The example produces the \`VideoProject\` data structure, not rendered MP4. Use \`LocalRenderer\` for final output.
|
|
31
|
+
`
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "docs.examples.video-docs-terminal.usage",
|
|
35
|
+
title: "Video Docs Terminal -- Usage",
|
|
36
|
+
summary: "How to generate terminal demo videos and narration from CLI tutorials.",
|
|
37
|
+
kind: "usage",
|
|
38
|
+
visibility: "public",
|
|
39
|
+
route: "/docs/examples/video-docs-terminal/usage",
|
|
40
|
+
tags: ["video", "terminal", "usage"],
|
|
41
|
+
body: `## Usage
|
|
42
|
+
|
|
43
|
+
### Build a single tutorial video
|
|
44
|
+
|
|
45
|
+
\`\`\`ts
|
|
46
|
+
import { buildTutorialVideo } from "@contractspec/example.video-docs-terminal/build-tutorial";
|
|
47
|
+
import { initTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
|
|
48
|
+
|
|
49
|
+
const project = buildTutorialVideo(initTutorial);
|
|
50
|
+
|
|
51
|
+
console.log(project.scenes.length); // 1
|
|
52
|
+
console.log(project.scenes[0].compositionId); // "TerminalDemo"
|
|
53
|
+
console.log(project.totalDurationInFrames); // 360 (12s × 30fps)
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
### Build a multi-scene tutorial suite
|
|
57
|
+
|
|
58
|
+
\`\`\`ts
|
|
59
|
+
import { buildTutorialSuite } from "@contractspec/example.video-docs-terminal/build-tutorial";
|
|
60
|
+
import { allTutorials } from "@contractspec/example.video-docs-terminal/sample-tutorials";
|
|
61
|
+
|
|
62
|
+
const project = buildTutorialSuite(allTutorials);
|
|
63
|
+
|
|
64
|
+
console.log(project.scenes.length); // 4 (init, build, validate, deploy)
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
### Generate narration
|
|
68
|
+
|
|
69
|
+
\`\`\`ts
|
|
70
|
+
import { generateTutorialNarration } from "@contractspec/example.video-docs-terminal/generate-narration";
|
|
71
|
+
import { buildTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
|
|
72
|
+
|
|
73
|
+
const narration = await generateTutorialNarration(buildTutorial);
|
|
74
|
+
|
|
75
|
+
console.log(narration.fullText); // Full narration text
|
|
76
|
+
console.log(narration.segments.length); // Per-scene segments
|
|
77
|
+
console.log(narration.estimatedDurationSeconds); // ~12s
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
## Guardrails
|
|
81
|
+
|
|
82
|
+
- Keep terminal lines concise -- long output slows the typing animation.
|
|
83
|
+
- Target 10-15 lines per tutorial for optimal pacing at 12 seconds per scene.
|
|
84
|
+
- The \`summary\` field is displayed as a call-out after the terminal completes -- keep it to one sentence.
|
|
85
|
+
- Use \`"technical"\` narration style for documentation videos and \`"professional"\` for marketing.
|
|
86
|
+
`
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/example.ts
|
|
2
|
+
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
3
|
+
var example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "video-docs-terminal",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "Video Docs Terminal",
|
|
8
|
+
description: "Generate terminal demo videos from CLI walkthroughs using the TerminalDemo composition and ScriptGenerator.",
|
|
9
|
+
kind: "script",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
owners: ["@platform.core"],
|
|
13
|
+
tags: ["video", "documentation", "terminal", "cli", "tutorial"]
|
|
14
|
+
},
|
|
15
|
+
docs: {
|
|
16
|
+
rootDocId: "docs.examples.video-docs-terminal",
|
|
17
|
+
usageDocId: "docs.examples.video-docs-terminal.usage"
|
|
18
|
+
},
|
|
19
|
+
entrypoints: {
|
|
20
|
+
packageName: "@contractspec/example.video-docs-terminal",
|
|
21
|
+
docs: "./docs"
|
|
22
|
+
},
|
|
23
|
+
surfaces: {
|
|
24
|
+
templates: true,
|
|
25
|
+
sandbox: { enabled: true, modes: ["markdown"] },
|
|
26
|
+
studio: { enabled: true, installable: true },
|
|
27
|
+
mcp: { enabled: true }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var example_default = example;
|
|
31
|
+
export {
|
|
32
|
+
example_default as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/generate-narration.ts
|
|
2
|
+
import { ScriptGenerator } from "@contractspec/lib.video-gen/generators/script-generator";
|
|
3
|
+
async function generateTutorialNarration(tutorial, options) {
|
|
4
|
+
const generator = new ScriptGenerator;
|
|
5
|
+
const style = options?.style ?? "technical";
|
|
6
|
+
return generator.generate(tutorial.brief, { enabled: true, style });
|
|
7
|
+
}
|
|
8
|
+
async function generateSuiteNarration(tutorials, options) {
|
|
9
|
+
const results = await Promise.all(tutorials.map(async (tutorial) => {
|
|
10
|
+
const script = await generateTutorialNarration(tutorial, options);
|
|
11
|
+
return [tutorial.id, script];
|
|
12
|
+
}));
|
|
13
|
+
return new Map(results);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
generateTutorialNarration,
|
|
17
|
+
generateSuiteNarration
|
|
18
|
+
};
|