-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
135 lines (117 loc) · 4.95 KB
/
install.ps1
File metadata and controls
135 lines (117 loc) · 4.95 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
#!/usr/bin/env pwsh
# RustClaw Installer for Windows
$ErrorActionPreference = "Stop"
$Repo = "Adaimade/RustClaw"
$InstallDir = "$env:USERPROFILE\.local\bin"
$ConfigDir = "$env:USERPROFILE\.rustclaw"
$Target = "rustclaw-x86_64-windows"
Write-Host ""
Write-Host " RustClaw Installer" -ForegroundColor Cyan
Write-Host " =====================" -ForegroundColor Cyan
Write-Host ""
Write-Host " Platform: Windows x86_64 -> $Target" -ForegroundColor Gray
# Get latest release
Write-Host " Downloading latest release..." -ForegroundColor Yellow
$Release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest"
$Asset = $Release.assets | Where-Object { $_.name -like "*$Target*" } | Select-Object -First 1
if (-not $Asset) {
Write-Host " ERROR: Could not find release for $Target" -ForegroundColor Red
Write-Host " Check: https://github.com/$Repo/releases" -ForegroundColor Red
exit 1
}
$DownloadUrl = $Asset.browser_download_url
Write-Host " URL: $DownloadUrl" -ForegroundColor Gray
# Download and extract
$TmpDir = New-TemporaryFile | ForEach-Object { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
$ZipPath = Join-Path $TmpDir "rustclaw.zip"
Invoke-WebRequest -Uri $DownloadUrl -OutFile $ZipPath
# SHA256 checksum verification
$ChecksumAsset = $Release.assets | Where-Object { $_.name -eq "checksums.txt" } | Select-Object -First 1
if ($ChecksumAsset) {
$ChecksumUrl = $ChecksumAsset.browser_download_url
$ChecksumFile = Join-Path $TmpDir "checksums.txt"
Invoke-WebRequest -Uri $ChecksumUrl -OutFile $ChecksumFile
$Expected = (Get-Content $ChecksumFile | Where-Object { $_ -like "*$Target*" }) -split '\s+' | Select-Object -First 1
if ($Expected) {
$Actual = (Get-FileHash -Path $ZipPath -Algorithm SHA256).Hash.ToLower()
if ($Actual -ne $Expected) {
Write-Host " ERROR: Checksum verification failed!" -ForegroundColor Red
Write-Host " Expected: $Expected" -ForegroundColor Red
Write-Host " Got: $Actual" -ForegroundColor Red
exit 1
}
Write-Host " Checksum verified" -ForegroundColor Green
}
}
Expand-Archive -Path $ZipPath -DestinationPath $TmpDir -Force
# Install binary
if (-not (Test-Path $InstallDir)) {
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
}
$ExePath = Get-ChildItem -Path $TmpDir -Filter "rustclaw.exe" -Recurse | Select-Object -First 1
if ($ExePath) {
Copy-Item -Path $ExePath.FullName -Destination "$InstallDir\rustclaw.exe" -Force
} else {
Write-Host " ERROR: rustclaw.exe not found in archive" -ForegroundColor Red
exit 1
}
Remove-Item -Recurse -Force $TmpDir
Write-Host " Installed: $InstallDir\rustclaw.exe" -ForegroundColor Green
# Check PATH
$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($UserPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("PATH", "$InstallDir;$UserPath", "User")
Write-Host " Added $InstallDir to user PATH" -ForegroundColor Green
Write-Host " (Restart your terminal for PATH to take effect)" -ForegroundColor Yellow
} else {
Write-Host " PATH already includes $InstallDir" -ForegroundColor Green
}
# Create default config
if (-not (Test-Path "$ConfigDir\config.toml")) {
New-Item -ItemType Directory -Path $ConfigDir -Force | Out-Null
@"
[gateway]
port = 18789
bind = "127.0.0.1"
token = ""
[agent]
provider = "openai"
api_key = "ollama"
base_url = "http://127.0.0.1:11434"
model = "qwen3-coder:30b"
system_prompt = "You are a helpful assistant."
[channels.telegram]
enabled = false
bot_token = ""
[channels.discord]
enabled = false
bot_token = ""
"@ | Set-Content -Path "$ConfigDir\config.toml" -Encoding UTF8
Write-Host " Config created: $ConfigDir\config.toml" -ForegroundColor Green
} else {
Write-Host " Config exists: $ConfigDir\config.toml (not overwritten)" -ForegroundColor Green
}
# Check Ollama
Write-Host ""
$OllamaPath = Get-Command ollama -ErrorAction SilentlyContinue
if ($OllamaPath) {
Write-Host " Ollama detected" -ForegroundColor Green
try {
$null = Invoke-RestMethod -Uri "http://localhost:11434/api/tags" -TimeoutSec 2
Write-Host " Ollama is running" -ForegroundColor Green
} catch {
Write-Host " Ollama installed but not running. Start it: ollama serve" -ForegroundColor Yellow
}
} else {
Write-Host " Ollama not found. Install it for local LLM:" -ForegroundColor Yellow
Write-Host " https://ollama.com/download" -ForegroundColor Cyan
Write-Host ""
Write-Host " Or use a cloud API -- edit $ConfigDir\config.toml:" -ForegroundColor Yellow
Write-Host " provider = `"anthropic`"" -ForegroundColor White
Write-Host " api_key = `"sk-ant-...`"" -ForegroundColor White
}
Write-Host ""
Write-Host " Done! Try:" -ForegroundColor Green
Write-Host " rustclaw agent `"Hello, what can you do?`"" -ForegroundColor White
Write-Host " rustclaw gateway # Start server with Telegram/Discord" -ForegroundColor White
Write-Host ""