Transforming code on the command line with Amazon Q Developer - Amazon Q Developer

Transforming code on the command line with Amazon Q Developer

Transforming code with Amazon Q on the command line is in preview, and is subject to change.

You can transform your Java applications from the command line with the Amazon Q Developer command line transformation tool. You provide the path to your source code, and Amazon Q upgrades your Java language version, including deprecated code, libraries, and other dependencies. For more information on the types of upgrades Amazon Q makes to transform Java applications, see How Amazon Q transforms your code.

In addition to the transformation Amazon Q runs, you have the option to create custom transformations to make changes unique to your organization’s code. For more information, see Customizing transformations on the command line with Amazon Q Developer.

To transform your code, Amazon Q creates a new branch in your repository where it commits the code changes. Throughout the transformation, Amazon Q runs builds on your local environment to verify changes. For more information, see Building code in your local environment. When the transformation is complete, you can merge the branch into your original branch to incorporate the changes into your codebase.

To get started, install the command line tool and authenticate, and then see the commands to configure and start a transformation.

Building code in your local environment

During a transformation, Amazon Q performs verification builds in your local environment. Amazon Q transforms your code on the server side in multiple steps. After each step, Amazon Q sends the code to your local environment to build and test the changes it made. The code is then sent back to the server side to continue the transformation.

The build in your local environment helps verify the transformed code by allowing Amazon Q to run tests that require access to private resources. To minimize security risks associated with building AI-generated code in your local environment, Amazon Q reviews and updates the code it generates to address security concerns.

Commands

For step-by-step instructions for running these commands, see Running a transformation on the command line with Amazon Q Developer.

To configure a transformation and authenticate to Amazon Q Developer Pro, run:

qct configure

To start a transformation, run:

qct transform --source_folder <path-to-folder>

To start a transformation with a customization, run:

qct transform --source_folder <path-to-folder> --custom_transformation_file <path-to-orchestrator-file>

To get help with transformations, run:

qct -h