OpenSpec projects get AI-driven E2E verification that lives where your code does. One /openspec-e2e <change> command — sixteen editors supported — plans, generates, executes, and self-heals Playwright tests against the spec, with a per-change report and no manual harness wiring.
Why this exists: spec-driven development without test automation is a half-finished loop. This tool completes it — write a change spec, run one command, get tests traceable to spec anchors and a report on what passed, what healed, and what is left for human review.
- Install
- Setup
- Supported AI Coding Assistants
- Usage
- Prerequisites
- Init Modes: frontend vs minimal
- How It Works
- CLI Commands
- Selecting Editors on Init
- Managed
.gitignorepaths - Official Playwright Agents
- What
openspec-pw initDoes openspec-pw doctorChecks- App Server Detection
- Authentication
- Customization
- Architecture
- License
npm install -g openspec-playwright@latestnpm is the supported installation channel. Global installs via pnpm/bun/yarn are not supported —
openspec-pw updateself-updates throughnpm install -g, which would create a second, conflicting install.
# In your project directory
npm install -g @fission-ai/openspec@latest
openspec init --scope project # 2.x keeps skills in the repo; on a 1.x CLI run: openspec init
openspec-pw init # Install Playwright E2E integration (--tools to pick editors, --agents for the official agents)Then, once per project:
npx playwright install chromium— on Linux CI images add--with-deps; on macOS runxcode-select --installfirst if the install fails.- Start your dev server (
npm run dev) in a separate terminal; setBASE_URLif the app is not on the detected port. npx playwright test tests/playwright/seed.spec.tsvalidates the environment — if it fails, checkwebServerinplaywright.config.ts.- Run
/openspec-e2e <change-name>; reports land inopenspec/reports/. Configure auth first if the app needs login (Authentication; debug withnpx playwright test --project=setup).
Naming follows the installed OpenSpec major: the table below uses the 2.x names; on 1.x the same products install opsx-e2e artifacts at opsx- paths (for example .claude/commands/opsx/e2e.md) and invoke them as /opsx:e2e in Claude Code, CodeBuddy CLI, and Gemini CLI, /opsx-e2e elsewhere, $opsx-e2e in Codex, and /skill:opsx-e2e in Kimi Code.
| Editor | Command | Artifact | Playwright MCP | AGENTS.md hook |
|---|---|---|---|---|
| Claude Code (Anthropic) | /openspec-e2e <change-name> |
.claude/skills/openspec-e2e/SKILL.md + shared .agents/skills/openspec-e2e/SKILL.md |
yes (project .mcp.json) |
via CLAUDE.md → @AGENTS.md |
| OpenCode (SST) | /openspec-e2e <change-name> |
.opencode/commands/openspec-e2e.md |
yes (opencode.jsonc) |
instructions field |
| Cline | /openspec-e2e <change-name> |
.cline/skills/openspec-e2e/SKILL.md |
yes (.cline/mcp.json) |
native |
| Cursor | /openspec-e2e <change-name> |
.cursor/commands/openspec-e2e.md + .cursor/skills/openspec-e2e/SKILL.md |
yes (.cursor/mcp.json) |
native |
| Pi (earendil-works) | /openspec-e2e <change-name> |
.pi/prompts/openspec-e2e.md (filename = command) |
no MCP client — openspec-pw explore + npx playwright test, no Healer step |
native |
| Oh My Pi (omp) | /openspec-e2e <change-name> |
.omp/commands/openspec-e2e.md |
yes (.omp/mcp.json) |
native |
| CodeBuddy CLI (Tencent) | /openspec-e2e <change-name> |
.codebuddy/commands/openspec-e2e.md |
yes (project .mcp.json) |
via CODEBUDDY.md → @AGENTS.md |
MiniMax Code (mcode CLI) |
/openspec-e2e <change-name> |
.agents/skills/openspec-e2e/SKILL.md (skill) |
yes (project .mcp.json) |
native (AGENTS.md) |
DeepSeek Harness (dsh) |
openspec-e2e skill |
.dsh/skills/openspec-e2e/SKILL.md (skill) |
no project-level carrier — configure Playwright MCP in your $DSH_HOME profile patch |
native (AGENTS.md) |
| Gemini CLI | /openspec-e2e <change-name> |
.gemini/commands/openspec-e2e.toml (TOML) |
yes (.gemini/settings.json) |
GEMINI.md |
| Qwen Code | /openspec-e2e <change-name> |
.qwen/commands/openspec-e2e.md |
yes (.qwen/settings.json) |
QWEN.md |
| GitHub Copilot (VS Code) | /openspec-e2e <change-name> |
.github/prompts/openspec-e2e.prompt.md |
yes (project .mcp.json) |
.github/copilot-instructions.md |
| Roo Code | /openspec-e2e <change-name> |
.roo/commands/openspec-e2e.md |
yes (.roo/mcp.json) |
.roo/rules/openspec-pw.md |
| Trae | /openspec-e2e <change-name> |
.trae/commands/openspec-e2e.md |
yes (.trae/mcp.json, Project MCP beta) |
.trae/rules/project_rules.md |
| Codex | $openspec-e2e <change-name> |
.agents/skills/openspec-e2e/SKILL.md (skill) |
no JSON carrier — project MCP lives in .codex/config.toml (TOML, not supported) |
native (AGENTS.md) |
| Kimi Code | /skill:openspec-e2e <change-name> |
.kimi-code/skills/openspec-e2e/SKILL.md (skill) |
yes (.kimi-code/mcp.json) |
native (AGENTS.md) |
The command body is identical across editors; only the name and artifact location differ. Invoke it with a change name, e.g. /openspec-e2e add-checkout ($openspec-e2e add-checkout in Codex, /skill:openspec-e2e add-checkout in Kimi Code). Per-editor MCP, detection, and auth details are in Prerequisites.
Per-editor nuances (expand only if init reports a divergence)
- Cursor: skill uses
disable-model-invocation: true(only runs when explicitly invoked). If you want Cursor support but have no.cursor/yet:mkdir -p .cursor. - Oh My Pi: also inherits MCP servers already configured in
.claude//.cursor//opencode.jsoncwhen those are present. - MiniMax Code: skills are the only user-extensible command mechanism in the
mcodeCLI, which loads no user-defined command files. Integration target is themcodeCLI; the desktop app is not covered. - DeepSeek Harness:
.dsh/skillsis dsh's rank-100 project root, so it beats the.agents/skillscopy a MiniMax setup leaves behind. Developer preview — the adapter relies only on its documented skill-discovery contract. - GitHub Copilot: targets the VS Code surface — MCP entries are
stdioand shared with Claude/CodeBuddy/MiniMax; detection uses Copilot-specific markers only, so a plain.github/directory in any repository does not count. - Roo Code: Roo loads every file in
.roo/rules/. - Trae: Project MCP is beta — older IDE builds may ignore
.trae/mcp.json. - Codex: the skill directory is shared with MiniMax Code, so deselecting Codex keeps the skill while MiniMax stays selected; browser exploration falls back to
openspec-pw exploreandnpx playwright test. - Kimi Code: Kimi's automatic
AGENTS.mdloading is not documented, so treat that hook as unverified.
Pre-select logic, deselect = remove, editor territory
openspec-pw init normally auto-detects the editors in your project and
configures all of them. To install only a subset (or none), use --tools —
matching the semantics of openspec init --tools:
openspec-pw init --tools claude,cursor # only Claude Code and Cursor
openspec-pw init --tools all # every supported editor
openspec-pw init --tools none # no editors; scaffold onlySupported ids: claude, opencode, cline, cursor, pi, omp,
codebuddy, minimax, dsh, gemini, qwen, github-copilot,
roocode, trae, codex, kimi (oh-my-pi is accepted as an alias for
omp, minimax-code for minimax). Ids are
case-insensitive, repeats are de-duplicated, and all/none cannot be
mixed with specific ids. A --tools id is configured even when the editor
is not detected (its config directory is created).
Without --tools, a TTY shows a multi-select grouped as Configured / Detected / Other: editors this project already uses are pre-checked, editors installed globally but unused are listed unchecked, and a first-run project pre-checks only project-level signals (root CLAUDE.md, .cursorrules, opencode.json(c), CODEBUDDY.md). --tools picks which editors; --no-mcp decides whether their Playwright MCP server is installed.
Standards language. init --lang zh|en selects the language of the AGENTS.md standards block; without the flag, an installed block's language wins, then the OS locale, then the terminal locale, then English. update --lang switches an installed block. IP and region are never detected.
Standards profile. init --standards general|ml selects which standards body is installed; without the flag an installed block's profile wins, then general. On a TTY with no flag, init asks once with the installed profile pre-selected, so Enter keeps it; non-interactive runs never prompt. update --standards switches an installed block. The ML profile is ML-first — evaluation integrity, data boundaries, training budgets, reproducibility, artifacts, and reporting — and carries the large-artifact source rules; the general profile covers frontend, backend, and general codebases.
Init prints a pre-select hint (not the install set) and a Selected editors: line (the actual install set).
Choosing what to ignore. Interactive init lists the managed .gitignore paths as four group toggles (--auto-pipeline keeps openspec/ committable), all checked — Enter keeps them ignored; unchecking a group commits every path in it, focusing a group shows all of its paths below the list, and the "Customize" row opens the per-path list. Committed paths are recorded on the block's # openspec-pw: skip=… line, so update leaves them out and a later init can restore an exactly recorded path. An opt-out for a path inside a managed directory keeps that whole directory committable — git cannot re-include a file under an ignored directory — and the directory stops being offered. Rule files are always injected (use --no-rule-files to install only AGENTS.md). Non-interactive runs keep the previous choices; a fresh project ignores everything managed.
Deselect = remove. In interactive init, deselecting a detected editor offers to delete its openspec-pw products (one confirmation). Only tool-owned territory is touched — your own config entries and edited vendored agents stay. A shared .mcp.json entry is kept while another selected editor (Claude Code, CodeBuddy, MiniMax, Copilot) still reads that file. --tools and non-TTY runs never remove anything.
Editor territory: update only maintains editors already configured in the project; to add one, run openspec-pw init --tools <id>.
The block itself lists all 40 paths it covers (AI coding assistants, test artifacts and credentials, MCP config, other tools and runtime files, and the always-ignored rule files) — open .gitignore to see them. Editor roots are ignored whole, so your own files under them (e.g. .agents/skills/team-skill/) need git add -f. If the block cannot be written, a warning lists the uncovered paths. Ignore rules do not apply to already-tracked files: if credentials were committed before, run git rm --cached tests/playwright/credentials.yaml.
openspec-pw init picks an install mode from the frontend signal
(vite/next/nuxt/... config files > framework dependencies > dev script
keywords > monorepo workspace members):
- frontend mode (signal hit): the full Playwright scaffold — e2e
command, seed test,
BasePage, test plan,playwright.config.ts, auth setup, credentials, MCP gate, agents gate. - minimal mode (no signal, or no readable
package.json— e.g. Python/Go backends): only atests/README.mddescribing the acceptance-test contract (real requests against a real running service, framework of your choice) plus the employee-grade standards block. No Playwright scaffold, no e2e command, no MCP, no agents.
The Summary prints the mode and its basis (Mode: frontend (signal: vite.config.ts) / Mode: minimal (no frontend signal)), so a misjudgment
is visible on the spot. Detect blind spots (frontend in an untracked
subdirectory; vite.config.ts hosting only vitest) are covered by an
explicit override:
openspec-pw init --frontend # force the full scaffold despite no signal
openspec-pw init --no-frontend # force minimal mode despite a hitLater, --frontend (or a newly detected signal) adds the full scaffold incrementally and prunes the untouched tests/README.md; minimal projects stay supported by update, doctor, and remove.
init can scaffold E2E for a WeChat mini-program instead of a web app. The
target is a separate dimension from the install mode: a mini-program project
is always frontend mode.
Detection looks for project.config.json, a built mp-weixin output, @tarojs/* / @dcloudio/* dependencies, or a genuine app.json (with pages and a companion file); override with --miniprogram / --no-miniprogram. After generation, update / remove / doctor follow the generated artifacts (wxa-test.ts or wxaProject) instead of re-detecting, and re-running init --miniprogram over a web scaffold stops with a migration instruction instead of a half-converted project.
The scaffold uses the official @open-wxa/wxa-runner-playwright fixture: the wxa-test.ts wrapper, wxa.setup.ts (auth state lives here — no auth.setup.ts or credentials.yaml), a Chrome-channel playwright.config.ts, and a seed test. Dependencies: @playwright/test@^1.65, @open-wxa/wxa-runner-{playwright,core}@^0.13, wxa-runner@^0.13, and Chrome (npx playwright install chrome). Generated CI installs Chrome and runs the app build (build:weapp for Taro, build:mp-weixin for uni-app) before the tests.
Limitations: tests run in headless Chrome, not WeChat DevTools. DevTools-only
APIs (real login, payment, native components) are outside the harness. CI
support targets x86-64 Linux; there is no WebKit or Firefox project. Taro
projects resolve and build, but Taro's own runtime may fail to initialize in
the browser runner (没有找到页面实例); run the seed first and treat a
failing seed as that app being unsupported, not as a reason to write specs.
opt-in --agents — what gets vendored and how updates treat it
openspec-pw init --tools claude --agents # additionally install the official planner agent--agents (off by default) vendors one byte-identical snapshot of Playwright's official init-agents output into .claude/agents/: playwright-test-planner.md, which explores the app and drafts the test plan (delegable for context isolation). The official generator and healer agents are deliberately not installed — generation runs inside the pipeline, and the official healer edits assertions to force green, the opposite of the honest-failure exit the Healer step keeps.
Ownership is content-based: unmodified snapshots are refreshed by update and removed by remove, edited copies are never overwritten or deleted, and doctor warns (non-blocking) when their playwright-test MCP entry is missing. Init asks once (default No); minimal-mode projects skip agents along with MCP.
Running
npx playwright init-agentsyourself is clobber-type: it rewrites.mcp.jsonwholesale (your own entries are destroyed) and creates a parallelopencode.json. Run it beforeopenspec-pw initwith your editor's--loop(claude,opencode,codex,copilot,vscode; omitting it writes the Copilot set) if you must, and checkgit diff .mcp.json. With--agentsyou don't need it.
openspec-pw -v # Print version (also -V / --version)
openspec-pw init # Initialize integration (--tools all|none|ids… to select editors; --agents adds the official agents; --frontend/--no-frontend force the install mode; --miniprogram/--no-miniprogram select the mini-program target; --rule-files/--no-rule-files toggle per-editor rules copies; --lint-config generates/extends ESLint and ruff config for the swallow-error checklist; --hook[=static|full] installs a Claude Code Stop hook; --auto-pipeline generates the headless CI workflow; --lang zh|en selects the employee-standards language; --standards general|ml selects the standards profile)
openspec-pw update # Update CLI and commands to latest version (--lang zh|en and --standards general|ml switch an installed standards block)
openspec-pw doctor # Check prerequisites (Node, Playwright, OpenSpec, config, tests) + app server diagnostics
openspec-pw install --claude # Install or verify Claude Code via the official native installer (default: print only; --run executes; --verify checks)
openspec-pw audit # Audit tests for orphaned specs and issues (--gate exits 1 when any issue is found)
openspec-pw coverage # Analyze spec–test coverage for changes (--fail-under <pct> exits 1 below it; --plan <file> exits 1 unless every delta-spec scenario appears in that plan)
openspec-pw flake # Detect flake patterns in test files (static patterns + raised timeouts)
openspec-pw gate [change] # Run every quality check and exit 0 / 1 / 2 (pass / fail / cannot decide; --repeat N reruns failed E2E tests to classify flaky vs real)
openspec-pw migrate # Migrate old test files to new structure
openspec-pw explore # Explore app routes with Playwright (--file <path> selects app-exploration.md)
openspec-pw remove # Remove integration (--all scans home + Windows drives; asks before removing on a TTY, --yes skips)install --claude prints the official native installer command (--run executes it, --verify checks an existing install, --channel stable|latest, --version x.y.z). It uses official Anthropic channels only — no mirrors, proxies, or region workarounds.
remove deletes only tool-owned artifacts (editor commands, MCP entries, rules blocks, the managed .gitignore block, hooks, the schema, the lint checklist, vendored agents) plus template files still byte-identical to the bundled copies. Your own files, tests/**, credentials.yaml, and openspec/specs are never touched; edited tool files are kept with a notice; paths that resolve outside the project through a symlink are skipped.
remove --all scans your home directory (every drive root on Windows) for projects holding any of those artifacts. It lists the plan first: on a TTY it asks once before deleting, --yes skips the question, and non-TTY runs only print the plan. --root <dir> (repeatable) replaces the scan roots. One project's failure never stops the rest; the run ends with removed N / skipped M / failed K and a non-zero exit when anything failed.
openspec-pw gate runs validate → lint → typecheck → test → flake → e2e, stops at the first failure unless --keep-going, and exits 0 / 1 / 2 (pass / fail / cannot decide). It also fails a change that declares scenarios but has no E2E tests, and any newly added test.fixme(; edits to lint/TS/Playwright configs and raised timeouts are reported under flags, not failed.
Runtime flake evidence. gate --repeat <N> reruns only the E2E tests that failed on the first run (--retries=N). Tests that pass at least once are listed as flaky and do not fail the gate unless --strict-flake is given. Playwright artifacts land in tmp/gate-flake-*. --hook cannot be combined with --repeat.
Stop hook. init --hook installs a Claude Code Stop hook that runs gate --hook: static (default) or full (adds flake and e2e — use it only once the change's E2E tests exist). A red gate exits 2, so the agent keeps working instead of claiming done. --no-hook or remove takes it out; your own hooks are untouched.
Autonomous pipeline. init --auto-pipeline writes .github/workflows/openspec-auto.yml once and never overwrites it. Every pull request runs gate only — mark that job a required status check — while an openspec:auto label or manual dispatch starts the headless agent (apply → static gate → generate E2E → full gate) and opens the PR. Required secret: ANTHROPIC_API_KEY; authenticated apps also need E2E_USERNAME / E2E_PASSWORD secrets and the E2E_AUTH_* variables. Stages run cheapest-first; apply is judged by openspec list --json task counts, and the final verify pass is advisory. Because CI checks out the repository, openspec/ must stay committed in pipeline projects.
Every test the Generator writes carries a spec anchor — one comment line above each test():
// spec: coupon#优惠券七天后过期
test('coupon expires after 7 days', async ({ page }) => { ... });The anchor's <capability>#<requirement> uses the requirement's exact title text from the delta spec (no slug conversion), so openspec-pw audit can check it against the live main spec. The audit flags a requirement that no longer exists (retire candidate), a change name used as the capability (generator slip — fix the anchor), and a missing capability directory (likely rename); anchor-free tests are listed as info, and test.fixme tests are skipped. Audit is report-only — it never deletes or edits tests.
Workflow tree — 10 steps from change selection to per-change report
/openspec-e2e <change-name> # Codex `$openspec-e2e`, Kimi `/skill:openspec-e2e`
/openspec-e2e <change-name> --auto # headless — no human checkpoint (see Autonomous pipeline)
│
├── 1. Select change → read openspec/changes/<name>/specs/
│
├── 2. Detect auth → check specs for login/auth markers
│
├── 3. Validate env → run seed.spec.ts
│
├── 4. Explore app → browser exploration (Playwright MCP / `openspec-pw explore`)
│ └─ Write app-exploration.md; extract shared patterns → app-knowledge.md
│
├── 5. Planner → generates test-plan.md
│
├── 6. Generator → creates tests/playwright/changes/<name>/<name>.spec.ts
│
├── 7. Configure auth → auth.setup.ts (if required)
│
├── 8. Configure playwright → playwright.config.ts
│
├── 9. Execute tests → npx playwright test (Healer repairs failures via MCP)
│
└── 10. Report → openspec/reports/playwright-e2e-<name>-<timestamp>.md
The numbered steps are the same on OpenSpec 1.x; only the command name changes (see the naming note).
Required:
- Node.js >= 22
- One or more supported editors — see the Supported AI Coding Assistants table. Pi, Oh My Pi, MiniMax Code, DeepSeek Harness, Gemini CLI, Qwen Code, GitHub Copilot, Roo Code, Codex and Kimi Code are also detected via their global config dirs (
~/.pi/agent/,~/.omp/agent/,~/.minimax-code/,~/.dsh/,~/.gemini/,~/.qwen/,~/.copilot/,~/.roo/,~/.codex/,~/.kimi-code/). - OpenSpec initialized — see Setup (1.x is supported too: install
@1and run plainopenspec init) - Playwright MCP (for test execution + Healer) — installed automatically by
openspec-pw initwhen a frontend signal is detected (skipped for API-only projects — API tests use therequestfixture), project-scoped (written to the editor's project file from the table above, never your global config):playwright-test— the officialplaywright init-agentstest-runner server:{ "command": "npx", "args": ["playwright", "run-test-mcp-server"] }undermcpServers(Claude Code:claude mcp add --scope project→ project-root.mcp.json;opencode.jsoncnests it undermcp). CodeBuddy and MiniMax Code are written directly, never through their CLIs — CodeBuddy'smcpCLI starts a port-bound service that conflicts with running sessions.- Pi and DeepSeek Harness have no project-level MCP client; browser exploration uses
openspec-pw exploreinstead.
OpenSpec 1.x and 2.x supported: naming follows the installed major (see the naming note).
openspec-pw doctoraccepts both; 3.x is rejected.
Project-scoped servers prompt for approval the first time they are used interactively (
claude mcp reset-project-choicesresets those choices).
Server name
playwright-test: this is the server Playwright's ownplaywright init-agentsships (samenpx playwright run-test-mcp-servertransport). It is not@playwright/mcp(a separate package registering asplaywrightwith ~67browser_*tools) — the test-runner is its superset, adding the structuredtest_run/test_debug/test_listtools the Healer loop uses. The two coexist; searching "Playwright MCP" usually surfaces@playwright/mcpdocs.
- Detects supported editors in the project — project markers, or the global config dirs listed under Prerequisites — and picks up the editors already configured by openspec-pw (see Selecting Editors on Init)
- Installs the E2E command or skill for each selected editor (paths in the Supported AI Coding Assistants table)
- Generates
tests/playwright/seed.spec.ts,auth.setup.ts,credentials.yaml,app-knowledge.md,test-plan.template.md,pages/BasePage.ts, plus the project-rootlint-guidelines.mdswallow-error and docstring lint checklist (refreshed byupdatewhile unmodified, removed byremove)
--lint-config(opt-in): creates a minimaleslint.config.mjs(eslint 9+ projects with no config anywhere up to the git root) and extends the ruff config with a managedextend-select = ["B904"]block. Existing configs are never edited — a paste-ready snippet is printed instead.
- Generates
playwright.config.tswith automatic dev script and port detection (Vite/Next/Nuxt/Astro,.env, and--port) - Picks the install mode from the frontend signal (see Init Modes); with none found, prints guidance in the Summary — run
openspec-pw initin the app directory (monorepo), or use Playwright'srequestfixture for API-only projects - Installs the employee-grade standards block into
AGENTS.md(plus each selected editor's rules copy) in the chosen language and profile —--lang zh|en,--standards general|ml; on a TTY init asks for the profile once, pre-selecting what is already installed
openspec-pw doctor verifies prerequisites and exits non-zero if any required check fails.
| Category | Required checks | Optional checks |
|---|---|---|
| Node.js | node version |
engines compatibility |
| npm | npm availability |
— |
| Playwright Config | config file exists (ts/js/mjs/mts) |
— |
| OpenSpec | directory initialized, CLI major 1 or 2 | .spec.md count |
| Playwright Browsers | CLI version, Chromium downloaded | — |
| Playwright Test | @playwright/test installed |
— |
| Mini Program | Chrome, wxa fixture, @playwright/test >=1.64, wxaProject output |
— |
| Playwright MCP | server configured for each configured editor | playwright-cli on PATH |
| Cursor E2E | command + skill files when Cursor is configured | hint pointing at init --tools cursor |
| Vendored Agents | — | snapshots' presence and ownership |
| Sync | standards in sync when initialized | not initialized |
| Tests | tests/playwright/ exists |
auth.setup.ts presence, storageState file present |
| Seed Test | — | seed.spec.ts presence |
| Lint | — | swallow-error checklist coverage (semantic check when the linter can resolve its config, text probe otherwise) |
| App Server | — | dev script, base URL, reachability |
| CodeGraph | — | CLI availability, index presence, MCP installation |
Run with --json for machine-readable output.
Priority chain and existing-config handling
Generated playwright.config.ts automatically detects the app URL in this priority order:
BASE_URLenvironment variable- environment variables:
PLAYWRIGHT_PORT,E2E_PORT,VITE_PORT,PORT - port flags in
package.jsonscripts, e.g.vite --port 5125 vite.config.*server.port.env.local,.env.development,.env(same env var names)- framework defaults: Vite
5173, Astro4321, Next/Nuxt3000 seed.spec.tsBASE_URLconstant- fallback:
http://localhost:3000
Run openspec-pw doctor to see the detected dev script and base URL. If your project already has playwright.config.ts, init will not overwrite it — it prints patch hints for missing webServer, testDir, storageState, and setup-project wiring.
If your app requires login, set up credentials once, then all tests run authenticated automatically.
Credentials are ignored automatically by the managed
.gitignoreblock (see Managed.gitignorepaths). Ignore rules do not apply to already-tracked files: if credentials were committed before, rungit rm --cached tests/playwright/credentials.yaml. Alternatively keep them in theE2E_USERNAME/E2E_PASSWORDenv vars.
# 1. (Optional) Edit test users for role-based tests
vim tests/playwright/credentials.yaml
# 2. Enable auth and set environment variables
export E2E_AUTH_REQUIRED=true # without it auth.setup.ts is skipped
export E2E_AUTH_METHOD=api # or ui
export E2E_AUTH_API=/api/auth/login # optional; this is the default
export E2E_USERNAME=your-email@example.com
export E2E_PASSWORD=your-password
# 3. Record login (one-time; UI login opens the browser)
npx playwright test --project=setup
# 4. All subsequent tests use the saved session
/openspec-e2e my-featureSupports API login (preferred, cookie-based) and UI login (fallback, for token/localStorage auth). For multi-user tests (admin vs user), add multiple users in credentials.yaml and run /openspec-e2e (Codex $openspec-e2e, Kimi /skill:openspec-e2e) — it reads role labels from specs and users from credentials.yaml, then generates one setup per role. Each setup reads E2E_<ROLE>_USERNAME and E2E_<ROLE>_PASSWORD (role name uppercased; non-alphanumeric characters become _).
Edit tests/playwright/seed.spec.ts to match your app's:
- Base URL
- Common selectors
- Page object methods
Edit tests/playwright/credentials.yaml:
- Add one entry per role for role-based tests
Auth variables are shown in the quick start above; E2E_AUTH_CHECK_PATH optionally asserts a path after login, before the session is saved.
In CI, set the E2E_AUTH_* values as repository variables; the workflow passes them to the test step. For multi-user CI, add the per-role credential pairs as secrets and forward them in the workflow env — the shipped workflow forwards only E2E_USERNAME / E2E_PASSWORD.
Standards delivery and coexistence
Employee-grade standards live in AGENTS.md as the single source of truth; the hook column in the Supported table is how each editor reaches it. Claude Code needs CLAUDE.md to import it with @AGENTS.md (it does not read AGENTS.md by default): the @ line may sit anywhere outside backticks/code blocks, and outside the OPENSPEC-PW markers. CodeBuddy prefers CODEBUDDY.md when both exist.
Per-editor rules copies. AGENTS.md is the only mandatory rules file; the wrapper and per-editor rules files are convenience copies. init --no-rule-files installs AGENTS.md and removes those copies (unless they hold user content outside the block); init --rule-files restores them. The choice is recorded on the managed .gitignore block's skip line and honored by later runs.
Standards profiles. Two bodies ship per language: general (§0–§7 — code quality, tooling, large tasks, anti-fabrication, temp files, testing, resource bounds) for frontend, backend, and general codebases, and ml (ML-first — evaluation integrity, data boundaries, training budgets, reproducibility, dependencies, artifacts, reporting, baseline safety) for training and experiment work. The installed block itself is the only persisted signal: its profile is detected from a section heading, so update and doctor follow whatever was installed unless --standards overrides it.
Coexisting with the official
@fission-ai/openspecCLI: itsopenspec updatedeletes root AGENTS.md/CLAUDE.md blocks wrapped in plainOPENSPEC:START/ENDmarkers. openspec-pw uses the exclusiveOPENSPEC-PW:namespace, which that matcher cannot see; if a block was already wiped,openspec-pw initrestores it.
MIT