AgentSkillsCN

setup-pr-analysis

为分析特定 PR/问题配对的本地环境做好准备。在运行漏洞分析器代理之前,先检出父级提交,并准备好上下文文件。

SKILL.md
--- frontmatter
name: setup-pr-analysis
description: Set up the local environment for analyzing a specific PR/issue pair. Use this before running the bug-analyzer agent to checkout the parent commit and prepare context files.

Setup PR Analysis Skill

This skill prepares the local environment for analyzing a bug-fix PR by checking out the parent commit and gathering context.

Usage

Run the setup.sh script with the following parameters:

bash
./setup.sh --pr <number> --issue <number> --repo <owner/repo> --clone-path <path> [--output-dir <path>]

Parameters

ParameterRequiredDescriptionExample
--prYesPR number to analyze12345
--issueYesLinked issue number12340
--repoYesRepository in owner/repo formatmicrosoft/vscode
--clone-pathYesPath to local repo clone/Users/penlv/Code/Work/vscode2
--output-dirNoDirectory for context files (default: data/analysis/<pr>)./context

Example

bash
# Setup analysis for PR #12345 linked to issue #12340
./.github/skills/setup-pr-analysis/setup.sh \
  --pr 12345 \
  --issue 12340 \
  --repo microsoft/vscode \
  --clone-path /Users/penlv/Code/Work/vscode2

What It Does

  1. Fetches PR details: Gets merge commit, parent commit, PR description, changed files
  2. Fetches issue details: Gets issue title, body, and all comments
  3. Checks out parent commit: Switches local clone to the state before the fix
  4. Generates context files:
  • issue.md - Issue title, body, and comments
  • pr.md - PR title, body, and commit messages (for fix-validator only)
  • pr-diff.patch - The actual PR diff (for validator comparison)
  • changed-files.txt - List of files changed in the PR (for validator comparison)
  • metadata.json - Structured data for scripts

Output Structure

code
data/analysis/<pr>/
├── issue.md           # Issue context for bug-analyzer
├── pr.md              # PR context (fix-validator only)
├── pr-diff.patch      # Actual fix (for validator)
├── changed-files.txt  # Files touched by the PR
└── metadata.json      # Structured metadata

Prerequisites

  • gh CLI installed and authenticated
  • jq for JSON processing
  • Local clone of the repository at the specified path
  • Git access to checkout commits