mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 21:02:28 +00:00
fix(agents): replace gh CLI with curl for PR checking to prevent duplicate work
Agents do not have access to gh CLI, causing them to skip the pre-flight PR check and collide on duplicate work. This replaces all gh-based PR checking commands with curl + jq using the GitHub REST API, updates the task claiming protocol to use branch push + started log file as the primary lock mechanism, and updates automation scripts to use curl for PR listing and git fetch for PR checkout. Files updated: - AGENTS.md (Section 12 coordination rules) - CLAUDE.md (coordination rules) - META_PROMPTS.md (daily + weekly meta prompts) - daily-scheduler.md (pre-flight gate, task claiming, error handling) - weekly-scheduler.md (pre-flight gate, task claiming, error handling) - bitvid-pr-review-agent.md (PR enumeration + checkout) - bitvid-ci-health-agent.md (CI run gathering) - bitvid-weekly-synthesis-agent.md (PR metadata gathering) - bitvid-changelog-agent.md (PR metadata verification) - scripts/agent/review-open-prs.mjs (PR listing + checkout) - scripts/automated-pr-review.mjs (--all mode PR listing + checkout) https://claude.ai/code/session_01L5bzzGpZ6YTiLXcfqaL81G
This commit is contained in:
11 files changed
+97
-103
No files matched your search
@@ -128,7 +128,7 @@ PR METADATA (PR number, author) — RULES
|
||||
|
||||
Only include PR number and author if you can **verify** them via:
|
||||
- merge commit messages that include PR numbers, OR
|
||||
- an available local tool/config that exposes PR metadata (e.g., `gh`)
|
||||
- the GitHub API via `curl` (e.g., `curl -s "https://api.github.com/repos/PR0M3TH3AN/bitvid/pulls?state=closed&per_page=50" | jq '[.[] | {number, title, merged_at: .merged_at}]'`)
|
||||
If not verifiable:
|
||||
- omit PR numbers/authors and keep bullets keyed to commit subjects/hashes.
|
||||
|
||||
|
||||
@@ -73,21 +73,22 @@ WORKFLOW
|
||||
- security-sensitive boundaries and logging policy
|
||||
- Confirm tooling availability:
|
||||
- `npm` available
|
||||
- PR checkout method available (`gh` CLI or equivalent)
|
||||
If `gh` is not available, fall back to manual instructions in the audit log.
|
||||
- `curl` and `jq` available for GitHub API queries
|
||||
If `curl` is not available, document that PR enumeration was not possible in the audit log.
|
||||
|
||||
2) Enumerate open PRs
|
||||
- Preferred: `curl` command (works without gh auth):
|
||||
```bash
|
||||
curl -s "https://api.github.com/repos/PR0M3TH3AN/bitvid/pulls?state=open&per_page=100" | jq -c '.[] | {number: .number, title: .title, created_at: .created_at, author: .user.login}'
|
||||
```
|
||||
- Alternative: `gh pr list` (if available/configured).
|
||||
- Otherwise: document that PR enumeration was not possible in this environment.
|
||||
|
||||
3) For each PR: checkout and run verification
|
||||
Checkout:
|
||||
- Preferred: `gh pr checkout <num>`
|
||||
- Otherwise: fetch the PR branch via git remote refs (only if you can verify).
|
||||
- Fetch the PR branch via git remote refs:
|
||||
```bash
|
||||
git fetch origin pull/<num>/head:pr-<num> && git checkout pr-<num>
|
||||
```
|
||||
|
||||
Install + checks (verify the script names first):
|
||||
- `npm ci` (preferred) or `npm install` if CI install is not supported
|
||||
|
||||
@@ -76,11 +76,16 @@ WORKFLOW
|
||||
- Gather branch refs:
|
||||
- `git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short)' refs/heads/ai`
|
||||
|
||||
Optional method (only if tooling is available and policy allows):
|
||||
- Use `gh` CLI or other configured tooling to fetch:
|
||||
- PR links/status
|
||||
- issue links/priorities
|
||||
If not available: do not guess links; report locally-derived identifiers.
|
||||
Optional method (use curl to query the GitHub API):
|
||||
- Fetch open PRs:
|
||||
```
|
||||
curl -s "https://api.github.com/repos/PR0M3TH3AN/bitvid/pulls?state=open&per_page=100" | jq '{count: length, titles: [.[].title]}'
|
||||
```
|
||||
- Fetch recently closed/merged PRs:
|
||||
```
|
||||
curl -s "https://api.github.com/repos/PR0M3TH3AN/bitvid/pulls?state=closed&per_page=50&sort=updated&direction=desc" | jq '[.[] | {title: .title, merged: .merged_at, number: .number}]'
|
||||
```
|
||||
If curl is unavailable: do not guess links; report locally-derived identifiers.
|
||||
|
||||
3) Normalize items into report sections
|
||||
For each item discovered, capture:
|
||||
|
||||
Reference in new issue
Block a user