-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
80 lines (71 loc) · 3.44 KB
/
Copy pathinstall.ps1
File metadata and controls
80 lines (71 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# yaggo-brain bootstrap installer (Windows / PowerShell).
#
# Unlike a single-binary MCP server, yaggo-brain is a full local-first stack
# (Docker Compose + a pnpm/turbo monorepo). This script clones the repo, installs
# dependencies, brings up the infrastructure, applies migrations, and pulls the
# local models so you can go straight to `pnpm dev`.
#
# Usage:
# irm https://raw.githubusercontent.com/YaggoSEO/yaggo-brain/main/install.ps1 | iex
# # or download and inspect first (recommended):
# Invoke-WebRequest -Uri https://raw.githubusercontent.com/YaggoSEO/yaggo-brain/main/install.ps1 -OutFile install.ps1
# .\install.ps1 -Dir .\yaggo-brain
# .\install.ps1 -NoModels # skip Ollama model pulls
# .\install.ps1 -NoDocker # skip infra + migrations
[CmdletBinding()]
param(
[string]$Dir = "yaggo-brain",
[switch]$NoDocker,
[switch]$NoModels,
[switch]$Dev
)
$ErrorActionPreference = "Stop"
function Info($m) { Write-Host "[yaggo-brain] $m" -ForegroundColor Cyan }
function Warn($m) { Write-Host "[yaggo-brain] $m" -ForegroundColor Yellow }
function Have($c) { [bool](Get-Command $c -ErrorAction SilentlyContinue) }
# --- prerequisites ---
if (-not (Have git)) { throw "git is required." }
if (-not (Have node)) { throw "Node.js >= 20 is required (https://nodejs.org)." }
$nodeMajor = [int](node -p "process.versions.node.split('.')[0]")
if ($nodeMajor -lt 20) { throw "Node.js >= 20 required (found $(node -v))." }
if (-not (Have pnpm) -and (Have corepack)) { Info "Enabling pnpm via corepack"; corepack enable pnpm }
if (-not (Have pnpm)) { throw "pnpm is required. Install it: npm i -g pnpm" }
# --- locate or clone the repo ---
$inRepo = (Test-Path package.json) -and (Select-String -Path package.json -Pattern '"name": *"yaggo-brain"' -Quiet -ErrorAction SilentlyContinue)
if ($inRepo) {
Info "Running inside an existing yaggo-brain checkout."
} else {
if (Test-Path "$Dir/.git") { Info "Updating existing checkout in $Dir"; git -C $Dir pull --ff-only }
else { Info "Cloning into $Dir"; git clone --depth=1 https://github.com/YaggoSEO/yaggo-brain.git $Dir }
Set-Location $Dir
}
# --- environment file ---
if (-not (Test-Path .env)) { Copy-Item .env.example .env; Info "Created .env from .env.example" }
# --- dependencies ---
Info "Installing dependencies (pnpm install)"; pnpm install
# --- infrastructure + migrations ---
if (-not $NoDocker) {
if (Have docker) {
Info "Starting infrastructure (docker compose up -d)"; pnpm db:up
Info "Waiting for Postgres to become ready..."
for ($i = 0; $i -lt 30; $i++) {
docker exec yaggo-postgres pg_isready -U yaggo -d yaggo *> $null
if ($LASTEXITCODE -eq 0) { break }
Start-Sleep -Seconds 2
}
Info "Applying database migrations"
try { pnpm db:migrate } catch { Warn "Migrations failed; run 'pnpm db:migrate' once Postgres is healthy." }
if (-not $NoModels) {
Info "Pulling local Ollama models (best effort)"
foreach ($m in @("nomic-embed-text", "qwen2.5:3b", "qwen2.5-coder:7b")) {
try { docker exec yaggo-ollama ollama pull $m } catch { Warn "skipped $m" }
}
}
} else {
Warn "Docker not found; skipping infra. Install Docker Desktop, then run: pnpm db:up; pnpm db:migrate"
}
}
Info "Done."
Info "Start the panel: pnpm dev (web http://localhost:3000, api http://localhost:3333)"
Info "Wire your IDE: npx yaggo-brain install --target=cursor (also: claude-code, windsurf, --all)"
if ($Dev) { Info "Starting dev server..."; pnpm dev }