Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(review-pr): use JSON payload for review comments instead of broken -f flag syntax (#1410)

worktrunk-bota790c0b7ce8e
diff --git a/.claude/skills/review-pr/SKILL.md b/.claude/skills/review-pr/SKILL.md
index 977565f87..12a277c64 100644
--- a/.claude/skills/review-pr/SKILL.md
+++ b/.claude/skills/review-pr/SKILL.md
@@ -333,17 +333,32 @@ the diff, offer to push a fix commit instead.
**Correct — inline suggestion on the line:**
`````bash
+cat > /tmp/review-payload.json << 'ENDJSON'
+{
+ "event": "COMMENT",
+ "comments": [
+ {
+ "path": ".claude/skills/example/SKILL.md",
+ "line": 3,
+ "body": "```suggestion\ndescription: new text here\n```"
+ }
+ ]
+}
+ENDJSON
+
+# Read body from file to avoid shell expansion issues
+BODY=$(cat /tmp/review-body.md)
+jq --arg body "$BODY" '.body = $body' /tmp/review-payload.json > /tmp/review-final.json
+
gh api "repos/$REPO/pulls/<number>/reviews" \
--method POST \
- -f event=COMMENT \
- -f body="Summary of suggestions" \
- -f 'comments[0][path]=.claude/skills/example/SKILL.md' \
- -f 'comments[0][line]=3' \
- -f 'comments[0][body]=```suggestion
-description: new text here
-```'
+ --input /tmp/review-final.json
`````
+**Do not** use `-f 'comments[0][path]=...'` flag syntax — `gh api` converts
+array indices to object keys (`{"0": {...}}` instead of `[{...}]`), which
+GitHub rejects.
+
- Use suggestions for any small fix — no limit on count.
- If a review has both suggestions and prose observations, put the suggestions
as inline comments and the prose in the review body.