New Feature: Natural Language Descriptions in Codemod AI

·2 min read
announcing Natural Language Descriptions in Codemod AI

We are thrilled to announce a new feature in Codemod AI that empowers users to provide transformation logic in the form of natural language descriptions directly within the code examples. This improvement builds on top of our existing iterative approach which significantly improves the accuracy of AI-generated codemods.

By leveraging this additional context, Codemod AI can generate more precise and accurate codemods and further reduce the burden on developers.

Example

Let’s walk through an example use case to see how you can benefit from this new feature.

Take the following before and after code examples for which we want an AI model to generate a codemod.

Before Example:

const mapStateToProps = (state) => ({
a: selectA(state),
});

After Example:

import { State } from "state";
function mapStateToProps(state: State) {
const { data } = state;
return { data };
}

The codemod which is generated for this pair of code snippets is not generalizable to functions other than mapStateToProps.

Here is where the new feature comes in. The user can add some descriptions to the “After” snippet (like below) to get a more generalized codemod.

After Example with Additional User Description:

import { State } from "state";
// the codemod should work on any function argument which is named "state", and not just for "mapStateToProps" function
function mapStateToProps(state: State) {
const { data } = state;
return { data };
}

This time, Codemod AI generates a generalizable codemod that is applicable to any function that has an argument named state.

Get Started Today

We invite you to explore this new feature and see how natural language descriptions can transform your codemod generation experience. Your feedback is invaluable as we continue to refine and expand our tool to better serve the community.

You build. We migrate

Fully delegate code migrations to Codemod agents, freeing your engineers to focus on shipping new features on a secure, high-performance codebase.

Write to us.

Send email

Meet us for a demo.

Book a call