@playcraft/cli 0.0.41 → 0.0.43
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/dist/atom-plan/validate-asr-coverage.js +317 -0
- package/dist/commands/prad.js +61 -0
- package/dist/commands/remix.js +4 -2
- package/dist/commands/skills.js +24 -0
- package/dist/commands/tools-generation.js +2 -4
- package/dist/commands/tools-utils.js +19 -0
- package/dist/prad/atom-ref.js +23 -0
- package/dist/prad/check.js +377 -0
- package/dist/prad/check.test.js +27 -0
- package/dist/prad/explain.js +109 -0
- package/dist/prad/load-spec.js +23 -0
- package/dist/prad/paths.js +83 -0
- package/dist/prad/skills-index.js +60 -0
- package/dist/utils/version-checker.js +8 -11
- package/package.json +3 -3
- package/project-template/.claude/agents/designer.md +34 -26
- package/project-template/.claude/agents/developer.md +55 -62
- package/project-template/.claude/agents/pm.md +3 -1
- package/project-template/.claude/agents/refs/README.md +21 -15
- package/project-template/.claude/agents/refs/designer-deliverable-spec.md +70 -7
- package/project-template/.claude/agents/refs/designer-handoff-v2-checklist.md +21 -13
- package/project-template/.claude/agents/refs/designer-master-composite-recipes.md +20 -28
- package/project-template/.claude/agents/refs/designer-style-exploration-flow.md +39 -9
- package/project-template/.claude/agents/refs/developer-dev-handoff.md +1 -1
- package/project-template/.claude/agents/refs/developer-phase1-flow.md +81 -156
- package/project-template/.claude/agents/refs/pm-workflow-detail.md +24 -2
- package/project-template/.claude/agents/refs/reviewer-convergence-eval.md +142 -0
- package/project-template/.claude/agents/refs/reviewer-six-dimension-eval.md +4 -284
- package/project-template/.claude/agents/refs/ta-atlas-deliverable-standard.md +27 -6
- package/project-template/.claude/agents/refs/ta-pipeline-cookbook.md +474 -29
- package/project-template/.claude/agents/reviewer.md +65 -38
- package/project-template/.claude/agents/technical-artist.md +38 -25
- package/project-template/.claude/hooks/README.md +40 -4
- package/project-template/.claude/hooks/asr-coverage-validate.mjs +381 -0
- package/project-template/.claude/hooks/validate-workflow-stop.mjs +196 -5
- package/project-template/.claude/settings.json +4 -0
- package/project-template/.claude/skills/playcraft-asset-state-sheet/SKILL.md +76 -22
- package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +84 -15
- package/project-template/.claude/skills/playcraft-storyboard/SKILL.md +26 -7
- package/project-template/.claude/skills/playcraft-workflow/SKILL.md +104 -15
- package/project-template/.claude/skills/playwright-cli/SKILL.md +390 -0
- package/project-template/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
- package/project-template/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/project-template/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
- package/project-template/.claude/skills/playwright-cli/references/running-code.md +240 -0
- package/project-template/.claude/skills/playwright-cli/references/session-management.md +226 -0
- package/project-template/.claude/skills/playwright-cli/references/spec-driven-testing.md +312 -0
- package/project-template/.claude/skills/playwright-cli/references/storage-state.md +275 -0
- package/project-template/.claude/skills/playwright-cli/references/test-generation.md +138 -0
- package/project-template/.claude/skills/playwright-cli/references/tracing.md +142 -0
- package/project-template/.claude/skills/playwright-cli/references/video-recording.md +157 -0
- package/project-template/.cursor/rules/playcraft-orchestrator.mdc +74 -24
- package/project-template/.cursor/rules/playcraft-subagent-boundary.mdc +1 -1
- package/project-template/CLAUDE.md +99 -59
- package/project-template/docs/team/agent-conduct.md +42 -26
- package/project-template/docs/team/agent-runtime-matrix.md +71 -39
- package/project-template/docs/team/atom-plan-format.md +101 -2
- package/project-template/docs/team/collaboration.md +57 -48
- package/project-template/docs/team/core-model.md +20 -19
- package/project-template/docs/team/workflow-changelog.md +28 -14
- package/project-template/docs/team/workflow-consistency-checklist.md +64 -0
- package/project-template/templates/atom-plan.template.json +18 -0
- package/project-template/templates/atom-plan.template.md +35 -3
- package/project-template/templates/designer-log.template.md +94 -5
- package/project-template/templates/developer-log.template.md +95 -101
- package/project-template/templates/layout-spec.template.md +62 -8
- package/project-template/templates/project-state.template.md +51 -33
- package/project-template/templates/review-report.template.md +76 -151
- package/project-template/templates/ta-log.template.md +180 -14
|
@@ -0,0 +1,138 @@
|
|
|
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 using one of the recommended matchers:
|
|
81
|
+
|
|
82
|
+
- `toBeVisible()` — element is rendered and visible
|
|
83
|
+
- `toHaveText(text)` — element text content matches
|
|
84
|
+
- `toHaveValue(value) / toBeEmpty()` — input/select value matches
|
|
85
|
+
- `toBeChecked() / toBeUnchecked()` — checkbox state matches
|
|
86
|
+
- `toMatchAriaSnapshot(snapshot)` — page (or locator) matches a partial accessibility snapshot
|
|
87
|
+
|
|
88
|
+
Use `playwright-cli generate-locator <target>` to produce the locator expression for the assertion, and the snapshot/eval commands to capture the expected value.
|
|
89
|
+
|
|
90
|
+
When asserting text content, make sure that generated locator does not contain text from the element itself. `getByTestId()` or `getByLabel()` usually work well with asserting text. When locator is text-based, prefer `toBeVisible()` instead.
|
|
91
|
+
|
|
92
|
+
Snapshot to be matched does not have to contain all the information - only capture what's necessary for the assertion. You can use regular expressions for unstable values.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Get a stable locator for an element ref to use in the assertion
|
|
96
|
+
playwright-cli --raw generate-locator e5
|
|
97
|
+
# getByRole('button', { name: 'Submit' })
|
|
98
|
+
|
|
99
|
+
# Capture expected text content for toHaveText
|
|
100
|
+
playwright-cli --raw eval "el => el.textContent" e5
|
|
101
|
+
|
|
102
|
+
# Capture expected input value for toHaveValue/toBeEmpty
|
|
103
|
+
playwright-cli --raw eval "el => el.value" e5
|
|
104
|
+
|
|
105
|
+
# Capture expected aria snapshot for toMatchAriaSnapshot/toBeChecked
|
|
106
|
+
# (whole page, or use a ref to scope to a region)
|
|
107
|
+
playwright-cli --raw snapshot
|
|
108
|
+
playwright-cli --raw snapshot e5
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Generated action
|
|
113
|
+
await page.getByRole("button", { name: "Submit" }).click();
|
|
114
|
+
|
|
115
|
+
// Manual assertions using the outputs above:
|
|
116
|
+
await expect(page.getByRole("alert", { name: "Success" })).toBeVisible();
|
|
117
|
+
await expect(page.getByTestId("main-header")).toHaveText("Welcome, user");
|
|
118
|
+
await expect(page.getByRole("textbox", { name: "Email" })).toHaveValue(
|
|
119
|
+
"user@example.com",
|
|
120
|
+
);
|
|
121
|
+
await expect(
|
|
122
|
+
page.getByRole("checkbox", { name: "Enable notifications" }),
|
|
123
|
+
).toBeChecked();
|
|
124
|
+
|
|
125
|
+
// toMatchAriaSnapshot on the whole page, finds a matching region
|
|
126
|
+
await expect(page).toMatchAriaSnapshot(`
|
|
127
|
+
- heading "Welcome, user"
|
|
128
|
+
- link /\\d+ new messages?/
|
|
129
|
+
- button "Sign out"
|
|
130
|
+
`);
|
|
131
|
+
|
|
132
|
+
// toMatchAriaSnapshot scoped to a region
|
|
133
|
+
await expect(page.getByRole("navigation")).toMatchAriaSnapshot(`
|
|
134
|
+
- link "Home"
|
|
135
|
+
- link /\\d+ new messages?/
|
|
136
|
+
- link "Profile"
|
|
137
|
+
`);
|
|
138
|
+
```
|
|
@@ -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,157 @@
|
|
|
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
|
+
# Open browser first
|
|
9
|
+
playwright-cli open
|
|
10
|
+
|
|
11
|
+
# Start recording
|
|
12
|
+
playwright-cli video-start demo.webm
|
|
13
|
+
|
|
14
|
+
# Add a chapter marker for section transitions
|
|
15
|
+
playwright-cli video-chapter "Getting Started" --description="Opening the homepage" --duration=2000
|
|
16
|
+
|
|
17
|
+
# Navigate and perform actions
|
|
18
|
+
playwright-cli goto https://example.com
|
|
19
|
+
playwright-cli snapshot
|
|
20
|
+
playwright-cli click e1
|
|
21
|
+
|
|
22
|
+
# Add another chapter
|
|
23
|
+
playwright-cli video-chapter "Filling Form" --description="Entering test data" --duration=2000
|
|
24
|
+
playwright-cli fill e2 "test input"
|
|
25
|
+
|
|
26
|
+
# Stop and save
|
|
27
|
+
playwright-cli video-stop
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Best Practices
|
|
31
|
+
|
|
32
|
+
### 1. Use Descriptive Filenames
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Include context in filename
|
|
36
|
+
playwright-cli video-start recordings/login-flow-2024-01-15.webm
|
|
37
|
+
playwright-cli video-start recordings/checkout-test-run-42.webm
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Record entire hero scripts.
|
|
41
|
+
|
|
42
|
+
When recording a video for the user or as a proof of work, it is best to create a code snippet and execute it with run-code.
|
|
43
|
+
It allows pulling appropriate pauses between the actions and annotating the video. There are new Playwright APIs for that.
|
|
44
|
+
|
|
45
|
+
1. Perform scenario using CLI and take note of all locators and actions. You'll need those locators to request their bounding boxes for highlight.
|
|
46
|
+
2. Create a file with the intended script for video (below). Use pressSequentially w/ delay for nice typing, make reasonable pauses.
|
|
47
|
+
3. Use playwright-cli run-code --filename your-script.js
|
|
48
|
+
|
|
49
|
+
**Important**: Overlays are `pointer-events: none` — they do not interfere with page interactions. You can safely keep sticky overlays visible while clicking, filling, or performing any actions on the page.
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
async (page) => {
|
|
53
|
+
await page.screencast.start({
|
|
54
|
+
path: "video.webm",
|
|
55
|
+
size: { width: 1280, height: 800 },
|
|
56
|
+
});
|
|
57
|
+
await page.goto("https://demo.playwright.dev/todomvc");
|
|
58
|
+
|
|
59
|
+
// Show a chapter card — blurs the page and shows a dialog.
|
|
60
|
+
// Blocks until duration expires, then auto-removes.
|
|
61
|
+
// Use this for simple use cases, but always feel free to hand-craft your own beautiful
|
|
62
|
+
// overlay via await page.screencast.showOverlay().
|
|
63
|
+
await page.screencast.showChapter("Adding Todo Items", {
|
|
64
|
+
description: "We will add several items to the todo list.",
|
|
65
|
+
duration: 2000,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Perform action
|
|
69
|
+
await page
|
|
70
|
+
.getByRole("textbox", { name: "What needs to be done?" })
|
|
71
|
+
.pressSequentially("Walk the dog", { delay: 60 });
|
|
72
|
+
await page
|
|
73
|
+
.getByRole("textbox", { name: "What needs to be done?" })
|
|
74
|
+
.press("Enter");
|
|
75
|
+
await page.waitForTimeout(1000);
|
|
76
|
+
|
|
77
|
+
// Show next chapter
|
|
78
|
+
await page.screencast.showChapter("Verifying Results", {
|
|
79
|
+
description: "Checking the item appeared in the list.",
|
|
80
|
+
duration: 2000,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Add a sticky annotation that stays while you perform actions.
|
|
84
|
+
// Overlays are pointer-events: none, so they won't block clicks.
|
|
85
|
+
const annotation = await page.screencast.showOverlay(`
|
|
86
|
+
<div style="position: absolute; top: 8px; right: 8px;
|
|
87
|
+
padding: 6px 12px; background: rgba(0,0,0,0.7);
|
|
88
|
+
border-radius: 8px; font-size: 13px; color: white;">
|
|
89
|
+
✓ Item added successfully
|
|
90
|
+
</div>
|
|
91
|
+
`);
|
|
92
|
+
|
|
93
|
+
// Perform more actions while the annotation is visible
|
|
94
|
+
await page
|
|
95
|
+
.getByRole("textbox", { name: "What needs to be done?" })
|
|
96
|
+
.pressSequentially("Buy groceries", { delay: 60 });
|
|
97
|
+
await page
|
|
98
|
+
.getByRole("textbox", { name: "What needs to be done?" })
|
|
99
|
+
.press("Enter");
|
|
100
|
+
await page.waitForTimeout(1500);
|
|
101
|
+
|
|
102
|
+
// Remove the annotation when done
|
|
103
|
+
await annotation.dispose();
|
|
104
|
+
|
|
105
|
+
// You can also highlight relevant locators and provide contextual annotations.
|
|
106
|
+
const bounds = await page.getByText("Walk the dog").boundingBox();
|
|
107
|
+
await page.screencast.showOverlay(
|
|
108
|
+
`
|
|
109
|
+
<div style="position: absolute;
|
|
110
|
+
top: ${bounds.y}px;
|
|
111
|
+
left: ${bounds.x}px;
|
|
112
|
+
width: ${bounds.width}px;
|
|
113
|
+
height: ${bounds.height}px;
|
|
114
|
+
border: 1px solid red;">
|
|
115
|
+
</div>
|
|
116
|
+
<div style="position: absolute;
|
|
117
|
+
top: ${bounds.y + bounds.height + 5}px;
|
|
118
|
+
left: ${bounds.x + bounds.width / 2}px;
|
|
119
|
+
transform: translateX(-50%);
|
|
120
|
+
padding: 6px;
|
|
121
|
+
background: #808080;
|
|
122
|
+
border-radius: 10px;
|
|
123
|
+
font-size: 14px;
|
|
124
|
+
color: white;">Check it out, it is right above this text
|
|
125
|
+
</div>
|
|
126
|
+
`,
|
|
127
|
+
{ duration: 2000 },
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
await page.screencast.stop();
|
|
131
|
+
};
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Embrace creativity, overlays are powerful.
|
|
135
|
+
|
|
136
|
+
### Overlay API Summary
|
|
137
|
+
|
|
138
|
+
| Method | Use Case |
|
|
139
|
+
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
|
140
|
+
| `page.screencast.showChapter(title, { description?, duration?, styleSheet? })` | Full-screen chapter card with blurred backdrop — ideal for section transitions |
|
|
141
|
+
| `page.screencast.showOverlay(html, { duration? })` | Custom HTML overlay — use for callouts, labels, highlights |
|
|
142
|
+
| `disposable.dispose()` | Remove a sticky overlay added without duration |
|
|
143
|
+
| `page.screencast.hideOverlays()` / `page.screencast.showOverlays()` | Temporarily hide/show all overlays |
|
|
144
|
+
|
|
145
|
+
## Tracing vs Video
|
|
146
|
+
|
|
147
|
+
| Feature | Video | Tracing |
|
|
148
|
+
| -------- | -------------------- | ---------------------------------------- |
|
|
149
|
+
| Output | WebM file | Trace file (viewable in Trace Viewer) |
|
|
150
|
+
| Shows | Visual recording | DOM snapshots, network, console, actions |
|
|
151
|
+
| Use case | Demos, documentation | Debugging, analysis |
|
|
152
|
+
| Size | Larger | Smaller |
|
|
153
|
+
|
|
154
|
+
## Limitations
|
|
155
|
+
|
|
156
|
+
- Recording adds slight overhead to automation
|
|
157
|
+
- Large recordings can consume significant disk space
|
|
@@ -7,17 +7,59 @@ alwaysApply: true
|
|
|
7
7
|
|
|
8
8
|
You are the **orchestrator** for a PlayCraft playable ad project. Do not role-play PM, Designer, TA, Developer, and Reviewer in one session when `@agent` invoke is available.
|
|
9
9
|
|
|
10
|
-
## Invoke `@developer` (`
|
|
10
|
+
## Invoke `@developer` (`ui_pass` / `gameplay_pass` only)
|
|
11
11
|
|
|
12
|
-
Sub-agents start a **fresh session** — they do not see your `playcraft skills match` output.
|
|
12
|
+
Sub-agents start a **fresh session** — they do not see your `playcraft skills match` output.
|
|
13
|
+
|
|
14
|
+
**Before `ui_pass`** (after TA Wave 2 `done`):
|
|
13
15
|
|
|
14
16
|
1. Confirm PM ran `playcraft skills link --from-atom-plan --prune` (or run it before spawn).
|
|
15
17
|
2. Read `docs/atom-plan.json` → `atoms[]` where `assignTo: Developer` and `skillRef` is non-null.
|
|
16
18
|
3. Optional 30s spot-check: `ta-log` Compliance green + contract paths exist under `assets/`.
|
|
17
|
-
4. In the **first message** to `@developer`, paste skillRef list
|
|
19
|
+
4. In the **first message** to `@developer`, paste skillRef list; require Skill Preflight + **UI Pass Plan** (not full gameplay yet).
|
|
18
20
|
5. Ban hand-written PGS that ignores linked Skill `ref/`.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
**Before `gameplay_pass`** (after `ui_review` pass):
|
|
23
|
+
|
|
24
|
+
1. Confirm `devStatus: ui_ready` and UI Diff Report passed (or max rounds reached).
|
|
25
|
+
2. Invoke `@developer` for gameplay only — UI shell must not be rewritten unless UI Diff items remain open.
|
|
26
|
+
|
|
27
|
+
UI Pass STOP invalid without **§ Skill Preflight** + **§ UI Pass Plan**. Gameplay Pass STOP invalid without **§ Gameplay Pass Plan**.
|
|
28
|
+
|
|
29
|
+
## Gate pre-check: Reviewer `design_check`
|
|
30
|
+
|
|
31
|
+
Before **Gate #1** and **Gate #2b** (not #2a), invoke `@reviewer` with mode `design_check`:
|
|
32
|
+
|
|
33
|
+
1. PM or Designer STOP with gate materials ready.
|
|
34
|
+
2. Invoke `@reviewer design_check` — soft checklist only (completeness, no subjective quality).
|
|
35
|
+
3. If fail → route to PM/Designer per report → re-invoke Reviewer → then run Gate.
|
|
36
|
+
|
|
37
|
+
## Dispatching Principle: WHAT + Skill Refs, not HOW
|
|
38
|
+
|
|
39
|
+
**Orchestrator 不是全知全能的指挥官。** Sub-agents 有完整的 `.claude/agents/<role>.md` + `refs/` + Skills 体系。
|
|
40
|
+
|
|
41
|
+
**调度时只传递:**
|
|
42
|
+
1. **目标**:需要完成哪些 atoms / review mode
|
|
43
|
+
2. **关键约束/提醒**:如 `mediaGroups` 中有可复用资产
|
|
44
|
+
3. **上游依赖状态**:哪些 Wave 已完成
|
|
45
|
+
|
|
46
|
+
**禁止调度时:**
|
|
47
|
+
- 写出详细生产步骤(agent 自己读 refs/ 和 Skills)
|
|
48
|
+
- 越俎代庖选择 prompt/model/工具(agent 按 Skill Preflight 决定)
|
|
49
|
+
- 跳过 agent 自身的 Step 0 流程
|
|
50
|
+
|
|
51
|
+
## Post-STOP 验证(必须,在阶段转换前)
|
|
52
|
+
|
|
53
|
+
Sub-agent STOP 返回后,orchestrator **必须验证** 再转阶段:
|
|
54
|
+
|
|
55
|
+
| 验证项 | 方法 | 失败处理 |
|
|
56
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------ | ------------------ |
|
|
57
|
+
| Atom status 已全部更新 | `atom-plan.json` → 该 agent 所有 atoms 的 `status ≠ pending` | 要求补全 |
|
|
58
|
+
| actualOutput 非空且文件存在 | `atoms[].actualOutput` 对应文件在磁盘上存在 | 要求补全 |
|
|
59
|
+
| Skill Context 已填写 | `atom-plan.md` 对应区域不含 `"(Pending"` | 要求回填 |
|
|
60
|
+
| Skill Preflight 已完成 | TA: `ta-log.md` § Skill Preflight; Developer: `developer-log.md` § Skill Preflight | 拒绝 STOP,重新入 |
|
|
61
|
+
| Plan section 已完成 | `ui_pass`: § UI Pass Plan; `gameplay_pass`: § Gameplay Pass Plan | 拒绝 STOP,重新入 |
|
|
62
|
+
| mediaGroups 处置已记录(Designer/TA) | `ta-log.md` § mediaGroups Reuse 或 `designer-log` 有处置记录 | 要求补充 |
|
|
21
63
|
|
|
22
64
|
## Before every decision
|
|
23
65
|
|
|
@@ -31,10 +73,10 @@ Integration STOP invalid without **§ Skill Preflight** (each row: `linked` or `
|
|
|
31
73
|
|
|
32
74
|
| Gate | When | Action |
|
|
33
75
|
| ---- | ---- | ------ |
|
|
34
|
-
| #1 | handoff `gate_pending: "1"`
|
|
35
|
-
| #2a | `gate_pending: "2a"` | `AskUserQuestion` → `selectedMcOption` → resume `@designer` |
|
|
36
|
-
| #2b | `gate_pending: "2b"` | Confirm MC+ASR → `stage: production` → invoke `@designer` Ph.2 **only** |
|
|
37
|
-
| #3 | Reviewer pass, `devStatus: ready` | Show **devUrl** via `AskUserQuestion` — user never runs `npm run dev` |
|
|
76
|
+
| #1 | handoff `gate_pending: "1"` after Reviewer `design_check` pass | `AskUserQuestion` → pass → `stage: style_exploration` → `@designer` |
|
|
77
|
+
| #2a | `gate_pending: "2a"` | `AskUserQuestion` → `selectedMcOption` → resume `@designer` (no Reviewer pre-check) |
|
|
78
|
+
| #2b | `gate_pending: "2b"` after Reviewer `design_check` pass | Confirm MC+ASR → `stage: production` → invoke `@designer` Ph.2 **only** |
|
|
79
|
+
| #3 | Reviewer `load_check` pass, `devStatus: ready` | Show **devUrl** via `AskUserQuestion` — user never runs `npm run dev` |
|
|
38
80
|
|
|
39
81
|
Sub-agents **must not** use `AskUserQuestion` or set mainline `stage`. See `docs/team/agent-conduct.md`.
|
|
40
82
|
|
|
@@ -45,9 +87,9 @@ After **Technical Artist** or **Developer** subagent STOP, `.claude/hooks/valida
|
|
|
45
87
|
- **Claude Code**: `.claude/settings.json` → `SubagentStop`
|
|
46
88
|
- **Cursor**: `.cursor/hooks.json` → `subagentStop`
|
|
47
89
|
|
|
48
|
-
If intake validation fails, the subagent **cannot stop** until `logs/ta-log.md` or `logs/developer-log.md` § **Upstream Intake** is complete. Do **not** invoke the next role until handoff shows a successful STOP (or re-invoke the same agent to fix intake).
|
|
90
|
+
If intake validation fails, the subagent **cannot stop** until `logs/ta-log.md` or `logs/developer-log.md` § **Upstream Intake** + correct Plan section is complete. Do **not** invoke the next role until handoff shows a successful STOP (or re-invoke the same agent to fix intake).
|
|
49
91
|
|
|
50
|
-
**Serial spawn after Gate #2b:** `@designer` → (Wave 1 done) `@technical-artist` → (Wave 2 done) `stage:
|
|
92
|
+
**Serial spawn after Gate #2b:** `@designer` → (Wave 1 done) `@technical-artist` → (Wave 2 done) `stage: ui_pass` + `@developer`. **Never** spawn `@developer` during `production`.
|
|
51
93
|
|
|
52
94
|
## Stage sync on handoff
|
|
53
95
|
|
|
@@ -55,33 +97,41 @@ When executing `next_orchestrator_action`, **also** update `stage` / gates (sub-
|
|
|
55
97
|
|
|
56
98
|
| Action substring | Must write |
|
|
57
99
|
| ---------------- | ---------- |
|
|
100
|
+
| `Invoke @reviewer design_check Gate #1` | Stay `pm`; Reviewer audit only |
|
|
58
101
|
| `Run Gate #1` | After pass: `stage: style_exploration`, `gates.#1 = passed` |
|
|
59
|
-
| `Run Gate #2a` | `gates.#2a = passed`, set `selectedMcOption`, resume `@designer`
|
|
102
|
+
| `Run Gate #2a` | `gates.#2a = passed`, set `selectedMcOption`, resume `@designer` |
|
|
103
|
+
| `Invoke @reviewer design_check Gate #2b` | Stay `style_exploration`; Reviewer audit only |
|
|
60
104
|
| `Run Gate #2b` | `stage: production`, `gates.#2b = passed`, invoke `@designer` Ph.2 only |
|
|
61
105
|
| `Invoke @technical-artist` | Wave 1 `done` → invoke TA (stay `production`) |
|
|
62
|
-
| `Set stage=
|
|
63
|
-
| `Invoke @reviewer` | `stage:
|
|
64
|
-
| `Set stage=
|
|
106
|
+
| `Set stage=ui_pass` / invoke `@developer` | Wave 2 `done` → `stage: ui_pass` |
|
|
107
|
+
| `Invoke @reviewer ui_diff` | `stage: ui_review` |
|
|
108
|
+
| `Set stage=ui_rework` | `stage: ui_rework` + invoke routed agents |
|
|
109
|
+
| `Set stage=gameplay_pass` | UI convergence done → `stage: gameplay_pass` |
|
|
110
|
+
| `Invoke @reviewer load_check` | Before Gate #3 |
|
|
65
111
|
| `Run Gate #3` | `gates.#3 = pending` → accept → `stage: done` |
|
|
66
112
|
|
|
67
113
|
## Handoff × stage matrix
|
|
68
114
|
|
|
69
115
|
| stage | gate_pending | Typical `next_orchestrator_action` |
|
|
70
116
|
| ----- | ------------ | ------------------------------------ |
|
|
71
|
-
| `pm` | `"1"` | Run Gate #1 |
|
|
117
|
+
| `pm` | `"1"` | Invoke `@reviewer design_check Gate #1` → Run Gate #1 |
|
|
72
118
|
| `style_exploration` | `"2a"` | Run Gate #2a |
|
|
73
|
-
| `style_exploration` | `"2b"` | Run Gate #2b → `stage: production` → `@designer` Ph.2 |
|
|
119
|
+
| `style_exploration` | `"2b"` | Invoke `@reviewer design_check Gate #2b` → Run Gate #2b → `stage: production` → `@designer` Ph.2 |
|
|
74
120
|
| `production` | null, Wave 1 pending | `@designer` Ph.2 |
|
|
75
121
|
| `production` | null, Wave 1 done | `Invoke @technical-artist` |
|
|
76
|
-
| `production` | null, Wave 2 done | `Set stage=
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
122
|
+
| `production` | null, Wave 2 done | `Set stage=ui_pass, invoke @developer` |
|
|
123
|
+
| `ui_pass` | null, `devStatus: ui_ready` | Invoke `@reviewer ui_diff` |
|
|
124
|
+
| `ui_pass` | null, `blocked_upstream` | Re-invoke per `devBlockers.routeTo` → `@developer` |
|
|
125
|
+
| `ui_review` | — (fail) | Set `stage: ui_rework`, invoke routed agents |
|
|
126
|
+
| `ui_rework` | null | Fixes → `@developer` → `@reviewer ui_diff` |
|
|
127
|
+
| `ui_review` | — (pass or 5 rounds) | Set `stage: gameplay_pass, invoke @developer` |
|
|
128
|
+
| `gameplay_pass` | null, `devStatus: ready` | Invoke `@reviewer load_check` |
|
|
129
|
+
| `gameplay_pass` | load_check fail | Re-invoke `@developer` → `@reviewer load_check` |
|
|
130
|
+
| `gameplay_pass` | load_check pass | Gate #3 devUrl |
|
|
82
131
|
|
|
83
132
|
## Stage shortcuts
|
|
84
133
|
|
|
85
|
-
- Gate #2b → `@designer` only; Wave 1 done → `@technical-artist`; Wave 2 done → `
|
|
86
|
-
-
|
|
134
|
+
- Gate #2b → `@designer` only; Wave 1 done → `@technical-artist`; Wave 2 done → `ui_pass` + `@developer`
|
|
135
|
+
- UI fail → **you** set `stage: ui_rework` (Reviewer does not)
|
|
136
|
+
- `uiReworkRound` max 5 — then proceed to `gameplay_pass` or escalate to user
|
|
87
137
|
- `done` = user accepts devUrl; **not** `playcraft build`
|
|
@@ -15,4 +15,4 @@ When editing project outputs as a **sub-agent** (PM / Designer / TA / Developer
|
|
|
15
15
|
- **Do not** change mainline `stage` — use `next_orchestrator_action` in handoff.
|
|
16
16
|
- R/W matrix: `docs/team/collaboration.md`.
|
|
17
17
|
|
|
18
|
-
Designer: read `selectedMcOption` before ASR (UI + element state sheets). TA: only after Production Pipeline Wave 1 `done`. Developer: only in `
|
|
18
|
+
Designer: read `selectedMcOption` before ASR (UI + element state sheets). TA: only after Production Pipeline Wave 1 `done`. Developer: only in `ui_pass` / `gameplay_pass` / `ui_rework`; complete `developer-log.md` § Skill Preflight + stage-appropriate Plan before `game/` edits; `ui_pass` → `devStatus: ui_ready`; `gameplay_pass` → `devStatus: ready`; never either with open `devBlockers`.
|