ptywright 0.1.0 → 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.
package/README.md CHANGED
@@ -1,188 +1,245 @@
1
1
  # ptywright
2
2
 
3
- 一个通用的“终端版 DevTools / Playwright driver”原型:通过 PTY 启动任意 CLI/TUI,把 ANSI/VT 输出喂给 `@xterm/headless` 重建屏幕网格,并以 MCP(stdio)暴露工具接口。
3
+ [中文文档](./README_ZH.md)
4
4
 
5
- ## Run
5
+ A universal "Terminal DevTools / Playwright driver": Launch any CLI/TUI via PTY, feed ANSI/VT output to `@xterm/headless` to rebuild the screen grid, and expose it as MCP (stdio) tools.
6
+
7
+ ## Installation
6
8
 
7
9
  ```bash
8
- bun install
10
+ # Recommended: Run with bunx (no install needed)
11
+ bunx ptywright@latest --help
9
12
 
10
- # 默认:启动 MCP server(等价 `ptywright mcp`)
11
- bun run bin/ptywright
13
+ # Or install globally
14
+ bun add -g ptywright
15
+ ptywright --help
16
+
17
+ # Or via npm/npx
18
+ npx -y ptywright@latest --help
19
+ npm install -g ptywright
20
+ ```
12
21
 
13
- # 显式写法:
14
- # bun run bin/ptywright mcp
22
+ ## Quick Start
23
+
24
+ ### Use as MCP Server
25
+
26
+ ```bash
27
+ # stdio mode (default)
28
+ bunx ptywright@latest mcp
15
29
 
16
- # 可选:以 Streamable HTTP 方式启动(Web transport)
17
- # bun run bin/ptywright mcp-http --port 3000
30
+ # HTTP mode
31
+ bunx ptywright@latest mcp-http --port 3000
18
32
 
19
- # 可选:减少 tool 数量(降低 Agent 上下文压力)
20
- # bun run bin/ptywright mcp --caps core
21
- # 或:PTYWRIGHT_CAPS=core bun run bin/ptywright
33
+ # Minimal tools (reduce Agent context pressure)
34
+ bunx ptywright@latest mcp --caps core
22
35
  ```
23
36
 
24
- ## Tools (MVP)
37
+ ### Configure MCP Client
25
38
 
26
- 工具默认全量开启(等价 `PTYWRIGHT_CAPS=all`)。如需减少 tool 数量,可设置 `PTYWRIGHT_CAPS=core` 或按需组合:
39
+ **Claude Desktop / Cursor** (`~/.config/claude/claude_desktop_config.json`):
27
40
 
28
- - 默认:`PTYWRIGHT_CAPS=all`
29
- - 最小:`PTYWRIGHT_CAPS=core`
30
- - 组合:`PTYWRIGHT_CAPS=core,debug,script,recording`
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "ptywright": {
45
+ "command": "bunx",
46
+ "args": ["ptywright@latest", "mcp"]
47
+ }
48
+ }
49
+ }
50
+ ```
31
51
 
32
- ### core
52
+ **Minimal mode** (load core tools only):
33
53
 
34
- - `list_sessions` / `select_session`:管理与选择会话
35
- - `launch_session`:启动 PTY 会话(会自动成为默认会话)
36
- - `send_text` / `press_key`:发送输入
37
- - `snapshot_text`:返回可见屏幕文本(适合 Agent “看界面”与做 golden)
38
- - `snapshot_view`:更适合人看的快照(带元信息+行号)
39
- - `wait_for_text`:等待文本/正则出现
40
- - `wait_for_stable_screen`:等待屏幕在 quiet window 内稳定(降低 flaky)
41
- - `assert`:对当前屏幕做断言(text/regex/semantic)
42
- - `close_session`:关闭会话
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "ptywright": {
58
+ "command": "bunx",
59
+ "args": ["ptywright@latest", "mcp", "--caps", "core"]
60
+ }
61
+ }
62
+ }
63
+ ```
43
64
 
44
- ### debug(可选)
65
+ **HTTP mode** (for Web clients):
45
66
 
