patchright-cli 0.4.1__tar.gz → 0.6.0__tar.gz

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 (47) hide show
  1. patchright_cli-0.6.0/.claude-plugin/marketplace.json +20 -0
  2. patchright_cli-0.6.0/.github/workflows/ci.yml +34 -0
  3. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/.gitignore +1 -0
  4. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/CLAUDE.md +14 -3
  5. patchright_cli-0.6.0/Makefile +18 -0
  6. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/PKG-INFO +54 -55
  7. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/README.md +49 -54
  8. patchright_cli-0.6.0/docs/installation.md +146 -0
  9. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/pyproject.toml +11 -1
  10. patchright_cli-0.6.0/skills/patchright-cli/SKILL.md +350 -0
  11. patchright_cli-0.6.0/skills/patchright-cli/references/request-mocking.md +103 -0
  12. patchright_cli-0.6.0/skills/patchright-cli/references/running-code.md +129 -0
  13. patchright_cli-0.6.0/skills/patchright-cli/references/session-management.md +106 -0
  14. patchright_cli-0.6.0/skills/patchright-cli/references/snapshot-refs.md +86 -0
  15. patchright_cli-0.6.0/skills/patchright-cli/references/storage-state.md +113 -0
  16. patchright_cli-0.6.0/skills/patchright-cli/references/tracing.md +53 -0
  17. patchright_cli-0.6.0/skills/patchright-cli/references/video-recording.md +85 -0
  18. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/__init__.py +1 -1
  19. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/cli.py +131 -5
  20. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/daemon.py +311 -18
  21. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/ref_registry.py +27 -1
  22. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/snapshot.py +4 -2
  23. patchright_cli-0.6.0/tests/test_cli_config.py +203 -0
  24. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/tests/test_daemon_handlers.py +237 -0
  25. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/tests/test_ref_registry.py +51 -0
  26. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/uv.lock +111 -1
  27. patchright_cli-0.4.1/.claude-plugin/marketplace.json +0 -21
  28. patchright_cli-0.4.1/docs/installation.md +0 -177
  29. patchright_cli-0.4.1/docs/superpowers/plans/2026-04-14-cdp-attach.md +0 -297
  30. patchright_cli-0.4.1/docs/superpowers/plans/2026-04-14-cli-enhancements.md +0 -529
  31. patchright_cli-0.4.1/docs/superpowers/plans/2026-04-14-codegen.md +0 -234
  32. patchright_cli-0.4.1/docs/superpowers/plans/2026-04-14-context-config-and-permissions.md +0 -411
  33. patchright_cli-0.4.1/docs/superpowers/plans/2026-04-14-show-dashboard.md +0 -337
  34. patchright_cli-0.4.1/skills/patchright-cli/SKILL.md +0 -562
  35. patchright_cli-0.4.1/tests/test_cli_config.py +0 -74
  36. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/.claude-plugin/skills/browser-automation.json +0 -0
  37. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/.github/workflows/publish.yml +0 -0
  38. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/.pre-commit-config.yaml +0 -0
  39. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/CONTRIBUTING.md +0 -0
  40. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/LICENSE +0 -0
  41. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/patchright-cli +0 -0
  42. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/patchright-cli.cmd +0 -0
  43. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/__main__.py +0 -0
  44. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/src/patchright_cli/dashboard.py +0 -0
  45. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/tests/__init__.py +0 -0
  46. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/tests/fixture.html +0 -0
  47. {patchright_cli-0.4.1 → patchright_cli-0.6.0}/tests/test_e2e.py +0 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "patchright-cli",
3
+ "owner": {
4
+ "name": "Han Zhu"
5
+ },
6
+ "metadata": {
7
+ "description": "Anti-detect browser automation CLI & Skills for AI agents, powered by Patchright",
8
+ "version": "0.5.0"
9
+ },
10
+ "plugins": [
11
+ {
12
+ "name": "patchright-cli",
13
+ "description": "Anti-detect browser automation skill using Patchright (undetected Playwright fork)",
14
+ "source": "./",
15
+ "skills": [
16
+ "./skills/patchright-cli"
17
+ ]
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: astral-sh/setup-uv@v6
15
+ with:
16
+ version: ">=0.7,<0.8"
17
+ python-version: "3.12"
18
+ - run: uv venv && uv pip install -e ".[dev]"
19
+ - run: uv run pre-commit run --all-files
20
+
21
+ test:
22
+ strategy:
23
+ matrix:
24
+ os: [ubuntu-latest, windows-latest]
25
+ python-version: ["3.10", "3.12"]
26
+ runs-on: ${{ matrix.os }}
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: astral-sh/setup-uv@v6
30
+ with:
31
+ version: ">=0.7,<0.8"
32
+ python-version: ${{ matrix.python-version }}
33
+ - run: uv venv && uv pip install -e ".[dev]"
34
+ - run: uv run pytest tests/ -v --ignore=tests/test_e2e.py
@@ -6,4 +6,5 @@ __pycache__/
6
6
  dist/
7
7
  build/
8
8
  docs/reddit-post.md
9
+ docs/superpowers/
9
10
  .worktrees/
@@ -26,7 +26,18 @@ python -m patchright_cli <command> [args...]
26
26
  patchright-cli <command> [args...]
27
27
  ```
28
28
 
29
- There are no automated tests yet — changes are tested manually via the CLI.
29
+ ## Testing
30
+
31
+ ```bash
32
+ # Unit tests (no browser required)
33
+ pytest tests/ -v --ignore=tests/test_e2e.py
34
+
35
+ # E2E tests (requires Chrome)
36
+ pytest tests/test_e2e.py -v
37
+
38
+ # Lint
39
+ pre-commit run --all-files
40
+ ```
30
41
 
31
42
  ## Architecture
32
43
 
@@ -38,9 +49,9 @@ CLI (cli.py) --TCP:9321--> Daemon (daemon.py) --Patchright--> Chrome
38
49
 
39
50
  - **CLI (`src/patchright_cli/cli.py`)**: Stateless thin client. Parses argv manually (not click subcommands), builds a JSON `{command, args, options, cwd}` message, sends it over a length-prefixed TCP socket to the daemon, prints the response, and exits. All commands are defined in the `COMMANDS_HELP` dict and `ALL_COMMANDS` list.
40
51
 
41
- - **Daemon (`src/patchright_cli/daemon.py`)**: Long-running async process managing browser sessions. Auto-spawned on `open` via `ensure_daemon_running()` which launches a subprocess. Uses `DaemonState` → multiple `Session` objects, each owning a Patchright persistent browser context. Command dispatch is a large `handle_command()` function with if/elif branches. Console capture uses CDP sessions (not Playwright's `page.on('console')`) because Patchright suppresses it.
52
+ - **Daemon (`src/patchright_cli/daemon.py`)**: Long-running async process managing browser sessions. Auto-spawned on `open` via `ensure_daemon_running()` which launches a subprocess. Uses `DaemonState` → multiple `Session` objects, each owning a Patchright persistent browser context. Command dispatch uses `@register()` decorated handlers in `COMMAND_HANDLERS` dict, dispatched by `handle_command()`. Console capture uses CDP sessions (not Playwright's `page.on('console')`) because Patchright suppresses it.
42
53
 
43
- - **Snapshot (`src/patchright_cli/snapshot.py`)**: Two-pass DOM scanner injected as JavaScript: Pass 1 uses TreeWalker to assign `data-patchright-ref` attributes (`e1`, `e2`, ...) in document order; Pass 2 builds a nested tree. Python side converts to flat YAML. Snapshots are saved to `.patchright-cli/` in the caller's cwd.
54
+ - **Snapshot (`src/patchright_cli/snapshot.py`)**: Uses Playwright's native `aria_snapshot()` to get the accessibility tree. `RefRegistry` annotates each node with sequential refs (`e1`, `e2`, ...). Snapshots are saved as YAML to `.patchright-cli/` in the caller's cwd.
44
55
 
45
56
  ## Key Design Decisions
46
57
 
@@ -0,0 +1,18 @@
1
+ .PHONY: install-dev lint test-unit test-e2e test build
2
+
3
+ install-dev:
4
+ uv venv && uv pip install -e ".[dev]" && pre-commit install
5
+
6
+ lint:
7
+ pre-commit run --all-files
8
+
9
+ test-unit:
10
+ pytest tests/ -v --ignore=tests/test_e2e.py
11
+
12
+ test-e2e:
13
+ pytest tests/test_e2e.py -v
14
+
15
+ test: lint test-unit
16
+
17
+ build:
18
+ uv build
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchright-cli
3
- Version: 0.4.1
3
+ Version: 0.6.0
4
4
  Summary: Anti-detect browser automation CLI using Patchright (undetected Playwright fork)
5
5
  Project-URL: Homepage, https://github.com/AhaiMk01/patchright-cli
6
6
  Project-URL: Repository, https://github.com/AhaiMk01/patchright-cli
@@ -25,6 +25,10 @@ Requires-Dist: aiohttp>=3.9
25
25
  Requires-Dist: click
26
26
  Requires-Dist: patchright
27
27
  Requires-Dist: pyyaml
28
+ Provides-Extra: dev
29
+ Requires-Dist: pre-commit; extra == 'dev'
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
32
  Description-Content-Type: text/markdown
29
33
 
30
34
  # patchright-cli
@@ -174,6 +178,8 @@ patchright-cli check <ref> # Check checkbox
174
178
  patchright-cli uncheck <ref> # Uncheck checkbox
175
179
  patchright-cli drag <from> <to> # Drag and drop
176
180
  patchright-cli snapshot # Accessibility snapshot
181
+ patchright-cli snapshot -i # Interactive elements only (recommended)
182
+ patchright-cli snapshot --depth=3 # Limit depth
177
183
  patchright-cli snapshot <ref> # Snapshot element subtree
178
184
  patchright-cli snapshot --filename=f # Save to custom path
179
185
  patchright-cli eval <expr> # Run JavaScript
@@ -298,6 +304,17 @@ patchright-cli console warning # Filter by level
298
304
  patchright-cli console --clear # Clear after printing
299
305
  ```
300
306
 
307
+ ### Output
308
+ ```bash
309
+ patchright-cli --raw eval --file=s.js # Raw output (no page/snapshot decoration)
310
+ patchright-cli --raw snapshot > p.yml # Pipe raw snapshot to file
311
+ ```
312
+
313
+ ### Setup
314
+ ```bash
315
+ patchright-cli install --skills # Auto-install skills for detected AI agents
316
+ ```
317
+
301
318
  ### Sessions
302
319
  ```bash
303
320
  patchright-cli -s=mysession open https://example.com --persistent
@@ -314,67 +331,41 @@ patchright-cli --port=9322 open # Custom daemon port
314
331
 
315
332
  ---
316
333
 
317
- ## Snapshots
334
+ ## Agent Integration
318
335
 
319
- After each state-changing command, the CLI outputs page info and a YAML snapshot:
336
+ Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
320
337
 
338
+ ```bash
339
+ # Install skill for all detected agents (recommended)
340
+ npx skills add AhaiMk01/patchright-cli
321
341
  ```
322
- ### Page
323
- - Page URL: https://example.com/
324
- - Page Title: Example Domain
325
- ### Snapshot
326
- [Snapshot](.patchright-cli/page-1774376207818.yml)
327
- ```
328
-
329
- The snapshot lists interactive elements with refs you can use in commands:
330
-
331
- ```yaml
332
- - ref: e1
333
- role: heading
334
- name: Example Domain
335
- level: 1
336
- - ref: e2
337
- role: link
338
- name: Learn more
339
- url: "https://iana.org/domains/example"
340
- ```
341
-
342
- > [!NOTE]
343
- > Use refs directly: `patchright-cli click e2`, `patchright-cli fill e5 "text"`
344
-
345
- ---
346
-
347
- ## Anti-Detect Features
348
342
 
349
- > [!CAUTION]
350
- > This tool is for **authorized testing, security research, and legitimate automation** only.
351
-
352
- - :white_check_mark: Real Chrome browser (not Chromium)
353
- - :white_check_mark: Patchright patches `navigator.webdriver` and other detection vectors
354
- - :white_check_mark: Persistent profiles maintain cookies/sessions across runs
355
- - :white_check_mark: No custom user-agent or headers (natural fingerprint)
356
- - :white_check_mark: Headed by default (headless is more detectable)
357
-
358
- ---
343
+ <details>
344
+ <summary><b>Other install methods</b></summary>
359
345
 
360
- ## Agent Integration
346
+ ```bash
347
+ # Via patchright-cli itself
348
+ pip install patchright-cli
349
+ patchright-cli install --skills
361
350
 
362
- Works with any AI coding agent that supports SKILL.md skills:
351
+ # Or just tell your agent:
352
+ # "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
353
+ ```
363
354
 
364
- | Agent | Install skill |
365
- |-------|--------------|
366
- | **Claude Code** | `mkdir -p ~/.claude/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.claude/skills/patchright-cli/SKILL.md` |
367
- | **OpenClaw** | `mkdir -p ~/.openclaw/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.openclaw/skills/patchright-cli/SKILL.md` |
368
- | **Codex CLI** | `mkdir -p ~/.codex/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.codex/skills/patchright-cli/SKILL.md` |
369
- | **Gemini CLI** | `mkdir -p ~/.gemini/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.gemini/skills/patchright-cli/SKILL.md` |
370
- | **OpenCode** | `mkdir -p ~/.opencode/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.opencode/skills/patchright-cli/SKILL.md` |
371
- | **Cursor** | Copy SKILL.md to `.cursor/skills/patchright-cli/` in your project |
372
- | **Windsurf** | Copy SKILL.md to `.windsurf/skills/patchright-cli/` in your project |
373
- | **Aider** | Copy SKILL.md to `.aider/skills/patchright-cli/` in your project |
355
+ </details>
374
356
 
375
- Or just tell your agent:
357
+ ### Skill docs
376
358
 
377
- > Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md
359
+ | File | Topic |
360
+ |------|-------|
361
+ | [`SKILL.md`](skills/patchright-cli/SKILL.md) | Main skill — commands, options, patterns |
362
+ | [`snapshot-refs.md`](skills/patchright-cli/references/snapshot-refs.md) | Snapshots, element refs, `-i` flag |
363
+ | [`session-management.md`](skills/patchright-cli/references/session-management.md) | Named sessions, profiles, CDP, dashboard |
364
+ | [`request-mocking.md`](skills/patchright-cli/references/request-mocking.md) | Route mocking, network state |
365
+ | [`storage-state.md`](skills/patchright-cli/references/storage-state.md) | Cookies, localStorage, sessionStorage |
366
+ | [`running-code.md`](skills/patchright-cli/references/running-code.md) | eval, run-code, `--file`, stdin |
367
+ | [`tracing.md`](skills/patchright-cli/references/tracing.md) | Trace recording and debugging |
368
+ | [`video-recording.md`](skills/patchright-cli/references/video-recording.md) | Video, codegen, screenshot, PDF |
378
369
 
379
370
  ---
380
371
 
@@ -398,9 +389,7 @@ patchright-cli aims for full command parity with [Microsoft's playwright-cli](ht
398
389
  | Feature | Reason |
399
390
  |---------|--------|
400
391
  | `--browser=firefox/webkit/msedge` | Patchright only supports Chromium/Chrome. Anti-detect patches are Chrome-specific. |
401
- | `--config=<file>` | No config file system. Options are passed as CLI flags. |
402
392
  | `--extension` | Browser extension connection not supported. Patchright uses CDP directly. |
403
- | `show` / `devtools-start` | DevTools are available natively in headed mode (default). |
404
393
  | `install` / `install-browser` | Use `python -m patchright install chromium` instead. |
405
394
 
406
395
  All other commands and options are fully supported.
@@ -416,6 +405,16 @@ All other commands and options are fully supported.
416
405
 
417
406
  ---
418
407
 
408
+ ## Credits
409
+
410
+ This project builds on the work of:
411
+
412
+ - **[Patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright)** by [@Kaliiiiiiiiii-Vinyzu](https://github.com/Kaliiiiiiiiii-Vinyzu) — the undetected Playwright fork that makes this possible. All anti-detect capabilities come from Patchright.
413
+ - **[playwright-cli](https://github.com/microsoft/playwright-cli)** by Microsoft — the original CLI that patchright-cli's command interface is modeled after.
414
+ - **[camoufox-cli](https://github.com/Bin-Huang/camoufox-cli)** by [@Bin-Huang](https://github.com/Bin-Huang) — inspiration for the CLI-first approach to anti-detect browser automation and the SKILL.md agent integration pattern.
415
+
416
+ ---
417
+
419
418
  ## License
420
419
 
421
420
  Apache 2.0 — same as [playwright-cli](https://github.com/microsoft/playwright-cli)
@@ -145,6 +145,8 @@ patchright-cli check <ref> # Check checkbox
145
145
  patchright-cli uncheck <ref> # Uncheck checkbox
146
146
  patchright-cli drag <from> <to> # Drag and drop
147
147
  patchright-cli snapshot # Accessibility snapshot
148
+ patchright-cli snapshot -i # Interactive elements only (recommended)
149
+ patchright-cli snapshot --depth=3 # Limit depth
148
150
  patchright-cli snapshot <ref> # Snapshot element subtree
149
151
  patchright-cli snapshot --filename=f # Save to custom path
150
152
  patchright-cli eval <expr> # Run JavaScript
@@ -269,6 +271,17 @@ patchright-cli console warning # Filter by level
269
271
  patchright-cli console --clear # Clear after printing
270
272
  ```
271
273
 
274
+ ### Output
275
+ ```bash
276
+ patchright-cli --raw eval --file=s.js # Raw output (no page/snapshot decoration)
277
+ patchright-cli --raw snapshot > p.yml # Pipe raw snapshot to file
278
+ ```
279
+
280
+ ### Setup
281
+ ```bash
282
+ patchright-cli install --skills # Auto-install skills for detected AI agents
283
+ ```
284
+
272
285
  ### Sessions
273
286
  ```bash
274
287
  patchright-cli -s=mysession open https://example.com --persistent
@@ -285,67 +298,41 @@ patchright-cli --port=9322 open # Custom daemon port
285
298
 
286
299
  ---
287
300
 
288
- ## Snapshots
301
+ ## Agent Integration
289
302
 
290
- After each state-changing command, the CLI outputs page info and a YAML snapshot:
303
+ Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
291
304
 
305
+ ```bash
306
+ # Install skill for all detected agents (recommended)
307
+ npx skills add AhaiMk01/patchright-cli
292
308
  ```
293
- ### Page
294
- - Page URL: https://example.com/
295
- - Page Title: Example Domain
296
- ### Snapshot
297
- [Snapshot](.patchright-cli/page-1774376207818.yml)
298
- ```
299
-
300
- The snapshot lists interactive elements with refs you can use in commands:
301
-
302
- ```yaml
303
- - ref: e1
304
- role: heading
305
- name: Example Domain
306
- level: 1
307
- - ref: e2
308
- role: link
309
- name: Learn more
310
- url: "https://iana.org/domains/example"
311
- ```
312
-
313
- > [!NOTE]
314
- > Use refs directly: `patchright-cli click e2`, `patchright-cli fill e5 "text"`
315
-
316
- ---
317
-
318
- ## Anti-Detect Features
319
309
 
320
- > [!CAUTION]
321
- > This tool is for **authorized testing, security research, and legitimate automation** only.
322
-
323
- - :white_check_mark: Real Chrome browser (not Chromium)
324
- - :white_check_mark: Patchright patches `navigator.webdriver` and other detection vectors
325
- - :white_check_mark: Persistent profiles maintain cookies/sessions across runs
326
- - :white_check_mark: No custom user-agent or headers (natural fingerprint)
327
- - :white_check_mark: Headed by default (headless is more detectable)
328
-
329
- ---
310
+ <details>
311
+ <summary><b>Other install methods</b></summary>
330
312
 
331
- ## Agent Integration
313
+ ```bash
314
+ # Via patchright-cli itself
315
+ pip install patchright-cli
316
+ patchright-cli install --skills
332
317
 
333
- Works with any AI coding agent that supports SKILL.md skills:
318
+ # Or just tell your agent:
319
+ # "Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md"
320
+ ```
334
321
 
335
- | Agent | Install skill |
336
- |-------|--------------|
337
- | **Claude Code** | `mkdir -p ~/.claude/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.claude/skills/patchright-cli/SKILL.md` |
338
- | **OpenClaw** | `mkdir -p ~/.openclaw/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.openclaw/skills/patchright-cli/SKILL.md` |
339
- | **Codex CLI** | `mkdir -p ~/.codex/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.codex/skills/patchright-cli/SKILL.md` |
340
- | **Gemini CLI** | `mkdir -p ~/.gemini/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.gemini/skills/patchright-cli/SKILL.md` |
341
- | **OpenCode** | `mkdir -p ~/.opencode/skills/patchright-cli && curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md -o ~/.opencode/skills/patchright-cli/SKILL.md` |
342
- | **Cursor** | Copy SKILL.md to `.cursor/skills/patchright-cli/` in your project |
343
- | **Windsurf** | Copy SKILL.md to `.windsurf/skills/patchright-cli/` in your project |
344
- | **Aider** | Copy SKILL.md to `.aider/skills/patchright-cli/` in your project |
322
+ </details>
345
323
 
346
- Or just tell your agent:
324
+ ### Skill docs
347
325
 
348
- > Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md
326
+ | File | Topic |
327
+ |------|-------|
328
+ | [`SKILL.md`](skills/patchright-cli/SKILL.md) | Main skill — commands, options, patterns |
329
+ | [`snapshot-refs.md`](skills/patchright-cli/references/snapshot-refs.md) | Snapshots, element refs, `-i` flag |
330
+ | [`session-management.md`](skills/patchright-cli/references/session-management.md) | Named sessions, profiles, CDP, dashboard |
331
+ | [`request-mocking.md`](skills/patchright-cli/references/request-mocking.md) | Route mocking, network state |
332
+ | [`storage-state.md`](skills/patchright-cli/references/storage-state.md) | Cookies, localStorage, sessionStorage |
333
+ | [`running-code.md`](skills/patchright-cli/references/running-code.md) | eval, run-code, `--file`, stdin |
334
+ | [`tracing.md`](skills/patchright-cli/references/tracing.md) | Trace recording and debugging |
335
+ | [`video-recording.md`](skills/patchright-cli/references/video-recording.md) | Video, codegen, screenshot, PDF |
349
336
 
350
337
  ---
351
338
 
@@ -369,9 +356,7 @@ patchright-cli aims for full command parity with [Microsoft's playwright-cli](ht
369
356
  | Feature | Reason |
370
357
  |---------|--------|
371
358
  | `--browser=firefox/webkit/msedge` | Patchright only supports Chromium/Chrome. Anti-detect patches are Chrome-specific. |
372
- | `--config=<file>` | No config file system. Options are passed as CLI flags. |
373
359
  | `--extension` | Browser extension connection not supported. Patchright uses CDP directly. |
374
- | `show` / `devtools-start` | DevTools are available natively in headed mode (default). |
375
360
  | `install` / `install-browser` | Use `python -m patchright install chromium` instead. |
376
361
 
377
362
  All other commands and options are fully supported.
@@ -387,6 +372,16 @@ All other commands and options are fully supported.
387
372
 
388
373
  ---
389
374
 
375
+ ## Credits
376
+
377
+ This project builds on the work of:
378
+
379
+ - **[Patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright)** by [@Kaliiiiiiiiii-Vinyzu](https://github.com/Kaliiiiiiiiii-Vinyzu) — the undetected Playwright fork that makes this possible. All anti-detect capabilities come from Patchright.
380
+ - **[playwright-cli](https://github.com/microsoft/playwright-cli)** by Microsoft — the original CLI that patchright-cli's command interface is modeled after.
381
+ - **[camoufox-cli](https://github.com/Bin-Huang/camoufox-cli)** by [@Bin-Huang](https://github.com/Bin-Huang) — inspiration for the CLI-first approach to anti-detect browser automation and the SKILL.md agent integration pattern.
382
+
383
+ ---
384
+
390
385
  ## License
391
386
 
392
387
  Apache 2.0 — same as [playwright-cli](https://github.com/microsoft/playwright-cli)
@@ -0,0 +1,146 @@
1
+ # patchright-cli Installation Guide
2
+
3
+ ## Prerequisites
4
+
5
+ - Python 3.10+
6
+ - Google Chrome installed on the system
7
+
8
+ ## Install
9
+
10
+ ### Step 1: Ensure uv is installed
11
+
12
+ uv is the recommended Python package manager. Check if it's installed:
13
+
14
+ ```bash
15
+ uv --version
16
+ ```
17
+
18
+ If not installed:
19
+
20
+ ```bash
21
+ # macOS / Linux
22
+ curl -LsSf https://astral.sh/uv/install.sh | sh
23
+
24
+ # Windows (PowerShell)
25
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
26
+ ```
27
+
28
+ ### Step 2: Run patchright-cli
29
+
30
+ With uvx (recommended — always uses the latest version, no install needed):
31
+
32
+ ```bash
33
+ uvx patchright-cli open https://example.com
34
+ uvx patchright-cli snapshot
35
+ uvx patchright-cli close
36
+ ```
37
+
38
+ > **Note:** If you have Google Chrome installed, patchright-cli will use it directly via `channel="chrome"` for maximum stealth. If Chrome is not found, install the Patchright fallback browser: `uvx patchright install chromium`
39
+
40
+ ### Step 3: Verify
41
+
42
+ ```bash
43
+ uvx patchright-cli --version
44
+ uvx patchright-cli open https://example.com
45
+ uvx patchright-cli eval "document.title"
46
+ uvx patchright-cli close
47
+ ```
48
+
49
+ <details>
50
+ <summary><b>Alternative: pip install</b></summary>
51
+
52
+ ```bash
53
+ pip install patchright-cli
54
+ patchright-cli open https://example.com
55
+ patchright-cli close
56
+ ```
57
+
58
+ </details>
59
+
60
+ ### Troubleshooting
61
+
62
+ If you see `browser not found` errors:
63
+
64
+ ```bash
65
+ # Check if Chrome is installed
66
+ google-chrome --version # Linux
67
+ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version # macOS
68
+ reg query "HKLM\SOFTWARE\Google\Chrome\BLBeacon" /v version # Windows
69
+
70
+ # If no Chrome, install the Patchright browser
71
+ uvx patchright install chromium
72
+ ```
73
+
74
+ If you see `patchright-cli: command not found`:
75
+
76
+ ```bash
77
+ # Use uvx instead (no install or PATH needed)
78
+ uvx patchright-cli --help
79
+ ```
80
+
81
+ ## Agent Integration
82
+
83
+ Install the patchright-cli skill so your AI coding agent knows how to use it. Works with Claude Code, Cursor, Gemini CLI, Codex, and [40+ other agents](https://github.com/vercel-labs/skills).
84
+
85
+ ### Recommended: Skills CLI
86
+
87
+ ```bash
88
+ npx skills add AhaiMk01/patchright-cli
89
+ ```
90
+
91
+ This auto-detects your installed agents and installs the skill (including reference docs) to all of them.
92
+
93
+ ### Alternative: patchright-cli built-in
94
+
95
+ ```bash
96
+ pip install patchright-cli
97
+ patchright-cli install --skills
98
+ ```
99
+
100
+ ### Alternative: Tell your agent
101
+
102
+ Just paste this into your agent and it will handle the rest:
103
+
104
+ > Install patchright-cli skill from https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md
105
+
106
+ ### Manual install
107
+
108
+ Copy the skill file to your agent's skills directory:
109
+
110
+ ```bash
111
+ # Example for Claude Code
112
+ mkdir -p ~/.claude/skills/patchright-cli
113
+ curl -sL https://raw.githubusercontent.com/AhaiMk01/patchright-cli/main/skills/patchright-cli/SKILL.md \
114
+ -o ~/.claude/skills/patchright-cli/SKILL.md
115
+ ```
116
+
117
+ Replace `~/.claude` with `~/.gemini`, `~/.codex`, `~/.opencode`, `.cursor`, etc. for other agents.
118
+
119
+ ## Usage
120
+
121
+ ```bash
122
+ # Open an anti-bot-protected site
123
+ uvx patchright-cli open https://protected-site.com
124
+
125
+ # Take a snapshot to see interactive elements
126
+ uvx patchright-cli snapshot
127
+
128
+ # Interact with elements using refs from the snapshot
129
+ uvx patchright-cli fill e3 "username"
130
+ uvx patchright-cli fill e4 "password"
131
+ uvx patchright-cli click e5
132
+
133
+ # Save login state for reuse
134
+ uvx patchright-cli state-save auth.json
135
+
136
+ # Later, restore the session
137
+ uvx patchright-cli open https://protected-site.com --persistent
138
+ uvx patchright-cli state-load auth.json
139
+
140
+ # Close when done
141
+ uvx patchright-cli close
142
+ ```
143
+
144
+ ## All Commands
145
+
146
+ Run `patchright-cli --help` for the full command reference.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "patchright-cli"
3
- version = "0.4.1"
3
+ version = "0.6.0"
4
4
  description = "Anti-detect browser automation CLI using Patchright (undetected Playwright fork)"
5
5
  license = "Apache-2.0"
6
6
  requires-python = ">=3.10"
@@ -44,12 +44,22 @@ build-backend = "hatchling.build"
44
44
  [tool.hatch.build.targets.wheel]
45
45
  packages = ["src/patchright_cli"]
46
46
 
47
+ [tool.hatch.build.targets.wheel.force-include]
48
+ "skills/patchright-cli" = "patchright_cli/_skills/patchright-cli"
49
+
47
50
  [tool.pytest.ini_options]
48
51
  asyncio_mode = "auto"
49
52
  markers = [
50
53
  "e2e: marks tests that launch a real browser",
51
54
  ]
52
55
 
56
+ [project.optional-dependencies]
57
+ dev = [
58
+ "pytest>=8.0",
59
+ "pytest-asyncio>=0.23",
60
+ "pre-commit",
61
+ ]
62
+
53
63
  [dependency-groups]
54
64
  dev = [
55
65
  "pytest>=8.0",