@clubmatto/ai-kit 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +65 -0
  3. package/dist/scripts/fetch-playwright-skills.js +63 -0
  4. package/dist/src/cmd/sync.js +109 -0
  5. package/dist/src/commands/sync.js +111 -0
  6. package/dist/src/content.js +99 -0
  7. package/dist/src/index.js +19 -0
  8. package/dist/src/logger.js +2 -0
  9. package/dist/src/manifest.js +24 -0
  10. package/dist/src/output.js +46 -0
  11. package/dist/src/reader.js +99 -0
  12. package/dist/src/template.js +10 -0
  13. package/dist/tests/content.test.js +141 -0
  14. package/dist/tests/integration/cli.test.js +43 -0
  15. package/dist/tests/output.js +36 -0
  16. package/dist/tests/reader.test.js +141 -0
  17. package/dist/tests/sync.test.js +90 -0
  18. package/dist/tests/utils.js +20 -0
  19. package/dist/vitest.config.js +9 -0
  20. package/docs/roadmap.md +16 -0
  21. package/eslint.config.mjs +38 -0
  22. package/package.json +78 -0
  23. package/scripts/fetch-playwright-skills.ts +79 -0
  24. package/src/agents/monorepo.md +30 -0
  25. package/src/agents/opencode.json +31 -0
  26. package/src/cmd/sync.ts +158 -0
  27. package/src/commands/commit.md +43 -0
  28. package/src/commands/interview.md +92 -0
  29. package/src/commands/synth.md +45 -0
  30. package/src/index.ts +24 -0
  31. package/src/logger.ts +10 -0
  32. package/src/manifest.ts +29 -0
  33. package/src/output.ts +66 -0
  34. package/src/reader.ts +114 -0
  35. package/src/rules/go.md +306 -0
  36. package/src/rules/kotlin.md +177 -0
  37. package/src/rules/plan-mode.md +7 -0
  38. package/src/rules/spring-boot.md +549 -0
  39. package/src/rules/typescript.md +302 -0
  40. package/src/rules/unsure.md +9 -0
  41. package/src/skills/image-gen/SKILL.md +50 -0
  42. package/src/skills/image-gen/scripts/generate.js +166 -0
  43. package/src/skills/playwright-cli/SKILL.md +279 -0
  44. package/src/skills/playwright-cli/references/request-mocking.md +87 -0
  45. package/src/skills/playwright-cli/references/running-code.md +232 -0
  46. package/src/skills/playwright-cli/references/session-management.md +170 -0
  47. package/src/skills/playwright-cli/references/storage-state.md +275 -0
  48. package/src/skills/playwright-cli/references/test-generation.md +88 -0
  49. package/src/skills/playwright-cli/references/tracing.md +142 -0
  50. package/src/skills/playwright-cli/references/video-recording.md +43 -0
  51. package/src/template.ts +14 -0
  52. package/tests/fixtures/agents/another.json +4 -0
  53. package/tests/fixtures/agents/monorepo.md +5 -0
  54. package/tests/fixtures/agents/opencode.json +4 -0
  55. package/tests/fixtures/commands/another.md +5 -0
  56. package/tests/fixtures/commands/commit.md +7 -0
  57. package/tests/fixtures/commands/test.md +13 -0
  58. package/tests/fixtures/rules/nested/nested-rule.md +3 -0
  59. package/tests/fixtures/rules/test-rule.md +5 -0
  60. package/tests/fixtures/rules/typescript.md +5 -0
  61. package/tests/fixtures/skills/test-skill/SKILL.md +7 -0
  62. package/tests/fixtures/skills/test-skill/nested-refs/doc.md +3 -0
  63. package/tests/fixtures/skills/test-skill/skill-details.md +7 -0
  64. package/tests/integration/cli.test.ts +55 -0
  65. package/tests/output.ts +37 -0
  66. package/tests/reader.test.ts +193 -0
  67. package/tests/sync.test.ts +136 -0
  68. package/tests/utils.ts +17 -0
  69. package/tsconfig.json +23 -0
  70. package/vitest.config.ts +8 -0
