Skip to main content

🔥 KernHell

"The Heart of Your System Where Innovation Meets Precision"

AI-Powered Autonomous Self-Healing Testing Engine & CLI tool for Playwright.

Python 3.11+ Next.js 14 License: MIT CI/CD Status TypeScript & Python


⚡ The Problem

Modern frontend engineering moves fast. When developers refactor classes, IDs, or DOM wrappers (e.g., #buy-now becomes #purchase-btn), automated Playwright and Selenium test suites fail even though the business functionality works seamlessly. QA teams waste 30–40% of their time manually maintaining broken selectors.

KernHell autonomously resolves broken selectors in real-time across both Python and TypeScript/JavaScript test suites, preserving 100% of your code formatting, comments, and QA sanity.


🏛️ Autonomous 6-Stage Healing Architecture

flowchart TD
    A[Playwright Locator Timeout] -->|1. Intercept| B(Scanner & Live DOM Capture)
    B -->|2. Prune| C(Selectolax Lexbor HTML5 Pruner)
    C -->|85% Token Reduction| D{3. Dense Vector Cache}
    D -->|Cache Hit <5ms| G[Strict DOM Verification]
    D -->|Cache Miss| E[4. AI Brain: LiteLLM Gateway]
    E -->|Intent Diagnosis| F{RENAME vs MISSING?}
    F -->|MISSING: Real Bug| H[Anti-Hallucination Guardrail: Abort Healing]
    F -->|RENAME: Safe Refactor| G
    G -->|5. Verify Unambiguous Element| I[Selector Fix: role / data-testid / text]
    I -->|Store Embedding| D
    I -->|6. Surgical Patch| J[Surgical CST & Line Patcher]
    J -->|Preserve Comments & Formatting| K[Automatic Verification Runner]
    K -->|Pass| L[Commit Fix & Log Run]
    K -->|Fail| M[Immediate Rollback from .kernhell.bak]

🚀 Key Features

  • Multi-Language Playwright Support: Seamlessly heals both Python (pytest-playwright) and TypeScript / JavaScript (@playwright/test) test suites with zero configuration.
  • Failure Interception & Live DOM Capture (Scanner): Intercepts Playwright selector timeouts and crashes, capturing the error stack trace, line number, broken selector, and live DOM snapshot (page.content()).
  • High-Speed Semantic DOM Pruning (DOMPruner): Strips scripts, styles, SVGs, base64 data, and non-semantic wrappers using selectolax to slash token usage by 80–90% while keeping semantic landmarks and accessibility roles.
  • Semantic Vector Memory (Vector Cache): 384-dimensional dense cosine index matching broken selectors against historical fixes. Resolves recurring failures in <5ms with zero LLM API cost.
  • Strict Anti-Hallucination Guardrails: Distinguishes between renamed selectors (RENAME) and genuine missing features (MISSING) to prevent false-positive heals on actual product regressions.
  • Surgical Code Patching (Patcher): Surgically transforms only the target locator expression in the AST / file without reformatting unrelated code or stripping inline comments (supports Python LibCST & TypeScript line targeting).
  • Automated Verification & Zero-Risk Rollback (Verifier): Re-runs the patched test in a sandbox (via pytest or npx playwright test); if it fails, immediately restores the code from .kernhell.bak.
  • Mission Control Dashboard (Next.js App Router): High-tech, dark-mode glassmorphic web dashboard providing live stats, real-time healing stream, semantic memory inspector, and interactive simulation playground.

📦 Installation

Quick Install (from PyPI)

pip install kernhell

That's it! Now run kernhell --help to get started.

With Optional Dependencies

# Install with dashboard support
pip install kernhell[dashboard]

# Install everything (dev + dashboard)
pip install kernhell[all]

🔧 Developer Setup (Contributing)

# Clone the repository
git clone https://github.com/riteshkumar072/KernHell.git
cd KernHell

# Install in editable mode with all dev dependencies
pip install -e ".[all]"

# Install Mission Control dashboard dependencies
cd dashboard
npm install
cd ..

🛠️ CLI Usage

Usage: kernhell [OPTIONS] COMMAND [ARGS]...

┌─ Commands ──────────────────────────────────────────────────────────────────┐
│ scan       Scan a test file to detect broken selectors and capture DOM      │
│            snapshots.                                                       │
│ heal       Autonomously heal broken Playwright selectors in a test file.    │
│ dashboard  Launch the KernHell Mission Control Dashboard and REST API.      │
│ ui         Alias for 'dashboard' command.                                   │
│ cache      Inspect, query, and manage KernHell's Semantic Vector Cache.     │
│ config     View and configure KernHell engine parameters.                   │
└─────────────────────────────────────────────────────────────────────────────┘

1. Scan a Test File for Broken Selectors

kernhell scan tests/test_checkout.py

2. Autonomously Heal a Test File or Suite

# Preview changes without modifying code (dry run)
kernhell heal tests/test_checkout.py --dry-run

# Surgically patch and verify fix with automatic backup
kernhell heal tests/test_checkout.py

# Batch heal all test files in a folder
kernhell heal tests/

# Export machine-readable report for CI/CD pipelines
kernhell heal tests/ --output json

3. Launch the Mission Control Dashboard

# Start FastAPI REST API and open dashboard in browser
kernhell dashboard

# Or run Next.js frontend directly:
cd dashboard
npm run dev

Visit http://localhost:3000 to view the live dashboard and interactive playground.

4. Semantic Vector Memory & Cache

# List all verified cached selector mappings
kernhell cache list

# View cache hit/miss ratio and efficiency metrics
kernhell cache stats

# Purge semantic memory
kernhell cache clear

5. Engine Configuration

# Display active settings
kernhell config show

# Run the interactive configuration wizard
kernhell config init

🖥️ Mission Control Dashboard

The dashboard provides a production-grade operations center:

  • Overview (/): Real-time healing metrics (autonomous fixes, cache efficiency, real bugs guarded, dollar savings), live 6-stage pipeline status, and recent activity stream.
  • Interactive Playground (/playground): Test healer sandbox with pre-configured refactor scenarios and out-of-stock guardrail alerts.
  • Semantic Memory Explorer (/cache): Searchable browser for 384-dimensional dense vector embeddings with hit counts and verification badges.
  • Run History & Diffs (/history): Audit trail with side-by-side syntax-highlighted unified diffs of AST code patches.

🧪 Running the Test Suite

# Run all 59 unit and integration tests
python -m pytest -v

# Run with test coverage
python -m pytest tests/unit -v --cov=src/kernhell

🗺️ Execution Roadmap

  • Weekend 1: Foundation (Scanner, Pruner, Core Models & CLI)
  • Weekend 2: AI Brain (Analyzer, Healer, CST Surgical Patcher & Verifier)
  • Weekend 3: Semantic Memory (Vector Cache, Embedder, Batch Healing & CI Export)
  • Weekend 4: Mission Control Dashboard (Next.js & Production Release)

📄 License

MIT © 2026 Ritesh Kumar • KernHell Systems

Metadata

Release files for kernhell 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kernhell 0.1.3
File Size Uploaded Provenance
kernhell-0.1.3.tar.gz 45.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kernhell 0.1.3
File Interpreter ABI Platform
kernhell-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 107.2 kB

Release files / kernhell-0.1.3.tar.gz

Download URL kernhell-0.1.3.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
96b1ac954a28483d560fb10b6f38520d8bca9d8fd745bc4ab585b684d709a500
BLAKE2b-256 checksum
How to use checksums
72a53611c99844e3dca3c045a843838ffd6ccd574be60042847314eab40c9951
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / kernhell-0.1.3-py3-none-any.whl

Download URL kernhell-0.1.3-py3-none-any.whl
Size 61.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb0e639c5031705dd09ee6ca9bb57b6f863c069c7c4f2b2a8af3cb797831a5ce
BLAKE2b-256 checksum
How to use checksums
dd86f1e1209044ac66774046a14a374db94c6ed339c9be4312a9614a07f5056b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for kernhell 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page