Skip to content

⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.

feat(installer): auto-quit wizard and run pai automatically post-install

Daniel Miessler698b15fc1966
diff --git a/Releases/v5.0.0/.claude/PAI/PAI-Install/public/app.js b/Releases/v5.0.0/.claude/PAI/PAI-Install/public/app.js
index e0359050..9e9d1920 100644
--- a/Releases/v5.0.0/.claude/PAI/PAI-Install/public/app.js
+++ b/Releases/v5.0.0/.claude/PAI/PAI-Install/public/app.js
@@ -101,6 +101,13 @@ function handleServerMessage(msg) {
case 'install_complete':
renderSummary(msg.summary);
+ // Hand off to the launching shell. The wizard server stays up just long
+ // enough for the user to see the summary, then we close the window —
+ // electron/main.js's window-all-closed handler triggers app.quit(),
+ // which exits the bun child, which lets install.sh resume and exec the
+ // post-install `pai` handoff. 3s is the same beat as the success voice
+ // notification so the audio finishes before the window disappears.
+ setTimeout(() => { window.close(); }, 3000);
break;
case 'error':
diff --git a/Releases/v5.0.0/.claude/install.sh b/Releases/v5.0.0/.claude/install.sh
index 46c19ccb..b3f016e1 100755
--- a/Releases/v5.0.0/.claude/install.sh
+++ b/Releases/v5.0.0/.claude/install.sh
@@ -246,4 +246,36 @@ fi
# containing this install.sh — the root of the v5 release bundle.
export PAI_BUNDLE_DIR="$SCRIPT_DIR"
-exec bun run "$INSTALLER_DIR/main.ts" --mode "$INSTALL_MODE"
+# Run the wizard. We deliberately do NOT exec here — once the wizard exits we
+# need to hand off to the user's interactive shell with `pai` already running.
+bun run "$INSTALLER_DIR/main.ts" --mode "$INSTALL_MODE"
+INSTALL_EXIT=$?
+
+# Post-wizard handoff. Three paths, in priority order:
+#
+# 1. Interactive TTY available (user ran `bash install.sh` directly, or CLI
+# mode in a terminal): exec into zsh -i -c 'source ~/.zshrc && pai' so the
+# user lands directly in pai in the same window. exec replaces this
+# process — there's no return.
+#
+# 2. macOS without a TTY (the `curl https://ourpai.ai/install.sh | sh` path
+# pipes stdin from curl, so [ -t 0 ] is false even though stdout is a
+# terminal): use osascript to open a fresh Terminal window running pai.
+# The user keeps their original terminal AND gets a new one with pai live.
+#
+# 3. Headless / no TTY / no osascript (Linux SSH, CI harness): print the
+# explicit command so the user can run it themselves.
+if [ "$INSTALL_EXIT" -eq 0 ]; then
+ echo ""
+ if [ -t 0 ] && [ -t 1 ]; then
+ info "Launching pai..."
+ exec zsh -i -c 'source ~/.zshrc && pai'
+ elif [ "$(uname)" = "Darwin" ] && command -v osascript >/dev/null 2>&1; then
+ info "Opening a new Terminal window for pai..."
+ osascript -e 'tell application "Terminal" to do script "source ~/.zshrc && pai"' >/dev/null 2>&1 || \
+ info "Could not auto-launch — run: ${BOLD}source ~/.zshrc && pai${RESET}"
+ else
+ info "Install complete. To start pai, run: ${BOLD}source ~/.zshrc && pai${RESET}"
+ fi
+fi
+exit $INSTALL_EXIT