svamp-cli 0.2.77 → 0.2.78
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/cli.mjs
CHANGED
|
@@ -322,7 +322,7 @@ async function main() {
|
|
|
322
322
|
} else if (!subcommand || subcommand === "start") {
|
|
323
323
|
await handleInteractiveCommand();
|
|
324
324
|
} else if (subcommand === "--version" || subcommand === "-v") {
|
|
325
|
-
const pkg = await import('./package-
|
|
325
|
+
const pkg = await import('./package-ike8lo0g.mjs').catch(() => ({ default: { version: "unknown" } }));
|
|
326
326
|
console.log(`svamp version: ${pkg.default.version}`);
|
|
327
327
|
} else {
|
|
328
328
|
console.error(`Unknown command: ${subcommand}`);
|
|
@@ -999,7 +999,10 @@ Subcommands (fan out across every machine in your workspace):
|
|
|
999
999
|
status Show svamp + claude-code version per machine
|
|
1000
1000
|
exec "<command>" Run a shell command on every machine
|
|
1001
1001
|
upgrade-claude [-v X] Install Claude Code (defaults to svamp-cli's pinned version)
|
|
1002
|
-
upgrade-svamp [-v X]
|
|
1002
|
+
upgrade-svamp [-v X] [--exclude-self]
|
|
1003
|
+
npm install -g svamp-cli@X + svamp daemon restart
|
|
1004
|
+
(--exclude-self skips this machine to avoid
|
|
1005
|
+
interrupting the current session)
|
|
1003
1006
|
daemon-restart [--cleanup] Restart daemons (default graceful)
|
|
1004
1007
|
push-skill <name> Install/force-refresh a skill on all machines
|
|
1005
1008
|
|
|
@@ -1011,6 +1014,7 @@ Examples:
|
|
|
1011
1014
|
svamp fleet exec "uptime"
|
|
1012
1015
|
svamp fleet upgrade-claude
|
|
1013
1016
|
svamp fleet upgrade-svamp -v 0.2.73
|
|
1017
|
+
svamp fleet upgrade-svamp --exclude-self
|
|
1014
1018
|
svamp fleet push-skill hypha`);
|
|
1015
1019
|
process.exit(0);
|
|
1016
1020
|
}
|
|
@@ -1022,24 +1026,24 @@ Examples:
|
|
|
1022
1026
|
};
|
|
1023
1027
|
const hasFlag = (name) => fleetArgs.includes(`--${name}`);
|
|
1024
1028
|
if (sub === "status") {
|
|
1025
|
-
const { fleetStatus } = await import('./fleet-
|
|
1029
|
+
const { fleetStatus } = await import('./fleet-Cp-Ykxc6.mjs');
|
|
1026
1030
|
await fleetStatus();
|
|
1027
1031
|
} else if (sub === "exec") {
|
|
1028
1032
|
const command = fleetArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
|
|
1029
|
-
const { fleetExec } = await import('./fleet-
|
|
1033
|
+
const { fleetExec } = await import('./fleet-Cp-Ykxc6.mjs');
|
|
1030
1034
|
await fleetExec(command, { cwd: flag("cwd") });
|
|
1031
1035
|
} else if (sub === "upgrade-claude") {
|
|
1032
|
-
const { fleetUpgradeClaude } = await import('./fleet-
|
|
1036
|
+
const { fleetUpgradeClaude } = await import('./fleet-Cp-Ykxc6.mjs');
|
|
1033
1037
|
await fleetUpgradeClaude({ version: flag("version", "-v") });
|
|
1034
1038
|
} else if (sub === "upgrade-svamp") {
|
|
1035
|
-
const { fleetUpgradeSvamp } = await import('./fleet-
|
|
1036
|
-
await fleetUpgradeSvamp({ version: flag("version", "-v") });
|
|
1039
|
+
const { fleetUpgradeSvamp } = await import('./fleet-Cp-Ykxc6.mjs');
|
|
1040
|
+
await fleetUpgradeSvamp({ version: flag("version", "-v"), excludeSelf: hasFlag("exclude-self") });
|
|
1037
1041
|
} else if (sub === "daemon-restart") {
|
|
1038
|
-
const { fleetDaemonRestart } = await import('./fleet-
|
|
1042
|
+
const { fleetDaemonRestart } = await import('./fleet-Cp-Ykxc6.mjs');
|
|
1039
1043
|
await fleetDaemonRestart({ graceful: !hasFlag("cleanup") });
|
|
1040
1044
|
} else if (sub === "push-skill") {
|
|
1041
1045
|
const name = fleetArgs[1];
|
|
1042
|
-
const { fleetPushSkill } = await import('./fleet-
|
|
1046
|
+
const { fleetPushSkill } = await import('./fleet-Cp-Ykxc6.mjs');
|
|
1043
1047
|
await fleetPushSkill(name);
|
|
1044
1048
|
} else {
|
|
1045
1049
|
console.error(`Unknown fleet subcommand: ${sub}`);
|
|
@@ -44,6 +44,16 @@ function readDaemonState() {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
function getSelfMachineId() {
|
|
48
|
+
return readDaemonState()?.machineId || null;
|
|
49
|
+
}
|
|
50
|
+
function partitionSelf(machines, selfId) {
|
|
51
|
+
if (!selfId) return { targets: machines, skipped: [] };
|
|
52
|
+
return {
|
|
53
|
+
targets: machines.filter((m) => m.machineId !== selfId),
|
|
54
|
+
skipped: machines.filter((m) => m.machineId === selfId)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
47
57
|
function suppressHyphaLogs() {
|
|
48
58
|
const ol = console.log, ow = console.warn, oi = console.info, oe = console.error;
|
|
49
59
|
const sw = process.stdout.write.bind(process.stdout);
|
|
@@ -243,12 +253,18 @@ async function fleetUpgradeSvamp(opts) {
|
|
|
243
253
|
await server.disconnect();
|
|
244
254
|
return;
|
|
245
255
|
}
|
|
246
|
-
|
|
256
|
+
const selfId = opts?.excludeSelf ? getSelfMachineId() : null;
|
|
257
|
+
if (opts?.excludeSelf && !selfId) {
|
|
258
|
+
console.log("\u26A0 --exclude-self: could not determine this machine's ID (no local daemon state) \u2014 nothing excluded.");
|
|
259
|
+
}
|
|
260
|
+
const { targets, skipped } = partitionSelf(machines, selfId);
|
|
261
|
+
console.log(`Upgrading svamp-cli to ${version} on ${targets.length} machine(s)${selfId ? ` (excluding self: ${selfId})` : ""}...
|
|
247
262
|
`);
|
|
248
263
|
try {
|
|
249
264
|
printHeader(["MACHINE ID", "LABEL", "STATE", "DETAIL"], [20, 24, 6, 60]);
|
|
265
|
+
for (const m of skipped) printResultRow(m, "SKIP", 'self \u2014 restart separately with "svamp daemon restart"');
|
|
250
266
|
const cmd = `bash -lc 'npm install -g svamp-cli@${version} 2>&1 | tail -5 && svamp daemon restart 2>&1 | tail -5'`;
|
|
251
|
-
const rows = await fanOut(
|
|
267
|
+
const rows = await fanOut(targets, async (m) => await m.rpc.bash(cmd, void 0));
|
|
252
268
|
let failures = 0;
|
|
253
269
|
for (const r of rows) {
|
|
254
270
|
if (!r.ok) {
|
|
@@ -336,4 +352,4 @@ ${rows.length - failures}/${rows.length} updated.`);
|
|
|
336
352
|
}
|
|
337
353
|
}
|
|
338
354
|
|
|
339
|
-
export { fleetDaemonRestart, fleetExec, fleetPushSkill, fleetStatus, fleetUpgradeClaude, fleetUpgradeSvamp };
|
|
355
|
+
export { fleetDaemonRestart, fleetExec, fleetPushSkill, fleetStatus, fleetUpgradeClaude, fleetUpgradeSvamp, partitionSelf };
|