#!/bin/bash # walle installer. # # curl -fsSL https://raw.githubusercontent.com/sidharthrajaram/walle/main/install.sh | bash # # Downloads the latest release (falls back to building from source), then puts # walle -> ~/.local/bin/walle (or $WALLE_BIN) # walle.app -> ~/Applications/walle.app (menu bar) # the skill -> ~/.claude/skills/walle and ~/.codex/skills/walle, if those agents are here # # Options (after `bash -s --` when piping): # --no-setup install only (agents: then `walle setup --yes ...`) # --no-app no menu bar app # --source build from source even if a release is available # --uninstall set -euo pipefail BIN_DIR=${WALLE_BIN:-$HOME/.local/bin} APP_DIR=$HOME/Applications LOGIN_PLIST=$HOME/Library/LaunchAgents/ai.walle.bar.plist GH=${WALLE_GH:-sidharthrajaram/walle} ARGS=" $* " say() { printf ' \033[38;5;172m▣\033[0m %s\n' "$*"; } fail() { printf ' \033[31m✗\033[0m %s\n' "$*" >&2; exit 1; } [[ "$(uname -s)" == Darwin ]] || fail "walle is macOS only" if [[ "$ARGS" == *" --uninstall "* ]]; then launchctl bootout "gui/$(id -u)/ai.walle.bar" 2>/dev/null || true launchctl bootout "gui/$(id -u)/ai.walle.watch" 2>/dev/null || true pkill -x WalleBar 2>/dev/null || true rm -rf "$APP_DIR/walle.app" "$LOGIN_PLIST" "$HOME/Library/LaunchAgents/ai.walle.watch.plist" \ "$BIN_DIR/walle" "$HOME/.claude/skills/walle" "$HOME/.codex/skills/walle" say "walle removed. your notes and history are still in ~/.walle" exit 0 fi WORK=$(mktemp -d) trap 'rm -rf "$WORK"' EXIT PKG="" # folder holding walle, walle.app, SKILL.md # 1. Running from a checkout? Build it. SRC="" if [[ -f "${BASH_SOURCE[0]:-}" ]]; then SRC=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd); fi build_from() { command -v swift >/dev/null || fail "building from source needs Swift: xcode-select --install" say "building from source…" (cd "$1" && swift build -c release --product walle >/dev/null) mkdir -p "$WORK/pkg" cp "$(cd "$1" && swift build -c release --show-bin-path)/walle" "$WORK/pkg/walle" cp "$1/skills/walle/SKILL.md" "$WORK/pkg/SKILL.md" if [[ "$ARGS" != *" --no-app "* ]]; then cp -R "$(cd "$1" && scripts/bundle-app.sh)" "$WORK/pkg/walle.app" fi PKG="$WORK/pkg" } if [[ -f "$SRC/Package.swift" ]]; then build_from "$SRC" else # 2. Otherwise, the latest release. if [[ "$ARGS" != *" --source "* ]] && \ curl -fsSL "${WALLE_URL:-https://github.com/$GH/releases/latest/download/walle-macos.tar.gz}" -o "$WORK/walle.tgz" 2>/dev/null; then say "downloaded the latest release" tar -xzf "$WORK/walle.tgz" -C "$WORK" PKG="$WORK/walle" else # 3. No release: clone and build. say "fetching source…" git clone --depth 1 -q "https://github.com/$GH.git" "$WORK/src" build_from "$WORK/src" fi fi # Install. mkdir -p "$BIN_DIR" rm -f "$BIN_DIR/walle" # replace, don't overwrite: macOS caches the old signature cp "$PKG/walle" "$BIN_DIR/walle" chmod +x "$BIN_DIR/walle" say "walle → $BIN_DIR/walle" case ":$PATH:" in *":$BIN_DIR:"*) ;; *) # Put walle on the PATH for new terminals (zsh is the macOS default). LINE="export PATH=\"$BIN_DIR:\$PATH\"" case "${SHELL:-/bin/zsh}" in */bash) RC="$HOME/.bash_profile" ;; *) RC="$HOME/.zshrc" ;; esac if ! grep -qsF "$BIN_DIR" "$RC"; then printf '\n# walle\n%s\n' "$LINE" >> "$RC"; fi export PATH="$BIN_DIR:$PATH" say "added $BIN_DIR to your PATH in ${RC/#$HOME/~} (open a new terminal to use walle)" ;; esac for agent in claude codex; do if [[ -d "$HOME/.$agent" ]]; then mkdir -p "$HOME/.$agent/skills/walle" cp "$PKG/SKILL.md" "$HOME/.$agent/skills/walle/SKILL.md" say "skill → ~/.$agent/skills/walle" fi done if [[ "$ARGS" != *" --no-app "* && -d "$PKG/walle.app" ]]; then mkdir -p "$APP_DIR" pkill -x WalleBar 2>/dev/null || true rm -rf "$APP_DIR/walle.app" cp -R "$PKG/walle.app" "$APP_DIR/walle.app" xattr -dr com.apple.quarantine "$APP_DIR/walle.app" 2>/dev/null || true if [[ -f "$LOGIN_PLIST" ]]; then launchctl kickstart -k "gui/$(id -u)/ai.walle.bar" 2>/dev/null || true say "menu bar app updated and restarted" else say "menu bar app → $APP_DIR/walle.app (setup asks before turning it on)" fi fi if [[ "$ARGS" != *" --no-setup "* ]] && [[ -r /dev/tty ]] && [[ -t 1 ]]; then "$BIN_DIR/walle" setup < /dev/tty exit 0 fi echo say "next: walle setup (agents: walle setup --yes --analyst claude|codex|off)" echo