Files
pikasTech-unidesk/scripts/src/web-probe.ts
T
2026-06-26 09:57:14 +08:00

33 lines
1.5 KiB
TypeScript

// SPEC: PJ2026-01010305 71FREQ预装 draft-2026-06-26-71freq-v03-hwpod-preinstall.
// Responsibility: Top-level web-probe CLI adapter and legacy hwlab nodes web-probe migration guard.
import type { Config } from "./config";
import type { RenderedCliResult } from "./output";
import { hwlabNodeWebProbeHelp } from "./hwlab-node-help";
import { parseNodeWebProbeOptions } from "./hwlab-node/web-probe";
import { runNodeWebProbe } from "./hwlab-node/web-probe-observe";
export function webProbeHelp(): Record<string, unknown> {
return hwlabNodeWebProbeHelp();
}
export async function runWebProbeCommand(_config: Config, args: string[]): Promise<Record<string, unknown> | RenderedCliResult> {
if (args.length === 0 || args.includes("--help") || args.includes("-h") || args[0] === "help") return webProbeHelp();
return runNodeWebProbe(parseNodeWebProbeOptions(args));
}
export function legacyHwlabNodeWebProbeUnsupported(args: string[]): Record<string, unknown> {
const filtered = args.filter((item) => item !== "help" && item !== "--help" && item !== "-h");
const suffix = filtered.length === 0 ? "" : ` ${filtered.join(" ")}`;
return {
ok: false,
status: "unsupported",
command: `hwlab nodes web-probe${args.length === 0 ? "" : ` ${args.join(" ")}`}`.trim(),
message: "`hwlab nodes web-probe` has moved to top-level `web-probe`; the old path is no longer an executable alias.",
migration: {
canonicalCommand: `bun scripts/cli.ts web-probe${suffix}`,
help: "bun scripts/cli.ts web-probe --help",
},
valuesPrinted: false,
};
}