From 2f8218400dd6a0976902188dff216f1888f2f882 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Fri, 13 Mar 2026 09:44:11 +0100 Subject: [PATCH] chore(skills): tea-comment @filepath support and docs update tea-comment now accepts @/path/to/file.md syntax to read comment body from a file, avoiding $() subshells that break permission matching. Updated pr-review skill and tea-cli rules with the new pattern. Co-Authored-By: Claude Opus 4.6 --- .claude/rules/tea-cli.md | 7 ++++--- .claude/skills/pr-review/SKILL.md | 9 +++++++-- tooling/tea-comment | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.claude/rules/tea-cli.md b/.claude/rules/tea-cli.md index 34c8ea5e3..7813c40cb 100644 --- a/.claude/rules/tea-cli.md +++ b/.claude/rules/tea-cli.md @@ -11,8 +11,9 @@ tea pr list --login schweitz --repo jpmschweitzer/settled-reach --state open --o # View a PR with comments tea pr --login schweitz --repo jpmschweitzer/settled-reach --comments -o simple -# Post a comment on a PR (or issue) -tooling/tea-comment "comment body" +# Post a comment on a PR (or issue) — use @filepath for long comments +tooling/tea-comment @/tmp/review.md +tooling/tea-comment "short inline comment" # Approve a PR tea pr approve --login schweitz --repo jpmschweitzer/settled-reach @@ -25,7 +26,7 @@ tea issue list --login schweitz --repo jpmschweitzer/settled-reach --state open - **All flags must be explicit** — omitting `--login` or `--repo` triggers interactive prompts that crash in Claude Code (no TTY) - **Use `--output simple`** for machine-readable output (no table borders) -- **For comments, use `tooling/tea-comment "body"`** — handles temp files and cleanup automatically. Works with multi-line strings. +- **For comments, use `tooling/tea-comment @/tmp/file.md`** for long comments (write to file first, then pass `@filepath`). Short inline strings also work: `tooling/tea-comment "body"`. The `@filepath` form avoids `$()` subshells which break permission matching. - **`tea pr reject` does not work on your own PRs** — use `tea comment` instead - **Never delete protected branches:** `main`, `maintenance`, `server`, `client`, `copy`, `audio`, `visual`, `ci` are protected on Gitea. Do not use `tea pr clean`, `git push --delete`, or `git branch -D` on these branches. diff --git a/.claude/skills/pr-review/SKILL.md b/.claude/skills/pr-review/SKILL.md index df9fd1d26..dffc78e46 100644 --- a/.claude/skills/pr-review/SKILL.md +++ b/.claude/skills/pr-review/SKILL.md @@ -185,10 +185,15 @@ After presenting results to the user, post the review as a PR comment. Note: `tea pr reject` does not work on your own PRs. Use `tea comment` instead. -Post using the `tea-comment` wrapper (handles temp files and cleanup): +Post using the `tea-comment` wrapper (handles temp files and cleanup). +Write the review to a temp file first, then pass via `@filepath` syntax: ```bash -tooling/tea-comment "review markdown here" +# Write review to file, then post — avoids $() in the command which breaks permissions +cat > /tmp/pr-review-.md << 'EOF' +...review content... +EOF +tooling/tea-comment @/tmp/pr-review-.md ``` ## 7. Merging approved PRs diff --git a/tooling/tea-comment b/tooling/tea-comment index 42fcd6252..971496cfe 100755 --- a/tooling/tea-comment +++ b/tooling/tea-comment @@ -1,15 +1,29 @@ #!/usr/bin/env bash # Post a comment to a Gitea PR or issue. # Usage: tea-comment "comment body" +# tea-comment @/path/to/file.md set -euo pipefail if [[ $# -lt 2 ]]; then - echo "Usage: tea-comment " >&2 + echo "Usage: tea-comment " >&2 exit 1 fi NUMBER="$1" -BODY="$2" +INPUT="$2" + +# If the body starts with @, read from file +if [[ "$INPUT" == @* ]]; then + FILEPATH="${INPUT#@}" + if [[ ! -f "$FILEPATH" ]]; then + echo "Error: file not found: $FILEPATH" >&2 + exit 1 + fi + BODY=$(cat "$FILEPATH") +else + BODY="$INPUT" +fi + HASH=$(echo -n "$BODY" | md5sum | cut -c1-8) TMPFILE="/tmp/tea-comment-${NUMBER}-${HASH}.md" trap 'rm -f "$TMPFILE"' EXIT