@tea-agent/loop-agent 0.25.5 → 0.26.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 (173) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +1020 -986
  3. package/bin/loop-agent.js +21 -21
  4. package/dist/commands/cursor-prompt.js +6 -6
  5. package/dist/commands/init.js +68 -129
  6. package/dist/commands/loop-benchmark.js +11 -11
  7. package/dist/commands/pi-reuse-benchmark.js +16 -16
  8. package/dist/executors/dag-pi-executor.js +26 -20
  9. package/dist/executors/model-routing.js +34 -18
  10. package/dist/executors/shell-executor.js +1 -1
  11. package/dist/governance/manifest-types.js +33 -5
  12. package/dist/sidecars/cursor-prompt/executor.js +1 -1
  13. package/dist/task/task-demand-routing.js +3 -1
  14. package/dist/worker/console/chat/model-resolver.js +15 -3
  15. package/dist/worker/observe/static/constants.js +3 -2
  16. package/dist/worker/observe/static/copy.js +67 -67
  17. package/dist/worker/observe/static/dag-layout.d.ts +31 -31
  18. package/dist/worker/observe/static/dag-layout.js +83 -83
  19. package/dist/worker/observe/static/dag-model.js +1 -0
  20. package/dist/worker/observe/static/dom.js +220 -220
  21. package/dist/worker/observe/static/relations.js +133 -133
  22. package/dist/worker/observe/static/router.js +93 -93
  23. package/dist/worker/observe/static/run-processing.js +148 -148
  24. package/dist/worker/observe/static/styles.css +182 -42
  25. package/dist/worker/observe/static/views/batch.js +227 -227
  26. package/dist/worker/observe/static/views/dag-graph.js +172 -172
  27. package/dist/worker/observe/static/views/failures.js +143 -143
  28. package/dist/worker/observe/static/views/feature.js +492 -492
  29. package/dist/worker/observe/static/views/run.js +453 -453
  30. package/dist/worker/observe/static/views/shell.js +7 -7
  31. package/dist/worker/observe/static/views/timeline.js +163 -163
  32. package/dist/workflows/dag/backend-test-case-coverage-analysis.js +362 -45
  33. package/dist/workflows/dag/backend-test-case-manifest.js +20 -0
  34. package/dist/workflows/dag/backend-test-markdown-workflow.js +17 -0
  35. package/dist/workflows/dag/canvas-observer.js +275 -275
  36. package/dist/workflows/dag/init-hybrid.js +18 -15
  37. package/dist/workflows/dag/lifecycle.js +40 -30
  38. package/dist/workflows/dag/node-execution.js +13 -0
  39. package/dist/workflows/dag/types.js +59 -19
  40. package/docs/init-surface.manifest.json +3 -1
  41. package/docs/skills/README.md +7 -7
  42. package/docs/templates/README.md +1 -0
  43. package/docs/templates/adr.md +60 -60
  44. package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
  45. package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
  46. package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
  47. package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
  48. package/docs/templates/agent-dag-report.schema.json +473 -473
  49. package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
  50. package/docs/templates/backend-test-dag.json +9 -9
  51. package/docs/templates/backend-test-result.schema.json +99 -99
  52. package/docs/templates/feature-spec.md +53 -53
  53. package/docs/templates/frontend-design-contract.md +42 -42
  54. package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -17
  55. package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -16
  56. package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -16
  57. package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -16
  58. package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -16
  59. package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -16
  60. package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -21
  61. package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -29
  62. package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -28
  63. package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -28
  64. package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -29
  65. package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -27
  66. package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -28
  67. package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -28
  68. package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -27
  69. package/docs/templates/frontend-eval/metrics.md +138 -138
  70. package/docs/templates/frontend-eval/smoke-targets.md +53 -53
  71. package/docs/templates/frontend-task-constraints.md +35 -35
  72. package/docs/templates/frontend-task-requirement.md +70 -70
  73. package/docs/templates/harness.schema.json +29 -7
  74. package/docs/templates/init-evolution-review.md +35 -35
  75. package/docs/templates/init-managed-agents.md +137 -0
  76. package/docs/templates/interactive-ui-round2-experiment.md +66 -66
  77. package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -118
  78. package/docs/templates/knowledge-sync-dag.json +178 -178
  79. package/docs/templates/knowledge-sync-draft.schema.json +71 -71
  80. package/docs/templates/product-line/closeout.yaml +9 -9
  81. package/docs/templates/product-line/design.md +13 -13
  82. package/docs/templates/product-line/links.md +10 -10
  83. package/docs/templates/product-line/requirement.md +17 -17
  84. package/docs/templates/product-line/test-plan.md +7 -7
  85. package/docs/templates/production-readiness-checklist.md +57 -57
  86. package/docs/templates/project-start-checklist.md +9 -9
  87. package/docs/templates/qa-report.md +48 -48
  88. package/docs/templates/sprint-contract.md +29 -29
  89. package/docs/templates/worker-dogfood-evidence.md +80 -80
  90. package/docs/templates/worker-dogfood-setup.md +68 -68
  91. package/harness.json +1 -2
  92. package/package.json +1 -1
  93. package/scripts/kb-bootstrap-init-skeleton.sh +0 -0
  94. package/scripts/kb-graph-incremental-prepare.mjs +386 -386
  95. package/scripts/kb-graph-materialize.mjs +105 -105
  96. package/scripts/kb-graph-promote.mjs +164 -164
  97. package/scripts/kb-query.mjs +554 -554
  98. package/skills/ai-engineering-context/SKILL.md +48 -48
  99. package/skills/analyze-product-dependencies/SKILL.md +67 -67
  100. package/skills/analyze-product-dependencies/agents/openai.yaml +4 -4
  101. package/skills/analyze-product-dependencies/references/api-documentation-schema.md +30 -30
  102. package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +28 -28
  103. package/skills/analyze-product-dependencies/references/example.md +76 -76
  104. package/skills/analyze-product-dependencies/references/forward-test-cases.md +35 -35
  105. package/skills/analyze-product-dependencies/references/input-contract.md +11 -11
  106. package/skills/analyze-product-dependencies/references/scouting-rules.md +61 -61
  107. package/skills/analyze-product-dependencies/scripts/test-validators.mjs +267 -267
  108. package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +101 -101
  109. package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +142 -142
  110. package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +76 -76
  111. package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +146 -146
  112. package/skills/analyze-product-requirements/SKILL.md +90 -90
  113. package/skills/analyze-product-requirements/agents/openai.yaml +4 -4
  114. package/skills/analyze-product-requirements/references/acceptance-criteria.md +91 -91
  115. package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +56 -56
  116. package/skills/analyze-product-requirements/references/example.md +86 -86
  117. package/skills/analyze-product-requirements/references/forward-test-cases.md +66 -66
  118. package/skills/analyze-product-requirements/references/product-analysis-schema.md +32 -32
  119. package/skills/analyze-product-requirements/references/product-requirement-schema.md +33 -33
  120. package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +35 -35
  121. package/skills/analyze-product-requirements/scripts/test-validators.mjs +193 -193
  122. package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +69 -69
  123. package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +97 -97
  124. package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +98 -98
  125. package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +156 -156
  126. package/skills/browser-tools/browser-content.js +103 -103
  127. package/skills/browser-tools/browser-cookies.js +35 -35
  128. package/skills/browser-tools/browser-eval.js +53 -53
  129. package/skills/browser-tools/browser-hn-scraper.js +108 -108
  130. package/skills/browser-tools/browser-nav.js +44 -44
  131. package/skills/browser-tools/browser-pick.js +162 -162
  132. package/skills/browser-tools/browser-screenshot.js +34 -34
  133. package/skills/browser-tools/browser-start.js +86 -86
  134. package/skills/browser-tools/package-lock.json +2556 -2556
  135. package/skills/browser-tools/package.json +19 -19
  136. package/skills/code-review-core/SKILL.md +20 -20
  137. package/skills/codebase-scout/SKILL.md +19 -19
  138. package/skills/grill-me/SKILL.md +10 -10
  139. package/skills/loop-agent/references/README.md +67 -67
  140. package/skills/loop-agent/references/command-reference.md +5 -4
  141. package/skills/loop-agent/references/docs-converge.md +126 -126
  142. package/skills/loop-agent/references/hybrid-dag.md +2 -2
  143. package/skills/loop-agent/references/learned/README.md +21 -21
  144. package/skills/loop-agent/references/long-running-loop.md +57 -57
  145. package/skills/loop-agent/references/model-routing.md +2 -0
  146. package/skills/loop-agent/references/one-shot-runs.md +85 -85
  147. package/skills/loop-agent/references/pi-prompt.md +23 -23
  148. package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -84
  149. package/skills/playwright-cli/SKILL.md +420 -420
  150. package/skills/playwright-cli/references/element-attributes.md +23 -23
  151. package/skills/playwright-cli/references/playwright-tests.md +39 -39
  152. package/skills/playwright-cli/references/request-mocking.md +87 -87
  153. package/skills/playwright-cli/references/running-code.md +241 -241
  154. package/skills/playwright-cli/references/session-management.md +225 -225
  155. package/skills/playwright-cli/references/storage-state.md +275 -275
  156. package/skills/playwright-cli/references/test-generation.md +433 -433
  157. package/skills/playwright-cli/references/tracing.md +139 -139
  158. package/skills/playwright-cli/references/video-recording.md +143 -143
  159. package/skills/requesting-code-review/SKILL.md +101 -101
  160. package/skills/requesting-code-review/code-reviewer.md +168 -168
  161. package/skills/systematic-debugging/CREATION-LOG.md +119 -119
  162. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
  163. package/skills/systematic-debugging/condition-based-waiting.md +115 -115
  164. package/skills/systematic-debugging/defense-in-depth.md +122 -122
  165. package/skills/systematic-debugging/find-polluter.sh +63 -63
  166. package/skills/systematic-debugging/root-cause-tracing.md +169 -169
  167. package/skills/systematic-debugging/test-academic.md +14 -14
  168. package/skills/systematic-debugging/test-pressure-1.md +58 -58
  169. package/skills/systematic-debugging/test-pressure-2.md +68 -68
  170. package/skills/systematic-debugging/test-pressure-3.md +69 -69
  171. package/skills/using-git-worktrees/SKILL.md +215 -215
  172. package/skills/verification-before-completion/SKILL.md +154 -154
  173. package/skills/webapp-testing/SKILL.md +19 -19
