-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-sod-command.ps1
More file actions
64 lines (53 loc) · 2.25 KB
/
setup-sod-command.ps1
File metadata and controls
64 lines (53 loc) · 2.25 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
# Setup SOD Command for PowerShell
# Run this script once to enable the /sod command from anywhere
Write-Host "Setting up SOD (Society of Agents Deploy) command..." -ForegroundColor Cyan
# Get the current directory (ApexSigma root)
$ApexSigmaDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Write-Host "ApexSigma Directory: $ApexSigmaDir" -ForegroundColor Yellow
# Function definition
$functionDef = @"
function sod {
param(
[switch]`$Force,
[switch]`$SkipAudit,
[switch]`$Verbose,
[switch]`$Help
)
`$currentLocation = Get-Location
try {
Set-Location "$ApexSigmaDir"
`$args = @()
if (`$Force) { `$args += "--force" }
if (`$SkipAudit) { `$args += "--skip-audit" }
if (`$Verbose) { `$args += "--verbose" }
if (`$Help) { `$args += "--help" }
Write-Host "Society of Agents Deploy (SOD)" -ForegroundColor Cyan
Write-Host "==============================" -ForegroundColor Cyan
python sod.py @args
}
finally {
Set-Location `$currentLocation
}
}
# Alias for /sod
Set-Alias -Name '/sod' -Value sod -Force
"@
# Check if profile exists, create if not
if (!(Test-Path $PROFILE)) {
Write-Host "Creating PowerShell profile at: $PROFILE" -ForegroundColor Green
New-Item -ItemType File -Path $PROFILE -Force | Out-Null
}
# Add the function to profile
Write-Host "Adding SOD function to PowerShell profile..." -ForegroundColor Green
Add-Content -Path $PROFILE -Value "`n# SOD (Society of Agents Deploy) Command"
Add-Content -Path $PROFILE -Value $functionDef
Write-Host "`nSOD command setup complete!" -ForegroundColor Green
Write-Host "`nTo activate in this session, run:" -ForegroundColor Yellow
Write-Host ". `$PROFILE" -ForegroundColor White
Write-Host "`nOr restart PowerShell." -ForegroundColor Yellow
Write-Host "`nUsage examples:" -ForegroundColor Yellow
Write-Host " sod # Basic deployment" -ForegroundColor White
Write-Host " sod -Force # Force cleanup + deploy" -ForegroundColor White
Write-Host " sod -Verbose # Verbose logging" -ForegroundColor White
Write-Host " sod -Help # Show help" -ForegroundColor White
Write-Host " /sod -Force # Using alias" -ForegroundColor White