mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-15 05:10:44 +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
91
openclaw/test/scripts/check-no-conflict-markers.test.ts
Normal file
91
openclaw/test/scripts/check-no-conflict-markers.test.ts
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import { execFileSync } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
findConflictMarkerLines,
|
||||
findConflictMarkersInFiles,
|
||||
listTrackedFiles,
|
||||
} from "../../scripts/check-no-conflict-markers.mjs";
|
||||
import { createScriptTestHarness } from "./test-helpers.js";
|
||||
|
||||
const { createTempDir } = createScriptTestHarness();
|
||||
|
||||
function git(cwd: string, ...args: string[]): string {
|
||||
return execFileSync("git", args, {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
}
|
||||
|
||||
describe("check-no-conflict-markers", () => {
|
||||
it("finds git conflict markers at the start of lines", () => {
|
||||
expect(
|
||||
findConflictMarkerLines(
|
||||
[
|
||||
"const ok = true;",
|
||||
"<<<<<<< HEAD",
|
||||
"value = left;",
|
||||
"=======",
|
||||
"value = right;",
|
||||
">>>>>>> main",
|
||||
].join("\n"),
|
||||
),
|
||||
).toEqual([2, 4, 6]);
|
||||
});
|
||||
|
||||
it("ignores marker-like text when it is indented or inline", () => {
|
||||
expect(
|
||||
findConflictMarkerLines(
|
||||
["Example:", " <<<<<<< HEAD", "const text = '======= not a conflict';"].join("\n"),
|
||||
),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("scans text files and skips binary files", () => {
|
||||
const rootDir = createTempDir("openclaw-conflict-markers-");
|
||||
const textFile = path.join(rootDir, "CHANGELOG.md");
|
||||
const binaryFile = path.join(rootDir, "image.png");
|
||||
fs.writeFileSync(textFile, "<<<<<<< HEAD\nconflict\n>>>>>>> main\n");
|
||||
fs.writeFileSync(binaryFile, Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x00]));
|
||||
|
||||
const violations = findConflictMarkersInFiles([textFile, binaryFile]);
|
||||
|
||||
expect(violations).toEqual([
|
||||
{
|
||||
filePath: textFile,
|
||||
lines: [1, 3],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("finds conflict markers in tracked script files", () => {
|
||||
const rootDir = createTempDir("openclaw-conflict-markers-");
|
||||
git(rootDir, "init", "-q");
|
||||
git(rootDir, "config", "user.email", "test@example.com");
|
||||
git(rootDir, "config", "user.name", "Test User");
|
||||
|
||||
const scriptFile = path.join(rootDir, "scripts", "bundled-plugin-metadata-runtime.mjs");
|
||||
fs.mkdirSync(path.dirname(scriptFile), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
scriptFile,
|
||||
[
|
||||
"<<<<<<< HEAD",
|
||||
'const left = "left";',
|
||||
"=======",
|
||||
'const right = "right";',
|
||||
">>>>>>> branch",
|
||||
].join("\n"),
|
||||
);
|
||||
git(rootDir, "add", "scripts/bundled-plugin-metadata-runtime.mjs");
|
||||
|
||||
const violations = findConflictMarkersInFiles(listTrackedFiles(rootDir));
|
||||
|
||||
expect(violations).toEqual([
|
||||
{
|
||||
filePath: scriptFile,
|
||||
lines: [1, 3, 5],
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue