diff --git a/.claude/settings.json b/.claude/settings.json index 90a00f426..16721c97e 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -44,6 +44,7 @@ "Bash(make)", "Bash(tea *)", + "Bash(tooling/tea-comment *)", "Bash(chmod *)", "Bash(ls *)", diff --git a/.claude/skills/pr-review/SKILL.md b/.claude/skills/pr-review/SKILL.md index c072787cb..08cb8d438 100644 --- a/.claude/skills/pr-review/SKILL.md +++ b/.claude/skills/pr-review/SKILL.md @@ -174,19 +174,11 @@ 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. -**IMPORTANT — `tea comment` hangs with inline heredocs and multi-line strings.** -Always use a two-step approach: write to a temp file first, then pass via `$(cat)`: +Post using the `tea-comment` wrapper (handles temp files and cleanup): +```bash +tooling/tea-comment "review markdown here" ``` -# Step 1: Write review to .tmp/ using the Write tool (no permission prompt) -Write(file_path: "/.tmp/review-.md", content: "...review content...") - -# Step 2: Post to Gitea (separate Bash call) -tea comment --login schweitz --repo jpmschweitzer/settled-reach "$(cat .tmp/review-.md)" -``` - -Use the Write tool for step 1 (avoids Bash permission prompts). The `.tmp/` -directory is gitignored and exists in the repo root for this purpose. ## 7. Merging approved PRs diff --git a/CLAUDE.md b/CLAUDE.md index 2f5022eea..a5860da7a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -121,7 +121,7 @@ tea pr list --login schweitz --repo jpmschweitzer/settled-reach --state open --o tea pr --login schweitz --repo jpmschweitzer/settled-reach --comments -o simple # Post a comment on a PR (or issue) -tea comment --login schweitz --repo jpmschweitzer/settled-reach "comment body" +tooling/tea-comment "comment body" # Approve a PR tea pr approve --login schweitz --repo jpmschweitzer/settled-reach @@ -133,12 +133,7 @@ tea issue list --login schweitz --repo jpmschweitzer/settled-reach --state open Key rules: - **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) -- **`tea comment` hangs with inline heredocs and multi-line strings.** Always write the comment body to a temp file first, then pass it via `$(cat)`: - ```bash - # Step 1: Write content to .tmp/ (gitignored) using the Write tool - # Step 2: Post via cat - tea comment --login schweitz --repo jpmschweitzer/settled-reach "$(cat .tmp/review-branch.md)" - ``` +- **For comments, use `tooling/tea-comment "body"`** — handles temp files and cleanup automatically. Works with multi-line strings. - **`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/tooling/tea-comment b/tooling/tea-comment new file mode 100755 index 000000000..42fcd6252 --- /dev/null +++ b/tooling/tea-comment @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Post a comment to a Gitea PR or issue. +# Usage: tea-comment "comment body" +set -euo pipefail + +if [[ $# -lt 2 ]]; then + echo "Usage: tea-comment " >&2 + exit 1 +fi + +NUMBER="$1" +BODY="$2" +HASH=$(echo -n "$BODY" | md5sum | cut -c1-8) +TMPFILE="/tmp/tea-comment-${NUMBER}-${HASH}.md" +trap 'rm -f "$TMPFILE"' EXIT + +printf '%s' "$BODY" > "$TMPFILE" +tea comment --login schweitz --repo jpmschweitzer/settled-reach "$NUMBER" "$(cat "$TMPFILE")"