PlanOpticon

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

Keyboard Shortcuts

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