pipelines / maintenance-rust.yaml
Keep a Rust app's dependencies fresh
Dependencies drift every week. This pipeline checks for free whether anything needs doing, lets a cheap model do the update, climbs to a smarter one only if the checks fail, and proves the site still answers exactly as before.
// the steps
What runs, in order.
- 01-gate
freecaffeine gate cargo: nothing outdated and no advisory, the run stops here and costs nothing.
- 02-smoke-before
scriptStarts the app and records how each route answers, before anything changes.
- 03-update
agent · cheap → smartUpdates Cargo.toml and Cargo.lock with only cargo commands allowed. If the checks fail, a stronger model takes over.
- verify
checkScope limited to Cargo files and src/, release build, tests, and the same smoke test as before.
- 99-pr
scriptcaffeine pr opens a pull request on the run's own branch. Add --auto-merge once caffeine stats says it's earned.
// the file
The whole pipeline.
Shipped with caffeine as an example. Copy it to ~/.caffeine/pipelines/, list it on a target in workspace.yaml, then caffeine run maintenance-rust.
description: "Dependency and security updates for a Rust app, checked by build, tests and a smoke test" branch_prefix: caffeine/maint max_budget_usd: 3 steps: - name: 01-gate # nothing to update and no advisory: stop, free run: caffeine gate cargo sandbox: none # a gate reads your home: always on the host - name: 02-smoke-before run: caffeine check smoke --save --status-only --start "{{smoke_start}}" --url {{smoke_url}} --wait 300 {{smoke_routes}} timeout: 900 - name: 03-update prompt: prompts/maintenance-rust/update.md model: cheap fallback: smart # a stronger model only when the checks fail max_turns: 50 timeout: 2400 allowed_tools: [Read, Edit, Grep, Glob, "Bash(cargo update*)", "Bash(cargo build*)", "Bash(cargo check*)", "Bash(cargo test*)", "Bash(cargo audit*)", "Bash(cargo tree*)"] verify: >- caffeine scope Cargo.toml Cargo.lock '*/Cargo.toml' 'src/**' '*/src/**' && cargo build --release -q && cargo test -q && caffeine check smoke --status-only --start "{{smoke_start}}" --url {{smoke_url}} --wait 300 {{smoke_routes}} - name: 99-pr # add --auto-merge once `caffeine stats` shows it is earned run: caffeine pr sandbox: none # pushes with your git and gh credentials: on the host