Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions skills/github/github-code-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ EOF
)"
```

### Step 8b: Cross-PR Conflict Check (Optional)

Run the cross-PR conflict check (see Section 6).

### Step 9: Clean up

```bash
Expand All @@ -479,3 +483,67 @@ git branch -D pr-$PR_NUMBER
- **Approve** — no critical or warning-level issues, only minor suggestions or all clear
- **Request Changes** — any critical or warning-level issue that should be fixed before merge
- **Comment** — observations and suggestions, but nothing blocking (use when you're unsure or the PR is a draft)

---

## 6. Cross-PR Conflict Analysis (Optional)

Check whether the current PR modifies functions also changed by other open PRs.

### During PR Review — Conflict Check

After posting your code review (Steps 7-8), run the cross-PR conflict check:

```bash
# Install codegraph if not present
if ! command -v codegraph &>/dev/null; then
pip install codegraph-ai

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not install this package into the active environment. The linked codegraph guide requires an isolated virtual environment (pr-analysis.md:17-23); this skill should make that prerequisite explicit or delegate the external setup to a supporting script.

fi

# Build index if not present (one-time, takes a few minutes)
if [ ! -d ".codegraph" ]; then
codegraph init --repo . --db .codegraph
# Re-run periodically (e.g. weekly) to keep the index fresh
codegraph pr-review prepare --db .codegraph --limit 500
echo ".codegraph/" >> .gitignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mutates the repository under review and leaves a tracked .gitignore diff. Keep graph and report state outside the checkout (the upstream guide supports --output) rather than editing project files during a review.

fi

# Ensure this PR is in the index (idempotent — safe to re-run on existing PRs)
codegraph pr-review update --db .codegraph --pr $PR_NUMBER

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linked upstream guide currently documents only codegraph pr-review prepare and label; it has no update subcommand or --pr argument. Please replace this with a supported full-pipeline or Python-API flow.


# Check for conflicts (dry-run to preview)
codegraph pr-review label --db .codegraph --pr $PR_NUMBER --comment-only --dry-run

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream documents label flags only for --db, --repo, and --dry-run (pr-analysis.md:146-152); --pr and --comment-only are not documented. This command must be revised before the workflow can be used.

```

If conflicts are found, post the conflict comment:

```bash
codegraph pr-review label --db .codegraph --pr $PR_NUMBER --comment-only
```

If no conflicts are found, skip — no comment needed.

The conflict comment looks like:

```markdown
### :warning: Cross-PR Conflict Detected

This PR shares modified code with #37398, #37442, #37966.

**Shared functions:**

| Function | File | Also modified by |
|----------|------|-----------------|
| `_run_single_child` | `tools/delegate_tool.py` | #37633, #37724 |
| `delegate_task` | `tools/delegate_tool.py` | #37398, #37442, #37966 |

**Recommendation:** Coordinate with #37398, #37442, #37633, #37724, #37966 before merging.
```

### Troubleshooting

| Problem | Fix |
|---------|-----|
| `Database locked` after interrupted `prepare` | `rm .codegraph/graph.db/neugdb.lock` |
| `prepare`/`update` fails to fetch PR diffs | Run `gh auth login` first — codegraph uses `gh` CLI for GitHub access |
| `prepare` seems stuck | Normal — indexing 500 PRs takes a few minutes. Let it finish |