What the agent does
The agent reads the dependency set and the lockfile before writing a config, because the grouping and ignore rules depend on what is in them. In an API laid out like hagopj13/node-express-boilerplate, package.json is at version 1.7.0, asks for Node 12 or newer, and pins with carets: mongoose ^5.7.7, express ^4.17.1, helmet ^4.1.0, passport ^0.4.0, passport-jwt ^4.0.0, jsonwebtoken ^8.5.1, joi ^17.3.0, swagger-jsdoc ^6.0.8, swagger-ui-express ^4.1.6, winston ^3.2.1, express-rate-limit ^5.0.0, moment, nodemailer and pm2, with ESLint 7 and the Airbnb base config, Prettier, Jest, Husky and lint-staged as dev dependencies. The lockfile is yarn.lock; Dockerfile runs yarn install --pure-lockfile on node:alpine. Tests live under tests/integration and tests/unit, run with jest -i, and tests/utils/setupTestDB.js connects to the MongoDB named in the config. There is no .github/ directory; .travis.yml still describes a Node 12 build with a MongoDB service that runs yarn lint and yarn test.
The agent adds .github/dependabot.yml with one npm entry for directory / on a weekly schedule; Dependabot reads yarn.lock and updates it with the manifest. It defines three groups: development tooling (ESLint and its plugins, Prettier, Jest, Husky, lint-staged, nodemon), minor and patch updates of production dependencies, and the passport packages together, since passport and passport-jwt move as a pair in this app's auth setup. It adds an ignore rule for major versions of mongoose, because the jump from the 5.x line this app pins is a migration: src/config/config.js still passes useCreateIndex, useNewUrlParser and useUnifiedTopology, options later Mongoose lines no longer accept, and the models under src/models/ use that line's plugins. That belongs in its own pull request rather than a weekly batch. express majors are ignored the same way. A docker entry is left out with a comment: the image is node:alpine with no version tag, so there is nothing for Dependabot to bump until the tag is pinned.
Because nothing on GitHub runs the tests, the agent says in the pull request that Dependabot's pull requests will show no checks, points at the .travis.yml as the suite's last home, and lists the yarn lint and yarn test commands a workflow would need, without adding one, since that is a separate change. In its sandbox it runs yarn install --frozen-lockfile to confirm the lockfile is consistent, yarn lint, and the Jest suite against a MongoDB it starts, so the baseline the first Dependabot pull requests are measured against is recorded.
It finishes by running yarn outdated and putting the table into the pull request, split into what the first weekly run will open and what the ignore rules hold back, so the maintainer sees that the mongoose major is the one update that needs a decision rather than a merge.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add Dependabot to this Express and Mongoose API. Read package.json, yarn.lock, Dockerfile, .travis.yml, src/config/config.js, tests/utils/setupTestDB.js and README.md first, and confirm there is no .github directory. Add .github/dependabot.yml with an npm entry for / on a weekly schedule and an open-pull-requests-limit; group development tooling, group minor and patch updates of production dependencies, group the passport packages, and ignore major updates of mongoose and express with a comment saying why. Leave the Docker image out with a comment that node:alpine has no tag to bump. Run yarn install --frozen-lockfile, yarn lint and the Jest suite against a MongoDB you start in your sandbox, run yarn outdated, and put the results in the pull request, split into what Dependabot will open first and what the ignore rules hold back. Say plainly that the pull requests will carry no checks until a workflow exists, and do not add one. Change no other file.",
"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 one file, .github/dependabot.yml, and nothing else. Its description shows the yarn install --frozen-lockfile result, the lint and Jest output from the sandbox, and the yarn outdated table split into the updates Dependabot will open on its first weekly run and the majors the ignore rules keep out.
Once merged, Dependabot opens grouped pull requests on the weekly slot, each changing package.json and yarn.lock together. The mongoose and express majors never arrive as Dependabot pull requests; the description names the upgrade-mongoose job as the way to take that one on when the team is ready. With no workflow in the repository, the pull requests show no checks, and the description says so.
Before merging, a reviewer picks the weekly day and time zone, decides whether the Docker base image should be pinned so a docker entry becomes useful, and whether to migrate the Travis configuration to a GitHub workflow first so the Dependabot pull requests get a result.
Run it on every repository without a Dependabot config
A team with many Node services sends this body once per repository to POST /o/{org}/sessions, each with its own 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 rather than opening a second pull request. Each run reads its own manifest: a service on npm's lockfile gets the same npm entry, one on pnpm gets it pointed at pnpm-lock.yaml, one on a pinned image gets a docker entry, and one on a current Mongoose line gets no ignore rule for it.
A webhook_url on the key reports each run.completed with the pull request in result, so the person who started the batch sees which services now have a config without opening each one.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
The config is short, but the decisions in it come from the repository: which packages move together, which major is a migration rather than a bump, whether the lockfile is consistent today, whether the Docker image can be bumped at all. The agent reads the manifest, the lockfile and the Dockerfile, runs the install, lint and test commands in its own sandbox with a database it starts, and reports the outdated table, so the first week of Dependabot pull requests holds no surprises.
The run keeps every command and its output. Many services can be done at once, each with groups and ignore rules that fit its own dependency set rather than a template.
Frequently asked questions
Why ignore major Mongoose updates?
The app pins the 5.x line and passes useCreateIndex, useNewUrlParser and useUnifiedTopology in src/config/config.js, options that later Mongoose lines no longer accept, so a major bump fails at connection time before any test runs. That is a migration with its own tests, not a weekly bump. The ignore rule keeps it out of the batch; a separate run can do the upgrade when the team chooses.
Does Dependabot handle yarn.lock?
Yes. The npm ecosystem covers npm, Yarn and pnpm lockfiles, and each pull request updates package.json and yarn.lock together, which is what yarn install --pure-lockfile in the Dockerfile needs.
Will the pull requests be tested?
Not until the repository has a GitHub workflow. The suite's last configuration is .travis.yml, which GitHub does not run. The agent states that in the pull request and lists the commands a workflow needs; moving the Travis configuration over is a separate job.
Why no docker entry?
The Dockerfile starts from node:alpine with no version tag. Dependabot can only propose a newer tag when there is one to compare, so the entry would do nothing. Pinning the image to a tagged version is the prerequisite, and the pull request says so.
More Mongoose jobs
The same job on other stacks
- Add Dependabot to an Obsidian Plugin (Obsidian plugin)
- Add Dependabot to a Poetry Project (Poetry)
- Add Dependabot to a Reflex App (Reflex)