46
- - `snapshot_ansi`:返回带 ANSI/SGR 样式的可见屏幕(适合 debug/人眼验收)
47
- - `snapshot_view_ansi`:带 ANSI/SGR 样式的 `snapshot_view`
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "ptywright": {
71
+ "command": "bunx",
72
+ "args": ["ptywright@latest", "mcp-http", "--port", "3000"]
73
+ }
74
+ }
75
+ }
76
+ ```
48
77
 
49
- ### script(可选)
78
+ ### CLI Commands
50
79
 
51
- - `run_routine`:一键执行多步交互(type/key/wait/assert/snapshot)
52
- - `run_script`:运行 `scriptPath=file.json|file.ts` 并产出 artifacts(cast/report/失败快照)
53
- - `run_all_scripts`:批量运行目录内脚本(递归;支持 `includeEntries/maxEntries` 控制输出)
54
- - `generate_test_from_doc`:从文档(本地/URL)生成可执行脚本
55
- - `inspect_failure`:查看最近一次失败的屏幕与错误
80
+ ```bash
81
+ # Run a single test script
82
+ bunx ptywright@latest run scripts/demo.json
56
83
 
57
- ### recording(可选)
84
+ # Run all scripts (generate HTML report)
85
+ bunx ptywright@latest run-all --dir scripts
58
86
 
59
- - `start_script_recording` / `stop_script_recording`:录制 MCP 工具调用并导出可复跑脚本(JSON + goldens)
60
- - `mark`:在 trace 中打点(asciicast marker event)
87
+ # Show help
88
+ bunx ptywright@latest --help
89
+ ```
61
90
 
62
- `mask`(可选):`snapshot_text/snapshot_ansi/snapshot_view/snapshot_view_ansi` 支持 `mask=[{regex,flags?,replacement?,preserveLength?}]`,用于把随机 id/时间戳等变成可 diff 的稳定快照
91
+ ## Tools
63
92
 
64
- ### `press_key` Key Spec
93
+ All tools are enabled by default (`--caps all`). Use `--caps core` or combine as needed:
65
94
 
66
- 支持单键与“修饰键 + 单键”的组合写法(大小写不敏感,`+`/`-` 都可作为分隔符):
67
- - 单字符:`"a"` / `"?"`(原样写入 PTY)
68
- - 特殊键:`Enter|Return`、`Esc|Escape`、`Backspace`、`Space`、`Tab`、`BackTab`
69
- - 组合键:`Ctrl+C`、`Ctrl+Shift+R`、`Alt+X`/`Meta+X`、`Shift+Tab`、`Ctrl+Up`
70
- - 导航键:`Up/Down/Left/Right`、`Home/End`、`PageUp/PageDown`、`Insert/Delete`、`F1..F12`
71
- - 兼容:`c-x`(等价 `Ctrl+X`)
95
+ - Default: `--caps all`
96
+ - Minimal: `--caps core`
97
+ - Combined: `--caps core,debug,script,recording`
72
98
 
73
- ## Tests
99
+ ### core
74
100
 
75
- ```bash
76
- bun test
77
- ```
101
+ - `list_sessions` / `select_session`: Manage and select sessions
102
+ - `launch_session`: Start a PTY session (becomes default session)
103
+ - `send_text` / `press_key`: Send input
104
+ - `snapshot_text`: Return visible screen text (for Agent "seeing" and golden snapshots)
105
+ - `snapshot_view`: Human-friendly snapshot (with metadata + line numbers)
106
+ - `wait_for_text`: Wait for text/regex to appear
107
+ - `wait_for_stable_screen`: Wait for screen to stabilize within quiet window (reduce flaky)
108
+ - `assert`: Assert on current screen (text/regex/semantic)
109
+ - `close_session`: Close session
78
110
 
79
- 包含:
80
- - PTY + xterm 解析与快照测试
81
- - MCP server 端到端 smoke(client 通过 stdio 启动 server 并调用 tools)
111
+ ### debug (optional)
82
112
 
83
- ## Use With MCP Clients(可选)
113
+ - `snapshot_ansi`: Return visible screen with ANSI/SGR styles (for debug/human review)
114
+ - `snapshot_view_ansi`: `snapshot_view` with ANSI/SGR styles
84
115
 
85
- 本仓库也提供了一个可选的 Codex skill:`skills/ptywright-testing/`,用于指导 Agent 如何用 ptywright MCP/CLI 跑回归并读取 `run.summary.json`(尽量不把超长报告塞进上下文)。
116
+ ### script (optional)
86
117
 
87
- 本项目是一个 stdio transport MCP server。直接启动:
118
+ - `run_routine`: Execute multi-step interactions in one call (type/key/wait/assert/snapshot)
119
+ - `run_script`: Run `scriptPath=file.json|file.ts` and produce artifacts (cast/report/failure snapshots)
120
+ - `run_all_scripts`: Run scripts in directory recursively (supports `includeEntries/maxEntries`)
121
+ - `generate_test_from_doc`: Generate executable scripts from documentation (local/URL)
122
+ - `inspect_failure`: View last failure screen and error
88
123
 
89
- ```bash
90
- # 默认等价 `ptywright mcp`
91
- bun run bin/ptywright
92
- ```
124
+ ### recording (optional)
93
125
 
94
- 也可以用 Streamable HTTP 启动(默认 endpoint: `http://127.0.0.1:3000/mcp`):
126
+ - `start_script_recording` / `stop_script_recording`: Record MCP tool calls and export replayable scripts (JSON + goldens)
127
+ - `mark`: Add marker to trace (asciicast marker event)
95
128
 
