// 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 { return hwlabNodeWebProbeHelp(); } export async function runWebProbeCommand(_config: Config, args: string[]): Promise | RenderedCliResult> { if (args.length === 0 || args.includes("--help") || args.includes("-h") || args[0] === "help") return webProbeHelp(); const format = args.includes("--json") ? "json" : args.includes("--yaml") ? "yaml" : "text"; const parsedArgs = args.filter((item) => item !== "--json" && item !== "--yaml"); const result = runNodeWebProbe(parseNodeWebProbeOptions(parsedArgs)); if (format === "text" || !("projection" in result) || result.projection === undefined) return result; if (format === "json") return result.projection; return { ...result, renderedText: Bun.YAML.stringify(result.projection), contentType: "application/yaml" }; } export function legacyHwlabNodeWebProbeUnsupported(args: string[]): Record { 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, }; }