feat: colored installer output with status indicators and next steps
- Green ✓ for success, yellow ⚠ for warnings, red ✗ for errors - Bold section headings (Installing, Post-install, PATH, Summary) - Summary block with numbered next steps (source shell profile, mosaic init) - Suppressed noisy sub-script output — only status lines shown - Colors auto-disabled when not running in a terminal (piped output) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
83
install.sh
83
install.sh
@@ -4,6 +4,21 @@ set -euo pipefail
|
||||
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TARGET_DIR="${MOSAIC_HOME:-$HOME/.config/mosaic}"
|
||||
|
||||
# Colors (disabled if not a terminal)
|
||||
if [[ -t 1 ]]; then
|
||||
GREEN='\033[0;32m' YELLOW='\033[0;33m' RED='\033[0;31m'
|
||||
CYAN='\033[0;36m' BOLD='\033[1m' RESET='\033[0m'
|
||||
else
|
||||
GREEN='' YELLOW='' RED='' CYAN='' BOLD='' RESET=''
|
||||
fi
|
||||
|
||||
ok() { echo -e " ${GREEN}✓${RESET} $1"; }
|
||||
warn() { echo -e " ${YELLOW}⚠${RESET} $1" >&2; }
|
||||
fail() { echo -e " ${RED}✗${RESET} $1" >&2; }
|
||||
step() { echo -e "\n${BOLD}$1${RESET}"; }
|
||||
|
||||
step "Installing Mosaic framework"
|
||||
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
@@ -16,33 +31,40 @@ fi
|
||||
chmod +x "$TARGET_DIR"/bin/*
|
||||
chmod +x "$TARGET_DIR"/install.sh
|
||||
|
||||
echo "[mosaic-install] Installed framework to $TARGET_DIR"
|
||||
ok "Framework installed to $TARGET_DIR"
|
||||
|
||||
echo "[mosaic-install] Linking runtime compatibility assets"
|
||||
if ! "$TARGET_DIR/bin/mosaic-link-runtime-assets"; then
|
||||
echo "[mosaic-install] WARNING: runtime asset linking failed (framework install still complete)" >&2
|
||||
step "Post-install tasks"
|
||||
|
||||
if "$TARGET_DIR/bin/mosaic-link-runtime-assets" >/dev/null 2>&1; then
|
||||
ok "Runtime assets linked"
|
||||
else
|
||||
warn "Runtime asset linking failed (non-fatal)"
|
||||
fi
|
||||
|
||||
echo "[mosaic-install] Syncing universal skills"
|
||||
if [[ "${MOSAIC_SKIP_SKILLS_SYNC:-0}" == "1" ]]; then
|
||||
echo "[mosaic-install] Skipping skills sync (MOSAIC_SKIP_SKILLS_SYNC=1)"
|
||||
ok "Skills sync skipped (MOSAIC_SKIP_SKILLS_SYNC=1)"
|
||||
else
|
||||
if ! "$TARGET_DIR/bin/mosaic-sync-skills"; then
|
||||
echo "[mosaic-install] WARNING: skills sync failed (framework install still complete)" >&2
|
||||
if "$TARGET_DIR/bin/mosaic-sync-skills" >/dev/null 2>&1; then
|
||||
ok "Skills synced"
|
||||
else
|
||||
warn "Skills sync failed (non-fatal)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[mosaic-install] Migrating runtime-local skills to Mosaic links"
|
||||
if ! "$TARGET_DIR/bin/mosaic-migrate-local-skills" --apply; then
|
||||
echo "[mosaic-install] WARNING: local skill migration failed (framework install still complete)" >&2
|
||||
if "$TARGET_DIR/bin/mosaic-migrate-local-skills" --apply >/dev/null 2>&1; then
|
||||
ok "Local skills migrated"
|
||||
else
|
||||
warn "Local skill migration failed (non-fatal)"
|
||||
fi
|
||||
|
||||
echo "[mosaic-install] Running health audit"
|
||||
if ! "$TARGET_DIR/bin/mosaic-doctor"; then
|
||||
echo "[mosaic-install] WARNING: doctor reported issues (run ~/.config/mosaic/bin/mosaic-doctor --fail-on-warn)" >&2
|
||||
if "$TARGET_DIR/bin/mosaic-doctor" >/dev/null 2>&1; then
|
||||
ok "Health audit passed"
|
||||
else
|
||||
warn "Health audit reported issues — run 'mosaic doctor' for details"
|
||||
fi
|
||||
|
||||
# Ensure ~/.config/mosaic/bin is in PATH persistently
|
||||
step "PATH configuration"
|
||||
|
||||
PATH_LINE="export PATH=\"$TARGET_DIR/bin:\$PATH\""
|
||||
|
||||
# Find the right shell profile
|
||||
@@ -56,20 +78,39 @@ else
|
||||
SHELL_PROFILE="$HOME/.profile"
|
||||
fi
|
||||
|
||||
PATH_CHANGED=false
|
||||
if grep -qF "$TARGET_DIR/bin" "$SHELL_PROFILE" 2>/dev/null; then
|
||||
echo "[mosaic-install] PATH: $TARGET_DIR/bin already in $SHELL_PROFILE ✓"
|
||||
ok "Already in PATH via $SHELL_PROFILE"
|
||||
else
|
||||
{
|
||||
echo ""
|
||||
echo "# Mosaic agent framework"
|
||||
echo "$PATH_LINE"
|
||||
} >> "$SHELL_PROFILE"
|
||||
echo "[mosaic-install] PATH: Added $TARGET_DIR/bin to $SHELL_PROFILE ✓"
|
||||
echo "[mosaic-install] Run 'source $SHELL_PROFILE' or open a new terminal to activate."
|
||||
ok "Added to PATH in $SHELL_PROFILE"
|
||||
PATH_CHANGED=true
|
||||
fi
|
||||
|
||||
# ── Summary ──────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo -e "${GREEN}${BOLD} Mosaic installed successfully.${RESET}"
|
||||
echo ""
|
||||
|
||||
# Collect next steps
|
||||
NEXT_STEPS=()
|
||||
|
||||
if [[ "$PATH_CHANGED" == "true" ]]; then
|
||||
NEXT_STEPS+=("Run ${CYAN}source $SHELL_PROFILE${RESET} or log out and back in to activate PATH.")
|
||||
fi
|
||||
|
||||
if [[ ! -f "$TARGET_DIR/SOUL.md" ]]; then
|
||||
echo ""
|
||||
echo "[mosaic-install] Set up your agent identity by running: mosaic init"
|
||||
echo "[mosaic-install] This generates SOUL.md — the universal behavioral contract for all agent sessions."
|
||||
NEXT_STEPS+=("Run ${CYAN}mosaic init${RESET} to set up your agent identity (SOUL.md).")
|
||||
fi
|
||||
|
||||
if [[ ${#NEXT_STEPS[@]} -gt 0 ]]; then
|
||||
echo -e " ${BOLD}Next steps:${RESET}"
|
||||
for i in "${!NEXT_STEPS[@]}"; do
|
||||
echo -e " $((i+1)). ${NEXT_STEPS[$i]}"
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user