Repository navigation
Replies: 5 comments 4 replies
|
Claude Code Stop Hook for inline response review I wanted a way to review and annotate Claude's responses inline instead of copy-paste line and annotate it then, so I wired revdiff directly into the Claude Code hook system. How it works: Claude Code fires a Stop event every time the assistant finishes a response. I added a shell hook that extracts Annotation headers get enriched with the actual line content before being sent back, so Claude sees Config knobs:
Hook looks like: Thanks for building revdiff — the --stdin + --stdin-name combo made this trivially easy to wire up. |
|
another Claude Code one — revdiff as the approval gate for every outbound gh/glab/tea post. the idea: Claude Code writes PR descriptions, review comments, issue comments, MR notes, release notes all day. depending on the skill, some print the draft in the terminal first — but there's no way to annotate it inline. to give real feedback you'd have to cut-paste parts of the response and type comments next to them manually. revdiff turns that into a proper line-annotation workflow before the text leaves. two pieces wired together: 1. ~/.claude/scripts/draft-review.sh /tmp/draft-pr.mdwhere LAUNCHER="$HOME/.claude/plugins/marketplaces/revdiff/.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh"
output=$("$LAUNCHER" --wrap --only="$DRAFT_FILE" 2>&1) || true
echo "$output"empty output = user approved → post it. non-empty = user annotated → rewrite and re-run. loop until approved. 2. what I actually get out of this in practice:
|
|
Thin wrapper script around revdiff that lets you select files by directory.
I use it to review plans generated by spec kit frameworks (now I use get-shit-done), I asked claude to run revdiff-dir with --dir pointing to the phase directory that contains the planning Markdown files after the planning skill finished. Example: revdiff-dir
--- |
|
To adapt revdiff skill to GSD phase plans I've updated my CLAUDE.md instead of using script above. GSD generates verbose, detailed plans per phase with code changes and agent-specific tags and it's difficult for people to read. I added instructions to CLAUDE.md how to customize revdiff skill. It can summarize the plans into human-readable format, save them to a temp file, then continue with revdiff skill as usual.
It's not immediately obvious to me, but you can customize external skills in CLAUDE.md, I just figured it out. Added to CLAUDE.md |
|
My typical workflow is deliberately simple: no agent hooks or skills. I run The base wrapper writes revdiff’s annotations to a temporary file, then sends them through # Run revdiff with --output and copy non-empty annotations.
[private]
_revdiff-with-copy *args:
#!/usr/bin/env bash
set -euo pipefail
tmp=$(mktemp)
cleanup() {
rm -f "$tmp"
}
trap cleanup EXIT
set +e
revdiff --output "$tmp" "$@"
status=$?
set -e
if [[ -s "$tmp" ]]; then
just -g osc-copy <"$tmp"
fi
exit "$status"
# Copy stdin to the local terminal clipboard via OSC 52, echoing it back.
osc-copy:
#!/usr/bin/env bash
set -euo pipefail
tmp=$(mktemp)
cleanup() {
rm -f "$tmp"
}
trap cleanup EXIT
tee "$tmp"
data=$(base64 <"$tmp" | tr -d "\n")
if ! printf "\e]52;c;%s\a" "$data" 2>/dev/null >/dev/tty; then
printf "\e]52;c;%s\a" "$data" >&2
fiI add three small convenience wrappers around the base command: # Current working-tree changes, including untracked files.
r-cur:
@just -g _revdiff-with-copy --untracked
# Last commit.
r-last:
@just -g _revdiff-with-copy HEAD~1
# Branch changes since it diverged from main, including untracked files.
r-branch:
@just -g _revdiff-with-copy --untracked "$(git merge-base main HEAD)"Most of the time I use |
Uh oh!
There was an error while loading. Please reload this page.
Want to share small fzf loop that
tested on macOS
All reactions