npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

playwright-intelligence-engine

v2.3.3

Published

Enterprise-grade Playwright reliability, failure diagnosis, and intent-preserving test verification engine

Readme

Playwright Intelligence Engine (pw-intel)

Fast, verification-first failure diagnosis, autonomous self-healing, and intent-preserving test generation for Microsoft Playwright suites.

npm version License Node Playwright


1. Quick Start: Autonomous Self-Healing

When Playwright tests fail in your repository, heal them autonomously with a single command:

# 1. Dry run: diagnose traces and verify fixes in an isolated worktree (0 active changes)
npx pw-intel repair

# 2. Repair & Apply: verify passing in sandbox and apply fixes atomically to your workspace
npx pw-intel repair --apply

Verification Pipeline

Trace (.zip) ──> [Gate 0: Negative Controls] ──> [Tier 1: AST Fast-Path] ──> [Tier 2: Semantic LLM] ──> [Worktree Sandbox] ──> Active Workspace
  1. Gate 0: Fail-Closed Negative Controls
    • Detects backend crashes (HTTP 5xx), failing client APIs (HTTP 4xx), network disconnections, and DNS lookup errors.
    • If a test failed because the environment or service is down, PIE immediately abstains from modifying UI locators. Zero false heals.
  2. Tier 1: Deterministic AST Fast-Path ($0.00 Token Cost)
    • Operates 100% offline and locally at zero token cost.
    • Analyzes trace action snapshots against Page Object and test AST trees to substitute drifted locators in milliseconds.
  3. Tier 2: Semantic LLM Authoring (Adaptive Fallback)
    • Engaged only when DOM structure shifts significantly (e.g. Select2 comboboxes, nested modals, dynamic custom components).
  4. Headless Git Worktree Sandbox Proof
    • Every single fix is compiled and re-executed against headless Playwright in an isolated Git worktree using per-test title isolation (-g "^testTitle$") before touching your working tree.
  5. Strict Assertion Invariance
    • Assertions (expect(...)) are strictly immutable. PIE will never alter, weaken, or remove test assertions.

2. Installation & LLM Configuration

Run directly without installing via npx:

npx pw-intel --help

Or install in your project:

npm install --save-dev playwright-intelligence-engine

(Note: pw-intel is the primary executable. pie is also preserved as a convenient short alias).

Initialize PIE in your Playwright repository:

npx pw-intel init

Providing your LLM API Key (Optional)

Note: Trace diagnosis, Gate 0 negative control filtering, and Tier 1 AST test repairs run 100% offline and locally without an LLM key. An API key is only needed if you want Tier 2 complex semantic repairs or AI-assisted test generation (pw-intel qa).

You can configure an LLM key in any of three ways:

Option A: During init

npx pw-intel init --api-key sk-your-openai-or-deepseek-key --model gpt-4o

This automatically creates .env and adds it to your .gitignore.

Option B: Environment Variable

export OPENAI_API_KEY="sk-..."
# or
export PIE_LLM_API_KEY="sk-..."

Option C: In .env

Create .env in your project root:

PIE_LLM_API_KEY=sk-...
PIE_LLM_MODEL=gpt-4o
PIE_LLM_ENDPOINT=https://api.openai.com/v1/chat/completions

Verify your setup at any time:

npx pw-intel doctor

3. Core Capabilities

🔍 A. Diagnose a Failing Test

Ingest a Playwright trace archive (trace.zip) to pinpoint root causes without running repairs:

npx pw-intel diagnose ./test-results/trace.zip

Output example:

{
  "category": "LOCATOR_DRIFT",
  "confidence": 0.94,
  "action": "click",
  "failingSelector": "#checkout-btn-v1",
  "suggestedSelector": "button:has-text(\"Proceed to Checkout\")",
  "targetFile": "e2e/pages/CartPage.ts",
  "evidence": "Element ID changed dynamically; stable accessible role match found."
}

If the failure was caused by a backend crash (HTTP 500) or network disconnection, PIE flags it immediately as a Negative Control Trigger and abstains.


🚀 B. Evidence-Driven Test Generation (pw-intel qa)

Generate full end-to-end test suites and Page Objects conforming to your repository's exact conventions:

npx pw-intel qa "Checkout Flow" --url http://localhost:3000 --author hybrid --out-dir tests/e2e

Generation Modes:

  • Brownfield Exploration: Discovers existing Page Objects, fixtures, custom matchers, and auth states in your repository. Generates clean tests that reuse existing architecture without creating redundant login steps or duplicate Page Objects.
  • Greenfield Scaffolding: Sets up a complete Playwright testing architecture with Page Object Model patterns and clean fixture isolation from raw requirements.
  • Automated Verification & Falsification: Compiles generated TypeScript files and runs Playwright discovery to guarantee 0 syntax or type errors.

