explainer-video 0.0.0-stage → 0.4.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 (150) hide show
  1. package/.claude-plugin/plugin.json +12 -0
  2. package/LICENSE +21 -0
  3. package/README.md +152 -2
  4. package/cordis.patch.yml +7 -0
  5. package/lib/index.js +35 -0
  6. package/package.json +56 -4
  7. package/plugin.json +13 -0
  8. package/skills/coursework-author/.synced-from +5 -0
  9. package/skills/coursework-author/SKILL.md +209 -0
  10. package/skills/craft-codeflow-flows/SKILL.md +116 -0
  11. package/skills/craft-codeflow-mine/SKILL.md +207 -0
  12. package/skills/craft-codeflow-plan/SKILL.md +65 -0
  13. package/skills/craft-codeflow-scene/SKILL.md +168 -0
  14. package/skills/craft-video-align/SKILL.md +109 -0
  15. package/skills/craft-video-assemble/SKILL.md +69 -0
  16. package/skills/craft-video-audio/SKILL.md +59 -0
  17. package/skills/craft-video-enrich/SKILL.md +46 -0
  18. package/skills/craft-video-plan/SKILL.md +57 -0
  19. package/skills/craft-video-publish/SKILL.md +79 -0
  20. package/skills/craft-video-render/SKILL.md +68 -0
  21. package/skills/craft-video-scene/SKILL.md +112 -0
  22. package/skills/craft-video-script/SKILL.md +80 -0
  23. package/skills/explainer-video-from-codebase/FLOWS.md +577 -0
  24. package/skills/explainer-video-from-codebase/SKILL.md +659 -0
  25. package/skills/explainer-video-from-codebase/tools/apply-flows.mjs +531 -0
  26. package/skills/explainer-video-from-codebase/tools/approve-flows.mjs +56 -0
  27. package/skills/explainer-video-from-codebase/tools/codemap-md.mjs +116 -0
  28. package/skills/explainer-video-from-codebase/tools/config/dotenv.mjs +13 -0
  29. package/skills/explainer-video-from-codebase/tools/config/json.mjs +14 -0
  30. package/skills/explainer-video-from-codebase/tools/config/redact.mjs +16 -0
  31. package/skills/explainer-video-from-codebase/tools/config/toml-lite.mjs +13 -0
  32. package/skills/explainer-video-from-codebase/tools/config/yaml-lite.mjs +18 -0
  33. package/skills/explainer-video-from-codebase/tools/excerpt-check.mjs +186 -0
  34. package/skills/explainer-video-from-codebase/tools/excerpt.mjs +116 -0
  35. package/skills/explainer-video-from-codebase/tools/flow-diagram.mjs +168 -0
  36. package/skills/explainer-video-from-codebase/tools/flow-plan.mjs +129 -0
  37. package/skills/explainer-video-from-codebase/tools/flows-md.mjs +87 -0
  38. package/skills/explainer-video-from-codebase/tools/lang/c.mjs +684 -0
  39. package/skills/explainer-video-from-codebase/tools/lang/go.mjs +673 -0
  40. package/skills/explainer-video-from-codebase/tools/lang/python-config.mjs +143 -0
  41. package/skills/explainer-video-from-codebase/tools/lang/python-deps.mjs +62 -0
  42. package/skills/explainer-video-from-codebase/tools/lang/python-stdlib.mjs +24 -0
  43. package/skills/explainer-video-from-codebase/tools/lang/python.mjs +609 -0
  44. package/skills/explainer-video-from-codebase/tools/lang/typescript.mjs +963 -0
  45. package/skills/explainer-video-from-codebase/tools/lib/decompose.mjs +102 -0
  46. package/skills/explainer-video-from-codebase/tools/lib/groups.mjs +77 -0
  47. package/skills/explainer-video-from-codebase/tools/lib/observe-coverage.mjs +68 -0
  48. package/skills/explainer-video-from-codebase/tools/lib/observe-v8.mjs +232 -0
  49. package/skills/explainer-video-from-codebase/tools/lib/observe.mjs +162 -0
  50. package/skills/explainer-video-from-codebase/tools/lib/redact.mjs +28 -0
  51. package/skills/explainer-video-from-codebase/tools/lib/sandbox.mjs +97 -0
  52. package/skills/explainer-video-from-codebase/tools/lib/test-links.mjs +28 -0
  53. package/skills/explainer-video-from-codebase/tools/lib/toml.mjs +129 -0
  54. package/skills/explainer-video-from-codebase/tools/lib/trace-c.mjs +95 -0
  55. package/skills/explainer-video-from-codebase/tools/lib/trace-go.mjs +101 -0
  56. package/skills/explainer-video-from-codebase/tools/lib/trace-js.mjs +136 -0
  57. package/skills/explainer-video-from-codebase/tools/lib/tree-sitter.mjs +19 -0
  58. package/skills/explainer-video-from-codebase/tools/lib/walk.mjs +138 -0
  59. package/skills/explainer-video-from-codebase/tools/mine.mjs +409 -0
  60. package/skills/explainer-video-from-codebase/tools/propose.mjs +127 -0
  61. package/skills/explainer-video-from-codebase/tools/rank.mjs +119 -0
  62. package/skills/explainer-video-from-codebase/tools/ranking-md.mjs +76 -0
  63. package/skills/explainer-video-from-codebase/tools/rules/c-handlers.mjs +53 -0
  64. package/skills/explainer-video-from-codebase/tools/rules/celery-taskiq.mjs +48 -0
  65. package/skills/explainer-video-from-codebase/tools/rules/click-typer.mjs +6 -0
  66. package/skills/explainer-video-from-codebase/tools/rules/express.mjs +72 -0
  67. package/skills/explainer-video-from-codebase/tools/rules/fastapi.mjs +99 -0
  68. package/skills/explainer-video-from-codebase/tools/rules/go-http.mjs +173 -0
  69. package/skills/explainer-video-from-codebase/tools/rules/go-test.mjs +108 -0
  70. package/skills/explainer-video-from-codebase/tools/rules/grpc.mjs +57 -0
  71. package/skills/explainer-video-from-codebase/tools/rules/gtest.mjs +97 -0
  72. package/skills/explainer-video-from-codebase/tools/rules/haystack.mjs +55 -0
  73. package/skills/explainer-video-from-codebase/tools/rules/jest-vitest.mjs +100 -0
  74. package/skills/explainer-video-from-codebase/tools/rules/js-http-client.mjs +111 -0
  75. package/skills/explainer-video-from-codebase/tools/rules/nextjs.mjs +53 -0
  76. package/skills/explainer-video-from-codebase/tools/rules/process-spawn.mjs +49 -0
  77. package/skills/explainer-video-from-codebase/tools/rules/py-http-client.mjs +26 -0
  78. package/skills/explainer-video-from-codebase/tools/rules/pytest.mjs +107 -0
  79. package/skills/explainer-video-from-codebase/tools/rules/react-router.mjs +17 -0
  80. package/skills/explainer-video-from-codebase/tools/rules/registry.mjs +31 -0
  81. package/skills/explainer-video-from-codebase/tools/trace/c/fmtrace-sh +14 -0
  82. package/skills/explainer-video-from-codebase/tools/trace/js/fmtrace-net.cjs +33 -0
  83. package/skills/explainer-video-from-codebase/tools/trace/js/fmtrace-srcmap.cjs +41 -0
  84. package/skills/explainer-video-from-codebase/tools/trace/python/fmtrace_plugin.py +87 -0
  85. package/skills/explainer-video-from-codebase/tools/trace/python/sitecustomize.py +330 -0
  86. package/skills/explainer-video-from-codebase/tools/trace/sandbox/linux-bwrap.sh +73 -0
  87. package/skills/explainer-video-from-codebase/tools/trace/sandbox/macos-nonet.sb +41 -0
  88. package/skills/explainer-video-from-codebase/tools/trace.mjs +577 -0
  89. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/tree-sitter-c.txt +21 -0
  90. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/tree-sitter-cpp.txt +21 -0
  91. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/tree-sitter-go.txt +21 -0
  92. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/tree-sitter-javascript.txt +21 -0
  93. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/tree-sitter-python.txt +21 -0
  94. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/tree-sitter-typescript.txt +21 -0
  95. package/skills/explainer-video-from-codebase/vendor/tree-sitter/LICENSES/web-tree-sitter.txt +21 -0
  96. package/skills/explainer-video-from-codebase/vendor/tree-sitter/MANIFEST.json +172 -0
  97. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-c.wasm +0 -0
  98. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-cpp.wasm +0 -0
  99. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-go.wasm +0 -0
  100. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-javascript.wasm +0 -0
  101. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-python.wasm +0 -0
  102. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-tsx.wasm +0 -0
  103. package/skills/explainer-video-from-codebase/vendor/tree-sitter/tree-sitter-typescript.wasm +0 -0
  104. package/skills/explainer-video-from-codebase/vendor/tree-sitter/web-tree-sitter.js +4081 -0
  105. package/skills/explainer-video-from-codebase/vendor/tree-sitter/web-tree-sitter.wasm +0 -0
  106. package/skills/explainer-video-from-coursework/ARCHITECTURE.md +59 -0
  107. package/skills/explainer-video-from-coursework/PIPELINE.md +343 -0
  108. package/skills/explainer-video-from-coursework/ROADMAP.md +725 -0
  109. package/skills/explainer-video-from-coursework/SERIES.md +232 -0
  110. package/skills/explainer-video-from-coursework/SETUP.md +105 -0
  111. package/skills/explainer-video-from-coursework/SKILL.md +858 -0
  112. package/skills/explainer-video-from-coursework/scenes/_pt-chart.js +12 -0
  113. package/skills/explainer-video-from-coursework/scenes/_pt-equation.js +10 -0
  114. package/skills/explainer-video-from-coursework/scenes/_pt-hubspoke.js +7 -0
  115. package/skills/explainer-video-from-coursework/scenes/_pt-loopflow.js +7 -0
  116. package/skills/explainer-video-from-coursework/scenes/_pt-sequence.js +12 -0
  117. package/skills/explainer-video-from-coursework/scenes/_pt-timeline.js +11 -0
  118. package/skills/explainer-video-from-coursework/src/scene-code.html +127 -0
  119. package/skills/explainer-video-from-coursework/src/scene-code.js +379 -0
  120. package/skills/explainer-video-from-coursework/src/scene-core.js +1250 -0
  121. package/skills/explainer-video-from-coursework/src/scene-diagram.html +50 -0
  122. package/skills/explainer-video-from-coursework/src/scene-svg.html +50 -0
  123. package/skills/explainer-video-from-coursework/src/timeline.js +297 -0
  124. package/skills/explainer-video-from-coursework/src/timing-chart.js +160 -0
  125. package/skills/explainer-video-from-coursework/tools/align.mjs +419 -0
  126. package/skills/explainer-video-from-coursework/tools/apply-enrichment.mjs +206 -0
  127. package/skills/explainer-video-from-coursework/tools/assemble.mjs +223 -0
  128. package/skills/explainer-video-from-coursework/tools/build-audio.mjs +234 -0
  129. package/skills/explainer-video-from-coursework/tools/chromium.mjs +73 -0
  130. package/skills/explainer-video-from-coursework/tools/debug-page.mjs +75 -0
  131. package/skills/explainer-video-from-coursework/tools/env.mjs +30 -0
  132. package/skills/explainer-video-from-coursework/tools/frame-dedup.mjs +131 -0
  133. package/skills/explainer-video-from-coursework/tools/key-source.mjs +151 -0
  134. package/skills/explainer-video-from-coursework/tools/model.mjs +21 -0
  135. package/skills/explainer-video-from-coursework/tools/naming.mjs +38 -0
  136. package/skills/explainer-video-from-coursework/tools/onset-audit.mjs +51 -0
  137. package/skills/explainer-video-from-coursework/tools/pacing-check.mjs +350 -0
  138. package/skills/explainer-video-from-coursework/tools/planner.mjs +616 -0
  139. package/skills/explainer-video-from-coursework/tools/publish.mjs +230 -0
  140. package/skills/explainer-video-from-coursework/tools/render.mjs +205 -0
  141. package/skills/explainer-video-from-coursework/tools/resolve-beats.mjs +239 -0
  142. package/skills/explainer-video-from-coursework/tools/script-check.mjs +174 -0
  143. package/skills/explainer-video-from-coursework/tools/stamp.mjs +71 -0
  144. package/skills/explainer-video-from-coursework/tools/timing-report.mjs +299 -0
  145. package/skills/explainer-video-from-coursework/tools/transcribe-gemini.mjs +96 -0
  146. package/skills/explainer-video-from-coursework/tools/tts-gemini.mjs +394 -0
  147. package/skills/explainer-video-from-coursework/tools/verify-audio.mjs +88 -0
  148. package/skills/explainer-video-from-coursework/tools/workdir.mjs +124 -0
  149. package/skills/explainer-video-from-coursework/vendor/plotly-basic.min.js +8 -0
  150. package/skills/explainer-video-from-coursework/vendor/plotly-basic.min.js.LICENSE.txt +16 -0
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: craft-codeflow-flows
3
+ description: Propose a code-flow video series with a reason per flow (flows.json) from a ranked code map, validate it until every high-ranked row, entry, segment, hop and cited test is accounted for, then show the user the approval table and record their explicit yes. Stages 1b and 1b′ of explainer-video-from-codebase, and the only place the series is decided.
4
+ ---
5
+
6
+ # craft-codeflow-flows — the series proposal, then the user's approval
7
+
8
+ > Part of the `explainer-video-from-codebase` pipeline: **stages 1b and 1b′**. This is the judgment stage and
9
+ > the **only** place the series is decided. It is also the only place the mined outputs are overridden: by
10
+ > declaring a link, promoting a dev row, or excluding an entry with a reason. Self-contained: it works on an
11
+ > existing mine. For a full run, use the main skill instead.
12
+ >
13
+ > The tools live in the sibling `explainer-video-from-codebase` skill. Run them as
14
+ > `node ../explainer-video-from-codebase/tools/<tool>.mjs`, resolved against this skill's folder, from the
15
+ > **scratch root**, outside the repo.
16
+
17
+ **Prerequisites:**
18
+
19
+ - `out/<name>/codemap.json`, `candidates.json` and `ranking.json` / `ranking.md`, from `craft-codeflow-mine`;
20
+ - the repo itself, to read the code;
21
+ - `out/<name>/trace.json`, when the user opted into the trace.
22
+
23
+ ## Stage 1b — the series proposal
24
+
25
+ <!-- sync:flows-rules -->
26
+ You propose the series in `out/<name>/flows.json` (fields in [`FLOWS.md`](../explainer-video-from-codebase/FLOWS.md)), from every row of
27
+ `ranking.md`, the candidates you consider, the code, and `trace.json` when stage 1t ran. Each video has to teach
28
+ something, so choose flows that tell distinct stories. The ranking is evidence, not a series. Follow these rules.
29
+
30
+ **Account for every row.**
31
+
32
+ - Every series flow and core gets a one-line `why`. So does every **high-ranked** row you do not include: include
33
+ it, list it as a variant, or skip it with a reason.
34
+ - High-ranked means the top 10 production rows, the top 5 eval rows, and every row at or above the
35
+ lowest-ranked row you include. The floor is the ranking's `--explain-top` / `--explain-top-eval` when those
36
+ are larger; a smaller value never lowers it.
37
+ - A glob never explains a high-ranked row.
38
+ - Every other entry is triaged: a flow, a continuation of one, a variant, skipped, or excluded with a reason
39
+ (globs allowed). Eval rows are never implicit. Dev rows stay filtered unless promoted with a reason.
40
+ - Every segment of a kept candidate is kept, mentioned with a `say`, or excluded with a `why`.
41
+
42
+ **Hops.**
43
+
44
+ - Hops are a subset of the candidate's code, in teaching order, each connected to the hops before it.
45
+ - A config alternative that no profile selects is taught (`teach`, naming its selector), not narrated, unless an
46
+ `outOfRepo` claim's `selects` names it.
47
+ - Declare a link only where no rule fires, with `file:line` evidence.
48
+ - Shared code with no entry of its own (auth, retries, a fee rule) is a `core`, which a hop hands over to with
49
+ `uses`.
50
+ - `break` on a hop starts a new video.
51
+
52
+ **Tests.**
53
+
54
+ - Cite a test on a hop only where the test has a direct link to it and does not mock it. Narration may call a hop
55
+ "tested" or "pinned" only for such a citation.
56
+ - A test that only reaches the hop is cited with `"strength": "reachable"` and is never called tested.
57
+ - Check `codemap.md`'s mocks first: a target every test in scope runs mocked is never tested.
58
+
59
+ **Eval flows.** An eval flow names the production flow it drives with `exercises` instead of re-narrating it.
60
+
61
+ Reasons (`why`, `say`, `claim`) are at least three words and never a placeholder (`tbd`, `todo`, `…`).
62
+ <!-- /sync:flows-rules -->
63
+
64
+ <!-- sync:flows-validate -->
65
+ ```sh
66
+ node ../explainer-video-from-codebase/tools/apply-flows.mjs --candidates out/<name>/candidates.json --flows out/<name>/flows.json
67
+ ```
68
+
69
+ It reads `codemap.json` and `ranking.json` beside the candidates, and the trace when one is there.
70
+
71
+ - **Exit 0** writes `flows.validated.json` and `flows.md`.
72
+ - **Exit 2** lists every problem in `flows.md` and on stderr, and removes a stale `flows.validated.json`. The
73
+ checks are reasons, C1′ high-ranked rows, C1 entry triage, C2 segment triage, C3 hop fidelity, dispatch,
74
+ C3′ test fidelity, groups and shape. Fix `flows.json` and rerun until it exits 0.
75
+ - **Exit 1** is a bad flag, unreadable or mismatched inputs, or an output inside the repo.
76
+
77
+ Never edit `flows.validated.json` or `flows.md`.
78
+
79
+ **Done when:** `apply-flows` exits 0 with `0 problems`: reasons on every series item and every high-ranked skip,
80
+ every entry triaged, every hop connected, and every cited test pinning its hop.
81
+ <!-- /sync:flows-validate -->
82
+
83
+ ## Stage 1b′ — approve the flow list
84
+
85
+ <!-- sync:approve -->
86
+ Show the user the **approval table** at the top of `flows.md` in full:
87
+
88
+ - the series in video order, with each reason;
89
+ - the skipped rows with theirs;
90
+ - the variants, the promoted rows and the dev rows;
91
+ - the estimated videos and minutes.
92
+
93
+ Ask them to approve it or to edit it (add, drop, reorder, promote); never assume approval. **Never write
94
+ `flows.approved.json` without the user's explicit yes to the table as shown.** Silence, "looks interesting" or an
95
+ approval of an earlier table is not a yes. **Only on that yes:**
96
+
97
+ ```sh
98
+ node ../explainer-video-from-codebase/tools/approve-flows.mjs --flows out/<name>/flows.validated.json --by user --note "<the user's words>"
99
+ ```
100
+
101
+ It writes `flows.approved.json`, bound to the validated list's sha256. Exit 2 means the validated list is
102
+ missing, did not pass, or `flows.json` changed since it was validated: rerun `apply-flows`.
103
+
104
+ On any edit, change `flows.json`, rerun `apply-flows`, show the new table, and ask again. The old approval no
105
+ longer matches, and stage 1c refuses until there is a new one.
106
+
107
+ **Done when:** the user said yes to the table as shown and `approve-flows` exited 0.
108
+ <!-- /sync:approve -->
109
+
110
+ **Next:** `craft-codeflow-plan` plans the approved list.
111
+
112
+ ## Maintenance
113
+
114
+ > If you modify this file, or the user asks to change these stages, tell the user that the main
115
+ > `explainer-video-from-codebase` skill's **"Stage 1b — /flows"** and **"Stage 1b′ — approve the flow list"**
116
+ > sections must be reconciled to match, and name those sections in your reply.
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: craft-codeflow-mine
3
+ description: Mine a codebase (Python, TypeScript / TSX, JavaScript, Go, C, C++, or a mix such as a Python backend with a TypeScript frontend) into one grouped code map, propose one candidate flow per entry point and rank them per group as evidence; and, only on the user's explicit yes, trace the repo's own test suite once inside an OS sandbox. Stages 1 and 1t of explainer-video-from-codebase; run it alone to mine or re-mine a repo.
4
+ ---
5
+
6
+ # craft-codeflow-mine — mine, propose, rank; the opt-in trace
7
+
8
+ > Part of the `explainer-video-from-codebase` pipeline: **stages 1 and 1t**, the first of its once-per-series
9
+ > stages. This skill is self-contained: it mines a repo from scratch. For a full run, use the main skill instead.
10
+ >
11
+ > The tools live in the sibling `explainer-video-from-codebase` skill. Run them as
12
+ > `node ../explainer-video-from-codebase/tools/<tool>.mjs`, resolved against this skill's folder. Run them from
13
+ > the **scratch root**, the directory that holds `out/`. It is always **outside the repo**: every tool here
14
+ > refuses to write inside it.
15
+
16
+ **Prerequisites:**
17
+
18
+ - Node ≥ 22, and nothing else for stage 1. The tree-sitter runtime and grammars are vendored, so there is no
19
+ `npm install`, no network and no key.
20
+ - A repo root and a scratch root outside it.
21
+ - Stage 1t also uses the repo's own toolchain and the OS sandbox, and never installs anything.
22
+
23
+ **What you own here.** Grouping, test links, candidate proposal, ranking, framework rules, config resolution and
24
+ tracing are code, and this skill is their single owner. Run the tools and never edit their outputs. The only
25
+ place their outputs are overridden, and the only place the series is chosen, is `craft-codeflow-flows`.
26
+
27
+ **Secrets.**
28
+
29
+ - `mine` reads config only from git-tracked files and keeps a value only for a key a dispatch guard reads. It
30
+ writes a secret-looking key or a credential-shaped value as `set (redacted)`. Never look one up or guess it.
31
+ - The trace runs with an empty environment and redacts credential-shaped strings from its log, the output tail
32
+ it prints and its failure messages.
33
+
34
+ ## Stage 1 — mine, propose, rank
35
+
36
+ <!-- sync:mine -->
37
+ ```sh
38
+ node ../explainer-video-from-codebase/tools/mine.mjs <repo> --out out/<name> [--group 'glob=prod|test|eval|dev' ...] \
39
+ [--exclude path,...] [--lang python,typescript,go,c,cpp] [--config-root <dir>]
40
+ ```
41
+
42
+ It writes `out/<name>/codemap.json` and `out/<name>/codemap.md`. It never writes inside the repo, never uses the
43
+ network and never runs repo code.
44
+
45
+ | Exit | Meaning |
46
+ |---|---|
47
+ | 0 | done |
48
+ | 1 | a bad path or flag, `--out` inside the repo, or a repo with no supported files |
49
+ | 2 | a failed self-check: a definition the parser saw was not extracted, or two collapsed into one symbol |
50
+
51
+ On exit 2, report the failure and do not edit the output.
52
+
53
+ **What it mines.** Python, TypeScript / TSX, JavaScript, Go, C and C++ are mined into one code map;
54
+ `--lang typescript` covers JavaScript too. Across languages:
55
+
56
+ - a frontend's or a client's HTTP calls link to the routes they hit in any language (FastAPI, Express, Next.js,
57
+ net/http, gin, echo, chi);
58
+ - UI routes, gRPC methods and C / C++ command tables are entries;
59
+ - each language's tests (pytest, unittest, jest / vitest, node:test, go test, gtest, Catch2, C test functions)
60
+ are evidence.
61
+
62
+ **Groups.** Every file is in exactly one group, `prod`, `test`, `eval` or `dev`, by ordered path rules, then by
63
+ content. A `--group` override wins over all of them. An entry that lands in the test group is not a flow;
64
+ `codemap.md` prints the override that moves it.
65
+
66
+ **Show the user `codemap.md` in full:**
67
+
68
+ - every group, with the rule that placed each file;
69
+ - every entry;
70
+ - every rule link with its evidence, and the frameworks imported without a rule pack (their wiring is not
71
+ linked);
72
+ - the test inventory with the mocks every test runs under (session-wide and autouse ones included);
73
+ - the config profiles with their group, and the config-selected dispatch;
74
+ - the self-check.
75
+
76
+ If the self-check reports calls into imports named like in-repo directories, ambiguous imports, or dependency
77
+ files it could not parse, say so: those calls are not linked.
78
+ <!-- /sync:mine -->
79
+
80
+ <!-- sync:propose-rank -->
81
+ ```sh
82
+ node ../explainer-video-from-codebase/tools/propose.mjs --codemap out/<name>/codemap.json [--fanin 6] [--leafy 5] [--no-iface-fold]
83
+ node ../explainer-video-from-codebase/tools/rank.mjs --candidates out/<name>/candidates.json [--explain-top 10] [--explain-top-eval 5]
84
+ ```
85
+
86
+ `propose` writes `out/<name>/candidates.json`: one candidate flow per prod, eval and dev entry, and how far each
87
+ test's direct links reach. A non-test walk never enters test code. An eval or dev walk folds production code
88
+ into `uses-prod` leaves and records the production flows it `exercises`. Exit 2 means an entry could not be
89
+ walked; report it.
90
+
91
+ `rank` writes `ranking.json` and `ranking.md`, each group ranked on its own by the new code each row covers.
92
+ **Show the user `ranking.md` in full**:
93
+
94
+ - every row of every group, with what each eval row exercises;
95
+ - the dev rows, filtered by default;
96
+ - the shared heavily-tested table, the continuations and the merged order;
97
+ - the explained top rows.
98
+
99
+ There is no cut line. Do not present the top rows as the series, and do not drop a row because its gain is small.
100
+ Choosing the series is stage 1b.
101
+
102
+ **Done when:** `mine`, `propose` and `rank` all exit 0, the self-check is clean, and `codemap.md` and
103
+ `ranking.md` have been shown in full: every group, nothing sampled.
104
+ <!-- /sync:propose-rank -->
105
+
106
+ ## Stage 1t — the test suite, observed (opt-in)
107
+
108
+ <!-- sync:trace-offer -->
109
+ Tracing runs the repo's own test code on this machine, so it is **never** run without the user's explicit yes.
110
+ Nothing but the test suite is ever traced: not a server, a sample request or an eval harness. Offer it at most
111
+ once per mined commit, and only when both of these hold.
112
+
113
+ **The repo has a test command you can name**, plus the arguments its own config or docs use:
114
+
115
+ - **Python:** `pytest`, `python -m pytest` or `python -m unittest`, run with the repo's own interpreter (its
116
+ `.venv/bin/python` when it has one).
117
+ - **JavaScript / TypeScript:** `node --test`, `npx jest` or `npx vitest run`.
118
+ - The runner must already be installed in the repo's `node_modules`, at its root or in the one package below
119
+ it that holds the tests, such as `frontend/`. Paths are then given as you would from that package.
120
+ - A jest or vitest flag's value is written as `-t=name` or `-t name`. Any other flag is boolean, so a path
121
+ after it stays a path.
122
+ - **Go:** `go test ./...`, or `go -C <module dir> test ./...` when the repo holds several Go modules, with the
123
+ `go` on PATH.
124
+ - **C / C++:** `make test` or `make check` (or `make -C <dir> test`), when the repo's Makefile builds and runs its
125
+ tests with `$(CC)` / `$(CXX)`, and `cc`, `make` and `gcov` are installed.
126
+
127
+ **This platform has a sandbox**: macOS (`sandbox-exec`), or Linux with `bwrap` (bubblewrap). Elsewhere, do not
128
+ offer it.
129
+ <!-- /sync:trace-offer -->
130
+
131
+ Ask with exactly this text, filling in the command and the test count from `codemap.md`:
132
+
133
+ <!-- sync:trace-prompt -->
134
+ > This repo has a test suite (`<command>`, N tests). I can run it once, under a profiler, to mark which call paths
135
+ > the tests actually exercise. It runs the repo's test code on this machine, inside a sandbox, on a copy of the files
136
+ > git does not ignore: no network, no writes outside a scratch folder, no inherited environment variables, no
137
+ > handing work to a program outside the sandbox (opening a URL or an app, scripting another app), and no reads of your home folder or the original repo folder (only the copy, the Python interpreter and its virtualenv, node and the repo's node_modules, or, for Go, exactly the two folders `go env` names as GOROOT and GOMODCACHE, read-only, even inside your home folder; never anything else of it). It
138
+ > can still read system files outside those folders. Anything it prints that looks like a credential is redacted from
139
+ > its log. Run it?
140
+ <!-- /sync:trace-prompt -->
141
+
142
+ <!-- sync:trace-run -->
143
+ A "no" skips the stage with no penalty: stage 1b works from the static code map alone. **Only on a yes** to that
144
+ exact command:
145
+
146
+ ```sh
147
+ node ../explainer-video-from-codebase/tools/trace.mjs --codemap out/<name>/codemap.json --test-command "<command>" --i-ran-this-by-the-user \
148
+ [--timeout 900]
149
+ ```
150
+
151
+ `--i-ran-this-by-the-user` means the user said yes. Never pass it otherwise; a different command needs a new yes.
152
+
153
+ The run is held to this boundary:
154
+
155
+ - it runs in a scratch copy of the repo's git-tracked and unignored files, inside this platform's sandbox;
156
+ - it has no network of any kind, localhost and unix sockets included;
157
+ - it writes nothing outside scratch;
158
+ - no program outside the sandbox acts for it;
159
+ - it reads neither the home folder nor the original repo;
160
+ - it starts with an empty environment;
161
+ - it writes no bytecode or cache;
162
+ - it stops at a time limit.
163
+
164
+ There is no option to weaken or skip the sandbox, and no sandbox means no run.
165
+
166
+ It writes `out/<name>/trace.json` and `trace.log`, the run's output with credential-shaped strings redacted.
167
+ `trace.json` is an overlay recording the opt-in (who, when, the exact command). The code map is never edited for
168
+ it, and no static edge is ever removed or demoted.
169
+
170
+ | Exit | Meaning |
171
+ |---|---|
172
+ | 0 | done |
173
+ | 1 | refused: no opt-in flag, bad flags or inputs, a jest / vitest the repo has not installed, two JS packages holding tests, several Go modules and no `-C`, a GOROOT or GOMODCACHE that is or holds the home folder, no Makefile, no gcov |
174
+ | 2 | no test ran: show the user `trace.log`'s end |
175
+ | 3 | refused: not a recognised test command (shell syntax and wrappers such as `uv run` or `env` included) |
176
+ | 4 | refused: no sandbox on this platform, or it does not start here |
177
+ | 5 | the time limit: the partial trace is kept and marked `timedOut` |
178
+
179
+ Report a refusal and never work around it, least of all by running the tests yourself.
180
+
181
+ Tell the user:
182
+
183
+ - the outcome (passed / failed / errors) and the static edges observed;
184
+ - the share of direct test links that ran under their own test. jest / vitest, go test and make record coverage,
185
+ so they say what ran in each test file, test or test binary (the trace's `granularity`) and record no
186
+ caller → callee pair;
187
+ - the callback links the trace confirmed, and the calls that ran with no static edge;
188
+ - **every test in `deniedBySandbox`**. Those tests need a service or a file the sandbox refused (a database, a
189
+ socket, the network, a file in the home folder or one git ignores), so they mark code the suite cannot
190
+ exercise offline.
191
+
192
+ Failing tests are data: never retry one, never weaken the sandbox, never install anything to make them pass. A
193
+ trace says what ran under the test configuration. Narrate it as "observed in the test suite", never as observed
194
+ in production.
195
+
196
+ **Done when:** the user declined, or the run ended (exit 0 or 5) and its report has been relayed, or a refusal
197
+ has been reported.
198
+ <!-- /sync:trace-run -->
199
+
200
+ **Next:** `craft-codeflow-flows` proposes the series from `ranking.md`, the candidates and, when it was made,
201
+ `trace.json`.
202
+
203
+ ## Maintenance
204
+
205
+ > If you modify this file, or the user asks to change these stages, tell the user that the main
206
+ > `explainer-video-from-codebase` skill's **"Stage 1 — /mine"** and **"Stage 1t — /trace"** sections must be
207
+ > reconciled to match, and name those sections in your reply.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: craft-codeflow-plan
3
+ description: Turn an approved, validated code-flow list into an explainer-video plan in the coursework plan's shape (an overview, then each flow and core, split under a 25-minute cap), refusing an unapproved or stale list. Stage 1c of explainer-video-from-codebase; run it alone to re-plan an approved list.
4
+ ---
5
+
6
+ # craft-codeflow-plan — plan the videos under the cap
7
+
8
+ > Part of the `explainer-video-from-codebase` pipeline: **stage 1c**, the last stage that is specific to code.
9
+ > Self-contained: it plans an approved list. For a full run, use the main skill instead.
10
+ >
11
+ > The tools live in the sibling `explainer-video-from-codebase` skill. Run them as
12
+ > `node ../explainer-video-from-codebase/tools/<tool>.mjs`, resolved against this skill's folder, from the
13
+ > **scratch root**, outside the repo.
14
+
15
+ **Prerequisites:** these files, from `craft-codeflow-flows`, both in the same folder:
16
+
17
+ - `out/<name>/flows.validated.json`;
18
+ - `out/<name>/flows.approved.json`, written only after the user said yes.
19
+
20
+ <!-- sync:plan -->
21
+ ```sh
22
+ node ../explainer-video-from-codebase/tools/flow-plan.mjs --flows out/<name>/flows.validated.json [--max-min 25] [--estimate] [--force]
23
+ ```
24
+
25
+ It writes `plan.json` and `plan.md` beside the validated flows: an overview video first, then each series flow
26
+ and core in order. A `break` hop starts a new video. Hops pack under the cap (25 minutes by default), and an item
27
+ that overflows splits at its latest crossing, else at the overflowing hop. A hop is never split, and two items
28
+ are never glued.
29
+
30
+ | Exit | Meaning |
31
+ |---|---|
32
+ | 0 | done |
33
+ | 1 | a bad flag or unreadable input |
34
+ | 2 | an orphaned hop or a video over the cap (C4: every kept hop lands in exactly one video) |
35
+ | 4 | the run would overwrite the plan an enriched plan was built from: rerun with `--force`, then rerun stage 2 |
36
+ | 5 | no matching approval (none, or the list changed after it): go back to stage 1b′, never work around it |
37
+
38
+ No plan, and so no script, exists before the user approves the list. `--estimate` prints the plan without an
39
+ approval and writes nothing; it is the estimate in the approval table, not a plan.
40
+
41
+ **`--max-min` is part of the plan.** Video indices are keyed by the split, so a different cap gives different
42
+ videos and invalidates any enrichment written for the old ones. Keep 25 unless the user asks otherwise.
43
+
44
+ The plan has the coursework plan's shape, so the coursework stages read it unchanged:
45
+
46
+ - `forms` is `overview`, `flow` and `core`;
47
+ - each video's `group` is its flow or core id, which `timing-report` groups by;
48
+ - `sections` are `"<file> :: <symbol> @L<start>"`, what a script's `covers` names;
49
+ - `sectionSpans` carry each hop's span, narrated lines and cited tests.
50
+
51
+ **Done when:** `flow-plan` exits 0, and every planned video has been shown to the user with the plan's
52
+ calibration banner, which says what the cost model is calibrated on and what is still uncalibrated. Show the index,
53
+ title, form and minutes of every video, with no sample and no "…and N more". The minutes are a planning
54
+ estimate, not measured audio.
55
+ <!-- /sync:plan -->
56
+
57
+ **Next:** run the coursework stages on `out/<name>/plan.json`, starting with `craft-video-enrich`. Its `form`
58
+ is one of the plan's `forms`: `overview`, `flow` or `core`. After the user chooses the scope, run
59
+ `craft-video-script`; its **Code-flow videos only** block holds the code-video script rules.
60
+
61
+ ## Maintenance
62
+
63
+ > If you modify this file, or the user asks to change this stage, tell the user that the main
64
+ > `explainer-video-from-codebase` skill's **"Stage 1c — /plan"** section must be reconciled to match, and name
65
+ > that section in your reply.
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: craft-codeflow-scene
3
+ description: Author one code video's visuals — code panels cut from the repo as mined (never typed), test panels for cited tests, one narration-synced focus window per sentence, pause badges only on pause segments, and flow diagrams generated from the validated flows — then verify every panel against the repo with excerpt-check. Stage 5 of explainer-video-from-codebase; craft-video-scene's contract plus the code rules.
4
+ ---
5
+
6
+ # craft-codeflow-scene — verified code and generated diagrams
7
+
8
+ > Part of the `explainer-video-from-codebase` pipeline: **stage 5, for code videos**. It is
9
+ > `craft-video-scene`'s full contract (beats anchored to narration lines, the over-ask ladder, the visual
10
+ > check) plus the rules that put a repo's code on screen. Self-contained for one video's scenes. For a full run,
11
+ > use the main skill instead.
12
+ >
13
+ > The code tools live in the sibling `explainer-video-from-codebase` skill and the scene tools and hosts in
14
+ > `explainer-video-from-coursework`. Run them as `node ../explainer-video-from-codebase/tools/<tool>.mjs` and
15
+ > `node ../explainer-video-from-coursework/tools/<tool>.mjs`, resolved against this skill's folder, from the
16
+ > **scratch root** that holds `out/`.
17
+
18
+ > **Timing.** Bracket the stage with the stamp pair; `end` must run before the stage counts as done:
19
+ >
20
+ > ```bash
21
+ > node ../explainer-video-from-coursework/tools/stamp.mjs begin --out out/<name> --video <NN> --stage 5
22
+ > node ../explainer-video-from-coursework/tools/stamp.mjs end --out out/<name> --video <NN> --stage 5
23
+ > ```
24
+
25
+ **Also needed:** the headless Chromium, for the stills. A `Playwright cache not found` failure means Chromium is
26
+ absent. Relay the step from `../explainer-video-from-coursework/SETUP.md` to the user, then re-run.
27
+
28
+ **The script this stage assumes.** The scenes show only what the narration reads, so the video's script must
29
+ already follow the code-video rules. `script-check` enforces the pause rule; you enforce the rest:
30
+
31
+ <!-- sync:stage3-addendum -->
32
+ **Code-flow videos only.** A code-flow video's plan, `plan.json` or `plan.enriched.json`, carries
33
+ `"kind": "codebase"`, and its `forms` are `overview`, `flow` and `core`. A coursework plan has no `kind`; nothing
34
+ in this block applies to its videos.
35
+
36
+ A code video's narration is the reading time: a panel shows only the lines being narrated, each highlighted while
37
+ its sentence plays. The script for a code video adds these rules:
38
+
39
+ - **Open** on the concrete request, UI action or command that starts the flow.
40
+ - **One hop per segment.** Name identifiers in words; spoken text holds no code, no URLs and no markdown.
41
+ - **Narrate every line a panel will show**: the hop's narrated lines (`sectionSpans[].lines` in the plan, or the
42
+ lines you choose when that is `null`, at most 22), plus a cited test's def, call and assertion lines.
43
+ - **Branches.** Teach each `teach` branch in its own segment, naming its selector: the setting, flag or profile
44
+ that picks it.
45
+ - **Tests.** Describe a cited test by what it asserts. Call a hop "tested" or "pinned" only for a direct, unmocked
46
+ link, never for a `"strength": "reachable"` citation. For a traced run say "observed in the test suite", never
47
+ "in production".
48
+ - **Evals.** An eval hop that drives a production flow names that flow's video instead of re-narrating it.
49
+ - **Pause prompts** are rare and bounded, only for a block that must be read whole.
50
+ - The segment's text says "pause" out loud.
51
+ - It carries `"pause": {"dwell": <s>}`, with 0 < dwell ≤ 2 and `pad` equal to the dwell.
52
+ - A video has at most 3. `script-check` errors on a fourth, so split the video instead.
53
+ - **Secrets.** Never say a secret or a redacted value.
54
+ <!-- /sync:stage3-addendum -->
55
+
56
+ ## The scenes
57
+
58
+ <!-- sync:code-scene -->
59
+ `craft-video-scene`'s whole contract holds:
60
+
61
+ - beats anchor to narration lines, never to seconds;
62
+ - `resolve-beats` passes before `pacing-check`;
63
+ - a shortfall means the scene over-asked: widen the beat's `lines` first, redesign it second, `pad` last;
64
+ - the stills are looked at.
65
+
66
+ Code videos add what follows. **Prerequisites:** `out/<name>/<NN>/timeline.json` and `lines.json` (stages 4 and
67
+ 4b), the video's script, `out/<name>/codemap.json`, `flows.validated.json` and `plan.json`.
68
+
69
+ **Hosts, per segment** (`out/<name>/<NN>/manifest.json`, `key` → `{host, scene}`):
70
+
71
+ - a hop or test segment is a `code` scene (`src/scene-code.html`);
72
+ - the overview's system map, a flow's sequence and an eval's hand-off are `diagram` or `svg` scenes.
73
+
74
+ Each scene lives at `out/<name>/<NN>/scenes/<key>.js` and sets `window.SCENE_CONFIG`. Like any scene, it also
75
+ declares `window.SCENE_BEATS`, one beat per narration line, which is what `resolve-beats` and `pacing-check`
76
+ read.
77
+
78
+ **Code panels.** Never type code into a scene; cut every panel from the repo as mined:
79
+
80
+ ```sh
81
+ node ../explainer-video-from-codebase/tools/excerpt.mjs --codemap out/<name>/codemap.json --symbol <id> [--lines 54-65,70]
82
+ node ../explainer-video-from-codebase/tools/excerpt.mjs --codemap out/<name>/codemap.json --symbol <id> --test <test id> [--lines 54-65,70]
83
+ ```
84
+
85
+ It prints the panel fragment (`file`, `lang`, `lines`, `numbers`, `elided`, `source`) to paste whole into the
86
+ scene's `panels`, with an `id` added.
87
+
88
+ - `--lines` picks the narrated lines: the hop's `lines` in the plan, or, when that is `null`, the lines the script
89
+ narrates. Every unshown run inside the span becomes one `⋯ N lines` marker. Without `--lines` the whole span is
90
+ shown.
91
+ - **Exit 2** covers more than 22 shown lines (narrow `--lines` or split the hop), a missing symbol or test, a line
92
+ outside the span, and a file changed since it was mined (mine again).
93
+ - `--test` cuts the test's side of a "pinned by" pair: its def line, the line that calls the hop, and its
94
+ assertion lines. It exits 2 for a test that mocks the hop or only reaches it. For a cited test, show the hop's
95
+ panel and the test's panel together.
96
+
97
+ **The panel's acts.**
98
+
99
+ - **Focus.** Give each panel one `focus` act per sentence, `{op: "focus", panel, lines, from, to, narration}`.
100
+ - `lines` are 1-based panel lines.
101
+ - `narration` is the narration line it is synced to: an index, or `[from, to]`, into the segment's lines in
102
+ `lines.json`.
103
+ - `from` is that line's onset (`start + lead`), and `to` falls between the line's end and the next line's onset.
104
+ - Every shown non-blank line is in some focus window.
105
+ - **Pause.** A pause segment gets a `{op: "pause", from, to}` act over its spoken prompt: the on-screen badge. Only
106
+ a pause segment gets one.
107
+ - **Segment.** Every code scene names its own segment, `segment: "<key>"`, equal to its manifest key. Its acts are
108
+ timed from that segment's window, and it draws no progress bar.
109
+ - **Taught branches.** A `teach` branch's segment shows each alternative as its own excerpted panel, placed side
110
+ by side with `initLayout` / `layout` acts, and the narration names the selector.
111
+
112
+ **Diagram skeletons.** The boxes and arrows come from the validated flows; the layout polish and the beats come
113
+ from you:
114
+
115
+ ```sh
116
+ node ../explainer-video-from-codebase/tools/flow-diagram.mjs --flows out/<name>/flows.validated.json --as map [--flow <id>]
117
+ node ../explainer-video-from-codebase/tools/flow-diagram.mjs --flows out/<name>/flows.validated.json --flow <id> --as sequence
118
+ node ../explainer-video-from-codebase/tools/flow-diagram.mjs --flows out/<name>/flows.validated.json --flow <id> --as exercises
119
+ ```
120
+
121
+ - `map` is a `diagram` host config: one box per module the hops run through, with the queue, HTTP and spawn
122
+ crossings for banners. It is the overview's system map.
123
+ - `sequence` is the params of the `svg` lane's `SceneCore.primitives.sequence`; clear the stage at the top of
124
+ `renderAt`.
125
+ - `exercises` draws an eval or dev flow's hand-off to each production flow it drives as one box naming that flow's
126
+ video ("see video 8"). The production flow is never re-drawn.
127
+ - Exit 1 is an unknown flow, or `exercises` on a flow with no `exercises` hop.
128
+
129
+ **Secrets.** Leave a line that holds a credential out of `--lines`, so it shows only as an elision marker.
130
+
131
+ **Check, then look.** Resolve the beats, check the pacing, verify the panels, then render stills and look at
132
+ them:
133
+
134
+ ```sh
135
+ node ../explainer-video-from-coursework/tools/resolve-beats.mjs --work out/<name>/<NN> --script out/<name>/scripts/<NN>-*.json
136
+ node ../explainer-video-from-coursework/tools/pacing-check.mjs --scene out/<name>/<NN>/scenes/<key>.js \
137
+ --timeline out/<name>/<NN>/timeline.json --segment <key>
138
+ node ../explainer-video-from-codebase/tools/excerpt-check.mjs --work out/<name>/<NN> --repo <repo> --script out/<name>/scripts/<NN>-*.json
139
+ node ../explainer-video-from-coursework/tools/render.mjs --shots <t1>,<t2>,<t3> --work out/<name>/<NN> --scene "src/scene-code.html?scene=<key>"
140
+ ```
141
+
142
+ `--shots` takes seconds of video time, and a code scene's acts are timed from its segment's window, so a still
143
+ outside that window shows nothing of the scene. Pick the shot times inside `timeline.json`'s `windows["<key>"]`: a
144
+ few seconds after its `start`, its middle, and just before its `end`.
145
+
146
+ `excerpt-check` is C6:
147
+
148
+ | Exit | Meaning |
149
+ |---|---|
150
+ | 0 | done |
151
+ | 1 | no manifest, scenes, `lines.json` or script |
152
+ | 2 | drift: a panel that is not byte-identical to the file as mined, was typed, or hides lines without a marker; re-excerpt it |
153
+ | 3 | a shown line outside every narration-synced focus window, a pause badge out of place, more than 3 pause segments, or a code scene that does not name its own segment |
154
+
155
+ The checkers catch timing and structure, never a visual fault. **Vision gate:** read the first still as an image.
156
+ If that fails, you are on a text-only model: ask the user whether to switch to a vision model or to skip the visual
157
+ check. Never "look" blind.
158
+
159
+ **Done when:** `resolve-beats`, `pacing-check` (each scene) and `excerpt-check` exit 0, and every still has been
160
+ looked at, or the user skipped the visual check.
161
+ <!-- /sync:code-scene -->
162
+
163
+ ## Maintenance
164
+
165
+ > If you modify this file, or the user asks to change this stage, tell the user that the main
166
+ > `explainer-video-from-codebase` skill's **"Stage 5 — /scene for code videos"** section must be reconciled to
167
+ > match, and so must the `explainer-video-from-coursework` skill's **"Stage 5 — /scene"** section wherever the
168
+ > shared scene contract changed. Name those sections in your reply.