openspec-playwright 0.3.21 → 0.3.23

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.
@@ -3,9 +3,10 @@ name: openspec-e2e
3
3
  description: "Run Playwright E2E verification. ONLY invoke when user explicitly says '/opsx:e2e' or 'run E2E tests'. Do NOT auto-trigger from explore/propose/apply/verify/continue stages — E2E is a separate workflow requiring explicit user request."
4
4
  license: MIT
5
5
  compatibility: Requires openspec CLI, Playwright (with browsers installed), /browse (gstack, for exploration), and @playwright/mcp (globally installed via `claude mcp add playwright npx @playwright/mcp@latest`, for test execution + Healer).
6
+ scope: This skill is designed for **Node.js + TypeScript + Playwright projects**. For other language ecosystems (Python, Go, Ruby), the workflow concepts apply but tools differ — use language-appropriate E2E frameworks and adjust accordingly.
6
7
  metadata:
7
8
  author: openspec-playwright
8
- version: "2.25"
9
+ version: "2.26"
9
10
  ---
10
11
 
11
12
  ## Input
@@ -249,7 +250,12 @@ Seed test initializes the `page` context — it runs all fixtures, hooks, and gl
249
250
 
250
251
  Explore to collect real DOM data before writing test plan. This eliminates blind selector guessing.
251
252
 
252
- **Prerequisites**: seed test pass. BASE_URL must be verified reachable (see 4.1). If auth is required and `auth.setup.ts` already exists → auth is ready. If auth is not yet configured → use the workaround below (Option B for protected routes).
253
+ **Prerequisites**:
254
+ 1. **gstack available** — Step 4 uses `$B` commands (browser exploration). If gstack is not available → **STOP**: inform user that browser exploration requires gstack. Ask user to install: `git clone --single-branch --depth 1 https://github.com/garrytan/gstack.git ~/.claude/skills/gstack && cd ~/.claude/skills/gstack && ./setup`
255
+ 2. seed test pass
256
+ 3. BASE_URL must be verified reachable (see 4.1)
257
+
258
+ If auth is required and `auth.setup.ts` already exists → auth is ready. If auth is not yet configured → use the workaround below (Option B for protected routes).
253
259
 
254
260
  #### 4.1. Verify BASE_URL + Read app-knowledge.md
255
261
 
@@ -806,11 +812,15 @@ If missing → generate a minimal `playwright.config.ts` with webServer, project
806
812
  2. `tests/playwright/seed.spec.ts` → extract `BASE_URL` value
807
813
  3. Read `vite.config.ts` (or `vite.config.js`) → extract `server.port` + infer protocol (`https` if `server.https`, else `http`)
808
814
  4. Read `package.json` → `scripts.dev` or `scripts.start` → extract port from `--port` flag
809
- 5. Fallback: `http://localhost:3000`
815
+ 5. **Python projects**: Read `pyproject.toml` or `settings.py` → extract `PORT` or `DEBUG` config
816
+ 6. **Go projects**: Read `main.go` or `.env` → extract port from `http.ListenAndServe` or env vars
817
+ 7. Fallback: `http://localhost:3000`
810
818
 
811
819
  **Auto-detect dev command**:
812
820
 
813
821
  1. `package.json` → scripts in order: `dev` → `start` → `serve` → `preview` → `npm run dev`
822
+ 2. **Python projects**: Check for `uvicorn`, `flask run`, `python manage.py runserver`, `fastapi dev`
823
+ 3. **Go projects**: Check for `air`, `reflex`, `fresh`, or custom dev scripts
814
824
 
815
825
  If playwright.config.ts exists → READ first, preserve ALL existing fields, add only missing `webServer` block.
816
826
 
@@ -32,7 +32,18 @@ E2E 工作流前提(由用户确保,非 AI 操作):
32
32
 
33
33
  **精准改动**:只改必要的,改完清理自己造成的垃圾。匹配现有风格,不改进无关代码。每一行改动都应追溯到用户的请求。
34
34
 
35
- **lint + typecheck 后才能算成功**。动手前查 `package.json` scripts、`Makefile` 等找工具链。工具不存在时,明确告知用户,不得假装成功。
35
+ **lint + typecheck 通过(项目标准工具链)才算成功**。动手前扫描项目根目录源码文件扩展名检测主语言——`.py`→Python(ruff + mypy)、`.ts`/`.tsx`→TypeScript(ESLint + tsc)、`.go`→Go(gofmt + vet),工具不存在时告知用户。
36
+
37
+ **禁止非通用性改动**:
38
+ - 不写只适配特定输入值的逻辑
39
+ - 假设所有外部数据都有效 → 必须校验类型/范围/null
40
+ - 处理数据时考虑边界情况(空值、异常值、边界值)
41
+ - 断言用通用规则,不用具体值(除非明确要求)
42
+ - 禁止魔法数字 → 用常量或枚举,注释说明原因
43
+ - 禁止隐式成功假设 → 异步/外部操作必须处理失败情况
44
+ - 禁止响应结构假设 → 先校验返回结构再访问深层属性
45
+ - 禁止精度/范围假设 → 计算前确认数值在安全范围内
46
+ - 禁止资源泄漏假设 → 文件/连接/cursor 等使用后必须释放
36
47
 
