openspec-playwright 0.3.0 → 0.3.2
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/.claude/skills/openspec-e2e/SKILL.md +105 -22
- package/dist/commands/explore.d.ts +17 -0
- package/dist/commands/explore.js +366 -0
- package/dist/commands/explore.js.map +1 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.js +16 -1
- package/dist/commands/run.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/employee-standards.md +8 -35
- package/package.json +2 -1
- package/templates/playwright.config.ts +3 -1
|
@@ -211,6 +211,19 @@ For each route:
|
|
|
211
211
|
$B goto <url> → $B console → $B snapshot → $B screenshot
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
+
#### Parallel Exploration (via `openspec-pw explore`)
|
|
215
|
+
|
|
216
|
+
For apps with many routes (>=5), use the dedicated CLI command for true parallel exploration:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
openspec-pw explore --parallel 4 # 4 independent Chromium workers
|
|
220
|
+
openspec-pw explore --dry-run # preview chunk assignment first
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Why**: `$B` uses a single shared Chromium instance with one active page — `Promise.allSettled` on `$B` commands serializes execution and causes navigation state conflicts. `openspec-pw explore` launches N independent browser processes, each with its own Chromium context, for genuine parallelism.
|
|
224
|
+
|
|
225
|
+
**After parallel exploration completes**, read the updated `app-exploration.md` to continue with Step 4.3.
|
|
226
|
+
|
|
214
227
|
**After navigating, check for app-level errors**:
|
|
215
228
|
|
|
216
229
|
| Signal | Meaning | Action |
|
|
@@ -346,6 +359,24 @@ After exploration, add route-level notes (redirects, dynamic content → see 4.5
|
|
|
346
359
|
|
|
347
360
|
**Idempotency**: If `app-exploration.md` already exists → read it, verify routes still match the live app, update only new routes or changed pages.
|
|
348
361
|
|
|
362
|
+
#### Route Snapshot Hash -- Skip Unchanged Routes
|
|
363
|
+
|
|
364
|
+
Before re-exploring, compute a lightweight hash of the app's current state:
|
|
365
|
+
|
|
366
|
+
1. **Quick hash** (for re-runs): Navigate to `${BASE_URL}/sitemap.xml` → hash the XML content
|
|
367
|
+
2. **If hash unchanged** since last exploration: Skip re-exploration entirely -- use cached `app-exploration.md`
|
|
368
|
+
3. **If hash changed**: Re-explore only changed routes (diff sitemap XML)
|
|
369
|
+
4. **Store hash** in `app-knowledge.md` → `Exploration State` section
|
|
370
|
+
|
|
371
|
+
```markdown
|
|
372
|
+
## Exploration State
|
|
373
|
+
Last explored: 2026-04-12T07:30:00Z
|
|
374
|
+
Sitemap hash: sha256:abc123...
|
|
375
|
+
Routes count: 20
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
This prevents redundant exploration on every `/opsx:e2e` run.
|
|
379
|
+
|
|
349
380
|
#### 4.6. Update app-knowledge.md
|
|
350
381
|
|
|
351
382
|
After writing `app-exploration.md`, extract **project-level shared knowledge** and append to `tests/playwright/app-knowledge.md`:
|
|
@@ -501,6 +532,28 @@ Is this assertion about a visible UI result?
|
|
|
501
532
|
4. Write test code with verified selectors
|
|
502
533
|
5. If selector unverifiable → note for Healer (Step 9)
|
|
503
534
|
|
|
535
|
+
**Selector Caching — reuse Step 4 exploration results:**
|
|
536
|
+
|
|
537
|
+
After Step 4, verified selectors are stored in `app-exploration.md`. Before navigating to verify a selector in Step 6, check if the route already has verified selectors from Step 4.
|
|
538
|
+
|
|
539
|
+
```javascript
|
|
540
|
+
// Step 6: Before navigating to verify, check cached selectors
|
|
541
|
+
const cachedSelectors = appExploration.routes.find(r => r.path === routePath)?.elements
|
|
542
|
+
if (cachedSelectors && cachedSelectors.length > 0) {
|
|
543
|
+
// Use first-priority selector from cache instead of re-navigating
|
|
544
|
+
const selector = getFirstPrioritySelector(cachedSelectors)
|
|
545
|
+
// Only navigate to verify if selector is missing or marked "Fragile"
|
|
546
|
+
if (selector.stability !== 'Fragile') {
|
|
547
|
+
return selector // use cached, skip verification navigation
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
// Fallback: navigate + snapshot + verify
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
**Benefit**: For a 50-test case suite, this saves 30-50 redundant navigations (~2-5 minutes).
|
|
554
|
+
|
|
555
|
+
**File to read**: The selector caching uses data already stored in Step 4.4's `app-exploration.md` output — no new file needed.
|
|
556
|
+
|
|
504
557
|
**Test coverage — empty states**: For list/detail pages, explore the empty state. If the app shows a "no data" UI when the list is empty, generate a test to verify it. Empty states are often missing from specs but are real user paths.
|
|
505
558
|
|
|
506
559
|
**Test coverage — special elements**: Check `app-exploration.md` → **Special Elements Detected** table. For each special element, generate tests using the following strategies:
|
|
@@ -741,41 +794,65 @@ For every App Bug classified in Phase 1, record it in `openspec/reports/app-bug-
|
|
|
741
794
|
|
|
742
795
|
**Healer — Phase 2: Repair**
|
|
743
796
|
|
|
797
|
+
> **Performance note**: Playwright startup (~15-20s) is the dominant cost. Batch diagnosis first, then sequential isolated runs.
|
|
798
|
+
|
|
744
799
|
After Triage classifies failure as "Test Bug" or "Ambiguous":
|
|
745
800
|
|
|
746
|
-
|
|
747
|
-
2
|
|
748
|
-
|
|
801
|
+
**Step 0 — Batch diagnosis** (no Playwright, fast):
|
|
802
|
+
For ALL Phase 2 failures in this run, do this simultaneously:
|
|
803
|
+
1. Read the failing test spec file(s) to understand what each test verifies
|
|
804
|
+
2. Read `app-knowledge.md` for any previous fixes or selector patterns
|
|
805
|
+
3. Read `app-knowledge.md` → **Common Selector Patterns** for project conventions
|
|
806
|
+
4. For each test, output:
|
|
807
|
+
```
|
|
808
|
+
TEST: <test-name>
|
|
809
|
+
ROUTE: <route>
|
|
810
|
+
ASSERTION: "<what the test expects>"
|
|
811
|
+
EXPECTED_BEHAVIOR: <from spec, one line>
|
|
812
|
+
KNOWN_FIX: <yes/no — from app-knowledge.md Selector Fixes table>
|
|
813
|
+
SELECTOR_CANDIDATES: <list from app-knowledge.md patterns if available>
|
|
814
|
+
```
|
|
815
|
+
5. Classify each test:
|
|
816
|
+
- `ready-to-fix` — known fix exists, or selector pattern is clear
|
|
817
|
+
- `needs-assertion-fix` — assertion itself needs changing (typo, wrong expected value)
|
|
818
|
+
- `needs-phase3` — ambiguous, no clear fix path
|
|
819
|
+
- `needs-more-diagnosis` — need to see actual page to determine
|
|
820
|
+
|
|
821
|
+
**Skip remaining steps for `needs-phase3` tests** — go directly to Phase 3.
|
|
822
|
+
|
|
823
|
+
**For `needs-more-diagnosis` tests** — go to Step 1 (navigate + snapshot) for each individually.
|
|
824
|
+
|
|
825
|
+
**Step 1** (for `needs-assertion-fix` or `needs-more-diagnosis`): Navigate to the failing page → `browser_snapshot` → **EXPLICIT COMPARISON**:
|
|
749
826
|
```
|
|
750
827
|
ASSERTION: "<what the test expects>"
|
|
751
828
|
ACTUAL: "<what the snapshot shows>"
|
|
752
829
|
MATCH: <yes/no>
|
|
753
830
|
```
|
|
754
|
-
4. If MATCH=no:
|
|
755
831
|
|
|
756
|
-
|
|
832
|
+
**Assertion modification guard — never skip Phase 3 unless ALL conditions are met:**
|
|
833
|
+
- The test has **never passed with the current assertion** (newly generated test, or this is the first time this assertion fails)
|
|
834
|
+
- The ACTUAL value is **verifiably** from a different spec section (e.g., this test was in the wrong describe block)
|
|
835
|
+
- You can point to the **specific line in the spec** that defines the ACTUAL behavior
|
|
757
836
|
|
|
758
|
-
|
|
759
|
-
- The ACTUAL value is **verifiably** from a different spec section (e.g., this test was in the wrong describe block)
|
|
760
|
-
- You can point to the **specific line in the spec** that defines the ACTUAL behavior
|
|
837
|
+
**If ANY condition is uncertain → Phase 3 immediately.** Do NOT modify the assertion.
|
|
761
838
|
|
|
762
|
-
|
|
839
|
+
**Safe to fix without Phase 3:**
|
|
840
|
+
- Typo in assertion (e.g., "Subm\"it" vs "Submit" in the expected text)
|
|
841
|
+
- Selector was correct but the element was moved to a different location (same text, different selector)
|
|
842
|
+
- Explicit spec drift confirmed by reading the spec (e.g., spec says "button says Submit" but test says "button says Submit Form")
|
|
763
843
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
844
|
+
**Never fix without Phase 3:**
|
|
845
|
+
- App behavior changed after an action (e.g., "after clicking submit, balance should decrease" → ACTUAL shows no change → **Phase 3**, could be optimistic update bug, backend failure, or spec mismatch)
|
|
846
|
+
- Data values differ (e.g., expected "¥1000" but got "¥999" → **Phase 3**, could be rounding, discount, or calculation bug)
|
|
847
|
+
- Missing elements after interaction (e.g., "after creating order, success message should appear" → no message → **Phase 3**)
|
|
768
848
|
|
|
769
|
-
|
|
770
|
-
- App behavior changed after an action (e.g., "after clicking submit, balance should decrease" → ACTUAL shows no change → **Phase 3**, could be optimistic update bug, backend failure, or spec mismatch)
|
|
771
|
-
- Data values differ (e.g., expected "¥1000" but got "¥999" → **Phase 3**, could be rounding, discount, or calculation bug)
|
|
772
|
-
- Missing elements after interaction (e.g., "after creating order, success message should appear" → no message → **Phase 3**)
|
|
849
|
+
**Steps 2-4 (original)** — consolidated into Step 1 (navigate + snapshot + comparison).
|
|
773
850
|
|
|
774
|
-
5
|
|
851
|
+
**Step 5** (for `ready-to-fix` with selector issue): Generate candidate list from snapshot:
|
|
775
852
|
|
|
776
|
-
**5a. Extract candidates** — identify the target element from the failing test's assertion, then from the snapshot list all selectors for that element
|
|
853
|
+
**5a. Extract candidates** — identify the target element from the failing test's assertion, then from the snapshot list all selectors for that element.
|
|
777
854
|
|
|
778
|
-
First check `app-knowledge.md` → **Common Selector Patterns** for project-specific conventions
|
|
855
|
+
First check `app-knowledge.md` → **Common Selector Patterns** for project-specific conventions.
|
|
779
856
|
|
|
780
857
|
```
|
|
781
858
|
Target: <element from failing assertion, e.g. "button with text 'Submit'">
|
|
@@ -792,8 +869,14 @@ After Triage classifies failure as "Test Bug" or "Ambiguous":
|
|
|
792
869
|
|
|
793
870
|
**5b. Select top candidate** — pick the highest-stability candidate that matches the target. Output: `SELECTED: <selector> — reason: <why this one>`.
|
|
794
871
|
|
|
795
|
-
6
|
|
796
|
-
|
|
872
|
+
**Step 6** — **Apply ALL fixes, then run sequential isolated**:
|
|
873
|
+
1. Apply all prepared fixes to all Phase 2 tests in this run
|
|
874
|
+
2. Run: `npx playwright test --workers=1 --grep "<test1|test2|test3|...>"` (all Phase 2 tests as a single combined grep)
|
|
875
|
+
3. `--workers=1` ensures true isolated execution — no data races, no shared state pollution
|
|
876
|
+
4. Each test result is independent — even if one fails, others proceed cleanly
|
|
877
|
+
5. Report per-test result (pass/fail/error) and update heal counters accordingly
|
|
878
|
+
|
|
879
|
+
**Step 7** — If healed → append to `app-knowledge.md` → **Selector Fixes** table (route, old → new selector, reason, date)
|
|
797
880
|
|
|
798
881
|
**Element Missing handling (when browser_snapshot shows element not found):**
|
|
799
882
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ExploreOptions {
|
|
2
|
+
parallel?: number;
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface RouteResult {
|
|
6
|
+
path: string;
|
|
7
|
+
url: string;
|
|
8
|
+
status: "ok" | "error" | "auth-required" | "skipped";
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
snapshot: {
|
|
11
|
+
title?: string;
|
|
12
|
+
mainHeading?: string;
|
|
13
|
+
formCount: number;
|
|
14
|
+
linkCount: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function explore(options: ExploreOptions): Promise<void>;
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { chromium } from "playwright";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { existsSync, cpSync, renameSync, readFileSync, writeFileSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
// ── File utilities ────────────────────────────────────────────────────────────────
|
|
6
|
+
/**
|
|
7
|
+
* Atomic write: backup original, write new content, revert on failure.
|
|
8
|
+
* Uses cpSync + rename for atomicity (POSIX rename is atomic on success).
|
|
9
|
+
*/
|
|
10
|
+
function atomicWrite(filePath, content) {
|
|
11
|
+
const backupPath = `${filePath}.bak`;
|
|
12
|
+
cpSync(filePath, backupPath, { force: true });
|
|
13
|
+
try {
|
|
14
|
+
writeFileSync(filePath, content, "utf-8");
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
cpSync(backupPath, filePath, { force: true });
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const LOCK_TTL_MS = 30 * 60 * 1000; // 30 minutes
|
|
22
|
+
/**
|
|
23
|
+
* Acquire a lock file. Stale locks (>30min) are auto-removed.
|
|
24
|
+
* Returns false if already locked by a live process.
|
|
25
|
+
*/
|
|
26
|
+
function acquireLock(lockPath) {
|
|
27
|
+
// Check for stale lock from crashed process
|
|
28
|
+
if (existsSync(lockPath)) {
|
|
29
|
+
try {
|
|
30
|
+
const content = readFileSync(lockPath, "utf-8");
|
|
31
|
+
const [pidStr, tsStr] = content.split(":");
|
|
32
|
+
const ts = parseInt(tsStr, 10);
|
|
33
|
+
if (!isNaN(ts) && Date.now() - ts > LOCK_TTL_MS) {
|
|
34
|
+
// Stale: remove and retry
|
|
35
|
+
renameSync(lockPath, `${lockPath}.stale`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Check if process is still alive
|
|
39
|
+
if (pidStr) {
|
|
40
|
+
try {
|
|
41
|
+
process.kill(parseInt(pidStr, 10), 0);
|
|
42
|
+
return false; // Process alive, lock held
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Process dead, stale lock
|
|
46
|
+
renameSync(lockPath, `${lockPath}.stale`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Can't read lock, try to remove it
|
|
53
|
+
try {
|
|
54
|
+
renameSync(lockPath, `${lockPath}.stale`);
|
|
55
|
+
}
|
|
56
|
+
catch { /* ignore */ }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
writeFileSync(lockPath, `${process.pid}:${Date.now()}`, { flag: "wx" });
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function releaseLock(lockPath) {
|
|
68
|
+
try {
|
|
69
|
+
if (existsSync(lockPath))
|
|
70
|
+
renameSync(lockPath, `${lockPath}.released`);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// ignore — lock release is best-effort
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// ── Parsing ────────────────────────────────────────────────────────────────────
|
|
77
|
+
function parseExplorationFile(content) {
|
|
78
|
+
const baseUrlMatch = content.match(/BASE_URL:\s*(\S+)/);
|
|
79
|
+
const baseUrl = baseUrlMatch ? baseUrlMatch[1].trim() : "http://localhost:3000";
|
|
80
|
+
const routes = [];
|
|
81
|
+
// More permissive regex: match any column count, allow spaces in route path
|
|
82
|
+
const tableRegex = /^\|\s*(\/[^\s|]+)\s*\|\s*([^|]+?)\s*\|\s*([^|]+?)\s*\|\s*(.+?)\s*\|/gm;
|
|
83
|
+
let match;
|
|
84
|
+
while ((match = tableRegex.exec(content)) !== null) {
|
|
85
|
+
routes.push({
|
|
86
|
+
path: match[1],
|
|
87
|
+
auth: match[2].trim(),
|
|
88
|
+
status: match[3].trim(),
|
|
89
|
+
readySignal: match[4].trim(),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return { baseUrl, routes, rawContent: content };
|
|
93
|
+
}
|
|
94
|
+
function updateExplorationFile(original, results) {
|
|
95
|
+
const lines = original.rawContent.split("\n");
|
|
96
|
+
const updatedLines = [];
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
// Update the Exploration Summary table with new results
|
|
99
|
+
if (line.match(/^\| \//)) {
|
|
100
|
+
const pathMatch = line.match(/^\| (\/\S+)/);
|
|
101
|
+
if (pathMatch) {
|
|
102
|
+
const path = pathMatch[1];
|
|
103
|
+
const result = results.find((r) => r.path === path);
|
|
104
|
+
if (result) {
|
|
105
|
+
const icon = result.status === "ok"
|
|
106
|
+
? "explored"
|
|
107
|
+
: result.status === "error"
|
|
108
|
+
? "error"
|
|
109
|
+
: result.status === "auth-required"
|
|
110
|
+
? "auth-required"
|
|
111
|
+
: "skipped";
|
|
112
|
+
// Replace status column (3rd column)
|
|
113
|
+
const cols = line.split("|");
|
|
114
|
+
if (cols.length >= 4) {
|
|
115
|
+
cols[3] = ` ${icon} `;
|
|
116
|
+
updatedLines.push(cols.join("|"));
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
updatedLines.push(line);
|
|
123
|
+
}
|
|
124
|
+
return updatedLines.join("\n");
|
|
125
|
+
}
|
|
126
|
+
function appendFailureSection(content, results) {
|
|
127
|
+
const failures = results.filter((r) => r.status === "error" || r.status === "auth-required");
|
|
128
|
+
if (failures.length === 0)
|
|
129
|
+
return content;
|
|
130
|
+
const failureLines = [
|
|
131
|
+
"",
|
|
132
|
+
"## Exploration Failures",
|
|
133
|
+
"",
|
|
134
|
+
"| Route | Status | Error | Notes |",
|
|
135
|
+
"|-------|--------|-------|-------|",
|
|
136
|
+
];
|
|
137
|
+
for (const f of failures) {
|
|
138
|
+
const notes = f.status === "auth-required"
|
|
139
|
+
? "Requires authentication — set up auth.setup.ts"
|
|
140
|
+
: "";
|
|
141
|
+
failureLines.push(`| ${f.path} | ${f.status} | ${f.errorMessage ?? "unknown"} | ${notes} |`);
|
|
142
|
+
}
|
|
143
|
+
failureLines.push("");
|
|
144
|
+
return content + failureLines.join("\n");
|
|
145
|
+
}
|
|
146
|
+
// ── Worker ──────────────────────────────────────────────────────────────────────
|
|
147
|
+
async function exploreRoute(page, route, baseUrl) {
|
|
148
|
+
const url = `${baseUrl}${route}`;
|
|
149
|
+
const loginPatterns = [
|
|
150
|
+
"/login",
|
|
151
|
+
"/signin",
|
|
152
|
+
"/auth",
|
|
153
|
+
"/sign-in",
|
|
154
|
+
"/log-in",
|
|
155
|
+
"/oauth",
|
|
156
|
+
"/sso",
|
|
157
|
+
];
|
|
158
|
+
try {
|
|
159
|
+
const response = await page.goto(url, {
|
|
160
|
+
waitUntil: "networkidle",
|
|
161
|
+
timeout: 30000,
|
|
162
|
+
});
|
|
163
|
+
const status = response?.status() ?? 0;
|
|
164
|
+
const finalUrl = page.url();
|
|
165
|
+
// Detect redirect to login page (auth-required route)
|
|
166
|
+
if (status < 400) {
|
|
167
|
+
try {
|
|
168
|
+
const expectedOrigin = new URL(baseUrl).origin;
|
|
169
|
+
const finalOrigin = new URL(finalUrl).origin;
|
|
170
|
+
if (finalOrigin === expectedOrigin &&
|
|
171
|
+
finalUrl !== url &&
|
|
172
|
+
loginPatterns.some((p) => finalUrl.toLowerCase().includes(p))) {
|
|
173
|
+
return {
|
|
174
|
+
path: route,
|
|
175
|
+
url,
|
|
176
|
+
status: "auth-required",
|
|
177
|
+
errorMessage: `Redirected to login`,
|
|
178
|
+
snapshot: { formCount: 0, linkCount: 0 },
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// URL parsing failed — proceed with status-based result
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (status >= 400) {
|
|
187
|
+
return {
|
|
188
|
+
path: route,
|
|
189
|
+
url,
|
|
190
|
+
status: "error",
|
|
191
|
+
errorMessage: `HTTP ${status}`,
|
|
192
|
+
snapshot: { formCount: 0, linkCount: 0 },
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
// Collect snapshot data
|
|
196
|
+
const snapshot = await page.evaluate(() => {
|
|
197
|
+
const title = document.title;
|
|
198
|
+
const h1 = document.querySelector("h1");
|
|
199
|
+
const mainHeading = h1?.textContent?.trim();
|
|
200
|
+
const formCount = document.querySelectorAll("form").length;
|
|
201
|
+
const linkCount = document.querySelectorAll("a").length;
|
|
202
|
+
return { title, mainHeading, formCount, linkCount };
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
path: route,
|
|
206
|
+
url,
|
|
207
|
+
status: "ok",
|
|
208
|
+
snapshot,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
const error = err;
|
|
213
|
+
return {
|
|
214
|
+
path: route,
|
|
215
|
+
url,
|
|
216
|
+
status: "error",
|
|
217
|
+
errorMessage: error.message,
|
|
218
|
+
snapshot: { formCount: 0, linkCount: 0 },
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async function runWorker(workerId, routes, baseUrl) {
|
|
223
|
+
const results = [];
|
|
224
|
+
if (routes.length === 0)
|
|
225
|
+
return results;
|
|
226
|
+
let browser;
|
|
227
|
+
try {
|
|
228
|
+
browser = await chromium.launch({
|
|
229
|
+
headless: true,
|
|
230
|
+
timeout: 60000,
|
|
231
|
+
});
|
|
232
|
+
const context = await browser.newContext();
|
|
233
|
+
const page = await context.newPage();
|
|
234
|
+
for (const route of routes) {
|
|
235
|
+
const result = await exploreRoute(page, route, baseUrl);
|
|
236
|
+
results.push(result);
|
|
237
|
+
const icon = result.status === "ok"
|
|
238
|
+
? chalk.green("ok")
|
|
239
|
+
: result.status === "auth-required"
|
|
240
|
+
? chalk.yellow("auth")
|
|
241
|
+
: chalk.red("err");
|
|
242
|
+
const pathDisplay = route.length > 40 ? route.slice(0, 40) + "..." : route;
|
|
243
|
+
console.log(` [worker ${workerId}] ${icon} ${pathDisplay}`);
|
|
244
|
+
}
|
|
245
|
+
await context.close();
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
if (browser) {
|
|
249
|
+
await browser.close();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return results;
|
|
253
|
+
}
|
|
254
|
+
function chunkRoutes(routes, numWorkers) {
|
|
255
|
+
const chunks = Array.from({ length: numWorkers }, () => []);
|
|
256
|
+
routes.forEach((route, i) => {
|
|
257
|
+
chunks[i % numWorkers].push(route);
|
|
258
|
+
});
|
|
259
|
+
return chunks;
|
|
260
|
+
}
|
|
261
|
+
// ── Main ───────────────────────────────────────────────────────────────────────
|
|
262
|
+
export async function explore(options) {
|
|
263
|
+
const projectRoot = process.cwd();
|
|
264
|
+
const MAX_WORKERS = 16;
|
|
265
|
+
const numWorkers = Math.min(options.parallel ?? 4, MAX_WORKERS);
|
|
266
|
+
const startTime = Date.now();
|
|
267
|
+
// ── Signal handling: clean up on Ctrl+C / SIGTERM ──
|
|
268
|
+
let interrupted = false;
|
|
269
|
+
const cleanup = () => {
|
|
270
|
+
if (interrupted)
|
|
271
|
+
return;
|
|
272
|
+
interrupted = true;
|
|
273
|
+
console.log(chalk.yellow("\n Interrupted — cleaning up Chromium processes...\n"));
|
|
274
|
+
process.exit(130);
|
|
275
|
+
};
|
|
276
|
+
process.on("SIGINT", cleanup);
|
|
277
|
+
process.on("SIGTERM", cleanup);
|
|
278
|
+
console.log(chalk.blue(`\nApp Exploration — ${numWorkers} workers\n`));
|
|
279
|
+
// 1. Read app-exploration.md
|
|
280
|
+
const explorationPath = join(projectRoot, "app-exploration.md");
|
|
281
|
+
if (!existsSync(explorationPath)) {
|
|
282
|
+
console.log(chalk.red(` app-exploration.md not found in ${projectRoot}\n` +
|
|
283
|
+
` Run openspec-pw init first to generate it, or create it manually.\n`));
|
|
284
|
+
process.exit(1);
|
|
285
|
+
}
|
|
286
|
+
const fileContent = readFileSync(explorationPath, "utf-8");
|
|
287
|
+
const parsed = parseExplorationFile(fileContent);
|
|
288
|
+
if (parsed.routes.length === 0) {
|
|
289
|
+
console.log(chalk.red(` ERROR: No routes parsed from app-exploration.md.\n` +
|
|
290
|
+
` Check that the file contains a valid route table with | /path | ... | format.\n`));
|
|
291
|
+
process.exit(1);
|
|
292
|
+
}
|
|
293
|
+
const baseUrl = process.env.BASE_URL ?? parsed.baseUrl;
|
|
294
|
+
const paths = parsed.routes.map((r) => r.path);
|
|
295
|
+
console.log(chalk.blue("─── Dry Run ───"));
|
|
296
|
+
if (options.dryRun) {
|
|
297
|
+
for (let i = 0; i < paths.length; i++) {
|
|
298
|
+
const chunk = i % numWorkers;
|
|
299
|
+
console.log(` worker ${chunk}: ${paths[i]}`);
|
|
300
|
+
}
|
|
301
|
+
console.log(chalk.gray(`\n (dry run — no browsers launched)\n`));
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
// 1b. Acquire lock to prevent concurrent runs from overwriting each other
|
|
305
|
+
const lockPath = join(projectRoot, ".explore.lock");
|
|
306
|
+
if (!acquireLock(lockPath)) {
|
|
307
|
+
console.log(chalk.red(` ERROR: Another explore process is running.\n` +
|
|
308
|
+
` Remove ${lockPath} if no other process is active.\n`));
|
|
309
|
+
process.exit(1);
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
// 2. Split routes into chunks
|
|
313
|
+
const chunks = chunkRoutes(paths, numWorkers);
|
|
314
|
+
const nonEmptyChunks = chunks
|
|
315
|
+
.map((c, i) => ({ chunk: c, id: i }))
|
|
316
|
+
.filter((x) => x.chunk.length > 0);
|
|
317
|
+
console.log(chalk.blue(`─── Exploring ${paths.length} routes with ${nonEmptyChunks.length} workers ───\n`));
|
|
318
|
+
// 3. Launch workers concurrently
|
|
319
|
+
const workerPromises = nonEmptyChunks.map(({ chunk, id }) => runWorker(id, chunk, baseUrl));
|
|
320
|
+
const settled = await Promise.allSettled(workerPromises);
|
|
321
|
+
// 4. Merge results
|
|
322
|
+
const allResults = [];
|
|
323
|
+
for (const result of settled) {
|
|
324
|
+
if (result.status === "fulfilled") {
|
|
325
|
+
allResults.push(...result.value);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// 5. Sort results to match original route order
|
|
329
|
+
const pathOrder = new Map(paths.map((p, i) => [p, i]));
|
|
330
|
+
allResults.sort((a, b) => (pathOrder.get(a.path) ?? 0) - (pathOrder.get(b.path) ?? 0));
|
|
331
|
+
// 6. Write updated app-exploration.md (atomic)
|
|
332
|
+
let updatedContent = updateExplorationFile(parsed, allResults);
|
|
333
|
+
updatedContent = appendFailureSection(updatedContent, allResults);
|
|
334
|
+
atomicWrite(explorationPath, updatedContent);
|
|
335
|
+
// 7. Print summary
|
|
336
|
+
const durationMs = Date.now() - startTime;
|
|
337
|
+
const durationSec = (durationMs / 1000).toFixed(1);
|
|
338
|
+
const okCount = allResults.filter((r) => r.status === "ok").length;
|
|
339
|
+
const authCount = allResults.filter((r) => r.status === "auth-required").length;
|
|
340
|
+
const errorCount = allResults.filter((r) => r.status === "error").length;
|
|
341
|
+
const totalCount = allResults.length;
|
|
342
|
+
console.log(chalk.blue("\n─── Summary ───"));
|
|
343
|
+
console.log(` Routes explored: ${totalCount} ` +
|
|
344
|
+
chalk.green(`ok ${okCount}`) +
|
|
345
|
+
(authCount > 0
|
|
346
|
+
? ` ${chalk.yellow(`auth-required ${authCount}`)}`
|
|
347
|
+
: "") +
|
|
348
|
+
" " +
|
|
349
|
+
(errorCount > 0
|
|
350
|
+
? chalk.red(`error ${errorCount}`)
|
|
351
|
+
: chalk.gray(`error ${errorCount}`)) +
|
|
352
|
+
` Duration: ${durationSec}s`);
|
|
353
|
+
console.log(chalk.blue("\n─── Updated ───"));
|
|
354
|
+
console.log(chalk.green(` ${explorationPath}\n`));
|
|
355
|
+
if (errorCount > 0) {
|
|
356
|
+
console.log(chalk.red(`Exploration completed with ${errorCount} error(s).\n`));
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
console.log(chalk.green("Exploration completed successfully.\n"));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
finally {
|
|
363
|
+
releaseLock(lockPath);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=explore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore.js","sourceRoot":"","sources":["../../src/commands/explore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiC,MAAM,YAAY,CAAC;AACr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,CACT,KAAK,CAAC,GAAG,CAAC,8BAA8B,UAAU,cAAc,CAAC,CAClE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;YAAS,CAAC;QACT,WAAW,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
package/dist/commands/run.d.ts
CHANGED
package/dist/commands/run.js
CHANGED
|
@@ -39,9 +39,24 @@ export async function run(changeName, options) {
|
|
|
39
39
|
if (options.project) {
|
|
40
40
|
args.push("--project=" + options.project);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
// Escape regex special chars in grep to prevent injection.
|
|
43
|
+
// Note: | is escaped too, so grep "a|b" matches the literal string "a|b",
|
|
44
|
+
// not "a OR b". For OR semantics, run two separate commands.
|
|
45
|
+
const escapeGrep = (s) => s.replace(/[.*+?()[\]{}|\\^$]/g, "\\$&");
|
|
46
|
+
if (options.grep && options.smoke) {
|
|
47
|
+
// Run tests matching BOTH smoke tag AND the grep pattern
|
|
48
|
+
const eg = escapeGrep(options.grep);
|
|
49
|
+
args.push("--grep", `@smoke.*${eg}|${eg}.*@smoke`);
|
|
50
|
+
}
|
|
51
|
+
else if (options.grep) {
|
|
43
52
|
args.push("--grep=" + options.grep);
|
|
44
53
|
}
|
|
54
|
+
else if (options.smoke) {
|
|
55
|
+
args.push("--grep", "@smoke");
|
|
56
|
+
}
|
|
57
|
+
if (options.workers) {
|
|
58
|
+
args.push("--workers=" + options.workers);
|
|
59
|
+
}
|
|
45
60
|
if (options.headed) {
|
|
46
61
|
args.push("--headed");
|
|
47
62
|
}
|
package/dist/commands/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC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ACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CACR,2BAA2B,EAC3B,EAAE,EACF,iEAAiE,EACjE,EAAE,EACF,4CAA4C,EAC5C,2CAA2C,EAC3C,2BAA2B,EAC3B,EAAE,EACF,kBAAkB,EAClB,EAAE,EACF,uDAAuD,EACvD,EAAE,EACF,iBAAiB,EACjB,EAAE,EACF,4FAA4F,EAC5F,EAAE,EACF,sBAAsB,EACtB,EAAE,EACF,0EAA0E,EAC1E,EAAE,CACH,CAAC;IAEF,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CACR,4BAA4B,EAC5B,gGAAgG,EAChG,4DAA4D,EAC5D,EAAE,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { run } from "./commands/run.js";
|
|
|
9
9
|
import { migrate } from "./commands/migrate.js";
|
|
10
10
|
import { uninstall } from "./commands/uninstall.js";
|
|
11
11
|
import { audit } from "./commands/audit.js";
|
|
12
|
+
import { explore } from "./commands/explore.js";
|
|
12
13
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
14
|
const pkg = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
14
15
|
const program = new Command();
|
|
@@ -42,6 +43,8 @@ program
|
|
|
42
43
|
.option("-t, --timeout <seconds>", "Test timeout in seconds", "300")
|
|
43
44
|
.option("--json", "Output results as JSON")
|
|
44
45
|
.option("-g, --grep <pattern>", "Run only tests matching pattern")
|
|
46
|
+
.option("--smoke", "Run only smoke tests (--grep @smoke)")
|
|
47
|
+
.option("-w, --workers <n>", "Number of parallel workers", (v) => parseInt(v, 10), undefined)
|
|
45
48
|
.option("--app-bugs <n>", "Number of app bugs (skipped tests)", (v) => parseInt(v, 10), undefined)
|
|
46
49
|
.option("--healed <n>", "Number of test bugs healed by Healer", (v) => parseInt(v, 10), undefined)
|
|
47
50
|
.option("--raft <n>", "Number of RAFTs detected", (v) => parseInt(v, 10), undefined)
|
|
@@ -63,5 +66,13 @@ program
|
|
|
63
66
|
.command("audit")
|
|
64
67
|
.description("Audit test files for orphaned specs, missing auth, sitemap issues")
|
|
65
68
|
.action(audit);
|
|
69
|
+
program
|
|
70
|
+
.command("explore")
|
|
71
|
+
.description("Explore routes in parallel with Playwright")
|
|
72
|
+
.option("-p, --parallel <n>", "Number of parallel workers", (v) => parseInt(v, 10), 4)
|
|
73
|
+
.option("-n, --dry-run", "Show what would be explored without running")
|
|
74
|
+
.action(async (opts) => {
|
|
75
|
+
await explore(opts);
|
|
76
|
+
});
|
|
66
77
|
program.parse();
|
|
67
78
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EA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AE,EAAE;IACrB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/employee-standards.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
# Claude Code Employee-Grade
|
|
1
|
+
# Claude Code Employee-Grade Standards
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
> 严格遵循 OpenSpec 规范驱动开发 + gstack 角色化虚拟工程团队 + Playwright 自动 E2E 验证。
|
|
3
|
+
> 员工级行为规范。
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
@@ -13,13 +12,11 @@ E2E 工作流前提(由用户确保,非 AI 操作):
|
|
|
13
12
|
- gstack:`git clone --single-branch --depth 1 https://github.com/garrytan/gstack.git ~/.claude/skills/gstack && cd ~/.claude/skills/gstack && ./setup`(提供 `/browse` 探索 + `/qa` 浏览器验证)
|
|
14
13
|
- OpenSpec CLI:`npm install -g @fission-ai/openspec && openspec init`(提供变更管理能力)
|
|
15
14
|
- openspec-playwright:`openspec-pw init`(提供 `/opsx:e2e` 命令)
|
|
16
|
-
- Playwright MCP:`claude mcp add playwright npx @playwright/mcp@latest`(用于测试执行 + Healer)
|
|
17
|
-
- 浏览器已安装:`npx playwright install --with-deps`
|
|
18
15
|
- 项目包含 `specs/`、`changes/`、`tests/playwright/` 目录
|
|
19
16
|
|
|
20
17
|
## 1. 浏览器操作约束
|
|
21
18
|
|
|
22
|
-
所有浏览器操作用 gstack 的 `/browse` 探索 + `/qa`
|
|
19
|
+
所有浏览器操作用 gstack 的 `/browse` 探索 + `/qa` 验证。
|
|
23
20
|
|
|
24
21
|
**冲突解决**:gstack 任何想直接修改代码的行为,都必须先确认当前 OpenSpec proposal 是否已存在并通过(检查 `changes/<name>/proposal.md` 是否处于 `approved` 状态)。
|
|
25
22
|
|
|
@@ -28,8 +25,6 @@ E2E 工作流前提(由用户确保,非 AI 操作):
|
|
|
28
25
|
|
|
29
26
|
**拒绝"够用就行"**。架构缺陷、状态重复、模式不一致——必须说出来并修复。
|
|
30
27
|
|
|
31
|
-
**安全防护**:写 Go 时关注内存安全,写 Python 时关注反序列化,写 Web/API 时参考 OWASP Top 10 / OWASP API Top 10。先了解所用场景的风险模型。
|
|
32
|
-
|
|
33
28
|
## 3. 上下文管理
|
|
34
29
|
**文件读取完整**:超过 500 行的文件,不要假设单次读取覆盖完整内容——根据需要分次读取或编辑前重新读取完整文件。超过 10 条消息后,编辑任何文件前强制重新读取。
|
|
35
30
|
|
|
@@ -38,16 +33,12 @@ E2E 工作流前提(由用户确保,非 AI 操作):
|
|
|
38
33
|
**重构前清死代码**:未使用的 import/export/prop/console.log 先删掉,单独提交,再做重构。
|
|
39
34
|
|
|
40
35
|
## 4. 大规模任务处理
|
|
41
|
-
**子 Agent 并行化**:任务涉及超过 5 个独立文件时,启动并行子 agent(每个 5-8 个文件),每个拥有独立 token budget。
|
|
42
|
-
|
|
43
|
-
**分阶段执行**:每个阶段不超过 5 个文件,完成后验证,等待用户批准再继续。
|
|
44
|
-
|
|
45
36
|
**200 行以上修改必须走 OpenSpec**:代码改动超过 200 行时,禁止直接修改,必须通过 OpenSpec 工作流(/opsx:propose)。
|
|
46
37
|
|
|
47
38
|
## 5. 工具限制与编辑安全
|
|
48
39
|
**搜索要全**:重命名时,用 Grep 覆盖调用、类型、字符串、`import`、barrel file、测试 mock,不得假设一次覆盖所有情况。
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
**编辑要求**:编辑后重新读取文件确认变更正确应用。变更完成后,明确告知用户可能遗漏的区域(动态引用、测试 mock 等),提示人工复查。
|
|
51
42
|
|
|
52
43
|
**不主动推送**:除非用户明确要求,否则不推送代码。
|
|
53
44
|
|
|
@@ -55,14 +46,14 @@ E2E 工作流前提(由用户确保,非 AI 操作):
|
|
|
55
46
|
|
|
56
47
|
---
|
|
57
48
|
|
|
58
|
-
## 6.
|
|
49
|
+
## 6. 完整生产工作流
|
|
59
50
|
|
|
60
51
|
```
|
|
61
52
|
1. 探索与提案
|
|
62
53
|
2. 产品与架构评审(按需触发)
|
|
63
54
|
3. 设计审查
|
|
64
55
|
4. 实现 → /opsx:apply
|
|
65
|
-
5. 自审 → /opsx:verify
|
|
56
|
+
5. 自审 → /opsx:verify
|
|
66
57
|
6. E2E 测试 → /opsx:e2e <change-name> → /browse 探索 + /qa 验证
|
|
67
58
|
7. 验证通过后归档 → /opsx:archive
|
|
68
59
|
8. 发布 → /ship 或 /land-and-deploy
|
|
@@ -82,30 +73,12 @@ E2E 工作流前提(由用户确保,非 AI 操作):
|
|
|
82
73
|
|
|
83
74
|
**4. 实现**:执行 `/opsx:apply` 进行实现 → `lint + typecheck` 通过才算成功。
|
|
84
75
|
|
|
85
|
-
**5. 自审**:`/opsx:verify`
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
两步式审计:
|
|
89
|
-
1. 确定间距基准 — 查 CSS variables / Tailwind spacing / Bootstrap $spacer
|
|
90
|
-
grep 'gap:|padding:|margin:' *.html → 提取值 → 对比基准,列低于基准的项
|
|
91
|
-
2. 检查 margin hack — 同一 grid/flex 容器中相邻元素各自用 margin 硬撑间距
|
|
92
|
-
信号:两个子元素的 margin 和 > 基准间距 2 倍 → 应改为 grid 行或 gap 控制
|
|
93
|
-
例:.desc{margin-b:36}+.btn{margin-t:80} 在同一 row → grid 行分离
|
|
94
|
-
```
|
|
76
|
+
**5. 自审**:`/opsx:verify` 自审实现代码,确保质量。
|
|
95
77
|
|
|
96
|
-
**6. E2E
|
|
78
|
+
**6. E2E 测试**:`/opsx:e2e <change-name>` 生成 Playwright 测试 → `/browse` 探索真实 DOM → Healer 自动修复 → `/qa` 真实浏览器验证。E2E 通过后进入发布环节。
|
|
97
79
|
|
|
98
80
|
**7. 验证通过后归档**:`/opsx:archive` 永久归档,更新 `specs/`
|
|
99
81
|
|
|
100
82
|
**8. 发布**:`/ship` 或 `/land-and-deploy`
|
|
101
83
|
|
|
102
84
|
**9. 迭代回顾**:`/retro`
|
|
103
|
-
|
|
104
|
-
### 反馈循环(生产中必然发生)
|
|
105
|
-
|
|
106
|
-
| 信号 | 回到 |
|
|
107
|
-
|------|------|
|
|
108
|
-
| 测试失败(App Bug) | 回到步骤 4 修复 → 重新测试 |
|
|
109
|
-
| 发现架构问题 | 回到步骤 2 重新评审 → 步骤 4 修复 |
|
|
110
|
-
| Proposal 需调整 | 回到步骤 1 重新提案 |
|
|
111
|
-
| 评审不通过 | 回到对应步骤重新处理 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openspec-playwright",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "OpenSpec + Playwright E2E verification setup tool for Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@types/tar": "^6.1.13",
|
|
23
23
|
"chalk": "^5.3.0",
|
|
24
24
|
"commander": "^12.1.0",
|
|
25
|
+
"playwright": "^1.50.0",
|
|
25
26
|
"tar": "^7.5.13"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
@@ -72,7 +72,9 @@ export default defineConfig({
|
|
|
72
72
|
fullyParallel: true,
|
|
73
73
|
forbidOnly: !!process.env.CI,
|
|
74
74
|
retries: process.env.CI ? 2 : 0,
|
|
75
|
-
|
|
75
|
+
// CI: respect PW_WORKERS env var (defaults to 4 for parallel execution).
|
|
76
|
+
// Local: undefined lets Playwright auto-select based on CPU cores.
|
|
77
|
+
workers: process.env.CI ? (parseInt(process.env.PW_WORKERS || '4') || 4) : undefined,
|
|
76
78
|
reporter: 'list',
|
|
77
79
|
|
|
78
80
|
use: {
|