Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
779 lines (711 loc) · 33.3 KB
/
Copy pathinstall.ps1
File metadata and controls
779 lines (711 loc) · 33.3 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
# install.ps1
# vibe-local Windows installer
# Vaporwave aesthetic installer for Windows
#
# Usage:
# .\install.ps1
# .\install.ps1 -Model qwen3:8b
# .\install.ps1 -Lang en
param(
[string]$Model,
[string]$Lang,
[switch]$Help
)
$ErrorActionPreference = "Continue"
$ProgressPreference = "SilentlyContinue" # Speed up Invoke-WebRequest
# --- UTF-8 encoding fix (PowerShell 文字化け対策) ---
# Force UTF-8 for console output (Japanese/CJK characters)
try {
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Text.Encoding]::UTF8
# chcp 65001 equivalent — switch console code page to UTF-8
$null = & cmd /c "chcp 65001 >nul 2>&1"
} catch {
# Older PowerShell versions may not support this — continue anyway
}
# ╔══════════════════════════════════════════════════════════════╗
# ║ 🎨 V A P O R W A V E C O L O R S ║
# ╚══════════════════════════════════════════════════════════════╝
# ANSI escape support (Windows Terminal)
$ESC = [char]27
function C { param([int]$c) return "${ESC}[38;5;${c}m" }
function BG { param([int]$c) return "${ESC}[48;5;${c}m" }
$BOLD = "${ESC}[1m"
$DIM = "${ESC}[2m"
$NC = "${ESC}[0m"
$PINK = C 198; $HOT_PINK = C 206; $MAGENTA = C 165; $PURPLE = C 141
$CYAN = C 51; $AQUA = C 87; $MINT = C 121; $CORAL = C 210
$ORANGE = C 208; $YELLOW = C 226; $WHITE = C 255; $GRAY = C 245
$RED = C 196; $GREEN = C 46; $NEON_GREEN = C 118; $BLUE = C 33
# ╔══════════════════════════════════════════════════════════════╗
# ║ 🌐 TRILINGUAL ENGINE ║
# ╚══════════════════════════════════════════════════════════════╝
# Auto-detect language
if (-not $Lang) {
$sysLang = (Get-Culture).Name
if ($sysLang -like "ja*") { $Lang = "ja" }
elseif ($sysLang -like "zh*") { $Lang = "zh" }
else { $Lang = "en" }
}
$Messages = @{
ja = @{
subtitle = " 無 料 A I コ ー デ ィ ン グ 環 境"
tagline = "ネットワーク不要 ・ 完全無料 ・ ローカルAIコーディング"
step1 = "S Y S T E M S C A N"
step2 = "M E M O R Y A N A L Y S I S"
step3 = "P A C K A G E I N S T A L L"
step4 = "A I M O D E L D O W N L O A D"
step5 = "F I L E D E P L O Y"
step6 = "C O N F I G G E N E R A T E"
step7 = "S Y S T E M T E S T"
hw_scan = "ハードウェアスキャン中..."
windows_ok = "Windows 検出"
mem_scan = "メモリ空間マッピング中..."
mem_label = "搭載メモリ"
model_best = "コーディング最強"
model_great = "高性能コーディング"
model_min = "最低限動作"
model_recommend = "16GB以上のメモリを推奨します"
mem_lack = "メモリ不足"
mem_lack_min = "最低8GB必要"
manual_model = "手動指定モデル"
installed = "インストール済み"
installing = "インストール中..."
install_done = "インストール完了"
install_fail = "インストール失敗"
install_fail_hint = "手動でインストールしてから再実行してください"
ollama_starting = "Ollama を起動中..."
ollama_wait = "Ollama 起動待ち中"
model_downloading = "モデルをダウンロード中..."
model_download_hint = "初回はサイズに応じて数分〜数十分かかります"
model_downloaded = "ダウンロード済み"
model_dl_done = "ダウンロード完了"
file_deploy = "ファイルデプロイ中..."
source_local = "ソース: ローカル"
source_github = "ソース: GitHub"
config_gen = "設定ファイル生成中..."
config_exists = "設定ファイルが既に存在 → 既存設定を保持"
config_file = "設定ファイル"
path_added = "PATH 追加"
path_set = "PATH: 設定済み"
diag = "システム診断を実行中..."
online = "ONLINE"
standby = "STANDBY"
ready = "READY"
warning = "WARNING"
loaded = "LOADED"
not_loaded = "未ロード"
complete = "INSTALL COMPLETE !!"
usage_label = "使い方:"
mode_interactive = "対話モード"
mode_oneshot = "ワンショット"
mode_auto = "ネットワーク自動判定"
settings_label = "設定:"
label_model = "モデル"
label_config = "設定"
label_command = "コマンド"
reopen = "新しいターミナルを開いてから vibe-local を実行"
enjoy = "無 料 A I コ ー デ ィ ン グ を 楽 し も う"
}
en = @{
subtitle = " F R E E A I C O D I N G E N V I R O N M E N T"
tagline = "No Network . Totally Free . Local AI Coding"
step1 = "S Y S T E M S C A N"
step2 = "M E M O R Y A N A L Y S I S"
step3 = "P A C K A G E I N S T A L L"
step4 = "A I M O D E L D O W N L O A D"
step5 = "F I L E D E P L O Y"
step6 = "C O N F I G G E N E R A T E"
step7 = "S Y S T E M T E S T"
hw_scan = "Scanning hardware..."
windows_ok = "Windows detected"
mem_scan = "Mapping memory space..."
mem_label = "System memory"
model_best = "Best for coding"
model_great = "Great for coding"
model_min = "Minimum viable"
model_recommend = "16GB+ RAM recommended"
mem_lack = "Insufficient memory"
mem_lack_min = "Minimum 8GB required"
manual_model = "Manual model"
installed = "installed"
installing = "Installing..."
install_done = "installed"
install_fail = "install failed"
install_fail_hint = "Please install manually, then re-run this script"
ollama_starting = "Starting Ollama..."
ollama_wait = "Waiting for Ollama"
model_downloading = "Downloading model..."
model_download_hint = "First download may take several minutes depending on size"
model_downloaded = "already downloaded"
model_dl_done = "download complete"
file_deploy = "Deploying files..."
source_local = "Source: local"
source_github = "Source: GitHub"
config_gen = "Generating config..."
config_exists = "Config exists -> keeping current settings"
config_file = "Config file"
path_added = "PATH added"
path_set = "PATH: already set"
diag = "Running system diagnostics..."
online = "ONLINE"
standby = "STANDBY"
ready = "READY"
warning = "WARNING"
loaded = "LOADED"
not_loaded = "not loaded"
complete = "INSTALL COMPLETE !!"
usage_label = "Usage:"
mode_interactive = "Interactive mode"
mode_oneshot = "One-shot"
mode_auto = "Auto-detect network"
settings_label = "Settings:"
label_model = "Model"
label_config = "Config"
label_command = "Command"
reopen = "Open a new terminal, then run vibe-local"
enjoy = "E N J O Y F R E E A I C O D I N G"
}
zh = @{
subtitle = " 免 费 A I 编 程 环 境"
tagline = "无需网络 ・ 完全免费 ・ 本地AI编程"
step1 = "S Y S T E M S C A N"
step2 = "M E M O R Y A N A L Y S I S"
step3 = "P A C K A G E I N S T A L L"
step4 = "A I M O D E L D O W N L O A D"
step5 = "F I L E D E P L O Y"
step6 = "C O N F I G G E N E R A T E"
step7 = "S Y S T E M T E S T"
hw_scan = "扫描硬件中..."
windows_ok = "检测到 Windows"
mem_scan = "内存空间映射中..."
mem_label = "系统内存"
model_best = "编程最强"
model_great = "高性能编程"
model_min = "最低限运行"
model_recommend = "推荐16GB以上内存"
mem_lack = "内存不足"
mem_lack_min = "最少需要8GB"
manual_model = "手动指定模型"
installed = "已安装"
installing = "安装中..."
install_done = "安装完成"
install_fail = "安装失败"
install_fail_hint = "请手动安装后重新运行此脚本"
ollama_starting = "正在启动 Ollama..."
ollama_wait = "等待 Ollama 启动"
model_downloading = "下载模型中..."
model_download_hint = "首次下载可能需要几分钟到几十分钟"
model_downloaded = "已下载"
model_dl_done = "下载完成"
file_deploy = "部署文件中..."
source_local = "来源: 本地"
source_github = "来源: GitHub"
config_gen = "生成配置文件中..."
config_exists = "配置文件已存在 → 保持现有设置"
config_file = "配置文件"
path_added = "PATH 已添加"
path_set = "PATH: 已设置"
diag = "运行系统诊断..."
online = "ONLINE"
standby = "STANDBY"
ready = "READY"
warning = "WARNING"
loaded = "LOADED"
not_loaded = "未加载"
complete = "安 装 完 成 !!"
usage_label = "使用方法:"
mode_interactive = "交互模式"
mode_oneshot = "单次执行"
mode_auto = "自动检测网络"
settings_label = "设置:"
label_model = "模型"
label_config = "配置"
label_command = "命令"
reopen = "打开新终端后运行 vibe-local"
enjoy = "享 受 免 费 A I 编 程"
}
}
function msg { param([string]$key) return $Messages[$Lang][$key] }
# Help
if ($Help) {
Write-Host "Usage: install.ps1 [-Model MODEL_NAME] [-Lang LANG]"
Write-Host ""
Write-Host " -Model MODEL Specify Ollama model (e.g. qwen3:8b)"
Write-Host " -Lang LANG Language: ja, en, zh"
exit 0
}
# ╔══════════════════════════════════════════════════════════════╗
# ║ 🎬 ANIMATION ENGINE ║
# ╚══════════════════════════════════════════════════════════════╝
function Rainbow-Text {
param([string]$text)
$colors = @(46, 47, 48, 49, 50, 51, 45, 39, 33, 27, 21, 57, 93, 129, 165, 201, 200, 199, 198, 197, 196)
$result = ""
for ($i = 0; $i -lt $text.Length; $i++) {
$ci = $i % $colors.Count
$result += "$(C $colors[$ci])$($text[$i])"
}
Write-Host "${result}${NC}"
}
function Vapor-Text {
param([string]$text)
$colors = @(51, 87, 123, 159, 195, 189, 183, 177, 171, 165)
$result = ""
for ($i = 0; $i -lt $text.Length; $i++) {
$ci = [math]::Floor($i * $colors.Count / [math]::Max($text.Length, 1)) % $colors.Count
$result += "$(C $colors[$ci])$($text[$i])"
}
Write-Host "${result}${NC}"
}
function Vaporwave-Progress {
param([string]$label, [int]$durationMs = 2000)
$width = 40
$colors = @(198, 199, 207, 213, 177, 171, 165, 129, 93, 57, 51, 50, 49, 48, 47, 46)
$steps = [math]::Max(20, [math]::Floor($durationMs / 100))
$sparkles = @("*", "+", "o", ".", "*", "+")
for ($s = 0; $s -le $steps; $s++) {
$pct = [math]::Floor($s * 100 / $steps)
$filled = [math]::Floor($s * $width / $steps)
$empty = $width - $filled
$bar = ""
for ($b = 0; $b -lt $filled; $b++) {
$ci = [math]::Floor($b * $colors.Count / $width)
$bar += "$(C $colors[$ci])#"
}
for ($b = 0; $b -lt $empty; $b++) {
$bar += "$(C 237)."
}
$si = $s % $sparkles.Count
Write-Host "`r $($sparkles[$si]) ${BOLD}${CYAN}$($label.PadRight(30))${NC} |${bar}${NC}| ${BOLD}${NEON_GREEN}$($pct.ToString().PadLeft(3))%${NC} " -NoNewline
Start-Sleep -Milliseconds ([math]::Floor($durationMs / $steps))
}
Write-Host "`r [OK] ${BOLD}${GREEN}$($label.PadRight(30))${NC} |$($(for($b=0;$b -lt $width;$b++){$ci=[math]::Floor($b*$colors.Count/$width); "$(C $colors[$ci])#"}) -join '')${NC}| ${BOLD}${NEON_GREEN}100%${NC} "
}
$TOTAL_STEPS = 7
function Step-Header {
param([int]$num, [string]$title)
$icons = @(">>>", ">>>", ">>>", ">>>", ">>>", ">>>", ">>>")
Write-Host ""
Write-Host " ${CYAN}=====================================================${NC}"
Write-Host " $($icons[$num-1]) ${BOLD}${WHITE}STEP ${num}/${TOTAL_STEPS}${NC} ${BOLD}${WHITE}${title}${NC}"
Write-Host " ${CYAN}=====================================================${NC}"
}
function Vapor-Success { param([string]$msg) Write-Host " ${NEON_GREEN}|${NC} [OK] ${BOLD}${MINT}${msg}${NC}" }
function Vapor-Info { param([string]$msg) Write-Host " ${CYAN}|${NC} [i] ${AQUA}${msg}${NC}" }
function Vapor-Warn { param([string]$msg) Write-Host " ${ORANGE}|${NC} [!] ${YELLOW}${msg}${NC}" }
function Vapor-Error { param([string]$msg) Write-Host " ${RED}|${NC} [X] ${RED}${BOLD}${msg}${NC}" }
function Run-WithSpinner {
param([string]$label, [scriptblock]$cmd)
$job = Start-Job -ScriptBlock $cmd
$sec = 0
$sparkles = @("|", "/", "-", "\")
while ($job.State -eq "Running") {
$si = $sec % $sparkles.Count
Write-Host "`r $($sparkles[$si]) ${BOLD}$($label.PadRight(35))${NC} ${DIM}${GRAY}$([math]::Floor($sec/2))s${NC} " -NoNewline
Start-Sleep -Milliseconds 500
$sec++
}
Write-Host "`r$(' ' * 60)`r" -NoNewline
$result = Receive-Job $job -ErrorAction SilentlyContinue
$exitOk = $job.State -eq "Completed"
Remove-Job $job -Force
return $exitOk
}
# ╔══════════════════════════════════════════════════════════════╗
# ║ 🌅 TITLE SCREEN ║
# ╚══════════════════════════════════════════════════════════════╝
# [UX] Don't Clear-Host — preserve terminal history so users can scroll back
Write-Host ""
Write-Host ""
Write-Host " ${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${MINT}##${NEON_GREEN}##${YELLOW}##${ORANGE}##${CORAL}##${HOT_PINK}##${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${NC}"
Write-Host ""
Write-Host "${MAGENTA}${BOLD}"
Write-Host " ██╗ ██╗██╗██████╗ ███████╗"
Write-Host " ██║ ██║██║██╔══██╗██╔════╝"
Write-Host " ██║ ██║██║██████╔╝█████╗"
Write-Host " ╚██╗ ██╔╝██║██╔══██╗██╔══╝"
Write-Host " ╚████╔╝ ██║██████╔╝███████╗"
Write-Host " ╚═══╝ ╚═╝╚═════╝ ╚══════╝"
Write-Host "${NC}${CYAN}${BOLD}"
Write-Host " ██╗ ██████╗ ██████╗ █████╗ ██╗"
Write-Host " ██║ ██╔═══██╗██╔════╝██╔══██╗██║"
Write-Host " ██║ ██║ ██║██║ ███████║██║"
Write-Host " ██║ ██║ ██║██║ ██╔══██║██║"
Write-Host " ███████╗╚██████╔╝╚██████╗██║ ██║███████╗"
Write-Host " ╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝"
Write-Host "${NC}"
Write-Host " ${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${MINT}##${NEON_GREEN}##${YELLOW}##${ORANGE}##${CORAL}##${HOT_PINK}##${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${NC}"
Write-Host ""
Vapor-Text " $(msg 'subtitle')"
Write-Host ""
Rainbow-Text " ================================================================"
Write-Host " ${PINK}##${NC} ${BOLD}${WHITE}$(msg 'tagline')${NC} ${PINK}##${NC}"
Rainbow-Text " ================================================================"
Write-Host ""
Start-Sleep -Milliseconds 500
# =============================================
# Step 1: OS / Architecture detection
# =============================================
Step-Header 1 (msg 'step1')
$Arch = $env:PROCESSOR_ARCHITECTURE
Vaporwave-Progress (msg 'hw_scan') 1000
Vapor-Info "OS: Windows / Arch: $Arch"
if ($Arch -eq "AMD64" -or $Arch -eq "ARM64") {
Vapor-Success "$(msg 'windows_ok') ($Arch)"
} else {
Vapor-Error "Unsupported architecture: $Arch"
exit 1
}
# =============================================
# Step 2: RAM detection & model auto-select
# =============================================
Step-Header 2 (msg 'step2')
try {
$TotalMem = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory
$RamGB = [math]::Floor($TotalMem / 1073741824)
} catch {
$RamGB = 16
Vapor-Warn "Could not detect RAM, assuming ${RamGB}GB"
}
Vaporwave-Progress (msg 'mem_scan') 1000
Write-Host " ${PURPLE}|${NC} ${BOLD}${WHITE}$(msg 'mem_label'): ${NEON_GREEN}${RamGB}GB${NC}"
$SidecarModel = ""
if ($Model) {
$SelectedModel = $Model
Vapor-Info "$(msg 'manual_model'): $SelectedModel"
} elseif ($RamGB -ge 32) {
$SelectedModel = "qwen3-coder:30b"
$SidecarModel = "qwen3:8b"
Write-Host " ${NEON_GREEN}|${NC} ${BOLD}${YELLOW}*** BEST MODEL ***${NC}"
Write-Host " ${NEON_GREEN}|${NC} ${BOLD}${WHITE}${SelectedModel}${NC} ${DIM}(19GB, MoE 3.3B active, $(msg 'model_best'))${NC}"
Write-Host " ${NEON_GREEN}|${NC} ${DIM}+ sidecar: ${SidecarModel} (5GB, fast helper)${NC}"
} elseif ($RamGB -ge 16) {
$SelectedModel = "qwen3:8b"
$SidecarModel = "qwen3:1.7b"
Write-Host " ${MINT}|${NC} ${BOLD}${CYAN}** GREAT MODEL **${NC}"
Write-Host " ${MINT}|${NC} ${BOLD}${WHITE}${SelectedModel}${NC} ${DIM}(5GB, $(msg 'model_great'))${NC}"
Write-Host " ${MINT}|${NC} ${DIM}+ sidecar: ${SidecarModel} (1.1GB, fast helper)${NC}"
} elseif ($RamGB -ge 8) {
$SelectedModel = "qwen3:1.7b"
Vapor-Warn "$SelectedModel (1.1GB, $(msg 'model_min'))"
Vapor-Warn (msg 'model_recommend')
} else {
Vapor-Error "$(msg 'mem_lack'): ${RamGB}GB ($(msg 'mem_lack_min'))"
exit 1
}
# =============================================
# Step 3: Install dependencies
# =============================================
Step-Header 3 (msg 'step3')
# --- winget pre-flight check ---
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
Vapor-Warn "winget is not available on this system."
Write-Host " Install dependencies manually:"
Write-Host " Ollama: https://ollama.com/download/OllamaSetup.exe"
Write-Host " Python: https://www.python.org/downloads/"
Write-Host " Then re-run this installer."
# Don't exit - continue in case user installed them manually
}
# --- Python ---
$PythonCmd = $null
foreach ($pyCmd in @("py", "python3", "python")) {
if (Get-Command $pyCmd -ErrorAction SilentlyContinue) {
$PythonCmd = $pyCmd
break
}
}
if ($PythonCmd) {
$pyVer = & $PythonCmd --version 2>&1
Vapor-Success "Python $(msg 'installed') ($pyVer)"
} else {
Vapor-Info "Python $(msg 'installing')"
$pythonInstalled = $false
# Method 1: Try winget
if (-not $pythonInstalled -and (Get-Command winget -ErrorAction SilentlyContinue)) {
Vapor-Info "Trying winget..."
try {
winget install -e --id Python.Python.3.12 --accept-source-agreements --accept-package-agreements 2>&1 | Out-Null
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
$PythonCmd = $null
foreach ($pyCmd in @("py", "python3", "python")) {
if (Get-Command $pyCmd -ErrorAction SilentlyContinue) {
$PythonCmd = $pyCmd
$pythonInstalled = $true
break
}
}
if ($pythonInstalled) {
Vapor-Success "Python $(msg 'install_done') (winget)"
}
} catch {}
}
# Method 2: Try Microsoft Store python (available without winget)
if (-not $pythonInstalled) {
Vapor-Info "Trying Microsoft Store Python..."
try {
# 'python3' command on Windows may trigger Store install
$storeResult = & python3 --version 2>&1
if ($LASTEXITCODE -eq 0 -and "$storeResult" -match "Python 3") {
$PythonCmd = "python3"
$pythonInstalled = $true
Vapor-Success "Python $(msg 'install_done') (Microsoft Store)"
}
} catch {}
}
if (-not $pythonInstalled) {
Vapor-Error "Python $(msg 'install_fail')"
Write-Host ""
Write-Host " ${BOLD}${WHITE}Please install Python manually:${NC}"
Write-Host " ${CYAN}1.${NC} Open: ${BOLD}https://www.python.org/downloads/${NC}"
Write-Host " ${CYAN}2.${NC} Click 'Download Python 3.x.x'"
Write-Host " ${CYAN}3.${NC} ${YELLOW}${BOLD}IMPORTANT:${NC} Check '${BOLD}Add Python to PATH${NC}' at the bottom of the installer"
Write-Host " ${CYAN}4.${NC} Click 'Install Now'"
Write-Host " ${CYAN}5.${NC} After installation, ${BOLD}open a NEW PowerShell window${NC} and re-run this installer"
Write-Host ""
}
}
# Fatal check: Python is required
if (-not $PythonCmd) {
Vapor-Error "Python 3 is required but could not be found."
Write-Host " Download from: https://www.python.org/downloads/"
Write-Host " IMPORTANT: Check 'Add Python to PATH' during installation."
Write-Host " Then open a NEW PowerShell window and re-run this installer."
exit 1
}
# --- Ollama ---
# Check PATH first, then common install locations (GUI installer doesn't always add to PATH)
$ollamaFound = Get-Command ollama -ErrorAction SilentlyContinue
if (-not $ollamaFound) {
$ollamaSearchPaths = @(
"$env:LOCALAPPDATA\Programs\Ollama\ollama.exe",
"$env:ProgramFiles\Ollama\ollama.exe",
"${env:ProgramFiles(x86)}\Ollama\ollama.exe"
)
foreach ($op in $ollamaSearchPaths) {
if (Test-Path $op) {
$ollamaDir = Split-Path $op
$env:PATH = "$ollamaDir;$env:PATH"
$ollamaFound = Get-Command ollama -ErrorAction SilentlyContinue
break
}
}
}
if ($ollamaFound) {
$ollamaVer = ollama --version 2>&1
Vapor-Success "Ollama $(msg 'installed') ($ollamaVer)"
} else {
Vapor-Warn "Ollama not installed — install it after setup:"
Write-Host " https://ollama.com/download"
}
# --- Claude Code CLI (optional, for --auto mode fallback) ---
if (Get-Command claude -ErrorAction SilentlyContinue) {
Vapor-Success "Claude Code CLI $(msg 'installed') [optional]"
} else {
Vapor-Info "Claude Code CLI not installed (optional - vibe-coder replaces it)"
}
# =============================================
# Step 4: Next steps
# =============================================
Step-Header 4 "Next steps"
Write-Host ""
Write-Host " Run the following to finish setup:"
Write-Host ""
if (-not $ollamaFound) {
Write-Host " 1. Install Ollama: https://ollama.com/download"
Write-Host " 2. Pull a model: ollama pull $SelectedModel"
if ($SidecarModel -and $SidecarModel -ne $SelectedModel) {
Write-Host " ollama pull $SidecarModel"
}
Write-Host " 3. Start: vibe-local"
} else {
Write-Host " 1. Pull a model: ollama pull $SelectedModel"
if ($SidecarModel -and $SidecarModel -ne $SelectedModel) {
Write-Host " ollama pull $SidecarModel"
}
Write-Host " 2. Start: vibe-local"
}
Write-Host ""
# =============================================
# Step 5: File deployment
# =============================================
Step-Header 5 (msg 'step5')
$LibDir = Join-Path $env:USERPROFILE ".local\lib\vibe-local"
$BinDir = Join-Path $env:USERPROFILE ".local\bin"
if (-not (Test-Path $LibDir)) { New-Item -ItemType Directory -Path $LibDir -Force | Out-Null }
if (-not (Test-Path $BinDir)) { New-Item -ItemType Directory -Path $BinDir -Force | Out-Null }
# --- Write permission check ---
try {
$testFile = Join-Path $LibDir ".write-test"
[IO.File]::WriteAllText($testFile, "test")
Remove-Item $testFile -Force
} catch {
Vapor-Error "Cannot write to $LibDir"
Write-Host " Check folder permissions and try running as Administrator."
exit 1
}
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Vaporwave-Progress (msg 'file_deploy') 1500
if ($ScriptDir -and (Test-Path (Join-Path $ScriptDir "vibe-coder.py"))) {
Vapor-Info (msg 'source_local')
Copy-Item (Join-Path $ScriptDir "vibe-coder.py") -Destination $LibDir -Force
Copy-Item (Join-Path $ScriptDir "vibe-local.ps1") -Destination $BinDir -Force
Copy-Item (Join-Path $ScriptDir "vibe-local.cmd") -Destination $BinDir -Force
} else {
$RepoRaw = "https://raw.githubusercontent.com/robustonian/vibe-local/main"
Vapor-Info (msg 'source_github')
try {
Invoke-WebRequest -Uri "$RepoRaw/vibe-coder.py" -OutFile (Join-Path $LibDir "vibe-coder.py") -ErrorAction Stop
} catch {
Vapor-Error "Failed to download vibe-coder.py from GitHub"
Write-Host " Check your internet connection or try again later."
exit 1
}
try {
Invoke-WebRequest -Uri "$RepoRaw/vibe-local.ps1" -OutFile (Join-Path $BinDir "vibe-local.ps1") -ErrorAction Stop
} catch {
Vapor-Error "Failed to download vibe-local.ps1 from GitHub"
Write-Host " Check your internet connection or try again later."
exit 1
}
try {
Invoke-WebRequest -Uri "$RepoRaw/vibe-local.cmd" -OutFile (Join-Path $BinDir "vibe-local.cmd") -ErrorAction Stop
} catch {
Vapor-Error "Failed to download vibe-local.cmd from GitHub"
Write-Host " Check your internet connection or try again later."
exit 1
}
}
Vapor-Success "vibe-coder.py -> $LibDir"
Vapor-Success "Command -> $BinDir\vibe-local.cmd"
# =============================================
# Step 6: Config generation
# =============================================
Step-Header 6 (msg 'step6')
$ConfigDir = Join-Path $env:USERPROFILE ".config\vibe-local"
$ConfigFile = Join-Path $ConfigDir "config"
if (-not (Test-Path $ConfigDir)) { New-Item -ItemType Directory -Path $ConfigDir -Force | Out-Null }
Vaporwave-Progress (msg 'config_gen') 1000
if (Test-Path $ConfigFile) {
Vapor-Warn (msg 'config_exists')
} else {
$configContent = @"
# vibe-local config
# Auto-generated: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')
# Engine: vibe-coder (direct Ollama, no proxy needed)
MODEL="$SelectedModel"
SIDECAR_MODEL="$SidecarModel"
OLLAMA_HOST="http://localhost:11434"
"@
Set-Content -Path $ConfigFile -Value $configContent -Encoding UTF8
Vapor-Success "$(msg 'config_file'): $ConfigFile"
}
# Add to PATH (User environment variable)
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($currentPath -notlike "*$BinDir*") {
[Environment]::SetEnvironmentVariable("PATH", "$BinDir;$currentPath", "User")
$env:PATH = "$BinDir;$env:PATH"
Vapor-Success "$(msg 'path_added') -> $BinDir"
} else {
Vapor-Success (msg 'path_set')
}
# =============================================
# Step 7: System diagnostics
# =============================================
Step-Header 7 (msg 'step7')
Write-Host ""
Write-Host " ${CYAN}|${NC} ${BOLD}${WHITE}$(msg 'diag')${NC}"
Write-Host ""
# Ollama
try {
$resp = Invoke-WebRequest -Uri "http://localhost:11434/api/tags" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
Vapor-Success "Ollama Server -> $(msg 'online')"
} catch {
Vapor-Warn "Ollama Server -> $(msg 'standby')"
}
# vibe-coder.py syntax check
$testPy = $null
foreach ($p in @("py", "python3", "python")) {
if (Get-Command $p -ErrorAction SilentlyContinue) { $testPy = $p; break }
}
$vibeCoderScript = Join-Path $LibDir "vibe-coder.py"
if ($testPy -and (Test-Path $vibeCoderScript)) {
try {
if ($testPy -eq "py") {
& py -3 -c "import ast, sys; ast.parse(open(sys.argv[1]).read())" "$vibeCoderScript" 2>&1 | Out-Null
} else {
& $testPy -c "import ast, sys; ast.parse(open(sys.argv[1]).read())" "$vibeCoderScript" 2>&1 | Out-Null
}
Vapor-Success "vibe-coder.py -> $(msg 'ready')"
} catch {
Vapor-Warn "vibe-coder.py -> $(msg 'warning') (syntax error)"
}
}
# Claude Code CLI (optional)
if (Get-Command claude -ErrorAction SilentlyContinue) {
Vapor-Info "Claude Code CLI -> available (optional, for --auto mode)"
} else {
Vapor-Info "Claude Code CLI -> not installed (not needed)"
}
# Model check
try {
$resp = Invoke-WebRequest -Uri "http://localhost:11434/api/tags" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
$tags = $resp.Content | ConvertFrom-Json
$found = $tags.models | Where-Object { $_.name -eq $SelectedModel }
if ($found) {
Vapor-Success "AI Model ($SelectedModel) -> $(msg 'loaded')"
} else {
Vapor-Warn "AI Model ($SelectedModel) -> $(msg 'not_loaded')"
}
if ($SidecarModel -and $SidecarModel -ne $SelectedModel) {
$foundSc = $tags.models | Where-Object { $_.name -eq $SidecarModel }
if ($foundSc) {
Vapor-Success "Sidecar ($SidecarModel) -> $(msg 'loaded')"
} else {
Vapor-Warn "Sidecar ($SidecarModel) -> $(msg 'not_loaded')"
}
}
} catch {}
# ╔══════════════════════════════════════════════════════════════╗
# ║ 🎆 C O M P L E T E !! ║
# ╚══════════════════════════════════════════════════════════════╝
Write-Host ""
Write-Host ""
Write-Host " ${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${MINT}##${NEON_GREEN}##${YELLOW}##${ORANGE}##${CORAL}##${HOT_PINK}##${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${NC}"
Write-Host ""
Rainbow-Text " =========================================================="
Write-Host ""
Write-Host " *** ${BOLD}${MAGENTA}$(msg 'complete')${NC} ***"
Write-Host ""
Rainbow-Text " =========================================================="
Write-Host ""
Write-Host " ${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${MINT}##${NEON_GREEN}##${YELLOW}##${ORANGE}##${CORAL}##${HOT_PINK}##${PINK}##${MAGENTA}##${PURPLE}##${CYAN}##${AQUA}##${NC}"
Write-Host ""
Write-Host ""
Rainbow-Text " ======================================================="
Write-Host ""
Write-Host " ${BOLD}${WHITE}$(msg 'usage_label')${NC}"
Write-Host ""
Write-Host " ${PINK}>${NC} ${BOLD}${CYAN}vibe-local${NC} ${DIM}$(msg 'mode_interactive')${NC}"
Write-Host " ${PINK}>${NC} ${BOLD}${CYAN}vibe-local -p `"...`"${NC} ${DIM}$(msg 'mode_oneshot')${NC}"
Write-Host " ${PINK}>${NC} ${BOLD}${CYAN}vibe-local -Auto${NC} ${DIM}$(msg 'mode_auto')${NC}"
Write-Host ""
Rainbow-Text " ======================================================="
Write-Host ""
Write-Host " ${BOLD}${WHITE}$(msg 'settings_label')${NC}"
Write-Host " ${PURPLE}|${NC} $(msg 'label_model'): ${BOLD}${NEON_GREEN}${SelectedModel}${NC}"
if ($SidecarModel -and $SidecarModel -ne $SelectedModel) {
Write-Host " ${PURPLE}|${NC} Sidecar: ${BOLD}${AQUA}${SidecarModel}${NC}"
}
Write-Host " ${PURPLE}|${NC} $(msg 'label_config'): ${AQUA}${ConfigFile}${NC}"
Write-Host " ${PURPLE}|${NC} $(msg 'label_command'): ${AQUA}${BinDir}\vibe-local.cmd${NC}"
Write-Host ""
Rainbow-Text " ======================================================="
Write-Host ""
Write-Host " ${YELLOW}${BOLD}>>> $(msg 'reopen') <<<${NC}"
Write-Host ""
Write-Host ""
Vapor-Text " $(msg 'enjoy')"
Write-Host ""
Write-Host ""