@lalalic/markcut 2.0.0 → 2.2.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 (48) hide show
  1. package/AGENTS.md +1 -0
  2. package/package.json +1 -1
  3. package/{SKILL.md → skills/markcut/SKILL.md} +8 -2
  4. package/{docs → skills/markcut/docs}/system-prompt-edit.md +5 -2
  5. package/skills/markcut/docs/template.md +213 -0
  6. package/{templates → skills/markcut/docs/templates}/courseware/TEMPLATE.md +220 -10
  7. package/{templates → skills/markcut/docs/templates}/courseware/prompts/outline.md +5 -0
  8. package/{templates → skills/markcut/docs/templates}/courseware/prompts/scene.md +6 -0
  9. package/skills/markcut/docs/templates/deep-dive/TEMPLATE.md +355 -0
  10. package/skills/markcut/docs/templates/deep-dive/agents/researcher.md +69 -0
  11. package/skills/markcut/docs/templates/deep-dive/agents/reviewer.md +108 -0
  12. package/skills/markcut/docs/templates/deep-dive/prompts/fix.md +28 -0
  13. package/skills/markcut/docs/templates/deep-dive/prompts/outline.md +102 -0
  14. package/skills/markcut/docs/templates/deep-dive/prompts/script.md +64 -0
  15. package/skills/markcut/docs/templates/illustrated-book/TEMPLATE.md +360 -0
  16. package/skills/markcut/docs/templates/illustrated-book/agents/reviewer.md +115 -0
  17. package/skills/markcut/docs/templates/illustrated-book/prompts/fix.md +29 -0
  18. package/skills/markcut/docs/templates/illustrated-book/prompts/illustration.md +35 -0
  19. package/skills/markcut/docs/templates/illustrated-book/prompts/story.md +69 -0
  20. package/skills/markcut/docs/templates/short-film/TEMPLATE.md +387 -0
  21. package/skills/markcut/docs/templates/short-film/agents/reviewer.md +115 -0
  22. package/skills/markcut/docs/templates/short-film/prompts/fix.md +29 -0
  23. package/skills/markcut/docs/templates/short-film/prompts/screenplay.md +101 -0
  24. package/skills/markcut/docs/templates/short-film/prompts/storyboard.md +54 -0
  25. package/skills/markcut/docs/templates/short-video/TEMPLATE.md +302 -0
  26. package/skills/markcut/docs/templates/short-video/agents/reviewer.md +94 -0
  27. package/skills/markcut/docs/templates/short-video/prompts/fix.md +27 -0
  28. package/skills/markcut/docs/templates/short-video/prompts/script.md +65 -0
  29. package/skills/markcut/docs/templates/vlog/TEMPLATE.md +405 -0
  30. package/skills/markcut/docs/templates/vlog/agents/reviewer.md +89 -0
  31. package/skills/markcut/docs/templates/vlog/agents/story-writer.md +100 -0
  32. package/skills/markcut/docs/templates/vlog/prompts/bgm-select.md +38 -0
  33. package/skills/markcut/docs/templates/vlog/prompts/group-clips.md +93 -0
  34. package/skills/markcut/docs/templates/vlog/prompts/local-context.md +59 -0
  35. package/skills/markcut/docs/templates/vlog/prompts/outline.md +56 -0
  36. package/skills/markcut/docs/templates/vlog/prompts/review-fix.md +27 -0
  37. package/skills/markcut/docs/templates/vlog/prompts/storyboard.md +41 -0
  38. package/src/config.mjs +11 -3
  39. package/src/player/bundle/player.js +5 -24
  40. package/src/player/components/EditControls.tsx +1 -1
  41. package/src/player/components/SceneThumbnails.tsx +6 -33
  42. package/src/player/server.mjs +217 -129
  43. /package/{docs → skills/markcut/docs}/edit-mode.md +0 -0
  44. /package/{docs → skills/markcut/docs}/json-descriptive.md +0 -0
  45. /package/{docs → skills/markcut/docs}/label-mode.md +0 -0
  46. /package/{docs → skills/markcut/docs}/markdown-descriptive.md +0 -0
  47. /package/{templates → skills/markcut/docs/templates}/courseware/agents/reviewer.md +0 -0
  48. /package/{templates → skills/markcut/docs/templates}/courseware/prompts/fix.md +0 -0
package/AGENTS.md CHANGED
@@ -188,6 +188,7 @@ node src/render/cli.mjs templates
188
188
  - `--label` flag starts a labeling UI for selecting and annotating media
189
189
  - `--port` flag sets the server port (default 3001)
190
190
  - Unified server: `server.mjs` serves all modes (preview, edit, label). React control components in `components/`.
