Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

ci: enforce architecture guards with portable checkout paths

morlutoecc67cab2d85
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")),
})),
);