# Upgrade a VS Code Extension to the Latest API

An agent raises engines.vscode and @types/vscode to ^1.144.0 in two samples, fixes the type breaks without casts, and adds a passing test to each.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-vscode-engine/vscode-extension/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads both samples' `package.json`, `npm outdated` and the `helloworld-test-cli-sample` setup first. Both declare `engines.vscode` and `@types/vscode` `^1.100.0`, both compile, neither has a `test` script, and `tree-view-sample` still depends on `jsonc-parser` ^0.4.2, `mkdirp` ^0.5.1 and `rimraf` ^2.6.2.

It moves both to `^1.144.0`, ESLint to 10, TypeScript to ~6.0.3 and the tree-view runtime dependencies to their current majors. Type breaks are fixed in code: `jsonOutline.ts` narrows `findNodeAtLocation`, which jsonc-parser 3 types as optional, `fileExplorer.ts` calls the promise-based `mkdirp` and `rimraf`, and `ftpExplorer.ts` imports `Client` as a default. Each sample gains a `.vscode-test.mjs` and a test that activates it and runs one command.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "In tree-view-sample and helloworld-sample only, raise engines.vscode and @types/vscode together to the latest compatible version and upgrade the other npm dependencies. Fix type errors against the API change, not with casts. Neither sample has tests: add @vscode/test-cli and @vscode/test-electron with a .vscode-test.mjs as helloworld-test-cli-sample does, and one test per sample that activates it and runs one command. Run npm run compile, then xvfb-run -a npm test, and npm run validate at the repository root. Leave out any upgrade that breaks the build or tests and say why. Open a pull request with one line per bump.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **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.
2. **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.
3. **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

Tried on microsoft/vscode-extension-samples at 65c1c448: 14 files changed, 5079 insertions(+), 2827 deletions(-), most of it the two regenerated `package-lock.json` files. `npm run compile` and root `npm run validate` exit 0 before and after. `xvfb-run -a npm test` ends `1 passing (283ms)` in `helloworld-sample` and `1 passing (433ms)` in `tree-view-sample`, both exit 0; `xvfb-run` first failed with `xvfb-run: error: xauth command not found` until the agent installed `xauth` with apt. No pull request was opened. The run copied the full diff to `/workspace/.rush/artifacts/`, but capture keeps no `.diff` file, so it did not come back.

For the reviewer: TypeScript stays on ~6.0.3, not 7.0.2, because npm refused 7 beside `typescript-eslint@8.72.1`, and `@types/node` stays on `^22`. Both lockfiles were regenerated after npm reported an ERESOLVE peer conflict once eslint went to 10. Whether the sibling samples should also move to ESLint 10 is left to the reviewer. The run did not look into the `npm audit` findings left after install.

## Run it on every Monday at 09:00 UTC

The weekly upgrade automation has a `schedule` trigger on cron `0 9 * * 1` in UTC, with this request as its prompt. An upgrade that npm refuses or that breaks the compile or test host is left out with the reason, as TypeScript 7 was here.

## Why run it on Rush?

This run moved `@types/vscode` and `engines.vscode` together and showed both samples activate in a real VS Code under xvfb. The run reports that its type breaks came from jsonc-parser, mkdirp, rimraf and TypeScript 6.

## Frequently asked questions

### Why do the tests not check the hello world message?

The run reports that `showInformationMessage` cannot be observed from the extension host, so each test asserts activation and runs `extension.helloWorld` or `nodeDependencies.refreshEntry`, a command that opens no prompt.

### Why was TypeScript not upgraded to 7?

npm refused it: `typescript-eslint@8.72.1` has a peer range of `>=4.8.4 <6.1.0`. The agent pinned `~6.0.3`, the newest 6.0 release, and listed it as held back.

## More VS Code Extension jobs

- [Write Integration Tests for a VS Code Extension](https://getrush.ai/run/write-extension-tests/vscode-extension/)
- [Add Code Coverage to CI for a VS Code Extension](https://getrush.ai/run/add-coverage-to-ci/vscode-extension/)
- [Add Dependabot to a VS Code Extension](https://getrush.ai/run/add-dependabot/vscode-extension/)

## More jobs like this: Upgrade dependencies weekly

- [Upgrade Wagtail to the Latest Release](https://getrush.ai/run/upgrade-wagtail/wagtail/)
- [Upgrade Zod 3 to Zod 4 in a React App](https://getrush.ai/run/upgrade-zod/zod/)
- [Add cargo-audit to CI for a Rust CLI](https://getrush.ai/run/add-cargo-audit-to-ci/rust-cli/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
