What the agent does
The agent reads every Gradle file, which in a project laid out like gothinkster/spring-boot-realworld-example-app is one: a 72-line build.gradle and no settings.gradle at all. The wrapper is Gradle 7.4. The plugins block applies Spring Boot 2.6.3, io.spring.dependency-management 1.0.11.RELEASE, java, the Netflix DGS codegen plugin 5.0.6 and Spotless 6.2.1. Below it, sourceCompatibility and targetCompatibility are the string '11', Spotless targets every *.java under the root except build/generated/** and runs googleJavaFormat(), compileOnly extends annotationProcessor for Lombok, and the dependency list names Spring Boot starters, mybatis-spring-boot-starter 2.2.2, graphql-dgs-spring-boot-starter 4.9.21, Flyway, jjwt 0.11.2 as one implementation and two runtimeOnly artifacts in a single call, Joda-Time, sqlite-jdbc, and four REST Assured 4.5.1 artifacts for tests. Three tasks are configured: test with useJUnitPlatform(), clean with a doFirst that deletes ./dev.db, and generateJava with schemaPaths under src/main/resources/schema and packageName io.spring.graphql.
The rewrite is line for line. build.gradle.kts keeps the five plugin ids in plugins { id("…") version "…" } form with java as the bare identifier, moves the two Java versions into a java { sourceCompatibility = JavaVersion.VERSION_11 } block, writes the Spotless target as target(fileTree(rootDir) { include("**/*.java"); exclude(…) }), and turns configurations { compileOnly { extendsFrom annotationProcessor } } into extendsFrom(configurations.annotationProcessor.get()). The runtimeOnly call that lists jjwt-impl and jjwt-jackson together becomes two calls, since the Kotlin DSL takes one notation per call. tasks.test { useJUnitPlatform() } and tasks.clean { doFirst { delete("./dev.db") } } replace the tasks.named forms, and generateJava is configured with tasks.named<GenerateJavaTask>("generateJava"), importing com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask, because the Kotlin DSL needs the task type to see schemaPaths and packageName. The old build.gradle is deleted so Gradle does not find two build scripts.
A settings.gradle.kts with rootProject.name is added, because the project has none and takes its name from the checkout directory, which differs between a clone, a CI runner and the bootBuildImage call the README documents with an explicit image name. Nothing else in the repository refers to the build script by name: .github/workflows/gradle.yml caches on hashFiles('**/*.gradle*'), which matches .gradle.kts, runs ./gradlew clean test on Zulu JDK 11, and needs no edit. Spotless formats Java only, so the build script itself is not under its rules.
The proof is the build. The agent runs ./gradlew clean test, which compiles the 93 main and 23 test sources, runs generateJava against schema.graphqls and the REST Assured and MyBatis test suites against the SQLite dev.db, and ./gradlew spotlessJavaCheck to show the formatting rules still apply to the same file set. It compares ./gradlew dependencies --configuration runtimeClasspath before and after the migration and quotes a clean diff in the pull request, which is the direct check that no artifact or version moved. The README's ./gradlew bootRun, test, bootBuildImage and spotlessJavaApply commands are unchanged and the README says so.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Migrate this Spring Boot project's Gradle build from Groovy to the Kotlin DSL. Read build.gradle, gradle/wrapper/gradle-wrapper.properties, .github/workflows/gradle.yml, README.md and src/main/resources/schema first; there is no settings.gradle. Write build.gradle.kts with the same five plugins and versions, the same Java 11 source and target compatibility, the same Spotless java target and googleJavaFormat, compileOnly extending annotationProcessor, every dependency with its exact coordinates and configuration, test using the JUnit platform, clean deleting ./dev.db in doFirst, and generateJava configured through tasks.named<GenerateJavaTask> with the same schemaPaths and packageName. Add settings.gradle.kts with rootProject.name and delete build.gradle. Run ./gradlew dependencies --configuration runtimeClasspath before and after and diff the output, run ./gradlew clean test and ./gradlew spotlessJavaCheck, and open a pull request that quotes the diff and the test summary.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request adds build.gradle.kts and settings.gradle.kts, deletes build.gradle, and touches nothing under src. Its description shows the Groovy and Kotlin forms side by side for the four places that are not a mechanical translation: the Java version block, the Spotless target, the split runtimeOnly call and the typed generateJava configuration. It quotes the empty dependency diff, the test summary and the Spotless check.
A reviewer reads the dependency diff first, because that is where a migration silently changes a build: a runtimeOnly promoted to implementation, a version lost in the rewrite. Then they confirm the CI cache key still matches and that generateJava still writes into build/generated, which Spotless excludes by path.
The description names the one behaviour change, the fixed project name from settings.gradle.kts, so the team can pick the name they want before merging.
Run it on every new Gradle repository
A team that is moving every service to the Kotlin DSL sends this body once per repository from its own server, each POST /o/{org}/sessions naming that repository in resources with a request_id that is a UUID v5 of the repository's full name, so a repeated call returns the run already started instead of a second pull request. Each run reads that repository's own build.gradle and settings and translates what is there, so a multi-module build gets one script per module.
An automation on the Project with a github trigger on pull_request.opened can read any later pull request that adds a build.gradle beside the .kts file and comment that the project has moved; automation runs read and comment, so they never push a translation themselves.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A build-script migration has no unit test of its own. Its proof is the build running the same way, which the agent produces by running Gradle twice in its own sandbox, once before and once after, and diffing the resolved classpath. That diff and the test run come back with the pull request, so the reviewer compares outputs rather than reading two dialects side by side.
The translation is of this project's script: its DGS task, its Spotless exclusions, its missing settings file. A team with many Gradle services starts the same request on each at once and reads one pull request per repository, each with its own classpath diff.
Frequently asked questions
Does Gradle 7.4 need an upgrade for the Kotlin DSL?
No. The Kotlin DSL has shipped with Gradle since 5.0, so the 7.4 wrapper in gradle-wrapper.properties builds build.gradle.kts as it is. Upgrading the wrapper is a separate change the pull request does not make.
Why is generateJava configured with a type?
In Groovy, generateJava { schemaPaths = … } resolves the properties at runtime. The Kotlin DSL is statically typed, so the task must be named with its class, GenerateJavaTask from the codegen plugin, for schemaPaths and packageName to compile.
Will the CI workflow change?
No. gradle.yml runs ./gradlew clean test and keys its cache on **/*.gradle*, which already matches build.gradle.kts and settings.gradle.kts.
What does settings.gradle.kts add?
A fixed rootProject.name. Without a settings file Gradle names the project after its directory, so a clone under another name produces differently named artifacts. The team picks the name in review.
Is the dependency diff really empty?
That is what the run checks. ./gradlew dependencies --configuration runtimeClasspath is captured before and after, and the pull request quotes the diff. A non-empty diff means a coordinate or configuration was mistranslated and the pull request would say which.