openspec-playwright 0.3.43 → 0.3.45
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/README.md +30 -11
- package/README.zh-CN.md +28 -11
- package/dist/commands/audit.js +22 -8
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/doctor.js +36 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/editors.d.ts +63 -12
- package/dist/commands/editors.js +318 -39
- package/dist/commands/editors.js.map +1 -1
- package/dist/commands/explore.js +37 -35
- package/dist/commands/explore.js.map +1 -1
- package/dist/commands/init.js +39 -30
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/run.js +8 -1
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/uninstall.js +25 -41
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +35 -30
- package/dist/commands/update.js.map +1 -1
- package/dist/shared/mcp.d.ts +15 -16
- package/dist/shared/mcp.js +30 -66
- package/dist/shared/mcp.js.map +1 -1
- package/employee-standards.md +17 -3
- package/package.json +6 -2
- package/templates/e2e-command.md +2 -0
package/README.md
CHANGED
|
@@ -20,7 +20,9 @@ openspec-pw init # Install Playwright E2E integration
|
|
|
20
20
|
|
|
21
21
|
## Supported AI Coding Assistants
|
|
22
22
|
|
|
23
|
-
Claude Code — E2E workflow is driven by `/opsx:e2e` command using a browser exploration tool (gstack `/browse`, Playwright MCP, or `openspec-pw explore`) + Playwright MCP (test execution).
|
|
23
|
+
**Claude Code** (Anthropic) — E2E workflow is driven by the `/opsx:e2e` command using a browser exploration tool (gstack `/browse`, Playwright MCP, or `openspec-pw explore`) + Playwright MCP (test execution).
|
|
24
|
+
|
|
25
|
+
**OpenCode** (SST) — E2E workflow is driven by the `/opsx-e2e` command (hyphenated per OpenSpec convention) using the same browser exploration + Playwright MCP stack. Playwright MCP is configured under `mcp.playwright` in `opencode.jsonc`.
|
|
24
26
|
|
|
25
27
|
## Usage
|
|
26
28
|
|
|
@@ -30,6 +32,14 @@ Claude Code — E2E workflow is driven by `/opsx:e2e` command using a browser ex
|
|
|
30
32
|
/opsx:e2e <change-name>
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
### In OpenCode
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
/opsx-e2e <change-name>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The command id is hyphenated per the OpenSpec convention; the body is rewritten from `/opsx:` to `/opsx-` during install and stored at `.opencode/commands/opsx-e2e.md`.
|
|
42
|
+
|
|
33
43
|
### CLI Commands
|
|
34
44
|
|
|
35
45
|
```bash
|
|
@@ -46,6 +56,7 @@ openspec-pw uninstall # Remove integration from the project
|
|
|
46
56
|
## How It Works
|
|
47
57
|
|
|
48
58
|
```
|
|
59
|
+
# Triggered by /opsx:e2e <change-name> (Claude Code) or /opsx-e2e <change-name> (OpenCode)
|
|
49
60
|
/opsx:e2e <change-name>
|
|
50
61
|
│
|
|
51
62
|
├── 1. Select change → read openspec/changes/<name>/specs/
|
|
@@ -81,9 +92,11 @@ openspec-pw uninstall # Remove integration from the project
|
|
|
81
92
|
**Required:**
|
|
82
93
|
|
|
83
94
|
1. **Node.js >= 20**
|
|
84
|
-
2. **Claude Code** with `.claude/` directory
|
|
95
|
+
2. **Claude Code** (with `.claude/` directory) and/or **OpenCode** (with `.opencode/` directory)
|
|
85
96
|
3. **OpenSpec** initialized: `npm install -g @fission-ai/openspec@latest && openspec init`
|
|
86
|
-
4. **Playwright MCP** (for test execution + Healer)
|
|
97
|
+
4. **Playwright MCP** (for test execution + Healer) — installed automatically by `openspec-pw init` for the detected editor:
|
|
98
|
+
- **Claude Code**: `claude mcp add playwright npx @playwright/mcp@latest`
|
|
99
|
+
- **OpenCode**: merged into `opencode.jsonc` under `mcp.playwright = { type: "local", command: ["npx", "@playwright/mcp@latest"] }`
|
|
87
100
|
|
|
88
101
|
**Optional** — `openspec-pw explore` and Playwright MCP can do browser exploration out of the box; install gstack only if you want the `/browse` slash command:
|
|
89
102
|
|
|
@@ -91,8 +104,8 @@ openspec-pw uninstall # Remove integration from the project
|
|
|
91
104
|
|
|
92
105
|
## What `openspec-pw init` Does
|
|
93
106
|
|
|
94
|
-
1. Detects
|
|
95
|
-
2. Installs E2E command (`/opsx:e2e`
|
|
107
|
+
1. Detects supported editors in the project (Claude Code and/or OpenCode)
|
|
108
|
+
2. Installs the E2E command for each detected editor (`/opsx:e2e` for Claude Code, `/opsx-e2e` for OpenCode)
|
|
96
109
|
3. Generates `tests/playwright/seed.spec.ts`, `auth.setup.ts`, `credentials.yaml`, `app-knowledge.md`
|
|
97
110
|
4. Generates `playwright.config.ts` with automatic dev script and port detection (Vite/Next/Nuxt/Astro, `.env`, and `--port`)
|
|
98
111
|
|
|
@@ -107,12 +120,12 @@ Run through these steps in order when using the E2E workflow for the first time:
|
|
|
107
120
|
| 1. Install CLI | `npm install -g openspec-playwright@latest` | Check Node.js version `node -v` (needs >= 20) |
|
|
108
121
|
| 2. Install OpenSpec | `npm install -g @fission-ai/openspec@latest && openspec init` | `npm cache clean -f && npm install -g @fission-ai/openspec@latest` |
|
|
109
122
|
| 3. Initialize E2E | `openspec-pw init` | Run `openspec-pw doctor` to see what's missing |
|
|
110
|
-
| 4. Install Playwright MCP | `claude mcp add playwright npx @playwright/mcp@latest` | `claude mcp list` to confirm
|
|
123
|
+
| 4. Install Playwright MCP | `claude mcp add playwright npx @playwright/mcp@latest` (Claude), or add `mcp.playwright` to `opencode.jsonc` (OpenCode) | `claude mcp list` (Claude) / `cat opencode.jsonc` (OpenCode) to confirm |
|
|
111
124
|
| 5. Install browsers | `npx playwright install --with-deps` | macOS may need `xcode-select --install` first |
|
|
112
125
|
| 6. Start dev server | `npm run dev` (in a separate terminal) | Confirm port, set `BASE_URL` if non-standard |
|
|
113
126
|
| 7. Validate env | `npx playwright test tests/playwright/seed.spec.ts` | Check `webServer` in `playwright.config.ts` |
|
|
114
127
|
| 8. Configure auth (if needed) | See "Authentication" below | Debug with `npx playwright test --project=setup` |
|
|
115
|
-
| 9. Run first E2E | `/opsx:e2e <change-name>` | Check `openspec/reports/` for the report |
|
|
128
|
+
| 9. Run first E2E | `/opsx:e2e <change-name>` (Claude) or `/opsx-e2e <change-name>` (OpenCode) | Check `openspec/reports/` for the report |
|
|
116
129
|
|
|
117
130
|
**Optional — only if you want the single-browser `/browse` workflow:**
|
|
118
131
|
|
|
@@ -163,7 +176,7 @@ npx playwright test --project=setup
|
|
|
163
176
|
/opsx:e2e my-feature
|
|
164
177
|
```
|
|
165
178
|
|
|
166
|
-
Supports **API login** (preferred) and **UI login** (fallback). For multi-user tests (admin vs user), add multiple users in `credentials.yaml` and run `/opsx:e2e` — it auto-detects roles from specs.
|
|
179
|
+
Supports **API login** (preferred) and **UI login** (fallback). For multi-user tests (admin vs user), add multiple users in `credentials.yaml` and run `/opsx:e2e` (or `/opsx-e2e` in OpenCode) — it auto-detects roles from specs.
|
|
167
180
|
|
|
168
181
|
## Customization
|
|
169
182
|
|
|
@@ -197,9 +210,15 @@ CLI (openspec-pw)
|
|
|
197
210
|
├── explore → Explores routes in parallel with Playwright
|
|
198
211
|
└── uninstall → Removes integration from the project
|
|
199
212
|
|
|
200
|
-
|
|
201
|
-
├──
|
|
202
|
-
|
|
213
|
+
Editors (auto-detected by openspec-pw init)
|
|
214
|
+
├── Claude Code (/opsx:e2e)
|
|
215
|
+
│ ├── .claude/commands/opsx/e2e.md → Command file
|
|
216
|
+
│ ├── @playwright/mcp → Healer Agent tools (via `claude mcp add playwright …`)
|
|
217
|
+
│ └── CLAUDE.md → Employee-grade standards
|
|
218
|
+
└── OpenCode (/opsx-e2e)
|
|
219
|
+
├── .opencode/commands/opsx-e2e.md → Command file (body rewritten from /opsx: → /opsx-)
|
|
220
|
+
├── opencode.jsonc → Playwright MCP (mcp.playwright) + instructions routing
|
|
221
|
+
└── CLAUDE.md or AGENTS.md → Employee-grade standards (routed by detected editors)
|
|
203
222
|
|
|
204
223
|
Test Assets (tests/playwright/)
|
|
205
224
|
├── seed.spec.ts → Env validation
|
package/README.zh-CN.md
CHANGED
|
@@ -15,9 +15,11 @@ npm install -g openspec-playwright@latest
|
|
|
15
15
|
**必需:**
|
|
16
16
|
|
|
17
17
|
1. **Node.js >= 20**
|
|
18
|
-
2. **Claude Code
|
|
18
|
+
2. **Claude Code**(带 `.claude/` 目录)和/或 **OpenCode**(带 `.opencode/` 目录)
|
|
19
19
|
3. **OpenSpec** 已初始化:`npm install -g @fission-ai/openspec@latest && openspec init`
|
|
20
|
-
4. **Playwright MCP**(用于测试执行 + Healer
|
|
20
|
+
4. **Playwright MCP**(用于测试执行 + Healer)— `openspec-pw init` 会按检测到的编辑器自动安装:
|
|
21
|
+
- **Claude Code**:`claude mcp add playwright npx @playwright/mcp@latest`
|
|
22
|
+
- **OpenCode**:合并到 `opencode.jsonc` 的 `mcp.playwright = { type: "local", command: ["npx", "@playwright/mcp@latest"] }`
|
|
21
23
|
|
|
22
24
|
**可选** — `openspec-pw explore` 和 Playwright MCP 自带浏览器探索能力;只有想要 `/browse` 短命令时才需要装 gstack:
|
|
23
25
|
|
|
@@ -35,7 +37,9 @@ openspec-pw init # 安装 Playwright E2E 集成
|
|
|
35
37
|
|
|
36
38
|
## 支持的 AI 编码助手
|
|
37
39
|
|
|
38
|
-
Claude Code
|
|
40
|
+
**Claude Code**(Anthropic)— E2E 工作流由 `/opsx:e2e` 命令驱动,使用 /browse(探索)+ Playwright MCP(测试执行)。
|
|
41
|
+
|
|
42
|
+
**OpenCode**(SST)— E2E 工作流由 `/opsx-e2e` 命令驱动(按 OpenSpec 惯例使用连字符),使用相同的浏览器探索 + Playwright MCP 技术栈。Playwright MCP 通过 `opencode.jsonc` 的 `mcp.playwright` 配置。
|
|
39
43
|
|
|
40
44
|
## 使用
|
|
41
45
|
|
|
@@ -45,6 +49,14 @@ Claude Code — E2E 工作流由 `/opsx:e2e` 命令驱动,使用 /browse(探
|
|
|
45
49
|
/opsx:e2e <change-name>
|
|
46
50
|
```
|
|
47
51
|
|
|
52
|
+
### 在 OpenCode 中
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
/opsx-e2e <change-name>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
命令 id 按 OpenSpec 惯例使用连字符;正文在安装时从 `/opsx:` 改写为 `/opsx-`,存储在 `.opencode/commands/opsx-e2e.md`。
|
|
59
|
+
|
|
48
60
|
### CLI 命令
|
|
49
61
|
|
|
50
62
|
```bash
|
|
@@ -61,6 +73,7 @@ openspec-pw uninstall # 移除项目中的集成
|
|
|
61
73
|
## 工作原理
|
|
62
74
|
|
|
63
75
|
```
|
|
76
|
+
# 由 /opsx:e2e <change-name>(Claude Code)或 /opsx-e2e <change-name>(OpenCode)触发
|
|
64
77
|
/opsx:e2e <change-name>
|
|
65
78
|
│
|
|
66
79
|
├── 1. 选择 change → 读取 openspec/changes/<name>/specs/
|
|
@@ -94,8 +107,8 @@ openspec-pw uninstall # 移除项目中的集成
|
|
|
94
107
|
|
|
95
108
|
## `openspec-pw init` 做了什么
|
|
96
109
|
|
|
97
|
-
1.
|
|
98
|
-
2.
|
|
110
|
+
1. 检测项目中的受支持编辑器(Claude Code 和/或 OpenCode)
|
|
111
|
+
2. 为每个检测到的编辑器安装 E2E 命令(Claude Code 用 `/opsx:e2e`,OpenCode 用 `/opsx-e2e`)
|
|
99
112
|
3. 生成 `tests/playwright/seed.spec.ts`、`auth.setup.ts`、`credentials.yaml`、`app-knowledge.md`
|
|
100
113
|
|
|
101
114
|
## 首次配置清单
|
|
@@ -107,12 +120,12 @@ openspec-pw uninstall # 移除项目中的集成
|
|
|
107
120
|
| 1. 安装 CLI | `npm install -g openspec-playwright@latest` | 检查 Node.js 版本 `node -v`(需 >= 20) |
|
|
108
121
|
| 2. 安装 OpenSpec | `npm install -g @fission-ai/openspec@latest && openspec init` | `npm cache clean -f && npm install -g @fission-ai/openspec@latest` |
|
|
109
122
|
| 3. 初始化 E2E | `openspec-pw init` | 运行 `openspec-pw doctor` 查看具体缺失项 |
|
|
110
|
-
| 4. 安装 Playwright MCP | `claude mcp add playwright npx @playwright/mcp@latest` | `claude mcp list`
|
|
123
|
+
| 4. 安装 Playwright MCP | `claude mcp add playwright npx @playwright/mcp@latest`(Claude),或将 `mcp.playwright` 加入 `opencode.jsonc`(OpenCode) | `claude mcp list`(Claude)/ `cat opencode.jsonc`(OpenCode)确认安装成功 |
|
|
111
124
|
| 5. 安装浏览器 | `npx playwright install --with-deps` | macOS 可能需先运行 `xcode-select --install` |
|
|
112
125
|
| 6. 启动开发服务器 | `npm run dev`(在另一个终端) | 确认端口,配置 `BASE_URL` |
|
|
113
126
|
| 7. 验证环境 | `npx playwright test tests/playwright/seed.spec.ts` | 检查 `playwright.config.ts` 中的 `webServer` 配置 |
|
|
114
127
|
| 8. 配置认证(如需要) | 见下方"认证配置" | `npx playwright test --project=setup` 调试 |
|
|
115
|
-
| 9. 运行第一个 E2E | `/opsx:e2e <change-name
|
|
128
|
+
| 9. 运行第一个 E2E | `/opsx:e2e <change-name>`(Claude)或 `/opsx-e2e <change-name>`(OpenCode) | 查看 `openspec/reports/` 中的报告 |
|
|
116
129
|
|
|
117
130
|
**可选 — 仅当需要单浏览器 `/browse` 工作流时:**
|
|
118
131
|
|
|
@@ -139,7 +152,7 @@ npx playwright test --project=setup
|
|
|
139
152
|
/opsx:e2e my-feature
|
|
140
153
|
```
|
|
141
154
|
|
|
142
|
-
支持 **API 登录**(推荐)和 **UI 登录**(备选)。多用户测试(管理员 vs 普通用户)在 `credentials.yaml`
|
|
155
|
+
支持 **API 登录**(推荐)和 **UI 登录**(备选)。多用户测试(管理员 vs 普通用户)在 `credentials.yaml` 中添加多个用户,运行 `/opsx:e2e`(OpenCode 中用 `/opsx-e2e`)— 会从 specs 自动检测角色。
|
|
143
156
|
|
|
144
157
|
## 自定义
|
|
145
158
|
|
|
@@ -173,9 +186,13 @@ CLI (openspec-pw)
|
|
|
173
186
|
├── explore → 并行探索路由
|
|
174
187
|
└── uninstall → 移除项目中的集成
|
|
175
188
|
|
|
176
|
-
|
|
177
|
-
├──
|
|
178
|
-
|
|
189
|
+
编辑器(由 openspec-pw init 自动检测)
|
|
190
|
+
├── Claude Code (/opsx:e2e)
|
|
191
|
+
│ ├── .claude/commands/opsx/e2e.md → 命令文件(从 templates/e2e-command.md 安装)
|
|
192
|
+
│ └── @playwright/mcp → Healer Agent 工具(通过 `claude mcp add playwright …`)
|
|
193
|
+
└── OpenCode (/opsx-e2e)
|
|
194
|
+
├── .opencode/commands/opsx-e2e.md → 命令文件(正文由 /opsx: 改写为 /opsx-)
|
|
195
|
+
└── opencode.jsonc → Playwright MCP (mcp.playwright) + 指令路由
|
|
179
196
|
|
|
180
197
|
测试资产 (tests/playwright/)
|
|
181
198
|
├── seed.spec.ts → 环境验证
|
package/dist/commands/audit.js
CHANGED
|
@@ -13,8 +13,11 @@ export async function audit() {
|
|
|
13
13
|
console.log(chalk.blue("\n🔍 OpenSpec Playwright: Audit\n"));
|
|
14
14
|
const results = [];
|
|
15
15
|
// 1. Get sitemap routes
|
|
16
|
-
const
|
|
17
|
-
const allRoutes =
|
|
16
|
+
const sitemapResult = await getSitemapRoutes();
|
|
17
|
+
const allRoutes = sitemapResult.routes;
|
|
18
|
+
if (sitemapResult.note) {
|
|
19
|
+
console.log(chalk.gray(` ℹ ${sitemapResult.note}`));
|
|
20
|
+
}
|
|
18
21
|
// 2. Get OpenSpec change names
|
|
19
22
|
const changeNames = await getChangeNames(projectRoot);
|
|
20
23
|
// 3. Scan all spec files recursively
|
|
@@ -121,14 +124,19 @@ export async function audit() {
|
|
|
121
124
|
}
|
|
122
125
|
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
123
126
|
async function getSitemapRoutes() {
|
|
127
|
+
const baseUrl = process.env.BASE_URL || "http://localhost:3000";
|
|
128
|
+
const hasBaseUrl = !!process.env.BASE_URL;
|
|
124
129
|
try {
|
|
125
|
-
const baseUrl = process.env.BASE_URL || "http://localhost:3000";
|
|
126
130
|
const controller = new AbortController();
|
|
127
131
|
const timeoutId = setTimeout(() => controller.abort(), TIMEOUT.OPENSPEC_LIST);
|
|
128
132
|
const response = await fetch(`${baseUrl}/sitemap.xml`, { signal: controller.signal });
|
|
129
133
|
clearTimeout(timeoutId);
|
|
130
|
-
if (!response.ok)
|
|
131
|
-
return
|
|
134
|
+
if (!response.ok) {
|
|
135
|
+
return {
|
|
136
|
+
routes: [],
|
|
137
|
+
note: `${baseUrl}/sitemap.xml returned ${response.status}; route coverage check skipped`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
132
140
|
const text = await response.text();
|
|
133
141
|
const urlRegex = /<loc>([^<]+)<\/loc>/g;
|
|
134
142
|
const urls = [];
|
|
@@ -139,10 +147,16 @@ async function getSitemapRoutes() {
|
|
|
139
147
|
}
|
|
140
148
|
catch { }
|
|
141
149
|
}
|
|
142
|
-
return [...new Set(urls)];
|
|
150
|
+
return { routes: [...new Set(urls)], note: null };
|
|
143
151
|
}
|
|
144
|
-
catch {
|
|
145
|
-
|
|
152
|
+
catch (err) {
|
|
153
|
+
const reason = hasBaseUrl
|
|
154
|
+
? `fetch failed: ${err.message}`
|
|
155
|
+
: `no BASE_URL set, tried default ${baseUrl}`;
|
|
156
|
+
return {
|
|
157
|
+
routes: [],
|
|
158
|
+
note: `sitemap.xml unreachable; route coverage check skipped (${reason})`,
|
|
159
|
+
};
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
async function getChangeNames(projectRoot) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAi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AAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3C,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW,EAAE,YAAsB,EAAE;IAC7D,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,+CAA+C;YAC/C,IACE,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAC3B,KAAK,CAAC,IAAI,KAAK,cAAc;gBAC7B,KAAK,CAAC,IAAI,KAAK,eAAe,EAC9B,CAAC;gBACD,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3C,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { execFileSync } from "child_process";
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
+
import { detectAdapters } from "../commands/editors.js";
|
|
6
7
|
import { detectAppServer, isPlaywrightMcpInstalled, needsShell } from "../shared/index.js";
|
|
7
8
|
export async function doctor(options = {}) {
|
|
8
9
|
const checks = [];
|
|
@@ -13,11 +14,16 @@ export async function doctor(options = {}) {
|
|
|
13
14
|
encoding: "utf-8",
|
|
14
15
|
shell: needsShell,
|
|
15
16
|
}).trim();
|
|
17
|
+
const majorMatch = node.match(/v?(\d+)\./);
|
|
18
|
+
const major = majorMatch ? parseInt(majorMatch[1], 10) : 0;
|
|
19
|
+
const deprecated = major > 0 && major < 22;
|
|
16
20
|
checks.push({
|
|
17
21
|
category: "Node.js",
|
|
18
22
|
name: "node",
|
|
19
23
|
ok: true,
|
|
20
|
-
message:
|
|
24
|
+
message: deprecated
|
|
25
|
+
? `${node} ⚠ Node < 22 deprecated by GitHub Actions; recommend Node 22+`
|
|
26
|
+
: node,
|
|
21
27
|
});
|
|
22
28
|
}
|
|
23
29
|
catch {
|
|
@@ -105,14 +111,27 @@ export async function doctor(options = {}) {
|
|
|
105
111
|
ok: hasPwTest,
|
|
106
112
|
message: pwTestMsg,
|
|
107
113
|
});
|
|
108
|
-
// Playwright MCP —
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
// Playwright MCP — check each detected editor adapter
|
|
115
|
+
const adapters = detectAdapters(projectRoot);
|
|
116
|
+
if (adapters.length === 0) {
|
|
117
|
+
checks.push({
|
|
118
|
+
category: "Playwright MCP",
|
|
119
|
+
name: "playwright-mcp",
|
|
120
|
+
ok: false,
|
|
121
|
+
message: "no editors detected (configure .claude/ or .opencode/)",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
for (const adapter of adapters) {
|
|
126
|
+
const installed = isPlaywrightMcpInstalled(adapter);
|
|
127
|
+
checks.push({
|
|
128
|
+
category: "Playwright MCP",
|
|
129
|
+
name: `playwright-mcp-${adapter.label}`,
|
|
130
|
+
ok: installed,
|
|
131
|
+
message: installed ? "installed" : `not configured for ${adapter.label}`,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
116
135
|
// Seed test
|
|
117
136
|
const hasSeed = existsSync(join(projectRoot, "tests", "playwright", "seed.spec.ts"));
|
|
118
137
|
checks.push({
|
|
@@ -174,7 +193,14 @@ export async function doctor(options = {}) {
|
|
|
174
193
|
console.log(chalk.blue("\n─── Summary ───"));
|
|
175
194
|
if (allOk) {
|
|
176
195
|
console.log(chalk.green(" ✅ All prerequisites met!\n"));
|
|
177
|
-
|
|
196
|
+
const detected = detectAdapters(process.cwd());
|
|
197
|
+
const hints = detected.length
|
|
198
|
+
? detected.map((a) => {
|
|
199
|
+
const slash = a.id === "claude" ? "/opsx:e2e" : "/opsx-e2e";
|
|
200
|
+
return `${slash} (in ${a.displayName})`;
|
|
201
|
+
})
|
|
202
|
+
: ["/opsx:e2e (in Claude Code) or /opsx-e2e (in OpenCode)"];
|
|
203
|
+
console.log(chalk.gray(` Run: ${hints.join(" or ")} <change-name>\n`));
|
|
178
204
|
}
|
|
179
205
|
else {
|
|
180
206
|
console.log(chalk.red(" ❌ Some prerequisites are missing\n"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAM3F,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,UAAyB,EAAE;IACtD,MAAM,MAAM,GAKP,EAAE,CAAC;IAER,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAElC,UAAU;IACV,IAAI,CAAC;QACH,MAA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C,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Escape a value for safe inclusion in a YAML frontmatter scalar. */
|
|
2
2
|
export declare function escapeYamlValue(value: string): string;
|
|
3
|
-
/** Format tags as YAML inline array */
|
|
3
|
+
/** Format tags as a YAML inline array. */
|
|
4
4
|
export declare function formatTagsArray(tags: string[]): string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* OpenCode slash-command names are hyphenated (`/opsx-e2e`), Claude's are
|
|
7
|
+
* colon-prefixed (`/opsx:e2e`). Rewrite all `/opsx:` references in a
|
|
8
|
+
* command body for OpenCode installation.
|
|
9
|
+
*/
|
|
10
|
+
export declare function transformToHyphenCommands(text: string): string;
|
|
6
11
|
export interface CommandMeta {
|
|
7
12
|
id: string;
|
|
8
13
|
name: string;
|
|
@@ -11,16 +16,62 @@ export interface CommandMeta {
|
|
|
11
16
|
tags: string[];
|
|
12
17
|
body: string;
|
|
13
18
|
}
|
|
14
|
-
/**
|
|
19
|
+
/** Build the command metadata for the /opsx:e2e command. */
|
|
20
|
+
export declare function buildCommandMeta(body: string): CommandMeta;
|
|
21
|
+
export interface EditorAdapter {
|
|
22
|
+
id: "claude" | "opencode";
|
|
23
|
+
/** Short label used in log messages. */
|
|
24
|
+
label: string;
|
|
25
|
+
/** Human-readable name used in user-facing messages. */
|
|
26
|
+
displayName: string;
|
|
27
|
+
/** True if this editor's config dir is present in the project. */
|
|
28
|
+
detect(projectRoot: string): boolean;
|
|
29
|
+
/** Relative path of the command file inside the project. */
|
|
30
|
+
commandFilePath(id: string): string;
|
|
31
|
+
/** Format command file contents (frontmatter + body). */
|
|
32
|
+
formatCommand(meta: CommandMeta): string;
|
|
33
|
+
/** Absolute path of the project rules file. */
|
|
34
|
+
projectRulesPath(projectRoot: string): string;
|
|
35
|
+
/** True if MCP server `serverName` is already configured. */
|
|
36
|
+
isMcpInstalled(projectRoot: string, serverName: string): boolean;
|
|
37
|
+
/** Install MCP server config in this editor. */
|
|
38
|
+
installMcp(projectRoot: string, serverName: string, command: string[]): void;
|
|
39
|
+
/** Remove MCP server config from this editor. */
|
|
40
|
+
removeMcp(projectRoot: string, serverName: string): void;
|
|
41
|
+
/** Optional: register project rules file path in editor config. */
|
|
42
|
+
registerInstructions?(projectRoot: string, instructions: string[]): void;
|
|
43
|
+
}
|
|
15
44
|
export declare function formatClaudeCommand(meta: CommandMeta): string;
|
|
16
45
|
export declare function getClaudeCommandPath(id: string): string;
|
|
17
|
-
/** Build the command metadata for Claude Code */
|
|
18
|
-
export declare function buildCommandMeta(body: string): CommandMeta;
|
|
19
|
-
/** Detect if Claude Code is installed */
|
|
20
46
|
export declare function hasClaudeCode(projectRoot: string): boolean;
|
|
21
|
-
|
|
22
|
-
export declare function
|
|
23
|
-
|
|
24
|
-
export declare function
|
|
25
|
-
|
|
47
|
+
export declare function formatOpenCodeCommand(meta: CommandMeta): string;
|
|
48
|
+
export declare function getOpenCodeCommandPath(id: string): string;
|
|
49
|
+
export declare function hasOpenCode(projectRoot: string): boolean;
|
|
50
|
+
export declare function getAdapter(id: "claude" | "opencode"): EditorAdapter | undefined;
|
|
51
|
+
export declare function detectAdapters(projectRoot: string): EditorAdapter[];
|
|
52
|
+
/** Install the command file for one adapter. */
|
|
53
|
+
export declare function installCommand(adapter: EditorAdapter, meta: CommandMeta, projectRoot: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Install employee-grade standards into the editor's rules file
|
|
56
|
+
* (CLAUDE.md for Claude, AGENTS.md for OpenCode). Wraps content in
|
|
57
|
+
* `<!-- OPENSPEC:START -->` / `<!-- OPENSPEC:END -->` markers so future
|
|
58
|
+
* updates can replace the block without touching the rest of the file.
|
|
59
|
+
*/
|
|
60
|
+
export declare function installProjectClaudeMd(projectRoot: string, standardsContent: string, adapter?: EditorAdapter): void;
|
|
61
|
+
/**
|
|
62
|
+
* Route the employee-grade standards into the right rules file(s) for the
|
|
63
|
+
* detected editors:
|
|
64
|
+
*
|
|
65
|
+
* - 1 editor detected → write to that editor's rules file
|
|
66
|
+
* (CLAUDE.md for Claude, AGENTS.md for OpenCode)
|
|
67
|
+
* - 2 editors detected → write CLAUDE.md (OpenCode reads it natively)
|
|
68
|
+
* and register `CLAUDE.md` in `opencode.json[c].instructions`
|
|
69
|
+
* so OpenCode treats it as a project rule.
|
|
70
|
+
*/
|
|
71
|
+
export declare function installProjectRules(projectRoot: string, standardsContent: string, detected: EditorAdapter[]): void;
|
|
72
|
+
/** Remove the OPENSPEC markers block from a rules file (CLAUDE.md / AGENTS.md). */
|
|
73
|
+
export declare function cleanProjectRules(adapter: EditorAdapter, projectRoot: string): void;
|
|
74
|
+
/** Read the employee-grade standards source file (empty string if missing). */
|
|
26
75
|
export declare function readEmployeeStandards(srcPath: string): string;
|
|
76
|
+
export declare const claudeAdapter: EditorAdapter;
|
|
77
|
+
export declare const opencodeAdapter: EditorAdapter;
|