mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 20:50:52 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
49
openclaw/scripts/test-hotspots.mjs
Normal file
49
openclaw/scripts/test-hotspots.mjs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import {
|
||||
formatMs,
|
||||
loadVitestReportFromArgs,
|
||||
parseVitestReportArgs,
|
||||
} from "./lib/vitest-report-cli-utils.mjs";
|
||||
import { collectVitestFileDurations } from "./test-report-utils.mjs";
|
||||
|
||||
if (process.argv.slice(2).includes("--help")) {
|
||||
console.log(
|
||||
[
|
||||
"Usage: node scripts/test-hotspots.mjs [options]",
|
||||
"",
|
||||
"Print the slowest test files from a Vitest JSON report.",
|
||||
"",
|
||||
"Options:",
|
||||
" --config <path> Vitest config to run when no report is supplied",
|
||||
" --report <path> Reuse an existing Vitest JSON report",
|
||||
" --limit <count> Number of files to print (default: 20)",
|
||||
" --help Show this help text",
|
||||
"",
|
||||
"Examples:",
|
||||
" node scripts/test-hotspots.mjs",
|
||||
" node scripts/test-hotspots.mjs --config test/vitest/vitest.channels.config.ts --limit 10",
|
||||
" node scripts/test-hotspots.mjs --report /tmp/vitest-report.json",
|
||||
].join("\n"),
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const opts = parseVitestReportArgs(process.argv.slice(2), {
|
||||
config: "test/vitest/vitest.unit.config.ts",
|
||||
limit: 20,
|
||||
});
|
||||
const report = loadVitestReportFromArgs(opts, "openclaw-vitest-hotspots");
|
||||
const fileResults = collectVitestFileDurations(report).toSorted(
|
||||
(a, b) => b.durationMs - a.durationMs,
|
||||
);
|
||||
|
||||
const top = fileResults.slice(0, opts.limit);
|
||||
const totalDurationMs = fileResults.reduce((sum, item) => sum + item.durationMs, 0);
|
||||
console.log(
|
||||
`\n[test-hotspots] top ${String(top.length)} by file duration (${formatMs(totalDurationMs)} total)`,
|
||||
);
|
||||
for (const [index, item] of top.entries()) {
|
||||
const label = String(index + 1).padStart(2, " ");
|
||||
const duration = formatMs(item.durationMs).padStart(10, " ");
|
||||
const tests = String(item.testCount).padStart(4, " ");
|
||||
console.log(`${label}. ${duration} | tests=${tests} | ${item.file}`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue