Files
openclaw/scripts/check-src-extension-import-boundary.mts
Peter Steinberger c70aee247e refactor(scripts): migrate JavaScript tools to TypeScript (#121005)
* refactor(scripts): migrate JavaScript tools to TypeScript

* fix(ci): keep changed-scope preflight zero-install

* fix(ci): preserve zero-install script owners

* fix(ci): complete script migration follow-through

* fix(release): keep stable closeout zero-install

* fix(scripts): preserve standalone execution boundaries

* fix(scripts): repair standalone loader boundaries

* fix(scripts): normalize gateway observation ids

* fix(scripts): keep Docker packager standalone

* test(scripts): preserve rebase cleanup helpers

* test(sessions): use tracked temp directory
2026-08-09 07:21:35 -07:00

35 lines
1.1 KiB
TypeScript

#!/usr/bin/env node
// Runs the src/** extension import boundary checker.
import { createExtensionImportBoundaryChecker } from "./lib/extension-import-boundary-checker.mts";
import { runAsScript } from "./lib/ts-guard-utils.mts";
const ALLOWED_EXTENSION_PUBLIC_SURFACE_RE = /^extensions\/[^/]+\/(?:api|runtime-api)\.js$/;
const checker = createExtensionImportBoundaryChecker({
roots: ["src"],
boundaryLabel: "src",
rule: "Rule: production src/** must not import bundled plugin files",
cleanMessage: "No src import boundary violations found.",
inventoryTitle: "Src extension import boundary inventory:",
skipSourcesWithoutBundledPluginPrefix: true,
allowResolvedPath(resolvedPath) {
return ALLOWED_EXTENSION_PUBLIC_SURFACE_RE.test(resolvedPath);
},
shouldSkipFile(relativeFile) {
return (
relativeFile.endsWith(".test.ts") ||
relativeFile.endsWith(".test.tsx") ||
relativeFile.endsWith(".e2e.test.ts") ||
relativeFile.endsWith(".e2e.test.tsx")
);
},
});
/**
* Entrypoint for the src extension import boundary checker.
*/
export const main = checker.main;
runAsScript(import.meta.url, main);