Search by

rakibhossainporosh / laravel-codepulse

rakibhossainporosh

AI-Powered Code & Security Review Engine for Laravel using Google Gemini BYOK

Package info

github.com/rakibhossainporosh/laravel-codepulse

pkg:composer/rakibhossainporosh/laravel-codepulse

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-22 15:58 UTC

This package is auto-updated.

Last update: 2026-11-22 16:38:06 UTC


README

Run Tests Latest Version on Packagist Total Downloads License

CodePulse AI is an automated code quality, security vulnerability, and performance auditing package for Laravel applications powered by Google Gemini BYOK (Bring Your Own Key).

Key Highlights

  • Terminal Audit Command: Scan files, controllers, or staged Git changes right from your terminal with php artisan codepulse:check --staged.
  • Automated Git Pre-Commit Hook: Install a Git pre-commit quality gate with php artisan codepulse:hook --install to prevent critical vulnerabilities from ever being committed.
  • Drop-in Web Dashboard: Interactive, zero-dependency dashboard accessible at /codepulse with dark/light themes, drag-and-drop file upload, and real-time status polling.
  • Line-by-Line Code Inspector: View line-highlighted syntax, detailed vulnerability findings, and 1-click "Copy Fix" buttons.
  • Markdown Export: Copy or download detailed audit reports in standard Markdown (.md) format.
  • BYOK Architecture: Zero monthly fees; runs directly on your Google Gemini quota.
  • Automatic Model Fallback: Automatically falls back from gemini-3.8-flash to gemini-3.5-flash-lite on rate limits (HTTP 429) or service outages (HTTP 503).
  • CI/CD Ready: Returns exit code 1 when critical security issues or severe bottlenecks are detected.

Installation

Install the package via Composer:

composer require rakibhossainporosh/laravel-codepulse --dev

Run the interactive install command:

php artisan codepulse:install

This will publish config/codepulse.php and run the required database migrations.

Configuration

Obtain a Gemini API key from Google AI Studio and add it to your .env file:

CODEPULSE_GEMINI_KEY=AQ.your_gemini_api_key_here
CODEPULSE_PATH=codepulse
CODEPULSE_DEFAULT_MODEL=gemini-3.8-flash

Usage

1. Terminal Code Auditing

Audit staged Git changes before committing:

php artisan codepulse:check --staged

Audit a specific controller or directory:

php artisan codepulse:check app/Http/Controllers/OrderController.php

2. Git Pre-Commit Quality Gate

Automatically audit staged files before every git commit:

# Install Git pre-commit hook
php artisan codepulse:hook --install

# Remove Git pre-commit hook
php artisan codepulse:hook --remove

3. Web Dashboard

Navigate to /codepulse in your browser.

In local and testing environments, the dashboard is open automatically. In production, protect access via Gate::define('viewCodePulse', ...) in your AppServiceProvider.

4. Programmatic Inspection via Facade

use CodePulse\Facades\CodePulse;

$result = CodePulse::review($sourceCode, language: 'PHP');
$scores = $result['scores'];
$findings = $result['findings'];

Testing

vendor/bin/phpunit

License

This package is open-sourced software licensed under the MIT license.