# Add Dependabot to a VS Code Extension

Yes. An agent adds a dependabot.yml that updates your extension's npm dependencies weekly, keeps @types/vscode in step with your engine, and adds a build check.

[Run this on Rush](https://cloud.getrush.ai/run/add-dependabot/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 the manifest and the build. In an extension laid out like usernamehw/vscode-error-lens, `package.json` declares `engines.vscode` as `^1.107.0` and `engines.npm` as `>=10.0.0`, points `main` at `./dist/extension.js`, and has two scripts: `vscode:prepublish`, which runs `webpack --mode production`, and `watch`. Its devDependencies are `@types/vscode` at `^1.107.0`, TypeScript 6, webpack 5 with `webpack-cli` and `ts-loader`, ESLint 8 with the v5 `@typescript-eslint` plugin and parser, and `@types/node` 22; the one runtime dependency is lodash. `package-lock.json` is lockfile version 2. `.vscodeignore` keeps `src/`, the lockfile and `webpack.config.js` out of the package, so only `dist/` ships. There is no `.github/` directory at all: no workflows, no Dependabot, nothing that builds the extension on a pull request.

Two dependencies need care, and the agent writes the reason for each into the file. `@types/vscode` must not run ahead of `engines.vscode`: a newer types package exposes API the declared minimum editor does not have, and `vsce` refuses to package a mismatch, so that package goes under `ignore` with a comment saying to bump it together with the engine. ESLint 8 and the v5 typescript-eslint packages are a matched set whose next majors need a flat config, so majors for the three of them are ignored and minors grouped, while the rest of the devDependencies are grouped by minor and patch into one weekly pull request. Lodash sits in its own group because it ships in the bundle.

The `.github/dependabot.yml` it writes has one `npm` update for directory `/` on a weekly schedule with a `dependencies` label and those groups and ignores. Because no workflow exists, a Dependabot pull request would otherwise arrive with no check, so the agent adds a small `.github/workflows/build.yml` on `pull_request` and `push` that uses `actions/setup-node` with the Node major that `@types/node` targets, runs `npm ci` and then `npm run vscode:prepublish`, the production bundle, with `contents: read` permissions. The file includes a `github-actions` entry too, now that there is a workflow to keep current.

In its sandbox the agent runs `npm ci` and the production webpack build to confirm the baseline is green, runs `npm outdated` to preview what the first Dependabot pass will propose, and runs `actionlint` on the new workflow before opening the pull request.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add Dependabot to this VS Code extension. Read package.json, package-lock.json, .vscodeignore, webpack.config.js, tsconfig.json and any .github directory first. Write .github/dependabot.yml with a weekly npm update on the root: ignore @types/vscode with a comment that it moves together with engines.vscode, ignore major updates of eslint and the typescript-eslint packages with a comment about flat config, group the remaining devDependencies by minor and patch, and put runtime dependencies in their own group. If no workflow exists, add .github/workflows/build.yml on pull_request and push that runs npm ci and the production bundle script with contents: read permissions, and add a github-actions entry to dependabot.yml. Run npm ci and the production build in the sandbox, run npm outdated to preview the first updates, run actionlint, and open a pull request that lists the preview and explains each ignore.",
  "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

The pull request adds `.github/dependabot.yml` and `.github/workflows/build.yml`. Its description lists the packages `npm outdated` reports today, grouped as the file groups them, the reason for each ignore entry, the Node version the workflow uses and why, and the result of the production build and `actionlint` from the sandbox.

Once merged, the first grouped Dependabot pull request arrives on the next schedule with the build check attached, and a bump that breaks the bundle, such as a `ts-loader` change that TypeScript 6 rejects, turns red before a maintainer opens it.

Before merging, a reviewer confirms the `@types/vscode` ignore matches their policy for raising the minimum editor version, decides whether weekly is right for an extension that releases on its own cadence, and checks that the workflow's Node version is one the Marketplace build also uses.

## Run it on every new repository

A publisher with several extensions sends this body once per repository from its own server, each a `POST /o/{org}/sessions` with that repository in `resources` and a `request_id` that is a UUID v5 of the repository's full name, so a retried call returns the run already started. Each run reads its own manifest: an extension built with esbuild gets a workflow that runs that script, one on pnpm gets a pnpm install, and one with workflows already gets no new build file.

Once Dependabot is running, an automation on the Project with a `schedule` trigger set to the morning after Dependabot's weekly slot and the prompt "for each open Dependabot pull request whose build failed, read the log and comment with the package, the error and whether the bundle or the type check broke" starts one run a week. A `github` trigger would not do here: Dependabot is a bot sender, and bot senders never fire one. The run comments without pushing.

## Why run it on Rush?

The default Dependabot file bumps `@types/vscode` past the engine the extension declares, and the first sign is a packaging error weeks later. The agent reads `engines.vscode` and the matched ESLint set first and writes each exclusion with its reason, and it gives the repository a build check so the updates it invites are tested.

The baseline build, the `npm outdated` preview and the `actionlint` output stay with the run as proof. A publisher with many extensions starts one run per repository at the same time, each in its own sandbox with its own `node_modules`.

## Frequently asked questions

### Why is @types/vscode ignored?

The types package version must match `engines.vscode`; a newer one exposes API the declared minimum editor lacks, and packaging refuses the mismatch. The maintainer bumps both together when they raise the minimum version, and the comment in the file says so.

### Why add a workflow in a Dependabot task?

With no workflow, every Dependabot pull request would arrive unchecked. A single job running `npm ci` and the production bundle is the smallest check that proves an update still builds, and it gives the `github-actions` ecosystem something to update.

### Will it propose ESLint 9?

No. ESLint 9 and the v8 typescript-eslint packages need a flat config, which is a migration of its own. Their majors are ignored with a comment, and minors and patches within the current majors are grouped.

### Does it touch package-lock.json?

No. The agent runs `npm ci` against the existing lockfile and changes nothing in it. Dependabot's own pull requests will update it one group at a time.

## More VS Code extension jobs

- [Bundle a VS Code Extension with esbuild](https://getrush.ai/run/add-esbuild-bundling/vscode-extension/)
- [Add User Settings to a VS Code Extension](https://getrush.ai/run/add-extension-settings/vscode-extension/)
- [Set Up GitHub Actions CI for a VS Code Extension](https://getrush.ai/run/add-github-actions-ci/vscode-extension/)

## The same job on other stacks

- [Add Dependabot to a Chrome Extension Repository](https://getrush.ai/run/add-dependabot/chrome-extension/)
- [Add Dependabot to a CMake C++ Project](https://getrush.ai/run/add-dependabot/cmake/)
- [Add Dependabot to a Cobra CLI](https://getrush.ai/run/add-dependabot/cobra/)

## 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/)
