-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
82 lines (67 loc) · 1.53 KB
/
Copy pathinstall.ps1
File metadata and controls
82 lines (67 loc) · 1.53 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
[CmdletBinding()]
param(
[switch]$SkipBuild,
[switch]$Uninstall,
[switch]$Help
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$RepoDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$PluginId = "ix-memory"
if ($Help) {
Write-Host @"
ix-openclaw-plugin installer
Usage:
.\install.ps1
.\install.ps1 -SkipBuild
.\install.ps1 -Uninstall
Options:
-SkipBuild Skip npm install and npm run build
-Uninstall Remove the installed plugin and exit
-Help Show this message
"@
exit 0
}
function Assert-Command {
param(
[string]$Name,
[string]$Hint
)
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
throw "$Name not found. $Hint"
}
}
Assert-Command "openclaw" "Install OpenClaw first."
if ($Uninstall) {
try {
& openclaw plugins uninstall $PluginId | Out-Null
} catch {
}
Write-Host "Uninstalled $PluginId"
exit 0
}
Assert-Command "npm" "Install Node.js and npm first."
if (-not $SkipBuild) {
Push-Location $RepoDir
try {
& npm install
if ($LASTEXITCODE -ne 0) {
throw "npm install failed"
}
& npm run build
if ($LASTEXITCODE -ne 0) {
throw "npm run build failed"
}
} finally {
Pop-Location
}
}
try {
& openclaw plugins uninstall $PluginId | Out-Null
} catch {
}
& openclaw plugins install -l $RepoDir
if ($LASTEXITCODE -ne 0) {
throw "openclaw plugins install failed"
}
Write-Host "Installed $PluginId from $RepoDir"