openspec-playwright 0.3.43 → 0.3.44
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/dist/commands/doctor.js +22 -8
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/editors.d.ts +61 -12
- package/dist/commands/editors.js +316 -39
- package/dist/commands/editors.js.map +1 -1
- package/dist/commands/init.js +39 -30
- package/dist/commands/init.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/package.json +6 -2
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/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 = [];
|
|
@@ -105,14 +106,27 @@ export async function doctor(options = {}) {
|
|
|
105
106
|
ok: hasPwTest,
|
|
106
107
|
message: pwTestMsg,
|
|
107
108
|
});
|
|
108
|
-
// Playwright MCP —
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
// Playwright MCP — check each detected editor adapter
|
|
110
|
+
const adapters = detectAdapters(projectRoot);
|
|
111
|
+
if (adapters.length === 0) {
|
|
112
|
+
checks.push({
|
|
113
|
+
category: "Playwright MCP",
|
|
114
|
+
name: "playwright-mcp",
|
|
115
|
+
ok: false,
|
|
116
|
+
message: "no editors detected (configure .claude/ or .opencode/)",
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
for (const adapter of adapters) {
|
|
121
|
+
const installed = isPlaywrightMcpInstalled(adapter);
|
|
122
|
+
checks.push({
|
|
123
|
+
category: "Playwright MCP",
|
|
124
|
+
name: `playwright-mcp-${adapter.label}`,
|
|
125
|
+
ok: installed,
|
|
126
|
+
message: installed ? "installed" : `not configured for ${adapter.label}`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
116
130
|
// Seed test
|
|
117
131
|
const hasSeed = existsSync(join(projectRoot, "tests", "playwright", "seed.spec.ts"));
|
|
118
132
|
checks.push({
|
|
@@ -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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CAAC,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC3B,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;QACH,OAAO;YACL,EAAE,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG;YACpB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,OAAO,EAAE,aAAa,GAAG,CAAC,MAAM,EAAE;SACnC,CAAC;IACJ,CAAC;IAAC,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,60 @@ 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
|
+
/** True if this editor's config dir is present in the project. */
|
|
26
|
+
detect(projectRoot: string): boolean;
|
|
27
|
+
/** Relative path of the command file inside the project. */
|
|
28
|
+
commandFilePath(id: string): string;
|
|
29
|
+
/** Format command file contents (frontmatter + body). */
|
|
30
|
+
formatCommand(meta: CommandMeta): string;
|
|
31
|
+
/** Absolute path of the project rules file. */
|
|
32
|
+
projectRulesPath(projectRoot: string): string;
|
|
33
|
+
/** True if MCP server `serverName` is already configured. */
|
|
34
|
+
isMcpInstalled(projectRoot: string, serverName: string): boolean;
|
|
35
|
+
/** Install MCP server config in this editor. */
|
|
36
|
+
installMcp(projectRoot: string, serverName: string, command: string[]): void;
|
|
37
|
+
/** Remove MCP server config from this editor. */
|
|
38
|
+
removeMcp(projectRoot: string, serverName: string): void;
|
|
39
|
+
/** Optional: register project rules file path in editor config. */
|
|
40
|
+
registerInstructions?(projectRoot: string, instructions: string[]): void;
|
|
41
|
+
}
|
|
15
42
|
export declare function formatClaudeCommand(meta: CommandMeta): string;
|
|
16
43
|
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
44
|
export declare function hasClaudeCode(projectRoot: string): boolean;
|
|
21
|
-
|
|
22
|
-
export declare function
|
|
23
|
-
|
|
24
|
-
export declare function
|
|
25
|
-
|
|
45
|
+
export declare function formatOpenCodeCommand(meta: CommandMeta): string;
|
|
46
|
+
export declare function getOpenCodeCommandPath(id: string): string;
|
|
47
|
+
export declare function hasOpenCode(projectRoot: string): boolean;
|
|
48
|
+
export declare function getAdapter(id: "claude" | "opencode"): EditorAdapter | undefined;
|
|
49
|
+
export declare function detectAdapters(projectRoot: string): EditorAdapter[];
|
|
50
|
+
/** Install the command file for one adapter. */
|
|
51
|
+
export declare function installCommand(adapter: EditorAdapter, meta: CommandMeta, projectRoot: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Install employee-grade standards into the editor's rules file
|
|
54
|
+
* (CLAUDE.md for Claude, AGENTS.md for OpenCode). Wraps content in
|
|
55
|
+
* `<!-- OPENSPEC:START -->` / `<!-- OPENSPEC:END -->` markers so future
|
|
56
|
+
* updates can replace the block without touching the rest of the file.
|
|
57
|
+
*/
|
|
58
|
+
export declare function installProjectClaudeMd(projectRoot: string, standardsContent: string, adapter?: EditorAdapter): void;
|
|
59
|
+
/**
|
|
60
|
+
* Route the employee-grade standards into the right rules file(s) for the
|
|
61
|
+
* detected editors:
|
|
62
|
+
*
|
|
63
|
+
* - 1 editor detected → write to that editor's rules file
|
|
64
|
+
* (CLAUDE.md for Claude, AGENTS.md for OpenCode)
|
|
65
|
+
* - 2 editors detected → write CLAUDE.md (OpenCode reads it natively)
|
|
66
|
+
* and register `CLAUDE.md` in `opencode.json[c].instructions`
|
|
67
|
+
* so OpenCode treats it as a project rule.
|
|
68
|
+
*/
|
|
69
|
+
export declare function installProjectRules(projectRoot: string, standardsContent: string, detected: EditorAdapter[]): void;
|
|
70
|
+
/** Remove the OPENSPEC markers block from a rules file (CLAUDE.md / AGENTS.md). */
|
|
71
|
+
export declare function cleanProjectRules(adapter: EditorAdapter, projectRoot: string): void;
|
|
72
|
+
/** Read the employee-grade standards source file (empty string if missing). */
|
|
26
73
|
export declare function readEmployeeStandards(srcPath: string): string;
|
|
74
|
+
export declare const claudeAdapter: EditorAdapter;
|
|
75
|
+
export declare const opencodeAdapter: EditorAdapter;
|