feat: move web-probe to top-level cli (#933)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-26 09:57:14 +08:00
committed by GitHub
parent 0328967e58
commit 241a2d511f
18 changed files with 249 additions and 274 deletions
+22 -22
View File
@@ -84,7 +84,7 @@ export function recoverWebObserveAnalyzeTurnDetails(options: NodeWebProbeObserve
export function withWebObserveAnalyzeRendered(value: Record<string, unknown>): RenderedCliResult {
return {
ok: value.ok !== false,
command: typeof value.command === "string" ? value.command : "hwlab nodes web-probe observe analyze",
command: typeof value.command === "string" ? value.command : "web-probe observe analyze",
contentType: "text/plain",
renderedText: renderWebObserveAnalyzeTable(value),
};
@@ -321,7 +321,7 @@ export function renderWebObserveAnalyzeTable(value: Record<string, unknown>): st
webObserveShort(webObserveArray(item.slowSamples).map((sample) => webObserveText(record(sample)?.otelTraceId)).filter((text) => text !== "-").join(",") || "-", 36),
]);
const lines = [
`hwlab nodes web-probe observe analyze (${webObserveText(value.status)})`,
`web-probe observe analyze (${webObserveText(value.status)})`,
"",
...(value.ok === false ? [
"Blocked detail:",
@@ -916,7 +916,7 @@ export function upsertWebObserveIndexEntry(entry: WebObserveIndexEntry): Record<
ok: true,
id: entry.id,
path,
statusCommand: `bun scripts/cli.ts hwlab nodes web-probe observe status ${entry.id}`,
statusCommand: `bun scripts/cli.ts web-probe observe status ${entry.id}`,
valuesRedacted: true,
};
} catch (error) {
@@ -925,7 +925,7 @@ export function upsertWebObserveIndexEntry(entry: WebObserveIndexEntry): Record<
id: entry.id,
path,
error: error instanceof Error ? error.message : String(error),
fallback: `bun scripts/cli.ts hwlab nodes web-probe observe status --node ${entry.node} --lane ${entry.lane} --state-dir ${entry.stateDir}`,
fallback: `bun scripts/cli.ts web-probe observe status --node ${entry.node} --lane ${entry.lane} --state-dir ${entry.stateDir}`,
valuesRedacted: true,
};
}
@@ -964,16 +964,16 @@ export function webObserveIndexEntryFromOptions(options: NodeWebProbeObserveOpti
export function webObserveCommandLabel(action: NodeWebProbeObserveAction, options: Pick<NodeWebProbeObserveOptions, "id" | "jobId" | "node" | "lane">): string {
const id = webObserveIdFromOptions(options);
return id === null
? `hwlab nodes web-probe observe ${action} --node ${options.node} --lane ${options.lane}`
: `hwlab nodes web-probe observe ${action} ${id}`;
? `web-probe observe ${action} --node ${options.node} --lane ${options.lane}`
: `web-probe observe ${action} ${id}`;
}
export function webObserveNextCommands(id: string): Record<string, string> {
return {
status: `bun scripts/cli.ts hwlab nodes web-probe observe status ${id}`,
command: `bun scripts/cli.ts hwlab nodes web-probe observe command ${id} --type mark --label checkpoint`,
stop: `bun scripts/cli.ts hwlab nodes web-probe observe stop ${id}`,
analyze: `bun scripts/cli.ts hwlab nodes web-probe observe analyze ${id}`,
status: `bun scripts/cli.ts web-probe observe status ${id}`,
command: `bun scripts/cli.ts web-probe observe command ${id} --type mark --label checkpoint`,
stop: `bun scripts/cli.ts web-probe observe stop ${id}`,
analyze: `bun scripts/cli.ts web-probe observe analyze ${id}`,
};
}
@@ -1058,7 +1058,7 @@ export function renderWebProbeRunResult(result: Record<string, unknown>): Record
"",
"NEXT",
` report: ${reportPath}`,
` rerun: ${result.command ?? `hwlab nodes web-probe run --node ${result.node ?? "-"} --lane ${result.lane ?? "-"}`}`,
` rerun: ${result.command ?? `web-probe run --node ${result.node ?? "-"} --lane ${result.lane ?? "-"}`}`,
].join("\n");
return withWebObserveRendered(result, renderedText);
}
@@ -1116,10 +1116,10 @@ export function renderWebObserveStartResult(result: Record<string, unknown>): Re
...blockedRows,
"",
"NEXT",
` status: bun scripts/cli.ts hwlab nodes web-probe observe status ${id}`,
` analyze: bun scripts/cli.ts hwlab nodes web-probe observe analyze ${id}`,
` command: bun scripts/cli.ts hwlab nodes web-probe observe command ${id} --type mark --label checkpoint`,
` stop: bun scripts/cli.ts hwlab nodes web-probe observe stop ${id}`,
` status: bun scripts/cli.ts web-probe observe status ${id}`,
` analyze: bun scripts/cli.ts web-probe observe analyze ${id}`,
` command: bun scripts/cli.ts web-probe observe command ${id} --type mark --label checkpoint`,
` stop: bun scripts/cli.ts web-probe observe stop ${id}`,
].join("\n");
return withWebObserveRendered(result, renderedText);
}
@@ -1174,9 +1174,9 @@ export function renderWebObserveStatusResult(result: Record<string, unknown>): R
...resultSection,
"",
"NEXT",
` status: bun scripts/cli.ts hwlab nodes web-probe observe status ${id}`,
` analyze: bun scripts/cli.ts hwlab nodes web-probe observe analyze ${id}`,
` command: bun scripts/cli.ts hwlab nodes web-probe observe command ${id} --type mark --label checkpoint`,
` status: bun scripts/cli.ts web-probe observe status ${id}`,
` analyze: bun scripts/cli.ts web-probe observe analyze ${id}`,
` command: bun scripts/cli.ts web-probe observe command ${id} --type mark --label checkpoint`,
].join("\n");
return withWebObserveRendered(result, renderedText);
}
@@ -1203,8 +1203,8 @@ export function renderWebObserveCommandResult(result: Record<string, unknown>):
),
"",
"NEXT",
` status: bun scripts/cli.ts hwlab nodes web-probe observe status ${id}`,
` analyze: bun scripts/cli.ts hwlab nodes web-probe observe analyze ${id}`,
` status: bun scripts/cli.ts web-probe observe status ${id}`,
` analyze: bun scripts/cli.ts web-probe observe analyze ${id}`,
].join("\n");
return withWebObserveRendered(result, renderedText);
}
@@ -1396,7 +1396,7 @@ export function renderWebObserveAnalyzeResult(result: Record<string, unknown>):
` md: ${analysis.reportMdPath ?? "-"}`,
"",
"NEXT",
` status: bun scripts/cli.ts hwlab nodes web-probe observe status ${id}`,
` status: bun scripts/cli.ts web-probe observe status ${id}`,
].join("\n");
return withWebObserveRendered(result, renderedText);
}
@@ -1464,7 +1464,7 @@ export function renderWebProbeScriptResult(result: Record<string, unknown>): Rec
"",
"NEXT",
` report: ${reportLoad.path ?? probe.reportPath ?? "-"}`,
` rerun: ${result.command ?? `hwlab nodes web-probe script --node ${result.node ?? "-"} --lane ${result.lane ?? "-"}`}`,
` rerun: ${result.command ?? `web-probe script --node ${result.node ?? "-"} --lane ${result.lane ?? "-"}`}`,
].join("\n");
return withWebObserveRendered(result, renderedText);
}