mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(agent hooks): wire hooks into real harness entry points and fix payload parsing
Claude Code never reads a standalone .claude/hooks.json, so the PostToolUse and Stop pipeline is moved into .claude/settings.json and hooks.json is removed; .cursor/hooks.json is rewritten in Cursor's version+afterFileEdit/stop schema; .codex/hooks.json is already Codex-valid and stays. The shared scripts now parse both the Cursor file_path and Claude/Codex tool_input.file_path stdin shapes and normalize absolute paths, so the format, yarn-install, and react-pattern-review hooks stop being silent no-ops. verify.sh blocks with exit 2 plus a stderr reason, guards stop_hook_active, and skips clean trees; react-pattern-review surfaces its reminder via hookSpecificOutput on PostToolUse; sync-git-branches no longer misreports open PRs as merged. The validator now checks that the three harness-specific entry points wire the same hook scripts instead of requiring byte-identical hooks.json copies.
This commit is contained in:
@@ -45,6 +45,7 @@ branch_has_live_upstream() {
|
||||
merged_pr_number_for_branch() {
|
||||
local branch="$1"
|
||||
local pr_number=""
|
||||
local merged_at=""
|
||||
|
||||
if ! command -v gh >/dev/null 2>&1; then
|
||||
return 0
|
||||
@@ -60,7 +61,10 @@ merged_pr_number_for_branch() {
|
||||
esac
|
||||
|
||||
if [ -n "$pr_number" ]; then
|
||||
gh pr view "$pr_number" --repo bitsocialnet/5chan --json mergedAt --jq 'select(.mergedAt != null) | .mergedAt' >/dev/null 2>&1 || return 0
|
||||
# gh exits 0 even when the PR exists but is unmerged (the jq select just
|
||||
# produces no output), so test the output instead of the exit code.
|
||||
merged_at="$(gh pr view "$pr_number" --repo bitsocialnet/5chan --json mergedAt --jq 'select(.mergedAt != null) | .mergedAt' 2>/dev/null || true)"
|
||||
[ -n "$merged_at" ] || return 0
|
||||
echo "$pr_number"
|
||||
return 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user