|
|
|
@@ -19,7 +19,9 @@ SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
TARGET_DIR="${MOSAIC_HOME:-$HOME/.config/mosaic}"
|
|
|
|
TARGET_DIR="${MOSAIC_HOME:-$HOME/.config/mosaic}"
|
|
|
|
INSTALL_MODE="${MOSAIC_INSTALL_MODE:-prompt}"
|
|
|
|
INSTALL_MODE="${MOSAIC_INSTALL_MODE:-prompt}"
|
|
|
|
|
|
|
|
|
|
|
|
# Files/dirs preserved across upgrades (never overwritten).
|
|
|
|
# Files/dirs protected from rsync --delete during sync. NOTE: framework-owned
|
|
|
|
|
|
|
|
# entries (CONSTITUTION/AGENTS/STANDARDS) ARE re-applied afterward by
|
|
|
|
|
|
|
|
# reconcile_framework_files (overwrite + backup-once); the rest stay user-owned.
|
|
|
|
# User-created content in these paths survives rsync --delete.
|
|
|
|
# User-created content in these paths survives rsync --delete.
|
|
|
|
PRESERVE_PATHS=("CONSTITUTION.md" "AGENTS.md" "SOUL.md" "USER.md" "TOOLS.md" "STANDARDS.md" "memory" "sources" "credentials")
|
|
|
|
PRESERVE_PATHS=("CONSTITUTION.md" "AGENTS.md" "SOUL.md" "USER.md" "TOOLS.md" "STANDARDS.md" "memory" "sources" "credentials")
|
|
|
|
|
|
|
|
|
|
|
|
@@ -70,11 +72,13 @@ reconcile_framework_files() {
|
|
|
|
[[ -d "$defaults" ]] || return 0
|
|
|
|
[[ -d "$defaults" ]] || return 0
|
|
|
|
for f in "${FRAMEWORK_OWNED[@]}"; do
|
|
|
|
for f in "${FRAMEWORK_OWNED[@]}"; do
|
|
|
|
[[ -f "$defaults/$f" ]] || continue
|
|
|
|
[[ -f "$defaults/$f" ]] || continue
|
|
|
|
if [[ -f "$TARGET_DIR/$f" ]] && ! cmp -s "$TARGET_DIR/$f" "$defaults/$f"; then
|
|
|
|
# Already current — skip to avoid mtime churn.
|
|
|
|
if [[ ! -f "$TARGET_DIR/${f}.pre-constitution.bak" ]]; then
|
|
|
|
if [[ -f "$TARGET_DIR/$f" ]] && cmp -s "$TARGET_DIR/$f" "$defaults/$f"; then
|
|
|
|
cp "$TARGET_DIR/$f" "$TARGET_DIR/${f}.pre-constitution.bak"
|
|
|
|
continue
|
|
|
|
warn "$f is now framework-owned and was updated; your previous copy is saved as ${f}.pre-constitution.bak — re-apply intended changes as a .local overlay or policy/ file (see CONSTITUTION.md / constitution/LAYER-MODEL.md)."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ -f "$TARGET_DIR/$f" && ! -f "$TARGET_DIR/${f}.pre-constitution.bak" ]]; then
|
|
|
|
|
|
|
|
cp "$TARGET_DIR/$f" "$TARGET_DIR/${f}.pre-constitution.bak"
|
|
|
|
|
|
|
|
warn "$f is now framework-owned and was updated; your previous copy is saved as ${f}.pre-constitution.bak — re-apply intended changes as a .local overlay or policy/ file (see CONSTITUTION.md / constitution/LAYER-MODEL.md)."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cp "$defaults/$f" "$TARGET_DIR/$f"
|
|
|
|
cp "$defaults/$f" "$TARGET_DIR/$f"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
@@ -281,9 +285,9 @@ sync_framework
|
|
|
|
mkdir -p "$TARGET_DIR/memory"
|
|
|
|
mkdir -p "$TARGET_DIR/memory"
|
|
|
|
mkdir -p "$TARGET_DIR/credentials"
|
|
|
|
mkdir -p "$TARGET_DIR/credentials"
|
|
|
|
|
|
|
|
|
|
|
|
# Seed defaults — copy framework contract files from defaults/ to framework
|
|
|
|
# Reconcile contract files from defaults/ into the framework root: framework-owned
|
|
|
|
# root if not already present. These ship with sensible defaults but must
|
|
|
|
# files (CONSTITUTION/AGENTS/STANDARDS) are overwritten every upgrade (a divergent
|
|
|
|
# never be overwritten once the user has customized them.
|
|
|
|
# copy is backed up once); user-seeded files (TOOLS) are written on first install only.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This list must match the framework-contract whitelist in
|
|
|
|
# This list must match the framework-contract whitelist in
|
|
|
|
# packages/mosaic/src/config/file-adapter.ts (FileConfigAdapter.syncFramework).
|
|
|
|
# packages/mosaic/src/config/file-adapter.ts (FileConfigAdapter.syncFramework).
|
|
|
|
|