From ecc67cab2d85cacda245890ffe84b80ac395d79e Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 10 Oct 2026 06:20:10 +0800 Subject: [PATCH] ci: enforce architecture guards with portable checkout paths --- package.json | 2 +- scripts/verify/architecture-guards.mjs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index abb5c215e..1c41d19bc 100644 --- a/package.json +++ b/package.json @@ -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 .", diff --git a/scripts/verify/architecture-guards.mjs b/scripts/verify/architecture-guards.mjs index efe2a8df4..ea92bf9d2 100644 --- a/scripts/verify/architecture-guards.mjs +++ b/scripts/verify/architecture-guards.mjs @@ -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")), })), );