no-mistakes(test): Fix no-mistakes agent:auto to [pi] migration using sed

This commit is contained in:
Lap Tran committed 2026-09-30 21:05:39 -04:00
1 parent 258dc2afa1
commit 65adb4cceb
1 file changed
+2 -9
+2 -9
View File
@@ -312,16 +312,9 @@ in
fi
# Ensure global config uses Pi (idempotent - only writes if missing or still `agent: auto`)
cfg="$HOME/.no-mistakes/config.yaml"
if [ -f "$cfg" ] && grep -qE '^\s*agent:\s*auto\s*$' "$cfg"; then
if [ -f "$cfg" ] && grep -qE '^[[:space:]]*agent:[[:space:]]*auto[[:space:]]*$' "$cfg"; then
tmp="$(mktemp)"
awk '
/^\s*agent:\s*auto\s*$/ {
print "# Managed by dotfiles/home.nix home.activation.noMistakes";
print "agent: [pi]";
next
}
{ print }
' "$cfg" > "$tmp" && mv "$tmp" "$cfg"
sed 's|^[[:space:]]*agent:[[:space:]]*auto[[:space:]]*$|# Managed by dotfiles/home.nix home.activation.noMistakes\nagent: [pi]|' "$cfg" > "$tmp" && mv "$tmp" "$cfg"
fi
if [ ! -f "$cfg" ]; then
mkdir -p "$(dirname "$cfg")"