feat: auto-update harness files when plugin version changes

setup.sh now stamps .harness-version in .loop/ at scaffold time. On each
/agent-loop:run, Phase 1 compares the installed harness version against
the plugin version and auto-updates lib/, prompts/, and loop.sh if stale.
Run state (prd.json, contracts, config.json) is preserved.

Also adds setup.sh --update mode for refreshing harness files without
re-scaffolding. Bump to 0.10.0.
This commit is contained in:
2026-04-02 09:02:41 -04:00
parent 1bd8004854
commit 71b00cf11f
4 changed files with 63 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ Follow this sequence. Each phase checks what exists and skips if already done.
---
## Phase 1: Scaffold (if needed)
## Phase 1: Scaffold or Update Harness
Check if `.loop/config.json` exists.
@@ -36,7 +36,23 @@ bash "$(ls -d ~/.claude/plugins/cache/agent-loop/agent-loop/*/setup.sh 2>/dev/nu
Show the output. If setup fails, stop.
**If it already exists**, skip to Phase 2.
**If it already exists**, check if the harness files need updating. Compare the installed harness version against the plugin version:
```bash
INSTALLED=$(cat .loop/.harness-version 2>/dev/null || echo "unknown")
PLUGIN=$(jq -r '.version // empty' "$(ls -d ~/.claude/plugins/cache/agent-loop/agent-loop/*/.claude-plugin/plugin.json 2>/dev/null | tail -1)" 2>/dev/null || echo "unknown")
echo "installed=$INSTALLED plugin=$PLUGIN"
```
If the versions differ (or installed is "unknown"), update the harness files:
```bash
bash "$(ls -d ~/.claude/plugins/cache/agent-loop/agent-loop/*/setup.sh 2>/dev/null | tail -1)" --update
```
Tell the user: *"Updated harness files to v{version}."* Then continue to Phase 2.
If versions match, skip to Phase 2.
---