Skip to main content

AI-First Console Error & Warning Detector for Web Applications

Project description

ConsolePatrol

AI-First Console Error & Warning Detector for Web Applications

PyPI License: MIT

ConsolePatrol is an intelligent console monitoring tool designed for AI agents and developers to automatically detect console errors and warnings across entire web applications. It supports multiple UI frameworks (Ant Design, Element UI, React, Vue, etc.) and provides structured reports with actionable insights.

Features

  • ๐ŸŒ Auto-Discovery โ€” Scans project routes/pages automatically without manual configuration
  • ๐ŸŽฏ Framework-Aware โ€” Recognizes UI frameworks and applies targeted detection rules
  • ๐Ÿ“Š Severity Levels โ€” P0 (Fatal) / P1 (Warning) / P2 (Hint) classification
  • ๐Ÿ“‹ Dual Output โ€” JSON (for AI agents) + Markdown (for humans)
  • ๐Ÿ”„ Diff Mode โ€” Compare results with previous runs to track changes
  • โš™๏ธ Extensible Rules โ€” Easy to add custom detection patterns
  • ๐Ÿ–ผ๏ธ Screenshot Capture โ€” Auto-screenshot on critical errors

Installation

pip install console-patrol

Or from source:

git clone https://github.com/zhzgao/console-patrol.git
cd console-patrol
pip install -e .

Quick Start

# Scan a running web app
console-patrol scan http://localhost:3000

# With auto-discovery of routes (React Router example)
console-patrol scan http://localhost:3000 --router-type react

# Full options
console-patrol scan http://localhost:3000 \
  --router-type react \
  --base-path /admin \
  --output report.json \
  --format markdown \
  --screenshot \
  --severity P1

Architecture

console-patrol/
โ”œโ”€โ”€ src/console_patrol/
โ”‚   โ”œโ”€โ”€ cli.py          # CLI entry point
โ”‚   โ”œโ”€โ”€ crawler.py      # Page navigation & route discovery
โ”‚   โ”œโ”€โ”€ detector.py     # Console message interception
โ”‚   โ”œโ”€โ”€ framework.py    # Framework auto-detection
โ”‚   โ”œโ”€โ”€ reporter.py     # JSON / Markdown output
โ”‚   โ””โ”€โ”€ rules/          # Detection rule engine
โ”‚       โ”œโ”€โ”€ base.py
โ”‚       โ”œโ”€โ”€ antd.py     # Ant Design rules
โ”‚       โ”œโ”€โ”€ react.py    # React rules
โ”‚       โ””โ”€โ”€ element.py  # Element UI rules
โ””โ”€โ”€ tests/

Detection Rules

Severity Levels

Level Meaning Action
P0 Fatal (JS exception, crash) Immediate fix required
P1 Warning (framework issues) Fix before release
P2 Hint (code smell, anti-pattern) Consider fixing

Built-in Rules

Ant Design

  • antd-useForm-unhooked โ€” form.getFieldValue() called outside form context
  • antd-modal-context โ€” Static modal methods in React 18+
  • antd-tree-missing-keys โ€” Tree component missing required keys

React

  • react-strict-mode-double-mount โ€” Potential StrictMode side effects
  • react-hook-rules โ€” Hook usage violations

Element UI

  • element-form-validate โ€” Form validation issues

For AI Agents

ConsolePatrol is designed to be agent-friendly:

from console_patrol import ConsolePatrol

result = ConsolePatrol.scan(
    url="http://localhost:3000",
    router_type="react",
    wait_time=2.0,
)

# Structured output
for issue in result.issues:
    if issue.severity == "P0":
        print(f"[{issue.severity}] {issue.rule_id}")
        print(f"  File: {issue.location}")
        print(f"  Fix: {issue.suggestion}")

License

MIT ยฉ zhzgao

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

console_patrol-0.1.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

console_patrol-0.1.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file console_patrol-0.1.0.tar.gz.

File metadata

  • Download URL: console_patrol-0.1.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for console_patrol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 44e2ef9daffc643fdfdcf62216b90389e2b1378f3037e93c4cfde3f426ce6ad2
MD5 1feaa3e54635379565a1b6121e2506cf
BLAKE2b-256 e90e103fa10b8290667fdcc27d231324ed802222cb184da4c481f0b1d3506596

See more details on using hashes here.

File details

Details for the file console_patrol-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: console_patrol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for console_patrol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe6c0c7806990a4c535e78c35c142ef1e30d5edc629243dfb9b1bf4ee07793b7
MD5 158ef00b108404d7c2084a9ac88bc739
BLAKE2b-256 ec4c6e8c56d62b2776dbf22a91bc7a2934ef2b6da403eeb9e9c34f612fae634e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page