96
- ```bash
97
- bun run bin/ptywright mcp-http --port 3000
98
- ```
129
+ ### `mask` Parameter
99
130
 
100
- 然后在你使用的 MCP client 里把它作为一个 stdio server 配置进去即可(不同 client 的配置方式不同)。
131
+ `snapshot_text/snapshot_ansi/snapshot_view/snapshot_view_ansi` support `mask=[{regex,flags?,replacement?,preserveLength?}]` to convert random IDs/timestamps into diffable stable snapshots.
132
+
133
+ ### `press_key` Key Spec
134
+
135
+ Supports single keys and modifier combinations (case-insensitive, `+`/`-` as separator):
136
+ - Single char: `"a"` / `"?"` (written to PTY as-is)
137
+ - Special keys: `Enter|Return`, `Esc|Escape`, `Backspace`, `Space`, `Tab`, `BackTab`
138
+ - Combos: `Ctrl+C`, `Ctrl+Shift+R`, `Alt+X`/`Meta+X`, `Shift+Tab`, `Ctrl+Up`
139
+ - Navigation: `Up/Down/Left/Right`, `Home/End`, `PageUp/PageDown`, `Insert/Delete`, `F1..F12`
140
+ - Compatible: `c-x` (equals `Ctrl+X`)
101
141
 
102
142
  ## Script Runner (JSON)
103
143
 
104
- 把一次 TUI 测试写成 JSON:启动输入等待快照(可 mask)→ 断言,并自动产出 `.cast` + `report.html`。
144
+ Write TUI tests as JSON: launch inputwaitsnapshot (with mask) assert, automatically producing `.cast` + `report.html`.
105
145
 
106
- 可选:在 JSON 顶部加上 schema(编辑器补全/校验更友好):
146
+ Optional: Add schema for editor completion/validation:
107
147
 
108
148
  ```json
109
- { "$schema": "../schemas/ptywright-script.schema.json" }
149
+ { "$schema": "node_modules/ptywright/schemas/ptywright-script.schema.json" }
110
150
  ```
111
151
 
112
152
  ```bash
113
- bun run script:run scripts/m5_mask_demo.json
114
- # 或(CLI)
115
- bun run bin/ptywright run scripts/m5_mask_demo.json
116
- #
117
- bun run script:m5-mask-demo
153
+ # Run single script
154
+ bunx ptywright@latest run scripts/m5_mask_demo.json
155
+
156
+ # Run all scripts
157
+ bunx ptywright@latest run-all --dir scripts
118
158
  ```
119
159
 
120
- 批量执行(本地/CI):
160
+ Artifacts go to `.tmp/runs/<name>/` by default (override with `--artifacts-dir`).
121
161
 
122
- ```bash
123
- bun run script:run-all
124
- # 或(CLI)
125
- bun run bin/ptywright run-all
126
- ```
162
+ Batch runs generate an overview report:
163
+ - Default: `.tmp/run-all/index.html` + `.tmp/run-all/run.summary.json`
164
+ - With `--artifacts-root <dir>`: `<dir>/index.html` + `<dir>/run.summary.json`
127
165
 
