@geekbeer/minion 3.5.33 → 3.5.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/win/minion-cli.ps1 +68 -42
package/package.json
CHANGED
package/win/minion-cli.ps1
CHANGED
|
@@ -114,6 +114,56 @@ function Test-CommandExists {
|
|
|
114
114
|
$null -ne (Get-Command $Name -ErrorAction SilentlyContinue)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
function Install-GitDirect {
|
|
118
|
+
# Download and install Git for Windows from GitHub Releases.
|
|
119
|
+
# Uses the GitHub API to resolve the latest 64-bit installer URL.
|
|
120
|
+
Write-Host " Downloading Git for Windows..."
|
|
121
|
+
try {
|
|
122
|
+
$releaseApi = 'https://api.github.com/repos/git-for-windows/git/releases/latest'
|
|
123
|
+
$release = Invoke-RestMethod -Uri $releaseApi -UseBasicParsing
|
|
124
|
+
$asset = $release.assets | Where-Object { $_.name -match '64-bit\.exe$' -and $_.name -notmatch 'portable' } | Select-Object -First 1
|
|
125
|
+
if (-not $asset) { Write-Warn "Could not find Git installer from GitHub releases"; return $false }
|
|
126
|
+
|
|
127
|
+
$installerPath = Join-Path $env:TEMP $asset.name
|
|
128
|
+
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $installerPath -UseBasicParsing
|
|
129
|
+
Write-Host " Running Git installer (silent)..."
|
|
130
|
+
$proc = Start-Process -FilePath $installerPath -ArgumentList '/VERYSILENT', '/NORESTART', '/SP-' -Wait -PassThru
|
|
131
|
+
Remove-Item $installerPath -Force -ErrorAction SilentlyContinue
|
|
132
|
+
return ($proc.ExitCode -eq 0)
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
Write-Warn "Git download failed: $_"
|
|
136
|
+
return $false
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function Install-PythonDirect {
|
|
141
|
+
# Download and install Python from python.org.
|
|
142
|
+
# Installs for all users with PATH prepended.
|
|
143
|
+
Write-Host " Downloading Python 3.12..."
|
|
144
|
+
try {
|
|
145
|
+
$pyUrl = 'https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe'
|
|
146
|
+
$installerPath = Join-Path $env:TEMP 'python-installer.exe'
|
|
147
|
+
Invoke-WebRequest -Uri $pyUrl -OutFile $installerPath -UseBasicParsing
|
|
148
|
+
Write-Host " Running Python installer (silent)..."
|
|
149
|
+
$proc = Start-Process -FilePath $installerPath -ArgumentList '/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'Include_pip=1' -Wait -PassThru
|
|
150
|
+
Remove-Item $installerPath -Force -ErrorAction SilentlyContinue
|
|
151
|
+
return ($proc.ExitCode -eq 0)
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
Write-Warn "Python download failed: $_"
|
|
155
|
+
return $false
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function Remove-ScheduledTaskSilent {
|
|
160
|
+
# Delete a scheduled task without emitting errors if it doesn't exist.
|
|
161
|
+
# PowerShell's NativeCommandError makes schtasks stderr impossible to suppress
|
|
162
|
+
# with 2>&1 | Out-Null alone, so we run via cmd /c.
|
|
163
|
+
param([string]$TaskName)
|
|
164
|
+
cmd /c "schtasks /Delete /TN `"$TaskName`" /F >nul 2>&1"
|
|
165
|
+
}
|
|
166
|
+
|
|
117
167
|
function Get-WebsockifyCommand {
|
|
118
168
|
# Returns @(executable, args-prefix) for launching websockify.
|
|
119
169
|
# Python writes informational output to stderr, which causes terminating errors
|
|
@@ -490,23 +540,8 @@ function Invoke-Setup {
|
|
|
490
540
|
Write-Detail "Node.js $nodeVersion already installed"
|
|
491
541
|
}
|
|
492
542
|
else {
|
|
493
|
-
Write-
|
|
494
|
-
|
|
495
|
-
& winget install --id OpenJS.NodeJS.LTS --source winget --accept-package-agreements --accept-source-agreements
|
|
496
|
-
# Refresh PATH
|
|
497
|
-
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
498
|
-
if (Test-CommandExists 'node') {
|
|
499
|
-
Write-Detail "Node.js installed successfully"
|
|
500
|
-
}
|
|
501
|
-
else {
|
|
502
|
-
Write-Warn "Node.js installed but not in PATH. Please restart this terminal."
|
|
503
|
-
exit 1
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
catch {
|
|
507
|
-
Write-Error "Failed to install Node.js. Please install manually from https://nodejs.org/"
|
|
508
|
-
exit 1
|
|
509
|
-
}
|
|
543
|
+
Write-Error "Node.js is required but not installed. Please install from https://nodejs.org/ and re-run setup."
|
|
544
|
+
exit 1
|
|
510
545
|
}
|
|
511
546
|
|
|
512
547
|
# Step 2: Install Git (required by Claude Code for git-bash)
|
|
@@ -522,9 +557,8 @@ function Invoke-Setup {
|
|
|
522
557
|
if (Test-Path $candidateBash) { $gitBashPath = $candidateBash }
|
|
523
558
|
}
|
|
524
559
|
else {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
& winget install --id Git.Git --source winget --accept-package-agreements --accept-source-agreements
|
|
560
|
+
$installed = Install-GitDirect
|
|
561
|
+
if ($installed) {
|
|
528
562
|
# Refresh PATH
|
|
529
563
|
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
530
564
|
if (Test-CommandExists 'git') {
|
|
@@ -538,7 +572,7 @@ function Invoke-Setup {
|
|
|
538
572
|
Write-Warn "Git installed but not in PATH. Please restart this terminal."
|
|
539
573
|
}
|
|
540
574
|
}
|
|
541
|
-
|
|
575
|
+
else {
|
|
542
576
|
Write-Warn "Failed to install Git. Please install manually from https://git-scm.com/downloads/win"
|
|
543
577
|
}
|
|
544
578
|
}
|
|
@@ -761,7 +795,7 @@ function Invoke-Setup {
|
|
|
761
795
|
Invoke-Nssm remove minion-vnc confirm
|
|
762
796
|
|
|
763
797
|
# Register VNC as logon task (must run in user session for desktop capture)
|
|
764
|
-
|
|
798
|
+
Remove-ScheduledTaskSilent "MinionVNC"
|
|
765
799
|
schtasks /Create /TN "MinionVNC" /TR "'$vncExePath' -run" /SC ONLOGON /RL HIGHEST /F | Out-Null
|
|
766
800
|
Write-Detail "TightVNC registered as logon task (user session, not service)"
|
|
767
801
|
}
|
|
@@ -779,16 +813,13 @@ function Invoke-Setup {
|
|
|
779
813
|
if ($pyVer -match '\d+\.\d+') { $pythonUsable = $true }
|
|
780
814
|
}
|
|
781
815
|
if (-not $pythonUsable) {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
$wingetResult = cmd /c "winget install --id Python.Python.3.12 --source winget --accept-package-agreements --accept-source-agreements 2>&1"
|
|
816
|
+
$installed = Install-PythonDirect
|
|
817
|
+
if ($installed) {
|
|
785
818
|
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
786
|
-
|
|
787
|
-
else { Write-Warn "winget install may have failed (exit code $LASTEXITCODE): $wingetResult" }
|
|
819
|
+
Write-Detail "Python installed"
|
|
788
820
|
}
|
|
789
|
-
|
|
790
|
-
Write-Warn "Failed to install Python
|
|
791
|
-
Write-Host " Install manually: winget install --id Python.Python.3.12 --source winget"
|
|
821
|
+
else {
|
|
822
|
+
Write-Warn "Failed to install Python. Install manually from https://www.python.org/downloads/"
|
|
792
823
|
}
|
|
793
824
|
}
|
|
794
825
|
|
|
@@ -1012,7 +1043,7 @@ function Invoke-Uninstall {
|
|
|
1012
1043
|
}
|
|
1013
1044
|
|
|
1014
1045
|
# Remove VNC logon task and legacy NSSM service
|
|
1015
|
-
|
|
1046
|
+
Remove-ScheduledTaskSilent "MinionVNC"
|
|
1016
1047
|
Invoke-Nssm stop minion-vnc
|
|
1017
1048
|
Invoke-Nssm remove minion-vnc confirm
|
|
1018
1049
|
Write-Detail "VNC logon task and legacy service removed"
|
|
@@ -1243,21 +1274,16 @@ function Invoke-Configure {
|
|
|
1243
1274
|
|
|
1244
1275
|
# Install cloudflared if needed
|
|
1245
1276
|
if (-not (Test-CommandExists 'cloudflared')) {
|
|
1246
|
-
Write-Host "
|
|
1247
|
-
|
|
1248
|
-
& winget install --id Cloudflare.cloudflared --source winget --accept-package-agreements --accept-source-agreements
|
|
1249
|
-
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
1250
|
-
}
|
|
1251
|
-
elseif (Test-CommandExists 'choco') {
|
|
1252
|
-
& choco install cloudflared -y
|
|
1253
|
-
}
|
|
1254
|
-
else {
|
|
1255
|
-
Write-Host " Downloading cloudflared..."
|
|
1277
|
+
Write-Host " Downloading cloudflared..."
|
|
1278
|
+
try {
|
|
1256
1279
|
$cfUrl = 'https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-amd64.exe'
|
|
1257
1280
|
$cfPath = Join-Path $DataDir 'cloudflared.exe'
|
|
1258
|
-
Invoke-WebRequest -Uri $cfUrl -OutFile $cfPath
|
|
1281
|
+
Invoke-WebRequest -Uri $cfUrl -OutFile $cfPath -UseBasicParsing
|
|
1259
1282
|
Write-Detail "cloudflared downloaded to $cfPath"
|
|
1260
1283
|
}
|
|
1284
|
+
catch {
|
|
1285
|
+
Write-Warn "Failed to download cloudflared: $_"
|
|
1286
|
+
}
|
|
1261
1287
|
}
|
|
1262
1288
|
else {
|
|
1263
1289
|
Write-Detail "cloudflared already installed"
|