@phil65/demoreel 0.3.1 → 0.5.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 (43) hide show
  1. package/README.md +47 -12
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/args.js +26 -0
  4. package/dist/cli.js +53 -3
  5. package/dist/compose.d.ts +4 -0
  6. package/dist/compose.js +4 -0
  7. package/dist/gif.d.ts +16 -0
  8. package/dist/gif.js +19 -0
  9. package/dist/index.d.ts +5 -3
  10. package/dist/index.js +4 -2
  11. package/dist/mcp.d.ts +5 -0
  12. package/dist/mcp.js +441 -0
  13. package/dist/openscreen/project.js +3 -3
  14. package/dist/project.d.ts +51 -1
  15. package/dist/project.js +89 -1
  16. package/dist/record.d.ts +6 -1
  17. package/dist/record.js +2 -1
  18. package/dist/renderer/assets/CanvasPool-PBu3bHFZ.js +1 -0
  19. package/dist/renderer/assets/CanvasRenderer-HmF-4gyW.js +1 -0
  20. package/dist/renderer/assets/RenderTargetSystem-Dk1U4wDJ.js +184 -0
  21. package/dist/renderer/assets/WebGLRenderer-C0v9HBel.js +149 -0
  22. package/dist/renderer/assets/WebGPURenderer-Ce0-U9Q1.js +95 -0
  23. package/dist/renderer/assets/{browserAll-aHn2isHo.js → browserAll-DhvWQ7nM.js} +2 -2
  24. package/dist/renderer/assets/canvasUtils-KRroregW.js +1 -0
  25. package/dist/renderer/assets/{getTexelRangeRects-yD6MQ0xy.js → getTexelRangeRects-D3pwCyRt.js} +3 -3
  26. package/dist/renderer/assets/index-CE-lli1m.js +556 -0
  27. package/dist/renderer/assets/init-DfmWKarH.js +83 -0
  28. package/dist/renderer/assets/webworkerAll-B41hok0-.js +1 -0
  29. package/dist/renderer/index.html +1 -6
  30. package/dist/scene.d.ts +24 -4
  31. package/dist/scene.js +74 -5
  32. package/dist/sheet.d.ts +6 -0
  33. package/dist/sheet.js +10 -0
  34. package/dist/types.d.ts +4 -0
  35. package/package.json +7 -1
  36. package/skills/demoreel/SKILL.md +161 -0
  37. package/dist/renderer/assets/CanvasPool-CHSHS1-v.js +0 -23
  38. package/dist/renderer/assets/RenderTargetSystem-EAUH9iQk.js +0 -404
  39. package/dist/renderer/assets/canvasUtils-n5g2f3_X.js +0 -1
  40. package/dist/renderer/assets/getTextureBatchBindGroup-Bwvgbco6.js +0 -1
  41. package/dist/renderer/assets/index-BwP6rH7I.js +0 -556
  42. package/dist/renderer/assets/init-C2Za5NQh.js +0 -83
  43. package/dist/renderer/assets/webworkerAll-JSSmbaR2.js +0 -1
package/README.md CHANGED
@@ -61,18 +61,21 @@ npx demoreel doctor # checks Chromium, ffmpeg, GPU, framesheet
61
61
 
