From 6a58c5187296fbb483c1be93bcf4988ad82e5e9a Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 7 Apr 2026 19:40:13 -0500 Subject: [PATCH] fix(installer): preserve credentials dir and seed STANDARDS.md on install - Add credentials/ to PRESERVE_PATHS so rsync --delete doesn't wipe user credential stores on framework upgrades - Add AGENTS.md and STANDARDS.md to PRESERVE_PATHS to protect user-customized copies from being deleted during sync - Seed AGENTS.md and STANDARDS.md from defaults/ on first install (previously only existed in defaults/ but never copied to framework root) - Create credentials/ directory during install (alongside memory/) Co-Authored-By: Claude Opus 4.6 --- packages/mosaic/framework/install.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/mosaic/framework/install.sh b/packages/mosaic/framework/install.sh index 051441c..4a9ecc1 100755 --- a/packages/mosaic/framework/install.sh +++ b/packages/mosaic/framework/install.sh @@ -19,8 +19,9 @@ SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" TARGET_DIR="${MOSAIC_HOME:-$HOME/.config/mosaic}" INSTALL_MODE="${MOSAIC_INSTALL_MODE:-prompt}" -# Files preserved across upgrades (never overwritten) -PRESERVE_PATHS=("SOUL.md" "USER.md" "TOOLS.md" "memory" "sources") +# Files/dirs preserved across upgrades (never overwritten). +# User-created content in these paths survives rsync --delete. +PRESERVE_PATHS=("AGENTS.md" "SOUL.md" "USER.md" "TOOLS.md" "STANDARDS.md" "memory" "sources" "credentials") # Current framework schema version — bump this when the layout changes. # The migration system uses this to run upgrade steps. @@ -217,8 +218,22 @@ fi sync_framework -# Ensure memory directory exists +# Ensure persistent directories exist mkdir -p "$TARGET_DIR/memory" +mkdir -p "$TARGET_DIR/credentials" + +# Seed defaults — copy from defaults/ to framework root if not already present. +# These are user-editable files that ship with sensible defaults but should +# never be overwritten once the user has customized them. +DEFAULTS_DIR="$TARGET_DIR/defaults" +if [[ -d "$DEFAULTS_DIR" ]]; then + for default_file in AGENTS.md STANDARDS.md; do + if [[ -f "$DEFAULTS_DIR/$default_file" ]] && [[ ! -f "$TARGET_DIR/$default_file" ]]; then + cp "$DEFAULTS_DIR/$default_file" "$TARGET_DIR/$default_file" + ok "Seeded $default_file from defaults" + fi + done +fi # Ensure tool scripts are executable find "$TARGET_DIR/tools" -name "*.sh" -exec chmod +x {} + 2>/dev/null || true