From 4e2452e99487a1b2514861df20adb811619982f7 Mon Sep 17 00:00:00 2001 From: bcherb2 Date: Wed, 18 Nov 2026 02:13:05 -0500 Subject: [PATCH] feat: install herdr agent integrations after the install pipeline herdr hook files are herdr-managed, so none is committed. The installer ends by running `herdr integration install ` for each of claude, codex, pi and omp that is present, skipping any herdr already reports current and saying nothing when herdr is absent. Seal and fake learn herdr; tests and two mutations cover install, idempotence, failure and absence (G-AG-5). --- .tests/fakebin/_fake | 15 ++++++++++ .../33-herdr-integrations-never-run.mut | 10 +++++++ ...-herdr-reinstalls-current-integrations.mut | 9 ++++++ .tests/seal.sh | 5 +++- .tests/test.sh | 30 +++++++++++++++++++ dot_local/bin/executable_dotup | 24 +++++++++++++++ 6 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 .tests/mutations/33-herdr-integrations-never-run.mut create mode 100644 .tests/mutations/34-herdr-reinstalls-current-integrations.mut diff --git a/.tests/fakebin/_fake b/.tests/fakebin/_fake index 4087af4..e3ee3f0 100755 --- a/.tests/fakebin/_fake +++ b/.tests/fakebin/_fake @@ -142,6 +142,21 @@ go) exit 0 ;; esac exit 0 ;; +herdr) + # `herdr integration status` lists one `: (...)` line per + # integration; FAKE_HERDR_CURRENT names the agents to report `current`, + # every other one is `not installed`. `install` is only logged. + case ${1:-}:${2:-} in + integration:status) + for _a in pi omp claude codex copilot; do + case " ${FAKE_HERDR_CURRENT:-} " in + *" $_a "*) printf '%s: current (v11) (%s/.fake/%s)\n' "$_a" "$HOME" "$_a" ;; + *) printf '%s: not installed (%s/.fake/%s)\n' "$_a" "$HOME" "$_a" ;; + esac + done ;; + integration:install) [ "$mode" = install ] && exit 1 ;; + esac + exit 0 ;; fzf) # The picker's own fzf, and the only fake here whose ARGV is the thing # under test. `--bind` strings are built across a dozen continued lines, so diff --git a/.tests/mutations/33-herdr-integrations-never-run.mut b/.tests/mutations/33-herdr-integrations-never-run.mut new file mode 100644 index 0000000..849f7d2 --- /dev/null +++ b/.tests/mutations/33-herdr-integrations-never-run.mut @@ -0,0 +1,10 @@ +# what: the install pipeline no longer ends with herdr's integration step +# why: a new laptop gets herdr with no agent hooks: panes show no agent state +# kills: herdr installs the claude integration +# run: unit +<< [--with name ...] [--without name ...]}; shift # Everything the seal KNOWS about, fixed before --without takes anything out: a diff --git a/.tests/test.sh b/.tests/test.sh index 5f4d299..b85049a 100755 --- a/.tests/test.sh +++ b/.tests/test.sh @@ -784,6 +784,36 @@ is "darwin: …after asking for sudo, which NONINTERACTIVE cannot" "yes" \ [ -n "$a" ] && [ -n "$b" ] && [ "$a" -lt "$b" ] && echo yes || echo "no [$a/$b]")" hasnt "darwin: no apt prerequisites on a machine with no apt" "apt-get" "$dry" +printf '\n\033[1mherdr installs its own agent integrations\033[0m\n' +# G-AG-5: herdr's hook files say "managed by herdr", so none is committed and +# herdr writes them. One per agent that is actually present, none for one +# herdr already reports current, and silence on a box with no herdr at all. +newbox; sh ./seal.sh "$SB/seal" --with herdr claude codex >/dev/null; BOXPATH=$SB/seal +BOXENV='FAKE_HERDR_CURRENT=codex'; pick core/ripgrep +out=$(box install 2>&1 | plain || true) +is "herdr installs the claude integration" "1" \ + "$(grep -c '^herdr integration install claude$' "$LOG" || true)" +is "…but not one herdr reports current" "0" \ + "$(grep -c '^herdr integration install codex' "$LOG" || true)" +is "…nor one for an agent that is not here" "0" \ + "$(grep -cE '^herdr integration install (pi|omp)' "$LOG" || true)" +: > "$LOG"; BOXENV='FAKE_HERDR_CURRENT=claude codex' +out=$(box install 2>&1 | plain || true) +is "a second run installs nothing" "0" \ + "$(grep -c '^herdr integration install' "$LOG" || true)" +hasnt "…and prints no herdr section" "herdr integrations" "$out" +BOXENV='FAKE_FAIL=herdr:install' +out=$(box install 2>&1 | plain || true) +has "a failed integration is named" "herdr integration install claude failed" "$out" +newbox; sh ./seal.sh "$SB/seal" --with claude codex >/dev/null; BOXPATH=$SB/seal +if grep -q '^herdr ' "$SB/seal/.shadowed" 2>/dev/null; then + printf ' \033[33mskip\033[0m herdr sits at an absolute path find_tool probes\n' +else + pick core/ripgrep + out=$(box install 2>&1 | plain || true) + hasnt "with no herdr the step says nothing" "herdr" "$out" +fi + printf '\n\033[1mclaude desktop trusts only Anthropic'"'"'s key\033[0m\n' # A vendor apt repository is a key apt will trust for root-installed packages, # so the key is checked against the published fingerprint before it is placed. diff --git a/dot_local/bin/executable_dotup b/dot_local/bin/executable_dotup index 7e8ed59..ed4a006 100755 --- a/dot_local/bin/executable_dotup +++ b/dot_local/bin/executable_dotup @@ -1196,6 +1196,29 @@ install_bespoke() { done } +# herdr's per-agent hooks (claude, codex, pi, omp) are herdr's own files: +# "managed by herdr; reinstalling or updating the integration overwrites this +# file". A committed copy drifts against every herdr upgrade, so none is +# committed and herdr installs them itself. Last in the pipeline because every +# channel that delivers an agent -- script, brew, npm -- has run by then. An +# integration herdr already reports `current` is left alone; no herdr at all is +# not this run's business and says nothing. +herdr_integrations() { + have herdr || return 0 + HERDR=$(find_tool herdr) + hst=$("$HERDR" integration status 2>/dev/null || :) + hd= + for ag in claude codex pi omp; do + have "$ag" || continue + case $(printf '%s\n' "$hst" | grep "^$ag: " || :) in + *": current"*) continue ;; + esac + [ -n "$hd" ] || { head_ "herdr integrations"; hd=1; } + run_sh "'$HERDR' integration install $ag" \ + || warn "herdr integration install $ag failed — agent state will not show in herdr" + done +} + cmd_install() { # A cron job re-running `--unattended install` gets its SAVED selection -- # that contract stands. But on a box where nothing was ever chosen, @@ -1255,6 +1278,7 @@ cmd_install() { install_flatpak "$(col flatpak)" install_npm "$(col npm)" install_uv "$(col uv)" + herdr_integrations rm -f "$tbl" if [ -s "$FAILED" ]; then