@staff0rd/assist 0.898.2 → 0.900.0
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/commands/sessions/web/bundle.js +387 -387
- package/dist/index.js +98 -66
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.900.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -13820,8 +13820,8 @@ function registerAdvise(program) {
|
|
|
13820
13820
|
}
|
|
13821
13821
|
|
|
13822
13822
|
// src/shared/internalCommand.ts
|
|
13823
|
-
function internalCommand(command,
|
|
13824
|
-
command.internalCalledBy =
|
|
13823
|
+
function internalCommand(command, calledBy2) {
|
|
13824
|
+
command.internalCalledBy = calledBy2;
|
|
13825
13825
|
return command;
|
|
13826
13826
|
}
|
|
13827
13827
|
|
|
@@ -39483,8 +39483,11 @@ function registerReview(program) {
|
|
|
39483
39483
|
"[number]",
|
|
39484
39484
|
"Optional PR number; when provided, runs `gh pr checkout <number>` before reviewing"
|
|
39485
39485
|
);
|
|
39486
|
-
|
|
39487
|
-
(
|
|
39486
|
+
internalCommand(
|
|
39487
|
+
addReviewModeOptions(addReviewRunOptions(reviewCommand)).action(
|
|
39488
|
+
(number, options2) => review({ ...options2, number })
|
|
39489
|
+
),
|
|
39490
|
+
"the Review menu"
|
|
39488
39491
|
);
|
|
39489
39492
|
configHelp(
|
|
39490
39493
|
reviewCommand,
|
|
@@ -51642,6 +51645,31 @@ async function closeSession() {
|
|
|
51642
51645
|
}
|
|
51643
51646
|
}
|
|
51644
51647
|
|
|
51648
|
+
// src/commands/sessions/nodes/listNodes.ts
|
|
51649
|
+
import chalk262 from "chalk";
|
|
51650
|
+
async function nodesReport() {
|
|
51651
|
+
const live = await queryNodes();
|
|
51652
|
+
if (live)
|
|
51653
|
+
return { local: live.local, daemonRunning: true, links: live.links };
|
|
51654
|
+
return {
|
|
51655
|
+
local: resolveNodeName(),
|
|
51656
|
+
daemonRunning: false,
|
|
51657
|
+
links: loadLinkSpecs().map((link3) => ({ ...link3, state: "disconnected" }))
|
|
51658
|
+
};
|
|
51659
|
+
}
|
|
51660
|
+
async function listNodes(options2) {
|
|
51661
|
+
const report = await nodesReport();
|
|
51662
|
+
if (options2.json) {
|
|
51663
|
+
console.log(JSON.stringify(report, null, 2));
|
|
51664
|
+
return;
|
|
51665
|
+
}
|
|
51666
|
+
console.log(`${report.local} ${chalk262.dim("(this node)")}`);
|
|
51667
|
+
if (!report.daemonRunning)
|
|
51668
|
+
console.log(chalk262.dim(" daemon not running; showing configured links"));
|
|
51669
|
+
if (report.links.length === 0) console.log(chalk262.dim(" no links"));
|
|
51670
|
+
for (const link3 of report.links) console.log(formatLink(link3));
|
|
51671
|
+
}
|
|
51672
|
+
|
|
51645
51673
|
// src/commands/sessions/nodes/findUnlinkedWindowsNode.ts
|
|
51646
51674
|
var WINDOWS_NODE_URL = "http://127.0.0.1:3101";
|
|
51647
51675
|
async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
@@ -51660,7 +51688,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
51660
51688
|
}
|
|
51661
51689
|
|
|
51662
51690
|
// src/commands/sessions/nodes/printReport.ts
|
|
51663
|
-
import
|
|
51691
|
+
import chalk263 from "chalk";
|
|
51664
51692
|
function printReport(report) {
|
|
51665
51693
|
if (report.links.length === 0) {
|
|
51666
51694
|
console.log(`${report.local} has no links`);
|
|
@@ -51674,11 +51702,11 @@ function printReport(report) {
|
|
|
51674
51702
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
51675
51703
|
}
|
|
51676
51704
|
function printDiagnosis(diagnosis) {
|
|
51677
|
-
console.log(`${
|
|
51705
|
+
console.log(`${chalk263.bold(diagnosis.name)} ${chalk263.dim(diagnosis.url)}`);
|
|
51678
51706
|
for (const hop of diagnosis.hops) {
|
|
51679
|
-
const mark = hop.ok ?
|
|
51707
|
+
const mark = hop.ok ? chalk263.green("\u2713") : chalk263.red("\u2717");
|
|
51680
51708
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
51681
|
-
if (hop.remediation) console.log(` ${
|
|
51709
|
+
if (hop.remediation) console.log(` ${chalk263.yellow(hop.remediation)}`);
|
|
51682
51710
|
}
|
|
51683
51711
|
}
|
|
51684
51712
|
|
|
@@ -51697,31 +51725,6 @@ async function doctorNodes(name, options2) {
|
|
|
51697
51725
|
else printReport(report);
|
|
51698
51726
|
}
|
|
51699
51727
|
|
|
51700
|
-
// src/commands/sessions/nodes/listNodes.ts
|
|
51701
|
-
import chalk263 from "chalk";
|
|
51702
|
-
async function nodesReport() {
|
|
51703
|
-
const live = await queryNodes();
|
|
51704
|
-
if (live)
|
|
51705
|
-
return { local: live.local, daemonRunning: true, links: live.links };
|
|
51706
|
-
return {
|
|
51707
|
-
local: resolveNodeName(),
|
|
51708
|
-
daemonRunning: false,
|
|
51709
|
-
links: loadLinkSpecs().map((link3) => ({ ...link3, state: "disconnected" }))
|
|
51710
|
-
};
|
|
51711
|
-
}
|
|
51712
|
-
async function listNodes(options2) {
|
|
51713
|
-
const report = await nodesReport();
|
|
51714
|
-
if (options2.json) {
|
|
51715
|
-
console.log(JSON.stringify(report, null, 2));
|
|
51716
|
-
return;
|
|
51717
|
-
}
|
|
51718
|
-
console.log(`${report.local} ${chalk263.dim("(this node)")}`);
|
|
51719
|
-
if (!report.daemonRunning)
|
|
51720
|
-
console.log(chalk263.dim(" daemon not running; showing configured links"));
|
|
51721
|
-
if (report.links.length === 0) console.log(chalk263.dim(" no links"));
|
|
51722
|
-
for (const link3 of report.links) console.log(formatLink(link3));
|
|
51723
|
-
}
|
|
51724
|
-
|
|
51725
51728
|
// src/commands/sessions/nodes/nodeLogs.ts
|
|
51726
51729
|
async function fetchLogTail(name, lines2) {
|
|
51727
51730
|
if (name === resolveNodeName())
|
|
@@ -51756,6 +51759,24 @@ async function nodeLogs(name, options2) {
|
|
|
51756
51759
|
for (const line of tail.lines) console.log(line);
|
|
51757
51760
|
}
|
|
51758
51761
|
|
|
51762
|
+
// src/commands/sessions/nodes/registerDiagnoseCommands.ts
|
|
51763
|
+
function registerDiagnoseCommands(nodes, calledBy2) {
|
|
51764
|
+
internalCommand(
|
|
51765
|
+
nodes.command("doctor [name]").description(
|
|
51766
|
+
"Probe each hop of every link (or one) in order and stop at the first failure with a remediation"
|
|
51767
|
+
).option("--json", "Output as JSON").action(
|
|
51768
|
+
(name, _options, command) => doctorNodes(name, command.optsWithGlobals())
|
|
51769
|
+
),
|
|
51770
|
+
calledBy2
|
|
51771
|
+
);
|
|
51772
|
+
internalCommand(
|
|
51773
|
+
nodes.command("logs <name>").description("Tail a linked node's daemon.log through its web server").option("-n, --lines <lines>", "Number of lines", "200").option("--json", "Output as JSON").action(
|
|
51774
|
+
(name, _options, command) => nodeLogs(name, command.optsWithGlobals())
|
|
51775
|
+
),
|
|
51776
|
+
calledBy2
|
|
51777
|
+
);
|
|
51778
|
+
}
|
|
51779
|
+
|
|
51759
51780
|
// src/commands/sessions/nodes/linkNode.ts
|
|
51760
51781
|
import chalk266 from "chalk";
|
|
51761
51782
|
|
|
@@ -51869,7 +51890,7 @@ async function linkNode(name, url, options2) {
|
|
|
51869
51890
|
|
|
51870
51891
|
// src/commands/sessions/nodes/registerLinkCommand.ts
|
|
51871
51892
|
function registerLinkCommand(nodes) {
|
|
51872
|
-
nodes.command("link <name> [url]").description(
|
|
51893
|
+
return nodes.command("link <name> [url]").description(
|
|
51873
51894
|
"Link a peer node by its web server URL or by its Tailscale name with --tailscale and --port (name must match the peer's sessions.nodeName)"
|
|
51874
51895
|
).option(
|
|
51875
51896
|
"--tailscale <host>",
|
|
@@ -51967,20 +51988,6 @@ async function restartNode(name, options2) {
|
|
|
51967
51988
|
console.log(`${name} is back (v${link3.peerVersion ?? "unknown"})`);
|
|
51968
51989
|
}
|
|
51969
51990
|
|
|
51970
|
-
// src/commands/sessions/nodes/unlinkNode.ts
|
|
51971
|
-
import chalk267 from "chalk";
|
|
51972
|
-
async function unlinkNode(name) {
|
|
51973
|
-
const links2 = await readLinks();
|
|
51974
|
-
const remaining = links2.filter((link3) => link3.name !== name);
|
|
51975
|
-
if (remaining.length === links2.length) {
|
|
51976
|
-
console.log(chalk267.yellow(`No link named ${name}`));
|
|
51977
|
-
return;
|
|
51978
|
-
}
|
|
51979
|
-
await writeLinks(remaining);
|
|
51980
|
-
console.log(chalk267.green(`Unlinked ${name}`));
|
|
51981
|
-
await notifyDaemonLinks();
|
|
51982
|
-
}
|
|
51983
|
-
|
|
51984
51991
|
// src/commands/sessions/nodes/updateNode.ts
|
|
51985
51992
|
var CREATE_TIMEOUT_MS = 3e4;
|
|
51986
51993
|
var UPDATE_TIMEOUT_MS = 10 * 6e4;
|
|
@@ -52043,25 +52050,50 @@ async function updateNode(name) {
|
|
|
52043
52050
|
console.log(`${name} updated to v${link3.peerVersion ?? "unknown"}`);
|
|
52044
52051
|
}
|
|
52045
52052
|
|
|
52053
|
+
// src/commands/sessions/nodes/registerPeerActionCommands.ts
|
|
52054
|
+
function registerPeerActionCommands(nodes, calledBy2) {
|
|
52055
|
+
internalCommand(
|
|
52056
|
+
nodes.command("restart <name>").description(
|
|
52057
|
+
"Restart a linked node's daemon and/or web server, wait for its link to reconnect and print its version"
|
|
52058
|
+
).option("--target <target>", "daemon, webserver or both", "both").action(restartNode),
|
|
52059
|
+
calledBy2
|
|
52060
|
+
);
|
|
52061
|
+
internalCommand(
|
|
52062
|
+
nodes.command("update <name>").description(
|
|
52063
|
+
"Run assist update on a linked node, restart it, wait for its link to reconnect and print its version"
|
|
52064
|
+
).action((name) => updateNode(name)),
|
|
52065
|
+
calledBy2
|
|
52066
|
+
);
|
|
52067
|
+
}
|
|
52068
|
+
|
|
52069
|
+
// src/commands/sessions/nodes/unlinkNode.ts
|
|
52070
|
+
import chalk267 from "chalk";
|
|
52071
|
+
async function unlinkNode(name) {
|
|
52072
|
+
const links2 = await readLinks();
|
|
52073
|
+
const remaining = links2.filter((link3) => link3.name !== name);
|
|
52074
|
+
if (remaining.length === links2.length) {
|
|
52075
|
+
console.log(chalk267.yellow(`No link named ${name}`));
|
|
52076
|
+
return;
|
|
52077
|
+
}
|
|
52078
|
+
await writeLinks(remaining);
|
|
52079
|
+
console.log(chalk267.green(`Unlinked ${name}`));
|
|
52080
|
+
await notifyDaemonLinks();
|
|
52081
|
+
}
|
|
52082
|
+
|
|
52046
52083
|
// src/commands/sessions/nodes/registerNodes.ts
|
|
52084
|
+
var calledBy = "agents managing linked nodes";
|
|
52047
52085
|
function registerNodes(sessions) {
|
|
52048
|
-
const cmd =
|
|
52049
|
-
|
|
52050
|
-
|
|
52051
|
-
|
|
52052
|
-
|
|
52053
|
-
|
|
52054
|
-
(name
|
|
52055
|
-
|
|
52056
|
-
|
|
52057
|
-
|
|
52058
|
-
);
|
|
52059
|
-
cmd.command("restart <name>").description(
|
|
52060
|
-
"Restart a linked node's daemon and/or web server, wait for its link to reconnect and print its version"
|
|
52061
|
-
).option("--target <target>", "daemon, webserver or both", "both").action(restartNode);
|
|
52062
|
-
cmd.command("update <name>").description(
|
|
52063
|
-
"Run assist update on a linked node, restart it, wait for its link to reconnect and print its version"
|
|
52064
|
-
).action((name) => updateNode(name));
|
|
52086
|
+
const cmd = internalCommand(
|
|
52087
|
+
sessions.command("nodes").description("List this node and every linked node with its link state").option("--json", "Output as JSON").action(listNodes),
|
|
52088
|
+
calledBy
|
|
52089
|
+
);
|
|
52090
|
+
internalCommand(registerLinkCommand(cmd), calledBy);
|
|
52091
|
+
internalCommand(
|
|
52092
|
+
cmd.command("unlink <name>").description("Remove a linked node").action(unlinkNode),
|
|
52093
|
+
calledBy
|
|
52094
|
+
);
|
|
52095
|
+
registerDiagnoseCommands(cmd, calledBy);
|
|
52096
|
+
registerPeerActionCommands(cmd, calledBy);
|
|
52065
52097
|
configHelp(cmd, nodesConfigHelp);
|
|
52066
52098
|
}
|
|
52067
52099
|
|