Skip to main content

AI-powered multi-agent code review for JavaScript/Node.js

Project description

NodeGuard

NodeGuard is an AI-powered code review and analysis pipeline built with LangGraph. It leverages LLMs (like Groq's llama-3.3-70b-versatile or OpenAI's gpt-4o-mini) to automatically inspect, audit, and provide automated fixes for JavaScript codebases. NodeGuard operates through a pipeline of specialized agents that analyze logic, security, style, and compile comprehensive HTML and Markdown reports.

Features

  • Multi-Agent Architecture: Uses distinct agents for reviewing different aspects of the codebase (Logic, Security, Style).
  • Automated Fixes: Conditionally invokes a code fixer agent if critical severity issues are identified.
  • GitHub Integration: Can scan an entire GitHub repository to evaluate all JavaScript files automatically.
  • Rich Reporting: Compiles repository-wide summaries, per-file Markdown reports, and an intuitive HTML dashboard.
  • CI/CD Ready: Includes a pre-configured GitHub Action (.github/workflows/nodeguard.yml) for seamless integration into your pull request or build pipeline.

Architecture

NodeGuard uses langgraph to create a directed graph of agents representing the code review lifecycle:

  1. Logic Analyst: Scans the code for logical errors, inefficient algorithms, and edge-case mishandlings.
  2. Security Auditor: Checks for vulnerabilities, insecure patterns, and potential exploits.
  3. Style Enforcer: Ensures the code conforms to standard JavaScript formatting and best practices.
  4. Report Compiler: Synthesizes the findings of the previous agents into a unified per-file report.
  5. Severity Router: Evaluates the compiled report and decides if the Code Fixer needs to intervene.
  6. Code Fixer: (Conditional) Generates corrected code snippets to resolve critical issues found.

Prerequisites

Installation

  1. Install via pip (recommended):

    pip install nodeguard
    

    Alternatively, install from source:

    git clone https://github.com/fayeloja/nodeguard.git
    cd nodeguard
    pip install -e .
    
  2. Set up environment variables: Create a .env file in the root directory and add your Groq API key:

    GROQ_API_KEY=your_groq_api_key_here
    

Usage

NodeGuard supports two main operational modes: Local File Mode and GitHub Repo Mode.

Local File Mode

To review a single JavaScript file on your local machine:

nodeguard path/to/your/file.js

The output report and any generated fixes will be saved in the reports/local/ directory.

GitHub Repo Mode

To review all JavaScript files in a public GitHub repository:

nodeguard https://github.com/username/repository

The outputs will be saved in the reports/<repository-name>/ directory, containing:

  • Individual Markdown reports for each analyzed file (*_review.md).
  • Fixed code files if applicable (*_fixed.js).
  • A repository-wide summary (_SUMMARY.md).
  • A comprehensive HTML dashboard (_REPORT.html).

CLI Options

NodeGuard comes with a robust CLI. You can use the --help flag for more information:

nodeguard --help

Key Flags:

  • --provider <groq|openai>: Select the LLM provider to use (default: groq).
  • --model <model_name>: Override the default model for the selected provider.
  • --output <dir>: Specify a custom directory for reports.
  • --verbose, -v: Enable detailed logging.

LLM Fallbacks: If you select the OpenAI provider but no OPENAI_API_KEY is found, NodeGuard will automatically attempt to fall back to Groq.

GitHub Actions Integration

NodeGuard can run automatically in your CI/CD pipeline using the included GitHub workflow.

To enable it:

  1. Go to your repository settings on GitHub.
  2. Navigate to Secrets and variables > Actions.
  3. Add a new repository secret named GROQ_API_KEY with your Groq API key.
  4. The workflow will automatically run on pushes to the main branch or when manually triggered, uploading the generated HTML report as an artifact.

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

nodeguard-0.1.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

nodeguard-0.1.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nodeguard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 940ee22b01b0e6d117d549aecb64205d0f0b54176053e593b8872bb61065f00a
MD5 df33d22d700559314b9c3c4d51c851bb
BLAKE2b-256 8e554876b8c50332cb4cf6a3ac742fb77b1a99900cbce23e1bdfb01f07a35186

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nodeguard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f16edc45f44001bcf173c7bc167a90d04dda1f19d7324df5b966585923a47fc
MD5 c900e6099c635734586492c8b0eddd8d
BLAKE2b-256 fa9b9db6f3add33b4e198500a3d1b6c85da97a5749b552da9706c4ac474eaeba

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