🧪 C. Live Diagnostic Reproduce

Rerun a flaky or intermittent test in a dedicated worktree with live DOM snapshots, network capture, and console stream telemetry:

npx pw-intel reproduce tests/checkout.spec.ts

📊 D. CI/CD Quality Gate & SARIF Reporting

Convert Playwright test results into GitHub Actions annotations, failure clusters, and SARIF security/flakiness reports:

npx pw-intel ci-report ./test-results/results.json --sarif-out ./pie-results.sarif

🔒 E. Enterprise Governance & Cryptographic CI Sign-Off

For regulated or compliance-heavy CI/CD pipelines where autonomous changes to source code require explicit multi-step sign-off:

# 1. Generate an isolated repair proposal and execute sandbox proof:
npx pw-intel repair ./test-results/trace.zip --execute

# 2. Inspect cryptographic proposal hash and sign off:
npx pw-intel approve <proposalId>

# 3. Promote the approved fix atomically to production:
npx pw-intel promote --token <approvalToken>

4. Cursor / Claude Code IDE Integration (MCP Server)

PIE includes a built-in Model Context Protocol (MCP) server so AI coding assistants can diagnose traces and fix tests directly inside your IDE.

For Cursor / Windsurf

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "playwright-intelligence": {
      "command": "npx",
      "args": ["-y", "playwright-intelligence-engine", "mcp"]
    }
  }
}

For Claude Desktop / Claude Code

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "pw-intel": {
      "command": "npx",
      "args": ["-y", "playwright-intelligence-engine", "mcp"]
    }
  }
}

Available MCP Tools:

  • diagnose_trace: Diagnoses Playwright traces and provides root causes.
  • repair_page_object: Stages isolated repairs with cryptographic approval tokens.
  • generate_playwright_test: Generates tests matching your repository's conventions.
  • ingest_playwright_report: Analyzes test run failures and flakiness.

First-Party Agent Skills Pack

For AI coding assistants that support Agent Skills (Cursor, Claude Code, Antigravity, Cline), PIE bundles 3 first-party skills in the skills/ directory:

  • pie-setup: Automated workspace readiness audit, diagnostic healthcheck (pw-intel doctor), and playwright.config.ts trace retention verification.
  • pie-self-heal: Autonomous end-to-end trace diagnosis and repair pipeline with Gate 0 negative control protection and isolated Git worktree proofs.
  • pie-stabilize: Flaky test auto-stabilizer. Scans specification files for arbitrary waitForTimeout calls and refactors them into deterministic event-driven awaits with multi-trial validation.

To use them in your AI assistant, copy the desired skill folder from node_modules/playwright-intelligence-engine/skills/ into your workspace's .agents/skills/ (or .cursor/skills/).


5. CLI Command Cheat Sheet

| Command | Usage | Description | | :--- | :--- | :--- | | repair | npx pw-intel repair [--apply] [--all] | Two-tier autonomous repair with worktree verification | | diagnose | npx pw-intel diagnose <trace.zip> | Ingests trace and outputs causal root cause | | doctor | npx pw-intel doctor | Verifies Node, Git, Playwright & LLM readiness | | init | npx pw-intel init [--api-key <k>] | Initializes .pie/config.json & optional LLM credentials | | stabilize | npx pw-intel stabilize <spec.ts> [--trials=3] [--apply] | Refactors flaky arbitrary sleeps (waitForTimeout) into event-driven awaits | | profile | npx pw-intel profile [dir] | Scans repository conventions, Page Objects, and preferred locators | | architect | npx pw-intel architect <feature> [--write] | Plans greenfield/brownfield Playwright architecture and typed fixtures | | qa | npx pw-intel qa <feature> --author hybrid | Evidence-driven 4-phase test generation (greenfield/brownfield) | | reproduce | npx pw-intel reproduce <spec.ts> | Reruns spec with live DOM and network capture | | ci-report | npx pw-intel ci-report <results.json> | Generates CI annotations and SARIF report | | repair (targeted) | npx pw-intel repair <trace.zip> --execute | Generates targeted proposal verified in isolated worktree | | approve | npx pw-intel approve <proposalId> | Authorizes cryptographic repair proposal | | promote | npx pw-intel promote --token <token> | Atomically applies authorized repair proposal to active workspace | | mcp | npx pw-intel mcp | Starts the Model Context Protocol stdio server |


6. Detailed Documentation


Community & Contributing

Contributions, feedback, and bug reports are warmly welcome! If Playwright Intelligence Engine saves you debugging time or helps stabilize your test suite, please consider giving it a ⭐ on GitHub.


License

Apache-2.0. See LICENSE for details.