62
62
  ```
63
63
  demoreel run <scenario.ts|js> record, write project, render MP4, contact sheet
64
- --out DIR --no-render --dry-run --state FILE --fps 30 --quality medium|good|source
64
+ --out DIR --no-render --gif --dry-run --state FILE --fps 30 --quality medium|good|source
65
65
  --[no-]gpu --trim-idle --speed 1.5 --viewport 1280x720 --headed -n 12 --framesheet auto|off
66
66
  demoreel inspect <url|scenario> ARIA snapshot (+ optional --screenshot) of a page or scenario end state
67
67
  --screenshot FILE --state FILE --viewport 1280x800 --headed
68
68
  demoreel login <url> sign in in headed Chromium and save storageState (default .demoreel/auth.json)
69
69
  --state FILE --viewport 1280x800
70
70
  demoreel render <project.openscreen> [--out FILE.mp4 --fps --quality --[no-]gpu]
71
- demoreel rezoom <outdir> re-derive zooms / idle cuts / marks from timeline.json
71
+ demoreel rezoom <outdir> re-derive zooms / idle cuts / keycaps / marks from timeline.json
72
72
  --max-depth 4 --lead 350 --hold 800 --no-auto-zoom --options JSON
73
- --trim-idle --idle-options '{"minMs":1500,"keepMs":600,"mode":"speed"}' --render
73
+ --trim-idle --idle-options '{"minMs":1500,"keepMs":600,"mode":"speed"}' --show-keys --render
74
74
  demoreel validate <project> OpenScreen's validateProjectData / normalizeProjectEditor
75
75
  demoreel sheet <video|outdir> framesheet inspect --marks marks.json, else ffmpeg tiles
76
+ demoreel frame <video|outdir> <sec> [--out FILE.png] extract one full-res PNG frame for review
77
+ demoreel gif <video|outdir> [--out FILE.gif --width 960 --fps 12] two-pass palette README GIF
78
+ demoreel mcp start the official MCP server over stdio
76
79
  demoreel init [dir] [--url URL] [--js] scaffold a scenario (+ a demo app to record)
77
80
  demoreel doctor environment check
78
81
  ```
@@ -94,15 +97,17 @@ Each run writes into `out/<name>/`:
94
97
  | --- | --- |
95
98
  | `goto(url)` | navigate (the first call starts the recording) |
96
99
  | `click(target, { zoom, label, navigates })` | eased cursor travel, aim, click; zooms by default |
100
+ | `select(target, value, { zoom, label })` | move to a `<select>` and pick an option cleanly |
101
+ | `drag(from, to \| { dx, dy }, { duration, zoom })` | 60 Hz cursor-tracked drag (3D canvases, sliders, drag-and-drop) |
97
102
  | `type(target, text, { clear, zoom })` | click into a field and type with human-ish timing |
98
103
  | `hover(target, { dwell, zoom })` | move there and rest (no zoom unless asked) |
99
104
  | `moveTo(target \| {x, y})` | move the cursor, nothing else |
100
105
  | `scroll(target \| { by: px })` | smooth scroll (the page's or the target's scroll container) |
101
- | `press(key)` | keyboard shortcut, Playwright syntax |
106
+ | `press(key, { show, duration })` | keyboard shortcut (Playwright syntax); optional keycap HUD pill |
102
107
  | `pause(ms)` | wait |
103
108
  | `caption(text, { duration, wait })` | caption overlay (an OpenScreen text annotation, sharp at any zoom) |
104
- | `zoom(target, { depth, duration, context, wait })` | explicit zoom that overrides automatic ones in its window |
105
- | `highlight(target, { duration, color, zoom })` | outline drawn into the page around an element |
109
+ | `zoom(target, { depth, duration, context, wait })` | explicit zoom (integer tier `1..6`: 1.25x..5x) overriding auto zooms |
110
+ | `highlight(target, { duration, color, dim, badge, zoom })` | outline with optional spotlight dim backdrop and callout badge |
106
111
 
107
112
  `target` is a structured accessibility-first spec (`{ role, name?, exact?, nth? }`,
108
113
  `{ label, exact?, nth? }`, `{ placeholder, exact?, nth? }`, `{ text, exact?, nth? }`,
@@ -116,11 +121,13 @@ up), `serve` (static dir served at `ctx.baseUrl`), `storageState` (Playwright st
116
121
  JSON, relative to the scenario file), `colorScheme`, `seed`, `pacing`
117
122
  (`speed`, `beforeAction`, `afterClick`, `typeDelay`, ...), `zoom` (see below), `look`
118
123
  (`wallpaper`, `padding`, `borderRadius`, `shadowIntensity`, `aspectRatio`,
119
- `captionPosition`), `trimIdle`.
124
+ `captionPosition`, `showKeys`), `cursor` (`size`, `clickBounce`, `smoothing`, `motionBlur`,
125
+ `show`), `clickRipple`, `trimIdle` (`true` or `{ minMs, keepMs, mode, speed, ignoreFrames }`).
120
126
 
