Ports the ncp PATH work from upstream. Registering ncp as a shell-profile function failed three ways on Windows: the default Restricted execution policy blocks the profile itself, profiles don't exist outside PowerShell (cmd, Win+R, Task Scheduler), and the self-elevating installer writes the admin's profile. Windows now ships management/ncp.cmd and the installer appends management\ to the Machine PATH via [Environment]::SetEnvironmentVariable -- never setx, which truncates PATH at 1024 chars. A .cmd is exempt from the execution policy. Linux symlinks /usr/local/bin/ncp -> management/nexus-cli.sh, falling back to the old .bashrc function when sudo is unavailable. Also renames requirements-wsl.txt to requirements-windows.txt and purges stale WSL references, including vite.config.js's dev-server comment and controlpanel.py's "Check WSLg." error string. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.9 KiB
PowerShell
44 lines
1.9 KiB
PowerShell
# ncp - PowerShell entry point. The CLI itself is management/ncp.py, the same
|
|
# file the Linux shell wrapper runs; this only picks an interpreter and forwards
|
|
# the arguments.
|
|
#
|
|
# On Windows, ncp comes from management/ncp.cmd on the machine PATH instead (a
|
|
# .cmd is not subject to the execution policy and works outside PowerShell too) -
|
|
# install-windows.ps1 sets that up. This file is what gives ncp to pwsh on Linux,
|
|
# where restore-linux.sh registers it in $PROFILE.CurrentUserAllHosts as:
|
|
#
|
|
# function ncp { & "<repo>/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)
|
|
|
|
# Forward slashes and per-platform venv layout: backslash is a literal character
|
|
# on Linux, not a separator, so "Promethean\Scripts\python.exe" would resolve to
|
|
# a single nonsense filename under pwsh on Linux. Windows accepts "/" happily.
|
|
# $env:OS is the 5.1-safe check; the automatic $IsWindows only exists on PS 6+.
|
|
$OnWindows = ($env:OS -eq "Windows_NT")
|
|
if ($OnWindows) {
|
|
$Py = Join-Path $Root "Promethean/Scripts/python.exe"
|
|
} else {
|
|
$Py = Join-Path $Root "Promethean/bin/python3"
|
|
}
|
|
|
|
# Fall back to a system Python so backup/restore still work before the venv is
|
|
# built - those delegate to the stdlib-only bin/sync.py.
|
|
if (-not (Test-Path $Py)) {
|
|
foreach ($candidate in @("python3", "python")) {
|
|
$found = Get-Command $candidate -ErrorAction SilentlyContinue
|
|
if ($found) { $Py = $found.Source; break }
|
|
}
|
|
}
|
|
if (-not (Test-Path $Py)) {
|
|
Write-Error "No Python found. Run install.sh (Linux) or install-windows.ps1 first."
|
|
exit 1
|
|
}
|
|
|
|
& $Py (Join-Path $Root "management/ncp.py") @args
|
|
exit $LASTEXITCODE
|