# Add Dependabot to a Rust CLI

Yes. An agent reads your Cargo workspace and CI, writes a dependabot.yml that groups crate updates and respects deliberate pins, and opens a PR.

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

## What the agent does

The agent reads the workspace and the checks that guard it. In a CLI laid out like casey/just, `Cargo.toml` declares a workspace of the root crate and `crates/*`, which holds `action-versions` and `generate-book`, sets `rust-version = "1.89.0"` and edition 2024, and lists dependencies with caret ranges except `clap_complete`, pinned exactly to `=4.6.11` because the crate uses its `unstable-dynamic` feature. `Cargo.lock` is committed. `[lints.clippy]` denies `all` and `pedantic`, and `.github/workflows/ci.yaml` sets `RUSTFLAGS: --deny warnings`, runs `cargo clippy --all --all-targets` and `cargo fmt --check` in a `lint` job, `cargo check` on 1.89.0 in an `msrv` job, builds the book with mdBook 0.4.52 in a `pages` job, and runs `cargo test --all` on Ubuntu, macOS and Windows.

GitHub Actions versions are already managed: `.github/workflows/actions.lock` is generated by `gh actions-lock` and lists each action and version per workflow, and `just action-versions` runs the `action-versions` crate to check them. A Dependabot `github-actions` entry would bump a `uses:` line and leave that lock file stale, so the agent writes a `cargo` entry only and says so in a comment at the top of the file.

The `.github/dependabot.yml` it writes has one `cargo` update for directory `/`, which covers the workspace members through the root `Cargo.lock`, on a weekly schedule with a `dependencies` label. Minor and patch updates are grouped into one pull request so the weekly noise is one review, while a major update arrives on its own. `clap_complete` is listed under `ignore` with a comment pointing at the exact pin, so Dependabot never proposes widening it. The agent also notes that Dependabot does not know the `rust-version` floor; the `msrv` job in `ci.yaml` is what catches a dependency that raises it, and `cargo update --locked --package just` in the `ci` justfile target is what the maintainer already runs.

In its sandbox the agent runs `cargo update --dry-run` to see which crates have newer versions today, so the pull request can say what the first Dependabot run will propose and whether any of it would trip the pinned clippy lints or the MSRV check. It runs `cargo check --all-targets` on the current lockfile to confirm nothing it touched affects the build and opens the pull request with the file and that preview.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add Dependabot to this Rust CLI. Read Cargo.toml, Cargo.lock, every workspace member's Cargo.toml, clippy.toml, the justfile and every file under .github/workflows first, including any actions.lock. Write .github/dependabot.yml with a cargo update on the root directory, weekly, with minor and patch updates grouped and majors separate, a label, and an ignore entry for every dependency whose requirement is an exact pin, each with a comment saying why. Do not add a github-actions entry if action versions are already checked by a lock file or a crate in the workspace; explain that in a comment instead. Run cargo update --dry-run to preview what the first run would propose, run cargo check --all-targets, and open a pull request that lists the preview and the pinned crates you excluded.",
  "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 nothing else. Its description lists the crates `cargo update --dry-run` would move today, grouped as the file groups them, the exact-pinned crates placed under `ignore` with their reasons, why no `github-actions` entry was added, and the `cargo check --all-targets` result from the sandbox.

Once merged, Dependabot opens its first grouped pull request on the next schedule, and every one of them runs the existing `ci.yaml`: clippy with warnings denied, the MSRV check on 1.89.0 and the three-platform test matrix, so an update that breaks any of them is red before anyone reads it.

Before merging, a reviewer checks the ignore list against `Cargo.toml` for any pin the agent missed, decides whether weekly is the right cadence for a project that releases often, and confirms that the actions lock file remains the single source for action versions.

## Run it on every new repository

An organisation that owns many Rust CLIs 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 `Cargo.toml` and workflows: a repository with no action lock gets a `github-actions` entry, a single-crate repository gets no workspace note, and a crate with no exact pins gets no ignore list.

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 CI failed, read the failing job and comment with the crate and the error, and whether the MSRV or a clippy lint caused it" 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?

A `dependabot.yml` copied from a template bumps the pinned crate the project chose on purpose and fights the tool that already locks action versions. The agent reads the pins, the lints and the lock file first, and the reasoning for every exclusion is written into the file where the next maintainer will look for it.

The dry-run preview, the `cargo check` output and the files the agent read are kept with the run, so a reviewer can see why each line is there. One request per repository runs many sandboxes at once, each with its own toolchain and lockfile.

## Frequently asked questions

### Will Dependabot try to change the exactly pinned crate?

Not with this file. The pinned crate is listed under `ignore` with a comment naming the feature that needs the pin. When the maintainer wants to move it, they edit the requirement and the lockfile together and remove the ignore entry.

### Why no github-actions entry?

The workflows already have an `actions.lock` generated by `gh actions-lock` and a workspace crate that checks it. A Dependabot bump of a `uses:` line would leave that lock stale. The file explains this in a comment; a repository without such a lock gets the entry.

### Does it respect rust-version?

Dependabot does not read `rust-version`, so a dependency that raises its own MSRV can be proposed. The `msrv` job in CI runs `cargo check` on 1.89.0 against every pull request, which turns such an update red; the pull request description points this out.

### Why group minor and patch updates?

With the lints denying warnings and three platforms in the test matrix, a weekly single pull request costs one CI run and one review. A major update stays separate because it is the one likely to need a code change.

## More Rust CLI jobs

- [Add Fuzz Tests to a Rust CLI's Parser](https://getrush.ai/run/add-fuzz-tests/rust-cli/)
- [Add JSON Output to a Rust CLI](https://getrush.ai/run/add-json-output/rust-cli/)
- [Generate a Man Page for a Rust CLI With clap_mangen](https://getrush.ai/run/add-man-page/rust-cli/)

## The same job on other stacks

- [Add Dependabot to a Sequelize App](https://getrush.ai/run/add-dependabot/sequelize/)
- [Add Dependabot to a Socket.IO App](https://getrush.ai/run/add-dependabot/socket-io/)
- [Add Dependabot to a SolidJS App](https://getrush.ai/run/add-dependabot/solidjs/)

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