121
127
  Library: `recordScenario`, `dryRunScenario`, `resolveStorageState`, `deriveZoomRegions`,
122
128
  `deriveIdleRegions`, `buildProject`, `buildCursorData`, `buildMarks`, `renderProject`,
123
- `validateProject`, `rezoom`, `reviewSheet`, all typed (`dist/index.d.ts`).
129
+ `validateProject`, `rezoom`, `reviewSheet`, `extractFrame`, `exportGif`, `createMcpServer`,
130
+ all typed (`dist/index.d.ts`).
124
131
 
125
132
  ### Inspect before you script
126
133
 
@@ -182,14 +189,42 @@ to the scenario file; `--state` overrides it relative to cwd). Add `.demoreel/`
182
189
  - **Captions** sit at the bottom unless that would cover a target active at the time; then
183
190
  they move to the top (`look.captionPosition: "auto"`, or force `"top"` / `"bottom"`).
184
191
 
185
- ## Agent loop
192
+ ## Agent loop & MCP server
186
193
 
187
194
  `timeline.json` + `marks.json` make the output checkable without watching the video:
188
195
  `demoreel sheet out/<name>` runs `framesheet inspect <video> --marks marks.json` (framesheet
189
196
  on PATH, in `node_modules`, or via `uvx framesheet`) which draws clicks, targets, zooms and
190
- captions onto the tiles and flags e.g. captions covering a target. Iterate with
191
- `demoreel rezoom` (no re-recording) and `demoreel render`. A Claude Code skill for this loop
192
- is in [docs/skill.md](docs/skill.md).
197
+ captions onto the tiles and flags e.g. captions covering a target. Use `demoreel frame out/<name> 12.5`
198
+ to pull a single full-resolution PNG when inspecting dense UI, and iterate with `demoreel rezoom`
199
+ (no re-recording) and `demoreel render`.
200
+
201
+ ### MCP server (Claude Desktop, Cursor, Antigravity, Contexter, etc.)
202
+
203
+ demoreel ships an official MCP server (`@modelcontextprotocol/server`) over stdio that returns
204
+ inline PNG screenshots, contact sheets, and full-res frames plus live render progress notifications:
205
+
206
+ ```json
207
+ {
208
+ "mcpServers": {
209
+ "demoreel": {
210
+ "command": "npx",
211
+ "args": ["-y", "@phil65/demoreel", "mcp"]
212
+ }
213
+ }
214
+ }
215
+ ```
216
+
217
+ Tools exposed: `doctor`, `inspect_page`, `dry_run_scenario`, `run_scenario`, `rezoom`,
218
+ `inspect_frame`, and `export_gif`.
219
+
220
+ ### Agent skill
221
+
222
+ Install the bundled skill ([skills/demoreel/SKILL.md](skills/demoreel/SKILL.md)) into Claude Code,
223
+ Cursor, Codex, or Antigravity:
224
+
225
+ ```bash
226
+ npx skills add phil65/demoreel
227
+ ```
193
228
 
194
229
  ## Limitations
195
230
 
@@ -19,7 +19,7 @@ are listed in `vendor/openscreen/VENDORED.md` in the demoreel repository.
19
19
  | eventemitter3 | 5.0.4 | MIT | [licenses/eventemitter3.txt](licenses/eventemitter3.txt) | git://github.com/primus/eventemitter3 |
20
20
  | gif.js | 0.2.0 | MIT | [licenses/gif.js.txt](licenses/gif.js.txt) | https://github.com/jnordberg/gif.js |
21
21
  | ismobilejs | 1.1.1 | MIT | [licenses/ismobilejs.txt](licenses/ismobilejs.txt) | https://github.com/kaimallea/isMobile |
22
- | mediabunny | 1.66.2 | MPL-2.0 | [licenses/mediabunny.txt](licenses/mediabunny.txt) | https://github.com/Vanilagy/mediabunny |
22
+ | mediabunny | 1.66.5 | MPL-2.0 | [licenses/mediabunny.txt](licenses/mediabunny.txt) | https://github.com/Vanilagy/mediabunny |
23
23
  | motion-dom | 12.43.0 | MIT | [licenses/motion-dom.txt](licenses/motion-dom.txt) | https://github.com/motiondivision/motion |
24
24
  | motion-utils | 12.39.0 | MIT | [licenses/motion-utils.txt](licenses/motion-utils.txt) | https://github.com/motiondivision/motion |
25
25
  | parse-svg-path | 0.2.0 | MIT | [licenses/parse-svg-path.txt](licenses/parse-svg-path.txt) | git://github.com/jkroso/parse-svg-path |
package/dist/args.js CHANGED
@@ -14,6 +14,7 @@ export const COMMANDS = {
14
14
  flags: {
15
15
  out: { type: "string", alias: "o", value: "DIR", description: "output directory (default out/<name>)" },
16
16
  render: { type: "boolean", description: "render the MP4 (default; --no-render to only record)" },
17
+ gif: { type: "boolean", description: "also export a palette-optimised GIF next to the MP4" },
17
18
  sheet: { type: "boolean", description: "write a contact sheet after rendering (default)" },
18
19
  gpu,
19
20
  fps,
@@ -53,6 +54,7 @@ export const COMMANDS = {
53
54
  "auto-zoom": { type: "boolean", description: "automatic zooms (--no-auto-zoom: only scene.zoom())" },
54
55
  "trim-idle": trimIdle,
55
56
  "idle-options": { type: "string", value: "JSON", description: 'e.g. \'{"minMs":1500,"keepMs":800,"mode":"speed"}\'' },
57
+ "show-keys": { type: "boolean", description: "toggle keycap HUD overlays for scene.press() shortcuts" },
56
58
  render: { type: "boolean", description: "render the MP4 afterwards" },
57
59
  gpu,
58
60
  fps,
@@ -77,6 +79,30 @@ export const COMMANDS = {
77
79
  framesheet,
78
80
  },
79
81
  },
82
+ gif: {
83
+ usage: "gif <video.mp4|outdir>",
84
+ description: "export a palette-optimised GIF from a rendered MP4 (for READMEs and docs)",
85
+ positionals: { min: 1, max: 1 },
86
+ flags: {
87
+ out: { type: "string", alias: "o", value: "FILE", description: "output GIF path (default: next to the MP4)" },
88
+ fps: { type: "number", value: "N", description: "GIF frame rate (default 12)" },
89
+ width: { type: "number", value: "PX", description: "GIF width in px, height auto (default 960; 0 = source)" },
90
+ },
91
+ },
92
+ frame: {
93
+ usage: "frame <video.mp4|outdir> <seconds>",
94
+ description: "extract a single full-resolution PNG frame at a timestamp (for checking dense UI)",
95
+ positionals: { min: 2, max: 2 },
96
+ flags: {
97
+ out: { type: "string", alias: "o", value: "FILE", description: "output PNG path (default: next to the MP4)" },
98
+ },
99
+ },
100
+ mcp: {
101
+ usage: "mcp",
102
+ description: "start the demoreel MCP server over stdio (for Cursor, Claude, Antigravity, etc.)",
103
+ positionals: { min: 0, max: 0 },
104
+ flags: {},
105
+ },
80
106
  inspect: {
81
107
  usage: "inspect <url|scenario.ts|js>",
82
108
  description: "print a page's ARIA snapshot (or dry-run a scenario and inspect its end state)",
package/dist/cli.js CHANGED
@@ -6,12 +6,13 @@ import { fileURLToPath } from "node:url";
6
6
  import { COMMANDS, gpuMode, helpText, parseArgs, parseJsonFlag, parseSize, UsageError } from "./args.js";
7
7
  import { readTimeline, rezoom } from "./compose.js";
8
8
  import { checkFfmpeg, DemoreelError, detectGpu, launchChromium } from "./env.js";
9
+ import { exportGif } from "./gif.js";
9
10
  import { initProject } from "./init.js";
10
11
  import { loadScenario } from "./load.js";
11
12
  import { PACKAGE_ROOT } from "./openscreen.js";
12
13
  import { dryRunScenario, recordScenario, resolveStorageState } from "./record.js";
13
14
  import { renderProject, validateProject } from "./render.js";
14
- import { findFramesheet, reviewSheet } from "./sheet.js";
15
+ import { extractFrame, findFramesheet, reviewSheet } from "./sheet.js";
15
16
  const fmt = (ms) => `${(ms / 1000).toFixed(1)}s`;
16
17
  const log = (msg) => console.error(msg);
17
18
  function progressPrinter(enabled) {
@@ -104,11 +105,16 @@ async function cmdRun({ positionals, flags }) {
104
105
  const r = await renderProject({
105
106
  projectPath: rec.projectPath,
106
107
  outputPath: mp4,
108
+ cursor: scenario.cursor,
107
109
  ...renderFlags(flags),
108
110
  log,
109
111
  onProgress: progressPrinter(true),
110
112
  });
111
113
  printRender(r);
114
+ if (flags.gif) {
115
+ const g = await exportGif(mp4);
116
+ log(` gif: ${g.outputPath} (${(g.bytes / 1e6).toFixed(1)} MB, ${g.width}px @ ${g.fps}fps)`);
117
+ }
112
118
  if (flags.sheet === false)
113
119
  return;
114
120
  const sheet = await reviewSheet(mp4, {
@@ -147,12 +153,19 @@ async function cmdRezoom({ positionals, flags }) {
147
153
  zoom.auto = Boolean(flags["auto-zoom"]);
148
154
  const idle = parseJsonFlag("idle-options", flags["idle-options"]);
149
155
  const trimIdle = flags["trim-idle"] === false ? false : flags["trim-idle"] || Object.keys(idle).length ? { ...idle } : undefined;
150
- const res = rezoom(dir, { zoom, trimIdle });
156
+ const look = flags["show-keys"] !== undefined ? { showKeys: Boolean(flags["show-keys"]) } : undefined;
157
+ const res = rezoom(dir, { zoom, trimIdle, look });
151
158
  const t = res.timeline;
152
159
  log(`rezoomed ${t.scenario}: ${t.zoomRegions.length} zoom regions, ${t.trimRegions.length} trims, ${t.speedRegions.length} speed regions; output ${fmt(t.outputDurationMs)}`);
153
160
  console.log(JSON.stringify({ zoomRegions: t.zoomRegions, trimRegions: t.trimRegions, speedRegions: t.speedRegions }, null, 1));
154
161
  if (flags.render) {
155
- const r = await renderProject({ projectPath: res.projectPath, ...renderFlags(flags), log, onProgress: progressPrinter(true) });
162
+ const r = await renderProject({
163
+ projectPath: res.projectPath,
164
+ cursor: t.options?.cursor,
165
+ ...renderFlags(flags),
166
+ log,
167
+ onProgress: progressPrinter(true),
168
+ });
156
169
  printRender(r);
157
170
  }
158
171
  }
@@ -195,6 +208,40 @@ async function cmdSheet({ positionals, flags }) {
195
208
  if (sheet.report)
196
209
  console.log(sheet.report);
197
210
  }
211
+ async function cmdGif({ positionals, flags }) {
212
+ let target = path.resolve(positionals[0]);
213
+ if (fs.existsSync(target) && fs.statSync(target).isDirectory()) {
214
+ const tl = readTimeline(target);
215
+ target = path.join(target, tl.files?.video ?? `${tl.scenario}.mp4`);
216
+ }
217
+ if (!fs.existsSync(target))
218
+ throw new DemoreelError(`video not found: ${target}`, "render it first: demoreel render <project>");
219
+ const g = await exportGif(target, flags.out ? path.resolve(String(flags.out)) : undefined, {
220
+ fps: flags.fps !== undefined ? Number(flags.fps) : undefined,
221
+ width: flags.width !== undefined ? Number(flags.width) : undefined,
222
+ });
223
+ log(`gif: ${g.outputPath} (${(g.bytes / 1e6).toFixed(1)} MB, ${g.width || "source"}px @ ${g.fps}fps)`);
224
+ console.log(g.outputPath);
225
+ }
226
+ async function cmdFrame({ positionals, flags }) {
227
+ let target = path.resolve(positionals[0]);
228
+ if (fs.existsSync(target) && fs.statSync(target).isDirectory()) {
229
+ const tl = readTimeline(target);
230
+ target = path.join(target, tl.files?.video ?? `${tl.scenario}.mp4`);
231
+ }
232
+ if (!fs.existsSync(target))
233
+ throw new DemoreelError(`video not found: ${target}`, "render it first: demoreel render <project>");
234
+ const seconds = Number(positionals[1]);
235
+ if (!Number.isFinite(seconds) || seconds < 0)
236
+ throw new UsageError(`invalid timestamp: ${positionals[1]} (expected seconds >= 0)`);
237
+ const f = await extractFrame(target, seconds, flags.out ? path.resolve(String(flags.out)) : undefined);
238
+ log(`frame @ ${f.seconds.toFixed(2)}s / ${f.duration.toFixed(2)}s -> ${f.outPng}`);
239
+ console.log(f.outPng);
240
+ }
241
+ async function cmdMcp() {
242
+ const { runMcpServer } = await import("./mcp.js");
243
+ await runMcpServer();
244
+ }
198
245
  async function cmdLogin({ positionals, flags }) {
199
246
  const url = positionals[0];
200
247
  const statePath = path.resolve(String(flags.state ?? path.join(".demoreel", "auth.json")));
@@ -432,6 +479,9 @@ export async function main(argv = process.argv.slice(2)) {
432
479
  rezoom: cmdRezoom,
433
480
  validate: cmdValidate,
434
481
  sheet: cmdSheet,
482
+ gif: cmdGif,
483
+ frame: cmdFrame,
484
+ mcp: cmdMcp,
435
485
  inspect: cmdInspect,
436
486
  login: cmdLogin,
437
487
  init: cmdInit,
package/dist/compose.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type IdleOptions } from "./idle.ts";
2
2
  import { type Marks } from "./marks.ts";
3
3
  import { buildProject, type LookOptions } from "./project.ts";
4
+ import type { CursorStyle } from "./render.ts";
4
5
  import type { ActionRecord, Caption, CursorSample, SpeedRegion, TrimRegion, Viewport, ZoomRegion } from "./types.ts";
5
6
  import { type ZoomOptions } from "./zoom.ts";
6
7
  export declare const TIMELINE_VERSION = 1;
@@ -19,6 +20,7 @@ export interface Timeline {
19
20
  zoom: Partial<ZoomOptions>;
20
21
  look: Partial<LookOptions>;
21
22
  trimIdle: Partial<IdleOptions> | false;
23
+ cursor?: CursorStyle;
22
24
  };
23
25
  actions: ActionRecord[];
24
26
  zoomRegions: ZoomRegion[];
@@ -52,6 +54,7 @@ export interface ComposeInput {
52
54
  zoom?: Partial<ZoomOptions>;
53
55
  look?: Partial<LookOptions>;
54
56
  trimIdle?: Partial<IdleOptions> | boolean;
57
+ cursor?: CursorStyle;
55
58
  }
56
59
  export interface ComposeResult {
57
60
  timeline: Timeline;
@@ -70,4 +73,5 @@ export declare function rezoom(dir: string, overrides?: {
70
73
  zoom?: Partial<ZoomOptions>;
71
74
  trimIdle?: Partial<IdleOptions> | boolean;
72
75
  look?: Partial<LookOptions>;
76
+ cursor?: CursorStyle;
73
77
  }): ComposeResult;
package/dist/compose.js CHANGED
@@ -32,6 +32,7 @@ export function compose(input, opts = {}) {
32
32
  videoPath: input.videoPath,
33
33
  zoomRegions,
34
34
  captions,
35
+ actions: input.actions,
35
36
  trimRegions,
36
37
  speedRegions,
37
38
  look,
@@ -73,6 +74,7 @@ export function compose(input, opts = {}) {
73
74
  zoom: input.zoom ?? {},
74
75
  look: input.look ?? {},
75
76
  trimIdle: idleOpts ?? false,
77
+ ...(input.cursor ? { cursor: input.cursor } : {}),
76
78
  },
77
79
  actions: input.actions.map(roundAction),
78
80
  zoomRegions,
@@ -124,6 +126,7 @@ export function rezoom(dir, overrides = {}) {
124
126
  ? { ...(tl.options?.trimIdle || {}) }
125
127
  : overrides.trimIdle;
126
128
  const projectPath = path.join(dir, `${tl.scenario}.openscreen`);
129
+ const cursor = overrides.cursor ?? tl.options?.cursor;
127
130
  return compose({
128
131
  name: tl.scenario,
129
132
  outDir: dir,
@@ -140,5 +143,6 @@ export function rezoom(dir, overrides = {}) {
140
143
  zoom: { ...tl.options?.zoom, ...overrides.zoom },
141
144
  look: { ...tl.options?.look, ...overrides.look },
142
145
  trimIdle: trimIdle ?? false,
146
+ cursor,
143
147
  }, { keepProjectFrom: overrides.look ? undefined : projectPath });
144
148
  }
package/dist/gif.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ export interface GifOptions {
2
+ /** Output frame rate (default 12). */
3
+ fps?: number;
4
+ /** Output width in px, height preserves aspect ratio (default 960; 0 keeps source width). */
5
+ width?: number;
6
+ /** Loop count: 0 = infinite (default), -1 = no loop, N = loop N times. */
7
+ loop?: number;
8
+ }
9
+ export interface GifResult {
10
+ outputPath: string;
11
+ bytes: number;
12
+ fps: number;
13
+ width: number;
14
+ }
15
+ /** Converts an MP4 video into a crisp palette-optimised GIF suitable for READMEs and docs. */
16
+ export declare function exportGif(videoPath: string, outPath?: string, opts?: GifOptions): Promise<GifResult>;
package/dist/gif.js ADDED
@@ -0,0 +1,19 @@
1
+ /** Two-pass palette-optimised GIF export from a rendered MP4 via ffmpeg. */
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { checkFfmpeg, ffmpegBin, run } from "./env.js";
5
+ /** Converts an MP4 video into a crisp palette-optimised GIF suitable for READMEs and docs. */
6
+ export async function exportGif(videoPath, outPath, opts = {}) {
7
+ checkFfmpeg();
8
+ const src = path.resolve(videoPath);
9
+ const dst = path.resolve(outPath ?? src.replace(/\.\w+$/, ".gif"));
10
+ const fps = Math.max(1, Math.min(30, Math.round(opts.fps ?? 12)));
11
+ const width = opts.width === 0 ? 0 : Math.max(120, Math.round(opts.width ?? 960));
12
+ const loop = opts.loop ?? 0;
13
+ fs.mkdirSync(path.dirname(dst), { recursive: true });
14
+ const scale = width > 0 ? `,scale=${width}:-2:flags=lanczos` : "";
15
+ const filter = `fps=${fps}${scale},split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=3`;
16
+ await run(ffmpegBin(), ["-y", "-loglevel", "error", "-i", src, "-vf", filter, "-loop", String(loop), dst]);
17
+ const { size } = fs.statSync(dst);
18
+ return { outputPath: dst, bytes: size, fps, width };
19
+ }
package/dist/index.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  /** demoreel: scripted product demo videos (videos as code), rendered by OpenScreen's exporter. */
2
2
  export { type DryRunError, type DryRunOptions, type DryRunResult, type RecordOptions, type RecordResult, type Scenario, type ScenarioContext, defineScenario, dryRunScenario, recordScenario, resolveStorageState, } from "./record.ts";
3
- export { type ActionOptions, applyZoomAnchor, DEFAULT_PACING, describeTarget, type HighlightOptions, type PacingOptions, resolveTarget, Scene, type SceneClock, type Target, type TargetSpec, ZOOM_ATTRIBUTE, type ZoomOptions as SceneZoomOptions, } from "./scene.ts";
3
+ export { type ActionOptions, applyZoomAnchor, type ClickRippleOptions, DEFAULT_PACING, describeTarget, type HighlightOptions, type PacingOptions, type PressOptions, resolveTarget, Scene, type SceneClock, type Target, type TargetSpec, ZOOM_ATTRIBUTE, type ZoomOptions as SceneZoomOptions, } from "./scene.ts";
4
4
  export { DEFAULT_ZOOM_OPTIONS, DEPTH_SCALES, deriveZoomRegions, depthForBox, normalizeDepth, type ZoomOptions } from "./zoom.ts";
5
5
  export { DEFAULT_IDLE_OPTIONS, deriveIdleRegions, idleIntervals, type IdleOptions, sourceToOutputMs } from "./idle.ts";
6
- export { buildCursorData, buildProject, type BuildProjectOptions, captionAnnotations, DEFAULT_LOOK, type LookOptions, normalizeSamples, type OpenScreenProject, writeProject, } from "./project.ts";
6
+ export { buildCursorData, buildProject, type BuildProjectOptions, captionAnnotations, DEFAULT_LOOK, formatKeycap, keycapAnnotations, type KeyHudOptions, type KeyHudPosition, keycapRect, type LookOptions, normalizeSamples, type OpenScreenProject, writeProject, } from "./project.ts";
7
+ export { exportGif, type GifOptions, type GifResult } from "./gif.ts";
7
8
  export { buildMarks, type Marks, type MarkPoint, type MarkRegion, type MarkSpan, type MarksInput } from "./marks.ts";
8
9
  export { stageLayout, type StageLayout } from "./layout.ts";
9
10
  export { compose, rezoom, readTimeline, type Timeline, TIMELINE_VERSION } from "./compose.ts";
10
11
  export { type CursorStyle, type RenderOptions, type RenderResult, renderProject, type ValidationResult, validateProject } from "./render.ts";
11
- export { contactSheet, findFramesheet, reviewSheet, type SheetOptions, type SheetResult } from "./sheet.ts";
12
+ export { contactSheet, extractFrame, findFramesheet, reviewSheet, type SheetOptions, type SheetResult } from "./sheet.ts";
13
+ export { createMcpServer, runMcpServer } from "./mcp.ts";
12
14
  export { DemoreelError, detectGpu, type GpuMode, type GpuProbe } from "./env.ts";
13
15
  export { loadScenario } from "./load.ts";
14
16
  export type * from "./types.ts";
package/dist/index.js CHANGED
@@ -3,11 +3,13 @@ export { defineScenario, dryRunScenario, recordScenario, resolveStorageState, }
3
3
  export { applyZoomAnchor, DEFAULT_PACING, describeTarget, resolveTarget, Scene, ZOOM_ATTRIBUTE, } from "./scene.js";
4
4
  export { DEFAULT_ZOOM_OPTIONS, DEPTH_SCALES, deriveZoomRegions, depthForBox, normalizeDepth } from "./zoom.js";
5
5
  export { DEFAULT_IDLE_OPTIONS, deriveIdleRegions, idleIntervals, sourceToOutputMs } from "./idle.js";
6
- export { buildCursorData, buildProject, captionAnnotations, DEFAULT_LOOK, normalizeSamples, writeProject, } from "./project.js";
6
+ export { buildCursorData, buildProject, captionAnnotations, DEFAULT_LOOK, formatKeycap, keycapAnnotations, keycapRect, normalizeSamples, writeProject, } from "./project.js";
7
+ export { exportGif } from "./gif.js";
7
8
  export { buildMarks } from "./marks.js";
8
9
  export { stageLayout } from "./layout.js";
9
10
  export { compose, rezoom, readTimeline, TIMELINE_VERSION } from "./compose.js";
10
11
  export { renderProject, validateProject } from "./render.js";
11
- export { contactSheet, findFramesheet, reviewSheet } from "./sheet.js";
12
+ export { contactSheet, extractFrame, findFramesheet, reviewSheet } from "./sheet.js";
13
+ export { createMcpServer, runMcpServer } from "./mcp.js";
12
14
  export { DemoreelError, detectGpu } from "./env.js";
13
15
  export { loadScenario } from "./load.js";
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { McpServer } from "@modelcontextprotocol/server";
2
+ /** Creates a configured demoreel `McpServer` instance (connect to stdio or any MCP transport). */
3
+ export declare function createMcpServer(): McpServer;
4
+ /** Starts the demoreel MCP server over stdio. */
5
+ export declare function runMcpServer(): Promise<void>;