claude-mode.ps1 was 2,407 lines. It is now 153: the help block, parameters, paths, the managed-key list, a loader, and the dispatch. The rest moved, verbatim, into eleven files under lib/ - providers, output, files, core, vault, switch, guards, health, catalogue, commands, menu - dot-sourced into the script's scope in their original order, with the same check as the bash split that every original line landed in exactly one file. Inside a module $PSScriptRoot is lib\, so the one path beside the main script (providers.json) now goes through $script:Here. install.ps1 ships lib\, clearing old modules first. The Windows suite parses every module and install.ps1 (36 checks, all green on Windows PowerShell 5.1); install.ps1 is parsed but never run, since it edits the real profile and User PATH. linux/bootstrap.sh and scripts/build-package.ps1 existed only to build and serve packages for the Arkylx Index. Both installers fetch the repository's own archive, so a push to master is the release; the two scripts, the dist/ ignore and their mentions in the docs are gone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
31 lines
1.3 KiB
Bash
Executable File
31 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs tests/windows/run.ps1 on a Windows host over SSH (default: winbox):
|
|
# copies the payload to the host's %TEMP%, runs it there, and removes it again.
|
|
# Needs key-based SSH to the host and python on the host (for the fake servers).
|
|
# The suite itself runs in a USERPROFILE sandbox; see run.ps1.
|
|
set -uo pipefail
|
|
cd "$(dirname "$0")/../.."
|
|
|
|
host="${1:-winbox}"
|
|
name='cm-test-payload'
|
|
ssh_() { ssh -o BatchMode=yes -o LogLevel=ERROR -o ConnectTimeout=10 "$host" "$@"; }
|
|
|
|
parent="$(mktemp -d)"
|
|
trap 'rm -rf "$parent"' EXIT
|
|
stage="$parent/$name"
|
|
mkdir -p "$stage/presets" "$stage/bin" "$stage/lib"
|
|
cp claude-mode.ps1 install.ps1 providers.json VERSION tests/fake_server.py tests/windows/run.ps1 "$stage/"
|
|
cp presets/*.json "$stage/presets/"
|
|
cp bin/* "$stage/bin/"
|
|
cp lib/*.ps1 "$stage/lib/"
|
|
|
|
rtemp="$(ssh_ 'Write-Output $env:TEMP' | tr -d '\r')" || { echo "cannot reach $host" >&2; exit 1; }
|
|
[ -n "$rtemp" ] || { echo "no %TEMP% on $host" >&2; exit 1; }
|
|
ssh_ "Remove-Item -Recurse -Force '$rtemp\\$name' -ErrorAction SilentlyContinue" || true
|
|
scp -q -r -o BatchMode=yes -o LogLevel=ERROR "$stage" "$host:${rtemp//\\//}/" || { echo "copy to $host failed" >&2; exit 1; }
|
|
|
|
ssh_ "powershell -NoProfile -ExecutionPolicy Bypass -File '$rtemp\\$name\\run.ps1'"
|
|
rc=$?
|
|
ssh_ "Remove-Item -Recurse -Force '$rtemp\\$name' -ErrorAction SilentlyContinue" || true
|
|
exit "$rc"
|