37
48
  ## 3. 上下文管理
38
49
 
@@ -40,21 +51,25 @@ E2E 工作流前提(由用户确保,非 AI 操作):
40
51
 
41
52
  **上下文压缩恢复后(Apply 阶段)**:
42
53
  1. `git status` — 确认已改动的内容
43
- 2. 重读 `changes/<name>/proposal.md` + `tasks.md` — 确认范围和任务状态
44
- 3. 然后继续实施
54
+ 2. 重读 `changes/<name>/proposal.md` + `design.md` + `tasks.md` — 确认范围、设计决策、任务状态
55
+ 3. 对照 design.md 检查关键实现(路径、命名、目录结构)
56
+ 4. 运行对应语言的 lint + typecheck 验证
57
+ 5. 然后继续实施
45
58
 
46
59
  **OpenSpec 阶段隔离**:所有阶段均由用户手动触发,不自动进入下一阶段。`/opsx:explore`、`/opsx:propose`、`/opsx:apply`、`/opsx:verify`、`/opsx:e2e` 均需用户明确调用。禁止在同一阶段内触发其他阶段(如 explore 阶段不能调用 apply,verify 阶段不能调用 e2e)。
47
60
 
48
61
  **重构前清死代码**:未使用的 import/export/prop/console.log 先删掉,单独提交,再做重构。
49
62
 
50
63
  ## 4. 大规模任务处理
51
- **200 行以上修改必须走 OpenSpec**:代码改动超过 200 行时,禁止直接修改,必须通过 OpenSpec 工作流(/opsx:propose)。
64
+ **200 行以上修改或显著架构变更必须走 OpenSpec**:代码改动超过 200 行、或涉及新增服务/API 契约/数据模型重构时,禁止直接修改,必须通过 OpenSpec 工作流(/opsx:propose)。
52
65
 
53
66
  ## 5. 工具限制与编辑安全
54
- **搜索要全**:用 Grep 搜内容,用 Glob 搜文件名。两者缺一不可。搜项目/工作区时默认包含所有源码类型,搜子目录时按需缩小。重命名时覆盖调用、类型、字符串、`import`、barrel file、测试 mock,不得假设一次覆盖所有情况。
67
+ **搜索要全**:用 Grep 搜内容,用 Glob 搜文件名。两者缺一不可。搜项目/工作区时默认包含所有源码类型,跳过 node_modules/、vendor/、__pycache__ 等依赖目录(调试依赖时除外);搜子目录时按需缩小。重命名时覆盖调用、类型、字符串、`import`、barrel file、测试 mock,不得假设一次覆盖所有情况。
55
68
 
56
69
  **编辑要求**:编辑后重新读取文件确认变更正确应用。变更完成后,明确告知用户可能遗漏的区域(动态引用、测试 mock 等),提示人工复查。
57
70
 
71
+ **禁止脚本改文件**:修改源码文件只能使用内置编辑工具(Read/Edit/Write),禁止用 sed/awk/node -e/python -c 等管道命令改文件。格式化工具(ruff fmt、prettier)除外。
72
+
58
73
  **不主动推送**:除非用户明确要求,否则不推送代码。
59
74
 
60
75
  **中文回复**:用中文回复用户。
@@ -93,18 +108,20 @@ E2E 工作流前提(由用户确保,非 AI 操作):
93
108
  - 完成后:逐条对照 proposal.md 确认 scope 内的已交付,scope 外的未改动
94
109
 
95
110
  **4.2 任务类型区分**:
96
- - **构建任务**:创建文件/代码 → lint + typecheck 通过后可标记
111
+ - **构建任务**:创建文件/代码 → 对应语言 lint + typecheck 通过后可标记
97
112
  - **验证任务**:需实际运行 → 必须验证后才能标记
98
113
  - **依赖任务**:等前置完成 → 不提前标记
99
114
 
100
115
  **4.3 依赖链检查**:标记依赖任务前,检查前置任务状态
101
116
 
102
- **4.4 自动化 Gate**:lint + typecheck 自动执行,任一失败则停止
117
+ **4.4 自动化 Gate**:对应语言 lint + typecheck 自动执行,任一失败则停止
103
118
 
104
119
  **4.5 Verify 强制化**:必须 verify 通过后才能标记完成,禁止跳过
105
120
 
106
121
  **5. E2E 测试**:`/opsx:e2e <change-name>` 生成 Playwright 测试 → `/browse` 探索真实 DOM → Healer 自动修复 → `/qa` 真实浏览器验证。E2E 通过后,由用户决定发布时机。
107
122
 
123
+ > 注:Healer 需要 Playwright 环境;非 Node.js 项目请参考各自语言的 OpenSpec 测试集成。
124
+
108
125
  **6. 发布**:由用户手动触发 `/ship`、`/land-and-deploy` 或 `/canary`。内部项目可能直接部署,无需走 PR 机制。
109
126
 
110
127
  **7. 迭代回顾**:`/retro`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openspec-playwright",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "OpenSpec + Playwright E2E verification setup tool for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {