Skip to content

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

feat: Add Windows PowerShell support for PAI setup

Daniel Miesslerb25c35890bc1
diff --git a/.claude/tools/setup/bootstrap.ps1 b/.claude/tools/setup/bootstrap.ps1
new file mode 100644
index 00000000..93473b26
--- /dev/null
+++ b/.claude/tools/setup/bootstrap.ps1
@@ -0,0 +1,102 @@
+# PAI Bootstrap Script for Windows
+# Checks prerequisites and runs the setup wizard
+#
+# Usage:
+# & "$env:USERPROFILE\.claude\.claude\tools\setup\bootstrap.ps1"
+
+$ErrorActionPreference = "Stop"
+
+# Banner
+Write-Host ""
+Write-Host "╔══════════════════════════════════════════════════════════════╗"
+Write-Host "║ PAI Setup Bootstrap ║"
+Write-Host "║ Personal AI Infrastructure Configuration ║"
+Write-Host "╚══════════════════════════════════════════════════════════════╝"
+Write-Host ""
+
+# Check and install Bun
+function Test-Bun {
+ if (Get-Command bun -ErrorAction SilentlyContinue) {
+ $version = bun --version
+ Write-Host "✓ Bun is installed (v$version)" -ForegroundColor Green
+ return $true
+ }
+
+ Write-Host "⚠ Bun is not installed" -ForegroundColor Yellow
+ Write-Host ""
+ Write-Host " Bun is required to run PAI. It's a fast JavaScript runtime."
+ Write-Host ""
+ $response = Read-Host " Install Bun now? (y/n)"
+
+ if ($response -eq 'y') {
+ Write-Host "→ Installing Bun..." -ForegroundColor Cyan
+ irm bun.sh/install.ps1 | iex
+
+ # Refresh PATH to include newly installed Bun
+ $env:BUN_INSTALL = "$env:USERPROFILE\.bun"
+ $env:PATH = "$env:BUN_INSTALL\bin;$env:PATH"
+
+ if (Get-Command bun -ErrorAction SilentlyContinue) {
+ Write-Host "✓ Bun installed successfully!" -ForegroundColor Green
+ Write-Host ""
+ Write-Host "! You may need to restart PowerShell after setup completes." -ForegroundColor Yellow
+ return $true
+ } else {
+ Write-Host "✗ Bun installation failed" -ForegroundColor Red
+ Write-Host " Try manually: irm bun.sh/install.ps1 | iex"
+ exit 1
+ }
+ } else {
+ Write-Host "✗ Bun is required. Install it and run this script again." -ForegroundColor Red
+ exit 1
+ }
+}
+
+# Check for Claude Code
+function Test-ClaudeCode {
+ Write-Host ""
+ if (Get-Command claude -ErrorAction SilentlyContinue) {
+ Write-Host "✓ Claude Code is installed" -ForegroundColor Green
+ } else {
+ Write-Host "⚠ Claude Code not found in PATH" -ForegroundColor Yellow
+ Write-Host " Install from: https://code.claude.com"
+ Write-Host " (You can continue setup without it)"
+ Write-Host ""
+ }
+}
+
+# Run the TypeScript setup wizard
+function Start-Wizard {
+ param(
+ [Parameter(ValueFromRemainingArguments=$true)]
+ [string[]]$Arguments
+ )
+
+ Write-Host ""
+ Write-Host "→ Installing setup dependencies..." -ForegroundColor Cyan
+
+ $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
+ Push-Location $scriptDir
+
+ try {
+ bun install --silent
+
+ Write-Host ""
+ Write-Host "→ Starting PAI Setup Wizard..." -ForegroundColor Cyan
+ Write-Host ""
+
+ if ($Arguments) {
+ bun run setup.ts @Arguments
+ } else {
+ bun run setup.ts
+ }
+ }
+ finally {
+ Pop-Location
+ }
+}
+
+# Main execution
+Test-Bun
+Test-ClaudeCode
+Start-Wizard @args
diff --git a/.claude/tools/setup/configurators/index.ts b/.claude/tools/setup/configurators/index.ts
index 436def49..b21e308c 100644
--- a/.claude/tools/setup/configurators/index.ts
+++ b/.claude/tools/setup/configurators/index.ts
@@ -10,6 +10,7 @@ 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';
+import { powershellTemplate, PS_MARKER_START, PS_MARKER_END } from '../templates/powershell';
export interface SetupConfig {
paiDir: string;
@@ -108,16 +109,45 @@ export async function writePlist(config: SetupConfig, transaction: Transaction):
}
/**
- * Update shell profile (.zshrc or .bashrc)
+ * Update shell profile (.zshrc, .bashrc, or PowerShell profile)
*/
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');
+ const isWindows = process.platform === 'win32';
+ let profilePath: string;
+ let template: string;
+ let markerStart: string;
+ let markerEnd: string;
+
+ if (isWindows) {
+ // PowerShell profile location
+ const documentsPath = join(
+ process.env.USERPROFILE || homedir(),
+ 'Documents',
+ 'PowerShell'
+ );
+
+ // Create PowerShell directory if needed
+ if (!existsSync(documentsPath)) {
+ mkdirSync(documentsPath, { recursive: true });
+ }
+
+ profilePath = join(documentsPath, 'Microsoft.PowerShell_profile.ps1');
+ template = powershellTemplate;
+ markerStart = PS_MARKER_START;
+ markerEnd = PS_MARKER_END;
+ } else {
+ // Unix: .zshrc or .bashrc
+ const shell = process.env.SHELL || '';
+ const isZsh = shell.includes('zsh');
+ profilePath = join(homedir(), isZsh ? '.zshrc' : '.bashrc');
+ template = shellTemplate;
+ markerStart = SHELL_MARKER_START;
+ markerEnd = SHELL_MARKER_END;
+ }
await transaction.backup(profilePath);
@@ -128,12 +158,12 @@ export async function updateShellProfile(config: SetupConfig, transaction: Trans
}
// Check if PAI config already exists
- if (content.includes(SHELL_MARKER_START)) {
+ if (content.includes(markerStart)) {
// Remove existing PAI config block
- const startIdx = content.indexOf(SHELL_MARKER_START);
- const endIdx = content.indexOf(SHELL_MARKER_END);
+ const startIdx = content.indexOf(markerStart);
+ const endIdx = content.indexOf(markerEnd);
if (startIdx !== -1 && endIdx !== -1) {
- content = content.slice(0, startIdx) + content.slice(endIdx + SHELL_MARKER_END.length);
+ content = content.slice(0, startIdx) + content.slice(endIdx + markerEnd.length);
}
}
@@ -142,7 +172,7 @@ export async function updateShellProfile(config: SetupConfig, transaction: Trans
...config,
createdAt: new Date().toISOString().split('T')[0],
};
- const shellConfig = Mustache.render(shellTemplate, data);
+ const shellConfig = Mustache.render(template, data);
content = content.trimEnd() + '\n' + shellConfig;
await writeAtomic(profilePath, content);
diff --git a/.claude/tools/setup/templates/powershell.ts b/.claude/tools/setup/templates/powershell.ts
new file mode 100644
index 00000000..9e8337e8
--- /dev/null
+++ b/.claude/tools/setup/templates/powershell.ts
@@ -0,0 +1,16 @@
+/**
+ * PowerShell profile snippet template (Windows)
+ */
+
+export const powershellTemplate = `
+# PAI (Personal AI Infrastructure) Configuration
+# Added by pai-setup on {{{createdAt}}}
+$env:PAI_DIR = "{{{paiDir}}}"
+$env:DA = "{{{assistantName}}}"
+$env:DA_COLOR = "{{{assistantColor}}}"
+$env:ENGINEER_NAME = "{{{userName}}}"
+# End PAI Configuration
+`;
+
+export const PS_MARKER_START = '# PAI (Personal AI Infrastructure) Configuration';
+export const PS_MARKER_END = '# End PAI Configuration';
diff --git a/.claude/tools/setup/validators/index.ts b/.claude/tools/setup/validators/index.ts
index dbe5bcbc..29208646 100644
--- a/.claude/tools/setup/validators/index.ts
+++ b/.claude/tools/setup/validators/index.ts
@@ -8,13 +8,18 @@ import { dirname } from 'path';
/**
* Expand ~ to home directory
+ * Uses USERPROFILE on Windows, HOME on Unix
*/
export function expandPath(path: string): string {
+ const home = process.platform === 'win32'
+ ? (process.env.USERPROFILE || homedir())
+ : homedir();
+
if (path.startsWith('~/')) {
- return path.replace('~', homedir());
+ return path.replace('~', home);
}
if (path === '~') {
- return homedir();
+ return home;
}
return path;
}
diff --git a/README.md b/README.md
index c10f7d68..2ec30dd1 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,12 @@
# The best AI in the world should be available to everyone
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/pai-overview.png">
+ <source media="(prefers-color-scheme: light)" srcset="docs/images/pai-overview.png">
+ <img alt="PAI Architecture Overview" src="docs/images/pai-overview.png" width="800">
+</picture>
+
</div>
Right now the most powerful AI setups are being built inside companies for efficiency and profits.
@@ -51,12 +57,6 @@ That's what PAI is. It's the foundation for building a Personal AI System that u
PAI (Personal AI Infrastructure) is an open-source template for building your own AI-powered operating system. It's currently built on [Claude Code](https://claude.ai/code), but designed to be platform-independent — the architecture, skills, and workflows are structured so future migrations to other AI platforms are straightforward.
-<picture>
- <source media="(prefers-color-scheme: dark)" srcset="docs/images/pai-overview.png">
- <source media="(prefers-color-scheme: light)" srcset="docs/images/pai-overview.png">
- <img alt="PAI Architecture Overview" src="docs/images/pai-overview.png" width="800">
-</picture>
-
| Component | Description |
|-----------|-------------|
| **Skills** | Self-contained AI capabilities with routing, workflows, and documentation |
@@ -86,72 +86,99 @@ Big updates! PAI is now fully **platform-agnostic** — your AI identity, your s
## 🚀 Quick Start
-### 1. Clone PAI
+Choose your platform:
+
+<details>
+<summary><strong>🍎 macOS</strong></summary>
+
+<br/>
-**macOS / Linux:**
+**1. Clone PAI**
```bash
git clone https://github.com/danielmiessler/PAI.git ~/.claude
```
-**Windows (PowerShell):**
-```powershell
-git clone https://github.com/danielmiessler/PAI.git $env:USERPROFILE\.claude
+**2. Run the Setup Wizard**
+```bash
+~/.claude/.claude/tools/setup/bootstrap.sh
```
-### 2. Run the Setup Wizard
-
-**macOS / Linux:**
+**3. Add Your API Keys**
```bash
-~/.claude/.claude/tools/setup/bootstrap.sh
+cp ~/.claude/.env.example ~/.claude/.env
+nano ~/.claude/.env
```
-**Windows (PowerShell):**
-```powershell
-& "$env:USERPROFILE\.claude\.claude\tools\setup\bootstrap.ps1"
+**4. Start Claude Code**
+```bash
+source ~/.zshrc # Load PAI environment
+claude
```
-The bootstrap script will:
-- Check your environment (zsh/bash/PowerShell)
-- Install Bun if needed (PAI's package manager)
-- Check for Claude Code
-- Launch the interactive setup wizard
+</details>
-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 only)
-- Add environment variables to your shell profile
+<details>
+<summary><strong>🐧 Linux</strong></summary>
-### 3. Add Your API Keys
+<br/>
-**macOS / Linux:**
+**1. Clone PAI**
+```bash
+git clone https://github.com/danielmiessler/PAI.git ~/.claude
+```
+
+**2. Run the Setup Wizard**
+```bash
+~/.claude/.claude/tools/setup/bootstrap.sh
+```
+
+**3. Add Your API Keys**
```bash
cp ~/.claude/.env.example ~/.claude/.env
nano ~/.claude/.env
```
-**Windows (PowerShell):**
+**4. Start Claude Code**
+```bash
+source ~/.bashrc # Load PAI environment
+claude
+```
+
+</details>
+
+<details>
+<summary><strong>🪟 Windows</strong></summary>
+
+<br/>
+
+**1. Clone PAI** (PowerShell)
```powershell
-Copy-Item "$env:USERPROFILE\.claude\.env.example" "$env:USERPROFILE\.claude\.env"
-notepad "$env:USERPROFILE\.claude\.env"
+git clone https://github.com/danielmiessler/PAI.git $env:USERPROFILE\.claude
```
-### 4. Start Claude Code
+**2. Run the Setup Wizard**
+```powershell
+& "$env:USERPROFILE\.claude\.claude\tools\setup\bootstrap.ps1"
+```
-**macOS / Linux:**
-```bash
-source ~/.zshrc # Load PAI environment
-claude
+**3. Add Your API Keys**
+```powershell
+Copy-Item "$env:USERPROFILE\.claude\.env.example" "$env:USERPROFILE\.claude\.env"
+notepad "$env:USERPROFILE\.claude\.env"
```
-**Windows (PowerShell):**
+**4. Start Claude Code**
```powershell
# Restart PowerShell to load environment, then:
claude
```
+</details>
+
+<br/>
+
+The setup wizard will configure your name, email, AI assistant name, and environment variables.
+
> [!TIP]
> **Non-interactive setup** for automation:
> ```bash
diff --git a/docs/images/skills-architecture.png b/docs/images/skills-architecture.png
deleted file mode 100644
index c3ccd79f..00000000
Binary files a/docs/images/skills-architecture.png and /dev/null differ