@lalalic/markcut 2.2.8 → 2.3.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 (46) hide show
  1. package/package.json +2 -1
  2. package/skills/markcut/SKILL.md +11 -9
  3. package/skills/markcut/docs/markdown-descriptive.md +1 -1
  4. package/src/config.mjs +60 -63
  5. package/src/descriptive/resolve.ts +3 -2
  6. package/src/player/pipeline.mjs +64 -21
  7. package/src/render/cli.mjs +42 -69
  8. package/src/vision/cli.mjs +21 -45
  9. package/skills/markcut/docs/edit-mode.md +0 -220
  10. package/skills/markcut/docs/label-mode.md +0 -112
  11. package/skills/markcut/docs/template.md +0 -212
  12. package/skills/markcut/docs/templates/courseware/TEMPLATE.md +0 -526
  13. package/skills/markcut/docs/templates/courseware/agents/reviewer.md +0 -84
  14. package/skills/markcut/docs/templates/courseware/prompts/fix.md +0 -30
  15. package/skills/markcut/docs/templates/courseware/prompts/outline.md +0 -58
  16. package/skills/markcut/docs/templates/courseware/prompts/scene.md +0 -70
  17. package/skills/markcut/docs/templates/deep-dive/TEMPLATE.md +0 -354
  18. package/skills/markcut/docs/templates/deep-dive/agents/researcher.md +0 -69
  19. package/skills/markcut/docs/templates/deep-dive/agents/reviewer.md +0 -108
  20. package/skills/markcut/docs/templates/deep-dive/prompts/fix.md +0 -28
  21. package/skills/markcut/docs/templates/deep-dive/prompts/outline.md +0 -102
  22. package/skills/markcut/docs/templates/deep-dive/prompts/script.md +0 -64
  23. package/skills/markcut/docs/templates/illustrated-book/TEMPLATE.md +0 -356
  24. package/skills/markcut/docs/templates/illustrated-book/agents/reviewer.md +0 -115
  25. package/skills/markcut/docs/templates/illustrated-book/prompts/fix.md +0 -29
  26. package/skills/markcut/docs/templates/illustrated-book/prompts/illustration.md +0 -35
  27. package/skills/markcut/docs/templates/illustrated-book/prompts/story.md +0 -69
  28. package/skills/markcut/docs/templates/short-film/TEMPLATE.md +0 -385
  29. package/skills/markcut/docs/templates/short-film/agents/reviewer.md +0 -115
  30. package/skills/markcut/docs/templates/short-film/prompts/fix.md +0 -29
  31. package/skills/markcut/docs/templates/short-film/prompts/screenplay.md +0 -101
  32. package/skills/markcut/docs/templates/short-film/prompts/storyboard.md +0 -54
  33. package/skills/markcut/docs/templates/short-video/TEMPLATE.md +0 -301
  34. package/skills/markcut/docs/templates/short-video/agents/reviewer.md +0 -94
  35. package/skills/markcut/docs/templates/short-video/prompts/fix.md +0 -27
  36. package/skills/markcut/docs/templates/short-video/prompts/script.md +0 -65
  37. package/skills/markcut/docs/templates/vlog/TEMPLATE.md +0 -326
  38. package/skills/markcut/docs/templates/vlog/agents/reviewer.md +0 -89
  39. package/skills/markcut/docs/templates/vlog/agents/story-writer.md +0 -100
  40. package/skills/markcut/docs/templates/vlog/prompts/bgm-select.md +0 -38
  41. package/skills/markcut/docs/templates/vlog/prompts/group-clips.md +0 -93
  42. package/skills/markcut/docs/templates/vlog/prompts/local-context.md +0 -59
  43. package/skills/markcut/docs/templates/vlog/prompts/outline.md +0 -56
  44. package/skills/markcut/docs/templates/vlog/prompts/review-fix.md +0 -27
  45. package/skills/markcut/docs/templates/vlog/prompts/storyboard.md +0 -41
  46. package/src/render/cli.test.ts +0 -13