@@ -0,0 +1,170 @@
1
+ # Browser Session Management
2
+
3
+ Run multiple isolated browser sessions concurrently with state persistence.
4
+
5
+ ## Named Browser Sessions
6
+
7
+ Use `-s` flag to isolate browser contexts:
8
+
9
+ ```bash
10
+ # Browser 1: Authentication flow
11
+ playwright-cli -s=auth open https://app.example.com/login
12
+
13
+ # Browser 2: Public browsing (separate cookies, storage)
14
+ playwright-cli -s=public open https://example.com
15
+
16
+ # Commands are isolated by browser session
17
+ playwright-cli -s=auth fill e1 "user@example.com"
18
+ playwright-cli -s=public snapshot
19
+ ```
20
+
21
+ ## Browser Session Isolation Properties
22
+
23
+ Each browser session has independent:
24
+
25
+ - Cookies
26
+ - LocalStorage / SessionStorage
27
+ - IndexedDB
28
+ - Cache
29
+ - Browsing history
30
+ - Open tabs
31
+
32
+ ## Browser Session Commands
33
+
34
+ ```bash
35
+ # List all browser sessions
36
+ playwright-cli list
37
+
38
+ # Stop a browser session (close the browser)
39
+ playwright-cli close # stop the default browser
40
+ playwright-cli -s=mysession close # stop a named browser
41
+
42
+ # Stop all browser sessions
43
+ playwright-cli close-all
44
+
45
+ # Forcefully kill all daemon processes (for stale/zombie processes)
46
+ playwright-cli kill-all
47
+
48
+ # Delete browser session user data (profile directory)
49
+ playwright-cli delete-data # delete default browser data
50
+ playwright-cli -s=mysession delete-data # delete named browser data
51
+ ```
52
+
53
+ ## Environment Variable
54
+
55
+ Set a default browser session name via environment variable:
56
+
57
+ ```bash
58
+ export PLAYWRIGHT_CLI_SESSION="mysession"
59
+ playwright-cli open example.com # Uses "mysession" automatically
60
+ ```
61
+
62
+ ## Common Patterns
63
+
64
+ ### Concurrent Scraping
65
+
66
+ ```bash
67
+ #!/bin/bash
68
+ # Scrape multiple sites concurrently
69
+
70
+ # Start all browsers
71
+ playwright-cli -s=site1 open https://site1.com &
72
+ playwright-cli -s=site2 open https://site2.com &
73
+ playwright-cli -s=site3 open https://site3.com &
74
+ wait
75
+
76
+ # Take snapshots from each
77
+ playwright-cli -s=site1 snapshot
78
+ playwright-cli -s=site2 snapshot
79
+ playwright-cli -s=site3 snapshot
80
+
81
+ # Cleanup
82
+ playwright-cli close-all
83
+ ```
84
+
85
+ ### A/B Testing Sessions
86
+
87
+ ```bash
88
+ # Test different user experiences
89
+ playwright-cli -s=variant-a open "https://app.com?variant=a"
90
+ playwright-cli -s=variant-b open "https://app.com?variant=b"
91
+
92
+ # Compare
93
+ playwright-cli -s=variant-a screenshot
94
+ playwright-cli -s=variant-b screenshot
95
+ ```
96
+
97
+ ### Persistent Profile
98
+
99
+ By default, browser profile is kept in memory only. Use `--persistent` flag on `open` to persist the browser profile to disk:
100
+
101
+ ```bash
102
+ # Use persistent profile (auto-generated location)
103
+ playwright-cli open https://example.com --persistent
104
+
105
+ # Use persistent profile with custom directory
106
+ playwright-cli open https://example.com --profile=/path/to/profile
107
+ ```
108
+
109
+ ## Default Browser Session
110
+
111
+ When `-s` is omitted, commands use the default browser session:
112
+
113
+ ```bash
114
+ # These use the same default browser session
115
+ playwright-cli open https://example.com
116
+ playwright-cli snapshot
117
+ playwright-cli close # Stops default browser
118
+ ```
119
+
120
+ ## Browser Session Configuration
121
+
122
+ Configure a browser session with specific settings when opening:
123
+
124
+ ```bash
125
+ # Open with config file
126
+ playwright-cli open https://example.com --config=.playwright/my-cli.json
127
+
128
+ # Open with specific browser
129
+ playwright-cli open https://example.com --browser=firefox
130
+
131
+ # Open in headed mode
132
+ playwright-cli open https://example.com --headed
133
+
134
+ # Open with persistent profile
135
+ playwright-cli open https://example.com --persistent
136
+ ```
137
+
138
+ ## Best Practices
139
+
140
+ ### 1. Name Browser Sessions Semantically
141
+
142
+ ```bash
143
+ # GOOD: Clear purpose
144
+ playwright-cli -s=github-auth open https://github.com
145
+ playwright-cli -s=docs-scrape open https://docs.example.com
146
+
147
+ # AVOID: Generic names
148
+ playwright-cli -s=s1 open https://github.com
149
+ ```
150
+
151
+ ### 2. Always Clean Up
152
+
153
+ ```bash
154
+ # Stop browsers when done
155
+ playwright-cli -s=auth close
156
+ playwright-cli -s=scrape close
157
+
158
+ # Or stop all at once
159
+ playwright-cli close-all
160
+
161
+ # If browsers become unresponsive or zombie processes remain
162
+ playwright-cli kill-all
163
+ ```
164
+
165
+ ### 3. Delete Stale Browser Data
166
+
167
+ ```bash
168
+ # Remove old browser data to free disk space
169
+ playwright-cli -s=oldsession delete-data
170
+ ```
@@ -0,0 +1,275 @@
1
+ # Storage Management
2
+
3
+ Manage cookies, localStorage, sessionStorage, and browser storage state.
4
+
5
+ ## Storage State
6
+
7
+ Save and restore complete browser state including cookies and storage.
8
+
9
+ ### Save Storage State
10
+
11
+ ```bash
12
+ # Save to auto-generated filename (storage-state-{timestamp}.json)
13
+ playwright-cli state-save
14
+
15
+ # Save to specific filename
16
+ playwright-cli state-save my-auth-state.json
17
+ ```
18
+
19
+ ### Restore Storage State
20
+
21
+ ```bash
22
+ # Load storage state from file
23
+ playwright-cli state-load my-auth-state.json
24
+
25
+ # Reload page to apply cookies
26
+ playwright-cli open https://example.com
27
+ ```
28
+
29
+ ### Storage State File Format
30
+
31
+ The saved file contains:
32
+
33
+ ```json
34
+ {
35
+ "cookies": [
36
+ {
37
+ "name": "session_id",
38
+ "value": "abc123",
39
+ "domain": "example.com",
40
+ "path": "/",
41
+ "expires": 1735689600,
42
+ "httpOnly": true,
43
+ "secure": true,
44
+ "sameSite": "Lax"
45
+ }
46
+ ],
47
+ "origins": [
48
+ {
49
+ "origin": "https://example.com",
50
+ "localStorage": [
51
+ { "name": "theme", "value": "dark" },
52
+ { "name": "user_id", "value": "12345" }
53
+ ]
54
+ }
55
+ ]
56
+ }
57
+ ```
58
+
59
+ ## Cookies
60
+
61
+ ### List All Cookies
62
+
63
+ ```bash
64
+ playwright-cli cookie-list
65
+ ```
66
+
67
+ ### Filter Cookies by Domain
68
+
69
+ ```bash
70
+ playwright-cli cookie-list --domain=example.com
71
+ ```
72
+
73
+ ### Filter Cookies by Path
74
+
75
+ ```bash
76
+ playwright-cli cookie-list --path=/api
77
+ ```
78
+
79
+ ### Get Specific Cookie
80
+
81
+ ```bash
82
+ playwright-cli cookie-get session_id
83
+ ```
84
+
85
+ ### Set a Cookie
86
+
87
+ ```bash
88
+ # Basic cookie
89
+ playwright-cli cookie-set session abc123
90
+
91
+ # Cookie with options
92
+ playwright-cli cookie-set session abc123 --domain=example.com --path=/ --httpOnly --secure --sameSite=Lax
93
+
94
+ # Cookie with expiration (Unix timestamp)
95
+ playwright-cli cookie-set remember_me token123 --expires=1735689600
96
+ ```
97
+
98
+ ### Delete a Cookie
99
+
100
+ ```bash
101
+ playwright-cli cookie-delete session_id
102
+ ```
103
+
104
+ ### Clear All Cookies
105
+
106
+ ```bash
107
+ playwright-cli cookie-clear
108
+ ```
109
+
110
+ ### Advanced: Multiple Cookies or Custom Options
111
+
112
+ For complex scenarios like adding multiple cookies at once, use `run-code`:
113
+
114
+ ```bash
115
+ playwright-cli run-code "async page => {
116
+ await page.context().addCookies([
117
+ { name: 'session_id', value: 'sess_abc123', domain: 'example.com', path: '/', httpOnly: true },
118
+ { name: 'preferences', value: JSON.stringify({ theme: 'dark' }), domain: 'example.com', path: '/' }
119
+ ]);
120
+ }"
121
+ ```
122
+
123
+ ## Local Storage
124
+
125
+ ### List All localStorage Items
126
+
127
+ ```bash
128
+ playwright-cli localstorage-list
129
+ ```
130
+
131
+ ### Get Single Value
132
+
133
+ ```bash
134
+ playwright-cli localstorage-get token
135
+ ```
136
+
137
+ ### Set Value
138
+
139
+ ```bash
140
+ playwright-cli localstorage-set theme dark
141
+ ```
142
+
143
+ ### Set JSON Value
144
+
145
+ ```bash
146
+ playwright-cli localstorage-set user_settings '{"theme":"dark","language":"en"}'
147
+ ```
148
+
149
+ ### Delete Single Item
150
+
151
+ ```bash
152
+ playwright-cli localstorage-delete token
153
+ ```
154
+
155
+ ### Clear All localStorage
156
+
157
+ ```bash
158
+ playwright-cli localstorage-clear
159
+ ```
160
+
161
+ ### Advanced: Multiple Operations
162
+
163
+ For complex scenarios like setting multiple values at once, use `run-code`:
164
+
165
+ ```bash
166
+ playwright-cli run-code "async page => {
167
+ await page.evaluate(() => {
168
+ localStorage.setItem('token', 'jwt_abc123');
169
+ localStorage.setItem('user_id', '12345');
170
+ localStorage.setItem('expires_at', Date.now() + 3600000);
171
+ });
172
+ }"
173
+ ```
174
+
175
+ ## Session Storage
176
+
177
+ ### List All sessionStorage Items
178
+
179
+ ```bash
180
+ playwright-cli sessionstorage-list
181
+ ```
182
+
183
+ ### Get Single Value
184
+
185
+ ```bash
186
+ playwright-cli sessionstorage-get form_data
187
+ ```
188
+
189
+ ### Set Value
190
+
191
+ ```bash
192
+ playwright-cli sessionstorage-set step 3
193
+ ```
194
+
195
+ ### Delete Single Item
196
+
197
+ ```bash
198
+ playwright-cli sessionstorage-delete step
199
+ ```
200
+
201
+ ### Clear sessionStorage
202
+
203
+ ```bash
204
+ playwright-cli sessionstorage-clear
205
+ ```
206
+
207
+ ## IndexedDB
208
+
209
+ ### List Databases
210
+
211
+ ```bash
212
+ playwright-cli run-code "async page => {
213
+ return await page.evaluate(async () => {
214
+ const databases = await indexedDB.databases();
215
+ return databases;
216
+ });
217
+ }"
218
+ ```
219
+
220
+ ### Delete Database
221
+
222
+ ```bash
223
+ playwright-cli run-code "async page => {
224
+ await page.evaluate(() => {
225
+ indexedDB.deleteDatabase('myDatabase');
226
+ });
227
+ }"
228
+ ```
229
+
230
+ ## Common Patterns
231
+
232
+ ### Authentication State Reuse
233
+
234
+ ```bash
235
+ # Step 1: Login and save state
236
+ playwright-cli open https://app.example.com/login
237
+ playwright-cli snapshot
238
+ playwright-cli fill e1 "user@example.com"
239
+ playwright-cli fill e2 "password123"
240
+ playwright-cli click e3
241
+
242
+ # Save the authenticated state
243
+ playwright-cli state-save auth.json
244
+
245
+ # Step 2: Later, restore state and skip login
246
+ playwright-cli state-load auth.json
247
+ playwright-cli open https://app.example.com/dashboard
248
+ # Already logged in!
249
+ ```
250
+
251
+ ### Save and Restore Roundtrip
252
+
253
+ ```bash
254
+ # Set up authentication state
255
+ playwright-cli open https://example.com
256
+ playwright-cli eval "() => { document.cookie = 'session=abc123'; localStorage.setItem('user', 'john'); }"
257
+
258
+ # Save state to file
259
+ playwright-cli state-save my-session.json
260
+
261
+ # ... later, in a new session ...
262
+
263
+ # Restore state
264
+ playwright-cli state-load my-session.json
265
+ playwright-cli open https://example.com
266
+ # Cookies and localStorage are restored!
267
+ ```
268
+
269
+ ## Security Notes
270
+
271
+ - Never commit storage state files containing auth tokens
272
+ - Add `*.auth-state.json` to `.gitignore`
273
+ - Delete state files after automation completes
274
+ - Use environment variables for sensitive data
275
+ - By default, sessions run in-memory mode which is safer for sensitive operations
@@ -0,0 +1,88 @@
1
+ # Test Generation
2
+
3
+ Generate Playwright test code automatically as you interact with the browser.
4
+
5
+ ## How It Works
6
+
7
+ Every action you perform with `playwright-cli` generates corresponding Playwright TypeScript code.
8
+ This code appears in the output and can be copied directly into your test files.
9
+
10
+ ## Example Workflow
11
+
12
+ ```bash
13
+ # Start a session
14
+ playwright-cli open https://example.com/login
15
+
16
+ # Take a snapshot to see elements
17
+ playwright-cli snapshot
18
+ # Output shows: e1 [textbox "Email"], e2 [textbox "Password"], e3 [button "Sign In"]
19
+
20
+ # Fill form fields - generates code automatically
21
+ playwright-cli fill e1 "user@example.com"
22
+ # Ran Playwright code:
23
+ # await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com');
24
+
25
+ playwright-cli fill e2 "password123"
26
+ # Ran Playwright code:
27
+ # await page.getByRole('textbox', { name: 'Password' }).fill('password123');
28
+
29
+ playwright-cli click e3
30
+ # Ran Playwright code:
31
+ # await page.getByRole('button', { name: 'Sign In' }).click();
32
+ ```
33
+
34
+ ## Building a Test File
35
+
36
+ Collect the generated code into a Playwright test:
37
+
38
+ ```typescript
39
+ import { test, expect } from "@playwright/test";
40
+
41
+ test("login flow", async ({ page }) => {
42
+ // Generated code from playwright-cli session:
43
+ await page.goto("https://example.com/login");
44
+ await page.getByRole("textbox", { name: "Email" }).fill("user@example.com");
45
+ await page.getByRole("textbox", { name: "Password" }).fill("password123");
46
+ await page.getByRole("button", { name: "Sign In" }).click();
47
+
48
+ // Add assertions
49
+ await expect(page).toHaveURL(/.*dashboard/);
50
+ });
51
+ ```
52
+
53
+ ## Best Practices
54
+
55
+ ### 1. Use Semantic Locators
56
+
57
+ The generated code uses role-based locators when possible, which are more resilient:
58
+
59
+ ```typescript
60
+ // Generated (good - semantic)
61
+ await page.getByRole("button", { name: "Submit" }).click();
62
+
63
+ // Avoid (fragile - CSS selectors)
64
+ await page.locator("#submit-btn").click();
65
+ ```
66
+
67
+ ### 2. Explore Before Recording
68
+
69
+ Take snapshots to understand the page structure before recording actions:
70
+
71
+ ```bash
72
+ playwright-cli open https://example.com
73
+ playwright-cli snapshot
74
+ # Review the element structure
75
+ playwright-cli click e5
76
+ ```
77
+
78
+ ### 3. Add Assertions Manually
79
+
80
+ Generated code captures actions but not assertions. Add expectations in your test:
81
+
82
+ ```typescript
83
+ // Generated action
84
+ await page.getByRole("button", { name: "Submit" }).click();
85
+
86
+ // Manual assertion
87
+ await expect(page.getByText("Success")).toBeVisible();
88
+ ```
@@ -0,0 +1,142 @@
1
+ # Tracing
2
+
3
+ Capture detailed execution traces for debugging and analysis. Traces include DOM snapshots, screenshots, network activity, and console logs.
4
+
5
+ ## Basic Usage
6
+
7
+ ```bash
8
+ # Start trace recording
9
+ playwright-cli tracing-start
10
+
11
+ # Perform actions
12
+ playwright-cli open https://example.com
13
+ playwright-cli click e1
14
+ playwright-cli fill e2 "test"
15
+
16
+ # Stop trace recording
17
+ playwright-cli tracing-stop
18
+ ```
19
+
20
+ ## Trace Output Files
21
+
22
+ When you start tracing, Playwright creates a `traces/` directory with several files:
23
+
24
+ ### `trace-{timestamp}.trace`
25
+
26
+ **Action log** - The main trace file containing:
27
+
28
+ - Every action performed (clicks, fills, navigations)
29
+ - DOM snapshots before and after each action
30
+ - Screenshots at each step
31
+ - Timing information
32
+ - Console messages
33
+ - Source locations
34
+
35
+ ### `trace-{timestamp}.network`
36
+
37
+ **Network log** - Complete network activity:
38
+
39
+ - All HTTP requests and responses
40
+ - Request headers and bodies
41
+ - Response headers and bodies
42
+ - Timing (DNS, connect, TLS, TTFB, download)
43
+ - Resource sizes
44
+ - Failed requests and errors
45
+
46
+ ### `resources/`
47
+
48
+ **Resources directory** - Cached resources:
49
+
50
+ - Images, fonts, stylesheets, scripts
51
+ - Response bodies for replay
52
+ - Assets needed to reconstruct page state
53
+
54
+ ## What Traces Capture
55
+
56
+ | Category | Details |
57
+ | --------------- | -------------------------------------------------- |
58
+ | **Actions** | Clicks, fills, hovers, keyboard input, navigations |
59
+ | **DOM** | Full DOM snapshot before/after each action |
60
+ | **Screenshots** | Visual state at each step |
61
+ | **Network** | All requests, responses, headers, bodies, timing |
62
+ | **Console** | All console.log, warn, error messages |
63
+ | **Timing** | Precise timing for each operation |
64
+
65
+ ## Use Cases
66
+
67
+ ### Debugging Failed Actions
68
+
69
+ ```bash
70
+ playwright-cli tracing-start
71
+ playwright-cli open https://app.example.com
72
+
73
+ # This click fails - why?
74
+ playwright-cli click e5
75
+
76
+ playwright-cli tracing-stop
77
+ # Open trace to see DOM state when click was attempted
78
+ ```
79
+
80
+ ### Analyzing Performance
81
+
82
+ ```bash
83
+ playwright-cli tracing-start
84
+ playwright-cli open https://slow-site.com
85
+ playwright-cli tracing-stop
86
+
87
+ # View network waterfall to identify slow resources
88
+ ```
89
+
90
+ ### Capturing Evidence
91
+
92
+ ```bash
93
+ # Record a complete user flow for documentation
94
+ playwright-cli tracing-start
95
+
96
+ playwright-cli open https://app.example.com/checkout
97
+ playwright-cli fill e1 "4111111111111111"
98
+ playwright-cli fill e2 "12/25"
99
+ playwright-cli fill e3 "123"
100
+ playwright-cli click e4
101
+
102
+ playwright-cli tracing-stop
103
+ # Trace shows exact sequence of events
104
+ ```
105
+
106
+ ## Trace vs Video vs Screenshot
107
+
108
+ | Feature | Trace | Video | Screenshot |
109
+ | ----------------------- | ----------- | ----------- | ---------------- |
110
+ | **Format** | .trace file | .webm video | .png/.jpeg image |
111
+ | **DOM inspection** | Yes | No | No |
112
+ | **Network details** | Yes | No | No |
113
+ | **Step-by-step replay** | Yes | Continuous | Single frame |
114
+ | **File size** | Medium | Large | Small |
115
+ | **Best for** | Debugging | Demos | Quick capture |
116
+
117
+ ## Best Practices
118
+
119
+ ### 1. Start Tracing Before the Problem
120
+
121
+ ```bash
122
+ # Trace the entire flow, not just the failing step
123
+ playwright-cli tracing-start
124
+ playwright-cli open https://example.com
125
+ # ... all steps leading to the issue ...
126
+ playwright-cli tracing-stop
127
+ ```
128
+
129
+ ### 2. Clean Up Old Traces
130
+
131
+ Traces can consume significant disk space:
132
+
133
+ ```bash
134
+ # Remove traces older than 7 days
135
+ find .playwright-cli/traces -mtime +7 -delete
136
+ ```
137
+
138
+ ## Limitations
139
+
140
+ - Traces add overhead to automation
141
+ - Large traces can consume significant disk space
142
+ - Some dynamic content may not replay perfectly
@@ -0,0 +1,43 @@
1
+ # Video Recording
2
+
3
+ Capture browser automation sessions as video for debugging, documentation, or verification. Produces WebM (VP8/VP9 codec).
4
+
5
+ ## Basic Recording
6
+
7
+ ```bash
8
+ # Start recording
9
+ playwright-cli video-start
10
+
11
+ # Perform actions
12
+ playwright-cli open https://example.com
13
+ playwright-cli snapshot
14
+ playwright-cli click e1
15
+ playwright-cli fill e2 "test input"
16
+
17
+ # Stop and save
18
+ playwright-cli video-stop demo.webm
19
+ ```
20
+
21
+ ## Best Practices
22
+
23
+ ### 1. Use Descriptive Filenames
24
+
25
+ ```bash
26
+ # Include context in filename
27
+ playwright-cli video-stop recordings/login-flow-2024-01-15.webm
28
+ playwright-cli video-stop recordings/checkout-test-run-42.webm
29
+ ```
30
+
31
+ ## Tracing vs Video
32
+
33
+ | Feature | Video | Tracing |
34
+ | -------- | -------------------- | ---------------------------------------- |
35
+ | Output | WebM file | Trace file (viewable in Trace Viewer) |
36
+ | Shows | Visual recording | DOM snapshots, network, console, actions |
37
+ | Use case | Demos, documentation | Debugging, analysis |
38
+ | Size | Larger | Smaller |
39
+
40
+ ## Limitations
41
+
42
+ - Recording adds slight overhead to automation
43
+ - Large recordings can consume significant disk space