-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
182 lines (156 loc) · 6.19 KB
/
Copy pathinstall.ps1
File metadata and controls
182 lines (156 loc) · 6.19 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
<#
.SYNOPSIS
OpsIntelligence installer for Windows (amd64).
.DESCRIPTION
Downloads the pre-built binary from GitHub Releases, creates %USERPROFILE%\.opsintelligence,
and verifies the install. Optional -WithMemPalace runs managed MemPalace bootstrap (Python venv + pip).
Optional -WithGemma runs local-intel GGUF bootstrap.
.PARAMETER Version
Release tag (e.g. v3.10.4) or 'latest'.
.PARAMETER InstallDir
Directory for opsintelligence.exe (must be on PATH or add manually).
.EXAMPLE
iwr -useb https://raw.githubusercontent.com/hridesh-net/OpsIntelligence/main/install.ps1 | iex
.EXAMPLE
.\install.ps1 -Version v3.10.4
.EXAMPLE
.\install.ps1 -WithMemPalace
.EXAMPLE
.\install.ps1 -WithGemma
#>
param(
[string]$Version = $(if ($env:OPSINTELLIGENCE_VERSION) { $env:OPSINTELLIGENCE_VERSION } else { "latest" }),
[string]$InstallDir = $(if ($env:OPSINTELLIGENCE_INSTALL_DIR) { $env:OPSINTELLIGENCE_INSTALL_DIR } else { "" }),
[switch]$WithMemPalace = $false,
[switch]$WithGemma = $false
)
$ErrorActionPreference = "Stop"
$Repo = "hridesh-net/OpsIntelligence"
$ConfigDir = Join-Path $env:USERPROFILE ".opsintelligence"
if (-not $InstallDir) {
$localBin = Join-Path $env:USERPROFILE ".local\bin"
$InstallDir = $localBin
}
$BinaryName = "opsintelligence-windows-amd64.exe"
$FinalName = "opsintelligence.exe"
function Write-Info {
param([string]$Message)
Write-Host -ForegroundColor Cyan "[opsintelligence] $Message"
}
function Write-Ok {
param([string]$Message)
Write-Host -ForegroundColor Green "[OK] $Message"
}
function Write-WarnLine {
param([string]$Message)
Write-Host -ForegroundColor Yellow "[!] $Message"
}
function Fail-Exit {
param([string]$Message)
Write-Host -ForegroundColor Red "[X] $Message"
exit 1
}
$releaseSegment = if ($Version -eq "latest") { "latest/download" } else { "download/$Version" }
$DownloadUrl = "https://github.com/$Repo/releases/$releaseSegment/$BinaryName"
$DestPath = Join-Path $InstallDir $FinalName
Write-Info "OpsIntelligence Windows installer"
Write-Info "Install dir: $InstallDir"
Write-Info "Release: $Version"
if (-not (Test-Path $InstallDir)) {
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
}
Write-Info "Downloading $BinaryName..."
$tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("opsintelligence-" + [Guid]::NewGuid().ToString("N") + ".exe")
try {
$params = @{
Uri = $DownloadUrl
OutFile = $tmp
UseBasicParsing = $true
MaximumRetryCount = 3
RetryIntervalSec = 2
}
if ($PSVersionTable.PSVersion.Major -ge 6) {
Invoke-WebRequest @params
} else {
# Windows PowerShell 5.x: no built-in retries
Invoke-WebRequest -Uri $DownloadUrl -OutFile $tmp -UseBasicParsing
}
Move-Item -Force -Path $tmp -Destination $DestPath
Write-Ok "Binary installed: $DestPath"
} catch {
if (Test-Path $tmp) { Remove-Item -Force $tmp -ErrorAction SilentlyContinue }
Fail-Exit "Download failed: $DownloadUrl — $($_.Exception.Message)"
}
Write-Info "Creating workspace: $ConfigDir"
$subDirs = @(
(Join-Path $ConfigDir "memory"),
(Join-Path $ConfigDir "tools"),
(Join-Path $ConfigDir "logs"),
(Join-Path $ConfigDir "security"),
(Join-Path $ConfigDir "skills\bundled"),
(Join-Path $ConfigDir "skills\custom"),
(Join-Path $ConfigDir "workspace\public")
)
foreach ($d in $subDirs) {
if (-not (Test-Path $d)) {
New-Item -ItemType Directory -Force -Path $d | Out-Null
}
}
Write-Ok "Workspace ready"
if ($WithMemPalace -or $env:WITH_MEMPALACE -eq "1") {
Write-Info "Bootstrapping MemPalace (managed venv under $ConfigDir\mempalace) — may download PyPI packages..."
& $DestPath --log-level info mempalace setup --state-dir $ConfigDir
if ($LASTEXITCODE -eq 0) {
Write-Ok "MemPalace bootstrap finished (merge printed YAML into opsintelligence.yaml)"
} else {
Write-WarnLine "MemPalace bootstrap failed (exit $LASTEXITCODE). Retry: & '$DestPath' mempalace setup --state-dir '$ConfigDir'"
}
}
if ($WithGemma -or $env:WITH_GEMMA -eq "1") {
Write-Info "Bootstrapping local-intel GGUF under $ConfigDir\\models\\ (download may be large)..."
$args = @("--log-level", "info", "local-intel", "setup", "--state-dir", $ConfigDir)
if ($env:OPSINTELLIGENCE_LOCAL_GEMMA_GGUF_URL) {
$args += @("--url", $env:OPSINTELLIGENCE_LOCAL_GEMMA_GGUF_URL)
}
if ($env:OPSINTELLIGENCE_LOCAL_GEMMA_GGUF_SHA256) {
$args += @("--sha256", $env:OPSINTELLIGENCE_LOCAL_GEMMA_GGUF_SHA256)
}
& $DestPath @args
if ($LASTEXITCODE -eq 0) {
Write-Ok "Local-intel GGUF bootstrap finished (merge printed local_intel YAML into opsintelligence.yaml)"
} else {
Write-WarnLine "Local-intel GGUF bootstrap failed (exit $LASTEXITCODE). Retry: & '$DestPath' local-intel setup --state-dir '$ConfigDir'"
}
}
Write-Info "Verifying..."
try {
$verOut = & $DestPath version 2>&1
Write-Ok "opsintelligence $($verOut -join ' ')"
} catch {
Write-WarnLine "Could not run version check. Add to PATH: $InstallDir"
}
Write-Host ""
Write-Host " Get started:"
Write-Host " opsintelligence --help"
Write-Host " opsintelligence onboard"
Write-Host " opsintelligence agent --message `"Hello`""
Write-Host ""
Write-Host " Config: $ConfigDir\opsintelligence.yaml"
if ($WithMemPalace -or $env:WITH_MEMPALACE -eq "1") {
Write-Host " MemPalace: bootstrapped under $ConfigDir\mempalace\"
} else {
Write-Host " MemPalace (optional): .\install.ps1 -WithMemPalace OR & '$DestPath' mempalace setup --state-dir '$ConfigDir'"
}
if ($WithGemma -or $env:WITH_GEMMA -eq "1") {
Write-Host " Local Intel: GGUF prepared under $ConfigDir\models\ (merge printed local_intel YAML into opsintelligence.yaml)"
} else {
Write-Host " Local Intel (optional): .\install.ps1 -WithGemma OR & '$DestPath' local-intel setup --state-dir '$ConfigDir'"
}
Write-Host ""
$pathDirs = $env:Path -split ';'
if ($pathDirs -notcontains $InstallDir) {
Write-WarnLine "$InstallDir is not on your PATH."
Write-Host ' User PATH (PowerShell):'
Write-Host " [Environment]::SetEnvironmentVariable('Path', `$env:Path + ';$InstallDir', 'User')"
Write-Host ""
}