128
- 会生成一个总览报告(类似 Playwright report 首页):
129
- - 默认:`.tmp/run-all/index.html` + `.tmp/run-all/run.summary.json`
130
- - 若传入 `--artifacts-root <dir>`:写到 `<dir>/index.html` + `<dir>/run.summary.json`
166
+ On failure, additional files are saved:
167
+ - `failure.error.txt` (error stack)
168
+ - `failure.step.json` (failed step info)
169
+ - `failure.last.txt` / `failure.last.view.txt` (last frame snapshot)
131
170
 
132
- 如果 JSON 里用到了 `type:"custom"`,用 `--steps <module.ts>` 注入 handlers(模块导出 `steps` 对象即可):
171
+ `report.html` includes **Timeline View** showing screen snapshots after each step. Click the `debug` badge to switch to debug view.
172
+
173
+ Built-in steps (no `--steps` needed):
174
+ - `assert`: Assert text/regex (`text`/`regex`)
175
+ - `assertSemantic`: Semantic assertion placeholder (`prompt`)
176
+ - `sleep`: Fixed wait
177
+ - `expectMeta`: Assert terminal meta
178
+ - `waitForExit`: Wait for process exit
179
+ - `sendMouse`: Send SGR mouse events
180
+
181
+ For `type:"custom"` steps, inject handlers with `--steps <module.ts>`:
133
182
 
134
183
  ```bash
135
- bun run script:run examples/json_custom_steps_demo.json --steps scripts/m6_json_custom_steps.ts
184
+ bunx ptywright@latest run demo.json --steps custom_steps.ts
136
185
  ```
137
186
 
138
- 产物默认写到 `.tmp/runs/<name>/`(可用 `--artifacts-dir` 覆盖)。
187
+ ## Script Recording (MCP)
139
188
 
140
- 失败时会额外落盘:
141
- - `failure.error.txt`(错误堆栈)
142
- - `failure.step.json`(失败的 step 信息)
143
- - `failure.last.txt` / `failure.last.view.txt`(最后一帧快照)
189
+ Record tool calls into replayable scripts from any MCP client/Agent:
144
190
 
145
- `report.html` 现在包含 **Timeline View**,展示每一步操作后的屏幕快照(不仅是失败时)。点击顶部 `debug` badge 可切换到调试视图。
191
+ 1) `start_script_recording(name="my_flow")`
192
+ 2) Execute normally: `launch_session/send_text/press_key/wait_for_*`
193
+ 3) Add checkpoints: `mark(label="checkpoint")` (auto-generates `snapshot + expectGolden`)
194
+ 4) `stop_script_recording(recordingId=...)` (writes `scripts/my_flow.json` + `tests/golden/scripts/my_flow/*.txt`)
146
195
 
147
- Cast Playback(完整录屏)会优先加载 report 同目录的 `asciinema-player.min.js` / `asciinema-player.css`(生成 report 时自动复制),因此离线打开 report 也可播放;若本地资源缺失则会 fallback 到 CDN。
196
+ ## Script DSL (TypeScript)
148
197
 
149
- 内置 steps(无需 `--steps`):
150
- - `assert`:**[NEW]** 断言文本/正则(`text`/`regex`)
151
- - `assertSemantic`:**[NEW]** 语义断言占位符(`prompt`)
152
- - `sleep`:固定等待
153
- - `expectMeta`:断言终端 meta
154
- - `waitForExit`:等待进程退出
155
- - `sendMouse`:发送 SGR 鼠标事件
198
+ Write scripts with TS builder (type-safe, composable, custom steps):
156
199
 
157
- ## Script Recording (MCP)
200
+ ```bash
201
+ bunx ptywright@latest run scripts/demo.ts
202
+ ```
158
203
 
159
- 如果你设置了 `PTYWRIGHT_CAPS` 且未包含 `recording`,需要开启 `recording`(例如 `PTYWRIGHT_CAPS=core,recording`)。
204
+ Conventions:
205
+ - Module default export (`export default`), or export `script`.
206
+ - Optional `steps` export (custom step handlers) for `type:"custom"` steps.
207
+ - Use `pasteText("...", { bracketed: true })` for bracketed paste testing.
160
208
 
161
- 在任意 MCP client/Agent 通过 MCP tools 驱动时,可以一键把工具调用“录成脚本”,并在 `mark` 处自动落盘 golden:
209
+ ## Cast -> SVG/GIF (Optional)
162
210
 
