Skip to content

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

feat: Add interactive setup wizard for PAI configuration

Daniel Miesslere6c88afcb2ee
diff --git a/.claude/tools/setup/.gitignore b/.claude/tools/setup/.gitignore
new file mode 100644
index 00000000..a14702c4
--- /dev/null
+++ b/.claude/tools/setup/.gitignore
@@ -0,0 +1,34 @@
+# dependencies (bun install)
+node_modules
+
+# output
+out
+dist
+*.tgz
+
+# code coverage
+coverage
+*.lcov
+
+# logs
+logs
+_.log
+report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
+
+# dotenv environment variable files
+.env
+.env.development.local
+.env.test.local
+.env.production.local
+.env.local
+
+# caches
+.eslintcache
+.cache
+*.tsbuildinfo
+
+# IntelliJ based IDEs
+.idea
+
+# Finder (MacOS) folder config
+.DS_Store
diff --git a/.claude/tools/setup/bootstrap.sh b/.claude/tools/setup/bootstrap.sh
new file mode 100755
index 00000000..6216e5da
--- /dev/null
+++ b/.claude/tools/setup/bootstrap.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+
+# PAI Bootstrap Script
+# Checks prerequisites and runs the setup wizard
+
+set -e
+
+echo ""
+echo "╔══════════════════════════════════════════════════════════════╗"
+echo "║ PAI Setup Bootstrap ║"
+echo "║ Personal AI Infrastructure Configuration ║"
+echo "╚══════════════════════════════════════════════════════════════╝"
+echo ""
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# Colors
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[0;33m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
+# Check current shell
+check_shell() {
+ CURRENT_SHELL=$(basename "$SHELL")
+ echo -e "${BLUE}ℹ${NC} Current shell: $CURRENT_SHELL"
+
+ if [[ "$CURRENT_SHELL" != "zsh" && "$CURRENT_SHELL" != "bash" ]]; then
+ echo -e "${YELLOW}⚠${NC} PAI works best with zsh or bash."
+ echo " Your current shell is: $CURRENT_SHELL"
+ echo ""
+ read -p " Would you like to switch to zsh? (y/n): " -n 1 -r
+ echo
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
+ if command -v zsh &> /dev/null; then
+ echo -e "${GREEN}✓${NC} zsh is installed. To switch, run: chsh -s $(which zsh)"
+ echo " Then restart your terminal and run this script again."
+ exit 0
+ else
+ echo -e "${RED}✗${NC} zsh is not installed."
+ echo " Install it first:"
+ echo " - macOS: brew install zsh"
+ echo " - Ubuntu: sudo apt install zsh"
+ exit 1
+ fi
+ fi
+ else
+ echo -e "${GREEN}✓${NC} Shell is compatible ($CURRENT_SHELL)"
+ fi
+}
+
+# Check and install bun
+check_bun() {
+ echo ""
+ if command -v bun &> /dev/null; then
+ BUN_VERSION=$(bun --version)
+ echo -e "${GREEN}✓${NC} Bun is installed (v$BUN_VERSION)"
+ return 0
+ else
+ echo -e "${YELLOW}⚠${NC} Bun is not installed"
+ echo ""
+ echo " Bun is required to run PAI. It's a fast JavaScript runtime."
+ echo ""
+ read -p " Install Bun now? (y/n): " -n 1 -r
+ echo
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
+ echo -e "${BLUE}→${NC} Installing Bun..."
+ curl -fsSL https://bun.sh/install | bash
+
+ # Source the new bun installation
+ export BUN_INSTALL="$HOME/.bun"
+ export PATH="$BUN_INSTALL/bin:$PATH"
+
+ if command -v bun &> /dev/null; then
+ echo -e "${GREEN}✓${NC} Bun installed successfully!"
+ echo ""
+ echo -e "${YELLOW}!${NC} You may need to restart your terminal or run:"
+ echo " source ~/.zshrc # or ~/.bashrc"
+ return 0
+ else
+ echo -e "${RED}✗${NC} Bun installation failed"
+ echo " Try manually: curl -fsSL https://bun.sh/install | bash"
+ exit 1
+ fi
+ else
+ echo -e "${RED}✗${NC} Bun is required. Install it and run this script again."
+ exit 1
+ fi
+ fi
+}
+
+# Check Claude Code
+check_claude() {
+ echo ""
+ if command -v claude &> /dev/null; then
+ echo -e "${GREEN}✓${NC} Claude Code is installed"
+ else
+ echo -e "${YELLOW}⚠${NC} Claude Code not found in PATH"
+ echo " Install from: https://code.claude.com"
+ echo " (You can continue setup without it)"
+ echo ""
+ fi
+}
+
+# Run the TypeScript setup wizard
+run_wizard() {
+ echo ""
+ echo -e "${BLUE}→${NC} Installing setup dependencies..."
+ cd "$SCRIPT_DIR"
+ bun install --silent
+
+ echo ""
+ echo -e "${BLUE}→${NC} Starting PAI Setup Wizard..."
+ echo ""
+
+ # Pass through any arguments
+ bun run setup.ts "$@"
+}
+
+# Main
+main() {
+ check_shell
+ check_bun
+ check_claude
+ run_wizard "$@"
+}
+
+main "$@"
diff --git a/.claude/tools/setup/bun.lock b/.claude/tools/setup/bun.lock
new file mode 100644
index 00000000..4d9b0dfb
--- /dev/null
+++ b/.claude/tools/setup/bun.lock
@@ -0,0 +1,44 @@
+{
+ "lockfileVersion": 1,
+ "configVersion": 1,
+ "workspaces": {
+ "": {
+ "name": "setup",
+ "dependencies": {
+ "@clack/prompts": "^0.11.0",
+ "mustache": "^4.2.0",
+ },
+ "devDependencies": {
+ "@types/bun": "latest",
+ "@types/mustache": "^4.2.6",
+ "bun-types": "^1.3.3",
+ },
+ "peerDependencies": {
+ "typescript": "^5",
+ },
+ },
+ },
+ "packages": {
+ "@clack/core": ["@clack/[email protected]", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow=="],
+
+ "@clack/prompts": ["@clack/[email protected]", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="],
+
+ "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.3.3" } }, "sha512-ogrKbJ2X5N0kWLLFKeytG0eHDleBYtngtlbu9cyBKFtNL3cnpDZkNdQj8flVf6WTZUX5ulI9AY1oa7ljhSrp+g=="],
+
+ "@types/mustache": ["@types/[email protected]", "", {}, "sha512-t+8/QWTAhOFlrF1IVZqKnMRJi84EgkIK5Kh0p2JV4OLywUvCwJPFxbJAl7XAow7DVIHsF+xW9f1MVzg0L6Szjw=="],
+
+ "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ=="],
+
+ "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-z3Xwlg7j2l9JY27x5Qn3Wlyos8YAp0kKRlrePAOjgjMGS5IG6E7Jnlx736vH9UVI4wUICwwhC9anYL++XeOgTQ=="],
+
+ "mustache": ["[email protected]", "", { "bin": { "mustache": "bin/mustache" } }, "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ=="],
+
+ "picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
+
+ "sisteransi": ["[email protected]", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
+
+ "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
+
+ "undici-types": ["[email protected]", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
+ }
+}
diff --git a/.claude/tools/setup/configurators/index.ts b/.claude/tools/setup/configurators/index.ts
new file mode 100644
index 00000000..436def49
--- /dev/null
+++ b/.claude/tools/setup/configurators/index.ts
@@ -0,0 +1,151 @@
+/**
+ * Configurators - apply configuration changes
+ */
+
+import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
+import { join, dirname } from 'path';
+import { homedir } from 'os';
+import Mustache from 'mustache';
+import { Transaction, writeAtomic } from '../core/transaction';
+import { plistTemplate } from '../templates/plist';
+import { profileTemplate } from '../templates/profile';
+import { shellTemplate, SHELL_MARKER_START, SHELL_MARKER_END } from '../templates/shell';
+
+export interface SetupConfig {
+ paiDir: string;
+ userName: string;
+ userEmail: string;
+ assistantName: string;
+ assistantColor: string;
+ voicePort: number;
+ voiceEnabled: boolean;
+ updateShellProfile: boolean;
+}
+
+/**
+ * Detect bun binary path
+ */
+function getBunPath(): string {
+ // Check common locations
+ const locations = [
+ join(homedir(), '.bun/bin/bun'), // bun's default install
+ '/opt/homebrew/bin/bun', // Apple Silicon homebrew
+ '/usr/local/bin/bun', // Intel homebrew / manual
+ ];
+
+ for (const loc of locations) {
+ if (existsSync(loc)) {
+ return loc;
+ }
+ }
+
+ // Fallback - assume it's in PATH
+ return 'bun';
+}
+
+/**
+ * Create PAI directory structure
+ */
+export async function createDirectories(config: SetupConfig): Promise<void> {
+ const dirs = [
+ config.paiDir,
+ join(config.paiDir, 'config'),
+ join(config.paiDir, 'skills'),
+ join(config.paiDir, 'tools'),
+ join(config.paiDir, 'history'),
+ join(config.paiDir, 'voice-server', 'logs'),
+ ];
+
+ for (const dir of dirs) {
+ if (!existsSync(dir)) {
+ mkdirSync(dir, { recursive: true });
+ }
+ }
+}
+
+/**
+ * Write user profile configuration
+ */
+export async function writeProfile(config: SetupConfig, transaction: Transaction): Promise<void> {
+ const profilePath = join(config.paiDir, 'config', 'profile.json');
+
+ await transaction.backup(profilePath);
+
+ const data = {
+ ...config,
+ createdAt: new Date().toISOString(),
+ };
+
+ const content = Mustache.render(profileTemplate, data);
+ await writeAtomic(profilePath, content);
+}
+
+/**
+ * Write voice server plist (macOS only)
+ */
+export async function writePlist(config: SetupConfig, transaction: Transaction): Promise<void> {
+ if (process.platform !== 'darwin') {
+ return; // Skip on non-macOS
+ }
+
+ const launchAgentsDir = join(homedir(), 'Library', 'LaunchAgents');
+ if (!existsSync(launchAgentsDir)) {
+ mkdirSync(launchAgentsDir, { recursive: true });
+ }
+
+ const plistPath = join(launchAgentsDir, 'com.pai.voiceserver.plist');
+
+ await transaction.backup(plistPath);
+
+ const data = {
+ ...config,
+ homeDir: homedir(),
+ bunPath: getBunPath(),
+ };
+
+ const content = Mustache.render(plistTemplate, data);
+ await writeAtomic(plistPath, content);
+}
+
+/**
+ * Update shell profile (.zshrc or .bashrc)
+ */
+export async function updateShellProfile(config: SetupConfig, transaction: Transaction): Promise<string | null> {
+ if (!config.updateShellProfile) {
+ return null;
+ }
+
+ const shell = process.env.SHELL || '';
+ const isZsh = shell.includes('zsh');
+ const profilePath = join(homedir(), isZsh ? '.zshrc' : '.bashrc');
+
+ await transaction.backup(profilePath);
+
+ // Read existing content
+ let content = '';
+ if (existsSync(profilePath)) {
+ content = readFileSync(profilePath, 'utf-8');
+ }
+
+ // Check if PAI config already exists
+ if (content.includes(SHELL_MARKER_START)) {
+ // Remove existing PAI config block
+ const startIdx = content.indexOf(SHELL_MARKER_START);
+ const endIdx = content.indexOf(SHELL_MARKER_END);
+ if (startIdx !== -1 && endIdx !== -1) {
+ content = content.slice(0, startIdx) + content.slice(endIdx + SHELL_MARKER_END.length);
+ }
+ }
+
+ // Add new PAI config
+ const data = {
+ ...config,
+ createdAt: new Date().toISOString().split('T')[0],
+ };
+ const shellConfig = Mustache.render(shellTemplate, data);
+ content = content.trimEnd() + '\n' + shellConfig;
+
+ await writeAtomic(profilePath, content);
+
+ return profilePath;
+}
diff --git a/.claude/tools/setup/core/logger.ts b/.claude/tools/setup/core/logger.ts
new file mode 100644
index 00000000..b8deb03f
--- /dev/null
+++ b/.claude/tools/setup/core/logger.ts
@@ -0,0 +1,45 @@
+/**
+ * Pretty console output with colors
+ */
+
+const colors = {
+ reset: '\x1b[0m',
+ bold: '\x1b[1m',
+ dim: '\x1b[2m',
+ red: '\x1b[31m',
+ green: '\x1b[32m',
+ yellow: '\x1b[33m',
+ blue: '\x1b[34m',
+ magenta: '\x1b[35m',
+ cyan: '\x1b[36m',
+};
+
+export const logger = {
+ success(msg: string) {
+ console.log(`${colors.green}✓${colors.reset} ${msg}`);
+ },
+
+ error(msg: string) {
+ console.log(`${colors.red}✗${colors.reset} ${msg}`);
+ },
+
+ warn(msg: string) {
+ console.log(`${colors.yellow}⚠${colors.reset} ${msg}`);
+ },
+
+ info(msg: string) {
+ console.log(`${colors.blue}ℹ${colors.reset} ${msg}`);
+ },
+
+ step(msg: string) {
+ console.log(`${colors.cyan}→${colors.reset} ${msg}`);
+ },
+
+ dim(msg: string) {
+ console.log(`${colors.dim}${msg}${colors.reset}`);
+ },
+
+ blank() {
+ console.log();
+ },
+};
diff --git a/.claude/tools/setup/core/transaction.ts b/.claude/tools/setup/core/transaction.ts
new file mode 100644
index 00000000..b26f940b
--- /dev/null
+++ b/.claude/tools/setup/core/transaction.ts
@@ -0,0 +1,94 @@
+/**
+ * Transaction system for safe configuration changes
+ * Backs up files before modification, rolls back on failure
+ */
+
+import { existsSync, mkdirSync, copyFileSync, unlinkSync, renameSync } from 'fs';
+import { dirname, join } from 'path';
+import { homedir } from 'os';
+
+export interface BackupEntry {
+ originalPath: string;
+ backupPath: string;
+ existed: boolean;
+}
+
+export class Transaction {
+ private backups: BackupEntry[] = [];
+ private backupDir: string;
+ private committed = false;
+
+ constructor() {
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
+ this.backupDir = join(homedir(), '.pai-setup-backups', timestamp);
+ }
+
+ /**
+ * Backup a file before modifying it
+ */
+ async backup(filePath: string): Promise<void> {
+ const existed = existsSync(filePath);
+ const backupPath = join(this.backupDir, filePath.replace(/\//g, '__'));
+
+ if (existed) {
+ // Ensure backup directory exists
+ if (!existsSync(this.backupDir)) {
+ mkdirSync(this.backupDir, { recursive: true });
+ }
+ copyFileSync(filePath, backupPath);
+ }
+
+ this.backups.push({ originalPath: filePath, backupPath, existed });
+ }
+
+ /**
+ * Mark transaction as committed (backups no longer needed for rollback)
+ */
+ commit(): void {
+ this.committed = true;
+ // Optionally clean up backup directory after successful commit
+ // For now, keep backups for safety
+ }
+
+ /**
+ * Rollback all changes - restore original files
+ */
+ async rollback(): Promise<void> {
+ if (this.committed) {
+ throw new Error('Cannot rollback a committed transaction');
+ }
+
+ for (const entry of this.backups.reverse()) {
+ if (entry.existed) {
+ // Restore from backup
+ copyFileSync(entry.backupPath, entry.originalPath);
+ } else {
+ // File didn't exist before - remove it
+ if (existsSync(entry.originalPath)) {
+ unlinkSync(entry.originalPath);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get backup directory path (for user info)
+ */
+ getBackupDir(): string {
+ return this.backupDir;
+ }
+}
+
+/**
+ * Atomic file write - write to temp then rename
+ */
+export async function writeAtomic(filePath: string, content: string): Promise<void> {
+ const dir = dirname(filePath);
+ if (!existsSync(dir)) {
+ mkdirSync(dir, { recursive: true });
+ }
+
+ const tempPath = `${filePath}.tmp.${process.pid}`;
+ await Bun.write(tempPath, content);
+ renameSync(tempPath, filePath);
+}
diff --git a/.claude/tools/setup/interactive.ts b/.claude/tools/setup/interactive.ts
new file mode 100644
index 00000000..96484ff3
--- /dev/null
+++ b/.claude/tools/setup/interactive.ts
@@ -0,0 +1,142 @@
+/**
+ * Interactive prompts using @clack/prompts
+ */
+
+import * as p from '@clack/prompts';
+import { homedir } from 'os';
+import { execSync } from 'child_process';
+import { validatePath, validateEmail, validateName, validateAssistantName, expandPath } from './validators';
+import type { SetupConfig } from './configurators';
+
+/**
+ * Try to get default values from git config
+ */
+function getGitConfig(key: string): string | null {
+ try {
+ return execSync(`git config --global ${key}`, { encoding: 'utf-8' }).trim();
+ } catch {
+ return null;
+ }
+}
+
+/**
+ * Color options for assistant
+ */
+const colorOptions = [
+ { value: 'blue', label: 'Blue', hint: 'calm, professional' },
+ { value: 'purple', label: 'Purple', hint: 'creative, unique' },
+ { value: 'green', label: 'Green', hint: 'growth, balanced' },
+ { value: 'cyan', label: 'Cyan', hint: 'tech, modern' },
+ { value: 'red', label: 'Red', hint: 'bold, energetic' },
+];
+
+/**
+ * Run the interactive setup wizard
+ */
+export async function runInteractiveSetup(): Promise<SetupConfig | null> {
+ p.intro('🤖 PAI Setup Wizard');
+
+ const defaultName = getGitConfig('user.name') || '';
+ const defaultEmail = getGitConfig('user.email') || '';
+ const defaultPaiDir = `${homedir()}/.claude`;
+
+ const results = await p.group(
+ {
+ paiDir: () =>
+ p.text({
+ message: 'Where should PAI be installed?',
+ placeholder: defaultPaiDir,
+ initialValue: defaultPaiDir,
+ validate: validatePath,
+ }),
+
+ userName: () =>
+ p.text({
+ message: "What's your name?",
+ placeholder: defaultName || 'Your Name',
+ initialValue: defaultName,
+ validate: validateName,
+ }),
+
+ userEmail: () =>
+ p.text({
+ message: "What's your email?",
+ placeholder: defaultEmail || '[email protected]',
+ initialValue: defaultEmail,
+ validate: validateEmail,
+ }),
+
+ assistantName: () =>
+ p.text({
+ message: 'What would you like to name your AI assistant?',
+ placeholder: 'Kai',
+ initialValue: 'Kai',
+ validate: validateAssistantName,
+ }),
+
+ assistantColor: () =>
+ p.select({
+ message: 'Choose a color theme for your assistant:',
+ options: colorOptions,
+ initialValue: 'purple',
+ }),
+
+ voiceEnabled: () =>
+ p.confirm({
+ message: 'Enable voice server? (macOS only)',
+ initialValue: process.platform === 'darwin',
+ }),
+
+ updateShellProfile: () =>
+ p.confirm({
+ message: 'Add PAI environment variables to your shell profile?',
+ initialValue: true,
+ }),
+ },
+ {
+ onCancel: () => {
+ p.cancel('Setup cancelled.');
+ return null;
+ },
+ }
+ );
+
+ if (!results || p.isCancel(results)) {
+ return null;
+ }
+
+ // Show summary and confirm
+ p.note(
+ [
+ `📁 PAI Directory: ${results.paiDir}`,
+ `👤 Your Name: ${results.userName}`,
+ `📧 Email: ${results.userEmail}`,
+ `🤖 Assistant: ${results.assistantName}`,
+ `🎨 Color: ${results.assistantColor}`,
+ `🔊 Voice: ${results.voiceEnabled ? 'Enabled' : 'Disabled'}`,
+ `🐚 Shell Profile: ${results.updateShellProfile ? 'Will update' : 'Skip'}`,
+ ].join('\n'),
+ 'Configuration Summary'
+ );
+
+ const confirmed = await p.confirm({
+ message: 'Proceed with this configuration?',
+ initialValue: true,
+ });
+
+ if (!confirmed || p.isCancel(confirmed)) {
+ p.cancel('Setup cancelled.');
+ return null;
+ }
+
+ return {
+ paiDir: expandPath(results.paiDir as string),
+ userName: results.userName as string,
+ userEmail: results.userEmail as string,
+ assistantName: results.assistantName as string,
+ assistantColor: results.assistantColor as string,
+ voicePort: 8888,
+ voiceEnabled: results.voiceEnabled as boolean,
+ updateShellProfile: results.updateShellProfile as boolean,
+ };
+}
diff --git a/.claude/tools/setup/package.json b/.claude/tools/setup/package.json
new file mode 100644
index 00000000..2b2e102b
--- /dev/null
+++ b/.claude/tools/setup/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "setup",
+ "module": "index.ts",
+ "type": "module",
+ "private": true,
+ "devDependencies": {
+ "@types/bun": "latest",
+ "@types/mustache": "^4.2.6",
+ "bun-types": "^1.3.3"
+ },
+ "peerDependencies": {
+ "typescript": "^5"
+ },
+ "dependencies": {
+ "@clack/prompts": "^0.11.0",
+ "mustache": "^4.2.0"
+ }
+}
diff --git a/.claude/tools/setup/setup.ts b/.claude/tools/setup/setup.ts
new file mode 100644
index 00000000..e49c2abf
--- /dev/null
+++ b/.claude/tools/setup/setup.ts
@@ -0,0 +1,256 @@
+#!/usr/bin/env bun
+/**
+ * PAI Setup Wizard
+ * Interactive configuration tool for Personal AI Infrastructure
+ */
+
+import * as p from '@clack/prompts';
+import { parseArgs } from 'util';
+import { runInteractiveSetup } from './interactive';
+import { Transaction } from './core/transaction';
+import { logger } from './core/logger';
+import {
+ createDirectories,
+ writeProfile,
+ writePlist,
+ updateShellProfile,
+ type SetupConfig,
+} from './configurators';
+import { expandPath, validatePath, validateEmail, validateName, validateAssistantName } from './validators';
+
+/**
+ * Parse command line arguments
+ */
+function parseCliArgs() {
+ const { values } = parseArgs({
+ args: Bun.argv.slice(2),
+ options: {
+ 'pai-dir': { type: 'string' },
+ name: { type: 'string' },
+ email: { type: 'string' },
+ 'assistant-name': { type: 'string' },
+ 'assistant-color': { type: 'string', default: 'purple' },
+ 'voice-port': { type: 'string', default: '8888' },
+ 'skip-voice': { type: 'boolean', default: false },
+ 'skip-shell-profile': { type: 'boolean', default: false },
+ 'dry-run': { type: 'boolean', default: false },
+ force: { type: 'boolean', default: false },
+ help: { type: 'boolean', default: false },
+ version: { type: 'boolean', default: false },
+ },
+ allowPositionals: false,
+ });
+
+ return values;
+}
+
+/**
+ * Show help message
+ */
+function showHelp() {
+ console.log(`
+PAI Setup Wizard - Configure your Personal AI Infrastructure
+
+Usage:
+ bun run setup.ts [options]
+
+Options:
+ --pai-dir <path> PAI installation directory (default: ~/.claude)
+ --name <name> Your name
+ --email <email> Your email
+ --assistant-name <name> AI assistant name (default: Kai)
+ --assistant-color <color> Color theme: blue, purple, green, cyan, red (default: purple)
+ --voice-port <port> Voice server port (default: 8888)
+ --skip-voice Don't configure voice server
+ --skip-shell-profile Don't update shell profile
+ --dry-run Show what would be done without making changes
+ --force Skip confirmation prompts
+ --help Show this help message
+ --version Show version
+
+Interactive Mode:
+ Run without arguments for interactive setup wizard.
+
+Examples:
+ # Interactive setup (recommended)
+ bun run setup.ts
+
+ # Non-interactive setup
+ bun run setup.ts --pai-dir ~/.claude --name "Jane Doe" --email [email protected] --force
+`);
+}
+
+/**
+ * Build config from CLI args
+ */
+function buildConfigFromArgs(args: ReturnType<typeof parseCliArgs>): SetupConfig | null {
+ // Validate required fields for non-interactive mode
+ if (!args['pai-dir'] || !args.name || !args.email) {
+ logger.error('Non-interactive mode requires --pai-dir, --name, and --email');
+ return null;
+ }
+
+ const paiDirError = validatePath(args['pai-dir']);
+ if (paiDirError) {
+ logger.error(`Invalid PAI directory: ${paiDirError}`);
+ return null;
+ }
+
+ const nameError = validateName(args.name);
+ if (nameError) {
+ logger.error(`Invalid name: ${nameError}`);
+ return null;
+ }
+
+ const emailError = validateEmail(args.email);
+ if (emailError) {
+ logger.error(`Invalid email: ${emailError}`);
+ return null;
+ }
+
+ const assistantName = args['assistant-name'] || 'Kai';
+ const assistantNameError = validateAssistantName(assistantName);
+ if (assistantNameError) {
+ logger.error(`Invalid assistant name: ${assistantNameError}`);
+ return null;
+ }
+
+ return {
+ paiDir: expandPath(args['pai-dir']),
+ userName: args.name,
+ userEmail: args.email,
+ assistantName,
+ assistantColor: args['assistant-color'] || 'purple',
+ voicePort: parseInt(args['voice-port'] || '8888', 10),
+ voiceEnabled: !args['skip-voice'] && process.platform === 'darwin',
+ updateShellProfile: !args['skip-shell-profile'],
+ };
+}
+
+/**
+ * Apply configuration changes
+ */
+async function applyConfiguration(config: SetupConfig, dryRun: boolean): Promise<boolean> {
+ const transaction = new Transaction();
+
+ try {
+ // Step 1: Create directories
+ p.log.step('Creating directory structure...');
+ if (!dryRun) {
+ await createDirectories(config);
+ }
+ p.log.success('Directory structure created');
+
+ // Step 2: Write profile config
+ p.log.step('Writing profile configuration...');
+ if (!dryRun) {
+ await writeProfile(config, transaction);
+ }
+ p.log.success(`Profile saved to ${config.paiDir}/config/profile.json`);
+
+ // Step 3: Configure voice server (macOS only)
+ if (config.voiceEnabled) {
+ p.log.step('Configuring voice server...');
+ if (!dryRun) {
+ await writePlist(config, transaction);
+ }
+ p.log.success('Voice server plist installed');
+ } else {
+ p.log.info('Voice server: skipped');
+ }
+
+ // Step 4: Update shell profile
+ if (config.updateShellProfile) {
+ p.log.step('Updating shell profile...');
+ if (!dryRun) {
+ const profilePath = await updateShellProfile(config, transaction);
+ if (profilePath) {
+ p.log.success(`Shell profile updated: ${profilePath}`);
+ }
+ } else {
+ p.log.success('Shell profile would be updated');
+ }
+ } else {
+ p.log.info('Shell profile: skipped');
+ }
+
+ // Commit transaction
+ if (!dryRun) {
+ transaction.commit();
+ }
+
+ return true;
+ } catch (error) {
+ logger.error(`Setup failed: ${error}`);
+
+ // Rollback changes
+ try {
+ if (!dryRun) {
+ await transaction.rollback();
+ logger.info('Changes rolled back successfully');
+ }
+ } catch (rollbackError) {
+ logger.error(`Rollback failed: ${rollbackError}`);
+ }
+
+ return false;
+ }
+}
+
+/**
+ * Main entry point
+ */
+async function main() {
+ const args = parseCliArgs();
+
+ if (args.help) {
+ showHelp();
+ process.exit(0);
+ }
+
+ if (args.version) {
+ console.log('PAI Setup Wizard v1.0.0');
+ process.exit(0);
+ }
+
+ let config: SetupConfig | null;
+
+ // Determine mode: interactive vs non-interactive
+ const isNonInteractive = args['pai-dir'] || args.name || args.email || args.force;
+
+ if (isNonInteractive) {
+ config = buildConfigFromArgs(args);
+ } else {
+ config = await runInteractiveSetup();
+ }
+
+ if (!config) {
+ process.exit(1);
+ }
+
+ // Apply configuration
+ const success = await applyConfiguration(config, args['dry-run'] ?? false);
+
+ if (success) {
+ p.outro('✨ PAI setup complete!');
+
+ logger.blank();
+ logger.info('Next steps:');
+ logger.step(`1. Reload your shell: source ~/.zshrc`);
+ if (config.voiceEnabled) {
+ logger.step(`2. Load voice server: launchctl load ~/Library/LaunchAgents/com.pai.voiceserver.plist`);
+ }
+ logger.step(`${config.voiceEnabled ? '3' : '2'}. Start Claude: claude`);
+ logger.blank();
+ logger.dim(`Your AI assistant "${config.assistantName}" is ready!`);
+
+ process.exit(0);
+ } else {
+ process.exit(1);
+ }
+}
+
+main().catch((error) => {
+ logger.error(`Unexpected error: ${error}`);
+ process.exit(1);
+});
diff --git a/.claude/tools/setup/templates/plist.ts b/.claude/tools/setup/templates/plist.ts
new file mode 100644
index 00000000..a2f7751e
--- /dev/null
+++ b/.claude/tools/setup/templates/plist.ts
@@ -0,0 +1,52 @@
+/**
+ * macOS LaunchAgent plist template for voice server
+ */
+
+export const plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>com.pai.voiceserver</string>
+
+ <key>ProgramArguments</key>
+ <array>
+ <string>{{{bunPath}}}</string>
+ <string>run</string>
+ <string>{{{paiDir}}}/voice-server/server.ts</string>
+ </array>
+
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>HOME</key>
+ <string>{{{homeDir}}}</string>
+ <key>PATH</key>
+ <string>{{{homeDir}}}/.bun/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
+ <key>PAI_DIR</key>
+ <string>{{{paiDir}}}</string>
+ <key>PORT</key>
+ <string>{{voicePort}}</string>
+ </dict>
+
+ <key>WorkingDirectory</key>
+ <string>{{{paiDir}}}/voice-server</string>
+
+ <key>RunAtLoad</key>
+ <true/>
+
+ <key>KeepAlive</key>
+ <dict>
+ <key>SuccessfulExit</key>
+ <false/>
+ </dict>
+
+ <key>StandardOutPath</key>
+ <string>{{{paiDir}}}/voice-server/logs/voice-server.log</string>
+
+ <key>StandardErrorPath</key>
+ <string>{{{paiDir}}}/voice-server/logs/voice-server-error.log</string>
+
+ <key>ThrottleInterval</key>
+ <integer>10</integer>
+</dict>
+</plist>`;
diff --git a/.claude/tools/setup/templates/profile.ts b/.claude/tools/setup/templates/profile.ts
new file mode 100644
index 00000000..f8dc629e
--- /dev/null
+++ b/.claude/tools/setup/templates/profile.ts
@@ -0,0 +1,23 @@
+/**
+ * User profile configuration template
+ */
+
+export const profileTemplate = `{
+ "user": {
+ "name": "{{{userName}}}",
+ "email": "{{{userEmail}}}"
+ },
+ "assistant": {
+ "name": "{{{assistantName}}}",
+ "color": "{{{assistantColor}}}"
+ },
+ "paths": {
+ "pai_dir": "{{{paiDir}}}"
+ },
+ "voice": {
+ "port": {{voicePort}},
+ "enabled": {{voiceEnabled}}
+ },
+ "created": "{{{createdAt}}}",
+ "version": "1.0.0"
+}`;
diff --git a/.claude/tools/setup/templates/shell.ts b/.claude/tools/setup/templates/shell.ts
new file mode 100644
index 00000000..633d4721
--- /dev/null
+++ b/.claude/tools/setup/templates/shell.ts
@@ -0,0 +1,16 @@
+/**
+ * Shell profile snippet template
+ */
+
+export const shellTemplate = `
+# PAI (Personal AI Infrastructure) Configuration
+# Added by pai-setup on {{{createdAt}}}
+export PAI_DIR="{{{paiDir}}}"
+export DA="{{{assistantName}}}"
+export DA_COLOR="{{{assistantColor}}}"
+export ENGINEER_NAME="{{{userName}}}"
+# End PAI Configuration
+`;
+
+export const SHELL_MARKER_START = '# PAI (Personal AI Infrastructure) Configuration';
+export const SHELL_MARKER_END = '# End PAI Configuration';
diff --git a/.claude/tools/setup/tsconfig.json b/.claude/tools/setup/tsconfig.json
new file mode 100644
index 00000000..bfa0fead
--- /dev/null
+++ b/.claude/tools/setup/tsconfig.json
@@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ // Environment setup & latest features
+ "lib": ["ESNext"],
+ "target": "ESNext",
+ "module": "Preserve",
+ "moduleDetection": "force",
+ "jsx": "react-jsx",
+ "allowJs": true,
+
+ // Bundler mode
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "noEmit": true,
+
+ // Best practices
+ "strict": true,
+ "skipLibCheck": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true,
+ "noImplicitOverride": true,
+
+ // Some stricter flags (disabled by default)
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "noPropertyAccessFromIndexSignature": false
+ }
+}
diff --git a/.claude/tools/setup/validators/index.ts b/.claude/tools/setup/validators/index.ts
new file mode 100644
index 00000000..dbe5bcbc
--- /dev/null
+++ b/.claude/tools/setup/validators/index.ts
@@ -0,0 +1,85 @@
+/**
+ * Input validators for setup wizard
+ */
+
+import { existsSync } from 'fs';
+import { homedir } from 'os';
+import { dirname } from 'path';
+
+/**
+ * Expand ~ to home directory
+ */
+export function expandPath(path: string): string {
+ if (path.startsWith('~/')) {
+ return path.replace('~', homedir());
+ }
+ if (path === '~') {
+ return homedir();
+ }
+ return path;
+}
+
+/**
+ * Validate PAI directory path
+ */
+export function validatePath(path: string): string | undefined {
+ if (!path || path.trim() === '') {
+ return 'Path is required';
+ }
+
+ const expanded = expandPath(path.trim());
+ const parent = dirname(expanded);
+
+ // Check parent directory exists (we'll create the target)
+ if (!existsSync(parent)) {
+ return `Parent directory does not exist: ${parent}`;
+ }
+
+ return undefined; // Valid
+}
+
+/**
+ * Validate email format
+ */
+export function validateEmail(email: string): string | undefined {
+ if (!email || email.trim() === '') {
+ return 'Email is required';
+ }
+
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ if (!emailRegex.test(email.trim())) {
+ return 'Invalid email format';
+ }
+
+ return undefined; // Valid
+}
+
+/**
+ * Validate name (non-empty)
+ */
+export function validateName(name: string): string | undefined {
+ if (!name || name.trim() === '') {
+ return 'Name is required';
+ }
+
+ if (name.trim().length < 2) {
+ return 'Name must be at least 2 characters';
+ }
+
+ return undefined; // Valid
+}
+
+/**
+ * Validate assistant name
+ */
+export function validateAssistantName(name: string): string | undefined {
+ if (!name || name.trim() === '') {
+ return 'Assistant name is required';
+ }
+
+ if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name.trim())) {
+ return 'Assistant name must start with a letter and contain only letters, numbers, underscores, or hyphens';
+ }
+
+ return undefined; // Valid
+}
diff --git a/.claude/voice-server/macos-service/com.paivoice.server.plist.template b/.claude/voice-server/macos-service/com.paivoice.server.plist.template
index b82293ec..38e12678 100644
--- a/.claude/voice-server/macos-service/com.paivoice.server.plist.template
+++ b/.claude/voice-server/macos-service/com.paivoice.server.plist.template
@@ -4,30 +4,32 @@
<dict>
<key>Label</key>
<string>com.paivoice.server</string>
-
+
<key>ProgramArguments</key>
<array>
- <string>/usr/local/bin/bun</string>
+ <string>__BUN_PATH__</string>
<string>run</string>
<string>__PAI_DIR__/voice-server/server.ts</string>
</array>
-
+
<key>EnvironmentVariables</key>
<dict>
<key>PORT</key>
<string>8888</string>
<key>PATH</key>
- <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
+ <string>__HOME__/.bun/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
<key>HOME</key>
<string>__HOME__</string>
+ <key>PAI_DIR</key>
+ <string>__PAI_DIR__</string>
</dict>
-
+
<key>WorkingDirectory</key>
<string>__PAI_DIR__/voice-server</string>
-
+
<key>RunAtLoad</key>
<true/>
-
+
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
@@ -35,14 +37,14 @@
<key>Crashed</key>
<true/>
</dict>
-
+
<key>StandardOutPath</key>
<string>__PAI_DIR__/voice-server/logs/voice-server.log</string>
-
+
<key>StandardErrorPath</key>
<string>__PAI_DIR__/voice-server/logs/voice-server-error.log</string>
-
+
<key>ThrottleInterval</key>
<integer>10</integer>
</dict>
-</plist>
\ No newline at end of file
+</plist>
diff --git a/.claude/voice-server/macos-service/install.sh b/.claude/voice-server/macos-service/install.sh
index e83c3cd4..234d5ccf 100755
--- a/.claude/voice-server/macos-service/install.sh
+++ b/.claude/voice-server/macos-service/install.sh
@@ -9,18 +9,31 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SERVICE_NAME="com.paivoice.server"
PLIST_FILE="com.paivoice.server.plist"
LAUNCH_AGENTS_DIR="$HOME/Library/LaunchAgents"
-VOICE_SERVER_DIR="$HOME/.claude/voice-server"
+
+# Use PAI_DIR if set, otherwise default to ~/.claude
+PAI_DIR="${PAI_DIR:-$HOME/.claude}"
+VOICE_SERVER_DIR="${PAI_DIR}/voice-server"
echo "🚀 PAIVoice Server Service Installer"
echo "==========================================="
echo ""
-# Check if bun is installed
-if ! command -v bun &> /dev/null; then
+# Check if bun is installed and find its path
+BUN_PATH=""
+if [ -f "$HOME/.bun/bin/bun" ]; then
+ BUN_PATH="$HOME/.bun/bin/bun"
+elif [ -f "/opt/homebrew/bin/bun" ]; then
+ BUN_PATH="/opt/homebrew/bin/bun"
+elif [ -f "/usr/local/bin/bun" ]; then
+ BUN_PATH="/usr/local/bin/bun"
+elif command -v bun &> /dev/null; then
+ BUN_PATH="$(which bun)"
+else
echo "❌ Error: bun is not installed"
echo "Please install bun first: curl -fsSL https://bun.sh/install | bash"
exit 1
fi
+echo "✅ Found bun at: ${BUN_PATH}"
# Check for ElevenLabs API configuration
echo "🔑 Checking API configuration..."
@@ -60,9 +73,24 @@ if launchctl list | grep -q "${SERVICE_NAME}"; then
launchctl remove "${SERVICE_NAME}" 2>/dev/null || true
fi
-# Copy plist file to LaunchAgents
-echo "📝 Installing service configuration..."
-cp "${SCRIPT_DIR}/${PLIST_FILE}" "${LAUNCH_AGENTS_DIR}/"
+# Generate plist from template with correct paths
+echo "📝 Generating service configuration..."
+PLIST_TEMPLATE="${SCRIPT_DIR}/com.paivoice.server.plist.template"
+
+if [ -f "${PLIST_TEMPLATE}" ]; then
+ # Use template and substitute paths
+ sed -e "s|__BUN_PATH__|${BUN_PATH}|g" \
+ -e "s|__PAI_DIR__|${PAI_DIR}|g" \
+ -e "s|__HOME__|${HOME}|g" \
+ "${PLIST_TEMPLATE}" > "${LAUNCH_AGENTS_DIR}/${PLIST_FILE}"
+ echo "✅ Generated plist with your paths:"
+ echo " PAI_DIR: ${PAI_DIR}"
+ echo " BUN: ${BUN_PATH}"
+else
+ # Fallback to copying static plist (legacy)
+ echo "⚠️ Template not found, using static plist"
+ cp "${SCRIPT_DIR}/${PLIST_FILE}" "${LAUNCH_AGENTS_DIR}/"
+fi
# Load the service
echo "🔧 Loading service..."
diff --git a/README.md b/README.md
index 8a5da095..320fa90e 100644
--- a/README.md
+++ b/README.md
@@ -92,53 +92,55 @@ Big updates! PAI is now fully **platform-agnostic** — your AI identity, your s
## 🚀 Quick Start
-### 1. Install Prerequisites
-
-```bash
-# Install Bun (PAI's package manager)
-curl -fsSL https://bun.sh/install | bash
-
-# Install Claude Code — https://code.claude.com
-```
-
-### 2. Clone and Configure
+### 1. Clone PAI
```bash
git clone https://github.com/danielmiessler/Personal_AI_Infrastructure.git
cd Personal_AI_Infrastructure
-
-# Copy environment template and add your API keys
-cp .claude/.env.example .claude/.env
```
-### 3. Copy to Your System
+### 2. Run the Setup Wizard
```bash
-# Backup existing config (if any)
-[ -d ~/.claude ] && mv ~/.claude ~/.claude.backup.$(date +%Y%m%d_%H%M%S)
-
-# Copy PAI to your home directory
-cp -r .claude ~/.claude
+.claude/tools/setup/bootstrap.sh
```
-<details>
-<summary><strong>Alternative: Symlink</strong> (keeps PAI updatable via git pull)</summary>
+The bootstrap script will:
+- Check your shell (recommends zsh or bash)
+- Install Bun if needed (PAI's package manager)
+- Check for Claude Code
+- Launch the interactive setup wizard
+
+The setup wizard will:
+- Ask where to install PAI (default: `~/.claude`)
+- Configure your name and email
+- Name your AI assistant (default: "Kai")
+- Choose a color theme
+- Set up voice server (macOS)
+- Add environment variables to your shell
+
+### 3. Add Your API Keys
```bash
-[ -d ~/.claude ] && mv ~/.claude ~/.claude.backup.$(date +%Y%m%d_%H%M%S)
-ln -s $(pwd)/.claude ~/.claude
-```
+# Copy environment template
+cp ~/.claude/.env.example ~/.claude/.env
-</details>
+# Edit with your API keys
+nano ~/.claude/.env
+```
### 4. Start Claude Code
```bash
+source ~/.zshrc # Load PAI environment
claude
```
-> [!IMPORTANT]
-> The CORE skill loads automatically at session start and provides all PAI functionality.
+> [!TIP]
+> **Non-interactive setup** for automation:
+> ```bash
+> bun run setup.ts --pai-dir ~/.claude --name "Your Name" --email [email protected] --force
+> ```
📚 For detailed setup, see [`docs/QUICKSTART.md`](docs/QUICKSTART.md)
diff --git a/docs/QUICKSTART.md b/docs/QUICKSTART.md
index 7bccb259..4fc74e1a 100644
--- a/docs/QUICKSTART.md
+++ b/docs/QUICKSTART.md
@@ -4,24 +4,6 @@
---
-## Prerequisites (1 minute)
-
-### Install Bun
-
-```bash
-# Install Bun (PAI's package manager)
-curl -fsSL https://bun.sh/install | bash
-
-# Restart your terminal or source your profile
-source ~/.bashrc # or ~/.zshrc
-```
-
-### Install Claude Code
-
-Follow the installation instructions at [code.claude.com](https://code.claude.com)
-
----
-
## Installation (2 minutes)
### 1. Clone PAI
@@ -31,60 +13,62 @@ git clone https://github.com/danielmiessler/Personal_AI_Infrastructure.git
cd Personal_AI_Infrastructure
```
-### 2. Configure Environment
+### 2. Run the Setup Wizard
```bash
-# Copy environment template
-cp .claude/.env.example .claude/.env
-
-# Edit with your API keys
-nano .claude/.env # or use your preferred editor
-
-# Required: ANTHROPIC_API_KEY
-# Optional: Add other API keys for specific skills
+.claude/tools/setup/bootstrap.sh
```
-### 3. Configure PAI_DIR
+The bootstrap script handles everything:
+- **Shell check** — Recommends zsh or bash if you're using something else
+- **Bun install** — Offers to install Bun if not found (PAI's package manager)
+- **Claude Code check** — Reminds you to install Claude Code if missing
+- **Setup wizard** — Launches the interactive configuration
-Edit `.claude/settings.json` and set `PAI_DIR` to your actual path:
+The interactive wizard will configure everything for you:
-```json
-"env": {
- "PAI_DIR": "/Users/yourname/.claude", // <- Change this!
- ...
-}
-```
-
-**Examples:**
-- macOS: `"/Users/john/.claude"`
-- Linux: `"/home/john/.claude"`
-- Custom location: `"/opt/pai"` (if you want PAI elsewhere)
+- **PAI Directory** — Where to install (default: `~/.claude`)
+- **Your Name** — Auto-detected from git config
+- **Your Email** — Auto-detected from git config
+- **Assistant Name** — Name your AI (default: "Kai")
+- **Color Theme** — Choose blue, purple, green, cyan, or red
+- **Voice Server** — Enable text-to-speech (macOS only)
+- **Shell Profile** — Add PAI environment variables
-### 4. Install to Your System
+#### Non-Interactive Mode (for automation)
-**Option A: Copy (recommended for beginners)**
```bash
-# Copy .claude directory to home
-cp -r .claude ~/.claude
+bun run setup.ts \
+ --pai-dir ~/.claude \
+ --name "Your Name" \
+ --email [email protected] \
+ --assistant-name "Kai" \
+ --force
```
-**Option B: Symlink (for development)**
+#### Dry Run (preview changes)
+
```bash
-# Symlink for live updates
-ln -s $(pwd)/.claude ~/.claude
+bun run setup.ts --dry-run
```
-### 5. Add PAI_DIR to Shell (Optional but Recommended)
+### 3. Add Your API Keys
-Add to your `~/.zshrc` or `~/.bashrc`:
```bash
-export PAI_DIR="$HOME/.claude"
+# Copy environment template
+cp ~/.claude/.env.example ~/.claude/.env
+
+# Edit with your API keys
+nano ~/.claude/.env
+
+# Required: ANTHROPIC_API_KEY
+# Optional: ELEVENLABS_API_KEY for voice
```
-Or copy the provided aliases:
+### 4. Reload Your Shell
+
```bash
-cat .claude/zshrc-aliases >> ~/.zshrc
-source ~/.zshrc
+source ~/.zshrc # or ~/.bashrc
```
---