You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chajia/scripts/record-priority1-ftl-path.ts

59 lines
1.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env tsx
/**
* FTL canonical 路径 — 人机协作录制
* 自动填 Step1 + 拖车类型Additional Services 及后续交人工并记录至报价
*
* npm run record:priority1-ftl-path
* $env:PRIORITY1_PATH_ID="F01-ftl-dry-van-full"; npm run record:priority1-ftl-path
*/
import { join } from "node:path";
import {
formatPriority1InputSummary,
PRIORITY1_CANONICAL_PATHS,
} from "@/workers/rpa/priority1/demo-input";
import { runPriority1FtlPathRecording } from "./visual-priority1-full-chain";
async function main(): Promise<void> {
const pathId = process.env.PRIORITY1_PATH_ID?.trim() ?? "F01-ftl-dry-van-full";
const canonical = PRIORITY1_CANONICAL_PATHS.find(
(p) => p.id === pathId || p.id.startsWith(pathId),
);
if (!canonical) {
console.error(`[record-ftl] 未找到路径: ${pathId}`);
console.error("可用 F 路径: F01 … F11");
process.exit(1);
}
if (!canonical.id.startsWith("F")) {
console.error(`[record-ftl] 非 FTL 路径: ${canonical.id}`);
process.exit(1);
}
const outDir = join(
process.cwd(),
".rpa",
"recordings",
`${canonical.id}-human-session`,
);
console.log("\n════════ FTL 人机协作录制 ════════");
console.log(`路径: ${canonical.id}${canonical.title}`);
console.log(formatPriority1InputSummary(canonical.input));
console.log(`\n[record-ftl] 输出目录: ${outDir}`);
console.log("[record-ftl] 浏览器打开后,在 handoff 清单处人工补操作");
console.log("[record-ftl] 出现报价自动保存;或 Ctrl+C 保存已录步骤\n");
const result = await runPriority1FtlPathRecording({
demo: canonical.input,
caseId: canonical.id,
outDir,
keepBrowserOpen: true,
});
process.exit(result.ok ? 0 : 1);
}
main().catch((e) => {
console.error(e);
process.exit(1);
});