@join-pantheon/cli 0.32.0-rc.2 → 0.32.0-rc.4
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,32 @@ 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, pids = [process.pid, process.ppid]) {
|
|
98
|
+
const script = cleanupScript(paths, pids);
|
|
99
|
+
if (!script)
|
|
100
|
+
return false;
|
|
101
|
+
try {
|
|
102
|
+
const child = spawn("powershell.exe", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-WindowStyle", "Hidden", "-Command", script], {
|
|
103
|
+
detached: true, stdio: "ignore", windowsHide: true,
|
|
104
|
+
});
|
|
105
|
+
child.on("error", () => { });
|
|
106
|
+
child.unref();
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export function cleanupScript(paths, pids) {
|
|
114
|
+
if (!paths.length || paths.some((x) => /[\r\n]/.test(x)))
|
|
115
|
+
return null;
|
|
116
|
+
const ids = pids.filter((n) => Number.isInteger(n) && n > 0);
|
|
117
|
+
return [
|
|
118
|
+
ids.length ? `Wait-Process -Id ${ids.join(",")} -Timeout 60 -ErrorAction SilentlyContinue` : "",
|
|
119
|
+
"Start-Sleep -Milliseconds 500",
|
|
120
|
+
`Remove-Item -LiteralPath ${paths.map((x) => `'${x.replace(/'/g, "''")}'`).join(",")} -Recurse -Force -ErrorAction SilentlyContinue`,
|
|
121
|
+
].filter(Boolean).join("; ");
|
|
122
|
+
}
|
|
97
123
|
export function removeManagedInstall(o) {
|
|
98
124
|
const fs = o.fs ?? realUninstallFs;
|
|
99
125
|
const env = o.env ?? process.env;
|
|
@@ -170,7 +196,10 @@ export function removeManagedInstall(o) {
|
|
|
170
196
|
}
|
|
171
197
|
const lockedHere = m.os === "win32" && !!o.running && o.running.root.toLowerCase() === m.root.toLowerCase();
|
|
172
198
|
if (lockedHere) {
|
|
173
|
-
|
|
199
|
+
const finish = (o.finishLater ?? finishAfterExit)([m.runtime, m.binDir, m.log]);
|
|
200
|
+
left.push(finish
|
|
201
|
+
? `${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"`
|
|
202
|
+
: `${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
203
|
return { removed, left };
|
|
175
204
|
}
|
|
176
205
|
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/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.4",
|
|
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": {
|