From 55beae93a772d94fd02f21c3da211df915d3303f Mon Sep 17 00:00:00 2001 From: Michael Sitarzewski Date: Mon, 22 Jun 2026 01:38:43 -0500 Subject: [PATCH] fix(convert): prune stale tool output before regenerating (#605) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit convert.sh overwrote per-agent output in place but never removed files for agents that were renamed or deleted, so orphans accumulated in the gitignored integrations// dirs (e.g. agency-security-engineer lingered in antigravity/ and openclaw/ long after the source agent was gone) — and install.sh would happily copy them. Add clean_tool_output(), called once at the top of run_conversions (the single choke point for serial, parallel, and single-file paths): it wipes the tool's generated output but preserves the committed README.md (the only tracked file under integrations// for conversion targets). Verified: antigravity regenerated to 232 (was 233), orphan pruned, README kept. Co-authored-by: Claude Opus 4.8 (1M context) --- scripts/convert.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/convert.sh b/scripts/convert.sh index 28d46d31..c8e92910 100755 --- a/scripts/convert.sh +++ b/scripts/convert.sh @@ -528,10 +528,22 @@ HEREDOC # --- Main loop --- +# Remove a tool's previously-generated output before regenerating, so renamed or +# deleted agents don't leave orphan files behind (convert.sh overwrites in place +# but never pruned stale output). Preserves the committed README.md — the only +# tracked file under integrations// for conversion targets. +clean_tool_output() { + local dir="$OUT_DIR/$1" + [[ -d "$dir" ]] || return 0 + find "$dir" -mindepth 1 -maxdepth 1 ! -name 'README.md' -exec rm -rf {} + +} + run_conversions() { local tool="$1" local count=0 + clean_tool_output "$tool" + for dir in "${AGENT_DIRS[@]}"; do local dirpath="$REPO_ROOT/$dir" [[ -d "$dirpath" ]] || continue