DEV Community

Harishbabu R
Harishbabu R

Posted on

Auto-fixing broken frontend builds using Antigravity SDK lifecycle hooks

Handling automated dependency updates usually means manually untangling UI component breakages when a major package version bumps. To eliminate this busywork, I built a local remediation agent using the Google Antigravity Python SDK. Instead of giving an LLM expensive, unrestricted access to the entire repository, the agent is securely sandboxed to trigger npm run build locally and capture the resulting stderr output when a Dependabot PR fails.

The core of the system relies on the SDK’s lifecycle hooks. Instead of dumping thousands of lines of raw terminal output directly into the model's context window, I configured a Transform hook to intercept the shell response before the agent processes it. This hook acts as a deterministic middleware filter: it strips out generic npm WARN logs and isolates the specific Webpack or Vite stack trace. By sanitizing the stderr stream in real-time, the model only reads the exact line numbers and deprecation errors, drastically reducing compute costs and preventing hallucinations.

Once the hook feeds the filtered stack trace into the agent's reasoning engine, it autonomously invokes the native FileSystem tool to open the failing React components, rewrites the deprecated syntax to match the new API, and re-runs the build to verify the patch. The entire process runs statelessly within the PR branch. I open-sourced the GitHub Action—if your team is drowning in noisy Dependabot failures, grab the repository here and let me know how it handles your stack.

DependaFix ⚡

An automated, self-healing GitHub Action that uses the Google Antigravity SDK to resolve breaking frontend syntax changes introduced by Dependabot upgrades.


The Headache

Dependabot is great for security alerts, but terrible for dev velocity.

Upgrading a minor or major version of a frontend library (like react-router-dom or lucide-react) often introduces breaking syntax changes. The automated PR is created, the build (e.g., Vercel, Netlify, or custom CI) fails, and the PR stalls.

Instead of building product features, senior engineers are forced to pull down branches, inspect build logs, manually refactor deprecated syntax, and push updates just to merge a package bump.


How It Works

DependaFix runs directly in your GitHub Actions workflow and executes a self-correcting cycle:

graph TD
    A[Dependabot opens PR] --> B[npm run build fails]
    B --> C[DependaFix Action triggers]
    C --> D[Antigravity Agent reads stderr log]
    D --> E[Agent patches affected UI components]
    E -->

Top comments (0)