@@ -1,212 +0,0 @@
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
- - Any domain-specific tools
63
-
64
- ### §1 Inputs — the contract with the user
65
-
66
- A table of what the orchestrator must collect before starting. Each row:
67
-
68
- | Input | Required | Default | Notes |
69
- |---|---|---|---|
70
-
71
- **Rule:** never invent content beyond given material + well-established knowledge. Missing or ambiguous inputs → ask the user, never fabricate.
72
-
73
- ### §2 Scene grammar — the tree shape
74
-
75
- The backbone. Show both:
76
-
77
- 1. **An ASCII tree diagram** of the required structure with layout/transition annotations
78
- 2. **Concrete code blocks** showing the exact node structure for each scene type
79
-
80
- Hard rules come here: number of scenes, layouts, transitions, `isBackground` usage, timing rules, etc.
81
-
82
- **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.
83
-
84
- ### §3 Authoring rules — the professional bar
85
-
86
- Rules the reviewer checks. Cover:
87
-
88
- - Slide/content rules (max bullets, text shape, emoji conventions, table usage)
89
- - Script/narration rules (pacing, per-sentence structure, example placement, tone)
90
- - Media rules (positioning, sizing, where media can overlay)
91
- - Multi-language variant rules
92
- - Domain-specific rules (e.g. "never fabricate facts" for courseware, "ground every line in clip captions" for vlog)
93
-
94
- ### §4 Components & styles — copy verbatim
95
-
96
- The trickiest section. Two code blocks:
97
-
98
- 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).
99
- 2. **`~~~css stylesheet` block** — all CSS. Same rules: theme knobs documented, structure immutable.
100
-
101
- In addition, a **theme knobs table** showing what the user can change (colors, fonts, sizes) and their defaults.
102
-
103
- **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.
104
-
105
- ### §5 Workflow — the orchestrator's playbook
106
-
107
- Numbered steps from start to finish. Each step is one of:
108
-
109
- - **Fill a prompt** — "Fill `prompts/outline.md` → course outline. Present to user for confirmation."
110
- - **Run a subagent** — "Run `agents/reviewer.md` in a fresh session. Pass it these absolute paths."
111
- - **Execute a CLI command** — "`npx @lalalic/markcut render course.md`"
112
- - **User interaction** — "Get user approval before continuing."
113
-
114
- Include fix loops:
115
-
116
- > 6. **Fix loop** — on FAIL: fill `prompts/fix.md` with the findings, apply edits, re-render. Max 3 iterations, then escalate to user.
117
-
118
- ### §6 Quality gate — measurable exit criteria
119
-
120
- The checklist the reviewer uses. Each item must be machine-verifiable (by reviewing source, extracting frames, running STT, measuring duration). Examples:
121
-
122
- - Total duration within ±15% of target
123
- - Structure matches §2 (hook, title, N concepts, summary, thanks)
124
- - No blank/black frames at scene boundaries
125
- - STT transcript matches scripts (≥90% content match)
126
- - Each bullet has a narration beat
127
-
128
- ### §7 Reference — worked examples
129
-
130
- Link to golden example files in `tests/fixtures/templates/`. The golden example demonstrates every rule in the template applied correctly.
131
-
132
- ## Production polish patterns (reusable)
133
-
134
- These are design patterns you can include in any template. They're documented in detail in the courseware template (§2.b) but summarized here:
135
-
136
- | Pattern | Technique | Use case |
137
- |---|---|---|
138
- | **Per-beat media** | `#### Beat` sub-scenes with `layout:parallel` (image + script per beat) | Courseware slides, tutorial demos |
139
- | **Transition-audio timing** | `start:<T>` on script nodes in `transitionSeries` | Any scripted scene with transitions |
140
- | **Persistent overlay** | `- image isBackground:true` at root level | Logo, watermark |
141
- | **Narrator PiP** | `- video/image isBackground:true` with border-radius + name label | Talking-head overlays |
142
- | **Entrance effects** | `effect:zoomIn` / `effect:fadeIn` on images/components | Reveal animations |
143
- | **Mermaid diagrams** | ` ```mermaid ` in slide markdown | Flowcharts, architecture, timelines |
144
- | **TTS expression** | `—` pauses, `*emphasis*`, rate adjustment, phonetic spelling | Natural speech |
145
-
146
- ## Prompt design principles
147
-
148
- ### prompts/*.md
149
- - Use `{placeholder}` values for every input. The orchestrator replaces these before executing.
150
- - Include constraints from TEMPLATE.md inline so the prompt is self-contained.
151
- - Output format should be a concrete template the orchestrator can parse and assemble.
152
-
153
- ### agents/*.md
154
- - Must include a **system prompt** (top) and a **task template** (bottom, filled by orchestrator).
155
- - System prompt defines the agent's role, rules, and procedure.
156
- - Task template uses `{placeholder}` values for paths, params, and inputs.
157
- - Always mark the agent as `mode: read-only` if it shouldn't edit files.
158
- - Include an explicit output schema (JSON format) so the orchestrator can parse results reliably.
159
- - List which tools the agent needs (read, bash, ffmpeg, etc.).
160
-
161
- ## Choosing prompts vs agents
162
-
163
- | Task type | Where | Why |
164
- |---|---|---|
165
- | Creative generation (write a scene) | `prompts/` | Needs full context of the project; best done by orchestrator |
166
- | Factual check (review) | `agents/` | Needs fresh context; strict rubric; no editing |
167
- | Research (find images, analyze) | `agents/` | Parallelizable; heavy tool use |
168
- | Outline / planning | `prompts/` | Needs user interaction (confirm outline) |
169
- | Quality fix | `prompts/` | Orchestrator applies edits, runs tools |
170
-
171
- ## Testing a template
172
-
173
- 1. **Generate** — have a model follow the template to produce a video markdown
174
- 2. **Render** — `npx @lalalic/markcut render <output>.md`
175
- 3. **Review** — run the reviewer agent on the rendered output
176
- 4. **Fix** — apply fixes, re-render, re-review
177
- 5. **Verify** — check frames visually, check STT transcript
178
-
179
- The courseware template's test loop is the reference:
180
-
181
- ```
182
- Agent (deepseek-v4-flash + SKILL.md + markdown spec) → course.md
183
- └→ npx markcut render → course.mp4
184
- └→ Reviewer agent (separate session) → PASS/FAIL + findings
185
- └→ Fix → re-render → re-review (max 3x)
186
- ```
187
-
188
- ## Built-in templates
189
- 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.
190
-
191
- ## Cross-cutting concerns
192
-
193
- ### Multi-language
194
- - Use variant blocks (`# <lang>` at file end) with per-language TTS voice.
195
- - Every script node has a `<lang>:"..."` twin; every slide source has a `<lang>-source` twin.
196
- - The engine resolves variants via `parseMarkdownVariants`.
197
-
198
- ### Reviewer design
199
- - Always `mode: read-only` — reviewers report findings, never edit.
200
- - Two-phase: static (source vs rulebook) + dynamic (rendered artifact via ffprobe/ffmpeg/STT/vision).
201
- - Output: strict JSON with `{verdict, measured, findings[]}`. Each finding has `id`, `severity`, `scene`, `check`, `issue`, `evidence`, `fix_hint`.
202
- - PASS requires zero `blocker` and zero `major` findings.
203
-
204
- ### The "orchestrator" role
205
- The orchestrator is the agent reading the template. It:
206
- 1. Collects inputs from the user
207
- 2. Executes prompts in its own context
208
- 3. Spawns subagents in separate sessions for isolated tasks
209
- 4. Assembles, renders, fixes, and iterates
210
- 5. Escalates to the human user when stuck
211
-
212
- 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".