fix(web-probe): accept stdin prompts for observe commands (#724)
Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
@@ -6923,7 +6923,7 @@ function parseNodeWebProbeObserveOptions(
|
||||
"--label",
|
||||
"--session-id",
|
||||
"--provider",
|
||||
]), new Set(["--force", "--full"]));
|
||||
]), new Set(["--force", "--full", "--text-stdin"]));
|
||||
const commandTypeRaw = optionValue(args, "--type") ?? null;
|
||||
const commandType = commandTypeRaw === null ? null : parseNodeWebProbeObserveCommandType(commandTypeRaw);
|
||||
const stateDir = optionValue(args, "--state-dir") ?? indexed?.stateDir ?? null;
|
||||
@@ -6937,6 +6937,15 @@ function parseNodeWebProbeObserveOptions(
|
||||
if (observeActionRaw !== "start" && stateDir === null && jobId === null) {
|
||||
throw new Error("web-probe observe status|command|stop|collect|analyze requires --state-dir or --job-id");
|
||||
}
|
||||
const commandTextOption = optionValue(args, "--text") ?? null;
|
||||
const commandTextFromStdin = args.includes("--text-stdin");
|
||||
if (commandTextFromStdin && observeActionRaw !== "command") {
|
||||
throw new Error("web-probe observe --text-stdin is only supported for observe command");
|
||||
}
|
||||
if (commandTextFromStdin && commandTextOption !== null) {
|
||||
throw new Error("web-probe observe command accepts either --text or --text-stdin, not both");
|
||||
}
|
||||
const commandText = commandTextFromStdin ? readFileSync(0, "utf8") : commandTextOption;
|
||||
return {
|
||||
action: "observe",
|
||||
observeAction: observeActionRaw,
|
||||
@@ -6962,7 +6971,7 @@ function parseNodeWebProbeObserveOptions(
|
||||
jobId,
|
||||
force: args.includes("--force"),
|
||||
commandType,
|
||||
commandText: optionValue(args, "--text") ?? null,
|
||||
commandText,
|
||||
commandPath: optionValue(args, "--path") ?? null,
|
||||
commandLabel: optionValue(args, "--label") ?? null,
|
||||
commandSessionId: optionValue(args, "--session-id") ?? null,
|
||||
|
||||
Reference in New Issue
Block a user