@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.
Files changed (41) hide show
  1. package/.turbo/turbo-build.log +38 -0
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +14 -0
  4. package/dist/browser/build-tutorial.js +60 -0
  5. package/dist/browser/docs/index.js +89 -0
  6. package/dist/browser/docs/video-docs-terminal.docblock.js +89 -0
  7. package/dist/browser/example.js +33 -0
  8. package/dist/browser/generate-narration.js +18 -0
  9. package/dist/browser/index.js +389 -0
  10. package/dist/browser/sample-tutorials.js +192 -0
  11. package/dist/build-tutorial.d.ts +44 -0
  12. package/dist/build-tutorial.js +61 -0
  13. package/dist/docs/index.d.ts +1 -0
  14. package/dist/docs/index.js +90 -0
  15. package/dist/docs/video-docs-terminal.docblock.d.ts +1 -0
  16. package/dist/docs/video-docs-terminal.docblock.js +90 -0
  17. package/dist/example.d.ts +2 -0
  18. package/dist/example.js +34 -0
  19. package/dist/generate-narration.d.ts +42 -0
  20. package/dist/generate-narration.js +19 -0
  21. package/dist/index.d.ts +5 -0
  22. package/dist/index.js +390 -0
  23. package/dist/node/build-tutorial.js +60 -0
  24. package/dist/node/docs/index.js +89 -0
  25. package/dist/node/docs/video-docs-terminal.docblock.js +89 -0
  26. package/dist/node/example.js +33 -0
  27. package/dist/node/generate-narration.js +18 -0
  28. package/dist/node/index.js +389 -0
  29. package/dist/node/sample-tutorials.js +192 -0
  30. package/dist/sample-tutorials.d.ts +40 -0
  31. package/dist/sample-tutorials.js +193 -0
  32. package/package.json +159 -0
  33. package/src/build-tutorial.ts +120 -0
  34. package/src/docs/index.ts +1 -0
  35. package/src/docs/video-docs-terminal.docblock.ts +93 -0
  36. package/src/example.ts +32 -0
  37. package/src/generate-narration.ts +70 -0
  38. package/src/index.ts +7 -0
  39. package/src/sample-tutorials.ts +241 -0
  40. package/tsconfig.json +9 -0
  41. package/tsdown.config.js +3 -0
