-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Summary
The pr-reference skill at .github/skills/shared/pr-reference/ provides diff generation, changed-file listing, and chunk reading for PR workflows. Several agents need diff-mode analysis capabilities that go beyond what the skill currently supports, requiring workarounds with raw git commands. Enhancing the skill directly benefits any agent or workflow that consumes branch diffs, including PR description generation, code review, and security analysis.
Current Behavior
The skill's generate.sh/ps1 and list-changed-files.sh/ps1 scripts support:
--base-branchwith a hardcoded default oforigin/main--typefiltering for a single change type (added,deleted,modified,renamed, orall)--no-md-diffto exclude markdown files from the diff--formatfor output as plain text, JSON, or markdown
Expected Behavior
The skill supports flexible base branch detection, merge-base comparison, multi-type file filtering, and extension/path exclusion across both bash and PowerShell implementations.
| # | Capability | Current Behavior | Enhancement |
|---|---|---|---|
| 1 | Auto-detect default branch | Hardcodes origin/main via --base-branch |
Add --base-branch auto that resolves the remote HEAD ref automatically |
| 2 | Merge-base comparison | Uses git diff ${BASE_BRANCH} (direct comparison) |
Add --merge-base flag to use git merge-base for proper three-way comparison |
| 3 | Multi-type file filtering | --type added supports a single type value |
Support comma-separated values (--type added,modified,renamed) or an --exclude-type flag (e.g., --exclude-type deleted) |
| 4 | Extension and path exclusion | Only --no-md-diff for markdown |
Add --exclude-ext (e.g., --exclude-ext yml,yaml,json,png) and --exclude-path (e.g., --exclude-path .github/skills/) |
Root Cause
The skill was built for PR description generation against origin/main with minimal filtering. Broader usage scenarios (security analysis, implementation validation, RPI validation) require more flexible diff scoping.
Files Requiring Changes
| File | Change |
|---|---|
.github/skills/shared/pr-reference/scripts/generate.sh |
Add --merge-base, --base-branch auto, --exclude-ext, --exclude-path parameters |
.github/skills/shared/pr-reference/scripts/generate.ps1 |
Add -MergeBase, -BaseBranch auto, -ExcludeExt, -ExcludePath parameters |
.github/skills/shared/pr-reference/scripts/list-changed-files.sh |
Support comma-separated --type values, add --exclude-type |
.github/skills/shared/pr-reference/scripts/list-changed-files.ps1 |
Support comma-separated -Type values, add -ExcludeType |
.github/skills/shared/pr-reference/scripts/shared.psm1 |
Add shared helper functions if needed for base branch detection |
.github/skills/shared/pr-reference/SKILL.md |
Update Parameters Reference table with all new flags |
Acceptance Criteria
-
generate.shandgenerate.ps1support--merge-baseto compare usinggit merge-baseinstead of direct diff -
generate.shandgenerate.ps1support automatic default branch detection via--base-branch auto(resolvesorigin/HEADand falls back gracefully) -
generate.shandgenerate.ps1support--exclude-extto exclude files by extension from the diff output -
generate.shandgenerate.ps1support--exclude-pathto exclude files by path prefix from the diff output -
list-changed-files.shandlist-changed-files.ps1support comma-separated--typevalues (e.g.,--type added,modified,renamed) -
list-changed-files.shandlist-changed-files.ps1support--exclude-typeas an alternative to--typefor exclusion-based filtering -
SKILL.mdParameters Reference table is updated to document all new flags - Pester tests cover all new parameters and edge cases (empty results, invalid inputs, combined flags)
- Pester test code coverage for pr-reference scripts is above 80%
- Bash scripts pass
shellcheckvalidation - PowerShell scripts pass
PSScriptAnalyzervalidation (npm run lint:ps) - All existing tests continue to pass (
npm run test:ps) - Collection manifests are updated if any paths change (
collections/hve-core.collection.yml,collections/hve-core-all.collection.yml,collections/ado.collection.yml) - Plugin outputs are regenerated (
npm run plugin:generate) and pass validation (npm run plugin:validate) - All CI checks pass (
npm run lint:all,npm run validate:skills) - Manually test calling the skill with the requirement to call the right script with the newer parameters, and validate the correct scripts execute the required
gitcommands.
Unit Testing and Code Coverage Requirements
Pester tests are required for all new parameters across the PowerShell scripts. Test code coverage for pr-reference scripts must exceed 80%. The --no-md-diff flag in generate.sh/generate.ps1 serves as the closest existing pattern for the new exclusion flags.
RPI Framework Starter Prompts
Phase 1: Research
Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Research enhancing the pr-reference skill with flexible filtering and base branch detection. Review the details from issue
#1011. Investigate: (1) Readgenerate.shandgenerate.ps1fully to understand how--no-md-diffand--base-branchare implemented. (2) Readlist-changed-files.shandlist-changed-files.ps1to understand the--typefiltering logic. (3) Readshared.psm1for shared helper functions. (4) Review git documentation forgit merge-baseandgit symbolic-ref refs/remotes/origin/HEADbehavior. (5) Check existing Pester test coverage inscripts/tests/. (6) Checkcodecov.ymlandscripts/tests/pester.config.ps1for coverage requirements. (7) Verify how--exclude-extand--exclude-pathmap to git pathspec patterns.
Phase 2: Plan
Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Plan enhancing the pr-reference skill using the research document (attach it from above result).
Phase 3: Implement
Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane. Attach the ....instructions.md generated by the Planner, then send the following prompt:
Implement the pr-reference skill enhancements following the plan attached.
Phase 4: Review
Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Review pr-reference skill enhancements. Verify the initial research and plan (attach the files), and cross check with the issue content.
References
.github/skills/shared/pr-reference/scripts/generate.sh— bash diff generation.github/skills/shared/pr-reference/scripts/generate.ps1— PowerShell diff generation.github/skills/shared/pr-reference/scripts/list-changed-files.sh— bash file listing.github/skills/shared/pr-reference/scripts/list-changed-files.ps1— PowerShell file listing.github/skills/shared/pr-reference/scripts/shared.psm1— shared PowerShell helpers.github/skills/shared/pr-reference/SKILL.md— skill documentation