Giter Site home page Giter Site logo

danmarauda / bumpgen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xeol-io/bumpgen

0.0 0.0 0.0 480 KB

bumpgen is an AI agent that upgrades npm packages

Home Page: https://www.xeol.io/beta

License: MIT License

Shell 0.39% JavaScript 5.41% TypeScript 94.20%

bumpgen's Introduction

logo

๐Ÿ“ Summary

bumpgen bumps your TypeScript / TSX dependencies and makes code changes for you if anything breaks.

demo

Here's a common scenario:

you: "I should upgrade to the latest version of x, it has banging new features and impressive performance improvements"

you (5 minutes later): nevermind, that broke a bunch of stuff

Then use bumpgen!

How does it work?

  • bumpgen builds your project to understand what broke when a dependency was bumped
  • Then bumpgen uses ts-morph to create an abstract syntax tree from your code, to understand the relationships between statements
  • It also uses the AST to get type definitions for external methods to understand how to use new package versions
  • bumpgen then creates a plan graph DAG to execute things in the correct order to handle propagating changes (ref: arxiv 2309.12499)

Note

bumpgen only supports typescript and tsx at the moment, but we're working on adding support for other strongly typed languages. Hit the emoji button on our open issues for Java, golang, C# and Python to request support.

๐Ÿš€ Get Started

To get started, you'll need an OpenAI API key. gpt-4-turbo-preview from OpenAI is the only supported model at this time, though we plan on supporting more soon.

Then, run bumpgen:

> export LLM_API_KEY="<openai-api-key>"
> cd ~/my-repository
> npm install -g bumpgen
> bumpgen @tanstack/react-query 5.28.14

where @tanstack/react-query is the package you want to bump and 5.28.14 is the version you want to bump to.

You can also run bumpgen without arguments and select which package to upgrade from the menu. Use bumpgen --help for a complete list of options.

Note

If you'd like to be first in line to try the bumpgen GitHub App to replace your usage of dependabot + renovatebot, sign up here.

Limitations

There are some limitations you should know about.

  • bumpgen relies on build errors to determine what needs to be fixed. If an issue is caused by a behavioral change, bumpgen won't detect it.
  • bumpgen can't handle multiple packages at the same time. It will fail to upgrade packages that require peer dependencies to be updated the same time to work such as @octokit/core and @octokit/plugin-retry.
  • bumpgen is not good with very large frameworks like vue. These kind of upgrades (and vue 2 -> 3 specifically) can be arduous even for a human.

๐Ÿ™๏ธ Architecture

 > bumpgen @tanstack/react-query 5.28.14
       โ”‚
