GitHubWatchdog is an agent-first Go CLI for scanning GitHub repositories and users for suspicious or malicious patterns. It can run broad searches, targeted repo or user scans, and mixed-target verdict batches backed by SQLite.
The CLI is designed to be agent-friendly:
- JSON is the default output for scan commands.
ndjsonis available for streaming workflows.capabilitiesexposes a machine-readable command and flag catalog.recommendturns a natural-language task into a deterministic command suggestion.- Exit code
10signals findings when--fail-on-findingsis used. - Search checkpoints can be saved, resumed, exported, and imported.
-quietsuppresses informational stderr logs for cleaner automation.
- Go 1.23.5 or newer
- GitHub auth via one of:
GITHUB_TOKENGH_TOKEN- an authenticated
ghsession
Example:
export GITHUB_TOKEN=your_token_hereOr authenticate once with GitHub CLI:
gh auth logingo build -o githubwatchdog ./cmd/appRun the default batch search:
./githubwatchdogScan a single repository:
./githubwatchdog repo BearHuddleston/GitHubWatchdogScan a single user:
./githubwatchdog user octocatEmit a compact verdict instead of the full payload:
./githubwatchdog verdict BearHuddleston/GitHubWatchdog
./githubwatchdog verdict octocatgithubwatchdog [global flags] search [search flags]
githubwatchdog [global flags] repo <owner>/<repo> [scan flags]
githubwatchdog [global flags] user <username> [scan flags]
githubwatchdog [global flags] verdict <owner/repo|username> [verdict flags]
githubwatchdog [global flags] checkpoints <list|show|delete|export|import> [args]
githubwatchdog [global flags] capabilities [--format json|text]
githubwatchdog [global flags] recommend <task...>
Global flags:
-config: path to config file, defaultconfig.json-db: path to SQLite database, defaultgithub_watchdog.db-quiet: suppress informational logs on stderr
Running the binary with no subcommand is equivalent to search.
Basic search:
./githubwatchdog search --query 'stars:>5' --since 2026-03-01 --max-pages 2Only emit flagged results and fail the run if any are found:
./githubwatchdog search --only-flagged --fail-on-findingsStream results as they are discovered:
./githubwatchdog search --format ndjson --only-flaggedAdd validated updated-time filters without editing raw updated: qualifiers:
./githubwatchdog search --since 2026-03-01 --updated-before 2026-03-13Search by repository creation time instead:
./githubwatchdog search --activity created --created-since 2026-03-01 --created-before 2026-03-13Search for repositories that are new or recently updated:
./githubwatchdog search --activity either --created-since 2026-03-10 --since 2026-03-10For agent workflows, derive the time window from the prompt. If the prompt implies "up to now", prefer lower-bound flags only and omit unnecessary upper bounds.
Use a built-in profile:
./githubwatchdog search --profile recent
./githubwatchdog search --profile high-signal --only-flagged
./githubwatchdog search --list-profilesBuilt-in profiles:
recenthigh-signalbackfill
Search output includes scan metadata such as:
activityprofile_namebase_queryqueryqueriessincecreated_sincecreated_beforeupdated_sinceupdated_beforecheckpoint_namenext_created_beforenext_updated_before
Save and resume long-running searches:
./githubwatchdog search --profile backfill --checkpoint backlog
./githubwatchdog search --checkpoint backlog --resumeManage stored checkpoints:
./githubwatchdog checkpoints list
./githubwatchdog checkpoints show backlog
./githubwatchdog checkpoints delete backlogMove checkpoints between machines:
./githubwatchdog checkpoints export backlog --format json > backlog.json
./githubwatchdog checkpoints import --input backlog.jsonCompact targeted verdicts:
./githubwatchdog repo BearHuddleston/GitHubWatchdog --summary
./githubwatchdog user octocat --summary --format json
./githubwatchdog verdict BearHuddleston/GitHubWatchdog
./githubwatchdog verdict octocatBatch mixed-target verdicts from stdin or a file:
printf 'BearHuddleston/GitHubWatchdog\noctocat\n' | ./githubwatchdog verdict --input - --format ndjson
./githubwatchdog verdict --input targets.txt --format ndjson --fail-on-findings
./githubwatchdog verdict --input targets.txt --format ndjson --continue-on-errorverdict --continue-on-error emits per-target error objects in batch mode instead of aborting on the first failure.
Use the binary itself as the authoritative command catalog:
./githubwatchdog capabilities --format jsonAsk the CLI for a deterministic recommendation from a user prompt:
./githubwatchdog recommend --prompt 'find new or updated repos from the last 3 days' --format jsonrecommend does not execute scans. It returns the recommended command, resolved time window, assumptions, warnings, and ready-to-run invocations.
Supported output formats:
jsontextndjson
Notes:
searchdefaults tojson, andndjsonstreams one result per line plus a final summary line.repo,user, andverdictsupport compact summary output for automation.capabilitiesandrecommendsupportjsonandtext.--fail-on-findingsreturns exit code10when suspicious results are present.-quietis useful for agent runs that want machine-readable output without informational stderr logs.
config.json is optional. The CLI can pick up auth from GITHUB_TOKEN, GH_TOKEN, or a logged-in gh session, and falls back to built-in defaults when no config file is present.
Example config.json:
{
"max_pages": 10,
"per_page": 100,
"github_query": "stars:>5",
"max_concurrent": 50,
"rate_limit_buffer": 500,
"cache_ttl": 60,
"verbose": false
}Run the CLI help:
go run ./cmd/app helpRun tests:
go test ./...
go vet ./...