forked from DeafAUTH/readme.md
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4
More file actions
261 lines (211 loc) · 8.25 KB
/
Copy path4
File metadata and controls
261 lines (211 loc) · 8.25 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# ============================================================
# setup.ps1 · MBTQ full local dev bootstrap (Windows Admin)
# Run as: powershell -ExecutionPolicy Bypass -File setup.ps1
# Requires: Administrator privileges for service installs
# ============================================================
#Requires -RunAsAdministrator
param(
[switch]$SkipRust,
[switch]$SkipDeno,
[switch]$SkipSupabase,
[switch]$SkipWorkers,
[switch]$DevOnly
)
$ErrorActionPreference = “Stop”
# ── Visual helpers (no audio — Deaf-first) ─────────────────
function Write-Status($msg, $color = “Green”) {
Write-Host “ ■ $msg” -ForegroundColor $color
}
function Write-Step($msg) {
Write-Host “`n ▶ $msg” -ForegroundColor Yellow
}
function Write-Fail($msg) {
Write-Host “ ✗ $msg” -ForegroundColor Red
}
function Write-Info($msg) {
Write-Host “ · $msg” -ForegroundColor Gray
}
# ── Header ────────────────────────────────────────────────
Clear-Host
Write-Host “”
Write-Host “ ┌─────────────────────────────────────────────────┐” -ForegroundColor Green
Write-Host “ │ MBTQ DEV BOOTSTRAP · deaf-first · windows │” -ForegroundColor Green
Write-Host “ └─────────────────────────────────────────────────┘” -ForegroundColor Green
Write-Host “”
# ── 1. Rust toolchain ─────────────────────────────────────
if (-not $SkipRust) {
Write-Step “Rust toolchain”
```
$rustup = Get-Command rustup -ErrorAction SilentlyContinue
if (-not $rustup) {
Write-Info "Installing Rust via winget..."
winget install --id Rustlang.Rustup -e --silent
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
} else {
Write-Info "rustup found — updating..."
rustup update stable 2>&1 | Out-Null
}
# Wasm target
rustup target add wasm32-unknown-unknown
Write-Info "Installing wasm-pack..."
cargo install wasm-pack --quiet
# Build mbtq-cli
Write-Info "Building mbtq-cli..."
Push-Location "tools\mbtq-cli"
cargo build --release --quiet
Pop-Location
# Add to PATH
$cliPath = "$PWD\tools\mbtq-cli\target\release"
[System.Environment]::SetEnvironmentVariable(
"PATH",
"$env:PATH;$cliPath",
[System.EnvironmentVariableTarget]::User
)
Write-Status "Rust + mbtq-cli ready"
```
}
# ── 2. Deno runtime ───────────────────────────────────────
if (-not $SkipDeno) {
Write-Step “Deno runtime”
```
$deno = Get-Command deno -ErrorAction SilentlyContinue
if (-not $deno) {
Write-Info "Installing Deno..."
irm https://deno.land/install.ps1 | iex
$env:PATH = "$env:USERPROFILE\.deno\bin;$env:PATH"
} else {
Write-Info "Deno found — upgrading..."
deno upgrade 2>&1 | Out-Null
}
# Verify
$denoVer = deno --version 2>&1 | Select-String "deno"
Write-Status "Deno: $denoVer"
# Cache all workspace deps
Write-Info "Caching Deno workspace..."
if (Test-Path "deno.json") {
deno cache --unstable-kv services/deafauth/mod.ts
deno cache --unstable-kv services/pinksync/mod.ts
deno cache --unstable-kv services/fibonrose/mod.ts
}
```
}
# ── 3. Node + npm (for Next.js + Vite apps) ────────────────
Write-Step “Node.js + npm”
$node = Get-Command node -ErrorAction SilentlyContinue
if (-not $node) {
Write-Info “Installing Node.js LTS via winget…”
winget install –id OpenJS.NodeJS.LTS -e –silent
$env:PATH = “C:\Program Files\nodejs;$env:PATH”
} else {
$nodeVer = node –version
Write-Info “Node found: $nodeVer”
}
# Install frontend deps
Write-Info “Installing frontend dependencies…”
$frontendPaths = @(
“frontend”,
“apps\mbtq-dev”,
“apps\vr4deaf”,
“apps\360magicians”,
“apps\pinkyai”
)
foreach ($p in $frontendPaths) {
if (Test-Path “$p\package.json”) {
Write-Info “ npm ci → $p”
Push-Location $p
npm ci –prefer-offline –silent 2>&1 | Out-Null
Pop-Location
}
}
Write-Status “Node apps ready”
# ── 4. Wrangler (Cloudflare Workers) ──────────────────────
Write-Step “Wrangler CLI”
$wrangler = Get-Command wrangler -ErrorAction SilentlyContinue
if (-not $wrangler) {
npm install -g wrangler –silent
}
$wVer = wrangler –version 2>&1
Write-Status “Wrangler: $wVer”
# ── 5. Supabase CLI ───────────────────────────────────────
if (-not $SkipSupabase) {
Write-Step “Supabase CLI”
```
$supa = Get-Command supabase -ErrorAction SilentlyContinue
if (-not $supa) {
Write-Info "Installing Supabase CLI via scoop..."
# Try scoop first, fall back to npm
$scoop = Get-Command scoop -ErrorAction SilentlyContinue
if ($scoop) {
scoop install supabase
} else {
npm install -g supabase --silent
}
}
# Start local Supabase
Write-Info "Starting local Supabase..."
if (Test-Path "supabase\config.toml") {
supabase start 2>&1 | Out-Null
# Run migrations
Write-Info "Running migrations..."
supabase db push 2>&1 | Out-Null
}
Write-Status "Supabase local stack ready"
```
}
# ── 6. Secrets setup ─────────────────────────────────────
Write-Step “Environment secrets”
$envFiles = @{
“.env.local” = @”
# MBTQ local dev secrets — do not commit
SUPABASE_URL=http://localhost:54321
SUPABASE_ANON_KEY=your-local-anon-key
SUPABASE_SERVICE_KEY=your-local-service-key
MBTQ_EDGE=false
DEAFAUTH_SECRET=dev-secret-replace-in-prod
FIBONROSE_THRESHOLD=0.382
PINKSYNC_WS_URL=ws://localhost:3003
VITE_API_URL=http://localhost:3000
“@
}
foreach ($f in $envFiles.Keys) {
if (-not (Test-Path $f)) {
Write-Info “Creating $f…”
$envFiles[$f] | Out-File -FilePath $f -Encoding utf8
} else {
Write-Info “$f already exists — skipping”
}
}
# ── 7. Build Wasm packages ────────────────────────────────
Write-Step “Wasm packages”
$wasmPkgs = @(“packages\fibonrose-wasm”, “packages\a11y-wasm”)
foreach ($pkg in $wasmPkgs) {
if (Test-Path “$pkg\Cargo.toml”) {
Write-Info “Building $pkg…”
Push-Location $pkg
wasm-pack build –target web –release –quiet 2>&1 | Out-Null
Pop-Location
Write-Status “$pkg built”
}
}
# ── 8. mbtq-cli final check ────────────────────────────────
Write-Step “Verify mbtq-cli”
try {
$mbtq = & “.\tools\mbtq-cli\target\release\mbtq.exe” list 2>&1
Write-Status “mbtq list OK — $(($mbtq | Measure-Object -Line).Lines) lines”
} catch {
Write-Fail “mbtq-cli not found — run: cargo build –release in tools/mbtq-cli”
}
# ── Summary ───────────────────────────────────────────────
Write-Host “”
Write-Host “ ┌─────────────────────────────────────────────────┐” -ForegroundColor Green
Write-Host “ │ BOOTSTRAP COMPLETE · visual status above │” -ForegroundColor Green
Write-Host “ └─────────────────────────────────────────────────┘” -ForegroundColor Green
Write-Host “”
Write-Host “ Start dev servers:” -ForegroundColor Cyan
Write-Host “ mbtq build –parallel # build all apps” -ForegroundColor White
Write-Host “ deno task dev (services/*) # start Deno services” -ForegroundColor White
Write-Host “ npm run dev (apps/*) # start frontend apps” -ForegroundColor White
Write-Host “ supabase studio # open DB studio” -ForegroundColor White
Write-Host “”
Write-Host “ · all output visual-only — no audio alerts” -ForegroundColor Gray
Write-Host “”