โ”Œโ”ฌโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚โ”‚ CLI                                                                        โ”‚
โ””โ”ดโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ–ฒโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚  โ”‚
โ”Œโ”ฌโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚โ”‚ Core (Codeplan)                                                            โ”‚
โ”‚โ”‚                                                                            โ”‚
โ”‚โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚โ”‚ โ”‚ Plan Graph                        โ”‚ โ”‚ Abstract Syntax Tree             โ”‚ โ”‚
โ”‚โ”‚ โ”‚                                   โ”‚ โ”‚                                  โ”‚ โ”‚
โ”‚โ”‚ โ”‚                                   โ”‚ โ”‚                                  โ”‚ โ”‚
โ”‚โ”‚ โ”‚               โ”Œโ”€โ”                 โ”‚ โ”‚                  โ”Œโ”€โ”             โ”‚ โ”‚
โ”‚โ”‚ โ”‚            โ”Œโ”€โ”€โ”ดโ”€โ”˜                 โ”‚ โ”‚               โ”Œโ”€โ”€โ”ดโ”€โ”ดโ”€โ”€โ”          โ”‚ โ”‚
โ”‚โ”‚ โ”‚            โ”‚                      โ”‚ โ”‚               โ”‚       โ”‚          โ”‚ โ”‚
โ”‚โ”‚ โ”‚           โ”Œโ–ผโ”                  โ”Œโ”€โ”€โ”ผโ”€โ”ผโ”€โ”€โ”           โ”Œโ–ผโ”     โ”Œโ–ผโ”         โ”‚ โ”‚
โ”‚โ”‚ โ”‚           โ””โ”€โ”ดโ”€โ”€โ”               โ”‚  โ”‚ โ”‚  โ”‚        โ”Œโ”€โ”€โ”ดโ”€โ”ดโ”€โ”€โ”  โ””โ”€โ”˜         โ”‚ โ”‚
โ”‚โ”‚ โ”‚                โ”‚                  โ”‚ โ”‚  โ–ผ        โ”‚       โ”‚              โ”‚ โ”‚
โ”‚โ”‚ โ”‚               โ”Œโ–ผโ”              โ–ฒ  โ”‚ โ”‚          โ”Œโ–ผโ”     โ”Œโ–ผโ”             โ”‚ โ”‚
โ”‚โ”‚ โ”‚               โ””โ”€โ”ดโ”€โ”€โ”           โ”‚  โ”‚ โ”‚  โ”‚       โ””โ”€โ”˜  โ”Œโ”€โ”€โ”ดโ”€โ”ดโ”€โ”€โ”          โ”‚ โ”‚
โ”‚โ”‚ โ”‚                    โ”‚           โ””โ”€โ”€โ”ผโ”€โ”ผโ”€โ”€โ”˜            โ”‚       โ”‚          โ”‚ โ”‚
โ”‚โ”‚ โ”‚                   โ”Œโ–ผโ”             โ”‚ โ”‚              โ”Œโ–ผโ”     โ”Œโ–ผโ”         โ”‚ โ”‚
โ”‚โ”‚ โ”‚                   โ””โ”€โ”˜             โ”‚ โ”‚              โ””โ”€โ”˜     โ””โ”€โ”˜         โ”‚ โ”‚
โ”‚โ”‚ โ”‚                                   โ”‚ โ”‚                                  โ”‚ โ”‚
โ”‚โ”‚ โ”‚                                   โ”‚ โ”‚                                  โ”‚ โ”‚
โ”‚โ”‚ โ”‚                                   โ”‚ โ”‚                                  โ”‚ โ”‚
โ”‚โ”‚ โ”‚                                   โ”‚ โ”‚                                  โ”‚ โ”‚
โ”‚โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚โ”‚                                                                            โ”‚
โ””โ”ดโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ–ฒโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚  โ”‚
โ”Œโ”ฌโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚โ”‚ Prompt Context                     โ”‚  โ”‚โ”‚ LLM                               โ”‚
โ”‚โ”‚                                    โ”‚  โ”‚โ”‚                                   โ”‚
โ”‚โ”‚ - plan graph                       โ”‚  โ”‚โ”‚ GPT4-Turbo, Claude 3, BYOM        โ”‚
โ”‚โ”‚ - errors                           โ”œโ”€โ”€โ–บโ”‚                                   โ”‚
โ”‚โ”‚ - code                             โ”‚  โ”‚โ”‚                                   โ”‚
โ”‚โ”‚                                    โ—„โ”€โ”€โ”ผโ”‚                                   โ”‚
โ”‚โ”‚                                    โ”‚  โ”‚โ”‚                                   โ”‚
โ”‚โ”‚                                    โ”‚  โ”‚โ”‚                                   โ”‚
โ”‚โ”‚                                    โ”‚  โ”‚โ”‚                                   โ”‚
โ””โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Abstract Syntax Tree

The AST is generated from ts-morph. This AST allows bumpgen to understand the relationship between nodes in a codebase.

Plan Graph

The plan graph is a concept detailed in codeplan by Microsoft. The plan graph allows bumpgen to not only fix an issue at a point but also fix the 2nd order breaking changes from the fix itself. In short, it allows bumpgen to propagate a fix to the rest of the codebase.

Prompt Context

We pass the plan graph, the error, and the actual file with the breaking change as context to the LLM to maximize its ability to fix the issue.

LLM

We only support gpt-4-turbo-preview at this time.

meme

โฑ๏ธ Benchmark

bumpgen + GPT-4 Turbo         โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   45% (67 tasks)

We benchmarked bumpgen with GPT-4 Turbo against a suite of version bumps with breaking changes. You can check out the evals here.

๐ŸŽ Contributing

Contributions are welcome! To get set up for development, see Development.

Roadmap

  • codeplan
  • Typescript/TSX support
  • bumpgen GitHub app
  • Embeddings for different package versions
  • Use test runners as an oracle
  • C# support
  • Java support
  • Go support

Join our Discord community to contribute, learn more, and ask questions!

bumpgen's People

Contributors

zlalvani avatar noqcks avatar shihanwan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.