Skip to content

Commit a84cb75

Browse files
authored
fix(ce-commit-push-pr): use body-file for PR descriptions (#757)
1 parent caf5e12 commit a84cb75

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

  • plugins/compound-engineering/skills/ce-commit-push-pr

plugins/compound-engineering/skills/ce-commit-push-pr/SKILL.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,22 @@ Use the current branch and existing PR check from context. If the current branch
7171

7272
**Compare and confirm.** Briefly explain what the new description covers differently from the old one. Ask the user to confirm before applying. If the user provided focus, confirm it was addressed.
7373

74-
If confirmed, apply with `gh pr edit`. Substitute `<TITLE>` verbatim; if it contains `"`, `` ` ``, `$`, or `\`, escape them or switch to single quotes. The body is best written to a temp file first to avoid shell-escaping the whole markdown body:
74+
If confirmed, apply with `gh pr edit`. Substitute `<TITLE>` verbatim; if it contains `"`, `` ` ``, `$`, or `\`, escape them or switch to single quotes.
75+
76+
The body **must** be written to a temp file and passed via `--body-file <path>`. Never use `--body-file -`, stdin pipes, heredoc-to-stdin, or `--body "$(cat ...)"` — wrappers and stdin handling can silently produce an empty PR body while `gh` still exits 0 and returns a URL.
7577

7678
```bash
7779
BODY_FILE=$(mktemp "${TMPDIR:-/tmp}/ce-pr-body.XXXXXX") && cat > "$BODY_FILE" <<'__CE_PR_BODY_END__'
7880
<the composed body markdown goes here, verbatim>
7981
__CE_PR_BODY_END__
80-
gh pr edit --title "<TITLE>" --body "$(cat "$BODY_FILE")"
8182
```
8283

8384
The quoted sentinel keeps `$VAR`, backticks, and any literal `EOF` inside the body from being expanded.
8485

86+
```bash
87+
gh pr edit --title "<TITLE>" --body-file "$BODY_FILE"
88+
```
89+
8590
Report the PR URL.
8691

8792
---
@@ -178,7 +183,9 @@ When evidence is not possible (docs-only, markdown-only, changelog-only, release
178183
179184
### Step 7: Create or update the PR
180185
181-
Apply via `gh pr create` (new PR) or `gh pr edit` (existing PR). The body is best written to a temp file first to avoid shell-escaping the whole markdown body. Substitute `<TITLE>` verbatim; if it contains `"`, `` ` ``, `$`, or `\`, escape them or switch to single quotes:
186+
Apply via `gh pr create` (new PR) or `gh pr edit` (existing PR). Substitute `<TITLE>` verbatim; if it contains `"`, `` ` ``, `$`, or `\`, escape them or switch to single quotes.
187+
188+
The body **must** be written to a temp file and passed via `--body-file <path>`. Never use `--body-file -`, stdin pipes, heredoc-to-stdin, or `--body "$(cat ...)"` — wrappers and stdin handling can silently produce an empty PR body while `gh` still exits 0 and returns a URL.
182189
183190
```bash
184191
BODY_FILE=$(mktemp "${TMPDIR:-/tmp}/ce-pr-body.XXXXXX") && cat > "$BODY_FILE" <<'__CE_PR_BODY_END__'
@@ -191,7 +198,7 @@ The quoted sentinel keeps `$VAR`, backticks, and any literal `EOF` inside the bo
191198
#### New PR (no existing PR from Step 3)
192199
193200
```bash
194-
gh pr create --title "<TITLE>" --body "$(cat "$BODY_FILE")"
201+
gh pr create --title "<TITLE>" --body-file "$BODY_FILE"
195202
```
196203
197204
Keep the title under 72 characters; the writing reference already emits a conventional-commit title in that range.
@@ -207,7 +214,7 @@ The new commits are already on the PR from Step 5. Report the PR URL, then ask w
207214
3. If confirmed, apply with `gh pr edit`:
208215
209216
```bash
210-
gh pr edit --title "<TITLE>" --body "$(cat "$BODY_FILE")"
217+
gh pr edit --title "<TITLE>" --body-file "$BODY_FILE"
211218
```
212219
213220
Then report the PR URL (Step 8).

0 commit comments

Comments
 (0)