mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-14 06:43:16 +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
85
openclaw/scripts/check-no-conflict-markers.mjs
Normal file
85
openclaw/scripts/check-no-conflict-markers.mjs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { execFileSync } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
function isBinaryBuffer(buffer) {
|
||||
return buffer.includes(0);
|
||||
}
|
||||
|
||||
export function findConflictMarkerLines(content) {
|
||||
const lines = content.split(/\r?\n/u);
|
||||
const matches = [];
|
||||
for (const [index, line] of lines.entries()) {
|
||||
if (
|
||||
line.startsWith("<<<<<<< ") ||
|
||||
line.startsWith("||||||| ") ||
|
||||
line === "=======" ||
|
||||
line.startsWith(">>>>>>> ")
|
||||
) {
|
||||
matches.push(index + 1);
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
export function listTrackedFiles(cwd = process.cwd()) {
|
||||
const output = execFileSync("git", ["ls-files", "-z"], {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
});
|
||||
return output
|
||||
.split("\0")
|
||||
.filter(Boolean)
|
||||
.map((relativePath) => path.join(cwd, relativePath));
|
||||
}
|
||||
|
||||
export function findConflictMarkersInFiles(filePaths, readFile = fs.readFileSync) {
|
||||
const violations = [];
|
||||
for (const filePath of filePaths) {
|
||||
let content;
|
||||
try {
|
||||
content = readFile(filePath);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (!Buffer.isBuffer(content)) {
|
||||
content = Buffer.from(String(content));
|
||||
}
|
||||
if (isBinaryBuffer(content)) {
|
||||
continue;
|
||||
}
|
||||
const lines = findConflictMarkerLines(content.toString("utf8"));
|
||||
if (lines.length > 0) {
|
||||
violations.push({
|
||||
filePath,
|
||||
lines,
|
||||
});
|
||||
}
|
||||
}
|
||||
return violations;
|
||||
}
|
||||
|
||||
export async function main() {
|
||||
const cwd = process.cwd();
|
||||
const violations = findConflictMarkersInFiles(listTrackedFiles(cwd));
|
||||
if (violations.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.error("Found unresolved merge conflict markers:");
|
||||
for (const violation of violations) {
|
||||
const relativePath = path.relative(cwd, violation.filePath) || violation.filePath;
|
||||
console.error(`- ${relativePath}:${violation.lines.join(",")}`);
|
||||
}
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue