@join-pantheon/cli 0.32.0-rc.1 → 0.32.0-rc.3
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/dist/uninstall.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
1
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
2
2
|
import { existsSync, lstatSync, readFileSync, readdirSync, rmdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { platform } from "node:os";
|
|
4
4
|
import { posix, win32 } from "node:path";
|
|
@@ -94,6 +94,21 @@ export function managedInstall(home, os = platform(), env = process.env, fs = re
|
|
|
94
94
|
const log = os === "win32" ? p.join(root, "install.log") : p.join(root, "logs", "install.log");
|
|
95
95
|
return { os, root, runtime, binDir, launcher, log, present: fs.exists(runtime) || fs.exists(launcher) };
|
|
96
96
|
}
|
|
97
|
+
export function finishAfterExit(paths) {
|
|
98
|
+
if (!paths.length || paths.some((x) => /["%^&|<>]/.test(x)))
|
|
99
|
+
return false;
|
|
100
|
+
try {
|
|
101
|
+
const rm = paths.map((x) => `rmdir /s /q "${x}" 2>nul & del /f /q "${x}" 2>nul`).join(" & ");
|
|
102
|
+
const child = spawn("cmd.exe", ["/d", "/s", "/c", `"ping -n 6 127.0.0.1 >nul & ${rm}"`], {
|
|
103
|
+
detached: true, stdio: "ignore", windowsHide: true, windowsVerbatimArguments: true,
|
|
104
|
+
});
|
|
105
|
+
child.unref();
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
97
112
|
export function removeManagedInstall(o) {
|
|
98
113
|
const fs = o.fs ?? realUninstallFs;
|
|
99
114
|
const env = o.env ?? process.env;
|
|
@@ -170,7 +185,10 @@ export function removeManagedInstall(o) {
|
|
|
170
185
|
}
|
|
171
186
|
const lockedHere = m.os === "win32" && !!o.running && o.running.root.toLowerCase() === m.root.toLowerCase();
|
|
172
187
|
if (lockedHere) {
|
|
173
|
-
|
|
188
|
+
const finish = (o.finishLater ?? finishAfterExit)([m.runtime, m.binDir, m.log]);
|
|
189
|
+
left.push(finish
|
|
190
|
+
? `${m.root} — Windows keeps Pantheon's node.exe locked while this command runs, so it is removed a few seconds after this command exits. If it is still there afterwards, an agent window has it open: close them, then in PowerShell: Remove-Item -Recurse -Force "$env:LOCALAPPDATA\\Pantheon"`
|
|
191
|
+
: `${m.root} — Windows keeps Pantheon's node.exe locked while this command runs. Close your agent windows and this one, then in a new PowerShell: Remove-Item -Recurse -Force "$env:LOCALAPPDATA\\Pantheon"`);
|
|
174
192
|
return { removed, left };
|
|
175
193
|
}
|
|
176
194
|
for (const [path, what] of [[m.launcher, "the pantheon command"], [m.log, "the installer's log"], [m.runtime, "Pantheon's own Node and the CLI in it"]]) {
|
package/installer/install.ps1
CHANGED
|
@@ -234,7 +234,14 @@ function Install-Pantheon {
|
|
|
234
234
|
Get-Download "$NodeDist/v$NodeVersion/$zipName" $zip
|
|
235
235
|
|
|
236
236
|
$State.step = 'checking the Node download'
|
|
237
|
-
|
|
237
|
+
# .NET, not Get-FileHash: that is a script function in Microsoft.PowerShell.Utility,
|
|
238
|
+
# and Windows PowerShell 5.1 started from PowerShell 7 (the line pasted into pwsh)
|
|
239
|
+
# inherits pwsh's module path and cannot load it ("Get-FileHash is not recognized").
|
|
240
|
+
$stream = [IO.File]::OpenRead($zip)
|
|
241
|
+
try {
|
|
242
|
+
$sha = [Security.Cryptography.SHA256]::Create()
|
|
243
|
+
$got = (($sha.ComputeHash($stream) | ForEach-Object { $_.ToString('x2') }) -join '')
|
|
244
|
+
} finally { $stream.Dispose() }
|
|
238
245
|
if ($got -ne $want) { Fail "the Node download does not match its published sha256 (expected $want, got $got), so it was not used. Something between you and nodejs.org changed it; run this again on another network." }
|
|
239
246
|
|
|
240
247
|
# Unpacked entry by entry with the archive's top folder stripped, so no
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@join-pantheon/cli",
|
|
3
|
-
"version": "0.32.0-rc.
|
|
3
|
+
"version": "0.32.0-rc.3",
|
|
4
4
|
"description": "Let your coding agent collaborate directly with your teammates' agents — ask, agree an interface, and deliver, without a human relaying messages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|