New Feature: 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:
1const mapStateToProps = (state) => ({2 a: selectA(state),3});
After Example:
1import { State } from "state";2function mapStateToProps(state: State) {3 const { data } = state;4 return { data };5}
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:
1import { State } from "state";2// the codemod should work on any function argument which is named "state", and not just for "mapStateToProps" function3function mapStateToProps(state: State) {4 const { data } = state;5 return { data };6}
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.
Put your migration campaigns on autopilot.
Accelerate large-scale code changes with unprecedented insights and automations, freeing your engineers to build new features on secure and performant codebases.