mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 05:10:45 +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
56
openclaw/scripts/test-extension.mjs
Normal file
56
openclaw/scripts/test-extension.mjs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { formatErrorMessage } from "./lib/error-format.mjs";
|
||||
import { resolveExtensionTestPlan } from "./lib/extension-test-plan.mjs";
|
||||
import { isDirectScriptRun, runVitestBatch } from "./lib/vitest-batch-runner.mjs";
|
||||
|
||||
function printUsage() {
|
||||
console.error("Usage: pnpm test:extension <extension-name|path> [vitest args...]");
|
||||
console.error(" node scripts/test-extension.mjs [extension-name|path] [vitest args...]");
|
||||
}
|
||||
|
||||
function printNoTestsMessage(plan) {
|
||||
console.log(`[test-extension] No tests found for ${plan.extensionDir}. Skipping.`);
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const rawArgs = process.argv.slice(2);
|
||||
if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
|
||||
printUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
const passthroughArgs = rawArgs.filter((arg) => arg !== "--");
|
||||
|
||||
let targetArg;
|
||||
if (passthroughArgs[0] && !passthroughArgs[0].startsWith("-")) {
|
||||
targetArg = passthroughArgs.shift();
|
||||
}
|
||||
|
||||
let plan;
|
||||
try {
|
||||
plan = resolveExtensionTestPlan({ cwd: process.cwd(), targetArg });
|
||||
} catch (error) {
|
||||
printUsage();
|
||||
console.error(formatErrorMessage(error));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!plan.hasTests) {
|
||||
printNoTestsMessage(plan);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`[test-extension] Running ${plan.testFileCount} test files for ${plan.extensionId}`);
|
||||
const exitCode = await runVitestBatch({
|
||||
args: passthroughArgs,
|
||||
config: plan.config,
|
||||
env: process.env,
|
||||
targets: plan.roots,
|
||||
});
|
||||
process.exit(exitCode);
|
||||
}
|
||||
|
||||
if (isDirectScriptRun(import.meta.url)) {
|
||||
await run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue