diff --git a/components/hoxay/README.md b/components/hoxay/README.md index edd69150..e006ae12 100644 --- a/components/hoxay/README.md +++ b/components/hoxay/README.md @@ -40,6 +40,7 @@ of scope — the herdr TUI keeps its existing operation there. | launch | `launch.sh` | `launch.ps1` | | verify | `verify.sh [--live]` | `verify.ps1 [-Live]` | | rollback | `rollback.sh` | `rollback.ps1` | +| plugins | `plugin-set.sh [--check]` | `plugin-set.ps1 [-Check]` | macOS stages the built `.app` into `~/Applications` so it behaves like a normal app (Finder, Spotlight, Launch Services, Dock). Windows keeps the @@ -69,13 +70,44 @@ the named-pipe endpoint `\\.\pipe\`), and — on macOS — that the app's own `bridge-status.json` reports a fresh successful herdr snapshot. +## rebuildup/hoxay-plugins set (pc-setup#239) + +`plugin-set.sh` / `plugin-set.ps1` install the fourteen plugins hoxay's +plugin boundary consumes, each through the official +`herdr plugin install rebuildup/hoxay-plugins/plugins/ --ref ` +path at the full commit SHA pinned by hoxay's +`docs/migration/contracts/plugins-boundary.md` @ release-0-6-0: + +| plugin | pinned commit | contract version | +| --- | --- | --- | +| `rebuildup.inbox` | `414e87dea9faa5c221fb27508e5828f086849836` | inbox v0.1.0 | +| `rebuildup.git` | `d0578307a856e53af210775f9cb95c9f593d6f87` | git-v1 @ 0.2.0 | +| `rebuildup.projects` | `2dcb2abfa57b0adcf5d1109f76087e19b3dfae07` | projects/v1 @ 0.3.0 | +| `rebuildup.checkpoints` | `ae4f214c523d05128354a8c4ba493b62cd8e843f` | checkpoints/v1 @ 0.4.0 | +| `rebuildup.automations` | `6c1cfa501323772e7c1c008c3dbcd7e364feb0b3` | automations/v1 @ 0.7.0 | +| `rebuildup.conversations` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | conversations/v1 @ 0.5.0 | +| `rebuildup.usage` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | usage/v1 @ 0.5.0 | +| `rebuildup.artifacts` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | artifacts/v1 @ 0.5.0 | +| `rebuildup.handoff` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | handoff/v1 @ 0.5.0 | +| `rebuildup.textgen` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | textgen/v1 @ 0.5.0 | +| `rebuildup.controls` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | controls/v1 @ 0.5.0 | +| `rebuildup.secrets` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | secrets/v1 @ 0.5.0 | +| `rebuildup.machines` | `08f96a4d151f0edb72b61483376ff977177f92e8` | machines/v1 @ 0.1.0 | +| `rebuildup.mcp` | `d23205af0cd2ff7dba25f72e1f3b872762a108ee` | mcp/v1 @ 0.5.0 | + +The script is idempotent: plugins already at the pinned commit are +skipped, and `--check` / `-Check` reports drift without installing. +Prerequisites are `herdr` (>= 0.9.0) and `bun` on PATH — plugin manifest +commands run `bun run`, so the runtime must resolve in the invoking +shell. On Windows, run it from an interactive shell: non-login ssh +sessions may not carry the user PATH (rebuildup/hoxay#339). + ## Integration notes - Requires `git`, `mise` (hoxay pins bun+node via `mise.toml`), `bun`, `curl` (POSIX) / `Invoke-RestMethod` (Windows). - Windows herdr connectivity goes through the named-pipe endpoint; the app - handles that transparently once herdr-t3#6 lands — until then - `verify.ps1 -Live` on Windows may report `herdr.reachable=false`. + resolves it itself, so `verify.ps1 -Live` probes the pipe directly. - Environment overrides: `HOXAY_STATE_DIR` and `HOXAY_APPS_DIR`. The pre-rename `HERDR_T3_STATE_DIR` / `HERDR_T3_APPS_DIR` still work as fallbacks. diff --git a/components/hoxay/install.sh b/components/hoxay/install.sh index 8b5590f0..6affda06 100755 --- a/components/hoxay/install.sh +++ b/components/hoxay/install.sh @@ -84,7 +84,10 @@ MISE_EMPTY_GLOBAL="$STATE_DIR/mise-empty-global.toml" # (e.g. ~/.config/mise/config.toml -> pc-setup's mise.global.toml) has to be # ignored by its real path too — excluding the directory alone would not # keep the global pins out of the build (rebuildup/pc-setup#245). -MISE_IGNORED_PATHS=("$HOME/.config/mise") +# ~/.tool-versions is read by mise's ancestor discovery as well, and the +# managed state dir lives under the home directory — a tool pinned there +# that the repo lockfile does not know would fail `--locked` too. +MISE_IGNORED_PATHS=("$HOME/.config/mise" "$HOME/.tool-versions") mise_user_config="$HOME/.config/mise/config.toml" if [[ -e "$mise_user_config" ]]; then mise_user_config_real="$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$mise_user_config" 2>/dev/null || true)" diff --git a/components/hoxay/plugin-set.ps1 b/components/hoxay/plugin-set.ps1 new file mode 100644 index 00000000..64e2d517 --- /dev/null +++ b/components/hoxay/plugin-set.ps1 @@ -0,0 +1,89 @@ +# Install the pinned rebuildup/hoxay-plugins set used by hoxay +# (pc-setup#239, rebuildup/hoxay#358). +# +# The fourteen plugins and their full commit SHAs mirror the contract pins in +# rebuildup/hoxay `docs/migration/contracts/plugins-boundary.md` +# @ release-0-6-0 (inbox v0.1.0, git v0.2.0, projects v0.3.0, +# checkpoints v0.4.0, automations v0.7.0, conversations/usage/artifacts/ +# handoff/textgen/controls/secrets/mcp v0.5.0 @ d23205af, machines v0.1.0 +# @ 08f96a4 — the RC pin-backport carrying the --socket/--session fix, +# hoxay-plugins#264) — the full set shipped in v0.6.0. Each +# plugin installs independently through the official +# `herdr plugin install --ref ` path; state lives under herdr's own +# plugin directories, so reinstalling never loses organize state. +# +# Idempotent: a plugin already installed at the pinned commit is skipped; +# a different commit is re-installed at the pin. `-Check` only reports. +# +# Prerequisites: `herdr` on PATH (herdr >= 0.9.0) and `bun` on PATH — +# plugin manifest commands run `bun run`. Note that non-login ssh +# sessions may not carry the user PATH; run this from an interactive +# shell (rebuildup/hoxay#339). +# +# Usage: plugin-set.ps1 [-Check] +param([switch]$Check) + +$ErrorActionPreference = "Stop" + +function Log($msg) { Write-Host "[hoxay plugins] $msg" } +function Die($msg) { Write-Host "[hoxay plugins] ERROR: $msg" -ForegroundColor Red; exit 1 } + +if (-not (Get-Command herdr -ErrorAction SilentlyContinue)) { Die "herdr not found on PATH" } +if (-not (Get-Command bun -ErrorAction SilentlyContinue)) { Die "bun not found on PATH (plugin commands run 'bun run')" } + +# name|full commit SHA — keep in sync with plugins-boundary.md. +$Plugins = @( + @{ Name = "inbox"; Sha = "414e87dea9faa5c221fb27508e5828f086849836" }, + @{ Name = "git"; Sha = "d0578307a856e53af210775f9cb95c9f593d6f87" }, + @{ Name = "projects"; Sha = "2dcb2abfa57b0adcf5d1109f76087e19b3dfae07" }, + @{ Name = "checkpoints"; Sha = "ae4f214c523d05128354a8c4ba493b62cd8e843f" }, + @{ Name = "automations"; Sha = "6c1cfa501323772e7c1c008c3dbcd7e364feb0b3" }, + @{ Name = "conversations"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "usage"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "artifacts"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "handoff"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "textgen"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "controls"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "secrets"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" }, + @{ Name = "machines"; Sha = "08f96a4d151f0edb72b61483376ff977177f92e8" }, + @{ Name = "mcp"; Sha = "d23205af0cd2ff7dba25f72e1f3b872762a108ee" } +) + +# A failing `herdr plugin list` writes to stderr and leaves stdout empty. +# An empty stdout would parse into $null and make every plugin look +# MISSING — the check would report a false drift and a normal run would +# reinstall the whole set. Fail loudly instead (PowerShell 7 does not stop +# on a non-zero exit code with $ErrorActionPreference alone). +$listJson = herdr plugin list --json | Out-String +if ($LASTEXITCODE -ne 0) { Die "herdr plugin list failed (exit $LASTEXITCODE)" } +try { + $listParsed = $listJson | ConvertFrom-Json +} catch { + Die "herdr plugin list did not return JSON: $($_.Exception.Message)" +} +if (-not $listParsed -or -not $listParsed.result) { Die "herdr plugin list returned no result payload" } +# NOTE: PowerShell variables are case-insensitive — this must NOT be +# named $plugins or it overwrites the $Plugins pin table above. +$installedPlugins = $listParsed.result.plugins + +$rc = 0 +foreach ($p in $Plugins) { + $pluginId = "rebuildup.$($p.Name)" + $entry = $installedPlugins | Where-Object { $_.plugin_id -eq $pluginId } | Select-Object -First 1 + $have = $entry.source.resolved_commit + if ($have -eq $p.Sha) { + Log "$pluginId already at pin $($p.Sha.Substring(0,12))" + continue + } + if ($Check) { + if (-not $have) { Log "$pluginId MISSING (pin $($p.Sha.Substring(0,12)))" } + else { Log "$pluginId at $($have.Substring(0,12)), pin is $($p.Sha.Substring(0,12))" } + $rc = 1 + continue + } + Log "installing $pluginId @ $($p.Sha.Substring(0,12))" + herdr plugin install "rebuildup/hoxay-plugins/plugins/$($p.Name)" --ref $p.Sha -y + if ($LASTEXITCODE -ne 0) { Log "ERROR: install failed for $pluginId"; $rc = 1 } +} + +exit $rc diff --git a/components/hoxay/plugin-set.sh b/components/hoxay/plugin-set.sh new file mode 100755 index 00000000..0f2c8752 --- /dev/null +++ b/components/hoxay/plugin-set.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +# Install the pinned rebuildup/hoxay-plugins set used by hoxay +# (pc-setup#239, rebuildup/hoxay#358). +# +# The fourteen plugins and their full commit SHAs mirror the contract pins in +# rebuildup/hoxay `docs/migration/contracts/plugins-boundary.md` +# @ release-0-6-0 (inbox v0.1.0, git v0.2.0, projects v0.3.0, +# checkpoints v0.4.0, automations v0.7.0, conversations/usage/artifacts/ +# handoff/textgen/controls/secrets/mcp v0.5.0 @ d23205af, machines v0.1.0 +# @ 08f96a4 — the RC pin-backport carrying the --socket/--session fix, +# hoxay-plugins#264) — the full set shipped in v0.6.0. Each +# plugin installs independently through the official +# `herdr plugin install --ref ` path; state lives under herdr's own +# plugin directories, so reinstalling never loses organize state. +# +# Idempotent: a plugin already installed at the pinned commit is skipped; +# a different commit is re-installed at the pin. `--check` only reports. +# +# Prerequisites: `herdr` on PATH (herdr >= 0.9.0) and `bun` on PATH — +# plugin manifest commands run `bun run`. +# +# Usage: plugin-set.sh [--check] +set -euo pipefail + +CHECK_ONLY=0 +[[ "${1:-}" == "--check" ]] && CHECK_ONLY=1 + +log() { printf '[hoxay plugins] %s\n' "$*"; } +die() { log "ERROR: $*" >&2; exit 1; } + +command -v herdr >/dev/null 2>&1 || die "herdr not found on PATH" +command -v bun >/dev/null 2>&1 || die "bun not found on PATH (plugin commands run 'bun run')" + +# name|full commit SHA — keep in sync with plugins-boundary.md. +PLUGINS=( + "inbox|414e87dea9faa5c221fb27508e5828f086849836" + "git|d0578307a856e53af210775f9cb95c9f593d6f87" + "projects|2dcb2abfa57b0adcf5d1109f76087e19b3dfae07" + "checkpoints|ae4f214c523d05128354a8c4ba493b62cd8e843f" + "automations|6c1cfa501323772e7c1c008c3dbcd7e364feb0b3" + "conversations|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "usage|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "artifacts|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "handoff|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "textgen|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "controls|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "secrets|d23205af0cd2ff7dba25f72e1f3b872762a108ee" + "machines|08f96a4d151f0edb72b61483376ff977177f92e8" + "mcp|d23205af0cd2ff7dba25f72e1f3b872762a108ee" +) + +# resolved_commit of one installed plugin (empty when absent/malformed). +installed_commit() { + herdr plugin list --json | bun -e ' + const d = JSON.parse(await new Response(Bun.stdin.stream()).text()); + const plugins = d?.result?.plugins ?? []; + const p = plugins.find((x) => x && x.plugin_id === process.argv[1]); + process.stdout.write(p?.source?.resolved_commit ?? ""); + ' "$1" +} + +rc=0 +for entry in "${PLUGINS[@]}"; do + name="${entry%%|*}" + rest="${entry#*|}" + sha="${rest##*|}" + plugin_id="rebuildup.$name" + have="$(installed_commit "$plugin_id")" + if [[ "$have" == "$sha" ]]; then + log "$plugin_id already at pin ${sha:0:12}" + continue + fi + if [[ "$CHECK_ONLY" == "1" ]]; then + if [[ -z "$have" ]]; then + log "$plugin_id MISSING (pin ${sha:0:12})" + else + log "$plugin_id at ${have:0:12}, pin is ${sha:0:12}" + fi + rc=1 + continue + fi + log "installing $plugin_id @ ${sha:0:12}" + herdr plugin install "rebuildup/hoxay-plugins/plugins/$name" --ref "$sha" -y \ + || { log "ERROR: install failed for $plugin_id" >&2; rc=1; } +done + +exit "$rc"