crash_pilot 1.0.7
crash_pilot: ^1.0.7 copied to clipboard
Autonomous self-healing & Shorebird hot-patch engine for Flutter apps with AST analysis and automated GitHub PR creation.
๐ CrashPilot #
The World's First Autonomous Self-Healing & Shorebird Hot-Patch Bot for Flutter Apps.
Zero-friction, instant surgical bug fixes and OTA deployment without waiting for App Store / Play Store reviews.
๐ What is CrashPilot? #
When a Flutter app crashes in production, it normally takes 24 to 72 hours for a developer to be alerted, reproduce the bug, write a patch, run tests, and wait for Google Play / Apple App Store approval. In the meantime, thousands of users experience crashes and leave 1-star ratings.
CrashPilot automates this entire lifecycle in under 10 minutes:
- Ingests Sentry & Firebase Crashlytics webhook alerts in real time.
- Parses Dart AST (
package:analyzer) to locate the exact enclosing method, class, and null-safety context. - Synthesizes Surgical Patches (only 5-15 lines, no speculative rewrites) using Gemini 1.5 Pro, Claude 3.5 Sonnet, or OpenAI GPT-4o.
- Verifies in a Sandbox: Enforces
flutter analyze --fatal-infos(0 errors, 0 warnings) and runs auto-generated regression unit tests. - Self-Heals: If tests fail, an automated reflection loop refines the fix.
- Dual Dispatch: Opens a complete diagnostic GitHub Pull Request and triggers Shorebird CodePush to hot-patch live user devices in minutes!
๐๏ธ Architecture #
[ Production Mobile App Crash ]
โ
โผ
[ Sentry / Crashlytics ] โโ(Webhook Alert with Stack Trace)
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CRASHPILOT ENGINE โ
โ โ
โ 1. Ingestion & Triage (Deduplication & Severity Gate) โ
โ 2. Git & AST Locator (Pulls commit, parses Dart AST) โ
โ 3. AI Patch Synthesizer (Surgical Fix + Regression Test) โ
โ 4. Sandbox Verifier (flutter analyze & flutter test) โ
โ 5. Self-Correction Loop (Reflection on any test failure) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
[ GitHub Pull Request ] [ Shorebird OTA Hot-Patch ]
(Detailed Diagnostic PR) (Zero App Store Wait! 5-min fix)
โก Quick Start (Developer Setup) #
1. Installation #
Clone or add CrashPilot to your workspace:
git clone https://github.com/vaibhavbadhe712/crash_pilot.git
cd crash_pilot
dart pub get
2. Initialize Configuration #
Generate crashpilot.yaml in your project root:
dart run bin/crash_pilot.dart init
3. Simulate Offline (Zero-Key Testing) #
Test the entire pipeline on your machine without requiring external API keys:
dart run bin/crash_pilot.dart simulate
4. Analyze Any Stack Trace #
dart run bin/crash_pilot.dart analyze-trace --raw "Null check operator used on a null value
#0 CartCubit.addItem (package:my_app/cart_cubit.dart:142:15)"
5. Autonomous Healing Run #
# Ingest from raw stack trace file:
dart run bin/crash_pilot.dart heal --trace crash.txt
# Or ingest from Sentry Webhook JSON:
dart run bin/crash_pilot.dart heal --json sentry_event.json --source sentry
โ๏ธ Configuration (crashpilot.yaml) #
crashpilot:
# AI Provider: 'gemini', 'claude', or 'openai'
ai_provider: gemini
gemini_model: gemini-1.5-pro
# Shorebird OTA CodePush:
# If true, runs `shorebird patch android/ios` upon test verification
auto_shorebird_patch: false
# Self-healing reflection retries
max_retries: 2
target_branch: main
๐ค GitHub Actions Workflow #
Add .github/workflows/crashpilot.yml to your Flutter repository:
name: CrashPilot Autonomous Self-Heal
on:
repository_dispatch:
types: [production-crash-alert]
jobs:
auto-heal:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Run CrashPilot
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
run: |
dart pub global activate --source path /path/to/crash_pilot
crashpilot heal --json '${{ toJson(github.event.client_payload) }}' --source sentry
๐งช Testing #
Run static analysis and the automated test suite:
dart analyze
dart test
๐ License #
MIT License. See LICENSE for details.