What the agent does
The agent sizes the job from the tree before it adds a compiler. In an app laid out like ember-learn/super-rentals, app/ and tests/ hold 21 .gjs files (nine components, five route templates and seven rendering tests) and 13 .js files, and package.json has no typescript, no Glint package and no tsconfig.json beside it. .ember-cli says "isTypeScriptProject": false while componentAuthoringFormat and routeAuthoringFormat are already strict, so every template is a <template> tag with explicit imports, which is the form a type checker can follow. config/ember-cli-update.json records @ember/app-blueprint 7.3.1. The agent generates a reference app from that same blueprint version with its --typescript option in a scratch directory, and copies the toolchain from there instead of from memory: the dev dependencies, tsconfig.json, the TypeScript transform in babel.config.mjs and the .gts blocks in eslint.config.mjs.
Configuration lands first, in a commit that renames nothing. tsconfig.json maps the two import roots the app uses, super-rentals/tests/* to tests/ and super-rentals/* to app/, mirroring the exports field in package.json. eslint.config.mjs currently scopes its parser options to **/*.{js,gjs} and its QUnit rules to tests/**/*-test.{js,gjs}; both globs gain the TypeScript extensions. .prettierrc.mjs already lists ts and gts. The type check goes in as a script named lint:types, and that name does the wiring: the lint script runs every pnpm:lint:* entry that is not a fix, so the Lint job in .github/workflows/ci.yml picks it up with no workflow edit. .ember-cli flips to true so generators emit .gts from then on.
Then the files move, leaves first, with git mv so history follows. Each class component gets a signature. Map declares Element: HTMLDivElement and its five arguments, and the agent has to decide what they are, because callers disagree: rental.gjs passes @zoom="9" and @width="150" as strings while @lat comes from the model as a number. It types them as number | string and lists the call sites, leaving the cleanup as a follow-up. RentalsFilter declares its rentals and query arguments and the one value its default block yields. Services become @service declare router: RouterService and @service declare store: Store, RentalRoute.model types params as { rental_id: string }, and the five template-only route files type @model through TOC from @ember/component/template-only.
The compiler finds real things in this code, and the agent fixes each at its source. In rentals.gjs, formData.get('rental-search-term') returns FormDataEntryValue | null and is assigned to a tracked string, so the handler narrows it and types event.currentTarget as a form. In share-button.gjs, url.searchParams.set('url', this.currentURL) passes a URL object where the DOM types want a string, so it becomes this.currentURL.href. map.gjs reads ENV.MAP_TILE_STYLE, a key app/config/environment.js never asserts, so the config type gains it. The rendering tests pass plain objects to <Rentals> where the routes pass store records, so the argument type is a structural Rental interface that both satisfy, with the fields app/models/rental.js declares through @attr and its type getter. After each batch the agent runs pnpm lint and pnpm test, the Vite build followed by Testem in Chrome, and keeps the count of any and @ts-expect-error at zero unless it explains one in the pull request.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Convert this Ember app from JavaScript to TypeScript. Read package.json, .ember-cli, config/ember-cli-update.json, babel.config.mjs, vite.config.mjs, eslint.config.mjs, .prettierrc.mjs, testem.cjs, .github/workflows/ci.yml and every file under app and tests first, and count the .js and .gjs files. Generate a reference app in a scratch directory from the same @ember/app-blueprint version with its TypeScript option and take the type-checking dependencies, tsconfig.json, Babel TypeScript transform and ESLint blocks from it; do not guess package names. Commit the configuration first without renaming files: add a lint:types script so pnpm lint runs the type check, map the super-rentals and super-rentals/tests import roots in tsconfig.json, extend the ESLint globs to ts and gts, and set isTypeScriptProject to true. Then rename with git mv, leaves first: utilities and config, the model, the store service, routes, components, route templates, then tests. Give every class component a signature with Element, Args and Blocks, declare injected services with their types, and type template-only route files. Where the compiler reports an error, fix the code and not the type: no any, no ts-ignore, and a ts-expect-error only with a comment and a line in the pull request. Do not change behaviour or markup. Export CI=true, install Chrome if missing, and run pnpm lint and pnpm test after each batch. Open a pull request listing each renamed file, each real type error found with its fix, and the final lint and test output.",
"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 has a configuration commit followed by rename commits grouped by layer, so a reviewer can read the toolchain change alone and then watch each layer convert. Every file under app/ and tests/ ends as .ts or .gts; config/environment.js, testem.cjs and the .mjs build files stay as they are, because Node loads them directly. The description lists the renames, then the errors the compiler surfaced with the line that fixed each, then the output of pnpm lint, which now includes the type check, and of pnpm test.
A reviewer spends their attention on the signatures, since those are new statements about the app and not translations. Is number | string on the map arguments acceptable, or should the string call sites be fixed in the same pull request? Does the structural Rental interface match what the JSON under public/api returns, including the nested location? They confirm from the diff that templates did not change apart from added imports, and that the test output lists the same modules as before the conversion.
Run it on every directory still in JavaScript
A larger app converts one directory at a time, and each directory is one run. From a script on your own server, send this body to POST /o/{org}/sessions once per directory with the path appended to the prompt, the repository in resources, and a request_id that is a UUID v5 of the repository and path, so starting the batch twice returns the runs already started. Each run opens its own pull request; merge the configuration one first and let the rest rebase onto it.
To stop new JavaScript arriving while the conversion is under way, add an automation on the Project with a github trigger on pull_request.opened, marked read only, whose prompt says to comment when the pull request named in the event adds a .js or .gjs file under app/.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A conversion is only finished when the type check, the linters and the browser tests all pass on the renamed files, and each failure sends the work back to a specific line. On Rush the agent does that loop in its own sandbox: it installs with pnpm, generates the reference app, runs the checks after every batch and reads the errors. The commands and their output are kept in the run's transcript, so the claim that a fix was needed is backed by the compiler message that prompted it.
The job is also long and interruptible in a way that suits a hand-off. When a turn ends the sandbox parks with its disk, and a follow-up message wakes it where it stopped, so a reviewer can answer the open question about the map arguments and have the same run apply the answer without starting over.
Frequently asked questions
Does it convert templates too, or only the JavaScript?
Both, because in this app they are the same files. A .gjs component holds its class and its <template> together, and renaming it to .gts puts the template under the type checker as well, so a misspelled argument at a call site becomes a compile error. An app that still has separate .hbs templates would need them moved into template tags first, which is a separate request.
How does it know which type-checking packages to install?
It asks the blueprint. config/ember-cli-update.json records which blueprint and version produced the app, and that blueprint has a TypeScript variant. Generating it in a scratch directory gives an exact, current list of packages and config files for this Ember version, which is more reliable than a list remembered from an older release.
Will the tests still run in a browser?
Yes. pnpm test stays vite build --mode development && testem ci --port 0, and vite.config.mjs already passes Embroider's extensions list to the Babel plugin, so the build compiles the renamed files once the TypeScript transform is in babel.config.mjs. Types are erased at build time and the QUnit suite runs in Chrome as before.