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.1.tar.gz (25.6 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.1-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: console_patrol-0.1.1.tar.gz
  • Upload date:
  • Size: 25.6 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.1.tar.gz
Algorithm Hash digest
SHA256 676720a555addba58e87d1e1f8faef198c1a5609f541fb90607f678dc9c518bd
MD5 6290c3e1d93e6defc6353333a370de55
BLAKE2b-256 68283ac7652a8ed7ed3847ebe612ec368c9bdf1bd710a260f8f2288ed91a4b2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: console_patrol-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b09d8bc910ba9aebf8a1eb1cb2e732500646fae98d28489059a2a46b2b55a6a
MD5 9408b2f30423edb5abccc1ad82e1876d
BLAKE2b-256 ac4430ebb44c2b8b54cb7a3dbfed52bdcf75fbca05e13479fce9ff193a18ecbf

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