From 177698fb4ad6cff0aede0761327a7cfdefcd4f74 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 16:35:11 +0100 Subject: [PATCH] ref(docs): Avoid shell redirects in PR workflow docs Replace shell redirect examples (>, >>, |, &&) with Write/Edit tool instructions in pr.mdc and create-java-pr skill. This prevents permission prompt spam when agents update PR descriptions, since compound shell commands don't match simple permission patterns. --- .claude/skills/create-java-pr/SKILL.md | 14 +++++++++----- .cursor/rules/pr.mdc | 16 +++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index cb2618e647..6d5bb34edb 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -123,6 +123,12 @@ Skip this step for standalone PRs. After creating the PR, update the PR description on **every other PR in the stack — including the collection branch PR** — so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". +**Important:** When updating PR bodies, never use shell redirects (`>`, `>>`) or pipes (`|`) or compound commands (`&&`). These create compound shell expressions that won't match permission patterns. Instead: +- Use `gh pr view --json body --jq '.body'` to get the body (output returned directly) +- Use the `Write` tool to save it to a temp file +- Use the `Edit` tool to modify the temp file +- Use `gh pr edit --body-file /tmp/pr-body.md` to update + ## Step 6: Update Changelog First, determine whether a changelog entry is needed. **Skip this step** (and go straight to "No changelog needed" below) if the changes are not user-facing, for example: @@ -173,8 +179,6 @@ git push If no changelog entry is needed, add `#skip-changelog` to the PR description to disable the changelog CI check: -```bash -gh pr view --json body --jq '.body' > /tmp/pr-body.md -printf '\n#skip-changelog\n' >> /tmp/pr-body.md -gh pr edit --body-file /tmp/pr-body.md -``` +1. Get the current body: `gh pr view --json body --jq '.body'` +2. Use the `Write` tool to save the output to `/tmp/pr-body.md`, appending `\n#skip-changelog\n` at the end +3. Update: `gh pr edit --body-file /tmp/pr-body.md` diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index df35ee3b94..139a30eca8 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -223,19 +223,13 @@ No status column — GitHub already shows that. The `---` separates the stack li This does not apply to standalone PRs or the collection branch PR. -To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body: +To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body. -```bash -# Get current PR description into a temp file -gh pr view --json body --jq '.body' > /tmp/pr-body.md - -# Edit /tmp/pr-body.md to prepend or replace the stack list section -# (replace everything from "## PR Stack" up to and including the "---" separator, -# or prepend before the existing description if no stack list exists yet) +**Important:** Do not use shell redirects (`>`, `>>`, `|`) or compound commands (`&&`, `||`). These create compound shell expressions that won't match permission patterns. Instead, use the `Write` and `Edit` tools for file manipulation: -# Update the description -gh pr edit --body-file /tmp/pr-body.md -``` +1. Read the current body with `gh pr view --json body --jq '.body'` (the output is returned directly — use the `Write` tool to save it to `/tmp/pr-body.md`) +2. Use the `Edit` tool to prepend or replace the stack list section in `/tmp/pr-body.md` +3. Update the description: `gh pr edit --body-file /tmp/pr-body.md` ### Merging Stacked PRs (done by the user, not the agent)