Files
NexusOS/management/ncp.ps1
T
jonandClaude Opus 4.8 ca8bc7425c Sync from upstream: ncp is Python now, runs on Windows too
management/ncp.py replaces the bash CLI's logic; nexus-cli.sh and the new
ncp.ps1 are thin wrappers, so Linux keeps its entry point and Windows gains one.
psutil handles process and port work on both platforms.

install-windows.ps1 registers ncp in the PowerShell profile. The panel VPN
switch now resolves its WireGuard connection through NetworkManager instead of
a hardcoded name, and the .ps1 ASCII guard globs rather than naming files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 11:34:15 -05:00

29 lines
1.2 KiB
PowerShell

# ncp - Windows entry point. The CLI itself is management\ncp.py, the same file
# the Linux box runs; this only picks an interpreter and forwards the arguments.
#
# Register it once per machine by adding this to your PowerShell profile
# (notepad $PROFILE):
#
# function ncp { & "$HOME\nexus-core\management\ncp.ps1" @args }
#
# ASCII only, no exceptions: PowerShell 5.1 decodes BOM-less files as ANSI, so a
# single Unicode dash eats a quote and the script dies at parse time. A test in
# tests/test_smoke.py fails if any .ps1 in this repo gains a non-ASCII byte.
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
# Prefer the venv interpreter (ncp.py needs psutil for service management), but
# fall back to system Python so backup/restore still work before the venv is
# built - those delegate to the stdlib-only bin\sync.py.
$Py = Join-Path $Root "Promethean\Scripts\python.exe"
if (-not (Test-Path $Py)) {
$Py = (Get-Command python -ErrorAction SilentlyContinue).Source
}
if (-not $Py) {
Write-Error "No Python found. Run install-windows.ps1 first."
exit 1
}
& $Py (Join-Path $Root "management\ncp.py") @args
exit $LASTEXITCODE