This guide will walk you through the process of creating a codemod using the Codegen IDE.

Access the dashboard

https://codegen.sh

This is where you’ll write, test, and run your codemods

Simply click login with Github to create an account. If you haven’t received access yet, please contact your administrator.

Create a New Codemod

https://codegen.sh/new will make you a new codemod

Ask an LLM for Help

Ask the LLM-based assistant in the “chat” tab to delete all of your dead functions:

It will compose a codemod for you that looks like this:

# iterate over all functions
for function in codebase.functions:
    # check if the function is not used and has no call sites
    if not function.get_usages() and not function.call_sites:
        # remove the function
        function.remove()

Manually Edit your Codemod

Modify the code to include print statements and skip tests, then click “save”:

Run your codemod

Click the purple “Run” button to run your codemod on your codebase. You will see logs and/or a diff, like so:

Publish a PR

Once you’re satisfied with the output of your codemod, can convert its output to a pull request.

[TODO - talk about GroupBy]

Congratulations! 🎉

You’ve created your first codemod with Codegen.. As you become more comfortable with the API, you can create more complex transformations.

Here are some suggestions for what to explore next: