DEV Community

fedasiaz
fedasiaz

Posted on

How I built an AI bot that fixes broken npm dependencies (and how it uses GitHub Actions)

Hey Dev.to community!

We all know the pain: Dependabot opens a PR, you merge it, and your build breaks because a library went ESM-only.

I built Suturely, an open-source tool that upgrades dependencies and fixes the code if tests break. It uses an LLM to read the error, patch the files, and retry until the tests are green.

How it works
It runs your tests before the upgrade (baseline check).

It bumps the dependency.

If tests fail, it sends the error and source files to an LLM (Groq, Gemini, etc).

The LLM patches the code. The cycle repeats up to 3 times.

It only opens a PR if the tests are green.

Free & Autonomous
You don't need to install anything locally. I added a GitHub Action workflow. You just bring your own API key (BYOK) and put it in your repo secrets. It runs on GitHub's servers for free every Monday.

Real-world example
I tested it on a repo with node-fetch@2. The bot updated it to v3, saw the ERR_REQUIRE_ESM error, and automatically rewrote the file to use .default import. It took 3 minutes.

Check out the repository here: https://github.com/fedasiaz/suturely

Any feedback on the architecture or the prompt engineering is highly appreciated!

Top comments (1)

Collapse
 
fedasiaz profile image
fedasiaz •

If anyone wants to test it on their repo, let me know! I'm happy to help debug.