@gnawbit/tabretake 0.0.0-stage → 0.4.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.
@@ -0,0 +1,48 @@
1
+ {
2
+ "url": "http://127.0.0.1:4173",
3
+ "displayUrl": "northstar.app",
4
+ "viewport": { "width": 1440, "height": 810 },
5
+ "initialWait": 700,
6
+ "tail": 1800,
7
+ "vertical": {
8
+ "badge": "RELEASE DEMO",
9
+ "titleLines": ["一个故事文件", "更新发布演示"],
10
+ "subtitle": "重复运行 · 本地生成",
11
+ "cta": "TabRetake",
12
+ "watermark": false
13
+ },
14
+ "steps": [
15
+ { "action": "wait", "ms": 300 },
16
+ {
17
+ "action": "click",
18
+ "role": "button",
19
+ "name": "New project",
20
+ "pause": 700,
21
+ "zoom": false,
22
+ "caption": "从一个新项目开始"
23
+ },
24
+ {
25
+ "action": "type",
26
+ "selector": "input[name=project-name]",
27
+ "value": "Release notes",
28
+ "pause": 700,
29
+ "caption": "为这次发布起个名字"
30
+ },
31
+ {
32
+ "action": "click",
33
+ "role": "button",
34
+ "name": "Sprint",
35
+ "pause": 900,
36
+ "caption": "选择团队的工作模板"
37
+ },
38
+ {
39
+ "action": "click",
40
+ "role": "button",
41
+ "name": "Create project",
42
+ "pause": 1000,
43
+ "zoom": false,
44
+ "caption": "新项目已准备就绪"
45
+ },
46
+ { "action": "waitFor", "selector": "#project-grid .project-name:text-is('Release notes')" }
47
+ ]
48
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "displayUrl": "northstar.app",
3
+ "video": "recording.mp4",
4
+ "marks": [
5
+ {
6
+ "t": 2.07,
7
+ "x": 0.946,
8
+ "y": 0.048,
9
+ "caption": "Start a new project",
10
+ "zoom": false
11
+ },
12
+ {
13
+ "t": 4.13,
14
+ "x": 0.5,
15
+ "y": 0.468,
16
+ "caption": "Give it a name"
17
+ },
18
+ {
19
+ "t": 6.3,
20
+ "x": 0.592,
21
+ "y": 0.563,
22
+ "caption": "Pick a template"
23
+ },
24
+ {
25
+ "t": 8.01,
26
+ "x": 0.594,
27
+ "y": 0.635,
28
+ "caption": "Done — ready for the team",
29
+ "zoom": false
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "url": "http://127.0.0.1:4173",
3
+ "displayUrl": "northstar.app",
4
+ "viewport": { "width": 1440, "height": 810 },
5
+ "scale": 1,
6
+ "initialWait": 900,
7
+ "tail": 1200,
8
+ "brand": {
9
+ "background": "#070a12",
10
+ "accent": "#6c5ce7"
11
+ },
12
+ "steps": [
13
+ { "action": "wait", "ms": 600 },
14
+ {
15
+ "action": "click",
16
+ "text": "New project",
17
+ "pause": 600,
18
+ "zoom": false,
19
+ "caption": "Start a new project"
20
+ },
21
+ { "action": "wait", "ms": 900 },
22
+ {
23
+ "action": "type",
24
+ "selector": "input[name=project-name]",
25
+ "value": "Q4 Launch",
26
+ "pause": 350,
27
+ "caption": "Give it a name"
28
+ },
29
+ { "action": "wait", "ms": 900 },
30
+ {
31
+ "action": "click",
32
+ "text": "Campaign",
33
+ "pause": 400,
34
+ "caption": "Pick a template"
35
+ },
36
+ { "action": "wait", "ms": 800 },
37
+ {
38
+ "action": "click",
39
+ "text": "Create project",
40
+ "pause": 900,
41
+ "zoom": false,
42
+ "caption": "Done — ready for the team"
43
+ },
44
+ { "action": "wait", "ms": 1500 }
45
+ ]
46
+ }
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@gnawbit/tabretake",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.1",
4
+ "description": "Create repeatable web app demos, README GIFs and 9:16 videos from editable JSON steps or existing screen recordings. Local CLI and Agent Skill for Claude Code, Codex and Cursor.",
5
+ "type": "module",
6
+ "bin": {
7
+ "tabretake": "bin/tabretake.mjs"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "scripts/",
12
+ "schemas/",
13
+ "references/",
14
+ "agents/",
15
+ "examples/site/",
16
+ "examples/stories/",
17
+ "examples/story.json",
18
+ "examples/story-video.json",
19
+ "SKILL.md",
20
+ "README.zh-CN.md",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "scripts": {
24
+ "test": "node --test",
25
+ "doctor": "node bin/tabretake.mjs doctor",
26
+ "serve": "node bin/tabretake.mjs serve",
27
+ "demo": "node bin/tabretake.mjs demo"
28
+ },
29
+ "keywords": [
30
+ "demo",
31
+ "video",
32
+ "gif",
33
+ "playwright",
34
+ "ffmpeg",
35
+ "agent-skill",
36
+ "claude-code",
37
+ "codex",
38
+ "product-launch"
39
+ ],
40
+ "license": "MIT",
41
+ "author": "gnawbit",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+ssh://git@github.com/gnawbit/tabretake.git"
45
+ },
46
+ "homepage": "https://gnawbit.github.io/tabretake/",
47
+ "bugs": {
48
+ "url": "https://github.com/gnawbit/tabretake/issues"
49
+ },
50
+ "engines": {
51
+ "node": ">=20.9.0"
52
+ },
53
+ "dependencies": {
54
+ "@ffmpeg-installer/ffmpeg": "^1.1.0",
55
+ "@ffprobe-installer/ffprobe": "^1.1.0",
56
+ "ajv": "^8.20.0",
57
+ "playwright": "^1.64.1",
58
+ "sharp": "^0.35.5"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public",
62
+ "registry": "https://registry.npmjs.org"
63
+ }
64
+ }
@@ -0,0 +1,77 @@
1
+ # Recording input and rendering
2
+
3
+ For a site that cannot be automated, or a desktop/mobile demonstration, use an
4
+ existing screen recording. Obtain timestamps from the user or inspect the video;
5
+ do not silently guess the moments to highlight.
6
+
7
+ Rendering uses FFmpeg, ffprobe and Sharp; it does not launch Chromium. A missing
8
+ browser in `doctor --json` alone does not block this workflow. Other required
9
+ checks still apply, and missing fonts need visual inspection of captions.
10
+
11
+ ```json
12
+ {
13
+ "displayUrl": "your-app.com",
14
+ "video": "recording.mp4",
15
+ "marks": [
16
+ { "t": 2.1, "x": 0.5, "y": 0.4, "duration": 0, "caption": "Start a project" },
17
+ { "t": 4.8, "zoom": false, "caption": "Ready for the team" }
18
+ ]
19
+ }
20
+ ```
21
+
22
+ ```bash
23
+ tabretake validate --config story-video.json --json
24
+ tabretake render --config story-video.json --video recording.mp4 --vertical --json
25
+ ```
26
+
27
+ `video` in the config is relative to the config file; `--video` is relative to
28
+ the current working directory. Marks use **seconds**. Prefer normalized `x`, `y`
29
+ coordinates from 0 to 1; larger values are source pixels. `duration` delays the
30
+ caption onset after the mark (default 0.6 seconds); `0` shows it immediately.
31
+ It does not set the caption's display duration. Captions last up to 2.8 seconds,
32
+ ending earlier at the next caption or video end.
33
+
34
+ Rendering a recorded browser flow takes its `record.json` timeline instead.
35
+ For style edits, update that file's nested `config`; changing only the original
36
+ story will not update a saved timeline. Re-record for changed browser actions.
37
+
38
+ ## Camera, posters and portrait branding
39
+
40
+ - `--zoom 1.28` sets focus magnification.
41
+ - From v0.4.1, `vertical.zoom` or `--vertical-zoom 1.8` sets portrait
42
+ focus magnification independently (1–10). The flag overrides config; when
43
+ neither is set it follows `--zoom`. Check capabilities before using the flag.
44
+ - `zoomDuration` or `--zoom-duration 0.5` sets transition seconds; `0` uses cuts.
45
+ - `posterAt` or `--poster-at 4.5` selects an output time strictly before the end.
46
+ Without it, the poster is chosen near the end.
47
+ - `--vertical` adds portrait outputs; `--no-gif` skips GIFs; `--no-captions`
48
+ suppresses captions and font-based portrait text.
49
+
50
+ Portrait cards fit the source video's aspect ratio between the title and captions.
51
+ From v0.4.1, landscape recordings also fit their source aspect ratio,
52
+ with captions below the content. Zooming still intentionally crops the source.
53
+ For a responsive mobile UI, record with a narrow viewport such as `390x844`;
54
+ inspect the page with `plan --viewport 390x844` before recording at that size.
55
+ Use `--zoom 1` to retain the full viewport. Larger zoom values intentionally crop
56
+ around each focus point. A wide desktop recording still has small text in a
57
+ portrait card; re-record a focused flow at a suitable viewport when needed.
58
+
59
+ Branding belongs at the top of a story/marks config, or inside a timeline's `config`:
60
+
61
+ ```json
62
+ {
63
+ "brand": { "background": "#070a12", "accent": "#6c5ce7" },
64
+ "vertical": {
65
+ "badge": "Your product",
66
+ "titleLines": ["Ship faster", "with less busywork"],
67
+ "subtitle": "Local and repeatable",
68
+ "cta": "your-app.com",
69
+ "watermark": false
70
+ }
71
+ }
72
+ ```
73
+
74
+ Use at most two title lines. Captions wrap and fit within the frame; excessively
75
+ long captions produce an error. Chinese text needs a CJK font such as Microsoft
76
+ YaHei, PingFang or Noto Sans CJK. Font warnings do not stop rendering, so inspect
77
+ the poster and video for missing glyphs. Videos have no audio track.
@@ -0,0 +1,80 @@
1
+ # Story authoring
2
+
3
+ Use `plan` output to select controls for the requested flow. From v0.3.3, `label`
4
+ resolves ARIA references and HTML labels; native select `options` provide labels,
5
+ values and disabled states. Older versions omit these fields; use the plan
6
+ screenshot and existing control metadata instead. The plan's `name` remains the
7
+ HTML attribute, not a computed accessible name. This DOM inventory is not a complete accessibility
8
+ tree. Use the supplied `selector` when the intended locator is uncertain.
9
+
10
+ An editable story:
11
+
12
+ ```json
13
+ {
14
+ "url": "https://your-app.com",
15
+ "viewport": { "width": 1440, "height": 810 },
16
+ "initialWait": 700,
17
+ "tail": 1200,
18
+ "steps": [
19
+ { "action": "click", "role": "button", "name": "New project", "zoom": false },
20
+ { "action": "waitFor", "selector": "input[name=project-name]" },
21
+ { "action": "type", "selector": "input[name=project-name]", "value": "Launch", "caption": "Give it a name" },
22
+ { "action": "click", "text": "Create project", "caption": "Your workspace is ready", "zoom": false },
23
+ { "action": "waitFor", "text": "Launch" }
24
+ ]
25
+ }
26
+ ```
27
+
28
+ `initialWait`, `tail`, step `ms`, `pause` and `timeout` use **milliseconds**.
29
+ `posterAt` and `zoomDuration` use **seconds**. Validate with the packaged
30
+ [schema](../schemas/story.schema.json); unknown fields are errors.
31
+
32
+ | Action | Fields |
33
+ |---|---|
34
+ | `wait` | `ms` |
35
+ | `goto` | `url`, `pause` |
36
+ | `click`, `hover` | locator, `pause`, `caption`, `zoom` |
37
+ | `focus` | locator, `pause`, `caption`, `zoom`; measure the target after scrolling into view |
38
+ | `type` | locator, `value`, `pause`, `caption`, `zoom` |
39
+ | `drag` | locator, `dx`, `dy`, `steps`, `pause`, `caption`, `zoom` |
40
+ | `scroll` | `y`, `pause`, `caption`, `zoom` |
41
+ | `press` | `key`, `pause`, `caption`, `zoom` |
42
+ | `waitFor` | `selector`, `text` or `url`; optional `timeout`, `pause` |
43
+ | `screenshot` | `file`, relative to the output directory |
44
+
45
+ Locator fields are `selector`, `role` + `name` (or `text`), `name`, or `text`.
46
+ An explicit selector is tried first. From v0.4.0, a supplied
47
+ role restricts name matching to that role, exact before partial. Without a role,
48
+ try exact button/link candidates, partial button/link candidates, then plain text
49
+ (exact before partial). This keeps noninteractive headings behind controls. Each candidate
50
+ selects its first visible match; hidden exact matches do not block a visible
51
+ partial match. Use a scoped selector when labels repeat or overlap.
52
+ On v0.3.3 and earlier, partial buttons may beat exact links: use a selector such
53
+ as `a[href='#/completed']` for “Completed” beside a “Clear completed” button.
54
+ Story steps do not have a dedicated iframe locator. `type` clears the field
55
+ before typing.
56
+
57
+ From v0.3.3, `click` waits for an enabled, unobstructed target;
58
+ its optional `timeout` is in milliseconds (default 20,000). Persistent blocking
59
+ returns `STEP_TIMEOUT`. v0.3.2 and earlier do not reliably wait for clickable
60
+ targets. A successful click does not prove the app finished processing it;
61
+ continue to use `waitFor` for the expected result.
62
+
63
+ Use `waitFor` for a visible result before the next interaction. Give captions
64
+ and focus targets explicit pauses. `focus` frames the target without clicking it;
65
+ add another focus step after the layout changes. Use `preview --config story.json`
66
+ to execute steps before recording. Preview performs actual app changes, so reset
67
+ demo data before a retake. It preserves recordings and writes explicit screenshots.
68
+ Use rendered output to check camera framing. Give captions
69
+ time to be read; they begin after the interaction and replace the previous
70
+ caption. In v0.3.1 or newer, an action's `pause` provides reading time
71
+ after its caption starts. With older releases, set `pause: 0` and add a separate
72
+ `wait` step to avoid delaying the caption. Re-record older stories to get the
73
+ new timing; saved timelines keep their original timestamps.
74
+ Set `zoom: false` when the result is elsewhere on screen. Avoid
75
+ recording a blank initial load or ending on an unfinished dialog.
76
+
77
+ To improve blurry output, record at a larger viewport such as 1920x1080.
78
+ If text does not fit, shorten the caption or split it across meaningful steps.
79
+ If a selector fails, inspect the reported step and refresh the page plan rather
80
+ than guessing at selectors or increasing every timeout.