@@ -0,0 +1,120 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Build Tutorial Video -- Construct a multi-scene VideoProject from CLI tutorials
3
+ // ---------------------------------------------------------------------------
4
+
5
+ import type { VideoProject } from '@contractspec/lib.contracts-integrations/integrations/providers/video';
6
+ import { VIDEO_FORMATS } from '@contractspec/lib.video-gen/design/layouts';
7
+ import type { CliTutorial } from './sample-tutorials';
8
+
9
+ const DEFAULT_FPS = 30;
10
+ const DEFAULT_SCENE_DURATION_SECONDS = 12;
11
+
12
+ /** Options for building a tutorial video. */
13
+ export interface BuildTutorialOptions {
14
+ /** Duration per scene in seconds. Default: 12. */
15
+ sceneDurationSeconds?: number;
16
+ /** FPS. Default: 30. */
17
+ fps?: number;
18
+ /** Terminal prompt string. Default: "$ ". */
19
+ prompt?: string;
20
+ }
21
+
22
+ /**
23
+ * Build a VideoProject from a single CLI tutorial.
24
+ *
25
+ * Creates a single-scene project using the TerminalDemo composition.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { buildTutorialVideo } from "@contractspec/example.video-docs-terminal/build-tutorial";
30
+ * import { initTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
31
+ *
32
+ * const project = buildTutorialVideo(initTutorial);
33
+ * // project.scenes[0].compositionId === "TerminalDemo"
34
+ * ```
35
+ */
36
+ export function buildTutorialVideo(
37
+ tutorial: CliTutorial,
38
+ options?: BuildTutorialOptions
39
+ ): VideoProject {
40
+ const fps = options?.fps ?? DEFAULT_FPS;
41
+ const sceneDuration =
42
+ options?.sceneDurationSeconds ?? DEFAULT_SCENE_DURATION_SECONDS;
43
+ const durationInFrames = sceneDuration * fps;
44
+
45
+ return {
46
+ id: `tutorial-${tutorial.id}-${Date.now().toString(36)}`,
47
+ scenes: [
48
+ {
49
+ id: `scene-${tutorial.id}`,
50
+ compositionId: 'TerminalDemo',
51
+ props: {
52
+ title: tutorial.title,
53
+ subtitle: tutorial.subtitle,
54
+ lines: tutorial.lines,
55
+ terminalTitle: tutorial.terminalTitle,
56
+ prompt: options?.prompt ?? '$ ',
57
+ summary: tutorial.summary,
58
+ },
59
+ durationInFrames,
60
+ },
61
+ ],
62
+ totalDurationInFrames: durationInFrames,
63
+ fps,
64
+ format: VIDEO_FORMATS.landscape,
65
+ };
66
+ }
67
+
68
+ /**
69
+ * Build a multi-scene VideoProject from an array of CLI tutorials.
70
+ *
71
+ * Each tutorial becomes one scene in the project, played in order.
72
+ * Useful for creating a comprehensive CLI walkthrough video covering
73
+ * init → build → validate → deploy.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * import { buildTutorialSuite } from "@contractspec/example.video-docs-terminal/build-tutorial";
78
+ * import { allTutorials } from "@contractspec/example.video-docs-terminal/sample-tutorials";
79
+ *
80
+ * const project = buildTutorialSuite(allTutorials);
81
+ * // project.scenes.length === 4
82
+ * // Total: ~48 seconds (4 × 12s)
83
+ * ```
84
+ */
85
+ export function buildTutorialSuite(
86
+ tutorials: CliTutorial[],
87
+ options?: BuildTutorialOptions
88
+ ): VideoProject {
89
+ const fps = options?.fps ?? DEFAULT_FPS;
90
+ const sceneDuration =
91
+ options?.sceneDurationSeconds ?? DEFAULT_SCENE_DURATION_SECONDS;
92
+ const durationInFrames = sceneDuration * fps;
93
+
94
+ const scenes = tutorials.map((tutorial) => ({
95
+ id: `scene-${tutorial.id}`,
96
+ compositionId: 'TerminalDemo',
97
+ props: {
98
+ title: tutorial.title,
99
+ subtitle: tutorial.subtitle,
100
+ lines: tutorial.lines,
101
+ terminalTitle: tutorial.terminalTitle,
102
+ prompt: options?.prompt ?? '$ ',
103
+ summary: tutorial.summary,
104
+ },
105
+ durationInFrames,
106
+ }));
107
+
108
+ const totalDurationInFrames = scenes.reduce(
109
+ (sum, s) => sum + s.durationInFrames,
110
+ 0
111
+ );
112
+
113
+ return {
114
+ id: `tutorial-suite-${Date.now().toString(36)}`,
115
+ scenes,
116
+ totalDurationInFrames,
117
+ fps,
118
+ format: VIDEO_FORMATS.landscape,
119
+ };
120
+ }
@@ -0,0 +1 @@
1
+ import './video-docs-terminal.docblock';
@@ -0,0 +1,93 @@
1
+ import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
2
+ import { registerDocBlocks } from '@contractspec/lib.contracts-spec/docs';
3
+
4
+ const blocks: DocBlock[] = [
5
+ {
6
+ id: 'docs.examples.video-docs-terminal',
7
+ title: 'Video Docs Terminal (example)',
8
+ summary:
9
+ 'Generate terminal demo videos from CLI walkthroughs using the TerminalDemo composition and ScriptGenerator.',
10
+ kind: 'reference',
11
+ visibility: 'public',
12
+ route: '/docs/examples/video-docs-terminal',
13
+ tags: ['video', 'documentation', 'terminal', 'cli', 'example'],
14
+ body: `## What this example shows
15
+
16
+ - Defining CLI tutorials as structured \`CliTutorial\` objects with \`TerminalLine\` arrays.
17
+ - Building single-scene and multi-scene \`VideoProject\` instances using the \`TerminalDemo\` composition.
18
+ - Using \`ScriptGenerator\` (deterministic, no LLM) to generate narration from tutorial content briefs.
19
+ - Assembling a full documentation video covering init, build, validate, and deploy workflows.
20
+
21
+ ## Key concepts
22
+
23
+ - **CliTutorial**: Combines \`TerminalLine[]\` (commands + output) with a \`ContentBrief\` for narration.
24
+ - **TerminalDemo**: The Remotion composition that renders animated terminal sessions.
25
+ - **ScriptGenerator**: Produces narration scripts from content briefs. Deterministic by default.
26
+ - **VideoProject**: The output scene graph -- one scene per tutorial, ready for rendering or preview.
27
+
28
+ ## Notes
29
+
30
+ - No LLM or voice provider is needed -- the pipeline is fully deterministic.
31
+ - Each tutorial maps to one \`TerminalDemo\` scene in the final video project.
32
+ - The example produces the \`VideoProject\` data structure, not rendered MP4. Use \`LocalRenderer\` for final output.
33
+ `,
34
+ },
35
+ {
36
+ id: 'docs.examples.video-docs-terminal.usage',
37
+ title: 'Video Docs Terminal -- Usage',
38
+ summary:
39
+ 'How to generate terminal demo videos and narration from CLI tutorials.',
40
+ kind: 'usage',
41
+ visibility: 'public',
42
+ route: '/docs/examples/video-docs-terminal/usage',
43
+ tags: ['video', 'terminal', 'usage'],
44
+ body: `## Usage
45
+
46
+ ### Build a single tutorial video
47
+
48
+ \`\`\`ts
49
+ import { buildTutorialVideo } from "@contractspec/example.video-docs-terminal/build-tutorial";
50
+ import { initTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
51
+
52
+ const project = buildTutorialVideo(initTutorial);
53
+
54
+ console.log(project.scenes.length); // 1
55
+ console.log(project.scenes[0].compositionId); // "TerminalDemo"
56
+ console.log(project.totalDurationInFrames); // 360 (12s × 30fps)
57
+ \`\`\`
58
+
59
+ ### Build a multi-scene tutorial suite
60
+
61
+ \`\`\`ts
62
+ import { buildTutorialSuite } from "@contractspec/example.video-docs-terminal/build-tutorial";
63
+ import { allTutorials } from "@contractspec/example.video-docs-terminal/sample-tutorials";
64
+
65
+ const project = buildTutorialSuite(allTutorials);
66
+
67
+ console.log(project.scenes.length); // 4 (init, build, validate, deploy)
68
+ \`\`\`
69
+
70
+ ### Generate narration
71
+
72
+ \`\`\`ts
73
+ import { generateTutorialNarration } from "@contractspec/example.video-docs-terminal/generate-narration";
74
+ import { buildTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
75
+
76
+ const narration = await generateTutorialNarration(buildTutorial);
77
+
78
+ console.log(narration.fullText); // Full narration text
79
+ console.log(narration.segments.length); // Per-scene segments
80
+ console.log(narration.estimatedDurationSeconds); // ~12s
81
+ \`\`\`
82
+
83
+ ## Guardrails
84
+
85
+ - Keep terminal lines concise -- long output slows the typing animation.
86
+ - Target 10-15 lines per tutorial for optimal pacing at 12 seconds per scene.
87
+ - The \`summary\` field is displayed as a call-out after the terminal completes -- keep it to one sentence.
88
+ - Use \`"technical"\` narration style for documentation videos and \`"professional"\` for marketing.
89
+ `,
90
+ },
91
+ ];
92
+
93
+ registerDocBlocks(blocks);
package/src/example.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { defineExample } from '@contractspec/lib.contracts-spec';
2
+
3
+ const example = defineExample({
4
+ meta: {
5
+ key: 'video-docs-terminal',
6
+ version: '1.0.0',
7
+ title: 'Video Docs Terminal',
8
+ description:
9
+ 'Generate terminal demo videos from CLI walkthroughs using the TerminalDemo composition and ScriptGenerator.',
10
+ kind: 'script',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['video', 'documentation', 'terminal', 'cli', 'tutorial'],
15
+ },
16
+ docs: {
17
+ rootDocId: 'docs.examples.video-docs-terminal',
18
+ usageDocId: 'docs.examples.video-docs-terminal.usage',
19
+ },
20
+ entrypoints: {
21
+ packageName: '@contractspec/example.video-docs-terminal',
22
+ docs: './docs',
23
+ },
24
+ surfaces: {
25
+ templates: true,
26
+ sandbox: { enabled: true, modes: ['markdown'] },
27
+ studio: { enabled: true, installable: true },
28
+ mcp: { enabled: true },
29
+ },
30
+ });
31
+
32
+ export default example;
@@ -0,0 +1,70 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Generate Narration -- Use ScriptGenerator to produce narration for tutorials
3
+ // ---------------------------------------------------------------------------
4
+
5
+ import { ScriptGenerator } from '@contractspec/lib.video-gen/generators/script-generator';
6
+ import type { NarrationScript } from '@contractspec/lib.video-gen/generators/script-generator';
7
+ import type { NarrationConfig } from '@contractspec/lib.contracts-integrations/integrations/providers/video';
8
+ import type { CliTutorial } from './sample-tutorials';
9
+
10
+ /** Options for narration generation. */
11
+ export interface GenerateNarrationOptions {
12
+ /** Narration style. Default: "technical". */
13
+ style?: NarrationConfig['style'];
14
+ }
15
+
16
+ /**
17
+ * Generate a narration script for a single CLI tutorial.
18
+ *
19
+ * Uses the deterministic ScriptGenerator (no LLM) to produce
20
+ * narration text from the tutorial's content brief.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import { generateTutorialNarration } from "@contractspec/example.video-docs-terminal/generate-narration";
25
+ * import { buildTutorial } from "@contractspec/example.video-docs-terminal/sample-tutorials";
26
+ *
27
+ * const narration = await generateTutorialNarration(buildTutorial);
28
+ * console.log(narration.fullText);
29
+ * console.log(narration.estimatedDurationSeconds); // ~12s
30
+ * ```
31
+ */
32
+ export async function generateTutorialNarration(
33
+ tutorial: CliTutorial,
34
+ options?: GenerateNarrationOptions
35
+ ): Promise<NarrationScript> {
36
+ const generator = new ScriptGenerator();
37
+ const style = options?.style ?? 'technical';
38
+
39
+ return generator.generate(tutorial.brief, { enabled: true, style });
40
+ }
41
+
42
+ /**
43
+ * Generate narration scripts for all tutorials in a suite.
44
+ *
45
+ * Returns a map of tutorial ID → narration script, useful for
46
+ * aligning narration with the multi-scene video project.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import { generateSuiteNarration } from "@contractspec/example.video-docs-terminal/generate-narration";
51
+ * import { allTutorials } from "@contractspec/example.video-docs-terminal/sample-tutorials";
52
+ *
53
+ * const narrations = await generateSuiteNarration(allTutorials);
54
+ * // narrations.get("init")?.fullText — narration for the init tutorial
55
+ * // narrations.get("build")?.fullText — narration for the build tutorial
56
+ * ```
57
+ */
58
+ export async function generateSuiteNarration(
59
+ tutorials: CliTutorial[],
60
+ options?: GenerateNarrationOptions
61
+ ): Promise<Map<string, NarrationScript>> {
62
+ const results = await Promise.all(
63
+ tutorials.map(async (tutorial) => {
64
+ const script = await generateTutorialNarration(tutorial, options);
65
+ return [tutorial.id, script] as const;
66
+ })
67
+ );
68
+
69
+ return new Map(results);
70
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './sample-tutorials';
2
+ export * from './build-tutorial';
3
+ export * from './generate-narration';
4
+
5
+ export { default as example } from './example';
6
+
7
+ import './docs';
@@ -0,0 +1,241 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Sample CLI Tutorials for Terminal Demo Video Generation
3
+ // ---------------------------------------------------------------------------
4
+
5
+ import type { TerminalLine } from '@contractspec/lib.video-gen/compositions/primitives/terminal';
6
+ import type { ContentBrief } from '@contractspec/lib.content-gen/types';
7
+
8
+ /**
9
+ * A CLI tutorial definition combining terminal lines with a content brief
10
+ * for narration generation.
11
+ */
12
+ export interface CliTutorial {
13
+ /** Tutorial identifier */
14
+ id: string;
15
+ /** Display title for the scene */
16
+ title: string;
17
+ /** Subtitle shown below the title */
18
+ subtitle?: string;
19
+ /** Terminal window title */
20
+ terminalTitle: string;
21
+ /** Terminal lines (commands + output) */
22
+ lines: TerminalLine[];
23
+ /** Summary text shown after the terminal completes */
24
+ summary?: string;
25
+ /** Content brief used for narration generation */
26
+ brief: ContentBrief;
27
+ }
28
+
29
+ // -- Init Tutorial ----------------------------------------------------------
30
+
31
+ /**
32
+ * Tutorial: Initialize a new ContractSpec project.
33
+ */
34
+ export const initTutorial: CliTutorial = {
35
+ id: 'init',
36
+ title: 'Initialize a Project',
37
+ subtitle: 'Set up a new ContractSpec workspace in seconds',
38
+ terminalTitle: '~/projects',
39
+ lines: [
40
+ { text: 'contractspec init my-api', type: 'command' },
41
+ { text: 'Creating project my-api...', type: 'output', delay: 15 },
42
+ { text: ' ├── contracts/', type: 'output', delay: 5 },
43
+ { text: ' ├── generated/', type: 'output', delay: 5 },
44
+ { text: ' ├── contractspec.config.ts', type: 'output', delay: 5 },
45
+ { text: ' └── package.json', type: 'output', delay: 5 },
46
+ { text: '✓ Project initialized', type: 'success', delay: 10 },
47
+ { text: 'cd my-api', type: 'command', delay: 15 },
48
+ { text: 'contractspec status', type: 'command', delay: 15 },
49
+ {
50
+ text: '0 contracts · 0 generated files · ready',
51
+ type: 'output',
52
+ delay: 10,
53
+ },
54
+ ],
55
+ summary: 'Your project is ready. Define contracts next.',
56
+ brief: {
57
+ title: 'Initialize a ContractSpec Project',
58
+ summary:
59
+ 'The init command scaffolds a new workspace with contracts, generated output, and configuration.',
60
+ problems: [
61
+ 'Setting up API projects manually is tedious and error-prone',
62
+ 'Teams need a consistent project structure from day one',
63
+ ],
64
+ solutions: [
65
+ 'One command creates the entire project scaffold',
66
+ 'Standard structure ensures consistency across teams',
67
+ ],
68
+ audience: {
69
+ role: 'Developer',
70
+ painPoints: ['Manual project setup', 'Inconsistent project structure'],
71
+ },
72
+ callToAction: 'Run contractspec init to get started.',
73
+ },
74
+ };
75
+
76
+ // -- Build Tutorial ---------------------------------------------------------
77
+
78
+ /**
79
+ * Tutorial: Build and generate code from contracts.
80
+ */
81
+ export const buildTutorial: CliTutorial = {
82
+ id: 'build',
83
+ title: 'Build from Contracts',
84
+ subtitle: 'Generate all surfaces from a single spec',
85
+ terminalTitle: '~/projects/my-api',
86
+ lines: [
87
+ { text: '# Define a contract first', type: 'comment' },
88
+ { text: 'contractspec build', type: 'command', delay: 15 },
89
+ { text: 'Building 3 contracts...', type: 'output', delay: 15 },
90
+ { text: ' → CreateUser REST + GraphQL + DB', type: 'output', delay: 8 },
91
+ { text: ' → ListUsers REST + GraphQL', type: 'output', delay: 8 },
92
+ { text: ' → DeleteUser REST + GraphQL + DB', type: 'output', delay: 8 },
93
+ { text: '✓ 18 files generated in 0.4s', type: 'success', delay: 12 },
94
+ { text: 'contractspec status', type: 'command', delay: 15 },
95
+ {
96
+ text: '3 contracts · 18 generated files · all up to date',
97
+ type: 'output',
98
+ delay: 10,
99
+ },
100
+ ],
101
+ summary: '3 contracts → 18 files. One spec, every surface.',
102
+ brief: {
103
+ title: 'Build from Contracts',
104
+ summary:
105
+ 'The build command reads your contract definitions and generates REST, GraphQL, DB schemas, and more.',
106
+ problems: [
107
+ 'Manually writing the same logic across REST, GraphQL, and DB',
108
+ 'Generated code drifts out of sync with the spec',
109
+ ],
110
+ solutions: [
111
+ 'Deterministic build: same spec always produces the same output',
112
+ 'All surfaces generated in a single pass',
113
+ ],
114
+ metrics: [
115
+ '18 files from 3 contracts in 0.4 seconds',
116
+ 'Zero manual synchronization',
117
+ ],
118
+ audience: {
119
+ role: 'Developer',
120
+ painPoints: ['Cross-surface code duplication', 'Schema drift'],
121
+ },
122
+ callToAction: 'Run contractspec build after defining your contracts.',
123
+ },
124
+ };
125
+
126
+ // -- Validate Tutorial ------------------------------------------------------
127
+
128
+ /**
129
+ * Tutorial: Validate contracts before building.
130
+ */
131
+ export const validateTutorial: CliTutorial = {
132
+ id: 'validate',
133
+ title: 'Validate Contracts',
134
+ subtitle: 'Catch errors before they reach production',
135
+ terminalTitle: '~/projects/my-api',
136
+ lines: [
137
+ { text: 'contractspec validate', type: 'command' },
138
+ { text: 'Validating 3 contracts...', type: 'output', delay: 15 },
139
+ { text: ' ✓ CreateUser schema valid', type: 'success', delay: 8 },
140
+ { text: ' ✓ ListUsers schema valid', type: 'success', delay: 8 },
141
+ {
142
+ text: ' ✗ DeleteUser missing required field "reason"',
143
+ type: 'error',
144
+ delay: 8,
145
+ },
146
+ { text: '', type: 'output', delay: 5 },
147
+ { text: '2 passed · 1 failed', type: 'output', delay: 10 },
148
+ { text: '# Fix the contract and re-validate', type: 'comment', delay: 15 },
149
+ { text: 'contractspec validate', type: 'command', delay: 15 },
150
+ { text: ' ✓ CreateUser schema valid', type: 'success', delay: 8 },
151
+ { text: ' ✓ ListUsers schema valid', type: 'success', delay: 8 },
152
+ { text: ' ✓ DeleteUser schema valid', type: 'success', delay: 8 },
153
+ { text: '✓ All 3 contracts valid', type: 'success', delay: 10 },
154
+ ],
155
+ summary: 'Validate early, validate often.',
156
+ brief: {
157
+ title: 'Validate Contracts',
158
+ summary:
159
+ 'The validate command checks all contracts against their schemas before generating code.',
160
+ problems: [
161
+ 'Invalid schemas slip through to production',
162
+ 'Catching errors late in the pipeline costs time',
163
+ ],
164
+ solutions: [
165
+ 'Pre-build validation catches schema errors instantly',
166
+ 'Clear error messages pinpoint exactly what needs fixing',
167
+ ],
168
+ audience: {
169
+ role: 'Developer',
170
+ painPoints: ['Invalid schemas in production', 'Late error detection'],
171
+ },
172
+ callToAction: 'Run contractspec validate as part of your CI pipeline.',
173
+ },
174
+ };
175
+
176
+ // -- Deploy Tutorial --------------------------------------------------------
177
+
178
+ /**
179
+ * Tutorial: Deploy generated artifacts.
180
+ */
181
+ export const deployTutorial: CliTutorial = {
182
+ id: 'deploy',
183
+ title: 'Deploy Artifacts',
184
+ subtitle: 'Ship generated code to production',
185
+ terminalTitle: '~/projects/my-api',
186
+ lines: [
187
+ { text: 'contractspec build --production', type: 'command' },
188
+ {
189
+ text: '✓ 18 files generated (production mode)',
190
+ type: 'success',
191
+ delay: 15,
192
+ },
193
+ { text: 'contractspec publish --dry-run', type: 'command', delay: 15 },
194
+ {
195
+ text: 'Publishing @my-api/contracts v1.2.0...',
196
+ type: 'output',
197
+ delay: 12,
198
+ },
199
+ { text: ' → npm pack (dry run)', type: 'output', delay: 8 },
200
+ { text: ' → 3 contracts, 18 generated files', type: 'output', delay: 8 },
201
+ { text: ' → Package size: 24.3 KB', type: 'output', delay: 8 },
202
+ {
203
+ text: '✓ Dry run complete -- ready to publish',
204
+ type: 'success',
205
+ delay: 10,
206
+ },
207
+ { text: 'contractspec publish', type: 'command', delay: 15 },
208
+ { text: '✓ Published @my-api/contracts@1.2.0', type: 'success', delay: 15 },
209
+ ],
210
+ summary: 'From spec to production in one pipeline.',
211
+ brief: {
212
+ title: 'Deploy Artifacts',
213
+ summary:
214
+ 'Build in production mode and publish your generated contracts as an npm package.',
215
+ problems: [
216
+ 'Deploying hand-written API code is risky and manual',
217
+ 'Teams need confidence that generated code matches the spec',
218
+ ],
219
+ solutions: [
220
+ 'Production builds are deterministic and reproducible',
221
+ 'Dry-run publishing catches packaging issues before release',
222
+ ],
223
+ metrics: [
224
+ '24.3 KB package with 3 contracts and 18 files',
225
+ 'Entire pipeline runs in seconds',
226
+ ],
227
+ audience: {
228
+ role: 'DevOps Engineer',
229
+ painPoints: ['Manual deployment processes', 'Spec-to-production drift'],
230
+ },
231
+ callToAction: 'Add contractspec publish to your CI/CD pipeline.',
232
+ },
233
+ };
234
+
235
+ /** All sample tutorials in recommended presentation order. */
236
+ export const allTutorials: CliTutorial[] = [
237
+ initTutorial,
238
+ buildTutorial,
239
+ validateTutorial,
240
+ deployTutorial,
241
+ ];
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@contractspec/tool.typescript/react-library.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules", "dist"],
5
+ "compilerOptions": {
6
+ "rootDir": "src",
7
+ "outDir": "dist"
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ import { moduleLibrary } from '@contractspec/tool.bun';
2
+
3
+ export default { ...moduleLibrary };