From cf0e934bb8d0a1dafeb81c3f9f72616f1db26eaf Mon Sep 17 00:00:00 2001 From: Marcin Pawlowski Date: Thu, 30 Jul 2026 17:54:13 +0200 Subject: [PATCH] Importing rfc-pr skill for filling the PR description based on branch changes --- tools/skills/rfc-pr/SKILL.md | 163 +++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 tools/skills/rfc-pr/SKILL.md diff --git a/tools/skills/rfc-pr/SKILL.md b/tools/skills/rfc-pr/SKILL.md new file mode 100644 index 0000000..a53732c --- /dev/null +++ b/tools/skills/rfc-pr/SKILL.md @@ -0,0 +1,163 @@ +--- +name: rfc-pr +description: "Fill in a GitHub PR description for a Logos spec change using the canonical RFC-PR template. Fetches the up-to-date template from the logos-blockchain/research repo, drafts every section from the current branch's diff vs master, writes RFC-PR-.md, then sets it as the PR body — creating the PR with `gh pr create` if none exists, or updating it with `gh pr edit`. Trigger: /rfc-pr." +--- + +# /rfc-pr + +Produce a filled-in PR description for a Logos specification-change PR by applying the +canonical **RFC-PR** template to the changes on the current branch, then set it as the +PR body on GitHub. + +## Usage + +``` +/rfc-pr # draft from current branch vs master, write file, push to the branch's PR +/rfc-pr # target a specific PR instead of the current branch's PR +/rfc-pr --base # diff against a base other than origin/master +/rfc-pr --no-push # write the Markdown file only; do not touch the GitHub PR +/rfc-pr --ref # fetch the template from a ref other than master +``` + +## Configuration (defaults) + +- **Template source repo:** `logos-blockchain/research` +- **Template path:** `templates/RFC-PR.md` +- **Base branch for the diff:** `origin/master` + +These are the defaults for the Logos research repo. If invoked in another repo whose +template lives elsewhere, adjust the repo/path accordingly (ask the user if unsure). + +## Procedure + +Follow these steps in order. Use the session scratchpad for all intermediate files. + +### 1. Establish branch / PR context + +```bash +git rev-parse --abbrev-ref HEAD # current branch — must NOT be master/main +gh pr view --json number,title,url,body,baseRefName,headRefName 2>/dev/null +``` + +- If a PR number was passed as an argument, use `gh pr view ...` instead. +- If no PR exists for the branch, that is fine — you will **create** one in step 6 using + the drafted description as its body. Note it as "no PR yet → will create". +- If a PR does exist, note whether it **already has a non-empty body** — you will confirm + before overwriting it in step 6. +- Ensure the branch is pushed to the remote before creating a PR + (`git push -u origin ` if it has no upstream); a PR cannot be opened otherwise. + +### 2. Fetch the up-to-date template (do NOT rely on any local copy) + +```bash +gh api repos/logos-blockchain/research/contents/templates/RFC-PR.md \ + -H "Accept: application/vnd.github.raw" > "$SCRATCH/RFC-PR.template.md" +``` + +Add `?ref=` to the path if `--ref` was given. Fallbacks, in order, only if the +`gh api` call fails: + +1. `git show origin/master:templates/RFC-PR.md` (if inside the research repo) +2. the local working-tree file `templates/RFC-PR.md` + +If every source fails, stop and report — do not invent a template structure. + +### 3. Gather the change content from git + +Compute the merge base and inspect the branch's changes against the base: + +```bash +BASE=$(git merge-base HEAD origin/master) +git diff --stat "$BASE"...HEAD # inventory of changed files +git diff "$BASE"...HEAD -- '*.md' '*.py' # full diff of spec/code changes +``` + +- Treat changed specification documents (Markdown/spec files) as the **Affected + Specifications**. Classify each as Created / Modified / Deprecated / Retired from the + diff (added file = Created, deleted = Retired, etc.). +- Read the changed files where the diff alone is ambiguous. +- Also read recent commit messages on the branch for intent: + `git log --format='%s%n%b' "$BASE"..HEAD`. + +### 4. Draft the filled-in description + +Parse the template's section structure, then write real content for each section. The +template's `