@gnawbit/tabretake 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.
@@ -0,0 +1,493 @@
1
+ # TabRetake — 可重复生成的 Web 应用演示
2
+
3
+ [English](README.md) · 简体中文
4
+
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+ [![Node](https://img.shields.io/badge/node-%3E%3D20.9-339933?logo=node.js&logoColor=white)](package.json)
7
+ [![最新发行版](https://img.shields.io/github/v/release/gnawbit/tabretake?label=latest%20release&color=6c5ce7)](https://github.com/gnawbit/tabretake/releases/latest)
8
+ [![Agent skill](https://img.shields.io/badge/agent%20skill-Claude%20Code%20%7C%20Codex%20%7C%20Cursor-6c5ce7)](SKILL.md)
9
+
10
+ **把 Web 应用录成 README 动图或竖屏发布视频。**
11
+
12
+ <img src="docs/hero.gif" alt="TabRetake 自动录屏、点击放大、加字幕" width="100%">
13
+
14
+ [项目页](https://gnawbit.github.io/tabretake/) · [观看演示](docs/hero.mp4) · [安装](#安装) · [工作原理](#工作原理) · [路线图](#路线图)
15
+
16
+ TabRetake 是在本地生成可重复网页演示的 CLI 和 Agent Skill。用可编辑 JSON
17
+ 描述操作流程,或让编程助手代写;在 Chromium 中执行步骤,添加点击放大和字幕,
18
+ 导出横屏或竖屏 MP4、README GIF 和 PNG 封面。支持 Windows、macOS 和 Linux。
19
+
20
+ 故事文件与代码一起保存,界面更新后即可重新生成演示。
21
+ 已有录屏也可配合时间标记渲染相同产物,无需浏览器自动化;详见[用已有录屏](#用已有录屏)。
22
+
23
+ [TodoMVC 实例](https://gnawbit.github.io/tabretake/todomvc/)提供固定版本的上游应用、
24
+ 可下载故事及实测的 README GIF / 9:16 制作流程。
25
+
26
+ [Agent 发现与调用实测](docs/agent-discovery.md) 分别记录搜索可见性、Skill 选择
27
+ 和产物成功情况,不将这些测试当作外部采用。
28
+
29
+ > 支持 Claude Code、Codex、Cursor,以及任何支持
30
+ > [Agent Skills](https://agentskills.io) 的 agent。
31
+
32
+ ---
33
+
34
+ ## 为什么做这个
35
+
36
+ 每个产品发布都需要一条演示:
37
+
38
+ - README 顶部的一张 GIF
39
+ - 官网 hero 区的一段视频
40
+ - 用于产品发布和社交分享的短片
41
+ - 新用户引导里的操作演示
42
+
43
+ 用故事文件记录演示流程,您或编程助手都可以编辑,并在发布新版本后重新生成素材。
44
+
45
+ **你会得到**
46
+
47
+ - 1080p MP4 + GIF + 封面,**16:9 和 9:16**
48
+ - 每次点击自动放大
49
+ - 光标和点击波纹
50
+ - 讲收益、不讲按钮名字的字幕
51
+ - 浏览器边框和生成的背景
52
+ - 可重渲染的 `record.json` 时间线
53
+ - 全部在本机完成,不上传、不联网渲染
54
+
55
+ ### 输出格式
56
+
57
+ | 16:9 — README / 官网 | 9:16 — 竖屏发布短片 |
58
+ |---|---|
59
+ | <img src="docs/poster.png" alt="16:9 演示封面" width="100%"> | <img src="docs/poster-9x16.png" alt="9:16 竖屏演示封面" width="100%"> |
60
+
61
+ [16:9 MP4](docs/hero.mp4) · [9:16 MP4](docs/hero-9x16.mp4) · [9:16 GIF](docs/hero-9x16.gif)
62
+
63
+ ## 安装
64
+
65
+ 从本仓库的 v0.4.0 正式标签安装 CLI。
66
+
67
+ ```bash
68
+ npm install --global git+https://github.com/gnawbit/tabretake.git#v0.4.0
69
+ tabretake setup
70
+ tabretake demo
71
+ ```
72
+
73
+ 要求 Node 20.9+ 和 Git。可以在工作目录运行 `tabretake`,内置示例会将结果写入
74
+ `./demo`。Linux 若缺少浏览器系统依赖,可用 `tabretake setup --with-deps`。
75
+ ffmpeg/ffprobe 随依赖安装。
76
+
77
+ 包名为 `@gnawbit/tabretake`,目前通过 GitHub 分发。
78
+ `v0.3.3` 及更早版本的命令和 Skill 仍叫 `demo-reel`。
79
+ 安装新版后,现有 JSON 故事可以直接用 `tabretake` 运行。
80
+
81
+ 参与开发时,从源码安装:
82
+
83
+ ```bash
84
+ git clone https://github.com/gnawbit/tabretake
85
+ cd tabretake
86
+ npm ci
87
+ node bin/tabretake.mjs setup
88
+ node bin/tabretake.mjs doctor
89
+ ```
90
+
91
+ 以下示例使用源码目录;全局安装后,将 `node bin/tabretake.mjs` 替换为 `tabretake` 即可。
92
+
93
+ CLI 环境就绪后,可安装 agent 工作流:
94
+
95
+ ```bash
96
+ npx skills@1.9.0 add "https://github.com/gnawbit/tabretake.git#v0.4.0" --skill tabretake
97
+ ```
98
+
99
+ 在目标项目中运行,可加 `--agent codex`、`--agent claude-code` 或 `--agent cursor`
100
+ 选择客户端。Skills CLI 1.9.0 需要 Node 22.20+,TabRetake 自身需要 Node 20.9+。
101
+ 将全局 CLI 或源码目录的位置告知编程助手,CLI 和 Skill 应从同一修订版本安装。
102
+
103
+ Claude Code 也可以通过插件安装(命令行版本需 2.1.292+):
104
+
105
+ ```bash
106
+ claude plugin install tabretake --marketplace "gnawbit/tabretake#v0.4.0"
107
+ ```
108
+
109
+ 两种工作流安装方式任选其一;插件仍需先安装上述 TabRetake 运行环境。
110
+ 它是 Claude Code 插件,不是 Cowork 安装包或 MCP 服务。
111
+ [发现与调用验证记录](docs/agent-discovery.md)区分了已经验证的能力和尚未测量的效果。
112
+ 可这样向编程助手提问:
113
+
114
+ - “把 http://localhost:3000 的注册流程做成 README 动图。”
115
+ - “为我的 Web 应用制作带字幕的竖屏发布演示。”
116
+ - “界面更新了,按原流程重新生成产品演示。”
117
+
118
+ 编程助手会编写故事并调用 CLI;处理已有录屏时,需要提供视频和要突出的时间点。
119
+
120
+ ## 快速开始
121
+
122
+ ```bash
123
+ # 1. 检查环境
124
+ node bin/tabretake.mjs doctor
125
+
126
+ # 2. 跑一遍内置 demo
127
+ node bin/tabretake.mjs demo
128
+
129
+ # 3. 录你自己的产品
130
+ node bin/tabretake.mjs plan --url https://your-app.com
131
+ node bin/tabretake.mjs init --url https://your-app.com
132
+ ```
133
+
134
+ 参考 `plan.json` 中的控件,在生成的 `demo.json` 中添加点击、输入等操作。
135
+ 初始模板只停留在页面上,不会自动编排流程,也不会覆盖已有故事文件。
136
+ 可用 `--out stories/demo.json` 指定其他路径。
137
+
138
+ v0.3.3 起,`label` 来自 ARIA 引用或 HTML 标签;原生下拉框的 `options`
139
+ 包含 `label`、`value` 和 `disabled`,方便识别控件与选项。`name` 仍是 HTML 属性,
140
+ `selector` 是建议使用的 CSS 定位器。这是 DOM 清单,不是完整的无障碍树。
141
+
142
+ ```bash
143
+ node bin/tabretake.mjs record --config demo.json
144
+ node bin/tabretake.mjs render --config demo/record.json --vertical
145
+ ```
146
+
147
+ 输出:
148
+
149
+ ```
150
+ demo/
151
+ demo-16x9.mp4
152
+ demo-9x16.mp4
153
+ demo.gif
154
+ demo-9x16.gif
155
+ poster.png
156
+ poster-9x16.png
157
+ record.json
158
+ ```
159
+
160
+ ## 故事文件
161
+
162
+ ### 预览与聚焦
163
+
164
+ 录制前运行 `tabretake preview --config demo.json`,可在可见浏览器中执行故事并查看步骤进度。
165
+ 预览会实际点击和修改应用数据,请使用演示数据并在录制前重置。
166
+ 已有录制会保留,只有显式 `screenshot` 步骤写出截图。
167
+ 自动化可加 `--headless --json`,登录后流程可加 `--storage-state auth.json`。
168
+
169
+ 操作后先等待结果出现,再把镜头聚焦到结果元素。
170
+ 聚焦坐标在目标滚入视口后测量,在 `pause` 期间保持;后续布局变化后可再加一个聚焦步骤。
171
+
172
+ ```json
173
+ [
174
+ { "action": "waitFor", "selector": "#result" },
175
+ { "action": "focus", "selector": "#result", "caption": "结果已生成", "pause": 1200 }
176
+ ]
177
+ ```
178
+
179
+ 预览检查浏览器操作,缩放和字幕效果需要检查实际渲染成片。
180
+
181
+ ```json
182
+ {
183
+ "url": "https://your-app.com",
184
+ "displayUrl": "your-app.com",
185
+ "viewport": { "width": 1440, "height": 810 },
186
+ "brand": { "background": "#070a12", "accent": "#6c5ce7" },
187
+ "steps": [
188
+ { "action": "wait", "ms": 600 },
189
+ {
190
+ "action": "click",
191
+ "text": "New project",
192
+ "pause": 600,
193
+ "zoom": false,
194
+ "caption": "一键开始"
195
+ },
196
+ { "action": "wait", "ms": 900 },
197
+ {
198
+ "action": "type",
199
+ "selector": "input[name=project-name]",
200
+ "value": "Q4 Launch",
201
+ "pause": 350,
202
+ "caption": "起个名字"
203
+ },
204
+ { "action": "wait", "ms": 900 },
205
+ {
206
+ "action": "click",
207
+ "text": "Create project",
208
+ "pause": 900,
209
+ "zoom": false,
210
+ "caption": "工作区已就绪"
211
+ }
212
+ ]
213
+ }
214
+ ```
215
+
216
+ 动作:`wait`、`goto`、`click`、`type`、`hover`、`focus`、`drag`、`scroll`、`press`、`waitFor`、`screenshot`。
217
+
218
+ v0.3.3 起,`click` 会等待目标启用且不被遮挡。步骤 `timeout`
219
+ 使用毫秒,默认 20,000;持续阻挡会返回 `STEP_TIMEOUT`。v0.3.2 及更早版本
220
+ 没有这项可靠的可点击等待。
221
+
222
+ 定位字段为 `selector`、`role` + `name`(或 `text`)、`name` 或 `text`。
223
+ 显式 `selector` 优先。从 v0.4.0 起,先精确匹配按钮与链接,再部分匹配
224
+ 按钮与链接,最后尝试普通文字(先精确后部分)。指定 `role` 时只在该角色中匹配,
225
+ 名称同样先精确后部分。
226
+ 每个候选取首个可见元素。标签重复或重叠时,使用限定范围的 CSS 选择器。
227
+ v0.3.3 及更早版本可能让部分匹配的按钮先于精确匹配的链接:页面同时有
228
+ “Clear completed” 按钮时,用 `selector: "a[href='#/completed']"`
229
+ 代替单独的 `text: "Completed"`。
230
+
231
+ 技巧:
232
+
233
+ - 3–5 步,12–25 秒。
234
+ - 每个动作后加一小段 `wait`,让结果和字幕落地。
235
+ - 如果结果在屏幕别处,用 `"zoom": false` 拉回全景。
236
+ - 字幕讲收益,不讲“点击按钮”。
237
+
238
+ 字幕会自动换行,并在需要时适度缩小字号。无法保持可读字号时,
239
+ 渲染会提示缩短文字或拆到多个步骤中;下一条字幕出现时,上一条会立即结束。
240
+
241
+ ### 镜头移动
242
+
243
+ 点击缩放默认用 0.35 秒平滑过渡。在故事或录屏标记配置顶层设置
244
+ `"zoomDuration": 0.5`,或用 `render --config demo/record.json --zoom-duration 0.5`
245
+ 覆盖。设为 `0` 可直接切换;步骤中的 `"zoom": false` 会拉回全景。
246
+ 连续点击会从当前镜头位置接续。
247
+
248
+ ### 封面
249
+
250
+ 封面默认取接近片尾的一帧,展示操作结果。在故事或录屏标记配置的顶层设置
251
+ `"posterAt": 4.5` 可以指定画面;已有时间线可用
252
+ `render --config demo/record.json --poster-at 4.5` 覆盖,无需重新录制。
253
+ 时间从裁剪后成片的第 0 秒开始,必须小于视频时长。
254
+
255
+ ### 竖屏品牌配置
256
+
257
+ 9:16 可以带自定义钩子和 CTA:
258
+
259
+ ```json
260
+ "vertical": {
261
+ "badge": "你的产品",
262
+ "titleLines": ["一句话钩子", "第二行补充"],
263
+ "subtitle": "Windows 原生 · 本地处理",
264
+ "cta": "your-app.com",
265
+ "watermark": false
266
+ }
267
+ ```
268
+
269
+ `titleLines` 最多两行;`watermark: false` 会去掉底部的小 TabRetake 水印。
270
+ 中文会自动用 CJK 字体。
271
+
272
+ v0.3.2 起,竖屏卡片按源视频比例适配。移动端流程可先用
273
+ `plan --viewport 390x844` 检查布局,再用相同 viewport 录制。
274
+ 渲染时加 `--vertical --zoom 1` 保留完整视口;更大的缩放会围绕焦点裁切。
275
+ 宽屏桌面录屏中的细字仍可能偏小。
276
+
277
+ ## 命令
278
+
279
+ | 命令 | 作用 |
280
+ |---|---|
281
+ | `tabretake --version` | 输出已安装 CLI 的版本 |
282
+ | `tabretake capabilities --json` | 查询支持的命令、参数及 JSON 输出 |
283
+ | `tabretake doctor [--json]` | 检查 Node、Chromium、ffmpeg、字体 |
284
+ | `tabretake setup` | 安装与当前 CLI 匹配的 Chromium |
285
+ | `tabretake init --url <url>` | 创建可编辑的故事文件 |
286
+ | `tabretake validate --config demo.json [--json]` | 预检故事、录屏标记或录制时间线 |
287
+ | `tabretake plan --url <url>` | 截图 + 列出可交互元素 |
288
+ | `tabretake record --config demo.json` | 录制故事 |
289
+ | `tabretake preview --config demo.json` | 在可见浏览器中执行步骤,提前检查故事 |
290
+ | `tabretake render --config demo/record.json` | 渲染 MP4 + GIF |
291
+ | `tabretake serve` | 启动内置 demo 站点 |
292
+ | `tabretake demo` | 录制 + 渲染内置 demo |
293
+
294
+ Agent 可用 `capabilities --json` 和 `doctor --json` 获取标准输出上的单个 JSON
295
+ 对象,包含 `schemaVersion: 1` 和已安装版本。诊断包含稳定的 `id`、`required`、
296
+ `status`,失败时提供修复提示 `hint`。必需检查失败返回退出码 `1`;缺少字体仅警告,
297
+ 必需项通过时退出码仍为 `0`。Chromium 仅检查是否安装,不实际启动。
298
+ JSON 工作流及配置校验需要 v0.3.0 或更新版本。
299
+
300
+ `doctor` 检查整个工具链。渲染现有录屏或已保存的时间线不需要 Chromium;
301
+ 若唯一失败的必需项是 `chromium`,可跳过浏览器安装,继续 `validate` 和
302
+ `render`,其他必需项错误仍需先修复。网页规划和录制仍需要 Chromium。
303
+
304
+ 录制前运行 `validate --config demo.json --json`,按随包提供的
305
+ [JSON Schema](schemas/story.schema.json) 检查类型、动作、必需目标和未知字段。
306
+ 失败返回退出码 `1`,错误包含 `code`、JSON Pointer 路径 `path`(如
307
+ `/steps/0/action`)、`message` 和 `hint`;JSON 语法或文件读取错误使用 `error` 对象。
308
+ 预检不会启动浏览器,也不验证选择器、登录态或媒体文件是否可用。
309
+ `record` 和 `render` 也会在改写输出文件前校验输入。编辑器补全可在配置中加入
310
+ `"$schema": "https://raw.githubusercontent.com/gnawbit/tabretake/main/schemas/story.schema.json"`。
311
+
312
+ 常用参数:
313
+
314
+ `init`、`plan`、`record`、`render` 也支持 `--json`:标准输出只有一个结果对象,
315
+ 进度写入标准错误。成功结果包含 `command`、`ok`、`version`、`schemaVersion`,
316
+ 以及列出绝对路径、类型、字节数的 `artifacts`。步骤失败提供从零开始的
317
+ `error.step.index`、动作、JSON Pointer 路径及修复提示,修正后再重试。
318
+ 手动 `--login` 需在交互终端运行且不带 `--json`,自动调用使用 `--storage-state`。
319
+ 失败可能留下部分文件;应以本次成功结果的产物清单确认输出。
320
+
321
+ v0.3.1 起将页面导航失败报告为 `PAGE_UNREACHABLE`,提示检查
322
+ URL、服务和网络;HTTP 4xx/5xx 返回 `PAGE_HTTP_ERROR` 与 `error.status`,
323
+ 避免把错误页录成成功演示。这类错误不回显目标 URL 中的凭据或查询参数。
324
+ `doctor` 只检查依赖,不能证明目标应用可访问。
325
+
326
+ v0.3.2 起,手动 `--login` 的导航异常也不回显目标 URL;HTTP 401/403
327
+ 页面会保留供登录,其他 HTTP 错误会停止命令。
328
+
329
+ v0.3.1 起已修正字幕时序:动作完成即显示字幕,随后 `pause` 留出阅读时间。
330
+ v0.3.0 可用 `pause: 0` 加独立 `wait` 步骤代替。旧时间线需重新录制才能获得
331
+ 新时序,仅重新渲染会保留原时间戳。
332
+
333
+ ```bash
334
+ --login # 打开有头浏览器,手动登录一次
335
+ --storage-state auth.json
336
+ --proxy http://127.0.0.1:10808
337
+ --viewport 1440x810
338
+ --headed # 看着它录
339
+ --vertical # 同时输出 9:16 和竖屏 GIF
340
+ --video recording.mp4 # 渲染已有录屏 + marks
341
+ --no-gif
342
+ --no-captions
343
+ --zoom 1.28
344
+ ```
345
+
346
+ ## 登录和受保护页面
347
+
348
+ ```bash
349
+ node bin/tabretake.mjs record --config demo.json --login
350
+ ```
351
+
352
+ 请在可交互终端运行。浏览器打开后手动登录,登录态保存在本地 `auth.json`,
353
+ 供本次录制使用。后续运行,或先用 `plan --login` 登录后,必须显式传入:
354
+
355
+ ```bash
356
+ node bin/tabretake.mjs record --config demo.json --storage-state auth.json
357
+ ```
358
+
359
+ 切换工作目录时请使用登录态文件的绝对路径。TabRetake 不会向你要密码,也不会
360
+ 上传 cookie。不要将登录态提交到 Git。
361
+
362
+ ## 工作原理
363
+
364
+ <img src="docs/architecture.svg" alt="故事文件进入 Playwright 录制,生成事件时间线和 webm,再由 sharp + ffmpeg 渲染成 MP4、GIF 和封面" width="100%">
365
+
366
+ 1. `plan` 打开页面,列出按钮、链接和输入框。
367
+ 2. `record` 驱动 Chromium,移动光标、点击、输入、录屏。
368
+ 3. 点击时间戳变成缩放关键帧。
369
+ 4. `render` 裁出点击区域,把同一条时间线分别合成到 16:9 浏览器画布和 9:16 竖屏卡片,再用 ffmpeg 编码。
370
+
371
+ 因为驱动的是真实浏览器,React、Vue、Svelte、纯 HTML、SPA 和登录后的页面都能录。
372
+
373
+ ## 示例
374
+
375
+ 真实开源应用案例包括 [Vikunja](https://gnawbit.github.io/tabretake/vikunja/) 的任务创建与看板拖拽,
376
+ 以及 [Memos](https://gnawbit.github.io/tabretake/memos/) 的富文本笔记与搜索。
377
+ 案例固定上游原版发行包,提供故事下载、本机搭建和重复录制方法。
378
+
379
+ [手动演示工作流](.github/workflows/demo.yml) 会启动固定版本的 TodoMVC、等待服务就绪、
380
+ 录制故事并上传 MP4、GIF 和封面附件。在自己的 fork 中选择
381
+ **Actions → Regenerate TodoMVC demo → Run workflow** 即可运行。
382
+ 接入自己的应用时,替换应用检出与启动命令、就绪检测地址和故事文件。
383
+ 使用可重置的演示数据,并在发布前检查成片。
384
+
385
+ | 示例 | 故事 | 输出 |
386
+ |---|---|---|
387
+ | Northstar SaaS dashboard | [examples/story.json](examples/story.json) | [16:9 MP4](docs/hero.mp4) · [9:16 MP4](docs/hero-9x16.mp4) · [GIF](docs/hero.gif) |
388
+
389
+ Northstar 是内置的虚构应用。三个[可运行示例](examples/README.md)分别展示
390
+ README 动图、首次创建项目,以及重复生成发布素材。从源码目录运行(全局安装可将前缀替换为 `tabretake`):
391
+
392
+ ```bash
393
+ node bin/tabretake.mjs demo --story readme --port 0 --out demo-readme
394
+ node bin/tabretake.mjs demo --story onboarding --port 0 --out demo-onboarding
395
+ node bin/tabretake.mjs demo --story release --port 0 --out demo-release
396
+ ```
397
+
398
+ ## 用已有录屏
399
+
400
+ 如果站点有验证码、强反爬,或者你要演示的是桌面 App / 手机 App,先用 OBS、
401
+ Screen Studio、QuickTime 或系统录屏录下来,再用 `marks` 描述哪里该放大:
402
+
403
+ ```json
404
+ {
405
+ "displayUrl": "your-app.com",
406
+ "video": "recording.mp4",
407
+ "marks": [
408
+ {
409
+ "t": 2.1,
410
+ "x": 0.946,
411
+ "y": 0.048,
412
+ "caption": "一键开始",
413
+ "zoom": false
414
+ },
415
+ {
416
+ "t": 4.1,
417
+ "x": 0.5,
418
+ "y": 0.468,
419
+ "caption": "起个名字"
420
+ }
421
+ ]
422
+ }
423
+ ```
424
+
425
+ - `t`:录屏里的秒数
426
+ - `x` / `y`:归一化 `0..1`;`zoom: false` 表示这一步保持全景
427
+ - `duration`:字幕相对 `t` 的出现延迟,单位为秒,默认 `0.6`;设为 `0` 即在标记处出现,不是字幕停留时间。
428
+ - 字幕最多显示 2.8 秒;下一条字幕出现或视频结束时会提前结束。
429
+
430
+ ```bash
431
+ node bin/tabretake.mjs render \
432
+ --config story-video.json \
433
+ --video recording.mp4 \
434
+ --vertical
435
+ ```
436
+
437
+ 输出和网址录制完全一样:16:9 / 9:16 视频、GIF、封面。
438
+
439
+ 最小示例见 [examples/story-video.json](examples/story-video.json)。
440
+
441
+ ## 和 Screen Studio 的区别
442
+
443
+ | | Screen Studio | TabRetake |
444
+ |---|---|---|
445
+ | 工作流 | 手动剪辑 | 故事文件 + 一条命令 |
446
+ | 可重复 | 否 | 是 |
447
+ | 能进 CI | 否 | 是 |
448
+ | 价格 | 付费 | 免费,MIT |
449
+
450
+ 要逐帧精修,用 Screen Studio;要可重复、可提交、可自动化的发布素材,用 TabRetake。
451
+
452
+ ## 常见问题
453
+
454
+ **这是录屏软件吗?**
455
+ 不是。它是“故事文件 + 浏览器 + 渲染器”的可重复流水线,录屏只是副产物。
456
+
457
+ **Windows 能用吗?**
458
+ 能。项目就在 Windows 上开发,ffmpeg 用 npm 包自带二进制。
459
+
460
+ **必须用 AI agent 吗?**
461
+ 不必。CLI 可以独立使用;agent skill 只是让它自动读页面、写故事、跑命令。
462
+
463
+ **能录别人的网站吗?**
464
+ 只在获得授权时。不要用它抓取、绕过付费墙或规避反爬。
465
+
466
+ **中文字幕能正常显示吗?**
467
+ 能。TabRetake 会自动选 CJK 字体:Windows 用微软雅黑,macOS 用苹方,
468
+ Linux 用 Noto Sans CJK。`doctor` 会检查。
469
+
470
+ **输出可以商用吗?**
471
+ 可以。代码是 MIT。确保你录的页面、字体和素材是你自己的或已授权。
472
+
473
+ ## 路线图
474
+
475
+ - [x] 9:16 竖屏导出
476
+ - [x] 已有录屏输入(`--video` + `marks`)
477
+ - [ ] 配音(TTS)
478
+ - [ ] 设备边框(iPhone、Android、macOS)
479
+ - [ ] 多套品牌预设
480
+ - [ ] 云端渲染
481
+
482
+ ## 参与贡献
483
+
484
+ 欢迎 issue 和 PR,先看 [CONTRIBUTING.md](CONTRIBUTING.md)。
485
+ 请不要提交 `auth.json`、客户录屏或任何包含个人数据的文件。
486
+
487
+ ## License
488
+
489
+ MIT — 见 [LICENSE](LICENSE)。
490
+
491
+ ---
492
+
493
+ 如果它帮你省下了一个下午,点个 star 能让更多人看到。
package/SKILL.md ADDED
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: tabretake
3
+ description: Create repeatable product demo videos and README GIFs from a web app URL or an existing screen recording. Use when asked for a launch video, browser walkthrough, signup or onboarding demo, or to regenerate a demo after UI changes, including 产品演示、网页录屏、README 动图. Runs locally and exports MP4, GIF and posters in landscape or portrait. Requires a story script or recording marks. Not for general video editing, text-to-video generation, or browser test assertions.
4
+ license: MIT
5
+ metadata:
6
+ author: gnawbit
7
+ version: "0.4.0"
8
+ repository: https://github.com/gnawbit/tabretake
9
+ compatibility: Node.js 20.9+, Chromium via tabretake setup, Windows/macOS/Linux. Target app access is required. Rendering is local; dependency installation needs network access.
10
+ ---
11
+
12
+ # TabRetake by gnawbit
13
+
14
+ Use `tabretake preview --config story.json --headless --json` to check steps
15
+ before recording. It executes real app changes; reset demo data before a retake.
16
+ It preserves recordings and writes only explicitly requested screenshots.
17
+ After `waitFor`, use a `focus` step with a selector, caption and pause to frame a
18
+ result instead of the last clicked control. Inspect the rendered clip for framing.
19
+
20
+ Create a repeatable product walkthrough from a web URL, or render an existing
21
+ screen recording with supplied timestamps. The canonical project is
22
+ https://github.com/gnawbit/tabretake.
23
+ Outputs are local MP4, GIF and PNG posters in landscape and optional portrait.
24
+
25
+ ## Locate and check the CLI
26
+
27
+ Use an installed `tabretake` CLI when available. The commands below assume it is
28
+ on PATH. For a source checkout, replace `tabretake` with
29
+ `node /absolute/path/to/tabretake/bin/tabretake.mjs`; paths with spaces need quoting.
30
+ A copied Skill does not prove its runtime dependencies are installed. If needed,
31
+ clone the canonical repository separately and run `npm ci` there, or follow the
32
+ [CLI installation instructions](https://github.com/gnawbit/tabretake#install).
33
+ The renamed CLI and Skill are available together in v0.4.0. Releases through
34
+ `v0.3.3` use the command and Skill name `demo-reel`.
35
+
36
+ ```bash
37
+ tabretake --version
38
+ tabretake capabilities --json
39
+ tabretake doctor --json
40
+ ```
41
+
42
+ Query capabilities before choosing flags: old releases may not support them.
43
+ On v0.2.0, fall back to `help` and plain `doctor`, or update before using the
44
+ JSON workflow. `doctor` reports required errors and optional font warnings;
45
+ it checks Chromium's presence, not browser launch or app access. For web
46
+ planning/recording, run `tabretake setup` for missing Chromium; Linux may need
47
+ `setup --with-deps`. Rendering an existing recording or saved timeline does not
48
+ need Chromium: if `chromium` is the only failed required check, continue to
49
+ validate/render without installing a browser. Fix other required errors first.
50
+ Node.js 20.9+ is required. Chinese captions need a CJK system font.
51
+
52
+ ## Choose the input
53
+
54
+ - **Web app:** confirm the URL and intended flow. `plan` inventories controls;
55
+ it does not write a story. Use a test account and non-sensitive demo data.
56
+ - **Existing recording:** get the file and moments to highlight. Read
57
+ [recording input and branding](references/rendering.md); do not invent marks.
58
+ - **Example requested:** `tabretake demo --story readme|onboarding|release --port 0`
59
+ runs a fictional bundled app. It is a template, not evidence of external adoption.
60
+
61
+ Ask only for missing details that affect the result, such as the target flow or
62
+ output orientation. Adapt the story length to the user's request; a few visible
63
+ state changes are usually enough for a short launch clip.
64
+
65
+ ## Record a web flow
66
+
67
+ 1. Inspect controls and create a starter if no story exists:
68
+
69
+ ```bash
70
+ tabretake plan --url https://your-app.com --out plan.json --json
71
+ tabretake init --url https://your-app.com --out demo.json --json
72
+ ```
73
+
74
+ 2. Read the plan file from its returned artifact path. Replace the starter's
75
+ wait-only steps with the requested flow. For actions, locator choices and
76
+ timing units, read [story authoring](references/story.md). `init` will not
77
+ overwrite a story. Prefer a visible result at the end and short benefit captions.
78
+ From v0.3.3, use `label` to identify form controls and native select `options`
79
+ to inspect their labels, values and disabled states. Older versions omit these
80
+ fields; use the plan screenshot and existing control metadata instead.
81
+ The plan's `name` is an HTML attribute, not necessarily an accessible name;
82
+ use `selector` when needed.
83
+ On v0.3.3 and earlier, use a scoped selector for overlapping labels: a
84
+ “Clear completed” button can match `text: "Completed"` before that exact link.
85
+ v0.4.0 prefers exact button/link labels and respects an explicit role;
86
+ see [locator behavior](references/story.md) before relying on this change.
87
+
88
+ 3. Validate, record and render:
89
+
90
+ ```bash
91
+ tabretake validate --config demo.json --json
92
+ tabretake record --config demo.json --out demo --json
93
+ tabretake render --config demo/record.json --vertical --json
94
+ ```
95
+
96
+ Omit `--vertical` for landscape only; add `--no-gif` if GIFs are unnecessary.
97
+ Use the returned timeline path if output goes elsewhere. Paths are resolved
98
+ from the current working directory unless documented otherwise; use absolute
99
+ paths when the CLI and target app live in different directories.
100
+
101
+ From v0.3.2, portrait cards fit the source aspect ratio. For a mobile flow,
102
+ inspect and record at a narrow viewport (for example `390x844`); use
103
+ `--zoom 1` to preserve the full viewport. Wide desktop text may still be small.
104
+
105
+ 4. Inspect the poster and video, then return links to the actual generated
106
+ artifacts. Re-record after flow changes; re-render the saved timeline after
107
+ caption, zoom or branding changes. Fonts and encoder versions can affect
108
+ appearance across machines. Output videos have no audio.
109
+
110
+ For caption reading time, use action `pause` on v0.3.1 or newer; on v0.3.0
111
+ use `pause: 0` followed by `wait`. Older recordings need to be recorded again
112
+ to adopt the corrected caption timing; re-rendering preserves their timestamps.
113
+
114
+ ## Interpret results and recover
115
+
116
+ `--json` writes one object to stdout; stderr carries progress. Check the exit
117
+ code and `ok`, then read `artifacts` for absolute paths, kinds and byte sizes.
118
+ Only a successful result describes the current run; failed runs may leave
119
+ partial files. `schemaVersion` identifies the response format, not the CLI release.
120
+
121
+ - `INVALID_CONFIG`: fix each `error.issues[].path` using the packaged
122
+ [JSON Schema](schemas/story.schema.json). The standalone `validate` command
123
+ returns an `errors` array for schema failures and an `error` object for file
124
+ or JSON syntax failures. It does not verify selectors, login or media access.
125
+ - `TARGET_NOT_FOUND`, `STEP_TIMEOUT`, `STEP_FAILED`: inspect `error.step.path`
126
+ and its zero-based index. Re-run `plan` with the same login state, update the
127
+ target or wait condition and retry. Do not repeat an unchanged failing command.
128
+ From v0.3.3, `click` also waits for an enabled, unobstructed
129
+ target using step `timeout` (milliseconds; default 20,000). v0.3.2 and earlier
130
+ do not reliably wait for clickable targets; inspect the resulting page.
131
+ - `PAGE_UNREACHABLE`: check the URL, local app server and browser network/proxy
132
+ access. `PAGE_HTTP_ERROR`: inspect `error.status`; fix the route/server or use
133
+ authorized login state for 401/403. These codes are available in v0.3.1 or newer;
134
+ older versions may return `COMMAND_FAILED`. Dependency checks do not prove
135
+ page access, and an HTTP error page is not a completed demo.
136
+ - Missing runtime or fonts: inspect `doctor --json` and its recovery hints.
137
+ - Captcha, anti-bot block, iframe-only or canvas-only flow: use a user-provided
138
+ recording with marks instead of trying to bypass the restriction.
139
+
140
+ ## Protected pages and privacy
141
+
142
+ Manual login needs an interactive terminal without `--json`:
143
+
144
+ From v0.3.2, login navigation errors also omit the target URL. HTTP 401/403
145
+ pages stay open for sign-in; other HTTP errors stop the command.
146
+
147
+ ```bash
148
+ tabretake plan --url https://your-app.com --login
149
+ tabretake record --config demo.json --storage-state auth.json --json
150
+ ```
151
+
152
+ `auth.json` is created in the login command's working directory and is never
153
+ implicitly loaded by later commands. Use an absolute state path after changing
154
+ directories. If it expires, let the user log in again; do not request passwords
155
+ or 2FA codes in chat. Do not upload or commit login state or private recordings.
156
+ Stories and recorded timelines retain typed values, so use synthetic data.
157
+ Record only authorized pages; the workflow does not authorize publishing assets.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "TabRetake"
3
+ short_description: "Create repeatable web app demos and README GIFs"
4
+ default_prompt: "Use $tabretake to turn my web app's main flow into a short demo video and README GIF."
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "./tabretake.mjs";
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "../scripts/cli.mjs";
3
+ import { commandOptions } from "../scripts/lib/options.mjs";
4
+ import { errorReport } from "../scripts/lib/report.mjs";
5
+
6
+ main(process.argv.slice(2)).catch((err) => {
7
+ const [command, ...args] = process.argv.slice(2);
8
+ if (commandOptions[command]?.json && args.includes("--json")) {
9
+ console.log(JSON.stringify(errorReport(command, err)));
10
+ } else console.error(err?.stack || err?.message || String(err));
11
+ process.exitCode = 1;
12
+ });