ci: enforce architecture guards with portable checkout paths
This commit is contained in:
+1
-1
@@ -98,7 +98,7 @@
|
|||||||
"precheck:pr": "npm run deps:check",
|
"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",
|
"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",
|
"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",
|
"build:cached": "node scripts/check-dependency-install.mjs && node scripts/run-exclusive.mjs artifacts turbo run artifacts:skills",
|
||||||
"format": "oxfmt .",
|
"format": "oxfmt .",
|
||||||
"format:check": "oxfmt --check .",
|
"format:check": "oxfmt --check .",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { readFile, readdir } from "node:fs/promises";
|
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.
|
// Architecture guards for the strict-identity / best-effort-inference split.
|
||||||
// - Evidence ordering must be locale-independent (ICU varies by host), so
|
// - 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
|
// Object.values walkers diverge on loc/comment fields and overflow the
|
||||||
// stack on deep generated chains.
|
// 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 listFiles = async (dir) => {
|
||||||
const output = [];
|
const output = [];
|
||||||
@@ -42,7 +43,7 @@ const stripComments = (content) =>
|
|||||||
const sources = await listFiles(join(root, "src"));
|
const sources = await listFiles(join(root, "src"));
|
||||||
const files = await Promise.all(
|
const files = await Promise.all(
|
||||||
sources.map(async (path) => ({
|
sources.map(async (path) => ({
|
||||||
path: path.slice(root.length),
|
path: relative(root, path).split(sep).join("/"),
|
||||||
content: stripComments(await readFile(path, "utf8")),
|
content: stripComments(await readFile(path, "utf8")),
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user