@lalalic/markcut 3.2.34 → 3.2.36
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/AGENTS.md +17 -302
- package/README.md +9 -0
- package/docs/developer-reference.md +311 -0
- package/package.json +1 -1
- package/skills/markcut/SKILL.md +56 -107
- package/skills/markcut/docs/markdown-descriptive.md +2 -2
- package/skills/markcut/evals/README.md +29 -0
- package/skills/markcut/evals/cases.json +227 -0
- package/skills/markcut/evals/check.mjs +80 -0
- package/skills/markcut/evals/check.selftest.mjs +48 -0
- package/skills/markcut/evals/run-codex.mjs +87 -0
- package/skills/markcut/references/mcp-preview-lifecycle.md +14 -0
- package/skills/markcut/references/preview-troubleshooting.md +21 -49
- package/skills/markcut/review.md +52 -465
- package/src/config.mjs +3 -1
- package/src/render/cli.mjs +5 -2
- package/src/render/validate-assets.mjs +19 -0
- package/src/vision/cli.mjs +79 -28
- package/src/vision/vision_prompts.md +5 -3
- package/tests/validate-assets.test.ts +26 -0
- package/tests/vision-generic-vtt-hooks.test.ts +77 -0
- package/tests/vitest.publish.config.ts +1 -0
package/package.json
CHANGED
package/skills/markcut/SKILL.md
CHANGED
|
@@ -1,132 +1,81 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: markcut
|
|
3
|
-
description:
|
|
3
|
+
description: Create, edit, preview, review, and render videos from Markdown using Markcut. Use for storyboards and scene structure, media inspection, narration and subtitles, video variants, GPS route visuals, MP4 export, and interactive human review in ChatGPT. Select the right authoring, preview, or review workflow for the requested outcome.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Markcut — Markdown-to-video
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Markcut turns a Markdown video definition into a compiled stream tree and a playable video. **Use the project-selected video template for creative defaults** (opening/ending, BGM, transitions, subtitles, voice, aspect ratio); **the instantiated `video.md` is the authoritative source for that video's current scenes, media paths, previews, review revisions, and render**. Original media files are evidence/assets, not a substitute for the active Markdown. Do not duplicate template settings in the Skill or an agent prompt.
|
|
9
9
|
|
|
10
|
+
## Choose the capability
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
| User goal | Agent action |
|
|
13
|
+
|---|---|
|
|
14
|
+
| Understand a folder of photos or clips | Inspect the files; use `markcut vision <folder>` if scene selection needs visual/media understanding. |
|
|
15
|
+
| Make or revise a video | Load the project-selected template, author/edit its Markdown scenes, then `markcut verify <file>`. |
|
|
16
|
+
| Quickly assess story structure | `markcut preview <file> --storyboard` (placeholder media, not a final-video quality check). |
|
|
17
|
+
| Watch a native work-in-progress video | `markcut preview <file>`; test real visuals, sound, and seeking. |
|
|
18
|
+
| Ask a person to review in ChatGPT | Call the available `markcut.preview({path})` tool; handle revision-specific feedback and approval. |
|
|
19
|
+
| Deliver a finished MP4 | `markcut render <file> --output <path>`; inspect the resulting video and sound. |
|
|
20
|
+
| Visualize a route or trip | Use a Markdown `map` stream; load [route/map reference](docs/map-dynamic-camera.md). |
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
- `npx @lalalic/markcut vision <folder>` provides tool to understand video and images in a folder, and generate a `metadata.json` file with with text description, duration, and other metadata for each media file.
|
|
15
|
-
- `npx @lalalic/markcut vision <folder> --label`, interactive mode, provides tool to label video and images with text, and above metadata.
|
|
22
|
+
`markcut` means the `npx @lalalic/markcut` CLI in the examples below. For supported flags and generation adapters, consult `npx @lalalic/markcut --help`, `npx @lalalic/markcut vision --help`, and `npx @lalalic/markcut --show-clis` rather than guessing. Media generation is handled by the configured Markcut pipeline; this Skill does not select a project's private vision provider.
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
## Author and validate
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
1. Identify the requested audience, platform, duration, story, language, available assets, and desired output. Reuse the user's/project's designated video Markdown template; if none exists, start a minimal `# video` document.
|
|
27
|
+
2. Use scene nodes for narrative beats, visual media for what viewers see, and `script` for spoken content. Keep scene structure, soundtracks, caption styling, and transitions in the video Markdown. Do not impose a viral-video arc unless the user requests that style.
|
|
28
|
+
3. For a scene with narration and **one visual intended to span the narration**, make that visual `isBackground:true`; otherwise it may end before the voice and leave a blank tail. Do not impose a fixed script duration when narration timing is resolved by the pipeline.
|
|
29
|
+
4. Put hand-authored/third-party assets beside the video under `assets/`; do not place them in generated `.markcut/` cache. Do not manually remove that cache as a troubleshooting shortcut.
|
|
30
|
+
5. Run `verify` on the actual file and correct missing/escaped asset paths, invalid node properties, and timing assumptions before preview or render. For exact grammar, load [Markdown DSL](docs/markdown-descriptive.md) **only when authoring or validating**.
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
## scene-1
|
|
25
|
-
- image prompt:"..." isBackground:true # fills the whole scene, narration decides duration
|
|
26
|
-
- script "..."
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
see [docs/markdown-descriptive.md](docs/markdown-descriptive.md) for full details.
|
|
32
|
+
Minimal structure (adapt to the project's template):
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Skips slow TTI/TTV/STT generation and renders a fast preview where:
|
|
37
|
-
- `image`/`video` nodes with `prompt` but no `src` → `<StoryboardSlot>` placeholder showing the prompt text
|
|
38
|
-
- `audio`/`script` nodes → `<StoryboardCaption>` overlays showing narration text
|
|
39
|
-
- A `<StoryboardInfo>` card with root metadata (title, dimensions, fps) appears at the first frame
|
|
40
|
-
|
|
41
|
-
Implies `--edit` so you can chat to reshape the story and see live reloads.
|
|
42
|
-
|
|
43
|
-
### Video Variants
|
|
44
|
-
- define variants for different video configurations, such as different languages, aspects, platforms
|
|
45
|
-
|
|
46
|
-
### Route / Vlog videos (map clips)
|
|
47
|
-
- For **route / travel-vlog clips** (drone flyover, route map with photo stops, Street View walks) use the `map` stream type with `view: overview | route | cinematic | streetview` and `tween(from,to,easing)` camera moves.
|
|
48
|
-
- Discover interesting stops along a route with `markcut spots --waypoints "lat,lng;lat,lng" --photos --markdown`, then compose a `map` storyboard from the returned `waypoints:[...]` line.
|
|
49
|
-
- See [docs/map-dynamic-camera.md](docs/map-dynamic-camera.md) — the agent guide with effects, spots workflow, and copy-paste markdown examples.
|
|
50
|
-
|
|
51
|
-
### Viral Story requires
|
|
52
|
-
- **Hooks** : why should the viewer watch this?
|
|
53
|
-
- **Conflict** : what challenges or obstacles do the characters face?
|
|
54
|
-
- **Resolution** : how are the conflicts resolved?
|
|
55
|
-
- **Emotion** : what feelings are evoked in the viewer?
|
|
56
|
-
- **Call to action** : what should the viewer do next?
|
|
57
|
-
- **Open ending** : does the story leave room for interpretation or continuation?
|
|
58
|
-
|
|
59
|
-
### TTS, TTI, TTV, STT media generation
|
|
60
|
-
markcut implements a **media generation pipeline** to generate TTS, TTI, TTV, STT media automatically.
|
|
61
|
-
- `npx @lalalic/markcut --show-clis` to see the default CLIs for TTS, TTI, TTV, STT media generation.
|
|
62
|
-
- `orchestrator` agent DONT generate media directly
|
|
63
|
-
|
|
64
|
-
## 3. CLI
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npx @lalalic/markcut <command> [options]
|
|
68
|
-
npx @lalalic/markcut --help # get overall information
|
|
69
|
-
npx @lalalic/markcut --show-clis # get command specific information
|
|
70
|
-
npx @lalalic/markcut preview <file> # assemble and preview the video with a local server, and chat to edit the video and auto refresh
|
|
71
|
-
npx @lalalic/markcut preview <file> --storyboard # fast structure preview: replaces TTI/TTV prompts with placeholder components, skips slow generation
|
|
72
|
-
npx @lalalic/markcut render <file> # render the video to mp4
|
|
73
|
-
npx @lalalic/markcut vision <folder> # vision understanding medias in folder
|
|
74
|
-
npx @lalalic/markcut vision <folder> --label # an extra step to provide UI to label the medias with text, time ranges
|
|
75
|
-
npx @lalalic/markcut spots --waypoints "lat,lng;lat,lng" # discover POIs along a route (for route/vlog map clips)
|
|
34
|
+
```md
|
|
35
|
+
# video
|
|
36
|
+
width:1080 height:1920 fps:30 layout:series
|
|
76
37
|
|
|
38
|
+
## Opening
|
|
39
|
+
layout:parallel
|
|
40
|
+
- image src:assets/opening.jpg isBackground:true
|
|
41
|
+
- script "An opening line that matches the shot."
|
|
77
42
|
```
|
|
78
43
|
|
|
79
|
-
|
|
44
|
+
Asset paths are relative to the Markdown document. A `prompt` without `src` asks the media pipeline to generate content; inspect the result rather than assuming the prompt guarantees a correct visual. Keep visual and spoken meaning aligned. Use variants in Markdown for alternate language/platform/aspect outputs, rather than separate prompt rules.
|
|
80
45
|
|
|
81
|
-
##
|
|
46
|
+
## Select the next action; preserve completion gates
|
|
82
47
|
|
|
83
|
-
|
|
48
|
+
- Choose the **immediate next action** from the user's request. A later verification gate is not the current action: after `changes_requested`, **edit the active source `video.md` first**, then `verify`, preview the **new** revision, and return it for human review. Do not choose `verify` as if the requested edit already happened.
|
|
49
|
+
- If a source asset is missing, fix its location or reference (or report the actual blocker); do not re-run `verify` as a substitute for repair, and do not manufacture a missing asset.
|
|
50
|
+
- When the user **asks whether** a failed/unverified review is complete, answer **not complete** and identify the missing gate. When asked to **fix** the failure, investigate and recheck the broken layer. A compiled file or MCP resource URL is not evidence of actual playback.
|
|
51
|
+
- For a requested **animated route or moving map camera**, inspect real playback to verify that movement and framing actually work; a valid `map` node or GPS source does not prove the animation.
|
|
52
|
+
- **Completion gates are not immediate steps.** For a finished video, inspect real playback. For an explicit human review/approval, the current revision must be playable and the human must review or approve that same revision. Never claim human approval, borrow approval from an older revision, or make approval mandatory for ordinary render requests.
|
|
84
53
|
|
|
85
|
-
##
|
|
54
|
+
## Preview, review, and finish
|
|
86
55
|
|
|
87
|
-
|
|
56
|
+
1. **Structure gate:** `npx @lalalic/markcut verify video.md`, then `npx @lalalic/markcut preview video.md --storyboard` when rapid scene review is useful. Storyboard placeholders do not verify generated media or final audio.
|
|
57
|
+
2. **Playback gate:** `npx @lalalic/markcut preview video.md`. Play and seek representative scenes; check black tails, media loading, narration, BGM, subtitles, route movement, and timing. For browser failures, load [Preview Troubleshooting](references/preview-troubleshooting.md) on demand.
|
|
58
|
+
3. **Human review gate:** Use Neo's `markcut.preview({path: "/absolute/path/video.md"})` when the user wants the hosted ChatGPT video player. This is **not** the CLI preview. The tool compiles/publishes a revision for playback; it does not rewrite the source. Comments with `decision: changes_requested` require editing that Markdown and calling `markcut.preview` again. `decision: approved` applies **only** to the identified revision/content hash; never apply an old approval to changed content. Follow [Review Contract](review.md) for actual video assessment.
|
|
59
|
+
4. **Delivery gate:** `npx @lalalic/markcut render video.md --output out/video.mp4`. Confirm the MP4 exists and examine playback, including the final audio and subtitles. A valid Markdown file, compile success, or hosted-player resource alone is not proof of a finished video.
|
|
88
60
|
|
|
89
|
-
|
|
90
|
-
- The MCP call returns promptly with an asynchronous compilation operation. The hosted iframe shows actual compilation stages, then loads a published immutable compiled JSON and media snapshot. There is no persistent player-manager process.
|
|
91
|
-
- Player controls include Play/Pause, Seek, volume/audio, fullscreen and a **horizontal clickable scene list** sourced from compiled scene metadata. The title bar displays **Markcut · video title**, a **Browser TTS** switch, and the player version at right.
|
|
92
|
-
- **Browser TTS** is an optional preview playback mode (default on when subtitle VTT exists). It speaks existing caption/script text in the browser; it does **not** use STT. Toggle off for generated audio and the original subtitle renderer. This switch does not currently skip compilation-time TTS or affect final renders. Playback timing and seeking are approximate for browser speech.
|
|
93
|
-
- Google Maps `map` streams (route/cinematic) can be prerendered by Remotion into MP4 during MCP compilation. The published compiled JSON then references video streams, not live map tiles or a browser-exposed API key. If the render key is unavailable or prerendering fails, the original live Google Maps stream is preserved as a fallback. Native Map support remains available.
|
|
94
|
-
- **Batch review:** choose scenes in the horizontal list and draft comments for each; scenes with drafts are highlighted. Returning to a scene restores its draft. **Add timed comment** stores a separate note at the current playback position. **Submit all feedback** sends one `changes_requested` message with a structured `comments[]` list of text and scene/time context, plus a backwards-compatible `feedback` summary. Drafts stay inside the current preview revision; approval requires resolving any unsent comments.
|
|
95
|
-
- **Send feedback** (formerly Request changes) requires text and sends `ui/message` with `decision: "changes_requested"`, the source path, revision/content hash, and `playbackContext` (current `sceneId`, `sceneName`, `timeSeconds`) when available. The calling agent must interpret the feedback, edit the supplied video Markdown, and invoke `markcut.preview` again for the next turn. The player does not edit files.
|
|
96
|
-
- **Approve** sends `decision: "approved"` via `ui/message` for the specific revision. Do not approve a different/newer revision on the basis of an old review.
|
|
97
|
-
- Earlier previews are read-only once superseded; the submitted revision is checked against the latest published hash.
|
|
98
|
-
- **Verification boundary:** compilation, static MP4 publication, and focused tests have passed, but complete real-hosted ChatGPT feedback → agent edit → re-preview → approval E2E still requires acceptance testing. Do not claim it is verified based on tool metadata alone.
|
|
61
|
+
If the user asks only for a script or structure, stop at the requested stage. Do not trigger expensive generation or claim final video delivery without a requested rendered artifact. A project-specific agent owns its own editorial or approval decisions; Markcut supplies authoring, playback and revision capabilities.
|
|
99
62
|
|
|
100
|
-
|
|
63
|
+
## Failure and lifecycle boundaries
|
|
101
64
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* review the rendered video
|
|
65
|
+
- Treat `verify` errors, missing media, failed compilation, inaccessible preview, broken audio, and failed rendering as different failures. Preserve the previous successful artifact; report the failed gate and evidence, not success.
|
|
66
|
+
- Some media jobs run for a long time. Monitor observable progress and use the host's managed-job/timeout/recovery facilities. Do not assume a job succeeded because it launched, and do not leave unresponsive work running indefinitely.
|
|
67
|
+
- Native preview, MCP compilation/publication and the actual hosted ChatGPT player are **separate verification gates**. Never infer one passes because another passes.
|
|
68
|
+
- Keep manual assets, private coordinates, credentials and third-party rights protected. For route media, distinguish measured GPS tracks from inferred roads between stops.
|
|
69
|
+
- Stop only preview servers and browser sessions created for this task; do not disturb unrelated processes.
|
|
108
70
|
|
|
109
|
-
##
|
|
71
|
+
## References — load by need
|
|
110
72
|
|
|
111
|
-
|
|
|
112
|
-
|
|
113
|
-
| Markdown
|
|
114
|
-
|
|
|
115
|
-
|
|
|
73
|
+
| Need | Reference |
|
|
74
|
+
|---|---|
|
|
75
|
+
| Markdown grammar, nodes, variants and asset syntax | [docs/markdown-descriptive.md](docs/markdown-descriptive.md) |
|
|
76
|
+
| Map/GPS videos and camera movement | [docs/map-dynamic-camera.md](docs/map-dynamic-camera.md) |
|
|
77
|
+
| JSX components and package examples | [docs/components.md](docs/components.md) |
|
|
116
78
|
| Sound effects | [docs/sound-effects.md](docs/sound-effects.md) |
|
|
117
|
-
| Review contract | [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Built-in components available via `@lalalic/markcut/components`. See [docs/components.md](docs/components.md) for full reference.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## Golden rule
|
|
125
|
-
- put all manual assets in `assets` folder, such as bgm, logo, watermark, etc. don't put them in `.markcut` folder, which is auto generated and will be deleted when `markcut clean` command is run.
|
|
126
|
-
|
|
127
|
-
### Don'ts
|
|
128
|
-
- **don't** set duration for script or stream's duration depending on audio script
|
|
129
|
-
- markcut resolver will automatically calculate the duration based on the audio script length
|
|
130
|
-
- **don't** rm `.markcut` directory, which served as cache for all generated content. cache will auto update
|
|
131
|
-
- **don't** set timeout for `preview`, `vision`, `render` markcut commands, which may take long time to generate medias.
|
|
132
|
-
- **don't** use skill to understand vision media. use `npx @lalalic/markcut vision <folder>`.
|
|
79
|
+
| Review criteria, evidence and feedback contract | [review.md](review.md) |
|
|
80
|
+
| Real player/audio/map/iframe troubleshooting | [references/preview-troubleshooting.md](references/preview-troubleshooting.md) |
|
|
81
|
+
| MCP published-preview lifecycle (Markcut repository) | [references/mcp-preview-lifecycle.md](references/mcp-preview-lifecycle.md) |
|
|
@@ -64,7 +64,7 @@ Where:
|
|
|
64
64
|
|
|
65
65
|
| Token | Stream Type | When | Required Keys |
|
|
66
66
|
|---|---|---|---|
|
|
67
|
-
| `image` | `image` | Still photos, title cards | `src
|
|
67
|
+
| `image` | `image` | Still photos, title cards | `src`; `duration` unless `isBackground:true` or parent duration applies |
|
|
68
68
|
| `video` | `video` | Video clips | `src` + (`duration` or `endAt`) |
|
|
69
69
|
| `audio` | `audio` | Voiceover, BGM, SFX | `src` + (`duration` or `endAt`) |
|
|
70
70
|
| `script "..."` | `audio` | Narration/TTS (shorthand for audio with script) | `script` text (the `"..."` is the primary content) |
|
|
@@ -262,7 +262,7 @@ width:1080 height:1920 fps:30 layout:series
|
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
### 13. `src` Path Resolution — Context Root
|
|
265
|
-
|
|
265
|
+
Local `src` paths must be relative to the Markdown file and must not escape its directory. For example, if your file is `./videos/course.md`, then `src:./assets/bg.jpg` resolves to `./videos/assets/bg.jpg`. The current `verify` and render asset checks reject absolute paths and `..` escapes. Remote URLs remain supported.
|
|
266
266
|
|
|
267
267
|
|
|
268
268
|
### 14. verify
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Markcut Skill behavioral evals
|
|
2
|
+
|
|
3
|
+
The 14 capability-driven scenarios test **next-action routing, source authority, and completion gates**. These are agent dry-run tests, **not** video rendering, network, browser, or approval E2E tests. The target model selects the immediate action. It also names **checks needed before claiming the entire requested result is complete**; these are separate decisions. A `report` refusal can be correct when the user asks whether an unverified artifact is already approved.
|
|
4
|
+
|
|
5
|
+
## Output contract
|
|
6
|
+
|
|
7
|
+
Each case returns an object in a JSON array:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{"id":"case-id","action":"author","authority":"video_md","completion_gates":["verify","real_playback","human_review"],"reason":"Brief explanation"}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- `action`: `vision | author | storyboard | native_preview | mcp_review | render | verify | repair | report`. This is the **immediate next step**, not a later gate.
|
|
14
|
+
- `authority`: `source_media` (original media evidence or a missing physical asset), `selected_video_template` (project's creative/style defaults), or `video_md` (current video's actual source, referenced assets, preview/review revision and render).
|
|
15
|
+
- `completion_gates`: any applicable checks drawn from `verify`, `real_playback`, `human_review`. `human_review` means the new revision must be reviewed/approved by an actual human before claiming a human review/approval result; it is **not** mandatory for an ordinary render. These are gates to **claim the requested outcome complete**, not actions to execute immediately.
|
|
16
|
+
- `reason`: explain the decision and why a blocker/approval cannot be assumed resolved. Do not claim actions were actually completed.
|
|
17
|
+
|
|
18
|
+
`cases.json` defines acceptable equivalent next actions or authorities and **required** and **forbidden** gates. The checker does not insist on irrelevant intermediate gates; the meaningful behavioral invariants matter more than one exact execution order. It still rejects a wrong initial action, wrong source authority, missing essential gate, or inappropriate human-review requirement. This avoids confusing a report of failure with a failed repair attempt.
|
|
19
|
+
|
|
20
|
+
## Run
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
node skills/markcut/evals/check.mjs --validate
|
|
24
|
+
node skills/markcut/evals/run-codex.mjs --provider openrouter --model openrouter/free
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The `run-codex.mjs` runner uses the locally authenticated Codex CLI and current `SKILL.md`. **By default it evaluates one independent user request per Codex invocation**, matching actual Skill usage instead of testing the model's ability to manage a large multi-task JSON array. Override with `--batch-size N` only for a batch-stress experiment. The provider and model are runtime parameters; `cases.json` and the checker are provider-independent. The runner saves the actual responses, JSONL events, stderr, and a score in a per-run temporary directory. It never changes video files or asks the model to perform real side effects.
|
|
28
|
+
|
|
29
|
+
If a result fails, inspect `reason` and classify it as a Skill ambiguity, prompt conflict, incorrect eval expectation, undocumented implementation behavior, or model failure **before modifying either the Skill or the assertions**. In particular, a successful `compiled.json` is never final video playback and an old revision's human approval never applies to new content.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "media-folder",
|
|
4
|
+
"kind": "capability",
|
|
5
|
+
"request": "我有一批骑行照片和视频,先帮我理解素材,不要生成视频。",
|
|
6
|
+
"action": "vision",
|
|
7
|
+
"authority": "source_media",
|
|
8
|
+
"notes": "Use media understanding, not speculative captions or render.",
|
|
9
|
+
"required_gates": [],
|
|
10
|
+
"forbidden_gates": [
|
|
11
|
+
"human_review",
|
|
12
|
+
"real_playback"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "project-template",
|
|
17
|
+
"kind": "capability",
|
|
18
|
+
"request": "用项目已有 video.md 模板做一段骑行 Vlog,保留固定 BGM、开头和字幕样式。",
|
|
19
|
+
"action": "author",
|
|
20
|
+
"authority": "selected_video_template",
|
|
21
|
+
"notes": "The chosen video template supplies creative settings; a finished video later needs real playback, not automatic human approval.",
|
|
22
|
+
"required_gates": [
|
|
23
|
+
"real_playback"
|
|
24
|
+
],
|
|
25
|
+
"forbidden_gates": [
|
|
26
|
+
"human_review"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "structure-only",
|
|
31
|
+
"kind": "capability",
|
|
32
|
+
"request": "先看故事分镜,不要生成图片或语音。",
|
|
33
|
+
"action": "storyboard",
|
|
34
|
+
"authority": "video_md",
|
|
35
|
+
"notes": "Storyboard preview is not a final video test.",
|
|
36
|
+
"required_gates": [],
|
|
37
|
+
"forbidden_gates": [
|
|
38
|
+
"human_review",
|
|
39
|
+
"real_playback"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "local-video",
|
|
44
|
+
"kind": "capability",
|
|
45
|
+
"request": "播放我现有的 Markcut Markdown 视频,看看是否有黑屏和音画不同步。",
|
|
46
|
+
"action": "native_preview",
|
|
47
|
+
"authority": "video_md",
|
|
48
|
+
"notes": "Use native CLI preview and real playback.",
|
|
49
|
+
"required_gates": [
|
|
50
|
+
"real_playback"
|
|
51
|
+
],
|
|
52
|
+
"forbidden_gates": [
|
|
53
|
+
"human_review"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "chatgpt-review",
|
|
58
|
+
"kind": "capability",
|
|
59
|
+
"request": "把这个视频打开在 ChatGPT Markcut Player,让我逐场景提意见。",
|
|
60
|
+
"action": "mcp_review",
|
|
61
|
+
"authority": "video_md",
|
|
62
|
+
"notes": "markcut.preview tool; not CLI preview.",
|
|
63
|
+
"required_gates": [
|
|
64
|
+
"real_playback",
|
|
65
|
+
"human_review"
|
|
66
|
+
],
|
|
67
|
+
"forbidden_gates": []
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "render-final",
|
|
71
|
+
"kind": "capability",
|
|
72
|
+
"request": "导出 final.mp4 给我。",
|
|
73
|
+
"action": "render",
|
|
74
|
+
"authority": "video_md",
|
|
75
|
+
"notes": "Verify and render MP4; inspect actual output.",
|
|
76
|
+
"required_gates": [
|
|
77
|
+
"real_playback"
|
|
78
|
+
],
|
|
79
|
+
"forbidden_gates": [
|
|
80
|
+
"human_review"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "gps-map",
|
|
85
|
+
"kind": "capability",
|
|
86
|
+
"request": "按这段 GPS 路线做有运动镜头的地图场景,连接道路是推断的。",
|
|
87
|
+
"action": "author",
|
|
88
|
+
"authority": "video_md",
|
|
89
|
+
"notes": "Source GPS is authoritative for actual track provenance; authored map motion belongs to the active video Markdown. Real playback verifies movement.",
|
|
90
|
+
"required_gates": [
|
|
91
|
+
"real_playback"
|
|
92
|
+
],
|
|
93
|
+
"forbidden_gates": [
|
|
94
|
+
"human_review"
|
|
95
|
+
],
|
|
96
|
+
"accepted_authorities": [
|
|
97
|
+
"video_md",
|
|
98
|
+
"source_media"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "edit-review",
|
|
103
|
+
"kind": "capability",
|
|
104
|
+
"request": "审核消息 changes_requested,要求第2场景 00:08 改旁白。",
|
|
105
|
+
"action": "author",
|
|
106
|
+
"authority": "video_md",
|
|
107
|
+
"notes": "The immediate action is to edit video.md, not verify the as-yet-unedited source. Then validate/re-preview and seek fresh human review.",
|
|
108
|
+
"accepted_actions": [
|
|
109
|
+
"author",
|
|
110
|
+
"repair"
|
|
111
|
+
],
|
|
112
|
+
"required_gates": [
|
|
113
|
+
"real_playback",
|
|
114
|
+
"human_review"
|
|
115
|
+
],
|
|
116
|
+
"forbidden_gates": []
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "asset-missing",
|
|
120
|
+
"kind": "edge",
|
|
121
|
+
"request": "verify 报告 assets/intro.jpg 不存在,但直接继续渲染吧。",
|
|
122
|
+
"action": "repair",
|
|
123
|
+
"authority": "video_md",
|
|
124
|
+
"notes": "Do not bypass verification or invent media.",
|
|
125
|
+
"required_gates": [
|
|
126
|
+
"verify"
|
|
127
|
+
],
|
|
128
|
+
"forbidden_gates": [
|
|
129
|
+
"human_review"
|
|
130
|
+
],
|
|
131
|
+
"accepted_authorities": [
|
|
132
|
+
"video_md",
|
|
133
|
+
"source_media"
|
|
134
|
+
],
|
|
135
|
+
"accepted_actions": [
|
|
136
|
+
"repair",
|
|
137
|
+
"report"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "stale-approval",
|
|
142
|
+
"kind": "edge",
|
|
143
|
+
"request": "我上次批准了 revision A,你现在改了 video.md 的镜头,直接标记 B 已批准。",
|
|
144
|
+
"action": "repair",
|
|
145
|
+
"authority": "video_md",
|
|
146
|
+
"notes": "Refuse transfer of approval from A to B. A new human review is required before declaring B approved.",
|
|
147
|
+
"accepted_actions": [
|
|
148
|
+
"report",
|
|
149
|
+
"mcp_review",
|
|
150
|
+
"repair"
|
|
151
|
+
],
|
|
152
|
+
"required_gates": [
|
|
153
|
+
"human_review"
|
|
154
|
+
],
|
|
155
|
+
"forbidden_gates": []
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"id": "compiled-not-played",
|
|
159
|
+
"kind": "edge",
|
|
160
|
+
"request": "compiled.json 成功生成了,没打开播放器,评价最终画质和声音并批准吧。",
|
|
161
|
+
"action": "report",
|
|
162
|
+
"authority": "video_md",
|
|
163
|
+
"notes": "Never claim video quality or approval from compiled.json; real playback and actual human review are prerequisites.",
|
|
164
|
+
"accepted_actions": [
|
|
165
|
+
"native_preview",
|
|
166
|
+
"report"
|
|
167
|
+
],
|
|
168
|
+
"required_gates": [
|
|
169
|
+
"real_playback",
|
|
170
|
+
"human_review"
|
|
171
|
+
],
|
|
172
|
+
"forbidden_gates": []
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"id": "bgm-location",
|
|
176
|
+
"kind": "capability",
|
|
177
|
+
"request": "改变 Vlog 背景音乐,应该改 Skill 还是项目 video.md 模板?",
|
|
178
|
+
"action": "author",
|
|
179
|
+
"authority": "selected_video_template",
|
|
180
|
+
"notes": "BGM is defined in authoritative Markdown, not SKILL.md or Planner.",
|
|
181
|
+
"accepted_actions": [
|
|
182
|
+
"report",
|
|
183
|
+
"author"
|
|
184
|
+
],
|
|
185
|
+
"required_gates": [],
|
|
186
|
+
"forbidden_gates": [
|
|
187
|
+
"human_review",
|
|
188
|
+
"real_playback"
|
|
189
|
+
],
|
|
190
|
+
"accepted_authorities": [
|
|
191
|
+
"selected_video_template",
|
|
192
|
+
"video_md"
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "cli-verify",
|
|
197
|
+
"kind": "command",
|
|
198
|
+
"request": "在正式导出前先验证 Markcut Markdown 的语法和素材路径,用什么 CLI?",
|
|
199
|
+
"action": "report",
|
|
200
|
+
"authority": "video_md",
|
|
201
|
+
"notes": "The user asks which command, not to execute it; answer markcut verify <file> without performing a command.",
|
|
202
|
+
"required_gates": [
|
|
203
|
+
"verify"
|
|
204
|
+
],
|
|
205
|
+
"forbidden_gates": [
|
|
206
|
+
"human_review",
|
|
207
|
+
"real_playback"
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "browser-broken",
|
|
212
|
+
"kind": "edge",
|
|
213
|
+
"request": "MCP 工具返回资源链接,但 ChatGPT 内播放器一直空白;算审核完成吗?",
|
|
214
|
+
"action": "repair",
|
|
215
|
+
"authority": "video_md",
|
|
216
|
+
"notes": "Asked whether complete: answer no and identify player as blocker; repairing is also valid if actively fixing.",
|
|
217
|
+
"required_gates": [
|
|
218
|
+
"real_playback",
|
|
219
|
+
"human_review"
|
|
220
|
+
],
|
|
221
|
+
"forbidden_gates": [],
|
|
222
|
+
"accepted_actions": [
|
|
223
|
+
"report",
|
|
224
|
+
"repair"
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { basename, dirname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const root = resolve(here, '..');
|
|
8
|
+
const cases = JSON.parse(readFileSync(resolve(here, 'cases.json'), 'utf8'));
|
|
9
|
+
const allowed = {
|
|
10
|
+
action: new Set(['vision', 'author', 'storyboard', 'native_preview', 'mcp_review', 'render', 'verify', 'repair', 'report']),
|
|
11
|
+
authority: new Set(['source_media', 'selected_video_template', 'video_md']),
|
|
12
|
+
gate: new Set(['verify', 'real_playback', 'human_review']),
|
|
13
|
+
kind: new Set(['capability', 'edge', 'command']),
|
|
14
|
+
};
|
|
15
|
+
let failures = 0;
|
|
16
|
+
let passedCases = 0;
|
|
17
|
+
function check(ok, label) {
|
|
18
|
+
if (!ok) { console.error(`FAIL ${label}`); failures++; }
|
|
19
|
+
return ok;
|
|
20
|
+
}
|
|
21
|
+
const ids = new Set();
|
|
22
|
+
for (const item of cases) {
|
|
23
|
+
check(typeof item.id === 'string' && !ids.has(item.id), `unique id ${item.id}`);
|
|
24
|
+
ids.add(item.id);
|
|
25
|
+
check(typeof item.request === 'string' && item.request.length > 8, `${item.id} user request`);
|
|
26
|
+
check(allowed.kind.has(item.kind), `${item.id} kind`);
|
|
27
|
+
for (const key of ['action', 'authority']) check(allowed[key].has(item[key]), `${item.id} ${key}`);
|
|
28
|
+
for (const key of ['accepted_actions', 'accepted_authorities']) {
|
|
29
|
+
if (!item[key]) continue;
|
|
30
|
+
const pool = key === 'accepted_actions' ? allowed.action : allowed.authority;
|
|
31
|
+
const baseline = key === 'accepted_actions' ? item.action : item.authority;
|
|
32
|
+
check(Array.isArray(item[key]) && item[key].includes(baseline) && item[key].every(v => pool.has(v)), `${item.id} ${key}`);
|
|
33
|
+
}
|
|
34
|
+
const required = item.required_gates, forbidden = item.forbidden_gates;
|
|
35
|
+
check(Array.isArray(required) && required.every(v => allowed.gate.has(v)) && new Set(required).size === required.length, `${item.id} required_gates`);
|
|
36
|
+
check(Array.isArray(forbidden) && forbidden.every(v => allowed.gate.has(v)) && new Set(forbidden).size === forbidden.length, `${item.id} forbidden_gates`);
|
|
37
|
+
check(required.every(v => !forbidden.includes(v)), `${item.id} gates do not contradict`);
|
|
38
|
+
}
|
|
39
|
+
const skill = readFileSync(resolve(root, 'SKILL.md'), 'utf8');
|
|
40
|
+
check(skill.startsWith('---\nname: markcut\n'), 'skill metadata');
|
|
41
|
+
check(/\ndescription: \S/.test(skill), 'skill description');
|
|
42
|
+
check(!/deepseek/i.test(skill), 'provider-specific vision does not belong in public Skill');
|
|
43
|
+
check(cases.length >= 12, 'minimum capability scenarios');
|
|
44
|
+
for (const relative of ['SKILL.md', 'review.md', 'references/preview-troubleshooting.md', 'references/mcp-preview-lifecycle.md']) {
|
|
45
|
+
const file = resolve(root, relative);
|
|
46
|
+
const content = readFileSync(file, 'utf8');
|
|
47
|
+
for (const match of content.matchAll(/\]\(([^)]+\.md)\)/g)) {
|
|
48
|
+
check(existsSync(resolve(dirname(file), match[1])), `reference ${basename(file)} -> ${match[1]}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (process.argv[2] === '--validate') {
|
|
52
|
+
console.log(`Validated ${cases.length} eval definitions and Markdown references; ${failures} failure(s).`);
|
|
53
|
+
} else {
|
|
54
|
+
if (!process.argv[2]) { console.error('Usage: node check.mjs --validate | responses.json'); process.exit(2); }
|
|
55
|
+
let responses;
|
|
56
|
+
try { responses = JSON.parse(readFileSync(resolve(process.argv[2]), 'utf8')); }
|
|
57
|
+
catch (e) { console.error(`FAIL model response is not valid JSON: ${e.message}`); process.exit(1); }
|
|
58
|
+
if (!check(Array.isArray(responses), 'responses is an array')) process.exit(1);
|
|
59
|
+
const byId = new Map(responses.map(r => [r?.id, r]));
|
|
60
|
+
check(byId.size === responses.length, 'no duplicate response ids');
|
|
61
|
+
check(responses.length === cases.length, 'expected response count');
|
|
62
|
+
for (const item of cases) {
|
|
63
|
+
const output = byId.get(item.id);
|
|
64
|
+
if (!check(Boolean(output), `${item.id} response exists`)) continue;
|
|
65
|
+
const before = failures;
|
|
66
|
+
for (const key of ['action', 'authority']) {
|
|
67
|
+
const options = (key === 'action' ? item.accepted_actions : item.accepted_authorities) ?? [item[key]];
|
|
68
|
+
check(options.includes(output[key]), `${item.id}.${key}: expected ${options.join(' / ')}, got ${output[key]}`);
|
|
69
|
+
}
|
|
70
|
+
const gates = output.completion_gates;
|
|
71
|
+
if (check(Array.isArray(gates) && gates.every(v => allowed.gate.has(v)) && new Set(gates).size === gates.length, `${item.id}.completion_gates valid`)) {
|
|
72
|
+
for (const required of item.required_gates) check(gates.includes(required), `${item.id} missing completion gate: ${required}`);
|
|
73
|
+
for (const forbidden of item.forbidden_gates) check(!gates.includes(forbidden), `${item.id} incorrect completion gate: ${forbidden}`);
|
|
74
|
+
}
|
|
75
|
+
check(typeof output.reason === 'string' && output.reason.trim().length > 12, `${item.id} explanation`);
|
|
76
|
+
if (failures === before) passedCases++;
|
|
77
|
+
}
|
|
78
|
+
console.log(`Scored ${cases.length} cases: ${passedCases}/${cases.length} passed; ${failures} failed assertions. Manually inspect reason text for misleading claims.`);
|
|
79
|
+
}
|
|
80
|
+
process.exit(failures ? 1 : 0);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { dirname, join } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const root = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const cases = JSON.parse(readFileSync(join(root, 'cases.json'), 'utf8'));
|
|
11
|
+
const dir = mkdtempSync(join(tmpdir(), 'markcut-eval-check-'));
|
|
12
|
+
function score(responses) {
|
|
13
|
+
const file = join(dir, 'responses.json');
|
|
14
|
+
writeFileSync(file, JSON.stringify(responses));
|
|
15
|
+
return spawnSync(process.execPath, [join(root, 'check.mjs'), file], {encoding: 'utf8'});
|
|
16
|
+
}
|
|
17
|
+
const good = cases.map(c => ({id: c.id, action: c.action, authority:c.authority,
|
|
18
|
+
completion_gates: [...c.required_gates], reason: 'Correct next action and required completion checks are recorded.'}));
|
|
19
|
+
test('checker scores valid capability decisions', () => {
|
|
20
|
+
const outcome = score(good);
|
|
21
|
+
assert.equal(outcome.status, 0, outcome.stderr);
|
|
22
|
+
assert.match(outcome.stdout, new RegExp(`${cases.length}/${cases.length} passed`));
|
|
23
|
+
});
|
|
24
|
+
test('checker catches wrong immediate action and missing human approval boundary', () => {
|
|
25
|
+
const wrong = structuredClone(good);
|
|
26
|
+
const edit = wrong.find(c => c.id === 'edit-review');
|
|
27
|
+
edit.action = 'verify';
|
|
28
|
+
edit.completion_gates = [];
|
|
29
|
+
const outcome = score(wrong);
|
|
30
|
+
assert.notEqual(outcome.status, 0);
|
|
31
|
+
assert.match(outcome.stderr, /edit-review\.action/);
|
|
32
|
+
assert.match(outcome.stderr, /edit-review missing completion gate: human_review/);
|
|
33
|
+
});
|
|
34
|
+
test('checker rejects a fabricated human-review requirement for a render-only request', () => {
|
|
35
|
+
const wrong = structuredClone(good);
|
|
36
|
+
wrong.find(c => c.id === 'render-final').completion_gates.push('human_review');
|
|
37
|
+
const outcome = score(wrong);
|
|
38
|
+
assert.notEqual(outcome.status, 0);
|
|
39
|
+
assert.match(outcome.stderr, /render-final incorrect completion gate: human_review/);
|
|
40
|
+
});
|
|
41
|
+
test('checker rejects invalid JSON rather than repairing it silently', () => {
|
|
42
|
+
const file = join(dir, 'invalid.json');
|
|
43
|
+
writeFileSync(file, '[{"id":"media-folder"}}}');
|
|
44
|
+
const outcome = spawnSync(process.execPath, [join(root, 'check.mjs'), file], {encoding:'utf8'});
|
|
45
|
+
assert.notEqual(outcome.status, 0);
|
|
46
|
+
assert.match(outcome.stderr, /not valid JSON/);
|
|
47
|
+
});
|
|
48
|
+
process.on('exit', () => rmSync(dir, {force:true, recursive:true}));
|