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:
- Logic Analyst: Scans the code for logical errors, inefficient algorithms, and edge-case mishandlings.
- Security Auditor: Checks for vulnerabilities, insecure patterns, and potential exploits.
- Style Enforcer: Ensures the code conforms to standard JavaScript formatting and best practices.
- Report Compiler: Synthesizes the findings of the previous agents into a unified per-file report.
- Severity Router: Evaluates the compiled report and decides if the
Code Fixerneeds to intervene. - Code Fixer: (Conditional) Generates corrected code snippets to resolve critical issues found.
Prerequisites
- Python 3.11 or higher
- A Groq API Key or OpenAI API Key
Installation
-
Install via pip (recommended):
pip install nodeguard
Alternatively, install from source:
git clone https://github.com/fayeloja/nodeguard.git cd nodeguard pip install -e .
-
Set up environment variables: Create a
.envfile 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:
- Go to your repository settings on GitHub.
- Navigate to Secrets and variables > Actions.
- Add a new repository secret named
GROQ_API_KEYwith your Groq API key. - The workflow will automatically run on pushes to the
mainbranch or when manually triggered, uploading the generated HTML report as an artifact.
Metadata
Release files for nodeguard 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nodeguard-0.1.0.tar.gz | 23.7 kB | Without provenance | Details for nodeguard-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nodeguard-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nodeguard-0.1.0-py3-none-any.whl |
Total release size: 50.6 kB
Release files / nodeguard-0.1.0.tar.gz
| Download URL | nodeguard-0.1.0.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
940ee22b01b0e6d117d549aecb64205d0f0b54176053e593b8872bb61065f00a
|
|
BLAKE2b-256 checksum How to use checksums |
8e554876b8c50332cb4cf6a3ac742fb77b1a99900cbce23e1bdfb01f07a35186
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / nodeguard-0.1.0-py3-none-any.whl
| Download URL | nodeguard-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f16edc45f44001bcf173c7bc167a90d04dda1f19d7324df5b966585923a47fc
|
|
BLAKE2b-256 checksum How to use checksums |
fa9b9db6f3add33b4e198500a3d1b6c85da97a5749b552da9706c4ac474eaeba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for nodeguard 0.1.0
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.