@vwala/tooling-config 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The halves of the pnpm convention that `use-pnpm-scripts.grit` cannot express.
4
+ *
5
+ * A GritQL plugin sees one file's syntax, so it can police package.json scripts
6
+ * and nothing else. The lockfiles, the `packageManager` field, the invocations
7
+ * in git hooks and CI workflows and Dockerfiles, and the escape hatch itself
8
+ * all live here. Wire this into a repository's own check script and run it from
9
+ * the repository root; it reads the repository through git, so it only sees
10
+ * tracked files.
11
+ *
12
+ * The escape hatch comes first. The convention says a repository that
13
+ * explicitly uses another package manager keeps it, so this is a no-op unless
14
+ * the repository opts in — by naming pnpm in `packageManager`, or by tracking a
15
+ * pnpm-lock.yaml with no other manager declared. An explicit foreign
16
+ * `packageManager` wins outright, so a stray lockfile cannot switch the script
17
+ * on. A repository with no package.json at all is skipped too, because the
18
+ * runner that sequences this also runs in repositories that are not Node ones.
19
+ *
20
+ * npm-shrinkwrap.json and the bun lockfiles are treated as competing lockfiles
21
+ * alongside the package-lock.json and yarn.lock the convention names — same
22
+ * defect, and naming only two would read as a deliberate exemption of the rest.
23
+ *
24
+ * npm is flagged on its install and run verbs rather than on the bare word, so
25
+ * the registry operations npm genuinely owns still pass: `npm publish`,
26
+ * `npm view`, `npm pkg set`, `npm --version`. That is not a courtesy — OIDC
27
+ * trusted publishing needs the npm CLI, and this package's own release workflow
28
+ * runs all four. `npx --no` is allowed for the same reason the shipped
29
+ * commit-msg hook uses it: it resolves the LOCAL binary and refuses to fetch.
30
+ *
31
+ * Markdown is deliberately out of scope. Documentation quotes a third party's
32
+ * install line as a citation, and a stale README is a review problem rather
33
+ * than a build-breaking one, so only files that actually execute are scanned.
34
+ *
35
+ * See: .agents/skills/vwala-conventions/references/prefer-pnpm.md
36
+ */
37
+ import { execFileSync } from "node:child_process";
38
+ import { readFileSync } from "node:fs";
39
+
40
+ const IGNORED_PREFIXES = [".agents/", ".claude/", "node_modules/"];
41
+ const COMPETING_LOCKFILE =
42
+ /(^|\/)(package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/;
43
+ // Files that run a command. `.husky/_/` is husky's generated internals, which
44
+ // are gitignored and so never reach this list anyway.
45
+ const EXECUTABLE_FILE =
46
+ /(^\.husky\/[^_/][^/]*$|\.(sh|bash|zsh)$|^\.github\/workflows\/[^/]+\.ya?ml$|(^|\/)action\.ya?ml$|(^|\/)Dockerfile[^/]*$|\.dockerfile$)/;
47
+ const COMMENT_LINE = /^\s*(#|\/\/)/;
48
+ // Mirrors the regex in use-pnpm-scripts.grit. JavaScript has lookahead, so the
49
+ // `npx --no` exception is a negative lookahead here rather than the expanded
50
+ // alternation Rust's regex forces on the plugin.
51
+ const NPM_VERBS =
52
+ "install|i|ci|add|run|run-script|exec|x|test|start|update|uninstall|remove|rm|link|rebuild|prune|dedupe|init|create";
53
+ const FORBIDDEN_INVOCATION = new RegExp(
54
+ String.raw`(?:^|[;&|(]|\bRUN\s+|\brun:\s*)\s*` +
55
+ String.raw`(?:npm[ \t]+(?:${NPM_VERBS})\b|yarn(?=[ \t]|$)|npx(?![ \t]+--no)(?=[ \t]|$))`,
56
+ );
57
+
58
+ const files = git(["ls-files"]).filter(
59
+ (file) => !IGNORED_PREFIXES.some((prefix) => file.startsWith(prefix)),
60
+ );
61
+ const packageManager = readRootPackageManager();
62
+ const lockfileTracked = files.includes("pnpm-lock.yaml");
63
+
64
+ if (!isPnpmRepository()) {
65
+ console.log(
66
+ " ✔ pnpm checks skipped — this repository declares another package manager",
67
+ );
68
+ process.exit(0);
69
+ }
70
+
71
+ const violations = [];
72
+
73
+ for (const file of files.filter((file) => COMPETING_LOCKFILE.test(file))) {
74
+ violations.push(
75
+ `${file}\n Competing lockfile beside pnpm-lock.yaml. Delete it and run \`pnpm install\`.`,
76
+ );
77
+ }
78
+
79
+ if (!lockfileTracked) {
80
+ violations.push(
81
+ "pnpm-lock.yaml\n Not committed. Run `pnpm install` and commit the lockfile.",
82
+ );
83
+ }
84
+
85
+ if (!packageManager?.startsWith("pnpm@")) {
86
+ violations.push(
87
+ 'package.json\n Missing `"packageManager": "pnpm@<version>"`. Pin the package manager so every environment installs with the same one.',
88
+ );
89
+ }
90
+
91
+ const executables = files.filter((file) => EXECUTABLE_FILE.test(file));
92
+ if (executables.length > 0) {
93
+ // `git grep` exits 1 when nothing matches, which is the clean case here — so
94
+ // read stdout off the thrown error rather than letting it propagate. The
95
+ // grep is deliberately coarse, because POSIX ERE has no lookahead; the real
96
+ // policy is applied per line below, so it has one source of truth.
97
+ let matches = "";
98
+ try {
99
+ matches = execFileSync(
100
+ "git",
101
+ ["grep", "-nE", "npm|npx|yarn", "--", ...executables],
102
+ { encoding: "utf8", maxBuffer: 1024 * 1024 * 64 },
103
+ );
104
+ } catch (error) {
105
+ if (error.status !== 1) {
106
+ throw error;
107
+ }
108
+ matches = error.stdout ?? "";
109
+ }
110
+
111
+ for (const match of matches.trim().split("\n").filter(Boolean)) {
112
+ // `git grep -n` prints `file:line:content`. The content has to be split
113
+ // off before matching, or the `^` anchor anchors to the filename.
114
+ const parsed = /^([^:]+):(\d+):(.*)$/.exec(match);
115
+ if (!parsed) {
116
+ continue;
117
+ }
118
+ const content = parsed[3];
119
+ if (COMMENT_LINE.test(content) || !FORBIDDEN_INVOCATION.test(content)) {
120
+ continue;
121
+ }
122
+ violations.push(
123
+ `${match}\n Use pnpm — \`pnpm install\`, \`pnpm add\`, \`pnpm run\`, \`pnpm dlx\`. (\`npx --no -- <bin>\` is the exception: local binary, never fetched.)`,
124
+ );
125
+ }
126
+ }
127
+
128
+ if (violations.length > 0) {
129
+ console.error(`\n ✖ ${violations.length} pnpm violation(s):\n`);
130
+ for (const violation of violations) {
131
+ console.error(` ${violation}\n`);
132
+ }
133
+ process.exit(1);
134
+ }
135
+
136
+ console.log(" ✔ pnpm conventions clean");
137
+
138
+ function isPnpmRepository() {
139
+ if (packageManager?.startsWith("pnpm@")) {
140
+ return true;
141
+ }
142
+ if (packageManager) {
143
+ return false;
144
+ }
145
+ return lockfileTracked;
146
+ }
147
+
148
+ /**
149
+ * Reads `packageManager` from the repository root only. Workspace packages must
150
+ * not declare it, so a nested one is neither read nor required.
151
+ */
152
+ function readRootPackageManager() {
153
+ try {
154
+ return JSON.parse(readFileSync("package.json", "utf8")).packageManager;
155
+ } catch {
156
+ return undefined;
157
+ }
158
+ }
159
+
160
+ function git(args) {
161
+ return execFileSync("git", args, {
162
+ encoding: "utf8",
163
+ maxBuffer: 1024 * 1024 * 64,
164
+ })
165
+ .split("\n")
166
+ .filter(Boolean);
167
+ }
@@ -0,0 +1,109 @@
1
+ // Prefer path aliases (@/, ~/, #) over deep relative imports. Imports that
2
+ // traverse two or more parent directories (../../) should use the project's
3
+ // configured alias instead.
4
+ //
5
+ // A single (../) traversal is allowed — it reaches a sibling folder, which is
6
+ // the shape of a test file importing its own folder's test-support, and where
7
+ // an alias adds little clarity. The governing convention asks for an alias on
8
+ // *any* `../` segment; this rule stops one short of that on purpose, so the
9
+ // common sibling import stays quiet.
10
+ //
11
+ // Configure aliases via one of:
12
+ // - Node.js subpath imports: `"imports": { "#src/*": "./src/*" }` in package.json
13
+ // - TypeScript paths: `"paths": { "@/*": ["./src/*"] }` in tsconfig.json
14
+ // and mirror the mapping in every resolver (bundler, test runner).
15
+ //
16
+ // Only static import/export-from declarations are checked. Dynamic import()
17
+ // expressions are skipped — they often compute the path and would produce
18
+ // false positives.
19
+ //
20
+ // GritQL's `$_` matches a single AST node, so `import $_ from $source`
21
+ // covers default, single-named, and single-type imports but NOT multi-
22
+ // specifier `import { A, B }`. Each arity needs its own branch. Regex
23
+ // matching does not work on `JsModuleSource` nodes, so the regex runs
24
+ // against the full statement text (`$node`), which requires `.*` anchors.
25
+ //
26
+ // Known gap: `export { default as X } from "..."` — the aliased-default
27
+ // re-export form does not match any branch. This is rare enough in practice
28
+ // that the gap is acceptable.
29
+ //
30
+ // Known gap: the regex runs against the whole statement and has no `(?s)`
31
+ // flag, so `.*` cannot cross a newline and a multi-line import is never
32
+ // matched — an import Biome's own formatter wrapped because it had several
33
+ // specifiers goes unreported. Closing it means adding `(?s)` to every branch,
34
+ // which also starts flagging deep imports in published `.mjs` scripts; those
35
+ // run under plain Node, which reads neither tsconfig `paths` nor a bundler
36
+ // alias, so they need a package.json `imports` (`#`) entry before the gap can
37
+ // be closed.
38
+ //
39
+ // See: .agents/skills/vwala-conventions/references/alias-imports.md
40
+ or {
41
+ `import $_ from $source` as $node where {
42
+ $node <: r".*\.\./\.\./.*",
43
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
44
+ },
45
+ `import { $a, $b } from $source` as $node where {
46
+ $node <: r".*\.\./\.\./.*",
47
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
48
+ },
49
+ `import { $a, $b, $c } from $source` as $node where {
50
+ $node <: r".*\.\./\.\./.*",
51
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
52
+ },
53
+ `import { $a, $b, $c, $d } from $source` as $node where {
54
+ $node <: r".*\.\./\.\./.*",
55
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
56
+ },
57
+ `import { $a, $b, $c, $d, $e } from $source` as $node where {
58
+ $node <: r".*\.\./\.\./.*",
59
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
60
+ },
61
+ `import type { $a, $b } from $source` as $node where {
62
+ $node <: r".*\.\./\.\./.*",
63
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
64
+ },
65
+ `import type { $a, $b, $c } from $source` as $node where {
66
+ $node <: r".*\.\./\.\./.*",
67
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
68
+ },
69
+ `import type { $a, $b, $c, $d } from $source` as $node where {
70
+ $node <: r".*\.\./\.\./.*",
71
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
72
+ },
73
+ `import type { $a, $b, $c, $d, $e } from $source` as $node where {
74
+ $node <: r".*\.\./\.\./.*",
75
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
76
+ },
77
+ `import * as $_ from $source` as $node where {
78
+ $node <: r".*\.\./\.\./.*",
79
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
80
+ },
81
+ `export { $a } from $source` as $node where {
82
+ $node <: r".*\.\./\.\./.*",
83
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
84
+ },
85
+ `export { $a, $b } from $source` as $node where {
86
+ $node <: r".*\.\./\.\./.*",
87
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
88
+ },
89
+ `export { $a, $b, $c } from $source` as $node where {
90
+ $node <: r".*\.\./\.\./.*",
91
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
92
+ },
93
+ `export type { $a } from $source` as $node where {
94
+ $node <: r".*\.\./\.\./.*",
95
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
96
+ },
97
+ `export type { $a, $b } from $source` as $node where {
98
+ $node <: r".*\.\./\.\./.*",
99
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
100
+ },
101
+ `export type { $a, $b, $c } from $source` as $node where {
102
+ $node <: r".*\.\./\.\./.*",
103
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
104
+ },
105
+ `export * from $source` as $node where {
106
+ $node <: r".*\.\./\.\./.*",
107
+ register_diagnostic(span=$source, message="Use a path alias instead of a deep relative import. Configure aliases via tsconfig `paths` or the package.json `imports` field.", severity="warn")
108
+ }
109
+ }
@@ -0,0 +1,60 @@
1
+ // Every package-manager invocation in a package.json script goes through pnpm:
2
+ // `pnpm install`, `pnpm add`, `pnpm run`, `pnpm dlx`. npm and yarn in a pnpm
3
+ // repository write a second lockfile and resolve a different dependency tree
4
+ // from the one CI installs, so the script that passes locally is not the script
5
+ // that runs in CI.
6
+ //
7
+ // `language json` is what makes this possible at all — GritQL only learned to
8
+ // parse JSON in Biome 2.4, which is why the four sibling plugins are all
9
+ // JavaScript. Those four declare no language and so default to JavaScript,
10
+ // which is also why none of them fire on the fixtures here.
11
+ //
12
+ // `within` walks the ancestors, so the enclosing `"scripts"` key scopes the
13
+ // rule: a `"description"` mentioning npm, an `npm-run-all` devDependency, and
14
+ // an `npm:` alias in `dependencies` are all invisible to it. The query root is
15
+ // re-executed per node with a fresh scope, so N offending scripts produce N
16
+ // diagnostics without `bubble`.
17
+ //
18
+ // The regex full-matches the node text INCLUDING its surrounding quotes — the
19
+ // same semantics use-given-when-then-test-names.grit relies on — which is what
20
+ // makes the leading `\"` usable as "start of the command". The other command
21
+ // position is after a shell separator, hence `.*[;&|(]`. Every group has to be
22
+ // non-capturing: Biome binds regex captures as pattern variables, so a plain
23
+ // `(` fails the plugin with `regex pattern matched N variables, but expected
24
+ // 0`. There is no `(?s)` either, unlike the JavaScript plugins, because a JSON
25
+ // string never holds a raw newline.
26
+ //
27
+ // npm is gated on its install and run verbs rather than on the bare word, so
28
+ // the registry operations npm genuinely owns still pass — `npm publish`,
29
+ // `npm view`, `npm pkg set`, `npm --version`. That is not a courtesy: OIDC
30
+ // trusted publishing needs the npm CLI, and this package's own release workflow
31
+ // runs all four. yarn is flagged unconditionally, matched as `yarn[ \t\";&|]`
32
+ // so the `yarn-deduplicate` binary is left alone. `npx` is flagged unless it is
33
+ // `npx --no`, which resolves the LOCAL binary and refuses to fetch — the same
34
+ // property that satisfies zizmor's adhoc-packages rule in
35
+ // src/commitlint/action.yml. Rust's regex has no lookaround, so that one
36
+ // exception is spelled out by expanding the alternatives that may follow
37
+ // `npx `.
38
+ //
39
+ // biome.json scopes this to `["**/package.json"]`, which matches the root file
40
+ // and every nested one. The glob is not redundant with `language json`: without
41
+ // it the plugin would also lint tsconfig.json, app.json, and the fixture
42
+ // workspace's own biome.json.
43
+ //
44
+ // Known gaps: commands the `scripts` object cannot see — a `lint-staged` array
45
+ // elsewhere in package.json, turbo.json, CI workflows, git hooks, Dockerfiles —
46
+ // plus the lockfile and `packageManager` halves of the convention. Those live
47
+ // in `_scripts/check-pnpm.mjs`. A plugin also cannot see the convention's own
48
+ // escape hatch, so a repository that deliberately uses another package manager
49
+ // has to drop this entry from its own `plugins` array.
50
+ //
51
+ // See: .agents/skills/vwala-conventions/references/prefer-pnpm.md
52
+ language json
53
+
54
+ JsonMember(value=$command) as $node where {
55
+ $node <: within JsonMember(name=$section) where {
56
+ $section <: r"\"scripts\""
57
+ } ,
58
+ $command <: r"(?:\"|.*[;&|(])[ \t]*(?:npm[ \t]+(?:install|i|ci|add|run|run-script|exec|x|test|start|update|uninstall|remove|rm|link|rebuild|prune|dedupe|init|create)\b|yarn[ \t\";&|]|npx[ \t]+(?:--no[a-zA-Z0-9]|--n[^o]|--[^n]|-[^-]|[^-\t ])).*",
59
+ register_diagnostic(span=$command, message="Run this through pnpm — `pnpm install`, `pnpm add`, `pnpm run`, `pnpm dlx`. npm and yarn in a pnpm repo write a second lockfile and resolve a different tree than CI installs. `npx --no -- <bin>` is the one exception: it runs the locally installed binary and refuses to fetch.", severity="error")
60
+ }
@@ -4,4 +4,4 @@ if [ -n "${2:-}" ]; then
4
4
  exit 0
5
5
  fi
6
6
 
7
- exec < /dev/tty && npx cz --hook || true
7
+ exec < /dev/tty && npx --no -- cz --hook || true
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Every package under `packages/modules/` owns a bounded area of the business,
4
+ * so every one of them declares its domain language in `CONTEXT.md`.
5
+ *
6
+ * Without it each module invents its own words for the same thing — one calls
7
+ * it an order, the next a purchase, the third a transaction — and the cost only
8
+ * shows up later, when the three have to talk to each other and nobody can say
9
+ * whether they mean the same thing. `packages/platform/` and `packages/tooling/`
10
+ * are excluded on purpose: they hold code with no domain knowledge, so they
11
+ * have no domain language to declare.
12
+ *
13
+ * Existence and non-emptiness are all that is checked. The convention asks for
14
+ * a glossary written as terms crystallise, and a checker that demanded headings
15
+ * and a minimum term count would only teach people to satisfy it with a heading
16
+ * and a fake term.
17
+ *
18
+ * Biome cannot express this. A missing file has no syntax to parse.
19
+ *
20
+ * See: .agents/skills/vwala-conventions/references/domain-language-in-context-md.md
21
+ * See: .agents/skills/vwala-conventions/references/monorepo-structure.md
22
+ */
23
+ import {
24
+ readBlob,
25
+ readIndexEntries,
26
+ SYMLINK_MODE,
27
+ } from "../../_scripts/git-index.mjs";
28
+
29
+ const MODULES_ROOT = "packages/modules/";
30
+ const MANIFEST = "package.json";
31
+ const CONTEXT_FILE = "CONTEXT.md";
32
+
33
+ /**
34
+ * Folders a workspace package never has as an ancestor. A `package.json` below
35
+ * one of these belongs to a fixture, a build output, or a vendored dependency
36
+ * rather than to a module.
37
+ */
38
+ const NOT_A_PACKAGE_ROOT = new Set([
39
+ "node_modules",
40
+ "src",
41
+ "dist",
42
+ "build",
43
+ "__tests__",
44
+ "test-support",
45
+ "fixtures",
46
+ ]);
47
+
48
+ const entries = readIndexEntries();
49
+ const byPath = new Map(entries.map((entry) => [entry.path, entry]));
50
+
51
+ /**
52
+ * A module is a package, so its `package.json` is what marks it — a directory
53
+ * with no tracked files does not exist to git, and one without a manifest is a
54
+ * folder rather than a workspace package.
55
+ *
56
+ * Depth is not fixed. Modules nest (`packages/modules/act/enrich/`) and may be
57
+ * scoped (`packages/modules/@acme/invoicing/`), so every manifest under
58
+ * `packages/modules/` counts — including one at a grouping level that also has
59
+ * modules beneath it, because a directory carrying a manifest is a package and
60
+ * a package here is a module. Excluding by ancestor folder rather than by depth
61
+ * is what keeps a fixture's manifest from registering as a module of its own.
62
+ */
63
+ const modules = entries
64
+ .filter(
65
+ (entry) =>
66
+ entry.path.startsWith(MODULES_ROOT) &&
67
+ entry.path.endsWith(`/${MANIFEST}`) &&
68
+ !entry.path
69
+ .slice(MODULES_ROOT.length, -`/${MANIFEST}`.length)
70
+ .split("/")
71
+ .some((segment) => NOT_A_PACKAGE_ROOT.has(segment)),
72
+ )
73
+ .map((entry) => entry.path.slice(0, -MANIFEST.length))
74
+ .sort();
75
+
76
+ const violations = [];
77
+
78
+ for (const module of modules) {
79
+ const contextPath = `${module}${CONTEXT_FILE}`;
80
+ const context = byPath.get(contextPath);
81
+
82
+ if (context === undefined) {
83
+ // macOS filesystems are case-insensitive, so a `Context.md` looks present
84
+ // in an editor while git tracks the name that was actually committed.
85
+ // Saying which is which beats "missing" on a file the author can see.
86
+ const miscased = entries.find(
87
+ (entry) =>
88
+ entry.path.toLowerCase() === contextPath.toLowerCase() &&
89
+ entry.path !== contextPath,
90
+ );
91
+
92
+ violations.push(
93
+ miscased === undefined
94
+ ? `${contextPath}\n Missing. Every module under ${MODULES_ROOT} declares its domain language in ${CONTEXT_FILE}.`
95
+ : `${miscased.path}\n Wrong case. Rename it to ${CONTEXT_FILE}.`,
96
+ );
97
+ continue;
98
+ }
99
+
100
+ if (context.mode === SYMLINK_MODE) {
101
+ violations.push(
102
+ `${contextPath}\n Symlink. A module's domain language is its own; it cannot be borrowed from another module.`,
103
+ );
104
+ continue;
105
+ }
106
+
107
+ if (readBlob({ sha: context.sha }).trim() === "") {
108
+ violations.push(
109
+ `${contextPath}\n Empty. Write the module's terms, or the file is a placeholder that says nothing.`,
110
+ );
111
+ }
112
+ }
113
+
114
+ if (violations.length > 0) {
115
+ console.error(`\n ✖ ${violations.length} module-context violation(s):\n`);
116
+ for (const violation of violations) {
117
+ console.error(` ${violation}\n`);
118
+ }
119
+ process.exit(1);
120
+ }
121
+
122
+ console.log(" ✔ module context clean");