Detect active repos by the owner not cloned locally and request confirmation before acting
Read bot_account, owner_account from the org's CLAUDE.md ## Automation config table.
Detect GitHub repos where the owner has active work (issues, PRs, reviews) that are not cloned locally. For each discovered repo, open an issue asking for confirmation before cloning.
~/.claude/scripts/repo-watch.sh [org-name ...] > /tmp/repo-watch.json
If the script is missing, run /setup-scripts to regenerate it.
The script outputs a JSON object with missing_repos array, each containing:
org, gh_org, repo, last_push, open_issues_assignedParse the JSON output.
Skip repos that are already listed in the org's CLAUDE.md under ## Excluded repos.
For each missing repo, do not clone automatically. Instead, create a GitHub issue on the repo asking for confirmation:
gh issue create -R {gh_org}/{repo} \
--title "Add to local dev environment?" \
--body "The bot detected that the owner has active work on this repo but it's not in the local dev setup.
Should I clone this repo and add it to the org automation?
- React with 👍 to confirm
- React with 👎 to exclude (will be added to the exclusion list)
This was opened by a bot. Please ping the owner for any questions."
On subsequent runs, check for reactions on previously opened issues:
## Excluded repos in CLAUDE.md and close the issue# Use the owner_account from Automation config
gh api "repos/{gh_org}/{repo}/issues/{number}/reactions" \
--jq '[.[] | select(.user.login == "<owner_account>")] | .[0].content'
For repos confirmed with 👍:
gh repo clone {gh_org}/{repo} $CODE_DIR/{org}/{repo}For repos rejected with 👎:
## Excluded repos section in the org's CLAUDE.mdIMPORTANT: If this command is being run as a standalone request, automatically exit after completing all phases successfully.