@astrofoundry/pi-astro 0.2.11 → 0.3.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.
- package/extensions/astro-agents/agents/code-reviewer.md +2 -0
- package/extensions/astro-agents/agents/google-tech-lead.md +2 -0
- package/extensions/astro-agents/agents/spec-writer.md +2 -0
- package/extensions/astro-agents/agents/tester-api.md +2 -0
- package/extensions/astro-agents/agents/tester-ui.md +2 -0
- package/extensions/astro-agents/agents/ui-architect.md +2 -0
- package/extensions/astro-agents/agents/ui-design-system.md +2 -0
- package/extensions/astro-agents/agents/ui-frontend-developer.md +2 -0
- package/package.json +1 -1
- package/skills/grimoire/SKILL.md +101 -0
- package/skills/playwright-cli/SKILL.md +278 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +232 -0
- package/skills/playwright-cli/references/session-management.md +169 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +88 -0
- package/skills/playwright-cli/references/tracing.md +139 -0
- package/skills/playwright-cli/references/video-recording.md +43 -0
- package/skills/postman-cli/SKILL.md +339 -0
- package/skills/postman-cli/references/environments.md +92 -0
- package/skills/postman-cli/references/reporters.md +94 -0
- package/skills/postman-cli/references/request-scripting.md +69 -0
- package/skills/raycast-script-creator/SKILL.md +132 -0
- package/themes/astro.json +76 -0
- package/skills/.gitkeep +0 -0
- package/themes/.gitkeep +0 -0
|
@@ -11,6 +11,8 @@ memory: user
|
|
|
11
11
|
tools: Read, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
12
12
|
_notWired: tools, model, effort, skills, memory
|
|
13
13
|
---
|
|
14
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
You are a senior code reviewer who audits code for quality, security, correctness, and spec compliance. You are read-only — you report issues with clear severity ratings and remediation guidance, but you never modify code. You review both frontend (React/TypeScript/Tailwind) and backend (Express/Firebase Cloud Functions/Firestore) code.
|
|
16
18
|
|
|
@@ -12,6 +12,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
12
12
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
13
13
|
_notWired: tools, model, effort, skills, memory
|
|
14
14
|
---
|
|
15
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
You are a senior technical lead specializing in the Google/Firebase ecosystem. You architect, design, and write production-grade code for Firebase Cloud Functions, Firestore, Firebase Auth, Firebase Hosting, Firebase Storage, and related services. You make architectural decisions and implement them — grounded in official documentation, never from assumptions.
|
|
17
19
|
|
|
@@ -12,6 +12,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
12
12
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
13
13
|
_notWired: tools, model, effort, skills, memory
|
|
14
14
|
---
|
|
15
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
You are a senior technical writer and systems analyst who writes functional and technical specification documents. You research existing code and specs, ask clarifying questions, and produce precise, complete specs that downstream agents can implement from without ambiguity. You write specs — you do not write application code.
|
|
17
19
|
|
|
@@ -12,6 +12,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
12
12
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
13
13
|
_notWired: tools, model, effort, skills, memory
|
|
14
14
|
---
|
|
15
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
You are an API testing specialist for TypeScript Express applications running on Firebase Cloud Functions. You write thorough, type-safe tests using Vitest and MSW, validate Postman collections against the implementation, and ensure 100% test coverage. You do not write application code — only tests.
|
|
17
19
|
|
|
@@ -13,6 +13,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
13
13
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
14
14
|
_notWired: tools, model, effort, skills, memory
|
|
15
15
|
---
|
|
16
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
You are a UI testing specialist for React applications built with TypeScript, Tailwind CSS, and shadcn/ui. You write thorough, accessible, user-centric tests using Vitest + React Testing Library for component tests and Playwright for E2E flows. You test user interactions, not implementation details. You do not write application code — only tests.
|
|
18
20
|
|
|
@@ -13,6 +13,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
13
13
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
14
14
|
_notWired: tools, model, effort, skills, memory
|
|
15
15
|
---
|
|
16
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
You are a UI architect who translates design tokens into detailed component specifications and screen-by-screen UI specs. You sit between the design system (tokens) and the frontend developer (code). Your job is to define precisely what every UI element looks like, how it behaves, and how it responds across breakpoints — so the frontend developer can implement without making design decisions.
|
|
18
20
|
|
|
@@ -13,6 +13,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
13
13
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
14
14
|
_notWired: tools, model, effort, skills, memory
|
|
15
15
|
---
|
|
16
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
You are a design system architect specializing in foundational design tokens for the modern React ecosystem. You create the visual language — colors, typography, spacing, border radius, shadows, motion, and breakpoints — that component designers and frontend developers consume. You do not design components or write application code. Your output is the foundation everything else is built on.
|
|
18
20
|
|
|
@@ -13,6 +13,8 @@ disallowedTools: mcp__filesystem__write_file, mcp__filesystem__edit_file, mcp__f
|
|
|
13
13
|
tools: Write, Read, MultiEdit, Bash, Grep, Glob, Skill, mcp__filesystem__read_file, mcp__filesystem__directory_tree, mcp__filesystem__list_directory, mcp__filesystem__search_files, mcp__filesystem__get_file_info
|
|
14
14
|
_notWired: tools, model, effort, skills, memory
|
|
15
15
|
---
|
|
16
|
+
If any instruction below conflicts with the user's global rules (provided separately in the system prompt), flag the conflict explicitly in your response and let the user decide — do not silently override either side.
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
You are an elite frontend development specialist with deep expertise in the React ecosystem. Your mastery spans TypeScript, React, Next.js, and Tailwind CSS, with a keen eye for performance, accessibility, and user experience. You build interfaces that are not just functional but delightful to use.
|
|
18
20
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grimoire
|
|
3
|
+
description: Search indexed documentation using the grimoire CLI tool. Grimoire indexes a growing collection of technical documentation — new sources are added regularly, so the available set changes over time. Common examples include Firebase, Gemini API, Next.js, React, TypeScript, Node.js, Flutter, ESLint, Git, GnuPG, and more — but this is NOT exhaustive. Use this skill for ANY technical question about libraries, frameworks, APIs, CLIs, or cloud services — even well-known ones like React, Firebase, or Node.js. ALWAYS search grimoire before relying on training data, as your training data may be outdated and grimoire indexes the latest docs. Prefer this over context7 and web search for documentation lookups. Trigger broadly on technical questions, API usage, configuration, error messages, or best practices for any technology.
|
|
4
|
+
allowed-tools: Bash(grimoire *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Grimoire — Documentation Search
|
|
8
|
+
|
|
9
|
+
Grimoire is a documentation RAG system that indexes technical docs and makes them searchable via vector similarity + reranking. The index is dynamic — sources are added and updated regularly. This skill replaces context7 and WebSearch for documentation lookups. Do not fall back to other doc tools when grimoire has the source indexed.
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
### Search documentation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
grimoire search "<query>"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Searches across all indexed sources. Returns top results with title, URL, heading breadcrumb, content snippet, and relevance score.
|
|
20
|
+
|
|
21
|
+
To narrow to a specific source:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
grimoire search "<query>" --source <source-name>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Control result count:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
grimoire search "<query>" --top 3
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Compact one-line output (ideal for scanning — avoids flooding context):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
grimoire search "<query>" --compact
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Compact output format: `score | source | title | heading path | url`
|
|
40
|
+
|
|
41
|
+
### Discover available sources
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
grimoire list --names
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Outputs one source name per line. Use this to quickly check if a source exists. Only run when you're unsure whether a source is indexed — skip it when you're confident (e.g., `firebase-firestore`, `nextjs`, `react` are reliably there).
|
|
48
|
+
|
|
49
|
+
Full details (chunks, URLs, timestamps):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
grimoire list
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Example output
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
$ grimoire search "batch write transaction limits" --source firebase-firestore --compact
|
|
59
|
+
0.9312 | firebase-firestore | Transactions and batched writes | Firestore > Data > Transactions | https://firebase.google.com/docs/firestore/manage-data/transactions
|
|
60
|
+
0.8847 | firebase-firestore | Quotas and limits | Firestore > Usage and limits | https://firebase.google.com/docs/firestore/quotas
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
$ grimoire search "batch write transaction limits" --source firebase-firestore
|
|
65
|
+
[1] Transactions and batched writes (0.9312)
|
|
66
|
+
https://firebase.google.com/docs/firestore/manage-data/transactions
|
|
67
|
+
Firestore > Data > Transactions
|
|
68
|
+
A batched write can contain up to 500 operations. Each operation in the batch counts separately...
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Source naming conventions
|
|
72
|
+
|
|
73
|
+
Sources follow predictable patterns — use these to search directly without running `grimoire list`:
|
|
74
|
+
|
|
75
|
+
- **Firebase**: `firebase-firestore`, `firebase-auth`, `firebase-functions`, `firebase-hosting`, `firebase-storage`, `firebase-rules`, `firebase-cli`, `firebase-admin`, `firebase-app-check`, `firebase-app-hosting`, `firebase-emulator-suite`
|
|
76
|
+
- **GCP**: `gcp-iam`, `gcp-cloud-run`, `gcp-cloud-functions`, `gcp-cloud-storage`, `gcp-bigquery`, `gcp-secret-manager`, `gcp-vpc`, `gcp-cdn`, `gcp-dns`, `gcp-cloud-build`, `gcp-app-engine`, `gcp-load-balancing`, `gcp-resource-manager`, `gcp-sdk`
|
|
77
|
+
- **Gemini**: `gemini-docs`, `gemini-api-ref`
|
|
78
|
+
- **Frontend**: `react`, `nextjs`, `tailwindcss`, `shadcn-ui`, `tanstack-query`, `react-hook-form`, `react-router`, `motion`, `zustand`, `zod`, `vite`, `vitest`, `testing-library`
|
|
79
|
+
- **Backend**: `expressjs`, `nodejs-api`, `esbuild`
|
|
80
|
+
- **Other**: `typescript`, `eslint`, `eslint-rules`, `pnpm`, `git-docs`, `git-book`, `postman`, `msw`, `claude-code`, `gemini-cli`, `pi-dev`
|
|
81
|
+
|
|
82
|
+
## Workflow
|
|
83
|
+
|
|
84
|
+
1. **Search directly** when you're confident a source exists. Use `--source` to scope it and `--compact` for quick scanning.
|
|
85
|
+
|
|
86
|
+
2. **Discover with `grimoire list --names`** only when you're unsure whether a source is indexed.
|
|
87
|
+
|
|
88
|
+
3. **Iterate if needed**: If the first search misses, rephrase or broaden. For complex topics, run 2-3 targeted searches covering different angles rather than one vague query.
|
|
89
|
+
|
|
90
|
+
4. **Cite what you find**: Include the URL so the user can read the full page. Quote the relevant snippet when precision matters.
|
|
91
|
+
|
|
92
|
+
## Proactive searching
|
|
93
|
+
|
|
94
|
+
The main value of this skill is surfacing docs without the user having to ask. When the user poses a technical question and grimoire might have relevant documentation indexed, search it immediately. Don't ask "would you like me to check the docs?" — just search and include the findings in your answer.
|
|
95
|
+
|
|
96
|
+
## Query strategy
|
|
97
|
+
|
|
98
|
+
- Match query language to documentation language (use the library's terminology, not colloquial descriptions)
|
|
99
|
+
- For "how do I X" questions, search for the feature name: "Firestore pagination cursors" rather than "how do I paginate"
|
|
100
|
+
- For error messages, search for the specific error text or error code
|
|
101
|
+
- For API questions, include the method or class name if known
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-cli
|
|
3
|
+
description: Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
|
|
4
|
+
allowed-tools: Bash(playwright-cli:*)
|
|
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
|
+
playwright-cli fill e5 "user@example.com"
|
|
39
|
+
playwright-cli drag e2 e8
|
|
40
|
+
playwright-cli hover e4
|
|
41
|
+
playwright-cli select e9 "option-value"
|
|
42
|
+
playwright-cli upload ./document.pdf
|
|
43
|
+
playwright-cli check e12
|
|
44
|
+
playwright-cli uncheck e12
|
|
45
|
+
playwright-cli snapshot
|
|
46
|
+
playwright-cli snapshot --filename=after-click.yaml
|
|
47
|
+
playwright-cli eval "document.title"
|
|
48
|
+
playwright-cli eval "el => el.textContent" e5
|
|
49
|
+
playwright-cli dialog-accept
|
|
50
|
+
playwright-cli dialog-accept "confirmation text"
|
|
51
|
+
playwright-cli dialog-dismiss
|
|
52
|
+
playwright-cli resize 1920 1080
|
|
53
|
+
playwright-cli close
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Navigation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
playwright-cli go-back
|
|
60
|
+
playwright-cli go-forward
|
|
61
|
+
playwright-cli reload
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Keyboard
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
playwright-cli press Enter
|
|
68
|
+
playwright-cli press ArrowDown
|
|
69
|
+
playwright-cli keydown Shift
|
|
70
|
+
playwright-cli keyup Shift
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Mouse
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
playwright-cli mousemove 150 300
|
|
77
|
+
playwright-cli mousedown
|
|
78
|
+
playwright-cli mousedown right
|
|
79
|
+
playwright-cli mouseup
|
|
80
|
+
playwright-cli mouseup right
|
|
81
|
+
playwright-cli mousewheel 0 100
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Save as
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
playwright-cli screenshot
|
|
88
|
+
playwright-cli screenshot e5
|
|
89
|
+
playwright-cli screenshot --filename=page.png
|
|
90
|
+
playwright-cli pdf --filename=page.pdf
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Tabs
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
playwright-cli tab-list
|
|
97
|
+
playwright-cli tab-new
|
|
98
|
+
playwright-cli tab-new https://example.com/page
|
|
99
|
+
playwright-cli tab-close
|
|
100
|
+
playwright-cli tab-close 2
|
|
101
|
+
playwright-cli tab-select 0
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Storage
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
playwright-cli state-save
|
|
108
|
+
playwright-cli state-save auth.json
|
|
109
|
+
playwright-cli state-load auth.json
|
|
110
|
+
|
|
111
|
+
# Cookies
|
|
112
|
+
playwright-cli cookie-list
|
|
113
|
+
playwright-cli cookie-list --domain=example.com
|
|
114
|
+
playwright-cli cookie-get session_id
|
|
115
|
+
playwright-cli cookie-set session_id abc123
|
|
116
|
+
playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
|
|
117
|
+
playwright-cli cookie-delete session_id
|
|
118
|
+
playwright-cli cookie-clear
|
|
119
|
+
|
|
120
|
+
# LocalStorage
|
|
121
|
+
playwright-cli localstorage-list
|
|
122
|
+
playwright-cli localstorage-get theme
|
|
123
|
+
playwright-cli localstorage-set theme dark
|
|
124
|
+
playwright-cli localstorage-delete theme
|
|
125
|
+
playwright-cli localstorage-clear
|
|
126
|
+
|
|
127
|
+
# SessionStorage
|
|
128
|
+
playwright-cli sessionstorage-list
|
|
129
|
+
playwright-cli sessionstorage-get step
|
|
130
|
+
playwright-cli sessionstorage-set step 3
|
|
131
|
+
playwright-cli sessionstorage-delete step
|
|
132
|
+
playwright-cli sessionstorage-clear
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Network
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
playwright-cli route "**/*.jpg" --status=404
|
|
139
|
+
playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
|
|
140
|
+
playwright-cli route-list
|
|
141
|
+
playwright-cli unroute "**/*.jpg"
|
|
142
|
+
playwright-cli unroute
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### DevTools
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
playwright-cli console
|
|
149
|
+
playwright-cli console warning
|
|
150
|
+
playwright-cli network
|
|
151
|
+
playwright-cli run-code "async page => await page.context().grantPermissions(['geolocation'])"
|
|
152
|
+
playwright-cli tracing-start
|
|
153
|
+
playwright-cli tracing-stop
|
|
154
|
+
playwright-cli video-start
|
|
155
|
+
playwright-cli video-stop video.webm
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Open parameters
|
|
159
|
+
```bash
|
|
160
|
+
# Use specific browser when creating session
|
|
161
|
+
playwright-cli open --browser=chrome
|
|
162
|
+
playwright-cli open --browser=firefox
|
|
163
|
+
playwright-cli open --browser=webkit
|
|
164
|
+
playwright-cli open --browser=msedge
|
|
165
|
+
# Connect to browser via extension
|
|
166
|
+
playwright-cli open --extension
|
|
167
|
+
|
|
168
|
+
# Use persistent profile (by default profile is in-memory)
|
|
169
|
+
playwright-cli open --persistent
|
|
170
|
+
# Use persistent profile with custom directory
|
|
171
|
+
playwright-cli open --profile=/path/to/profile
|
|
172
|
+
|
|
173
|
+
# Start with config file
|
|
174
|
+
playwright-cli open --config=my-config.json
|
|
175
|
+
|
|
176
|
+
# Close the browser
|
|
177
|
+
playwright-cli close
|
|
178
|
+
# Delete user data for the default session
|
|
179
|
+
playwright-cli delete-data
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Snapshots
|
|
183
|
+
|
|
184
|
+
After each command, playwright-cli provides a snapshot of the current browser state.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
> playwright-cli goto https://example.com
|
|
188
|
+
### Page
|
|
189
|
+
- Page URL: https://example.com/
|
|
190
|
+
- Page Title: Example Domain
|
|
191
|
+
### Snapshot
|
|
192
|
+
[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
You can also take a snapshot on demand using `playwright-cli snapshot` command.
|
|
196
|
+
|
|
197
|
+
If `--filename` is not provided, a new snapshot file is created with a timestamp. Default to automatic file naming, use `--filename=` when artifact is a part of the workflow result.
|
|
198
|
+
|
|
199
|
+
## Browser Sessions
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# create new browser session named "mysession" with persistent profile
|
|
203
|
+
playwright-cli -s=mysession open example.com --persistent
|
|
204
|
+
# same with manually specified profile directory (use when requested explicitly)
|
|
205
|
+
playwright-cli -s=mysession open example.com --profile=/path/to/profile
|
|
206
|
+
playwright-cli -s=mysession click e6
|
|
207
|
+
playwright-cli -s=mysession close # stop a named browser
|
|
208
|
+
playwright-cli -s=mysession delete-data # delete user data for persistent session
|
|
209
|
+
|
|
210
|
+
playwright-cli list
|
|
211
|
+
# Close all browsers
|
|
212
|
+
playwright-cli close-all
|
|
213
|
+
# Forcefully kill all browser processes
|
|
214
|
+
playwright-cli kill-all
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Local installation
|
|
218
|
+
|
|
219
|
+
In some cases user might want to install playwright-cli locally. If running globally available `playwright-cli` binary fails, use `npx playwright-cli` to run the commands. For example:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
npx playwright-cli open https://example.com
|
|
223
|
+
npx playwright-cli click e1
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Example: Form submission
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
playwright-cli open https://example.com/form
|
|
230
|
+
playwright-cli snapshot
|
|
231
|
+
|
|
232
|
+
playwright-cli fill e1 "user@example.com"
|
|
233
|
+
playwright-cli fill e2 "password123"
|
|
234
|
+
playwright-cli click e3
|
|
235
|
+
playwright-cli snapshot
|
|
236
|
+
playwright-cli close
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Example: Multi-tab workflow
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
playwright-cli open https://example.com
|
|
243
|
+
playwright-cli tab-new https://example.com/other
|
|
244
|
+
playwright-cli tab-list
|
|
245
|
+
playwright-cli tab-select 0
|
|
246
|
+
playwright-cli snapshot
|
|
247
|
+
playwright-cli close
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Example: Debugging with DevTools
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
playwright-cli open https://example.com
|
|
254
|
+
playwright-cli click e4
|
|
255
|
+
playwright-cli fill e7 "test"
|
|
256
|
+
playwright-cli console
|
|
257
|
+
playwright-cli network
|
|
258
|
+
playwright-cli close
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
playwright-cli open https://example.com
|
|
263
|
+
playwright-cli tracing-start
|
|
264
|
+
playwright-cli click e4
|
|
265
|
+
playwright-cli fill e7 "test"
|
|
266
|
+
playwright-cli tracing-stop
|
|
267
|
+
playwright-cli close
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Specific tasks
|
|
271
|
+
|
|
272
|
+
* **Request mocking** [references/request-mocking.md](references/request-mocking.md)
|
|
273
|
+
* **Running Playwright code** [references/running-code.md](references/running-code.md)
|
|
274
|
+
* **Browser session management** [references/session-management.md](references/session-management.md)
|
|
275
|
+
* **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
|
|
276
|
+
* **Test generation** [references/test-generation.md](references/test-generation.md)
|
|
277
|
+
* **Tracing** [references/tracing.md](references/tracing.md)
|
|
278
|
+
* **Video recording** [references/video-recording.md](references/video-recording.md)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Request Mocking
|
|
2
|
+
|
|
3
|
+
Intercept, mock, modify, and block network requests.
|
|
4
|
+
|
|
5
|
+
## CLI Route Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Mock with custom status
|
|
9
|
+
playwright-cli route "**/*.jpg" --status=404
|
|
10
|
+
|
|
11
|
+
# Mock with JSON body
|
|
12
|
+
playwright-cli route "**/api/users" --body='[{"id":1,"name":"Alice"}]' --content-type=application/json
|
|
13
|
+
|
|
14
|
+
# Mock with custom headers
|
|
15
|
+
playwright-cli route "**/api/data" --body='{"ok":true}' --header="X-Custom: value"
|
|
16
|
+
|
|
17
|
+
# Remove headers from requests
|
|
18
|
+
playwright-cli route "**/*" --remove-header=cookie,authorization
|
|
19
|
+
|
|
20
|
+
# List active routes
|
|
21
|
+
playwright-cli route-list
|
|
22
|
+
|
|
23
|
+
# Remove a route or all routes
|
|
24
|
+
playwright-cli unroute "**/*.jpg"
|
|
25
|
+
playwright-cli unroute
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## URL Patterns
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
**/api/users - Exact path match
|
|
32
|
+
**/api/*/details - Wildcard in path
|
|
33
|
+
**/*.{png,jpg,jpeg} - Match file extensions
|
|
34
|
+
**/search?q=* - Match query parameters
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Advanced Mocking with run-code
|
|
38
|
+
|
|
39
|
+
For conditional responses, request body inspection, response modification, or delays:
|
|
40
|
+
|
|
41
|
+
### Conditional Response Based on Request
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
playwright-cli run-code "async page => {
|
|
45
|
+
await page.route('**/api/login', route => {
|
|
46
|
+
const body = route.request().postDataJSON();
|
|
47
|
+
if (body.username === 'admin') {
|
|
48
|
+
route.fulfill({ body: JSON.stringify({ token: 'mock-token' }) });
|
|
49
|
+
} else {
|
|
50
|
+
route.fulfill({ status: 401, body: JSON.stringify({ error: 'Invalid' }) });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Modify Real Response
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
playwright-cli run-code "async page => {
|
|
60
|
+
await page.route('**/api/user', async route => {
|
|
61
|
+
const response = await route.fetch();
|
|
62
|
+
const json = await response.json();
|
|
63
|
+
json.isPremium = true;
|
|
64
|
+
await route.fulfill({ response, json });
|
|
65
|
+
});
|
|
66
|
+
}"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Simulate Network Failures
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
playwright-cli run-code "async page => {
|
|
73
|
+
await page.route('**/api/offline', route => route.abort('internetdisconnected'));
|
|
74
|
+
}"
|
|
75
|
+
# Options: connectionrefused, timedout, connectionreset, internetdisconnected
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Delayed Response
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
playwright-cli run-code "async page => {
|
|
82
|
+
await page.route('**/api/slow', async route => {
|
|
83
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
84
|
+
route.fulfill({ body: JSON.stringify({ data: 'loaded' }) });
|
|
85
|
+
});
|
|
86
|
+
}"
|
|
87
|
+
```
|