Skip to content
Development
Command

/merge-dependabot

@description Evaluate and merge dependabot PRs with parallel builds, dependency-aware batching, and transitive dep analysis. @arguments $REPO: GitHub org/repo (e.g., trailofbits/algo). $OPTIONS: Optional flags — "--skip-config-audit" skips Phase 0 (use in batch runs where config

From plugin
claude-code-config
2.1k4 skills4 commands2 hooks

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/merge-dependabot

Context preview

What this command does when you run it.

@description Evaluate and merge dependabot PRs with parallel builds, dependency-aware batching, and transitive dep analysis. @arguments $REPO: GitHub org/repo (e.g., trailofbits/algo). $OPTIONS: Optional flags — "--skip-config-audit" skips Phase 0 (use in batch runs where config

Command definition

merge-dependabot.md

Merge Dependabot PRs

@description Evaluate and merge dependabot PRs with parallel builds, dependency-aware batching, and transitive dep analysis. @arguments $REPO: GitHub org/repo (e.g., trailofbits/algo). $OPTIONS: Optional flags — "--skip-config-audit" skips Phase 0 (use in batch runs where config audit is a separate pass).

Clone $REPO if not already available locally:

gh repo clone $REPO /tmp/depbot-eval-$(echo "$REPO" | tr '/' '-') -- --depth=50 2>/dev/null || \
  (cd /tmp/depbot-eval-$(echo "$REPO" | tr '/' '-') && git fetch origin)

Work from `/tmp/depbot-eval-{repo-slug}` for all subsequent phases.

Execute every phase below sequentially. Do not stop or ask for confirmation at any phase.

Phase 0: Dependabot Config Audit

If `$OPTIONS` includes `--skip-config-audit`, skip this entire phase and proceed to Phase 1.

Detect all package ecosystems present in the repo by checking for these indicator files:

| Indicator file(s) | Ecosystem | |---|---| | `pyproject.toml` + `uv.lock` | `uv` | | `pyproject.toml` (no `uv.lock`), `requirements*.txt`, `setup.py`, `setup.cfg` | `pip` | | `Cargo.toml` | `cargo` | | `package.json` | `npm` | | `go.mod` | `gomod` | | `Gemfile` | `bundler` | | `Dockerfile`, `docker-compose.yml` | `docker` | | `.github/workflows/*.yml` | `github-actions` | | `composer.json` | `composer` | | `*.csproj`, `*.fsproj` | `nuget` |

Read `.github/dependabot.yml`. Verify all five conditions:

1. **Coverage** — every detected ecosystem has a corresponding `updates` entry with the correct `package-ecosystem` value and appropriate `directory` (usually `"/"`) 2. **uv vs pip** — if a directory has both `pyproject.toml` and `uv.lock`, the ecosystem MUST be `uv`, not `pip`. The `pip` ecosystem does not update `uv.lock`, which causes PRs that modify `pyproject.toml` but leave `uv.lock` out of sync. If any entry uses `pip` where `uv` is correct, flag it for correction. 3. **Schedule** — every entry has `schedule.interval: "weekly"` 4. **Cooldown** — every entry has a `cooldown` block with `default-days: 7`. This prevents dependabot from flooding the PR queue with rapid re-attempts after a PR is closed or merged. 5. **Grouped updates** — every entry has a `groups` key with at least one group using `patterns: ["*"]` or more specific grouping patterns

If the file is missing or any condition fails, create a corrective PR:

1. `git checkout -b fix/dependabot-config` 2. Write or update `.github/dependabot.yml`. Every `updates` entry MUST include all four required blocks. Use this template for each ecosystem entry:

   - package-ecosystem: "{ecosystem}"
     directory: "/"
     schedule:
       interval: "weekly"
     cooldown:
       default-days: 7
     groups:
       {ecosystem}-dependencies:
         patterns:
           - "*"

When updating an existing file, preserve any extra fields already present (labels, reviewers, open-pull-requests-limit, etc.) and only add missing blocks.

3. `git commit -m "chore: update dependabot config for full coverage, weekly schedule, 7-day cooldown, and grouped updates"` 4. `git push origin fix/dependabot-config` 5. `gh pr create --repo $REPO --title "Update dependabot configuration" --body "Adds missing ecosystem coverage, enforces weekly schedule, 7-day cooldown, and grouped updates."` 6. `git checkout main`

Continue to Phase 1 regardless — this PR is non-blocking.

Phase 1: Discovery & Baseline

1a. Fetch dependabot PRs

gh pr list --repo $REPO --author "app/dependabot" --state open \
  --json number,title,headRefName,labels,files,mergeable

If zero PRs are returned, print "No open dependabot PRs for $REPO" and stop.

1b. Categorize PRs

For each PR, examine its changed files:

  • **Actions dep** — all changed files are under `.github/workflows/`

or `.github/actions/`

  • **Library dep** — everything else (lockfiles, manifests, version

pins, dependency specification files)

Store the categorized list for later phases.

1c. Baseline build and test

Verify the main branch is healthy before evaluating any PR.

1. Check out the default branch: use whatever `gh repo view --repo $REPO --json defaultBranchRef` reports 2. Discover the build system — follow the same discovery process described in Phase 3's subagent instructions (read CI workflows first, then Makefile, then language-specific defaults) 3. Run the build command. If it fails, **stop the entire command** and report: "Main branch build is broken. Fix main before processing dependabot PRs." Include the error output. 4. Run the test command. If tests fail, **stop the entire command** and report: "Main branch tests are failing. Fix main before processing dependabot PRs." Include which tests fail. 5. Record the baseline:

  • Full dependency tree from lockfile(s) (`pip freeze`,

`cargo tree`, `npm ls --all`, `go list -m all`, etc.)

  • List of passing tests
  • Build output summary

Store the baseline data — subagents need it for comparison.

Phase 2: Dependency Graph Analysis

2a. Build the transitive dependency map

Parse the repo's lockfile(s) to understand the full dependency tree:

| Ecosystem | Lockfile | Tree command | |---|---|---| | uv | `uv.lock` | `uv pip freeze` (after `uv sync`) | | pip | `poetry.lock`, `requirements*.txt` | `pip freeze` | | cargo | `Cargo.lock` | `cargo tree` | | npm | `package-lock.json`, `pnpm-lock.yaml` | `npm ls --all` or `pnpm ls --depth=Infinity` | | gomod | `go.sum` | `go list -m all` | | bundler | `Gemfile.lock` | `bundle list` |

For each library dep PR, identify which direct dependency it bumps (from the PR title and changed files). Look up that package in the dependency tree to find all its transitive dependents and dependencies.

2b. Group overlapping PRs into batches

Two PRs overlap if:

  • PR A bumps package X, PR B bumps package Y, and X depends on Y

(or Y depends on X) in the transitive tree

  • Both PRs m
Read more
Ships withclaude-code-config

Opinionated defaults, documentation, and workflows for Claude Code at Trail of Bits. Covers sandboxing, permissions, hooks, skills, MCP servers, and usage patterns we've found effective across security audits, development, and research.

Get the whole plugin
Stats
2,114
Stars
160
Forks
Active
Maintenance
Shell
Language
23d ago
Last commit
7mo ago
Created

Repo: trailofbits/claude-code-config

Other commands on claude-code-config.