-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.ps1
More file actions
84 lines (72 loc) · 2.96 KB
/
install.ps1
File metadata and controls
84 lines (72 loc) · 2.96 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
# ShellWard One-Click Installer for Windows
# Usage: irm https://raw.githubusercontent.com/jnMetaCode/shellward/main/install.ps1 | iex
$ErrorActionPreference = "Stop"
Write-Host ""
Write-Host "==================================================" -ForegroundColor Cyan
Write-Host " ShellWard Security Plugin - One-Click Install" -ForegroundColor Cyan
Write-Host "==================================================" -ForegroundColor Cyan
Write-Host ""
# Check Node.js
Write-Host "Checking environment..." -ForegroundColor Blue
try {
$nodeVer = & node -v 2>$null
$major = [int]($nodeVer -replace 'v(\d+)\..*', '$1')
if ($major -lt 18) {
Write-Host "Node.js too old ($nodeVer). Need v18+. Download: https://nodejs.org" -ForegroundColor Red
exit 1
}
Write-Host "Node.js $nodeVer" -ForegroundColor Green
} catch {
Write-Host "Node.js not found. Download: https://nodejs.org" -ForegroundColor Red
exit 1
}
# Check OpenClaw
try {
$ocVer = & openclaw --version 2>$null | Select-Object -First 1
Write-Host "OpenClaw $ocVer" -ForegroundColor Green
} catch {
Write-Host "OpenClaw not found. Run: npm install -g openclaw" -ForegroundColor Red
exit 1
}
Write-Host ""
# Install
$pluginDir = Join-Path $env:USERPROFILE ".openclaw\plugins\shellward"
if (Test-Path $pluginDir) {
Write-Host "ShellWard already installed, updating..." -ForegroundColor Yellow
Remove-Item -Recurse -Force $pluginDir
}
$parentDir = Split-Path $pluginDir -Parent
if (!(Test-Path $parentDir)) {
New-Item -ItemType Directory -Path $parentDir -Force | Out-Null
}
Write-Host "Downloading ShellWard..." -ForegroundColor Blue
try {
& git clone --depth 1 https://github.com/jnMetaCode/shellward.git $pluginDir 2>$null
Remove-Item -Recurse -Force (Join-Path $pluginDir ".git") -ErrorAction SilentlyContinue
} catch {
Write-Host "Download failed. Check: https://github.com/jnMetaCode/shellward" -ForegroundColor Red
exit 1
}
# Verify
Write-Host ""
Write-Host "Verifying..." -ForegroundColor Blue
$indexFile = Join-Path $pluginDir "src\index.ts"
$pluginJson = Join-Path $pluginDir "openclaw.plugin.json"
if ((Test-Path $indexFile) -and (Test-Path $pluginJson)) {
Write-Host "Installation successful!" -ForegroundColor Green
} else {
Write-Host "Installation failed - files missing" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "==================================================" -ForegroundColor Cyan
Write-Host "Done! ShellWard will auto-load next time OpenClaw starts." -ForegroundColor Green
Write-Host ""
Write-Host "Usage:" -ForegroundColor Yellow
Write-Host ' openclaw agent --local -m "hello" # Start agent with security'
Write-Host ' /security # View security status'
Write-Host ' /audit # View audit log'
Write-Host ' /harden # Security scan'
Write-Host ""
Write-Host "Docs: https://github.com/jnMetaCode/shellward" -ForegroundColor Blue
Write-Host ""