PHPackages                             romegasoftware/laravel-autopilot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. romegasoftware/laravel-autopilot

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

romegasoftware/laravel-autopilot
================================

Semi-autonomous error resolution for local development

0244↓77.8%PHP

Since Mar 21Pushed 3mo agoCompare

[ Source](https://github.com/romegasoftware/laravel-autopilot)[ Packagist](https://packagist.org/packages/romegasoftware/laravel-autopilot)[ RSS](/packages/romegasoftware-laravel-autopilot/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel Autopilot
=================

[](#laravel-autopilot)

Semi-autonomous error resolution for local development. Autopilot monitors Laravel logs and frontend errors, then dispatches Claude CLI agents to fix issues while you keep testing.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 12+
- Claude CLI available in `PATH`

Installation
------------

[](#installation)

```
composer require romegasoftware/laravel-autopilot --dev
```

Enable in your `.env`:

```
AUTOPILOT_ENABLED=true
VITE_AUTOPILOT_ENABLED=true

```

Publish the config (optional):

```
php artisan vendor:publish --tag=autopilot-config
```

Usage
-----

[](#usage)

Run the watcher standalone:

```
php artisan autopilot:watch
```

Or integrate into your dev script:

```
{
    "scripts": {
        "dev": [
            "Composer\\Config::disableProcessTimeout",
            "npx concurrently -c \"#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"npm run dev\" \"php artisan autopilot:watch\" --names=server,vite,autopilot"
        ]
    }
}
```

Frontend Integration
--------------------

[](#frontend-integration)

Autopilot captures frontend errors via a small client library. The package provides TypeScript modules you import directly.

### 1. Initialize the Client

[](#1-initialize-the-client)

In your main entry file (e.g., `resources/js/app.tsx`):

```
const shouldEnableAutopilot =
    import.meta.env.DEV && import.meta.env.VITE_AUTOPILOT_ENABLED === 'true';

if (shouldEnableAutopilot) {
    import('laravel-autopilot/autopilot-client').then(({ initAutopilot }) => {
        initAutopilot();
    });
}
```

### 2. React Error Boundary

[](#2-react-error-boundary)

Wrap your app in the error boundary to capture React component errors:

```
import { AutopilotErrorBoundary } from 'laravel-autopilot/AutopilotErrorBoundary';

const shouldEnableAutopilot =
    import.meta.env.DEV && import.meta.env.VITE_AUTOPILOT_ENABLED === 'true';

// Passthrough component when autopilot is disabled
const Passthrough = ({ children }: { children: ReactNode }) => {children};
const AutopilotBoundary = shouldEnableAutopilot ? AutopilotErrorBoundary : Passthrough;

createInertiaApp({
    setup({ el, App, props }) {
        createRoot(el).render(

        );
    },
});
```

Custom fallback UI:

```

```

### 3. Axios Interceptor (422 Validation Errors)

[](#3-axios-interceptor-422-validation-errors)

Install the interceptor on your Axios instance to capture validation errors:

```
// resources/js/bootstrap.js
import axios from 'axios';

window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

if (import.meta.env.DEV && import.meta.env.VITE_AUTOPILOT_ENABLED === 'true') {
    import('laravel-autopilot/axios-interceptor').then(({ installAutopilotInterceptor }) => {
        installAutopilotInterceptor(window.axios);
    });
}
```

### 4. Manual Error Reporting

[](#4-manual-error-reporting)

Report errors manually when needed:

```
import { reportError } from 'laravel-autopilot/autopilot-client';

try {
    await riskyOperation();
} catch (error) {
    reportError('Custom operation failed', {
        stack: error.stack,
        url: window.location.href,
    });
}
```

### 5. Vite Configuration

[](#5-vite-configuration)

Add the package alias to your `vite.config.ts`:

```
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/js/app.tsx'],
            refresh: true,
        }),
    ],
    resolve: {
        alias: {
            'laravel-autopilot': '/vendor/romegasoftware/laravel-autopilot/resources/js',
        },
    },
});
```

Configuration
-------------

[](#configuration)

Full configuration options in `config/autopilot.php`:

```