191
+ - **Persistent AI agent via `pi --mode rpc`** (one cold start, many edits): at boot, `startAgentProcess()` spawns the configured agent CLI (`DEFAULT_AGENT_CLI`) with `--mode rpc` appended (the `-p/--prompt` flag is stripped — prompts arrive over stdin). Each `/api/edit` POST writes `{"id","type":"prompt","message"}` to stdin and resolves on the streamed `agent_settled` event (NOT idle-timeout guessing — pi's default interactive mode is a TUI, not a stdin REPL, so text/stdin mode does not work). Assistant text is collected from `message_end` events (`message.role==="assistant"`, text content blocks). `--session-id` (derived from the file path) resumes conversation history from disk across restarts. Do not revert to one-shot `spawn` per edit — that re-incurs the full cold-start every request.
191
192
 
192
193
  ## Testing
193
194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lalalic/markcut",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Markdown-to-video engine. Describe scenes in markdown, get a rendered video.",
5
5
  "bin": {
6
6
  "markcut": "bin/markcut"
@@ -8,10 +8,10 @@ description: use markdown to describe stream trees, provide CLI to render stream
8
8
  Everything video is a **stream tree** described with markdown. see [docs/markdown-descriptive.md](docs/markdown-descriptive.md) for full details.
9
9
 
10
10
 
11
- ## video design utitlies
11
+ ## Video Design Utilities
12
12
 
13
13
  ### User labels — label media with text, time ranges
14
- - `uvx @lalalic/markcut preview --label` provides tool to label video and images with text.
14
+ - `npx @lalalic/markcut preview --label` provides tool to label video and images with text.
15
15
 
16
16
  ### Storyboard — plan video structure with scene nodes
17
17
 
@@ -24,6 +24,10 @@ see [docs/markdown-descriptive.md](docs/markdown-descriptive.md) for full detail
24
24
  - define variants for different video configurations, such as different languages, aspects, platforms
25
25
 
26
26
 
27
+ ### Templates
28
+ - Templates in ``docs/templates/`` provide ready-to-use video structures for `orchestrator` agents, use them as starting point to create your own videos.
29
+
30
+
27
31
  ## 3. CLI
28
32
 
29
33
  ```bash
@@ -50,6 +54,8 @@ some common issues (photo or video can't be displayed, audio missing), take belo
50
54
  | Markdown descriptive format (primary authoring format) | [docs/markdown-descriptive.md](docs/markdown-descriptive.md) |
51
55
  | Label system (browse, label, export labels.json) | [docs/label-mode.md](docs/label-mode.md) |
52
56
  | Player servers (label + edit mode) | [docs/edit-mode.md](docs/edit-mode.md) |
57
+ | How to make video template | [docs/template.md](docs/template.md) |
58
+ | Templates | [docs/templates/](docs/templates/) |
53
59
 
54
60
 
55
61
  ## common used components
@@ -12,5 +12,8 @@ TASKS:
12
12
  1. Read the .md file directly using your file tools to see its current content
13
13
  2. Edit the .md file directly — change content, add/remove sections, update frontmatter
14
14
  3. Save the changes to the .md file using your write/edit tools
15
- 4. Output ONLY a one-line summary of what specific change you made
16
- 5. Do NOT output explanations, reasoning, or extra text
15
+ 4. Output ONLY a JSON object on a single line:
16
+ {"summary":"what specific change you made","fileChanged":true}
17
+ - `summary`: short description of the change
18
+ - `fileChanged`: true if you edited the file, false if no change was needed
19
+ 5. Do NOT output any other text, explanations, or reasoning — only the JSON line
@@ -0,0 +1,213 @@
1
+ # Markcut Template System
2
+
3
+ > How to design and build video templates that agents can follow to produce professional, consistent videos.
4
+
5
+ ## Why templates?
6
+
7
+ Markcut templates encode **domain expertise + production polish** into a reusable package. An agent reading a template learns not just markcut syntax, but:
8
+
9
+ - **What** makes a good video of this type (scene structure, pacing, rules)
10
+ - **How** to assemble it (workflow: prompts → agents → render → review)
11
+ - **Why** certain patterns work (production polish: transition timing, overlays, effects)
12
+
13
+ ## Template package structure
14
+
15
+ ```
16
+ templates/<name>/
17
+ TEMPLATE.md ← The single entry point. Everything except prompts & agents.
18
+ prompts/
19
+ <step>.md ← Fill-in prompt templates. Run in the orchestrator's context.
20
+ ...
21
+ agents/
22
+ <name>.md ← Subagent definitions. Run in separate, isolated sessions.
23
+ ...
24
+ example.md ← (optional) A complete worked example.
25
+ example.mp4 ← (optional) Rendered output for reference.
26
+ ```
27
+
28
+ ### File type conventions
29
+
30
+ | File | Context | Purpose |
31
+ |---|---|---|
32
+ | `TEMPLATE.md` | Orchestrator's context | Complete spec: inputs, structure, rules, workflow, quality gate, components, styles |
33
+ | `prompts/*.md` | Orchestrator's context | Fill-in-the-blank prompt templates; the orchestrator replaces `{placeholder}` values and executes them |
34
+ | `agents/*.md` | **Separate** session | Full agent definitions with system prompt + task template. Each runs in a fresh, isolated subagent session with its own tools and context |
35
+
36
+ ### Why separate prompts/ and agents/?
37
+
38
+ - **prompts/** — tasks the orchestrator does itself (outline generation, scene writing, fix application). These run in the orchestrator's own session so they have full context of the entire project.
39
+ - **agents/** — tasks that benefit from isolation (review, specialized generation). These run in separate sessions to avoid context pollution and to use specialized system prompts without interference.
40
+
41
+ ## Anatomy of TEMPLATE.md
42
+
43
+ Every `TEMPLATE.md` follows this section order:
44
+
45
+ ```
46
+ §0 Prerequisites — tools, skills, environment checks
47
+ §1 Inputs — what the orchestrator must collect from the user
48
+ §2 Scene grammar — the canonical tree structure with hard rules
49
+ §3 Authoring rules — professional-quality bar for content (text, timing, media)
50
+ §4 Components & styles — copy-verbatim code blocks with documented theme knobs
51
+ §5 Workflow — numbered steps: prompts → agents → render → review
52
+ §6 Quality gate — measurable exit criteria (the reviewer checks these)
53
+ §7 Reference — links to golden examples or related docs
54
+ ```
55
+
56
+ ### §0 Prerequisites
57
+
58
+ What tools/skills the agent needs before starting. Always include:
59
+
60
+ - The engine itself: `npx @lalalic/markcut` runnable
61
+ - Required markcut skill (`SKILL.md` + `docs/markdown-descriptive.md`) — the agent must read these
62
+ - Required CLIs: `edge-tts`, `ffmpeg`/`ffprobe`, whisper, image-understanding (for reviewer)
63
+ - Any domain-specific tools
64
+
65
+ ### §1 Inputs — the contract with the user
66
+
67
+ A table of what the orchestrator must collect before starting. Each row:
68
+
69
+ | Input | Required | Default | Notes |
70
+ |---|---|---|---|
71
+
72
+ **Rule:** never invent content beyond given material + well-established knowledge. Missing or ambiguous inputs → ask the user, never fabricate.
73
+
74
+ ### §2 Scene grammar — the tree shape
75
+
76
+ The backbone. Show both:
77
+
78
+ 1. **An ASCII tree diagram** of the required structure with layout/transition annotations
79
+ 2. **Concrete code blocks** showing the exact node structure for each scene type
80
+
81
+ Hard rules come here: number of scenes, layouts, transitions, `isBackground` usage, timing rules, etc.
82
+
83
+ **Crucial design principle:** make the tree as explicit as possible. Show node types, `id:` values, `on:` events, positioning styles. Don't leave structural decisions to the agent.
84
+
85
+ ### §3 Authoring rules — the professional bar
86
+
87
+ Rules the reviewer checks. Cover:
88
+
89
+ - Slide/content rules (max bullets, text shape, emoji conventions, table usage)
90
+ - Script/narration rules (pacing, per-sentence structure, example placement, tone)
91
+ - Media rules (positioning, sizing, where media can overlay)
92
+ - Multi-language variant rules
93
+ - Domain-specific rules (e.g. "never fabricate facts" for courseware, "ground every line in clip captions" for vlog)
94
+
95
+ ### §4 Components & styles — copy verbatim
96
+
97
+ The trickiest section. Two code blocks:
98
+
99
+ 1. **`~~~js imports` block** — all JSX component definitions the video needs. The agent copies this verbatim. Mark which parts are theme knobs (values that can change) vs structural (must stay the same).
100
+ 2. **`~~~css stylesheet` block** — all CSS. Same rules: theme knobs documented, structure immutable.
101
+
102
+ In addition, a **theme knobs table** showing what the user can change (colors, fonts, sizes) and their defaults.
103
+
104
+ **Best practice:** keep the component block minimal. One reusable `Slide` component is better than ten one-off components. Use standard markcut features (`- image`, `- video`, `- component`, `- effect`) before writing custom JSX.
105
+
106
+ ### §5 Workflow — the orchestrator's playbook
107
+
108
+ Numbered steps from start to finish. Each step is one of:
109
+
110
+ - **Fill a prompt** — "Fill `prompts/outline.md` → course outline. Present to user for confirmation."
111
+ - **Run a subagent** — "Run `agents/reviewer.md` in a fresh session. Pass it these absolute paths."
112
+ - **Execute a CLI command** — "`npx @lalalic/markcut render course.md`"
113
+ - **User interaction** — "Get user approval before continuing."
114
+
115
+ Include fix loops:
116
+
117
+ > 6. **Fix loop** — on FAIL: fill `prompts/fix.md` with the findings, apply edits, re-render. Max 3 iterations, then escalate to user.
118
+
119
+ ### §6 Quality gate — measurable exit criteria
120
+
121
+ The checklist the reviewer uses. Each item must be machine-verifiable (by reviewing source, extracting frames, running STT, measuring duration). Examples:
122
+
123
+ - Total duration within ±15% of target
124
+ - Structure matches §2 (hook, title, N concepts, summary, thanks)
125
+ - No blank/black frames at scene boundaries
126
+ - STT transcript matches scripts (≥90% content match)
127
+ - Each bullet has a narration beat
128
+
129
+ ### §7 Reference — worked examples
130
+
131
+ Link to golden example files in `tests/fixtures/templates/`. The golden example demonstrates every rule in the template applied correctly.
132
+
133
+ ## Production polish patterns (reusable)
134
+
135
+ These are design patterns you can include in any template. They're documented in detail in the courseware template (§2.b) but summarized here:
136
+
137
+ | Pattern | Technique | Use case |
138
+ |---|---|---|
139
+ | **Per-beat media** | `#### Beat` sub-scenes with `layout:parallel` (image + script per beat) | Courseware slides, tutorial demos |
140
+ | **Transition-audio timing** | `start:<T>` on script nodes in `transitionSeries` | Any scripted scene with transitions |
141
+ | **Persistent overlay** | `- image isBackground:true` at root level | Logo, watermark |
142
+ | **Narrator PiP** | `- video/image isBackground:true` with border-radius + name label | Talking-head overlays |
143
+ | **Entrance effects** | `effect:zoomIn` / `effect:fadeIn` on images/components | Reveal animations |
144
+ | **Mermaid diagrams** | ` ```mermaid ` in slide markdown | Flowcharts, architecture, timelines |
145
+ | **TTS expression** | `—` pauses, `*emphasis*`, rate adjustment, phonetic spelling | Natural speech |
146
+
147
+ ## Prompt design principles
148
+
149
+ ### prompts/*.md
150
+ - Use `{placeholder}` values for every input. The orchestrator replaces these before executing.
151
+ - Include constraints from TEMPLATE.md inline so the prompt is self-contained.
152
+ - Output format should be a concrete template the orchestrator can parse and assemble.
153
+
154
+ ### agents/*.md
155
+ - Must include a **system prompt** (top) and a **task template** (bottom, filled by orchestrator).
156
+ - System prompt defines the agent's role, rules, and procedure.
157
+ - Task template uses `{placeholder}` values for paths, params, and inputs.
158
+ - Always mark the agent as `mode: read-only` if it shouldn't edit files.
159
+ - Include an explicit output schema (JSON format) so the orchestrator can parse results reliably.
160
+ - List which tools the agent needs (read, bash, ffmpeg, etc.).
161
+
162
+ ## Choosing prompts vs agents
163
+
164
+ | Task type | Where | Why |
165
+ |---|---|---|
166
+ | Creative generation (write a scene) | `prompts/` | Needs full context of the project; best done by orchestrator |
167
+ | Factual check (review) | `agents/` | Needs fresh context; strict rubric; no editing |
168
+ | Research (find images, analyze) | `agents/` | Parallelizable; heavy tool use |
169
+ | Outline / planning | `prompts/` | Needs user interaction (confirm outline) |
170
+ | Quality fix | `prompts/` | Orchestrator applies edits, runs tools |
171
+
172
+ ## Testing a template
173
+
174
+ 1. **Generate** — have a model follow the template to produce a video markdown
175
+ 2. **Render** — `npx @lalalic/markcut render <output>.md`
176
+ 3. **Review** — run the reviewer agent on the rendered output
177
+ 4. **Fix** — apply fixes, re-render, re-review
178
+ 5. **Verify** — check frames visually, check STT transcript
179
+
180
+ The courseware template's test loop is the reference:
181
+
182
+ ```
183
+ Agent (deepseek-v4-flash + SKILL.md + markdown spec) → course.md
184
+ └→ npx markcut render → course.mp4
185
+ └→ Reviewer agent (separate session) → PASS/FAIL + findings
186
+ └→ Fix → re-render → re-review (max 3x)
187
+ ```
188
+
189
+ ## Built-in templates
190
+ All builtin templates are in `templates/` and can be used as-is or forked for your own. Each has a `TEMPLATE.md` with full instructions.
191
+
192
+ ## Cross-cutting concerns
193
+
194
+ ### Multi-language
195
+ - Use variant blocks (`# <lang>` at file end) with per-language TTS voice.
196
+ - Every script node has a `<lang>:"..."` twin; every slide source has a `<lang>-source` twin.
197
+ - The engine resolves variants via `parseMarkdownVariants`.
198
+
199
+ ### Reviewer design
200
+ - Always `mode: read-only` — reviewers report findings, never edit.
201
+ - Two-phase: static (source vs rulebook) + dynamic (rendered artifact via ffprobe/ffmpeg/STT/vision).
202
+ - Output: strict JSON with `{verdict, measured, findings[]}`. Each finding has `id`, `severity`, `scene`, `check`, `issue`, `evidence`, `fix_hint`.
203
+ - PASS requires zero `blocker` and zero `major` findings.
204
+
205
+ ### The "orchestrator" role
206
+ The orchestrator is the agent reading the template. It:
207
+ 1. Collects inputs from the user
208
+ 2. Executes prompts in its own context
209
+ 3. Spawns subagents in separate sessions for isolated tasks
210
+ 4. Assembles, renders, fixes, and iterates
211
+ 5. Escalates to the human user when stuck
212
+
213
+ The template is written FOR the orchestrator. Every instruction is an actionable command: "fill this prompt", "run this agent", "render the file", "if FAIL, fix and re-render".
@@ -80,12 +80,129 @@ Scene rules:
80
80
 
81
81
  - **Duration is TTS-driven**: never set explicit `duration` on scenes that have a script. Only fixed-visual scenes (Hook, Thanks) get `duration:`.
82
82
 
83
- ### make expressful slide
84
- - use chart to explain when making sense
85
- - group script and images/videos to make slide more expressful
86
- - select different transition
87
- - apply effects
88
- - control tts with emotion,breaks, speed for natural speech
83
+ ### Production polish — optional enhancements
84
+
85
+ Once the basic structure works, add these to make the video more professional.
86
+
87
+ #### A. Bullet-level media (image/video/component per bullet)
88
+
89
+ Each bullet can have its own visual accompaniment that appears only during that beat. Use `#### Beat` sub-scenes inside the concept scene to group the media and script into one transition segment:
90
+
91
+ ```markdown
92
+ ### Commits
93
+ layout:transitionSeries transition:fade(0.5)
94
+ - component id:c isBackground:true jsx:"<Slide current={current}>{source}</Slide>"
95
+ ~~~md source
96
+ ## Commits
97
+ - 📸 **Snapshot** — Every commit records changes
98
+ - 🏷️ **Unique hash** — Each has an ID like a1b2c3d
99
+ - 🔗 **Real example** — GitHub commit history for a PR
100
+ ~~~
101
+
102
+ #### B1-Snapshot
103
+ layout:parallel
104
+ - image src:snapshot.png style:position:absolute;right:60px;top:50%;width:35%;border-radius:12px;transform:translateY(-50%)
105
+ - script "A commit is like a photograph of your project at a moment in time..." start:0.5 on:(start, c.current=1)
106
+
107
+ #### B2-Hash
108
+ layout:parallel
109
+ - image src:unique-id.png style:position:absolute;right:60px;top:50%;width:35%;border-radius:12px;transform:translateY(-50%)
110
+ - script "Every commit gets a unique hash, like a1b2c3d, so you can always find it later..." start:0.5 on:(start, c.current=2)
111
+
112
+ #### B3-Example
113
+ layout:parallel
114
+ - image src:pr-history.png style:position:absolute;right:60px;top:50%;width:35%;border-radius:12px;transform:translateY(-50%)
115
+ - script "For example, when reviewing a pull request on GitHub, each commit tells a story..." start:0.5 on:(start, c.current=3)
116
+ ```
117
+
118
+ Rules for bullet-level media:
119
+ - Position the media in the **right third** of the slide (`right:60px;width:35%`) so it doesn't overlap the left-aligned text.
120
+ - Use `border-radius:12px` for images, `border-radius:50%` for circular narrator avatars.
121
+ - The media node and script node are siblings in a `layout:parallel` sub-scene so they play together as one segment.
122
+ - Each beat node name should briefly describe the visual (e.g. `#### B1-Snapshot`).
123
+ - For **video** clips per bullet: use `- video src:...` instead of `- image src:...`. Same positioning.
124
+ - For **component** per bullet: use `- component jsx:"<MyBulletVisual />"` with its own styling.
125
+
126
+ #### B. Transition-audio timing
127
+
128
+ In a `transitionSeries`, adjacent segments overlap by the transition duration (default 0.5s). Without adjustment, the next paragraph's TTS audio starts playing during the fade — creating cacophony.
129
+
130
+ **Fix: add `start:<T>` to every script node in a transitionSeries, where T = your transition time.**
131
+
132
+ ```markdown
133
+ - script "Paragraph..." start:0.5 on:(start, c.current=1)
134
+ ```
135
+
136
+ This delays both the TTS audio AND the bullet-highlight event until after the transition completes. The transition time value must match the `transition:fade(T)` parameter.
137
+
138
+ > **If using multiple transitionSeries (nested)**: segment overlap compounds. Each script still gets `start:T` relative to its own segment. The engine handles the compound timing.
139
+
140
+ #### C. Persistent logo overlay
141
+
142
+ Add a logo that appears throughout the entire video by placing an `- image isBackground:true` at the root level:
143
+
144
+ ```markdown
145
+ # video
146
+ width:1920 height:1080 fps:30 layout:series
147
+ - image isBackground:true src:logo.png style:position:absolute;bottom:24px;right:24px;width:60px;opacity:0.7
148
+
149
+ ## Hook ...
150
+ ## Slides ...
151
+ ## Thanks ...
152
+ ```
153
+
154
+ The `isBackground:true` flag wraps the image in `<Loop>` so it plays for the full video duration. Position it in a corner so it doesn't cover slide content.
155
+
156
+ Variations:
157
+ - **Bottom-left**: `bottom:24px;left:24px`
158
+ - **Transparent watermark**: `opacity:0.3;width:160px`
159
+ - **Animated logo**: use `- video loop isBackground:true src:logo-animated.mp4`
160
+ - **Component logo**: use `- component isBackground:true jsx:"<Logo />"` and define `<Logo>` in the imports block for custom styling.
161
+
162
+ #### D. Narrator overlay (picture-in-picture)
163
+
164
+ Add a narrator's face or avatar as a persistent overlay in a corner. Two approaches:
165
+
166
+ **Static image (circular crop):**
167
+ ```markdown
168
+ - image isBackground:true src:narrator.png style:position:absolute;bottom:40px;left:40px;width:100px;height:100px;border-radius:50px;border:3px solid #61dafb;object-fit:cover
169
+ ```
170
+
171
+ **Video loop (animated narrator):**
172
+ ```markdown
173
+ - video loop isBackground:true src:narrator.mp4 style:position:absolute;bottom:40px;right:40px;width:140px;height:140px;border-radius:70px;object-fit:cover;border:3px solid rgba(255,255,255,.3)
174
+ ```
175
+
176
+ **With name label (using component):**
177
+ ```markdown
178
+ - component isBackground:true jsx:"<NarratorBox src='narrator.png' name='Dr. Smith' />"
179
+ ```
180
+
181
+ The `NarratorBox` component is available in the imports block (see §4) and adds a name label + glow effect.
182
+
183
+ **Placement rules:**
184
+ - Narrator overlay goes in the **opposite corner** from the logo. If logo is bottom-right, narrator goes bottom-left.
185
+ - The overlay should be small enough (≤140px diameter) to not distract from slide content.
186
+ - For video narrators, keep the B-roll simple and well-lit (talking head style).
187
+
188
+ #### E. Effects (entrance animations)
189
+
190
+ Apply CSS keyframe animations to images and components for entrance effects:
191
+ ```markdown
192
+ - image src:chart.png effect:zoomIn duration:1
193
+ - component jsx:"<Counter />" effect:fadeIn duration:2
194
+ ```
195
+
196
+ See markcut docs for available effect types: `fadeIn`, `zoomIn`, `bounceIn`, `slideInLeft`, `slideInRight`, `flipIn`, or custom keyframes.
197
+
198
+ #### F. TTS expression control
199
+
200
+ Guide TTS pronunciation for more natural speech using SSML-style cues in the script text:
201
+ - **Pause**: use `—` (em dash) or `...` for natural breath pauses
202
+ - **Emphasis**: capitalize key terms or use `*asterisks*` (edge-tts interprets these as emphasis)
203
+ - **Rate**: set `tts.rate:+10%` on the root config line for faster pacing, or `tts:{"--rate +10%"}` per scene
204
+ - **Phonetic spelling**: for jargon ("Snyk" = "snik", "Grafana" = "gruh-fah-nuh"), add parenthetical pronunciation on first use: `Snyk (pronounced "snik")`
205
+ - **Language mix**: for bilingual content, switch edge-tts voice per language using the `# <lang>` variant block
89
206
 
90
207
  ## 3. Authoring rules — the professional bar
91
208
 
@@ -105,6 +222,7 @@ Narration script:
105
222
  - The concrete example gets its own bullet and its own script paragraph. Never bury the example in a generic paragraph.
106
223
  - Bullet ordering: concepts first (what/why), example last (concrete reinforcement). The example is the final beat before advancing to the next scene.
107
224
  - Summary: each row in the comparison table gets one beat. The final beat closes the course ("Thank you for watching…").
225
+ - **Transition-audio timing**: in a `transitionSeries`, add `start:<transitionTime>` to each script node to prevent TTS audio from playing during fade transitions (see §2.b).
108
226
 
109
227
  Mermaid diagrams:
110
228
 
@@ -155,7 +273,7 @@ export function Mermaid({ source }) {
155
273
  })
156
274
  }, [source])
157
275
 
158
- return (<divref={ref}style={{ width: '100%', maxWidth: 960, margin: '20px auto' }}/> )
276
+ return <div ref={ref} style={{ width: '100%', maxWidth: 960, margin: '20px auto' }} />
159
277
  }
160
278
 
161
279
  /**
@@ -164,6 +282,94 @@ export function Mermaid({ source }) {
164
282
  * - Highlights the Nth bullet when `current=N`
165
283
  * - Renders mermaid code blocks ( ```mermaid ...``` ) as inline diagrams
166
284
  */
285
+ /**
286
+ * Picture-in-picture narrator overlay with name label.
287
+ * Place as isBackground:true at root level.
288
+ */
289
+ export function NarratorBox({ src, name = '', size = 100 }) {
290
+ return (
291
+ <div style={{
292
+ position: 'absolute',
293
+ bottom: 40,
294
+ left: 40,
295
+ display: 'flex',
296
+ flexDirection: 'column',
297
+ alignItems: 'center',
298
+ gap: 6,
299
+ }}>
300
+ <div style={{
301
+ width: size,
302
+ height: size,
303
+ borderRadius: '50%',
304
+ overflow: 'hidden',
305
+ border: '3px solid #61dafb',
306
+ boxShadow: '0 0 20px rgba(97, 218, 251, 0.3)',
307
+ }}>
308
+ <img
309
+ src={src}
310
+ style={{ width: '100%', height: '100%', objectFit: 'cover' }}
311
+ />
312
+ </div>
313
+ {name && (
314
+ <span style={{
315
+ fontSize: 14,
316
+ color: '#a8dadc',
317
+ textShadow: '0 2px 8px rgba(0,0,0,.6)',
318
+ whiteSpace: 'nowrap',
319
+ }}>{name}</span>
320
+ )}
321
+ </div>
322
+ )
323
+ }
324
+
325
+ /**
326
+ * Two-column layout: slide text on left, media on right.
327
+ * Use inside a parallel layout for per-bullet media (see §2.b).
328
+ */
329
+ export function SplitSlide({ source, mediaSrc, current = 0, mediaPosition = 'right' }) {
330
+ const mediaContent = mediaSrc && (
331
+ <img src={mediaSrc} style={{
332
+ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain',
333
+ borderRadius: 12, boxShadow: '0 4px 20px rgba(0,0,0,.4)',
334
+ }} />
335
+ )
336
+ let idx = 1
337
+ return (
338
+ <div style={{
339
+ display: 'flex', flexDirection: mediaPosition === 'right' ? 'row' : 'row-reverse',
340
+ width: '100%', height: '100%', padding: 40, boxSizing: 'border-box', gap: 32,
341
+ }}>
342
+ <div style={{
343
+ flex: 1, display: 'flex', flexDirection: 'column',
344
+ justifyContent: 'center', minWidth: 0,
345
+ }}>
346
+ <div className="slide" style={{ padding: 0, margin: 0, width: '100%' }}>
347
+ <ReactMarkdown remarkPlugins={[remarkGfm]}
348
+ components={{
349
+ li: ({ children }) => {
350
+ const highlight = idx === current; idx++
351
+ return <li className={highlight ? 'highlight' : ''}>{children}</li>
352
+ },
353
+ pre: ({ children }) => {
354
+ const code = React.Children.toArray(children)[0]
355
+ if (code?.props?.className === 'language-mermaid') {
356
+ return <Mermaid source={String(code.props.children)} />
357
+ }
358
+ return <pre>{children}</pre>
359
+ },
360
+ }}>{source}</ReactMarkdown>
361
+ </div>
362
+ </div>
363
+ <div style={{
364
+ width: '40%', flexShrink: 0,
365
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
366
+ }}>
367
+ {mediaContent}
368
+ </div>
369
+ </div>
370
+ )
371
+ }
372
+
167
373
  export function Slide({ current = 0, children }) {
168
374
  let idx = 1
169
375
  return (
@@ -293,6 +499,9 @@ Prompts in `prompts/` are fill-in templates: replace every `{placeholder}`, then
293
499
  1. **Outline** — fill `prompts/outline.md` → course outline. **Present the outline to the user and get confirmation** before continuing.
294
500
  2. **Scenes** — for each outline section, fill `prompts/scene.md` → slide source + narration script (all languages).
295
501
  3. **Assemble** — write `course.md`: §2 grammar, §3 rules, §4 blocks verbatim, root config line with the user's width/height/fps/voice.
502
+ - **Basic**: standard bullet-reveal pattern (one scene, one Slide component, N script nodes per scene).
503
+ - **With per-bullet media**: use `#### Beat` sub-scenes in `transitionSeries` for each bullet (see §2). Each beat is `layout:parallel` containing the image + script. Add `start:0.5` to each script node.
504
+ - **Overlays**: add persistent logo/narrator as `- image isBackground:true` at the root level.
296
505
  4. **Render** — `npx @lalalic/markcut render course.md`. On engine errors: fix and re-render, max 3 attempts per error, then ask the user.
297
506
  5. **Review (quality gate)** — run `agents/reviewer.md` in a fresh separate session. Give it absolute paths to: `course.md`, the rendered MP4, this `TEMPLATE.md`, plus target duration and language(s). It returns `{verdict, findings[]}` and never edits anything.
298
507
  6. **Fix loop** — on FAIL: fill `prompts/fix.md` with the findings, apply the edits yourself, go back to step 4. Max **3** review iterations, then escalate to the user with the open findings.
@@ -306,9 +515,10 @@ Done only when ALL hold:
306
515
  - [ ] structure matches §2 (hook, title, 3–6 concepts, summary, thanks)
307
516
  - [ ] no blank/black frames at scene boundaries; slides legible at target resolution
308
517
  - [ ] STT transcript of rendered audio matches scripts (≥90% content match)
309
- - [ ] each bullet should be narrated
310
- - [ ] expressful slides applied
311
- - [ ] 80% slides have charts/image/...
518
+ - [ ] each bullet has a narration beat — beat count = bullet count in every concept scene
519
+ - [ ] ≥80% of slides include a visual element beyond text-only bullets (chart, image, diagram, mermaid)
520
+ - [ ] overlays (logo, narrator) positioned without obstructing slide content
521
+ - [ ] no TTS audio plays during transitions (checked via `start:` offset on transitionSeries scripts)
312
522
 
313
523
 
314
524
 
@@ -24,6 +24,7 @@ Requirements:
24
24
  - one concrete example (real product, scenario, or story) — gets its own key point
25
25
  - whether the content is comparative → table (if yes, name the columns)
26
26
  - whether a mermaid diagram would help (flowchart, architecture, timeline)
27
+ - per-bullet **image/video suggestion** (a concrete visual that illustrates this point)
27
28
  - word budget
28
29
  - Summary: one comparison table spanning all concepts (name the columns) + a selection/decision guide ("If X → use Y").
29
30
  - Hook: one vivid visual idea usable as an image/video generation prompt, OR a provocative question if generation is unavailable.
@@ -39,6 +40,10 @@ Output format (markdown):
39
40
  - points:
40
41
  - **<key phrase>** — <elaboration>
41
42
  - ... (last point = the concrete example)
43
+ - images:
44
+ - bullet 1: <description of visual — screenshot, diagram, photo, icon>
45
+ - bullet 2: <description>
46
+ - ...
42
47
  - table: no | yes (<col1>, <col2>, ...)
43
48
  - mermaid: no | yes (<type and description of diagram>)
44
49
  - words: <n>
@@ -27,6 +27,7 @@ Produce, for language(s) {languages}:
27
27
  - `>` quote block only for a single memorable takeaway line
28
28
  - no bullet may exceed one line at 1.3em / 1920px width (~90 chars)
29
29
  - Optional mermaid diagram: add a fenced mermaid code block after the bullet list (` ```mermaid ...``` `) for flowcharts or architecture visuals.
30
+ - **For each bullet, suggest a visual** (image, diagram, screenshot, or icon) that could accompany it. The visual should show something concrete: a screenshot, a diagram step, a photo, etc.
30
31
 
31
32
  **B. Narration script** (per language, **one paragraph per bullet**):
32
33
 
@@ -55,6 +56,11 @@ script (en):
55
56
 
56
57
  <p3: describes bullet 3 — concrete example>
57
58
 
59
+ image suggestions:
60
+ <bullet 1: brief description of visual — e.g. GitHub commit diff screenshot>
61
+ <bullet 2: brief description of visual — e.g. unique hash diagram>
62
+ <bullet 3: brief description of visual — e.g. PR timeline graphs>
63
+
58
64
  script (<lang>):
59
65
  <p1 translation>
60
66