PlanOpticon

planopticon / install.ps1
Source Blame History 180 lines
42e9b20… noreply 1 # PlanOpticon installer for Windows (PowerShell)
42e9b20… noreply 2 # Usage: irm https://planopticon.dev/install.ps1 | iex
42e9b20… noreply 3
42e9b20… noreply 4 $ErrorActionPreference = "Stop"
42e9b20… noreply 5
42e9b20… noreply 6 function Write-Step($msg) { Write-Host "`n==> $msg" -ForegroundColor White }
42e9b20… noreply 7 function Write-Ok($msg) { Write-Host "[ok] $msg" -ForegroundColor Green }
42e9b20… noreply 8 function Write-Warn($msg) { Write-Host "[warn] $msg" -ForegroundColor Yellow }
42e9b20… noreply 9 function Write-Err($msg) { Write-Host "[error] $msg" -ForegroundColor Red }
42e9b20… noreply 10 function Write-Info($msg) { Write-Host "[info] $msg" -ForegroundColor Blue }
42e9b20… noreply 11
42e9b20… noreply 12 function Test-Command($cmd) {
42e9b20… noreply 13 try { Get-Command $cmd -ErrorAction Stop | Out-Null; return $true }
42e9b20… noreply 14 catch { return $false }
42e9b20… noreply 15 }
42e9b20… noreply 16
42e9b20… noreply 17 # --- Header ------------------------------------------------------------------
42e9b20… noreply 18
42e9b20… noreply 19 Write-Host "`nPlanOpticon Installer" -ForegroundColor White
42e9b20… noreply 20 Write-Host "=====================================" -ForegroundColor White
42e9b20… noreply 21
42e9b20… noreply 22 # --- Python ------------------------------------------------------------------
42e9b20… noreply 23
42e9b20… noreply 24 Write-Step "Checking Python"
42e9b20… noreply 25
42e9b20… noreply 26 $python = $null
42e9b20… noreply 27 foreach ($cmd in @("python", "python3", "py")) {
42e9b20… noreply 28 if (Test-Command $cmd) {
42e9b20… noreply 29 $ver = & $cmd -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>$null
42e9b20… noreply 30 if ($ver) {
42e9b20… noreply 31 $parts = $ver.Split(".")
42e9b20… noreply 32 if ([int]$parts[0] -ge 3 -and [int]$parts[1] -ge 10) {
42e9b20… noreply 33 $python = $cmd
42e9b20… noreply 34 Write-Ok "Python $ver found ($cmd)"
42e9b20… noreply 35 break
42e9b20… noreply 36 }
42e9b20… noreply 37 }
42e9b20… noreply 38 }
42e9b20… noreply 39 }
42e9b20… noreply 40
42e9b20… noreply 41 if (-not $python) {
42e9b20… noreply 42 Write-Warn "Python 3.10+ not found"
42e9b20… noreply 43 if (Test-Command "winget") {
42e9b20… noreply 44 Write-Info "Installing Python via winget..."
42e9b20… noreply 45 winget install Python.Python.3.12 --accept-source-agreements --accept-package-agreements
42e9b20… noreply 46 $python = "python"
42e9b20… noreply 47 } elseif (Test-Command "choco") {
42e9b20… noreply 48 Write-Info "Installing Python via Chocolatey..."
42e9b20… noreply 49 choco install python312 -y
42e9b20… noreply 50 $python = "python"
42e9b20… noreply 51 } else {
42e9b20… noreply 52 Write-Err "Please install Python 3.10+ from https://www.python.org/downloads/"
42e9b20… noreply 53 exit 1
42e9b20… noreply 54 }
42e9b20… noreply 55 # Refresh PATH
42e9b20… noreply 56 $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
42e9b20… noreply 57 Write-Ok "Python installed"
42e9b20… noreply 58 }
42e9b20… noreply 59
42e9b20… noreply 60 # --- FFmpeg ------------------------------------------------------------------
42e9b20… noreply 61
42e9b20… noreply 62 Write-Step "Checking FFmpeg"
42e9b20… noreply 63
42e9b20… noreply 64 if (Test-Command "ffmpeg") {
42e9b20… noreply 65 Write-Ok "FFmpeg found"
42e9b20… noreply 66 } else {
42e9b20… noreply 67 Write-Warn "FFmpeg not found"
42e9b20… noreply 68 if (Test-Command "winget") {
42e9b20… noreply 69 Write-Info "Installing FFmpeg via winget..."
42e9b20… noreply 70 winget install Gyan.FFmpeg --accept-source-agreements --accept-package-agreements
42e9b20… noreply 71 } elseif (Test-Command "choco") {
42e9b20… noreply 72 Write-Info "Installing FFmpeg via Chocolatey..."
42e9b20… noreply 73 choco install ffmpeg -y
42e9b20… noreply 74 } else {
42e9b20… noreply 75 Write-Err "Please install FFmpeg from https://ffmpeg.org/download.html"
42e9b20… noreply 76 exit 1
42e9b20… noreply 77 }
42e9b20… noreply 78 $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
42e9b20… noreply 79 Write-Ok "FFmpeg installed"
42e9b20… noreply 80 }
42e9b20… noreply 81
42e9b20… noreply 82 # --- Extras ------------------------------------------------------------------
42e9b20… noreply 83
42e9b20… noreply 84 Write-Step "Choose extras"
42e9b20… noreply 85 Write-Host " 1) core - just the basics (default)"
42e9b20… noreply 86 Write-Host " 2) cloud - Google Drive, Dropbox, S3"
42e9b20… noreply 87 Write-Host " 3) pdf - PDF document ingestion"
42e9b20… noreply 88 Write-Host " 4) sources - YouTube, RSS, web scraping"
42e9b20… noreply 89 Write-Host " 5) all - everything"
42e9b20… noreply 90 Write-Host ""
42e9b20… noreply 91
42e9b20… noreply 92 $choice = Read-Host "Choose extras [1-5, default=1]"
42e9b20… noreply 93 $extras = switch ($choice) {
42e9b20… noreply 94 "2" { "[cloud]" }
42e9b20… noreply 95 "3" { "[pdf]" }
42e9b20… noreply 96 "4" { "[sources]" }
42e9b20… noreply 97 "5" { "[all]" }
42e9b20… noreply 98 default { "" }
42e9b20… noreply 99 }
42e9b20… noreply 100
42e9b20… noreply 101 # --- Install PlanOpticon -----------------------------------------------------
42e9b20… noreply 102
42e9b20… noreply 103 Write-Step "Installing PlanOpticon"
42e9b20… noreply 104
42e9b20… noreply 105 $target = "planopticon$extras"
42e9b20… noreply 106 Write-Info "Installing: $target"
42e9b20… noreply 107
42e9b20… noreply 108 try {
42e9b20… noreply 109 & $python -m pip install --upgrade $target
42e9b20… noreply 110 Write-Ok "PlanOpticon installed"
42e9b20… noreply 111 } catch {
42e9b20… noreply 112 Write-Warn "pip install failed, trying with --user"
42e9b20… noreply 113 & $python -m pip install --user --upgrade $target
42e9b20… noreply 114 Write-Ok "PlanOpticon installed (user)"
42e9b20… noreply 115 }
42e9b20… noreply 116
42e9b20… noreply 117 # --- API key setup -----------------------------------------------------------
42e9b20… noreply 118
42e9b20… noreply 119 Write-Step "API key setup"
42e9b20… noreply 120
42e9b20… noreply 121 $envFile = ".env"
42e9b20… noreply 122 if (Test-Path $envFile) {
42e9b20… noreply 123 Write-Ok "Found existing .env file"
42e9b20… noreply 124 } else {
42e9b20… noreply 125 Write-Host "`nPlanOpticon needs at least one AI provider API key."
42e9b20… noreply 126 Write-Host " 1) OpenAI (OPENAI_API_KEY)"
42e9b20… noreply 127 Write-Host " 2) Anthropic (ANTHROPIC_API_KEY)"
42e9b20… noreply 128 Write-Host " 3) Google (GEMINI_API_KEY)"
42e9b20… noreply 129 Write-Host " 4) Ollama (local, no key needed)"
42e9b20… noreply 130 Write-Host " 5) Skip for now"
42e9b20… noreply 131 Write-Host ""
42e9b20… noreply 132
42e9b20… noreply 133 $providerChoice = Read-Host "Choose provider [1-5]"
42e9b20… noreply 134 switch ($providerChoice) {
42e9b20… noreply 135 "1" {
42e9b20… noreply 136 $key = Read-Host "Enter your OpenAI API key"
42e9b20… noreply 137 if ($key) { "OPENAI_API_KEY=$key" | Out-File $envFile -Encoding utf8; Write-Ok "Saved to .env" }
42e9b20… noreply 138 }
42e9b20… noreply 139 "2" {
42e9b20… noreply 140 $key = Read-Host "Enter your Anthropic API key"
42e9b20… noreply 141 if ($key) { "ANTHROPIC_API_KEY=$key" | Out-File $envFile -Encoding utf8; Write-Ok "Saved to .env" }
42e9b20… noreply 142 }
42e9b20… noreply 143 "3" {
42e9b20… noreply 144 $key = Read-Host "Enter your Google/Gemini API key"
42e9b20… noreply 145 if ($key) { "GEMINI_API_KEY=$key" | Out-File $envFile -Encoding utf8; Write-Ok "Saved to .env" }
42e9b20… noreply 146 }
42e9b20… noreply 147 "4" {
42e9b20… noreply 148 "OLLAMA_HOST=http://localhost:11434" | Out-File $envFile -Encoding utf8
42e9b20… noreply 149 Write-Info "Using Ollama - no API key needed"
42e9b20… noreply 150 }
42e9b20… noreply 151 default { Write-Warn "Skipping API key setup. Add keys to .env later." }
42e9b20… noreply 152 }
42e9b20… noreply 153 }
42e9b20… noreply 154
42e9b20… noreply 155 # --- Verify ------------------------------------------------------------------
42e9b20… noreply 156
42e9b20… noreply 157 Write-Step "Verifying installation"
42e9b20… noreply 158
42e9b20… noreply 159 if (Test-Command "planopticon") {
42e9b20… noreply 160 try {
42e9b20… noreply 161 $version = & planopticon --version 2>$null
42e9b20… noreply 162 Write-Ok "planopticon CLI ready ($version)"
42e9b20… noreply 163 } catch {
42e9b20… noreply 164 Write-Ok "planopticon CLI ready"
42e9b20… noreply 165 }
42e9b20… noreply 166 } else {
42e9b20… noreply 167 Write-Warn "planopticon not in PATH - restart your terminal"
42e9b20… noreply 168 }
42e9b20… noreply 169
42e9b20… noreply 170 # --- Done --------------------------------------------------------------------
42e9b20… noreply 171
42e9b20… noreply 172 Write-Host "`nInstallation complete!" -ForegroundColor Green
42e9b20… noreply 173 Write-Host ""
42e9b20… noreply 174 Write-Host "Quick start:"
42e9b20… noreply 175 Write-Host " planopticon process video.mp4 # Analyze a video"
42e9b20… noreply 176 Write-Host " planopticon companion # Start AI companion"
42e9b20… noreply 177 Write-Host " planopticon list-models # Check available models"
42e9b20… noreply 178 Write-Host ""
42e9b20… noreply 179 Write-Host "Docs: https://planopticon.dev"
42e9b20… noreply 180 Write-Host ""

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button