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 <agent>` 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).
This commit is contained in:
1 parent
f8b17a79d3
commit
4e2452e994
6 files changed
+92
-1
No files matched your search
@@ -142,6 +142,21 @@ go)
|
||||
exit 0 ;;
|
||||
esac
|
||||
exit 0 ;;
|
||||
herdr)
|
||||
# `herdr integration status` lists one `<agent>: <state> (...)` 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
|
||||
|
||||
@@ -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
|
||||
<<<OLD
|
||||
install_uv "$(col uv)"
|
||||
herdr_integrations
|
||||
<<<NEW
|
||||
install_uv "$(col uv)"
|
||||
<<<END
|
||||
@@ -0,0 +1,9 @@
|
||||
# what: herdr's `current` status is ignored and every integration is reinstalled
|
||||
# why: each run rewrites hook files herdr already manages; not idempotent
|
||||
# kills: …but not one herdr reports current
|
||||
# run: unit
|
||||
<<<OLD
|
||||
*": current"*) continue ;;
|
||||
<<<NEW
|
||||
*": currentXX"*) continue ;;
|
||||
<<<END
|
||||
+4
-1
@@ -44,7 +44,10 @@ FAKE='curl apt-get apt-cache brew npm uv snap flatpak xcode-select
|
||||
# absent is what makes those script rows actually run; the
|
||||
# installers they fetch drop fakes like every other one here.
|
||||
# fc-cache absent is a fresh container; the font rows say so and carry on.
|
||||
OPTIONAL='sudo fzf bws nvim go node docker claude rustup claude-desktop fc-cache'
|
||||
# herdr, codex, pi, omp
|
||||
# absent is a box with no herdr, where the integration step must say
|
||||
# nothing; a test that wants them adds them with --with.
|
||||
OPTIONAL='sudo fzf bws nvim go node docker claude rustup claude-desktop fc-cache herdr codex pi omp'
|
||||
|
||||
dir=${1:?usage: seal.sh <dir> [--with name ...] [--without name ...]}; shift
|
||||
# Everything the seal KNOWS about, fixed before --without takes anything out: a
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user