mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 06:16:07 +00:00
* chore(lint): enforce no-floating-promises repo-wide * feat(tooling): split DOM globals out of the Node-side typecheck program tsconfig.core.json now compiles src/ + packages/ with lib ES2023; new tsconfig.ui.json owns ui/ with DOM. Web-global names used by Node code alias to canonical undici/stream-web types; highlight.js loads through a validated narrow API because its d.ts force-includes lib.dom. Boundary, sparse-guard, changed-lane routing, and profile lanes cover the new ui graph. * chore(deps): declare undici-types and teach knip about the highlight.js runtime require * ci: retrigger dropped pull_request synchronize event * refactor(types): derive web-global aliases from @types/node fetch globals, drop undici-types dep * ci: retrigger after dependency guard cleared * fix(scripts): add ui lane to changed-lanes declaration union
68 lines
2.3 KiB
JavaScript
68 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
// Enforces core tsgo project boundaries and sparse-checkout safety.
|
|
import { spawnSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { createManagedCommandInvocation } from "./lib/managed-child-process.mjs";
|
|
|
|
const repoRoot = path.resolve(import.meta.dirname, "..");
|
|
const tsgoPath = path.join(repoRoot, "node_modules", ".bin", "tsgo");
|
|
|
|
const coreGraphs = [
|
|
{ name: "core", config: "tsconfig.core.json" },
|
|
{ name: "ui", config: "tsconfig.ui.json" },
|
|
{ name: "core-test", config: "test/tsconfig/tsconfig.core.test.json" },
|
|
{ name: "core-test-agents", config: "test/tsconfig/tsconfig.core.test.agents.json" },
|
|
{ name: "core-test-non-agents", config: "test/tsconfig/tsconfig.core.test.non-agents.json" },
|
|
];
|
|
|
|
function normalizeFilePath(filePath) {
|
|
const normalized = filePath.trim().replaceAll("\\", "/");
|
|
const normalizedRoot = repoRoot.replaceAll("\\", "/");
|
|
if (normalized.startsWith(`${normalizedRoot}/`)) {
|
|
return normalized.slice(normalizedRoot.length + 1);
|
|
}
|
|
return normalized;
|
|
}
|
|
|
|
function listGraphFiles(graph) {
|
|
const tsgo = createManagedCommandInvocation({
|
|
args: ["-p", graph.config, "--pretty", "false", "--listFilesOnly"],
|
|
bin: tsgoPath,
|
|
});
|
|
const result = spawnSync(tsgo.command, tsgo.args, {
|
|
cwd: repoRoot,
|
|
encoding: "utf8",
|
|
maxBuffer: 256 * 1024 * 1024,
|
|
shell: tsgo.shell,
|
|
windowsVerbatimArguments: tsgo.windowsVerbatimArguments,
|
|
});
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
if ((result.status ?? 1) !== 0) {
|
|
const output = [result.stdout, result.stderr].filter(Boolean).join("\n");
|
|
throw new Error(`${graph.name} file listing failed with exit code ${result.status}\n${output}`);
|
|
}
|
|
return (result.stdout ?? "").split(/\r?\n/u).map(normalizeFilePath).filter(Boolean);
|
|
}
|
|
|
|
const violations = [];
|
|
for (const graph of coreGraphs) {
|
|
const extensionFiles = listGraphFiles(graph).filter((file) => file.startsWith("extensions/"));
|
|
for (const file of extensionFiles) {
|
|
violations.push(`${graph.name}: ${file}`);
|
|
}
|
|
}
|
|
|
|
if (violations.length > 0) {
|
|
console.error("Core tsgo graphs must not include bundled extension files:");
|
|
for (const violation of violations) {
|
|
console.error(`- ${violation}`);
|
|
}
|
|
console.error(
|
|
"Move extension-owned behavior behind plugin SDK contracts, public artifacts, or extension-local tests.",
|
|
);
|
|
process.exit(1);
|
|
}
|