fix: installer auto-adds mosaic bin to PATH with clear status output
- install.sh: detects shell profile (zsh/bash/profile), adds PATH entry if missing - install.ps1: adds to User PATH via SetEnvironmentVariable if missing - Both are idempotent — show "already in PATH ✓" on re-run - mosaic/mosaic.ps1: accept "help" and "version" as bare subcommands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
install.sh
26
install.sh
@@ -42,7 +42,31 @@ if ! "$TARGET_DIR/bin/mosaic-doctor"; then
|
||||
echo "[mosaic-install] WARNING: doctor reported issues (run ~/.config/mosaic/bin/mosaic-doctor --fail-on-warn)" >&2
|
||||
fi
|
||||
|
||||
echo "[mosaic-install] Add to PATH: export PATH=\"$TARGET_DIR/bin:$PATH\""
|
||||
# Ensure ~/.config/mosaic/bin is in PATH persistently
|
||||
PATH_LINE="export PATH=\"$TARGET_DIR/bin:\$PATH\""
|
||||
|
||||
# Find the right shell profile
|
||||
if [[ -n "${ZSH_VERSION:-}" ]] || [[ "$(basename "${SHELL:-}")" == "zsh" ]]; then
|
||||
SHELL_PROFILE="$HOME/.zshrc"
|
||||
elif [[ -f "$HOME/.bashrc" ]]; then
|
||||
SHELL_PROFILE="$HOME/.bashrc"
|
||||
elif [[ -f "$HOME/.profile" ]]; then
|
||||
SHELL_PROFILE="$HOME/.profile"
|
||||
else
|
||||
SHELL_PROFILE="$HOME/.profile"
|
||||
fi
|
||||
|
||||
if grep -qF "$TARGET_DIR/bin" "$SHELL_PROFILE" 2>/dev/null; then
|
||||
echo "[mosaic-install] PATH: $TARGET_DIR/bin already in $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."
|
||||
fi
|
||||
|
||||
if [[ ! -f "$TARGET_DIR/SOUL.md" ]]; then
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user