163
- 1) `start_script_recording(name="my_flow")`
164
- 2) 正常执行:`launch_session/send_text/press_key/wait_for_*`
165
- 3) 关键节点打点:`mark(label="checkpoint")`(会自动生成 `snapshot + expectGolden`)
166
- 4) `stop_script_recording(recordingId=...)`(写入 `scripts/my_flow.json` + `tests/golden/scripts/my_flow/*.txt`)
211
+ Recording artifacts are best for failure diagnosis or manual review; prefer `snapshot_grid` diff for stable regression.
167
212
 
168
- ## Script DSL (TypeScript)
213
+ - SVG: `bunx svg-term --in <castPath> --out <outSvg>`
214
+ - GIF: `agg --fps 30 <castPath> <outGif>` (requires [asciinema/agg](https://github.com/asciinema/agg))
169
215
 
170
- TS builder 写 script(类型安全,可组合,支持自定义 step),底层仍复用同一个 runner:
216
+ ## Development
171
217
 
172
218
  ```bash
173
- bun run script:run scripts/m6_dsl_demo.ts
219
+ bun install
220
+
221
+ # Start MCP server
222
+ bun run bin/ptywright mcp
223
+
224
+ # Run tests
225
+ bun test
226
+
227
+ # Lint & Format
228
+ bun run lint
229
+ bun run format:check
230
+
231
+ # Run scripts
232
+ bun run bin/ptywright run scripts/m5_mask_demo.json
233
+ bun run bin/ptywright run-all
174
234
  ```
175
235
 
176
- 约定:
177
- - module 默认导出(`export default`),或导出 `script`。
178
- - 可选导出 `steps`(custom step handlers),用于执行 `type:"custom"` 的步骤。
179
- - 常用 handlers 可复用:`src/script/steps/*`。
180
- - 需要测试“粘贴”时可用 `pasteText("...", { bracketed: true })`(bracketed paste)。
236
+ ## Environment Variables
181
237
 
182
- ## Cast -> SVG/GIF (可选)
238
+ - `TUI_TEST_PTY_BACKEND=auto|bun-terminal|bun-pty`
239
+ - default `auto`: macOS/Linux prefers `bun-terminal`, Windows uses `bun-pty`
240
+ - `PTYWRIGHT_CAPS=all|core|debug|script|recording`
241
+ - Equivalent to `--caps` parameter
183
242
 
184
- 录像类产物建议只用于失败诊断或人工验收;稳定回归优先用 `snapshot_grid` 做 diff。
243
+ ## License
185
244
 
186
- - SVG: `svg-term`(例如:`bunx svg-term --in <castPath> --out <outSvg>`)
187
- - TXT: `bun run src/trace/cast_to_txt.ts --in <castPath> --out <outTxt>`
188
- - GIF: `asciinema/agg`(例如:`agg --fps 30 <castPath> <outGif>`)
245
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptywright",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Terminal/TUI automation driver over PTY + xterm, exposed as MCP tools",
5
5
  "keywords": [
6
6
  "agent",
@@ -3,20 +3,23 @@ name: ptywright-testing
3
3
  description: Terminal/TUI automation and regression testing using ptywright (PTY + xterm) via CLI or MCP tools. Use when you need to (1) drive a CLI/TUI app (send keys/mouse, wait, snapshot), (2) run scripted regressions (run/run-all) and review the HTML report (index.html + run.summary.json), or (3) record an interactive MCP-driven session into a replayable script with golden checkpoints.
4
4
  ---
5
5
 
6
- # Ptywright Testing / 使用指南
6
+ # Ptywright Testing
7
7
 
8
- Use ptywright to run deterministic CLI/TUI regression tests with readable terminal screenshots and a Playwright-like HTML report.
8
+ Use ptywright to run deterministic CLI/TUI regression tests with readable "terminal screenshots" and a Playwright-like HTML report.
9
9
 
10
- ## How to run (发布版 vs 仓库内开发)
10
+ ## Installation & Usage
11
11
 
12
- This CLI is Bun-based (`#!/usr/bin/env bun`). For a released package, prefer `bunx`.
12
+ ```bash
13
+ # 推荐:bunx 一次性运行
14
+ bunx ptywright@latest <command>
13
15
 
14
- - **Published package (recommended):**
15
- - one-off: `bunx ptywright@latest <command>`
16
- - pinned: `bunx ptywright@0.1.0 <command>`
17
- - global: `bun add -g ptywright` then `ptywright <command>`
18
- - **Inside this repo (dev):**
19
- - `bun run bin/ptywright <command>`
16
+ # 或全局安装
17
+ bun add -g ptywright
18
+ ptywright <command>
19
+
20
+ # 本仓库内开发
21
+ bun run bin/ptywright <command>
22
+ ```
20
23
 
21
24
  ## Choose the interface
22
25
 
@@ -25,42 +28,57 @@ This CLI is Bun-based (`#!/usr/bin/env bun`). For a released package, prefer `bu
25
28
 
26
29
  ## Start the MCP server
27
30
 
28
- - stdio (default):
29
- - published: `bunx ptywright@latest mcp`
30
- - repo: `bun run bin/ptywright mcp`
31
- - restrict tools to reduce context:
32
- - published: `bunx ptywright@latest mcp --caps core`
33
- - repo: `bun run bin/ptywright mcp --caps core` (or `PTYWRIGHT_CAPS=core`)
34
- - Streamable HTTP:
35
- - published: `bunx ptywright@latest mcp-http --port 3000`
36
- - repo: `bun run bin/ptywright mcp-http --port 3000`
31
+ ```bash
32
+ # stdio (default)
33
+ bunx ptywright@latest mcp
34
+
35
+ # 精简 tools(降低上下文压力)
36
+ bunx ptywright@latest mcp --caps core
37
+
38
+ # HTTP 模式
39
+ bunx ptywright@latest mcp-http --port 3000
40
+ ```
41
+
42
+ Capabilities (`--caps`): `all|core|debug|script|recording` (comma separated)
37
43
 
38
- Capabilities (`--caps` / `PTYWRIGHT_CAPS`) match MCP tools:
44
+ ## Configure MCP Client
39
45
 
40
- - `all|core|debug|script|recording` (comma/space separated)
46
+ **Claude Desktop / Cursor** (`~/.config/claude/claude_desktop_config.json`):
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "ptywright": {
52
+ "command": "bunx",
53
+ "args": ["ptywright@latest", "mcp"]
54
+ }
55
+ }
56
+ }
57
+ ```
41
58
 
42
59
  ## Run scripts (deterministic regression)
43
60
 
44
61
  ### Run the whole suite (preferred)
45
62
 
46
- - CLI:
47
- - published: `bunx ptywright@latest run-all --dir scripts`
48
- - repo: `bun run bin/ptywright run-all --dir scripts`
49
- - Output to focus on:
50
- - `reportPath` (open in a browser)
51
- - `summaryPath` (`run.summary.json` for agents/CI)
63
+ ```bash
64
+ bunx ptywright@latest run-all --dir scripts
65
+ ```
52
66
 
53
- MCP equivalent:
67
+ Output to focus on:
68
+ - `reportPath` (open in a browser)
69
+ - `summaryPath` (`run.summary.json` for agents/CI)
54
70
 
71
+ MCP equivalent:
55
72
  - `run_all_scripts` (defaults: `dir="scripts"`, suite report in `.tmp/run-all/`)
56
73
  - Keep MCP output small: `run_all_scripts(includeEntries="failures", maxEntries=20)`
57
74
 
58
75
  ### Run one script
59
76
 
60
- - CLI:
61
- - published: `bunx ptywright@latest run <file.json|file.ts> [--artifacts-dir <dir>]`
62
- - repo: `bun run bin/ptywright run <file.json|file.ts> [--artifacts-dir <dir>]`
63
- - MCP: `run_script(scriptPath=...)`
77
+ ```bash
78
+ bunx ptywright@latest run <file.json|file.ts> [--artifacts-dir <dir>]
79
+ ```
80
+
81
+ MCP: `run_script(scriptPath=...)`
64
82
 
65
83
  ## Debug a failure
66
84
 
@@ -85,7 +103,9 @@ Tip: for flaky waits, prefer `scope="buffer"` when the content may have scrolled
85
103
 
86
104
  To verify ptywright MCP tool coverage without relying on external apps/network, run:
87
105
 
88
- - `bun test tests/mcp_all_tools_smoke.test.ts`
106
+ ```bash
107
+ bun test tests/mcp_all_tools_smoke.test.ts
108
+ ```
89
109
 
90
110
  This exercises `core + debug + script + recording` tools end-to-end.
91
111