#!/usr/bin/env bash
# pql: source .pql/hooks/post-rewrite
_pql_hook="$(git rev-parse --show-toplevel)/.pql/hooks/post-rewrite"; [ -f "$_pql_hook" ] && . "$_pql_hook"
# Post-rewrite hook (fires after `git rebase` / `git commit --amend`). Folds in
# pql's planning logic; its .pql/hooks installer is dead under
# core.hooksPath=.config/hooks.
#
# Rewriting history can reorder or drop changelog edits, so a full rebuild from
# the changelog is the safe, deterministic refresh (incremental replay would miss
# removals — D-16).
if command -v pql >/dev/null 2>&1; then
    pql plan rebuild >/dev/null 2>&1 || true
fi
