Add cn doctor with mirror auto-failover and restore commands

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-24 18:55:08 -04:00
co-authored by Claude Fable 5
parent d1a5ddfd02
commit dd3b893137
3 changed files with 155 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# omarchy:summary=Restore development registry configs from a backup stamp
# omarchy:args=<stamp>
# omarchy:examples=omarchycn restore config 20260824-184243
set -euo pipefail
source "$OMARCHY_PATH/cn/lib/dev-mirror.sh"
stamp="${1:?usage: omarchycn restore config <stamp> (see: omarchycn restore list)}"
dir="$CN_DM_BACKUP_ROOT/$stamp"
if [[ ! -d $dir ]]; then
echo "No backup at $dir" >&2
exit 1
fi
restored=0
for target in "${CN_DM_TARGETS[@]}"; do
dest=$(cn_dm_config_file "$target")
src="$dir/${dest##*/}"
if [[ -f $src && $dest != /etc/* ]]; then
mkdir -p "${dest%/*}"
cp "$src" "$dest"
echo "restored $target: $dest"
restored=$((restored + 1))
fi
done
if (( restored == 0 )); then
echo "Nothing restored from $dir (system files like docker are not auto-restored)" >&2
exit 1
fi