Split the Windows script into modules; drop the Arkylx Index pieces
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>
This commit is contained in:
+12
-5
@@ -28,16 +28,23 @@ function Expect-Eq($got, $want, [string] $what) {
|
||||
if ("$got" -eq "$want") { Pass } else { Fail "$what (got '$got', wanted '$want')" $null }
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path "$root\presets", "$root\bin", "$sb\.claude" | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path "$root\presets", "$root\bin", "$root\lib", "$sb\.claude" | Out-Null
|
||||
Copy-Item "$src\claude-mode.ps1", "$src\providers.json", "$src\VERSION" $root
|
||||
Copy-Item "$src\presets\*.json" "$root\presets"
|
||||
Copy-Item "$src\bin\*" "$root\bin"
|
||||
Copy-Item "$src\lib\*.ps1" "$root\lib"
|
||||
$cm = Join-Path $root 'claude-mode.ps1'
|
||||
|
||||
$tokens = $null; $errors = $null
|
||||
[void][System.Management.Automation.Language.Parser]::ParseFile($cm, [ref]$tokens, [ref]$errors)
|
||||
Expect-Eq $errors.Count 0 'claude-mode.ps1 parses'
|
||||
foreach ($e in $errors) { Write-Host " | line $($e.Extent.StartLineNumber): $($e.Message)" }
|
||||
# install.ps1 is parsed but never run: it edits the real PowerShell profile and
|
||||
# the User PATH, which no USERPROFILE sandbox contains.
|
||||
$parse = @($cm) + @(Get-ChildItem "$root\lib\*.ps1" | ForEach-Object { $_.FullName })
|
||||
if (Test-Path "$src\install.ps1") { $parse += "$src\install.ps1" }
|
||||
foreach ($file in $parse) {
|
||||
$tokens = $null; $errors = $null
|
||||
[void][System.Management.Automation.Language.Parser]::ParseFile($file, [ref]$tokens, [ref]$errors)
|
||||
Expect-Eq $errors.Count 0 "$(Split-Path -Leaf $file) parses"
|
||||
foreach ($e in $errors) { Write-Host " | $(Split-Path -Leaf $file) line $($e.Extent.StartLineNumber): $($e.Message)" }
|
||||
}
|
||||
|
||||
$portsFile = Join-Path $sb 'ports.json'
|
||||
$fake = Start-Process python -ArgumentList ('"' + (Join-Path $src 'fake_server.py') + '"') `
|
||||
|
||||
Reference in New Issue
Block a user