ci: enforce architecture guards with portable checkout paths
This commit is contained in:
parent
4bcea1aa76
commit
ecc67cab2d
|
|
@ -98,7 +98,7 @@
|
|||
"precheck:pr": "npm run deps:check",
|
||||
"check:pr": "node scripts/run-exclusive.mjs artifacts turbo run typecheck lint format:check knip metadata:check test:run && npm run docs:check && npm run jscpd && npm run scan:todos",
|
||||
"precheck:ci": "npm run deps:check",
|
||||
"check:ci": "node scripts/run-exclusive.mjs artifacts turbo run typecheck lint format:check knip metadata:check jscpd scan:todos",
|
||||
"check:ci": "node scripts/run-exclusive.mjs artifacts turbo run typecheck lint format:check knip metadata:check jscpd scan:todos && npm run verify:architecture-guards",
|
||||
"build:cached": "node scripts/check-dependency-install.mjs && node scripts/run-exclusive.mjs artifacts turbo run artifacts:skills",
|
||||
"format": "oxfmt .",
|
||||
"format:check": "oxfmt --check .",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { join, relative, sep } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
// Architecture guards for the strict-identity / best-effort-inference split.
|
||||
// - Evidence ordering must be locale-independent (ICU varies by host), so
|
||||
|
|
@ -15,7 +16,7 @@ import { join } from "node:path";
|
|||
// Object.values walkers diverge on loc/comment fields and overflow the
|
||||
// stack on deep generated chains.
|
||||
|
||||
const root = new URL("../../", import.meta.url).pathname;
|
||||
const root = fileURLToPath(new URL("../../", import.meta.url));
|
||||
|
||||
const listFiles = async (dir) => {
|
||||
const output = [];
|
||||
|
|
@ -42,7 +43,7 @@ const stripComments = (content) =>
|
|||
const sources = await listFiles(join(root, "src"));
|
||||
const files = await Promise.all(
|
||||
sources.map(async (path) => ({
|
||||
path: path.slice(root.length),
|
||||
path: relative(root, path).split(sep).join("/"),
|
||||
content: stripComments(await readFile(path, "utf8")),
|
||||
})),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue