autokast 0.0.0-stage → 0.1.1

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 (79) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +164 -2
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +300 -0
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.js +4 -0
  7. package/dist/inspect.d.ts +26 -0
  8. package/dist/inspect.js +193 -0
  9. package/dist/record/animations.d.ts +7 -0
  10. package/dist/record/animations.js +34 -0
  11. package/dist/record/capture.d.ts +85 -0
  12. package/dist/record/capture.js +202 -0
  13. package/dist/record/cast.d.ts +142 -0
  14. package/dist/record/cast.js +680 -0
  15. package/dist/record/cursor-style.d.ts +33 -0
  16. package/dist/record/cursor-style.js +252 -0
  17. package/dist/record/defaults.d.ts +96 -0
  18. package/dist/record/defaults.js +125 -0
  19. package/dist/record/editor.d.ts +11 -0
  20. package/dist/record/editor.js +48 -0
  21. package/dist/record/frame-pump.d.ts +91 -0
  22. package/dist/record/frame-pump.js +306 -0
  23. package/dist/record/index.d.ts +11 -0
  24. package/dist/record/index.js +287 -0
  25. package/dist/record/motion.d.ts +48 -0
  26. package/dist/record/motion.js +112 -0
  27. package/dist/record/pace.d.ts +69 -0
  28. package/dist/record/pace.js +133 -0
  29. package/dist/record/random.d.ts +12 -0
  30. package/dist/record/random.js +24 -0
  31. package/dist/record/scroll.d.ts +71 -0
  32. package/dist/record/scroll.js +249 -0
  33. package/dist/record/timeline.d.ts +34 -0
  34. package/dist/record/timeline.js +44 -0
  35. package/dist/render/background.d.ts +12 -0
  36. package/dist/render/background.js +209 -0
  37. package/dist/render/browser.d.ts +46 -0
  38. package/dist/render/browser.js +223 -0
  39. package/dist/render/camera.d.ts +119 -0
  40. package/dist/render/camera.js +372 -0
  41. package/dist/render/captions.d.ts +114 -0
  42. package/dist/render/captions.js +254 -0
  43. package/dist/render/color.d.ts +23 -0
  44. package/dist/render/color.js +78 -0
  45. package/dist/render/compositor.d.ts +185 -0
  46. package/dist/render/compositor.js +656 -0
  47. package/dist/render/cursor.d.ts +85 -0
  48. package/dist/render/cursor.js +314 -0
  49. package/dist/render/cursors/shapes.d.ts +34 -0
  50. package/dist/render/cursors/shapes.js +268 -0
  51. package/dist/render/defaults.d.ts +91 -0
  52. package/dist/render/defaults.js +139 -0
  53. package/dist/render/easing.d.ts +13 -0
  54. package/dist/render/easing.js +40 -0
  55. package/dist/render/effects.d.ts +39 -0
  56. package/dist/render/effects.js +91 -0
  57. package/dist/render/encoder.d.ts +52 -0
  58. package/dist/render/encoder.js +226 -0
  59. package/dist/render/index.d.ts +19 -0
  60. package/dist/render/index.js +138 -0
  61. package/dist/render/keycaps.d.ts +67 -0
  62. package/dist/render/keycaps.js +270 -0
  63. package/dist/render/scene.d.ts +59 -0
  64. package/dist/render/scene.js +230 -0
  65. package/dist/render/source.d.ts +21 -0
  66. package/dist/render/source.js +57 -0
  67. package/dist/render/spring.d.ts +11 -0
  68. package/dist/render/spring.js +47 -0
  69. package/dist/render/stage.d.ts +59 -0
  70. package/dist/render/stage.js +91 -0
  71. package/dist/render/timeline.d.ts +70 -0
  72. package/dist/render/timeline.js +157 -0
  73. package/dist/session.d.ts +14 -0
  74. package/dist/session.js +33 -0
  75. package/dist/types.d.ts +708 -0
  76. package/dist/types.js +1 -0
  77. package/package.json +63 -4
  78. package/skills/autokast/SKILL.md +300 -0
  79. package/skills/autokast/reference/jupyterlab.md +100 -0
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Jeremy Tuloup
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,165 @@
1
- # Temporary Holding Version
1
+ # autokast
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Automated, polished screencasts of web apps. Built for agents.
4
+
5
+ <!-- Demo video: upload the README demo to GitHub and put its link on the next line. -->
6
+
7
+ https://github.com/user-attachments/assets/086be325-b794-4391-9ec5-87e619862c43
8
+
9
+ You write a short script that says what happens on the page and where the camera looks.
10
+ `autokast` records the page with Playwright and renders the video: a smooth cursor, click
11
+ effects, zooms that follow the action, and a framed window. There is no editor.
12
+
13
+ It works with anything that opens in a browser.
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ npm install --save-dev autokast playwright
19
+ npx playwright install chromium
20
+ ```
21
+
22
+ You also need Node.js 22.18 or later and `ffmpeg` on the `PATH`.
23
+
24
+ ## Use it with an agent
25
+
26
+ Give the skill to your agent:
27
+
28
+ ```sh
29
+ npx skills add jtpio/autokast
30
+ ```
31
+
32
+ Then ask for the video:
33
+
34
+ > Record a screencast of http://localhost:3000 that shows how to create a project.
35
+
36
+ The agent explores the app, writes the script, records it, checks the result on still images
37
+ and renders the video.
38
+
39
+ ## Write a script
40
+
41
+ ```ts
42
+ import { defineScreencast } from 'autokast';
43
+
44
+ export default defineScreencast({
45
+ name: 'new-task',
46
+ url: 'http://localhost:4173',
47
+
48
+ async run(cast) {
49
+ const { page } = cast;
50
+ await cast.click(page.getByRole('button', { name: 'New task' }));
51
+ await cast.zoomTo(page.getByRole('dialog'), { level: 'medium' });
52
+ await cast.type('Ship the onboarding tour', { into: page.getByLabel('Title') });
53
+ await cast.click(page.getByRole('button', { name: 'Create task' }));
54
+ await cast.zoomOut();
55
+ },
56
+ });
57
+ ```
58
+
59
+ ```sh
60
+ npx autokast record new-task.ts -o new-task.mp4
61
+ ```
62
+
63
+ A target is a Playwright locator, a selector, a point or a rectangle.
64
+
65
+ | Call | Effect |
66
+ | ---------------------------------------------- | ------------------------------------------------ |
67
+ | `click`, `dblclick`, `rightClick`, `hover` | Moves the cursor along a natural path, then acts |
68
+ | `drag(from, to)`, `scroll`, `scrollTo` | Drag and smooth scroll |
69
+ | `select(target, values)` | Chooses options of a native `<select>` |
70
+ | `type(text)`, `press('Shift+Enter')` | Human typing and shortcuts |
71
+ | `goto(url)`, `showUrl()` | Opens a URL; shows the URL in the browser frame |
72
+ | `zoomTo(target)`, `zoom('close')`, `zoomOut()` | Camera moves |
73
+ | `wait(ms)`, `cut(fn)`, `speed(rate, fn)` | Hold a shot, remove a wait, play a part faster |
74
+ | `caption(text)`, `spotlight(target)` | Optional overlays |
75
+
76
+ Use `cast` for every action that the viewer must see. `cast.page` is the Playwright page, for
77
+ waits and for reading state.
78
+
79
+ ## Features
80
+
81
+ | Camera | Overlays |
82
+ | -------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
83
+ | ![A zoomed shot of the app](docs/images/zoom.jpg) | ![A caption below the window, with keycaps](docs/images/captions.jpg) |
84
+ | Named zoom levels, a fit to an element, and a camera that can follow the cursor. | Captions on the backdrop and shortcuts as keycaps. Both are optional. |
85
+
86
+ - **Cursor.** A large vector cursor that takes the shape the page asks for, with click
87
+ effects, motion blur, and a slight tilt when it travels.
88
+ - **Camera.** `zoomTo` frames an element; `zoom` zooms on the cursor. Each shot has a follow
89
+ mode: `off`, `edge` or `cursor`.
90
+ - **Look.** Ten backdrops, padding, rounded corners, shadow, and an optional title bar or
91
+ browser frame with an address bar that follows the page URL.
92
+ - **Output.** Any size and frame rate, as mp4, webm or gif.
93
+ - **Frame-perfect capture.** `--set capture.mode=frame-perfect` controls the page clock, so
94
+ page motion is exact at 60 fps on any machine. Use it for the final recording.
95
+ - **Made for agents.** `autokast inspect` prints the timeline and writes a contact sheet, so an
96
+ agent can check a video that it cannot watch.
97
+
98
+ ![A contact sheet: a grid of stills with their times](docs/images/contact-sheet.jpg)
99
+
100
+ ## Commands
101
+
102
+ ```sh
103
+ autokast record <script> # record, then render
104
+ autokast render <session> # render a recording again, with other options
105
+ autokast frame <session> --at 12 # one still frame
106
+ autokast inspect <session|video> # timeline and contact sheet
107
+ ```
108
+
109
+ A recording is stored as a session in `.autokast/<name>`. The look is decided at render time,
110
+ so one recording can give many videos:
111
+
112
+ ```sh
113
+ autokast render .autokast/new-task -o tall.mp4 --size 1080x1920 --background ink
114
+ autokast render .autokast/new-task -o big.mp4 --size 3840x2160 --set encode.quality=high
115
+ autokast render .autokast/new-task -o plain.mp4 --set cursor.tilt=0 --set zoom.follow=off
116
+ ```
117
+
118
+ `--set key=value` sets any option. Run `autokast --help` for the other flags.
119
+
120
+ ## Options
121
+
122
+ Options are fields of the script, and render options go under `render`.
123
+
124
+ ```ts
125
+ export default defineScreencast({
126
+ viewport: { width: 1280, height: 720 },
127
+ capture: { mode: 'realtime' }, // or 'frame-perfect'
128
+ typing: { delay: 45 },
129
+
130
+ render: {
131
+ size: { width: 1920, height: 1080 },
132
+ fps: 60,
133
+ background: 'dusk', // paper, fog, sage, dune, clay, dusk, harbor, graphite, ink, ember
134
+ frame: { padding: 0.07, radius: 16, chrome: 'none' }, // none, window, browser
135
+ cursor: { size: 1.9, motionBlur: 0.5, tilt: 1 },
136
+ zoom: { follow: 'edge', levels: { wide: 1.3, medium: 1.6, close: 2.2 } },
137
+ encode: { quality: 'standard' }, // draft, standard, high, max
138
+ },
139
+
140
+ async run(cast) {},
141
+ });
142
+ ```
143
+
144
+ Every option, with its meaning, is in [`src/types.ts`](src/types.ts). The skill in
145
+ [`skills/autokast`](skills/autokast/SKILL.md) has the full workflow and the direction rules.
146
+
147
+ ## Examples
148
+
149
+ The [`examples`](examples) directory has scripts for JupyterLab, JupyterLite and a demo app.
150
+ Each script names the command that starts its server. The video at the top of this page is
151
+ [`examples/jupyterlab-demo.ts`](examples/jupyterlab-demo.ts).
152
+
153
+ ## Development
154
+
155
+ ```sh
156
+ npm install
157
+ npm test
158
+ node src/cli.ts record examples/orbit-board.ts # runs from source
159
+ ```
160
+
161
+ See [RELEASE.md](RELEASE.md) for the release steps.
162
+
163
+ ## License
164
+
165
+ BSD 3-Clause. See [LICENSE](LICENSE).
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env node
2
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
3
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
4
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
5
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
6
+ });
7
+ }
8
+ return path;
9
+ };
10
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
11
+ import path from 'node:path';
12
+ import { pathToFileURL } from 'node:url';
13
+ import { parseArgs } from 'node:util';
14
+ import { contactSheet, describeSession } from "./inspect.js";
15
+ import { recordScreencast } from "./record/index.js";
16
+ import { render, renderFrame } from "./render/index.js";
17
+ import { loadSession } from "./session.js";
18
+ const HELP = `autokast - automated, polished screencasts of web apps
19
+
20
+ Usage:
21
+ autokast record <script> [options] Record a screencast script, then render it
22
+ autokast render <session> [options] Render a recorded session again
23
+ autokast frame <session> --at <sec> Render one still frame (PNG)
24
+ autokast inspect <session|video> Print the timeline and write a contact sheet
25
+
26
+ Common options:
27
+ -o, --out <file> Output file (.mp4, .webm, .gif; .png for frame and inspect)
28
+ --config <file> JSON file with render options
29
+ --set <key=value> Set one option by path, e.g. --set zoom.maxScale=2.5 (repeatable)
30
+ --preview Fast render: half size, 30 fps, draft quality
31
+ --size <WxH> Output size, e.g. 1920x1080
32
+ --fps <n> Output frame rate
33
+ --background <b> Background preset name or CSS color
34
+ --range <a:b> Render only this output time range, in seconds
35
+
36
+ record options:
37
+ --session <dir> Session directory (default: .autokast/<name>)
38
+ --no-render Record only
39
+ --headed Show the browser window
40
+
41
+ inspect options:
42
+ --every <sec> Time between tiles (default: fits 16 tiles)
43
+ --from <sec> Start time
44
+ --to <sec> End time
45
+ --cols <n> Columns (default: 4)
46
+ --tile-width <px> Width of one tile (default: 480)
47
+
48
+ For record, --set applies to the screencast definition (render options are under "render.").
49
+ For render, frame and inspect, --set applies to the render options.
50
+ `;
51
+ /**
52
+ * Sets a value in a nested object by a dotted path.
53
+ */
54
+ function setPath(target, key, value) {
55
+ const parts = key.split('.');
56
+ let node = target;
57
+ for (const part of parts.slice(0, -1)) {
58
+ if (typeof node[part] !== 'object' || node[part] === null) {
59
+ node[part] = {};
60
+ }
61
+ node = node[part];
62
+ }
63
+ node[parts[parts.length - 1]] = value;
64
+ }
65
+ /**
66
+ * Applies `key=value` pairs. Values are parsed as JSON when possible.
67
+ */
68
+ function applySets(target, sets) {
69
+ for (const entry of sets) {
70
+ const index = entry.indexOf('=');
71
+ if (index < 1) {
72
+ throw new Error(`Invalid --set "${entry}". Use key=value, e.g. --set cursor.size=2`);
73
+ }
74
+ const raw = entry.slice(index + 1);
75
+ let value = raw;
76
+ try {
77
+ value = JSON.parse(raw);
78
+ }
79
+ catch {
80
+ // A plain string.
81
+ }
82
+ setPath(target, entry.slice(0, index), value);
83
+ }
84
+ }
85
+ function parseSize(text) {
86
+ const match = /^(\d+)x(\d+)$/.exec(text);
87
+ if (!match) {
88
+ throw new Error(`Invalid --size "${text}". Use WIDTHxHEIGHT, e.g. 1920x1080`);
89
+ }
90
+ return { width: Number(match[1]), height: Number(match[2]) };
91
+ }
92
+ function parseFlags(args) {
93
+ return parseArgs({
94
+ args,
95
+ allowPositionals: true,
96
+ options: {
97
+ out: { type: 'string', short: 'o' },
98
+ config: { type: 'string' },
99
+ set: { type: 'string', multiple: true },
100
+ preview: { type: 'boolean' },
101
+ size: { type: 'string' },
102
+ fps: { type: 'string' },
103
+ background: { type: 'string' },
104
+ range: { type: 'string' },
105
+ session: { type: 'string' },
106
+ 'no-render': { type: 'boolean' },
107
+ headed: { type: 'boolean' },
108
+ at: { type: 'string' },
109
+ every: { type: 'string' },
110
+ from: { type: 'string' },
111
+ to: { type: 'string' },
112
+ cols: { type: 'string' },
113
+ 'tile-width': { type: 'string' },
114
+ help: { type: 'boolean', short: 'h' },
115
+ },
116
+ });
117
+ }
118
+ /**
119
+ * Builds render options from the command line flags.
120
+ */
121
+ async function renderOptions(flags, sets) {
122
+ const options = flags.config
123
+ ? JSON.parse(await readFile(flags.config, 'utf8'))
124
+ : {};
125
+ applySets(options, sets);
126
+ if (flags.size) {
127
+ options.size = parseSize(flags.size);
128
+ }
129
+ if (flags.fps) {
130
+ options.fps = Number(flags.fps);
131
+ }
132
+ if (flags.background) {
133
+ options.background = flags.background;
134
+ }
135
+ if (flags.range) {
136
+ const [start, end] = flags.range.split(':');
137
+ options.range = {
138
+ start: start ? Number(start) * 1000 : undefined,
139
+ end: end ? Number(end) * 1000 : undefined,
140
+ };
141
+ }
142
+ if (flags.out) {
143
+ options.output = flags.out;
144
+ }
145
+ return options;
146
+ }
147
+ /**
148
+ * Halves the output size and the frame rate for a fast render.
149
+ */
150
+ function applyPreview(options, base) {
151
+ const size = options.size ?? base?.size ?? { width: 1920, height: 1080 };
152
+ options.size = {
153
+ width: Math.round(size.width / 4) * 2,
154
+ height: Math.round(size.height / 4) * 2,
155
+ };
156
+ options.fps = 30;
157
+ options.encode = { ...options.encode, quality: 'draft' };
158
+ }
159
+ function progress(label) {
160
+ let last = -1;
161
+ return (done, total) => {
162
+ const percent = Math.floor((done / total) * 100);
163
+ const step = process.stderr.isTTY ? 1 : 10;
164
+ if (percent === last || percent % step !== 0) {
165
+ return;
166
+ }
167
+ last = percent;
168
+ if (process.stderr.isTTY) {
169
+ process.stderr.write(`\r${label} ${percent}%`);
170
+ if (percent === 100) {
171
+ process.stderr.write('\n');
172
+ }
173
+ }
174
+ else {
175
+ process.stderr.write(`${label} ${percent}%\n`);
176
+ }
177
+ };
178
+ }
179
+ async function loadDefinition(script) {
180
+ const module = await import(__rewriteRelativeImportExtension(pathToFileURL(path.resolve(script)).href));
181
+ const definition = module.default;
182
+ if (!definition || typeof definition.run !== 'function') {
183
+ throw new Error(`"${script}" must default-export a screencast: export default defineScreencast({ url, run })`);
184
+ }
185
+ return definition;
186
+ }
187
+ async function commandRecord(positionals, flags) {
188
+ const script = positionals[0];
189
+ if (!script) {
190
+ throw new Error('Usage: autokast record <script>');
191
+ }
192
+ const definition = await loadDefinition(script);
193
+ const overrides = {};
194
+ applySets(overrides, flags.set ?? []);
195
+ if (flags.session) {
196
+ overrides.sessionDir = flags.session;
197
+ }
198
+ if (flags.headed) {
199
+ setPath(overrides, 'browser.headless', false);
200
+ }
201
+ process.stderr.write(`Recording ${definition.name ?? script}...\n`);
202
+ const recorded = await recordScreencast(definition, overrides);
203
+ const seconds = (recorded.session.duration / 1000).toFixed(1);
204
+ console.log(`Session: ${recorded.dir} (${seconds}s, ${recorded.session.frames.length} frames)`);
205
+ if (flags['no-render']) {
206
+ return;
207
+ }
208
+ const options = await renderOptions(flags, []);
209
+ if (flags.preview) {
210
+ applyPreview(options, recorded.session.render);
211
+ }
212
+ options.onProgress = progress('Rendering');
213
+ const result = await recorded.render(options);
214
+ printResult(result);
215
+ }
216
+ async function commandRender(positionals, flags) {
217
+ const dir = positionals[0];
218
+ if (!dir) {
219
+ throw new Error('Usage: autokast render <session>');
220
+ }
221
+ const session = await loadSession(dir);
222
+ const options = await renderOptions(flags, flags.set ?? []);
223
+ if (flags.preview) {
224
+ applyPreview(options, session.render);
225
+ }
226
+ options.onProgress = progress('Rendering');
227
+ printResult(await render(dir, options));
228
+ }
229
+ function printResult(result) {
230
+ const seconds = (result.duration / 1000).toFixed(1);
231
+ const { width, height } = result.size;
232
+ console.log(`Video: ${result.output} (${seconds}s, ${width}x${height} @ ${result.fps} fps)`);
233
+ }
234
+ async function commandFrame(positionals, flags) {
235
+ const dir = positionals[0];
236
+ if (!dir || flags.at === undefined) {
237
+ throw new Error('Usage: autokast frame <session> --at <seconds> [-o frame.png]');
238
+ }
239
+ const options = await renderOptions(flags, flags.set ?? []);
240
+ const out = flags.out ?? `frame-${flags.at}s.png`;
241
+ delete options.output;
242
+ const png = await renderFrame(dir, Number(flags.at) * 1000, options);
243
+ await mkdir(path.dirname(path.resolve(out)), { recursive: true });
244
+ await writeFile(out, png);
245
+ console.log(`Frame: ${out}`);
246
+ }
247
+ async function commandInspect(positionals, flags) {
248
+ const source = positionals[0];
249
+ if (!source) {
250
+ throw new Error('Usage: autokast inspect <session|video> [-o sheet.png]');
251
+ }
252
+ const options = await renderOptions(flags, flags.set ?? []);
253
+ const out = flags.out ?? 'contact-sheet.png';
254
+ delete options.output;
255
+ const isVideo = /\.(mp4|webm|gif|mov|mkv)$/i.test(source);
256
+ if (!isVideo) {
257
+ console.log(describeSession(await loadSession(source), options));
258
+ }
259
+ const sheet = await contactSheet(source, {
260
+ out,
261
+ every: flags.every ? Number(flags.every) * 1000 : undefined,
262
+ from: flags.from ? Number(flags.from) * 1000 : undefined,
263
+ to: flags.to ? Number(flags.to) * 1000 : undefined,
264
+ columns: flags.cols ? Number(flags.cols) : undefined,
265
+ tileWidth: flags['tile-width'] ? Number(flags['tile-width']) : undefined,
266
+ render: options,
267
+ });
268
+ console.log(`Contact sheet: ${sheet.out} (${sheet.tiles} tiles, one every ${sheet.every / 1000}s)`);
269
+ }
270
+ async function main() {
271
+ const [command, ...rest] = process.argv.slice(2);
272
+ if (!command || command === 'help' || command === '--help' || command === '-h') {
273
+ console.log(HELP);
274
+ return;
275
+ }
276
+ const { values, positionals } = parseFlags(rest);
277
+ if (values.help) {
278
+ console.log(HELP);
279
+ return;
280
+ }
281
+ const commands = {
282
+ record: commandRecord,
283
+ render: commandRender,
284
+ frame: commandFrame,
285
+ inspect: commandInspect,
286
+ };
287
+ const run = commands[command];
288
+ if (!run) {
289
+ throw new Error(`Unknown command "${command}".\n\n${HELP}`);
290
+ }
291
+ await run(positionals, values);
292
+ }
293
+ main().catch((error) => {
294
+ const [summary, ...details] = error.message.split('\n');
295
+ console.error(`autokast: ${error.message}`);
296
+ if (details.length > 3) {
297
+ console.error(`\nautokast: ${summary}`);
298
+ }
299
+ process.exitCode = 1;
300
+ });
@@ -0,0 +1,4 @@
1
+ export * from './types.ts';
2
+ export { defineScreencast, loadSession, saveSession } from './session.ts';
3
+ export { record, recordScreencast } from './record/index.ts';
4
+ export { render, renderFrame } from './render/index.ts';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./types.js";
2
+ export { defineScreencast, loadSession, saveSession } from "./session.js";
3
+ export { record, recordScreencast } from "./record/index.js";
4
+ export { render, renderFrame } from "./render/index.js";
@@ -0,0 +1,26 @@
1
+ import type { RenderOptions, Session } from './types.ts';
2
+ export interface ContactSheetOptions {
3
+ out: string;
4
+ /**
5
+ * Time between tiles in milliseconds. Default: fits 16 tiles.
6
+ */
7
+ every?: number;
8
+ from?: number;
9
+ to?: number;
10
+ columns?: number;
11
+ tileWidth?: number;
12
+ render?: RenderOptions;
13
+ }
14
+ export interface ContactSheetResult {
15
+ out: string;
16
+ tiles: number;
17
+ every: number;
18
+ }
19
+ /**
20
+ * Returns a text summary of a session: sizes, capture rate and the timeline in output time.
21
+ */
22
+ export declare function describeSession(session: Session, options?: RenderOptions): string;
23
+ /**
24
+ * Writes a grid of stills with time labels, from a session directory or a video file.
25
+ */
26
+ export declare function contactSheet(source: string, options: ContactSheetOptions): Promise<ContactSheetResult>;