@@ -1,420 +1,420 @@
1
- ---
2
- name: playwright-cli
3
- description: Automate browser interactions, test web pages and work with Playwright tests.
4
- allowed-tools: Bash(playwright-cli:*) Bash(npx:*) Bash(npm:*)
5
- ---
6
-
7
- # Browser Automation with playwright-cli
8
-
9
- ## Quick start
10
-
11
- ```bash
12
- # open new browser
13
- playwright-cli open
14
- # navigate to a page
15
- playwright-cli goto https://playwright.dev
16
- # interact with the page using refs from the snapshot
17
- playwright-cli click e15
18
- playwright-cli type "page.click"
19
- playwright-cli press Enter
20
- # take a screenshot (rarely used, as snapshot is more common)
21
- playwright-cli screenshot
22
- # close the browser
23
- playwright-cli close
24
- ```
25
-
26
- ## Commands
27
-
28
- ### Core
29
-
30
- ```bash
31
- playwright-cli open
32
- # open and navigate right away
33
- playwright-cli open https://example.com/
34
- playwright-cli goto https://playwright.dev
35
- playwright-cli type "search query"
36
- playwright-cli click e3
37
- playwright-cli dblclick e7
38
- # --submit presses Enter after filling the element
39
- playwright-cli fill e5 "user@example.com" --submit
40
- playwright-cli drag e2 e8
41
- # drop files or data onto an element (from outside the page)
42
- playwright-cli drop e4 --path=./image.png
43
- playwright-cli drop e4 --data="text/plain=hello world"
44
- playwright-cli hover e4
45
- playwright-cli select e9 "option-value"
46
- playwright-cli upload ./document.pdf
47
- playwright-cli check e12
48
- playwright-cli uncheck e12
49
- playwright-cli snapshot
50
- # search the snapshot for text or a regexp, returns matching nodes with surrounding context
51
- playwright-cli find "Sign in"
52
- playwright-cli find --regex "Sign (in|up)"
53
- # wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
54
- playwright-cli find --regex "/sign (in|up)/i"
55
- playwright-cli eval "document.title"
56
- playwright-cli eval "el => el.textContent" e5
57
- # get element id, class, or any attribute not visible in the snapshot
58
- playwright-cli eval "el => el.id" e5
59
- playwright-cli eval "el => el.getAttribute('data-testid')" e5
60
- playwright-cli dialog-accept
61
- playwright-cli dialog-accept "confirmation text"
62
- playwright-cli dialog-dismiss
63
- playwright-cli resize 1920 1080
64
- playwright-cli close
65
- ```
66
-
67
- ### Navigation
68
-
69
- ```bash
70
- playwright-cli go-back
71
- playwright-cli go-forward
72
- playwright-cli reload
73
- ```
74
-
75
- ### Keyboard
76
-
77
- ```bash
78
- playwright-cli press Enter
79
- playwright-cli press ArrowDown
80
- playwright-cli keydown Shift
81
- playwright-cli keyup Shift
82
- ```
83
-
84
- ### Mouse
85
-
86
- ```bash
87
- playwright-cli mousemove 150 300
88
- playwright-cli mousedown
89
- playwright-cli mousedown right
90
- playwright-cli mouseup
91
- playwright-cli mouseup right
92
- playwright-cli mousewheel 0 100
93
- ```
94
-
95
- ### Save as
96
-
97
- ```bash
98
- playwright-cli screenshot
99
- playwright-cli screenshot e5
100
- playwright-cli screenshot --filename=page.png
101
- playwright-cli screenshot --hires
102
- playwright-cli pdf --filename=page.pdf
103
- ```
104
-
105
- ### Tabs
106
-
107
- ```bash
108
- playwright-cli tab-list
109
- playwright-cli tab-new
110
- playwright-cli tab-new https://example.com/page
111
- playwright-cli tab-close
112
- playwright-cli tab-close 2
113
- playwright-cli tab-select 0
114
- ```
115
-
116
- ### Storage
117
-
118
- ```bash
119
- playwright-cli state-save
120
- playwright-cli state-save auth.json
121
- playwright-cli state-load auth.json
122
-
123
- # Cookies
124
- playwright-cli cookie-list
125
- playwright-cli cookie-list --domain=example.com
126
- playwright-cli cookie-get session_id
127
- playwright-cli cookie-set session_id abc123
128
- playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
129
- playwright-cli cookie-delete session_id
130
- playwright-cli cookie-clear
131
-
132
- # LocalStorage
133
- playwright-cli localstorage-list
134
- playwright-cli localstorage-get theme
135
- playwright-cli localstorage-set theme dark
136
- playwright-cli localstorage-delete theme
137
- playwright-cli localstorage-clear
138
-
139
- # SessionStorage
140
- playwright-cli sessionstorage-list
141
- playwright-cli sessionstorage-get step
142
- playwright-cli sessionstorage-set step 3
143
- playwright-cli sessionstorage-delete step
144
- playwright-cli sessionstorage-clear
145
- ```
146
-
147
- ### Network
148
-
149
- ```bash
150
- playwright-cli route "**/*.jpg" --status=404
151
- playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
152
- playwright-cli route-list
153
- playwright-cli unroute "**/*.jpg"
154
- playwright-cli unroute
155
- ```
156
-
157
- ### DevTools
158
-
159
- ```bash
160
- playwright-cli console
161
- playwright-cli console warning
162
- playwright-cli requests
163
- playwright-cli request 5
164
- playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
165
- playwright-cli run-code --filename=script.js
166
- playwright-cli tracing-start
167
- playwright-cli tracing-stop
168
- playwright-cli video-start video.webm
169
- playwright-cli video-chapter "Chapter Title" --description="Details" --duration=2000
170
- playwright-cli video-stop
171
-
172
- # annotate each subsequent action (click, type, ...) with a callout naming the action and highlighting the target
173
- playwright-cli video-show-actions --duration=600 --position=top-right
174
- playwright-cli video-hide-actions
175
-
176
- # launch the dashboard for UI review / design feedback — user annotates the page, you receive the annotated screenshot, snapshot, and notes
177
- playwright-cli show --annotate
178
-
179
- # generate a Playwright locator for an element from its ref or selector
180
- playwright-cli generate-locator e5 --raw
181
-
182
- # show a persistent highlight overlay for an element, optionally with a custom style
183
- playwright-cli highlight e5
184
- playwright-cli highlight e5 --style="outline: 3px dashed red"
185
- # hide a single element highlight, or all page highlights when no target is given
186
- playwright-cli highlight e5 --hide
187
- playwright-cli highlight --hide
188
- ```
189
-
190
- ## Raw output
191
-
192
- The global `--raw` option strips page status, generated code, and snapshot sections from the output, returning only the result value. Use it to pipe command output into other tools. Commands that don't produce output return nothing.
193
-
194
- ```bash
195
- playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
196
- playwright-cli --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
197
- playwright-cli --raw snapshot > before.yml
198
- playwright-cli click e5
199
- playwright-cli --raw snapshot > after.yml
200
- diff before.yml after.yml
201
- TOKEN=$(playwright-cli --raw cookie-get session_id)
202
- playwright-cli --raw localstorage-get theme
203
- ```
204
-
205
- For structured output wrapping every reply as JSON, pass --json
206
- ```bash
207
- playwright-cli list --json
208
- ```
209
-
210
- ## Open parameters
211
- ```bash
212
- # Use specific browser when creating session
213
- playwright-cli open --browser=chrome
214
- playwright-cli open --browser=firefox
215
- playwright-cli open --browser=webkit
216
- playwright-cli open --browser=msedge
217
-
218
- # Emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit).
219
- # Prefer this when a mobile layout is acceptable: mobile pages are usually
220
- # lighter, so snapshots are smaller and cheaper.
221
- playwright-cli open --mobile
222
- playwright-cli open --device="iPhone 15"
223
-
224
- # Use persistent profile (by default profile is in-memory)
225
- playwright-cli open --persistent
226
- # Use persistent profile with custom directory
227
- playwright-cli open --profile=/path/to/profile
228
-
229
- # Connect to browser via Playwright Extension
230
- playwright-cli attach --extension=chrome
231
-
232
- # Connect to a running Chrome or Edge by channel name
233
- playwright-cli attach --cdp=chrome
234
- playwright-cli attach --cdp=msedge
235
-
236
- # Connect to a running browser via CDP endpoint
237
- playwright-cli attach --cdp=http://localhost:9222
238
-
239
- # Start with config file
240
- playwright-cli open --config=my-config.json
241
-
242
- # Close the browser
243
- playwright-cli close
244
- # Detach from an attached browser (leaves the external browser running)
245
- playwright-cli -s=msedge detach
246
- # Delete user data for the default session
247
- playwright-cli delete-data
248
- ```
249
-
250
- ## URLs with `&` on Windows
251
-
252
- On Windows, `cmd.exe` and PowerShell treat `&` as a command separator, so URLs with multiple query parameters get truncated before `playwright-cli` runs. Escape `&` with `^&` in `cmd.exe`, or use `--%` in PowerShell:
253
-
254
- ```batch
255
- playwright-cli goto "https://example.com/?a=1^&b=2"
256
- ```
257
-
258
- ```powershell
259
- playwright-cli --% goto "https://example.com/?a=1&b=2"
260
- ```
261
-
262
- ## Snapshots
263
-
264
- After each command, playwright-cli provides a snapshot of the current browser state.
265
-
266
- ```bash
267
- > playwright-cli goto https://example.com
268
- ### Page
269
- - Page URL: https://example.com/
270
- - Page Title: Example Domain
271
- ### Snapshot
272
- [Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
273
- ```
274
-
275
- You can also take a snapshot on demand using `playwright-cli snapshot` command. All the options below can be combined as needed.
276
-
277
- ```bash
278
- # default - save to a file with timestamp-based name
279
- playwright-cli snapshot
280
-
281
- # save to file, use when snapshot is a part of the workflow result
282
- playwright-cli snapshot --filename=after-click.yaml
283
-
284
- # snapshot an element instead of the whole page
285
- playwright-cli snapshot "#main"
286
-
287
- # limit snapshot depth for efficiency, take a partial snapshot afterwards
288
- playwright-cli snapshot --depth=4
289
- playwright-cli snapshot e34
290
-
291
- # include each element's bounding box as [box=x,y,width,height]
292
- playwright-cli snapshot --boxes
293
-
294
- # search a large snapshot instead of capturing it all — returns matching nodes
295
- # with 3 lines of context around each match (like grep -C)
296
- playwright-cli find "Add to cart"
297
- playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
298
- ```
299
-
300
- ## Targeting elements
301
-
302
- By default, use refs from the snapshot to interact with page elements.
303
-
304
- ```bash
305
- # get snapshot with refs
306
- playwright-cli snapshot
307
-
308
- # interact using a ref
309
- playwright-cli click e15
310
- ```
311
-
312
- You can also use css selectors or Playwright locators.
313
-
314
- ```bash
315
- # css selector
316
- playwright-cli click "#main > button.submit"
317
-
318
- # role locator
319
- playwright-cli click "getByRole('button', { name: 'Submit' })"
320
-
321
- # test id
322
- playwright-cli click "getByTestId('submit-button')"
323
- ```
324
-
325
- ## Browser Sessions
326
-
327
- ```bash
328
- # create new browser session named "mysession" with persistent profile
329
- playwright-cli -s=mysession open example.com --persistent
330
- # same with manually specified profile directory (use when requested explicitly)
331
- playwright-cli -s=mysession open example.com --profile=/path/to/profile
332
- playwright-cli -s=mysession click e6
333
- playwright-cli -s=mysession close # stop a named browser
334
- playwright-cli -s=mysession delete-data # delete user data for persistent session
335
-
336
- playwright-cli list
337
- # Close all browsers
338
- playwright-cli close-all
339
- # Forcefully kill all browser processes
340
- playwright-cli kill-all
341
- ```
342
-
343
- ## Installation
344
-
345
- If global `playwright-cli` command is not available, try a local version via `npx playwright cli`:
346
-
347
- ```bash
348
- npx --no-install playwright --version
349
- ```
350
-
351
- When local version is available, use `npx playwright cli` in all commands. Otherwise, install `playwright-cli` as a global command:
352
-
353
- ```bash
354
- npm install -g @playwright/cli@latest
355
- ```
356
-
357
- ## Example: Form submission
358
-
359
- ```bash
360
- playwright-cli open https://example.com/form
361
- playwright-cli snapshot
362
-
363
- playwright-cli fill e1 "user@example.com"
364
- playwright-cli fill e2 "password123"
365
- playwright-cli click e3
366
- playwright-cli snapshot
367
- playwright-cli close
368
- ```
369
-
370
- ## Example: Multi-tab workflow
371
-
372
- ```bash
373
- playwright-cli open https://example.com
374
- playwright-cli tab-new https://example.com/other
375
- playwright-cli tab-list
376
- playwright-cli tab-select 0
377
- playwright-cli snapshot
378
- playwright-cli close
379
- ```
380
-
381
- ## Example: Debugging with DevTools
382
-
383
- ```bash
384
- playwright-cli open https://example.com
385
- playwright-cli click e4
386
- playwright-cli fill e7 "test"
387
- playwright-cli console
388
- playwright-cli requests
389
- playwright-cli close
390
- ```
391
-
392
- ```bash
393
- playwright-cli open https://example.com
394
- playwright-cli tracing-start
395
- playwright-cli click e4
396
- playwright-cli fill e7 "test"
397
- playwright-cli tracing-stop
398
- playwright-cli close
399
- ```
400
-
401
- ## Example: Interactive session
402
-
403
- Ask the user for UI review or design feedback. The user draws boxes on the live page and types comments; you receive the annotated screenshot, the snapshot of the marked region, and the user's notes. Use this whenever the user asks for "UI review", "design feedback", or to "ask the user what they think / want / mean":
404
-
405
- ```bash
406
- playwright-cli open https://example.com
407
- playwright-cli show --annotate
408
- ```
409
-
410
- ## Specific tasks
411
-
412
- * **Running and Debugging Playwright tests** [references/playwright-tests.md](references/playwright-tests.md)
413
- * **Request mocking** [references/request-mocking.md](references/request-mocking.md)
414
- * **Running Playwright code** [references/running-code.md](references/running-code.md)
415
- * **Browser session management** [references/session-management.md](references/session-management.md)
416
- * **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
417
- * **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md)
418
- * **Tracing** [references/tracing.md](references/tracing.md)
419
- * **Video recording** [references/video-recording.md](references/video-recording.md)
420
- * **Inspecting element attributes** [references/element-attributes.md](references/element-attributes.md)
1
+ ---
2
+ name: playwright-cli
3
+ description: Automate browser interactions, test web pages and work with Playwright tests.
4
+ allowed-tools: Bash(playwright-cli:*) Bash(npx:*) Bash(npm:*)
5
+ ---
6
+
7
+ # Browser Automation with playwright-cli
8
+
9
+ ## Quick start
10
+
11
+ ```bash
12
+ # open new browser
13
+ playwright-cli open
14
+ # navigate to a page
15
+ playwright-cli goto https://playwright.dev
16
+ # interact with the page using refs from the snapshot
17
+ playwright-cli click e15
18
+ playwright-cli type "page.click"
19
+ playwright-cli press Enter
20
+ # take a screenshot (rarely used, as snapshot is more common)
21
+ playwright-cli screenshot
22
+ # close the browser
23
+ playwright-cli close
24
+ ```
25
+
26
+ ## Commands
27
+
28
+ ### Core
29
+
30
+ ```bash
31
+ playwright-cli open
32
+ # open and navigate right away
33
+ playwright-cli open https://example.com/
34
+ playwright-cli goto https://playwright.dev
35
+ playwright-cli type "search query"
36
+ playwright-cli click e3
37
+ playwright-cli dblclick e7
38
+ # --submit presses Enter after filling the element
39
+ playwright-cli fill e5 "user@example.com" --submit
40
+ playwright-cli drag e2 e8
41
+ # drop files or data onto an element (from outside the page)
42
+ playwright-cli drop e4 --path=./image.png
43
+ playwright-cli drop e4 --data="text/plain=hello world"
44
+ playwright-cli hover e4
45
+ playwright-cli select e9 "option-value"
46
+ playwright-cli upload ./document.pdf
47
+ playwright-cli check e12
48
+ playwright-cli uncheck e12
49
+ playwright-cli snapshot
50
+ # search the snapshot for text or a regexp, returns matching nodes with surrounding context
51
+ playwright-cli find "Sign in"
52
+ playwright-cli find --regex "Sign (in|up)"
53
+ # wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
54
+ playwright-cli find --regex "/sign (in|up)/i"
55
+ playwright-cli eval "document.title"
56
+ playwright-cli eval "el => el.textContent" e5
57
+ # get element id, class, or any attribute not visible in the snapshot
58
+ playwright-cli eval "el => el.id" e5
59
+ playwright-cli eval "el => el.getAttribute('data-testid')" e5
60
+ playwright-cli dialog-accept
61
+ playwright-cli dialog-accept "confirmation text"
62
+ playwright-cli dialog-dismiss
63
+ playwright-cli resize 1920 1080
64
+ playwright-cli close
65
+ ```
66
+
67
+ ### Navigation
68
+
69
+ ```bash
70
+ playwright-cli go-back
71
+ playwright-cli go-forward
72
+ playwright-cli reload
73
+ ```
74
+
75
+ ### Keyboard
76
+
77
+ ```bash
78
+ playwright-cli press Enter
79
+ playwright-cli press ArrowDown
80
+ playwright-cli keydown Shift
81
+ playwright-cli keyup Shift
82
+ ```
83
+
84
+ ### Mouse
85
+
86
+ ```bash
87
+ playwright-cli mousemove 150 300
88
+ playwright-cli mousedown
89
+ playwright-cli mousedown right
90
+ playwright-cli mouseup
91
+ playwright-cli mouseup right
92
+ playwright-cli mousewheel 0 100
93
+ ```
94
+
95
+ ### Save as
96
+
97
+ ```bash
98
+ playwright-cli screenshot
99
+ playwright-cli screenshot e5
100
+ playwright-cli screenshot --filename=page.png
101
+ playwright-cli screenshot --hires
102
+ playwright-cli pdf --filename=page.pdf
103
+ ```
104
+
105
+ ### Tabs
106
+
107
+ ```bash
108
+ playwright-cli tab-list
109
+ playwright-cli tab-new
110
+ playwright-cli tab-new https://example.com/page
111
+ playwright-cli tab-close
112
+ playwright-cli tab-close 2
113
+ playwright-cli tab-select 0
114
+ ```
115
+
116
+ ### Storage
117
+
118
+ ```bash
119
+ playwright-cli state-save
120
+ playwright-cli state-save auth.json
121
+ playwright-cli state-load auth.json
122
+
123
+ # Cookies
124
+ playwright-cli cookie-list
125
+ playwright-cli cookie-list --domain=example.com
126
+ playwright-cli cookie-get session_id
127
+ playwright-cli cookie-set session_id abc123
128
+ playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
129
+ playwright-cli cookie-delete session_id
130
+ playwright-cli cookie-clear
131
+
132
+ # LocalStorage
133
+ playwright-cli localstorage-list
134
+ playwright-cli localstorage-get theme
135
+ playwright-cli localstorage-set theme dark
136
+ playwright-cli localstorage-delete theme
137
+ playwright-cli localstorage-clear
138
+
139
+ # SessionStorage
140
+ playwright-cli sessionstorage-list
141
+ playwright-cli sessionstorage-get step
142
+ playwright-cli sessionstorage-set step 3
143
+ playwright-cli sessionstorage-delete step
144
+ playwright-cli sessionstorage-clear
145
+ ```
146
+
147
+ ### Network
148
+
149
+ ```bash
150
+ playwright-cli route "**/*.jpg" --status=404
151
+ playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
152
+ playwright-cli route-list
153
+ playwright-cli unroute "**/*.jpg"
154
+ playwright-cli unroute
155
+ ```
156
+
157
+ ### DevTools
158
+
159
+ ```bash
160
+ playwright-cli console
161
+ playwright-cli console warning
162
+ playwright-cli requests
163
+ playwright-cli request 5
164
+ playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
165
+ playwright-cli run-code --filename=script.js
166
+ playwright-cli tracing-start
167
+ playwright-cli tracing-stop
168
+ playwright-cli video-start video.webm
169
+ playwright-cli video-chapter "Chapter Title" --description="Details" --duration=2000
170
+ playwright-cli video-stop
171
+
172
+ # annotate each subsequent action (click, type, ...) with a callout naming the action and highlighting the target
173
+ playwright-cli video-show-actions --duration=600 --position=top-right
174
+ playwright-cli video-hide-actions
175
+
176
+ # launch the dashboard for UI review / design feedback — user annotates the page, you receive the annotated screenshot, snapshot, and notes
177
+ playwright-cli show --annotate
178
+
179
+ # generate a Playwright locator for an element from its ref or selector
180
+ playwright-cli generate-locator e5 --raw
181
+
182
+ # show a persistent highlight overlay for an element, optionally with a custom style
183
+ playwright-cli highlight e5
184
+ playwright-cli highlight e5 --style="outline: 3px dashed red"
185
+ # hide a single element highlight, or all page highlights when no target is given
186
+ playwright-cli highlight e5 --hide
187
+ playwright-cli highlight --hide
188
+ ```
189
+
190
+ ## Raw output
191
+
192
+ The global `--raw` option strips page status, generated code, and snapshot sections from the output, returning only the result value. Use it to pipe command output into other tools. Commands that don't produce output return nothing.
193
+
194
+ ```bash
195
+ playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
196
+ playwright-cli --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
197
+ playwright-cli --raw snapshot > before.yml
198
+ playwright-cli click e5
199
+ playwright-cli --raw snapshot > after.yml
200
+ diff before.yml after.yml
201
+ TOKEN=$(playwright-cli --raw cookie-get session_id)
202
+ playwright-cli --raw localstorage-get theme
203
+ ```
204
+
205
+ For structured output wrapping every reply as JSON, pass --json
206
+ ```bash
207
+ playwright-cli list --json
208
+ ```
209
+
210
+ ## Open parameters
211
+ ```bash
212
+ # Use specific browser when creating session
213
+ playwright-cli open --browser=chrome
214
+ playwright-cli open --browser=firefox
215
+ playwright-cli open --browser=webkit
216
+ playwright-cli open --browser=msedge
217
+
218
+ # Emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit).
219
+ # Prefer this when a mobile layout is acceptable: mobile pages are usually
220
+ # lighter, so snapshots are smaller and cheaper.
221
+ playwright-cli open --mobile
222
+ playwright-cli open --device="iPhone 15"
223
+
224
+ # Use persistent profile (by default profile is in-memory)
225
+ playwright-cli open --persistent
226
+ # Use persistent profile with custom directory
227
+ playwright-cli open --profile=/path/to/profile
228
+
229
+ # Connect to browser via Playwright Extension
230
+ playwright-cli attach --extension=chrome
231
+
232
+ # Connect to a running Chrome or Edge by channel name
233
+ playwright-cli attach --cdp=chrome
234
+ playwright-cli attach --cdp=msedge
235
+
236
+ # Connect to a running browser via CDP endpoint
237
+ playwright-cli attach --cdp=http://localhost:9222
238
+
239
+ # Start with config file
240
+ playwright-cli open --config=my-config.json
241
+
242
+ # Close the browser
243
+ playwright-cli close
244
+ # Detach from an attached browser (leaves the external browser running)
245
+ playwright-cli -s=msedge detach
246
+ # Delete user data for the default session
247
+ playwright-cli delete-data
248
+ ```
249
+
250
+ ## URLs with `&` on Windows
251
+
252
+ On Windows, `cmd.exe` and PowerShell treat `&` as a command separator, so URLs with multiple query parameters get truncated before `playwright-cli` runs. Escape `&` with `^&` in `cmd.exe`, or use `--%` in PowerShell:
253
+
254
+ ```batch
255
+ playwright-cli goto "https://example.com/?a=1^&b=2"
256
+ ```
257
+
258
+ ```powershell
259
+ playwright-cli --% goto "https://example.com/?a=1&b=2"
260
+ ```
261
+
262
+ ## Snapshots
263
+
264
+ After each command, playwright-cli provides a snapshot of the current browser state.
265
+
266
+ ```bash
267
+ > playwright-cli goto https://example.com
268
+ ### Page
269
+ - Page URL: https://example.com/
270
+ - Page Title: Example Domain
271
+ ### Snapshot
272
+ [Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
273
+ ```
274
+
275
+ You can also take a snapshot on demand using `playwright-cli snapshot` command. All the options below can be combined as needed.
276
+
277
+ ```bash
278
+ # default - save to a file with timestamp-based name
279
+ playwright-cli snapshot
280
+
281
+ # save to file, use when snapshot is a part of the workflow result
282
+ playwright-cli snapshot --filename=after-click.yaml
283
+
284
+ # snapshot an element instead of the whole page
285
+ playwright-cli snapshot "#main"
286
+
287
+ # limit snapshot depth for efficiency, take a partial snapshot afterwards
288
+ playwright-cli snapshot --depth=4
289
+ playwright-cli snapshot e34
290
+
291
+ # include each element's bounding box as [box=x,y,width,height]
292
+ playwright-cli snapshot --boxes
293
+
294
+ # search a large snapshot instead of capturing it all — returns matching nodes
295
+ # with 3 lines of context around each match (like grep -C)
296
+ playwright-cli find "Add to cart"
297
+ playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
298
+ ```
299
+
300
+ ## Targeting elements
301
+
302
+ By default, use refs from the snapshot to interact with page elements.
303
+
304
+ ```bash
305
+ # get snapshot with refs
306
+ playwright-cli snapshot
307
+
308
+ # interact using a ref
309
+ playwright-cli click e15
310
+ ```
311
+
312
+ You can also use css selectors or Playwright locators.
313
+
314
+ ```bash
315
+ # css selector
316
+ playwright-cli click "#main > button.submit"
317
+
318
+ # role locator
319
+ playwright-cli click "getByRole('button', { name: 'Submit' })"
320
+
321
+ # test id
322
+ playwright-cli click "getByTestId('submit-button')"
323
+ ```
324
+
325
+ ## Browser Sessions
326
+
327
+ ```bash
328
+ # create new browser session named "mysession" with persistent profile
329
+ playwright-cli -s=mysession open example.com --persistent
330
+ # same with manually specified profile directory (use when requested explicitly)
331
+ playwright-cli -s=mysession open example.com --profile=/path/to/profile
332
+ playwright-cli -s=mysession click e6
333
+ playwright-cli -s=mysession close # stop a named browser
334
+ playwright-cli -s=mysession delete-data # delete user data for persistent session
335
+
336
+ playwright-cli list
337
+ # Close all browsers
338
+ playwright-cli close-all
339
+ # Forcefully kill all browser processes
340
+ playwright-cli kill-all
341
+ ```
342
+
343
+ ## Installation
344
+
345
+ If global `playwright-cli` command is not available, try a local version via `npx playwright cli`:
346
+
347
+ ```bash
348
+ npx --no-install playwright --version
349
+ ```
350
+
351
+ When local version is available, use `npx playwright cli` in all commands. Otherwise, install `playwright-cli` as a global command:
352
+
353
+ ```bash
354
+ npm install -g @playwright/cli@latest
355
+ ```
356
+
357
+ ## Example: Form submission
358
+
359
+ ```bash
360
+ playwright-cli open https://example.com/form
361
+ playwright-cli snapshot
362
+
363
+ playwright-cli fill e1 "user@example.com"
364
+ playwright-cli fill e2 "password123"
365
+ playwright-cli click e3
366
+ playwright-cli snapshot
367
+ playwright-cli close
368
+ ```
369
+
370
+ ## Example: Multi-tab workflow
371
+
372
+ ```bash
373
+ playwright-cli open https://example.com
374
+ playwright-cli tab-new https://example.com/other
375
+ playwright-cli tab-list
376
+ playwright-cli tab-select 0
377
+ playwright-cli snapshot
378
+ playwright-cli close
379
+ ```
380
+
381
+ ## Example: Debugging with DevTools
382
+
383
+ ```bash
384
+ playwright-cli open https://example.com
385
+ playwright-cli click e4
386
+ playwright-cli fill e7 "test"
387
+ playwright-cli console
388
+ playwright-cli requests
389
+ playwright-cli close
390
+ ```
391
+
392
+ ```bash
393
+ playwright-cli open https://example.com
394
+ playwright-cli tracing-start
395
+ playwright-cli click e4
396
+ playwright-cli fill e7 "test"
397
+ playwright-cli tracing-stop
398
+ playwright-cli close
399
+ ```
400
+
401
+ ## Example: Interactive session
402
+
403
+ Ask the user for UI review or design feedback. The user draws boxes on the live page and types comments; you receive the annotated screenshot, the snapshot of the marked region, and the user's notes. Use this whenever the user asks for "UI review", "design feedback", or to "ask the user what they think / want / mean":
404
+
405
+ ```bash
406
+ playwright-cli open https://example.com
407
+ playwright-cli show --annotate
408
+ ```
409
+
410
+ ## Specific tasks
411
+
412
+ * **Running and Debugging Playwright tests** [references/playwright-tests.md](references/playwright-tests.md)
413
+ * **Request mocking** [references/request-mocking.md](references/request-mocking.md)
414
+ * **Running Playwright code** [references/running-code.md](references/running-code.md)
415
+ * **Browser session management** [references/session-management.md](references/session-management.md)
416
+ * **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
417
+ * **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md)
418
+ * **Tracing** [references/tracing.md](references/tracing.md)
419
+ * **Video recording** [references/video-recording.md](references/video-recording.md)
420
+ * **Inspecting element attributes** [references/element-attributes.md](references/element-attributes.md)