Skip to content

feat(discovery): add watchlist mode for targeted repo sweeps#18

Closed
SDS-Mike wants to merge 1 commit intotang-vu:mainfrom
SDS-Mike:feature/watchlist-mode
Closed

feat(discovery): add watchlist mode for targeted repo sweeps#18
SDS-Mike wants to merge 1 commit intotang-vu:mainfrom
SDS-Mike:feature/watchlist-mode

Conversation

@SDS-Mike
Copy link
Copy Markdown
Contributor

@SDS-Mike SDS-Mike commented Apr 3, 2026

Summary

  • Adds a watchlist field to DiscoveryConfig — a list of "owner/repo" strings for repos you want to sweep regularly
  • Adds a new contribai watchlist CLI command that iterates the watchlist, running run_targeted() on each repo
  • Supports --dry-run for analysis-only mode
  • Gracefully handles per-repo errors without aborting the full sweep
  • Aggregates findings and PR counts across all repos

Motivation

ContribAI's existing target command works great for single repos, and hunt mode discovers repos via GitHub search. But there's a gap: running ContribAI against your own repos on a schedule.

With watchlist, you can:

discovery:
  watchlist:
    - "myorg/backend-api"
    - "myorg/frontend-app"
    - "myorg/infra-tools"

Then schedule contribai watchlist via cron for continuous automated code review across your portfolio — security scans, code quality, docs — without relying on discovery.

Test plan

  • contribai watchlist with empty watchlist shows helpful config instructions
  • contribai watchlist --dry-run iterates repos and reports findings without submitting PRs
  • Invalid entries (missing /) are skipped with a warning
  • Per-repo errors don't abort the sweep
  • Final summary shows aggregated findings and PR counts

🤖 Generated with Claude Code

Adds a `watchlist` field to `DiscoveryConfig` and a new `contribai watchlist`
CLI command that iterates a configured list of specific repositories, running
the targeted analysis pipeline on each.

This enables using ContribAI as an automated code reviewer for your own
repos — populate `discovery.watchlist` with "owner/repo" entries and
schedule `contribai watchlist` via cron for continuous code quality sweeps
without relying on search-based discovery.

Changes:
- Add `watchlist: Vec<String>` to `DiscoveryConfig` (serde default: empty)
- Add `Watchlist` variant to CLI `Commands` enum with `--dry-run` flag
- Implement watchlist handler: validates entries, iterates repos, runs
  `run_targeted()` on each, aggregates findings/PR counts, handles errors
  gracefully per-repo without aborting the sweep
- Update `config.example.yaml` with watchlist documentation and examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SDS-Mike SDS-Mike requested a review from tang-vu as a code owner April 3, 2026 16:00
@tang-vu
Copy link
Copy Markdown
Owner

tang-vu commented Apr 3, 2026

Thanks for the contribution @SDS-Mike! The Watchlist mode is a great bridge between single target and full hunt discovery — exactly the kind of feature power users need.

I reviewed the code and the approach is solid. There are a few things to fix before we can merge:

🔴 Blocking

  1. Merge conflict in config.rs — The DiscoveryConfig struct has changed on main since you branched (we added stars_range normalization). Please rebase on main:

    git fetch origin main
    git rebase origin/main
    # resolve conflicts in crates/contribai-rs/src/core/config.rs
  2. CI failing — cargo fmt — There's a formatting issue around the final println! macro (line ~133 in your diff). Please run:

    cargo fmt --all

🟡 Minor

  1. Blank line in error handler (line 127 in diff) — There's a stray blank line inside the Err(e) arm. Please remove it for consistency with the rest of the codebase.

✅ Looks Good

  • Config field with #[serde(default)] — correct, backward compatible
  • splitn(2, '/') parsing with skip on invalid — clean
  • Per-repo error handling (continue on failure) — correct approach
  • Summary stats at the end — nice UX touch
  • config.example.yaml documentation — helpful

Once you fix the rebase + fmt, this should be good to go! 🚀

1 similar comment
@tang-vu
Copy link
Copy Markdown
Owner

tang-vu commented Apr 3, 2026

Thanks for the contribution @SDS-Mike! The Watchlist mode is a great bridge between single target and full hunt discovery — exactly the kind of feature power users need.

I reviewed the code and the approach is solid. There are a few things to fix before we can merge:

🔴 Blocking

  1. Merge conflict in config.rs — The DiscoveryConfig struct has changed on main since you branched (we added stars_range normalization). Please rebase on main:

    git fetch origin main
    git rebase origin/main
    # resolve conflicts in crates/contribai-rs/src/core/config.rs
  2. CI failing — cargo fmt — There's a formatting issue around the final println! macro (line ~133 in your diff). Please run:

    cargo fmt --all

🟡 Minor

  1. Blank line in error handler (line 127 in diff) — There's a stray blank line inside the Err(e) arm. Please remove it for consistency with the rest of the codebase.

✅ Looks Good

  • Config field with #[serde(default)] — correct, backward compatible
  • splitn(2, '/') parsing with skip on invalid — clean
  • Per-repo error handling (continue on failure) — correct approach
  • Summary stats at the end — nice UX touch
  • config.example.yaml documentation — helpful

Once you fix the rebase + fmt, this should be good to go! 🚀

@tang-vu
Copy link
Copy Markdown
Owner

tang-vu commented Apr 3, 2026

Merged! I resolved the merge conflicts and ran cargo fmt on your behalf. Thanks for the great contribution @SDS-Mike! 🚀

@tang-vu tang-vu closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants