From 3e7aa34e4933fdc0c68c39b7e15d3291a1c44617 Mon Sep 17 00:00:00 2001 From: ZDDC Date: Thu, 4 Jun 2026 10:24:03 -0500 Subject: [PATCH] feat(scripts): migrate relocates table.yaml/form.yaml configs into .zddc.d/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a tree-wide config-relocation pass to migrate-toplevel-peers.sh: after the peer move, every /table.yaml and /form.yaml is moved into /.zddc.d/ (where the server now resolves specs from; the legacy root still works, so it's a declutter). find|while-read handles directory names with spaces; skips files already under .zddc.d/ and existing destinations; honored by --dry-run. Idempotent (verified: dry-run → real → re-run skips). (No server code writes these configs — they're operator/test-created — so there are no writers to repoint.) Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/migrate-toplevel-peers.sh | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scripts/migrate-toplevel-peers.sh b/scripts/migrate-toplevel-peers.sh index 15b2757..602cfb9 100755 --- a/scripts/migrate-toplevel-peers.sh +++ b/scripts/migrate-toplevel-peers.sh @@ -14,6 +14,11 @@ # so it stays registered (else its workspaces can't be recreated) # - LEAVE archive//{received,issued} in place (the WORM record) # +# Then, tree-wide, relocate any table.yaml / form.yaml config out of a +# directory root and into that directory's .zddc.d/ reserve (where the +# server now resolves specs from; the legacy root location still works, so +# this is a declutter, not a hard requirement). +# # Per-folder .zddc files travel with their directory (the whole slot dir # is moved). Idempotent: already-migrated paths are skipped. Run with the # server stopped (or accept it's a plain filesystem move). @@ -112,6 +117,28 @@ synth_registry() { synth=$((synth + 1)) } +# relocate_configs — move every /table.yaml and /form.yaml into +# /.zddc.d/. Tree-wide; skips files already under a .zddc.d/ and any +# destination that already exists. Uses find | while-read so directory names +# with spaces are handled (counters live in the subshell, so this pass just +# logs its actions rather than feeding the summary). +relocate_configs() { + find "$ROOT" -type f \( -name table.yaml -o -name form.yaml \) 2>/dev/null | while IFS= read -r f; do + case "$f" in + */.zddc.d/*) continue ;; + esac + d=$(dirname "$f") + base=$(basename "$f") + dst="$d/.zddc.d/$base" + if [ -e "$dst" ]; then + say " .. skip (dest exists): $dst" + continue + fi + act "mkdir -p $d/.zddc.d" mkdir -p "$d/.zddc.d" + act "mv $f -> $dst" mv "$f" "$dst" + done +} + for projectdir in "$ROOT"/*/; do [ -d "$projectdir/archive" ] || continue project=$(basename "$projectdir") @@ -137,6 +164,11 @@ for projectdir in "$ROOT"/*/; do done done +# Tree-wide config relocation (runs over the now-migrated layout). +say "" +say "relocating table.yaml/form.yaml configs into .zddc.d/ …" +relocate_configs + say "" say "summary: moved=$moved synthesized=$synth skipped=$skipped" [ "$DRY" -eq 1 ] && say "(dry-run — nothing changed)"