@rdjperron/lint 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # @rdjperron/lint
2
2
 
3
3
  One Oxlint JS plugin, `rdjperron`, with twenty rules against low-evidence code, the config data a
4
- project spreads into its own `vite.config.ts`, and the check that proves every rule still fires.
4
+ project spreads into its own `vite.config.ts`, the check that proves every rule still fires, and
5
+ the repository checks that hold a repo's documents to their own conventions.
5
6
 
6
7
  | Entry | What it gives you |
7
8
  | ------------------------ | ---------------------------------------------------------------------------------- |
8
9
  | `@rdjperron/lint` | The plugin. One `jsPlugins` entry, one prefix, twenty rules. |
9
10
  | `@rdjperron/lint/config` | `recommended`, the override builders, and the `fmt`, `ignore` and `staged` blocks. |
11
+ | `@rdjperron/lint/repo` | `checkRepo`, five checks on a repo's links, decision register and research names. |
10
12
  | `rdjperron-lint-verify` | The command that proves every rule still fires. No config, no arguments. |
11
13
 
12
14
  Seventeen of the rules are a copy of [dmmulroy/anti-slop](https://github.com/dmmulroy/anti-slop),
@@ -184,6 +186,147 @@ one right after you move `vite-plus`, and in CI.
184
186
  One thing not to do: do not delete the fixtures. They are the only thing that catches a rule going
185
187
  dead.
186
188
 
189
+ ## Repository checks
190
+
191
+ `@rdjperron/lint/repo` is for a repo that keeps a decision register in `docs/decisions.md` and
192
+ dated research in `_research/`. Prose can state those conventions and cannot enforce them. `checkRepo`
193
+ reads the tree and returns what breaks them, so a test fails on a dead link or on a citation of a
194
+ retired decision.
195
+
196
+ It is plain Node and imports no test runner. You call it from a test of your own:
197
+
198
+ ```ts
199
+ // lib/repo.test.ts
200
+ import { fileURLToPath } from "node:url";
201
+
202
+ import { CHECKS, checkRepo, HINTS, TITLES } from "@rdjperron/lint/repo";
203
+ import { describe, expect, it } from "vitest";
204
+
205
+ const faults = checkRepo({
206
+ root: fileURLToPath(new URL("..", import.meta.url)),
207
+ codeRoots: ["app", "components", "lib", "convex", "e2e"],
208
+ linked: ["e2e/README.md"],
209
+ });
210
+
211
+ describe("the tree", () => {
212
+ for (const check of CHECKS) {
213
+ it(TITLES[check], () => {
214
+ expect(faults[check], HINTS[check]).toEqual([]);
215
+ });
216
+ }
217
+ });
218
+ ```
219
+
220
+ Loop over `CHECKS` rather than listing the checks by hand. A check added in a later version then
221
+ runs in your repo the day you move the pin, and nobody has to remember to assert it.
222
+
223
+ `checkRepo` returns one array of faults per check, empty where the check holds. A fault is one
224
+ line that opens with a path relative to the root, with the line number when the fault has one:
225
+
226
+ ```
227
+ README.md:63 points at docs/not-there.md, which is not there
228
+ src/main.tsx:43 cites D16, which is retired
229
+ _research/notes.md is not named YYYYMMDD.HHMM.topic.md or YYYYMMDD.topic/
230
+ src, named by `codeRoots`, is not there
231
+ ```
232
+
233
+ `TITLES` holds what each check promises, for the test's name. `HINTS` holds one sentence per check
234
+ saying how to fix it, which the example passes to `expect` as the failure message. `CHECKS` is the
235
+ five names: `scans`, `links`, `register`, `citations`, `research`.
236
+
237
+ `checkRepo` does not throw on a tree or a config it cannot read. A code root that is a file, a
238
+ register that is a directory, a symbolic link that leads nowhere and a root that does not exist
239
+ are each a fault in `scans`, and a link whose percent-escapes do not decode is a fault in `links`.
240
+
241
+ ### What each check holds
242
+
243
+ | Check | What it holds |
244
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
245
+ | `links` | Every relative Markdown link in the living documents and in each research folder's `README.md` points at a path that exists. A URL with a scheme, a `//host` and a bare `#anchor` are skipped, and an anchor after a path is dropped before the path is tested. |
246
+ | `register` | Every row is one line, `- **Dn** Sentence. (YYYY-MM-DD)` or `- **Dn** Sentence. (YYYY-MM-DD, source)`. Each number is given once and is not also in the retired list. No number is missing up to the highest ever given. No other line names a number in bold. A `## Retired` section exists, and it may name no number yet. |
247
+ | `citations` | Every `D<n>` in the scanned files, and in the register's own rows after their number, is a live row. A retired number fails as retired and a number never given fails as unknown. |
248
+ | `research` | Each entry of `_research/` is a file `YYYYMMDD.HHMM.topic.md` or a folder `YYYYMMDD.topic/` that holds a `README.md`. The topic is lowercase letters, digits and hyphens. |
249
+ | `scans` | Every path the config names is there and is the right kind, a file or a directory, defaults included. Every code root yields a file to scan. The register has a row. No symbolic link a walk meets leads nowhere. |
250
+
251
+ `scans` exists because a check that reads nothing passes. Rename `lib/` to `src/` without touching
252
+ the config and the citation scan would cover one directory fewer and stay green. With `scans` the
253
+ missing root is a fault.
254
+
255
+ `scans` holds paths and files, not matches. A repo with no research directory, an empty one, no
256
+ relative link or no citation yet is clean, so a repository can turn the test on from its first
257
+ commit. The one path that may be absent is the research directory.
258
+
259
+ The living documents are `README.md`, `AGENTS.md` and `BACKLOG.md` at the root, every `.md` file
260
+ under `docs/`, and the documents `linked` names. Their links are held and they are scanned for
261
+ citations, the register excepted. The citation scan also reads every file under a code root with a
262
+ scanned extension, and every file at the root with one. A lockfile is never scanned, meaning a
263
+ name that ends in `-lock.json`, `-lock.yaml` or the like.
264
+
265
+ The research is frozen once written, so the checks read little of it. The body of a research
266
+ entry is checked for neither links nor citations, since it names paths and numbers as they stood on
267
+ its date. Only a research folder's `README.md` has its links held, and nothing under the research
268
+ directory is scanned for citations, even if you name it as a code root or keep it under `docs/`.
269
+ The retired numbers are every `D<n>` in the `## Retired` section, up to the next `##` heading. The
270
+ prose around the register's rows may name any number.
271
+
272
+ When the register cannot be read, `scans` says so once, and `register` and `citations` stay empty
273
+ rather than failing every citation in the repo.
274
+
275
+ ### The config
276
+
277
+ Every path is relative to the root, and `lib`, `./lib` and `lib/` name the same one.
278
+
279
+ | Field | Default | What it is |
280
+ | ------------ | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
281
+ | `root` | required | The repository root. A relative one is resolved against the working directory. |
282
+ | `codeRoots` | required | The directories scanned for citations. `["."]` scans the whole root. |
283
+ | `extensions` | `ts` `tsx` `mts` `cts` `js` `jsx` `mjs` `cjs` `md` `json` `jsonc` `yml` `yaml` `html` | The extensions scanned for citations. Yours replace the default list. |
284
+ | `skip` | `node_modules` `_generated` `dist` | Names no walk enters, wherever they sit. Yours are added to the default list. |
285
+ | `leftOut` | none | Paths no walk enters, as `{ path: reason }`. The reason is for the reader. |
286
+ | `documents` | `README.md` `AGENTS.md` `BACKLOG.md` | The living documents at the root. Yours replace the default list, so a repo with no backlog names the two it has. |
287
+ | `docs` | `docs` | The directory whose every `.md` file is a living document. |
288
+ | `linked` | none | More living documents, such as `e2e/README.md`. |
289
+ | `register` | `decisions.md` in the `docs` directory | The decision register. It follows `docs`: with `docs: "handbook"` it is `handbook/decisions.md`. |
290
+ | `research` | `_research` | The research directory. It may be absent. |
291
+
292
+ `skip` matches a name at any depth, so `skip: ["fixtures"]` leaves out every `fixtures` directory.
293
+ `leftOut` matches one path, for a directory whose name is legitimate elsewhere:
294
+
295
+ ```ts
296
+ leftOut: { "site/.well-known": "certificate fingerprints read like decision numbers" },
297
+ ```
298
+
299
+ Both act on what a walk finds under `docs`, under a code root and at the root. Neither removes a
300
+ document you name in `documents` or `linked`. To stop holding one of those, take it off its list.
301
+
302
+ A citation is any `D` followed by digits and standing as a word of its own, so recorded data full
303
+ of ids such as `D12` is the usual reason to leave a path out. Leave it out with `skip` or
304
+ `leftOut`, or keep its extension off the list, as with `csv`.
305
+
306
+ `DEFAULT_DOCUMENTS`, `DEFAULT_EXTENSIONS` and `DEFAULT_SKIP` are exported, for a config that adds
307
+ to a list the field replaces.
308
+
309
+ ### What the checks do not do
310
+
311
+ They hold form, not truth. A link that resolves may point at the wrong document. A row may be well
312
+ formed and state a rule the code broke last week. A citation of a live number may cite the wrong
313
+ rule. A research entry with a correct name may be empty.
314
+
315
+ They also leave these alone:
316
+
317
+ - An anchor is not checked against the headings of its target.
318
+ - A link written as bare text, as `<path>`, inside an HTML tag, with a title in single quotes or
319
+ with parentheses in its path is not read as a link, or is read wrong.
320
+ - A link that opens with `/` is tested against the filesystem root, not the repository's.
321
+ - The date in a row or in a research name is not checked to be a real date.
322
+ - `**D11.**` and `**D12a**` are neither a row nor row-like, so the register check does not see them.
323
+ - `#D12` and `-D16` count as citations, since the `D` still opens a word.
324
+ - Any file directly under the research directory that is not a dated note is a fault, a
325
+ `README.md` or a `.DS_Store` included.
326
+ - A linked directory is not entered, since it may lead back to one of its own parents.
327
+
328
+ Reading the rows against the code is still a review's job.
329
+
187
330
  ## The rules
188
331
 
189
332
  Each rule file opens with the reason the rule exists and the case where it is legitimate to
@@ -248,6 +391,12 @@ Land a new rule at `warn`, fix or scope what fires, then promote it. When a rule
248
391
  code or add a narrowly scoped override with the measurement that justifies it. Never weaken the
249
392
  rule, add a cast, or rename a symbol to dodge the check.
250
393
 
394
+ ## Moving from 0.5
395
+
396
+ Nothing is removed and nothing changes. 0.6.0 adds `@rdjperron/lint/repo`. A repo that carries the
397
+ checks as a test file of its own replaces that file with the example under "Repository checks",
398
+ and keeps only its config.
399
+
251
400
  ## Moving from 0.4
252
401
 
253
402
  Nothing is removed. One builder changed what it does, and three are new.
@@ -0,0 +1,71 @@
1
+ //#region src/repo.d.ts
2
+ /**
3
+ * The promises a repository's prose can only state, held as faults instead.
4
+ *
5
+ * - a relative Markdown link points at something that is there;
6
+ * - the decision register is one well-formed line per row, each number given once;
7
+ * - a decision number cited anywhere is a live row in the register, never a retired one;
8
+ * - a research entry is named by its date, and a dated folder opens with a README;
9
+ * - every path the config names is there and holds something to check.
10
+ *
11
+ * Every path in a fault is relative to the root, so it reads as the path you would type to open
12
+ * the offender. Nothing here imports a test runner: the consumer's test asserts on what
13
+ * `checkRepo` returns. It never throws on a tree or a config it cannot read: that is a fault too.
14
+ */
15
+ export interface RepoConfig {
16
+ /** The repository root, absolute. */
17
+ root: string;
18
+ /**
19
+ * The directories scanned for decision numbers. Every path in this config is relative to the
20
+ * root, and `lib`, `./lib` and `lib/` name the same one.
21
+ */
22
+ codeRoots: readonly string[];
23
+ /**
24
+ * The extensions scanned for decision numbers, in the code roots and at the root itself.
25
+ * Replaces `DEFAULT_EXTENSIONS`.
26
+ */
27
+ extensions?: readonly string[];
28
+ /** Directory and file names no walk enters, wherever they sit. Added to `DEFAULT_SKIP`. */
29
+ skip?: readonly string[];
30
+ /** Paths no walk enters, each with the reason it is left out. */
31
+ leftOut?: {
32
+ readonly [path: string]: string;
33
+ };
34
+ /** The living documents at the root. Replaces `DEFAULT_DOCUMENTS`. */
35
+ documents?: readonly string[];
36
+ /** The directory whose every Markdown file is a living document. `docs` by default. */
37
+ docs?: string;
38
+ /** More documents held as the living ones are, for their links and their citations. */
39
+ linked?: readonly string[];
40
+ /** The decision register. `decisions.md` in the `docs` directory by default. */
41
+ register?: string;
42
+ /** The research directory. `_research` by default, and a repo may have none yet. */
43
+ research?: string;
44
+ }
45
+ export declare const CHECKS: readonly ["scans", "links", "register", "citations", "research"];
46
+ export type Check = (typeof CHECKS)[number];
47
+ /** The faults of each check, empty where the check holds. */
48
+ export type RepoFaults = { readonly [check in Check]: readonly string[]; };
49
+ /** What each check promises, for the title of the consumer's test. */
50
+ export declare const TITLES: {
51
+ scans: string;
52
+ links: string;
53
+ register: string;
54
+ citations: string;
55
+ research: string;
56
+ };
57
+ /** What to do about a failing check, for the message of the consumer's assertion. */
58
+ export declare const HINTS: {
59
+ scans: string;
60
+ links: string;
61
+ register: string;
62
+ citations: string;
63
+ research: string;
64
+ };
65
+ export declare const DEFAULT_DOCUMENTS: readonly string[];
66
+ export declare const DEFAULT_EXTENSIONS: readonly string[];
67
+ /** Vendored, generated and built trees. */
68
+ export declare const DEFAULT_SKIP: readonly string[];
69
+ export declare function checkRepo(config: RepoConfig): RepoFaults;
70
+ //#endregion
71
+ //# sourceMappingURL=repo.d.mts.map
package/dist/repo.mjs ADDED
@@ -0,0 +1,357 @@
1
+ import { lstatSync, readFileSync, readdirSync, statSync } from "node:fs";
2
+ import { dirname, join, posix, relative, resolve } from "node:path";
3
+ //#region src/repo.ts
4
+ /**
5
+ * The promises a repository's prose can only state, held as faults instead.
6
+ *
7
+ * - a relative Markdown link points at something that is there;
8
+ * - the decision register is one well-formed line per row, each number given once;
9
+ * - a decision number cited anywhere is a live row in the register, never a retired one;
10
+ * - a research entry is named by its date, and a dated folder opens with a README;
11
+ * - every path the config names is there and holds something to check.
12
+ *
13
+ * Every path in a fault is relative to the root, so it reads as the path you would type to open
14
+ * the offender. Nothing here imports a test runner: the consumer's test asserts on what
15
+ * `checkRepo` returns. It never throws on a tree or a config it cannot read: that is a fault too.
16
+ */
17
+ const CHECKS = [
18
+ "scans",
19
+ "links",
20
+ "register",
21
+ "citations",
22
+ "research"
23
+ ];
24
+ /** What each check promises, for the title of the consumer's test. */
25
+ const TITLES = {
26
+ scans: "every path the config names is there and holds something to check",
27
+ links: "every relative Markdown link resolves",
28
+ register: "the register is one well-formed line per row, each number given once",
29
+ citations: "every decision number cited anywhere is a live row in the register",
30
+ research: "every research entry is named by its date, and every dated folder has a README"
31
+ };
32
+ /** What to do about a failing check, for the message of the consumer's assertion. */
33
+ const HINTS = {
34
+ scans: "A check that reads nothing passes on nothing. Correct the path in the config, or remove it with the thing it named.",
35
+ links: "Fix the path, or delete the link with the thing it pointed at.",
36
+ register: "A row is one line, its number given once and never after it was retired, and a number that leaves the rows joins the retired list. Rewrite a rule in place under its own number.",
37
+ citations: "A citation of a retired number, or of one never given, sends the reader nowhere. Cite the row that carries the rule now. `git log -S \"D<n>\"` on the register shows what a retired row said.",
38
+ research: "The research sorts by name, so the name carries the date. Date an entry by the day it was opened, and give a folder a README that says what is in it."
39
+ };
40
+ const DEFAULT_DOCUMENTS = [
41
+ "README.md",
42
+ "AGENTS.md",
43
+ "BACKLOG.md"
44
+ ];
45
+ const DEFAULT_EXTENSIONS = [
46
+ "ts",
47
+ "tsx",
48
+ "mts",
49
+ "cts",
50
+ "js",
51
+ "jsx",
52
+ "mjs",
53
+ "cjs",
54
+ "md",
55
+ "json",
56
+ "jsonc",
57
+ "yml",
58
+ "yaml",
59
+ "html"
60
+ ];
61
+ /** Vendored, generated and built trees. */
62
+ const DEFAULT_SKIP = [
63
+ "node_modules",
64
+ "_generated",
65
+ "dist"
66
+ ];
67
+ function kindOf(tree, path) {
68
+ try {
69
+ return statSync(join(tree.root, path)).isDirectory() ? "directory" : "file";
70
+ } catch {
71
+ return "absent";
72
+ }
73
+ }
74
+ function isSymbolicLink(tree, path) {
75
+ try {
76
+ return lstatSync(join(tree.root, path)).isSymbolicLink();
77
+ } catch {
78
+ return false;
79
+ }
80
+ }
81
+ function read(tree, path) {
82
+ return readFileSync(join(tree.root, path), "utf8").replaceAll("\r\n", "\n");
83
+ }
84
+ function names(tree, path) {
85
+ try {
86
+ return readdirSync(join(tree.root, path)).toSorted();
87
+ } catch {
88
+ return [];
89
+ }
90
+ }
91
+ function child(base, name) {
92
+ return base === "" ? name : `${base}/${name}`;
93
+ }
94
+ function walk(tree, base) {
95
+ return names(tree, base).flatMap((name) => {
96
+ const path = child(base, name);
97
+ if (tree.skip.has(name) || tree.leftOut.has(path)) return [];
98
+ const kind = kindOf(tree, path);
99
+ if (kind === "file") return [path];
100
+ if (kind === "absent") tree.broken.add(path);
101
+ return kind === "directory" && !isSymbolicLink(tree, path) ? walk(tree, path) : [];
102
+ });
103
+ }
104
+ /** `lib`, `./lib` and `lib/` are one path, and the root itself is the empty one. */
105
+ function normal(path) {
106
+ const clean = posix.normalize(path).replace(/\/+$/, "");
107
+ return clean === "." ? "" : clean;
108
+ }
109
+ function hasExtension(name, extensions) {
110
+ return extensions.some((extension) => name.endsWith(`.${extension}`));
111
+ }
112
+ function lineOf(source, index) {
113
+ return source.slice(0, index).split("\n").length;
114
+ }
115
+ /** A single note, `YYYYMMDD.HHMM.topic.md`. */
116
+ const DATED_NOTE = /^\d{8}\.\d{4}\.[a-z0-9-]+\.md$/;
117
+ /** Research of several files, `YYYYMMDD.topic/`. */
118
+ const DATED_FOLDER = /^\d{8}\.[a-z0-9-]+$/;
119
+ function researchFaults(tree, entries) {
120
+ return entries.flatMap((entry) => {
121
+ if (!(entry.folder ? DATED_FOLDER : DATED_NOTE).test(entry.name)) return [`${entry.path} is not named YYYYMMDD.HHMM.topic.md or YYYYMMDD.topic/`];
122
+ return entry.folder && kindOf(tree, `${entry.path}/README.md`) !== "file" ? [`${entry.path}/ has no README.md`] : [];
123
+ });
124
+ }
125
+ /** `](target)`, with an optional title. Bare `path.md` inside backticks is not a link. */
126
+ const LINK = /\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g;
127
+ /** A scheme, a protocol-relative host or a bare anchor: the target is outside the tree. */
128
+ const OUTSIDE = /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;
129
+ function decoded(target) {
130
+ try {
131
+ return decodeURI(target.split("#")[0] ?? "");
132
+ } catch {
133
+ return;
134
+ }
135
+ }
136
+ function linksIn(tree, file) {
137
+ const source = read(tree, file);
138
+ return [...source.matchAll(LINK)].flatMap((match) => {
139
+ const target = match[1] ?? "";
140
+ const path = decoded(target);
141
+ if (OUTSIDE.test(target) || path === "") return [];
142
+ const points = path === void 0 ? void 0 : relative(tree.root, resolve(tree.root, dirname(file), path));
143
+ return [{
144
+ from: file,
145
+ target,
146
+ line: lineOf(source, match.index),
147
+ points
148
+ }];
149
+ });
150
+ }
151
+ function linkFaults(tree, links) {
152
+ return links.flatMap((link) => {
153
+ const at = `${link.from}:${link.line} points at ${link.target}`;
154
+ if (link.points === void 0) return [`${at}, whose percent-escapes do not decode`];
155
+ return kindOf(tree, link.points) === "absent" ? [`${at}, which is not there`] : [];
156
+ });
157
+ }
158
+ /** A line that opens as a row does: a list item whose first word is a bold decision number. */
159
+ const ROW_START = /^- \*\*D(\d+)\*\*/gm;
160
+ /** A whole row: the number, one sentence or more, then the date and an optional source. */
161
+ const ROW = /^- \*\*D\d+\*\* \S.*[.?!] \(\d{4}-\d{2}-\d{2}(?:, \S.*)?\)$/;
162
+ /** A line that names a number in bold as a row does, whatever it opens with. */
163
+ const ROW_LIKE = /\*\*D\d+\*\*/;
164
+ const RETIRED_SECTION = /^## Retired[ \t]*$([\s\S]*?)(?=^## |(?![\s\S]))/m;
165
+ /** A mistyped number in the retired list would otherwise print a gap per number below it. */
166
+ const GAPS_SHOWN = 20;
167
+ const CITATION = /\bD(\d+)\b/g;
168
+ function numbersIn(text) {
169
+ return [...text.matchAll(CITATION)].map((match) => Number(match[1]));
170
+ }
171
+ function readRegister(tree, path) {
172
+ const text = kindOf(tree, path) === "file" ? read(tree, path) : "";
173
+ const rows = [...text.matchAll(ROW_START)].map((match) => ({
174
+ number: Number(match[1]),
175
+ line: lineOf(text, match.index),
176
+ text: text.slice(match.index).split("\n", 1)[0] ?? ""
177
+ }));
178
+ const section = RETIRED_SECTION.exec(text);
179
+ return {
180
+ path,
181
+ text,
182
+ rows,
183
+ live: new Set(rows.map((row) => row.number)),
184
+ retired: new Set(numbersIn(section?.[1] ?? "")),
185
+ hasRetiredSection: section !== null
186
+ };
187
+ }
188
+ function rowFaults(register) {
189
+ const seen = /* @__PURE__ */ new Set();
190
+ return register.rows.flatMap((row) => {
191
+ const at = `${register.path}:${row.line} D${row.number}`;
192
+ const found = [
193
+ ...ROW.test(row.text) ? [] : [`${at} is not "- **Dn** Sentence. (date, source)"`],
194
+ ...seen.has(row.number) ? [`${at} is a second row`] : [],
195
+ ...register.retired.has(row.number) ? [`${at} is retired`] : []
196
+ ];
197
+ seen.add(row.number);
198
+ return found;
199
+ });
200
+ }
201
+ function gapFaults(register) {
202
+ const highest = Math.max(0, ...register.live, ...register.retired);
203
+ const gaps = [];
204
+ let more = 0;
205
+ for (let number = 1; number <= highest; number++) {
206
+ if (register.live.has(number) || register.retired.has(number)) continue;
207
+ if (gaps.length < GAPS_SHOWN) gaps.push(number);
208
+ else more++;
209
+ }
210
+ return [...gaps.map((number) => `${register.path} D${number} is neither a row nor retired`), ...more === 0 ? [] : [`${register.path} ${more} more numbers up to D${highest} are neither a row nor retired`]];
211
+ }
212
+ function registerFaults(register) {
213
+ const rowLike = register.text.split("\n").flatMap((text, index) => ROW_LIKE.test(text) && !text.startsWith("- **D") ? [`${register.path}:${index + 1} names a row but is not one: "${text.slice(0, 40)}"`] : []);
214
+ return [
215
+ ...rowFaults(register),
216
+ ...rowLike,
217
+ ...register.hasRetiredSection ? [] : [`${register.path} has no "## Retired" section`],
218
+ ...gapFaults(register)
219
+ ];
220
+ }
221
+ function citationsIn(tree, file) {
222
+ const source = read(tree, file);
223
+ return [...source.matchAll(CITATION)].map((match) => ({
224
+ where: `${file}:${lineOf(source, match.index)}`,
225
+ number: Number(match[1])
226
+ }));
227
+ }
228
+ /** A row may cite another row. The retired list and the prose around the rows are not held. */
229
+ function citationsInRows(register) {
230
+ return register.rows.flatMap((row) => numbersIn(row.text.slice(row.text.indexOf("**", 4) + 2)).map((number) => ({
231
+ where: `${register.path}:${row.line}`,
232
+ number
233
+ })));
234
+ }
235
+ function citationFaults(register, citations) {
236
+ return citations.flatMap(({ where, number }) => {
237
+ if (register.live.has(number)) return [];
238
+ return register.retired.has(number) ? [`${where} cites D${number}, which is retired`] : [`${where} cites D${number}, which the register has no row for`];
239
+ });
240
+ }
241
+ function isUnder(path, base) {
242
+ return base === "" || path === base || path.startsWith(`${base}/`);
243
+ }
244
+ /** `package-lock.json`, `pnpm-lock.yaml`: generated, and full of hashes that read like numbers. */
245
+ const LOCKFILE = /[-_.]lock\.(?:json|jsonc|ya?ml)$/;
246
+ function allNamed(by, paths, want) {
247
+ return paths.map((path) => ({
248
+ path: normal(path),
249
+ by,
250
+ want
251
+ }));
252
+ }
253
+ function namedOr(option, path, fallback, want) {
254
+ return path === void 0 ? {
255
+ path: fallback,
256
+ by: `the default of \`${option}\``,
257
+ want
258
+ } : {
259
+ path: normal(path),
260
+ by: `named by \`${option}\``,
261
+ want
262
+ };
263
+ }
264
+ function namedFault(tree, named) {
265
+ const kind = kindOf(tree, named.path);
266
+ if (kind === named.want) return [];
267
+ return [`${named.path === "" ? "." : named.path}, ${named.by}, is ${kind === "absent" ? "not there" : `not a ${named.want}`}`];
268
+ }
269
+ function usable(tree, named) {
270
+ return named.flatMap((one) => kindOf(tree, one.path) === one.want ? [one.path] : []);
271
+ }
272
+ const NO_FAULTS = {
273
+ scans: [],
274
+ links: [],
275
+ register: [],
276
+ citations: [],
277
+ research: []
278
+ };
279
+ function checkRepo(config) {
280
+ const leftOut = Object.keys(config.leftOut ?? {}).map(normal);
281
+ const tree = {
282
+ root: resolve(config.root),
283
+ skip: /* @__PURE__ */ new Set([...DEFAULT_SKIP, ...config.skip ?? []]),
284
+ leftOut: new Set(leftOut),
285
+ extensions: config.extensions ?? DEFAULT_EXTENSIONS,
286
+ broken: /* @__PURE__ */ new Set()
287
+ };
288
+ if (kindOf(tree, "") !== "directory") return {
289
+ ...NO_FAULTS,
290
+ scans: [`${tree.root}, named by \`root\`, is not a directory`]
291
+ };
292
+ const docs = namedOr("docs", config.docs, "docs", "directory");
293
+ const registerAt = namedOr("register", config.register, child(docs.path, "decisions.md"), "file");
294
+ const research = namedOr("research", config.research, "_research", "directory");
295
+ const codeRoots = allNamed("named by `codeRoots`", config.codeRoots, "directory");
296
+ const documents = config.documents === void 0 ? allNamed("a default of `documents`", DEFAULT_DOCUMENTS, "file") : allNamed("named by `documents`", config.documents, "file");
297
+ const linked = allNamed("named by `linked`", config.linked ?? [], "file");
298
+ const researchKind = kindOf(tree, research.path);
299
+ const entries = (researchKind === "directory" ? names(tree, research.path) : []).flatMap((name) => {
300
+ const path = child(research.path, name);
301
+ const kind = kindOf(tree, path);
302
+ if (kind === "absent") tree.broken.add(path);
303
+ return kind === "absent" ? [] : [{
304
+ path,
305
+ name,
306
+ folder: kind === "directory"
307
+ }];
308
+ });
309
+ const frozen = (file) => isUnder(file, research.path);
310
+ const living = [
311
+ ...usable(tree, documents),
312
+ ...walk(tree, docs.path).filter((file) => file.endsWith(".md") && !frozen(file)),
313
+ ...usable(tree, linked)
314
+ ];
315
+ const linking = /* @__PURE__ */ new Set([...living, ...entries.flatMap((entry) => {
316
+ const readme = `${entry.path}/README.md`;
317
+ return entry.folder && kindOf(tree, readme) === "file" ? [readme] : [];
318
+ })]);
319
+ const scanned = usable(tree, codeRoots).map((base) => ({
320
+ base,
321
+ files: walk(tree, base).filter((file) => hasExtension(file, tree.extensions))
322
+ }));
323
+ const atRoot = names(tree, "").filter((name) => hasExtension(name, tree.extensions) && !tree.skip.has(name) && !tree.leftOut.has(name) && kindOf(tree, name) === "file");
324
+ const citing = [.../* @__PURE__ */ new Set([
325
+ ...living,
326
+ ...scanned.flatMap((scan) => scan.files),
327
+ ...atRoot
328
+ ])].filter((file) => file !== registerAt.path && !frozen(file) && !LOCKFILE.test(file));
329
+ const held = kindOf(tree, registerAt.path) === "file";
330
+ const register = readRegister(tree, registerAt.path);
331
+ const wrongKind = researchKind === "file" ? namedFault(tree, research) : [];
332
+ const leftOutFaults = leftOut.flatMap((path) => kindOf(tree, path) === "absent" ? [`${path}, named by \`leftOut\`, is not there`] : []);
333
+ return {
334
+ scans: [
335
+ ...[
336
+ ...codeRoots,
337
+ ...documents,
338
+ docs,
339
+ registerAt,
340
+ ...linked
341
+ ].flatMap((one) => namedFault(tree, one)),
342
+ ...wrongKind,
343
+ ...leftOutFaults,
344
+ ...scanned.flatMap((scan) => scan.files.length === 0 ? [`${scan.base === "" ? "." : scan.base} holds no file to scan for decision numbers`] : []),
345
+ ...held && register.rows.length === 0 ? [`${registerAt.path} holds no row`] : [],
346
+ ...[...tree.broken].toSorted().map((path) => `${path} is a symbolic link that leads nowhere`)
347
+ ],
348
+ links: linkFaults(tree, [...linking].flatMap((file) => linksIn(tree, file))),
349
+ register: held ? registerFaults(register) : [],
350
+ citations: held ? citationFaults(register, [...citing.flatMap((file) => citationsIn(tree, file)), ...citationsInRows(register)]) : [],
351
+ research: researchFaults(tree, entries)
352
+ };
353
+ }
354
+ //#endregion
355
+ export { CHECKS, DEFAULT_DOCUMENTS, DEFAULT_EXTENSIONS, DEFAULT_SKIP, HINTS, TITLES, checkRepo };
356
+
357
+ //# sourceMappingURL=repo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.mjs","names":[],"sources":["../src/repo.ts"],"sourcesContent":["/**\n * The promises a repository's prose can only state, held as faults instead.\n *\n * - a relative Markdown link points at something that is there;\n * - the decision register is one well-formed line per row, each number given once;\n * - a decision number cited anywhere is a live row in the register, never a retired one;\n * - a research entry is named by its date, and a dated folder opens with a README;\n * - every path the config names is there and holds something to check.\n *\n * Every path in a fault is relative to the root, so it reads as the path you would type to open\n * the offender. Nothing here imports a test runner: the consumer's test asserts on what\n * `checkRepo` returns. It never throws on a tree or a config it cannot read: that is a fault too.\n */\n\nimport { lstatSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { dirname, join, posix, relative, resolve } from \"node:path\";\n\nexport interface RepoConfig {\n /** The repository root, absolute. */\n root: string;\n /**\n * The directories scanned for decision numbers. Every path in this config is relative to the\n * root, and `lib`, `./lib` and `lib/` name the same one.\n */\n codeRoots: readonly string[];\n /**\n * The extensions scanned for decision numbers, in the code roots and at the root itself.\n * Replaces `DEFAULT_EXTENSIONS`.\n */\n extensions?: readonly string[];\n /** Directory and file names no walk enters, wherever they sit. Added to `DEFAULT_SKIP`. */\n skip?: readonly string[];\n /** Paths no walk enters, each with the reason it is left out. */\n leftOut?: { readonly [path: string]: string };\n /** The living documents at the root. Replaces `DEFAULT_DOCUMENTS`. */\n documents?: readonly string[];\n /** The directory whose every Markdown file is a living document. `docs` by default. */\n docs?: string;\n /** More documents held as the living ones are, for their links and their citations. */\n linked?: readonly string[];\n /** The decision register. `decisions.md` in the `docs` directory by default. */\n register?: string;\n /** The research directory. `_research` by default, and a repo may have none yet. */\n research?: string;\n}\n\nexport const CHECKS = [\"scans\", \"links\", \"register\", \"citations\", \"research\"] as const;\n\nexport type Check = (typeof CHECKS)[number];\n\n/** The faults of each check, empty where the check holds. */\nexport type RepoFaults = { readonly [check in Check]: readonly string[] };\n\n/** What each check promises, for the title of the consumer's test. */\nexport const TITLES = {\n scans: \"every path the config names is there and holds something to check\",\n links: \"every relative Markdown link resolves\",\n register: \"the register is one well-formed line per row, each number given once\",\n citations: \"every decision number cited anywhere is a live row in the register\",\n research: \"every research entry is named by its date, and every dated folder has a README\",\n} satisfies { readonly [check in Check]: string };\n\n/** What to do about a failing check, for the message of the consumer's assertion. */\nexport const HINTS = {\n scans:\n \"A check that reads nothing passes on nothing. Correct the path in the config, or remove it \" +\n \"with the thing it named.\",\n links: \"Fix the path, or delete the link with the thing it pointed at.\",\n register:\n \"A row is one line, its number given once and never after it was retired, and a number that \" +\n \"leaves the rows joins the retired list. Rewrite a rule in place under its own number.\",\n citations:\n \"A citation of a retired number, or of one never given, sends the reader nowhere. Cite the \" +\n 'row that carries the rule now. `git log -S \"D<n>\"` on the register shows what a retired ' +\n \"row said.\",\n research:\n \"The research sorts by name, so the name carries the date. Date an entry by the day it was \" +\n \"opened, and give a folder a README that says what is in it.\",\n} satisfies { readonly [check in Check]: string };\n\nexport const DEFAULT_DOCUMENTS: readonly string[] = [\"README.md\", \"AGENTS.md\", \"BACKLOG.md\"];\n\nexport const DEFAULT_EXTENSIONS: readonly string[] = [\n \"ts\",\n \"tsx\",\n \"mts\",\n \"cts\",\n \"js\",\n \"jsx\",\n \"mjs\",\n \"cjs\",\n \"md\",\n \"json\",\n \"jsonc\",\n \"yml\",\n \"yaml\",\n \"html\",\n];\n\n/** Vendored, generated and built trees. */\nexport const DEFAULT_SKIP: readonly string[] = [\"node_modules\", \"_generated\", \"dist\"];\n\ninterface Tree {\n root: string;\n skip: ReadonlySet<string>;\n leftOut: ReadonlySet<string>;\n extensions: readonly string[];\n /** Symbolic links a walk met that lead nowhere. */\n broken: Set<string>;\n}\n\ntype Kind = \"file\" | \"directory\" | \"absent\";\n\nfunction kindOf(tree: Tree, path: string): Kind {\n try {\n return statSync(join(tree.root, path)).isDirectory() ? \"directory\" : \"file\";\n } catch {\n return \"absent\";\n }\n}\n\nfunction isSymbolicLink(tree: Tree, path: string): boolean {\n try {\n return lstatSync(join(tree.root, path)).isSymbolicLink();\n } catch {\n return false;\n }\n}\n\n// A Windows checkout may hand back CRLF, and every pattern here ends its line on `\\n`.\nfunction read(tree: Tree, path: string): string {\n return readFileSync(join(tree.root, path), \"utf8\").replaceAll(\"\\r\\n\", \"\\n\");\n}\n\nfunction names(tree: Tree, path: string): string[] {\n try {\n return readdirSync(join(tree.root, path)).toSorted();\n } catch {\n return [];\n }\n}\n\nfunction child(base: string, name: string): string {\n return base === \"\" ? name : `${base}/${name}`;\n}\n\n// A linked directory is not entered: it may lead back to one of its own parents.\nfunction walk(tree: Tree, base: string): string[] {\n return names(tree, base).flatMap((name) => {\n const path = child(base, name);\n if (tree.skip.has(name) || tree.leftOut.has(path)) return [];\n const kind = kindOf(tree, path);\n if (kind === \"file\") return [path];\n if (kind === \"absent\") tree.broken.add(path);\n return kind === \"directory\" && !isSymbolicLink(tree, path) ? walk(tree, path) : [];\n });\n}\n\n/** `lib`, `./lib` and `lib/` are one path, and the root itself is the empty one. */\nfunction normal(path: string): string {\n const clean = posix.normalize(path).replace(/\\/+$/, \"\");\n return clean === \".\" ? \"\" : clean;\n}\n\nfunction hasExtension(name: string, extensions: readonly string[]): boolean {\n return extensions.some((extension) => name.endsWith(`.${extension}`));\n}\n\nfunction lineOf(source: string, index: number): number {\n return source.slice(0, index).split(\"\\n\").length;\n}\n\n/** A single note, `YYYYMMDD.HHMM.topic.md`. */\nconst DATED_NOTE = /^\\d{8}\\.\\d{4}\\.[a-z0-9-]+\\.md$/;\n\n/** Research of several files, `YYYYMMDD.topic/`. */\nconst DATED_FOLDER = /^\\d{8}\\.[a-z0-9-]+$/;\n\ninterface Entry {\n path: string;\n name: string;\n folder: boolean;\n}\n\nfunction researchFaults(tree: Tree, entries: readonly Entry[]): string[] {\n return entries.flatMap((entry) => {\n if (!(entry.folder ? DATED_FOLDER : DATED_NOTE).test(entry.name)) {\n return [`${entry.path} is not named YYYYMMDD.HHMM.topic.md or YYYYMMDD.topic/`];\n }\n return entry.folder && kindOf(tree, `${entry.path}/README.md`) !== \"file\"\n ? [`${entry.path}/ has no README.md`]\n : [];\n });\n}\n\n/** `](target)`, with an optional title. Bare `path.md` inside backticks is not a link. */\nconst LINK = /\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)/g;\n\n/** A scheme, a protocol-relative host or a bare anchor: the target is outside the tree. */\nconst OUTSIDE = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/i;\n\ninterface Link {\n from: string;\n target: string;\n line: number;\n /** Where the target leads, relative to the root. Absent when its escapes do not decode. */\n points: string | undefined;\n}\n\nfunction decoded(target: string): string | undefined {\n try {\n return decodeURI(target.split(\"#\")[0] ?? \"\");\n } catch {\n return undefined;\n }\n}\n\nfunction linksIn(tree: Tree, file: string): Link[] {\n const source = read(tree, file);\n return [...source.matchAll(LINK)].flatMap((match) => {\n const target = match[1] ?? \"\";\n const path = decoded(target);\n if (OUTSIDE.test(target) || path === \"\") return [];\n const points =\n path === undefined ? undefined : relative(tree.root, resolve(tree.root, dirname(file), path));\n return [{ from: file, target, line: lineOf(source, match.index), points }];\n });\n}\n\nfunction linkFaults(tree: Tree, links: readonly Link[]): string[] {\n return links.flatMap((link) => {\n const at = `${link.from}:${link.line} points at ${link.target}`;\n if (link.points === undefined) return [`${at}, whose percent-escapes do not decode`];\n return kindOf(tree, link.points) === \"absent\" ? [`${at}, which is not there`] : [];\n });\n}\n\n/** A line that opens as a row does: a list item whose first word is a bold decision number. */\nconst ROW_START = /^- \\*\\*D(\\d+)\\*\\*/gm;\n\n/** A whole row: the number, one sentence or more, then the date and an optional source. */\nconst ROW = /^- \\*\\*D\\d+\\*\\* \\S.*[.?!] \\(\\d{4}-\\d{2}-\\d{2}(?:, \\S.*)?\\)$/;\n\n/** A line that names a number in bold as a row does, whatever it opens with. */\nconst ROW_LIKE = /\\*\\*D\\d+\\*\\*/;\n\nconst RETIRED_SECTION = /^## Retired[ \\t]*$([\\s\\S]*?)(?=^## |(?![\\s\\S]))/m;\n\n/** A mistyped number in the retired list would otherwise print a gap per number below it. */\nconst GAPS_SHOWN = 20;\n\nconst CITATION = /\\bD(\\d+)\\b/g;\n\ninterface Row {\n number: number;\n line: number;\n text: string;\n}\n\ninterface Register {\n path: string;\n text: string;\n rows: readonly Row[];\n live: ReadonlySet<number>;\n /** Every number the `## Retired` section names, however its lines wrap. */\n retired: ReadonlySet<number>;\n hasRetiredSection: boolean;\n}\n\nfunction numbersIn(text: string): number[] {\n return [...text.matchAll(CITATION)].map((match) => Number(match[1]));\n}\n\nfunction readRegister(tree: Tree, path: string): Register {\n const text = kindOf(tree, path) === \"file\" ? read(tree, path) : \"\";\n const rows = [...text.matchAll(ROW_START)].map((match) => ({\n number: Number(match[1]),\n line: lineOf(text, match.index),\n text: text.slice(match.index).split(\"\\n\", 1)[0] ?? \"\",\n }));\n const section = RETIRED_SECTION.exec(text);\n return {\n path,\n text,\n rows,\n live: new Set(rows.map((row) => row.number)),\n retired: new Set(numbersIn(section?.[1] ?? \"\")),\n hasRetiredSection: section !== null,\n };\n}\n\nfunction rowFaults(register: Register): string[] {\n const seen = new Set<number>();\n return register.rows.flatMap((row) => {\n const at = `${register.path}:${row.line} D${row.number}`;\n const found = [\n ...(ROW.test(row.text) ? [] : [`${at} is not \"- **Dn** Sentence. (date, source)\"`]),\n ...(seen.has(row.number) ? [`${at} is a second row`] : []),\n ...(register.retired.has(row.number) ? [`${at} is retired`] : []),\n ];\n seen.add(row.number);\n return found;\n });\n}\n\nfunction gapFaults(register: Register): string[] {\n const highest = Math.max(0, ...register.live, ...register.retired);\n const gaps: number[] = [];\n let more = 0;\n for (let number = 1; number <= highest; number++) {\n if (register.live.has(number) || register.retired.has(number)) continue;\n if (gaps.length < GAPS_SHOWN) gaps.push(number);\n else more++;\n }\n return [\n ...gaps.map((number) => `${register.path} D${number} is neither a row nor retired`),\n ...(more === 0\n ? []\n : [`${register.path} ${more} more numbers up to D${highest} are neither a row nor retired`]),\n ];\n}\n\nfunction registerFaults(register: Register): string[] {\n const rowLike = register.text\n .split(\"\\n\")\n .flatMap((text, index) =>\n ROW_LIKE.test(text) && !text.startsWith(\"- **D\")\n ? [`${register.path}:${index + 1} names a row but is not one: \"${text.slice(0, 40)}\"`]\n : [],\n );\n return [\n ...rowFaults(register),\n ...rowLike,\n ...(register.hasRetiredSection ? [] : [`${register.path} has no \"## Retired\" section`]),\n ...gapFaults(register),\n ];\n}\n\ninterface Citation {\n where: string;\n number: number;\n}\n\nfunction citationsIn(tree: Tree, file: string): Citation[] {\n const source = read(tree, file);\n return [...source.matchAll(CITATION)].map((match) => ({\n where: `${file}:${lineOf(source, match.index)}`,\n number: Number(match[1]),\n }));\n}\n\n/** A row may cite another row. The retired list and the prose around the rows are not held. */\nfunction citationsInRows(register: Register): Citation[] {\n return register.rows.flatMap((row) =>\n numbersIn(row.text.slice(row.text.indexOf(\"**\", 4) + 2)).map((number) => ({\n where: `${register.path}:${row.line}`,\n number,\n })),\n );\n}\n\nfunction citationFaults(register: Register, citations: readonly Citation[]): string[] {\n return citations.flatMap(({ where, number }) => {\n if (register.live.has(number)) return [];\n return register.retired.has(number)\n ? [`${where} cites D${number}, which is retired`]\n : [`${where} cites D${number}, which the register has no row for`];\n });\n}\n\nfunction isUnder(path: string, base: string): boolean {\n return base === \"\" || path === base || path.startsWith(`${base}/`);\n}\n\n/** `package-lock.json`, `pnpm-lock.yaml`: generated, and full of hashes that read like numbers. */\nconst LOCKFILE = /[-_.]lock\\.(?:json|jsonc|ya?ml)$/;\n\ninterface Named {\n path: string;\n /** How the path came to be named, for the fault. */\n by: string;\n want: Kind;\n}\n\nfunction allNamed(by: string, paths: readonly string[], want: Kind): Named[] {\n return paths.map((path) => ({ path: normal(path), by, want }));\n}\n\nfunction namedOr(option: string, path: string | undefined, fallback: string, want: Kind): Named {\n return path === undefined\n ? { path: fallback, by: `the default of \\`${option}\\``, want }\n : { path: normal(path), by: `named by \\`${option}\\``, want };\n}\n\nfunction namedFault(tree: Tree, named: Named): string[] {\n const kind = kindOf(tree, named.path);\n if (kind === named.want) return [];\n const shown = named.path === \"\" ? \".\" : named.path;\n return [`${shown}, ${named.by}, is ${kind === \"absent\" ? \"not there\" : `not a ${named.want}`}`];\n}\n\nfunction usable(tree: Tree, named: readonly Named[]): string[] {\n return named.flatMap((one) => (kindOf(tree, one.path) === one.want ? [one.path] : []));\n}\n\nconst NO_FAULTS: RepoFaults = { scans: [], links: [], register: [], citations: [], research: [] };\n\nexport function checkRepo(config: RepoConfig): RepoFaults {\n const leftOut = Object.keys(config.leftOut ?? {}).map(normal);\n const tree: Tree = {\n root: resolve(config.root),\n skip: new Set([...DEFAULT_SKIP, ...(config.skip ?? [])]),\n leftOut: new Set(leftOut),\n extensions: config.extensions ?? DEFAULT_EXTENSIONS,\n broken: new Set(),\n };\n if (kindOf(tree, \"\") !== \"directory\") {\n return { ...NO_FAULTS, scans: [`${tree.root}, named by \\`root\\`, is not a directory`] };\n }\n\n const docs = namedOr(\"docs\", config.docs, \"docs\", \"directory\");\n const registerAt = namedOr(\"register\", config.register, child(docs.path, \"decisions.md\"), \"file\");\n const research = namedOr(\"research\", config.research, \"_research\", \"directory\");\n const codeRoots = allNamed(\"named by `codeRoots`\", config.codeRoots, \"directory\");\n const documents =\n config.documents === undefined\n ? allNamed(\"a default of `documents`\", DEFAULT_DOCUMENTS, \"file\")\n : allNamed(\"named by `documents`\", config.documents, \"file\");\n const linked = allNamed(\"named by `linked`\", config.linked ?? [], \"file\");\n\n // A repo has no research until its first, so an absent directory is not a fault.\n const researchKind = kindOf(tree, research.path);\n const entries = (researchKind === \"directory\" ? names(tree, research.path) : []).flatMap(\n (name) => {\n const path = child(research.path, name);\n const kind = kindOf(tree, path);\n if (kind === \"absent\") tree.broken.add(path);\n return kind === \"absent\" ? [] : [{ path, name, folder: kind === \"directory\" }];\n },\n );\n\n // Inside the research only a folder's README is held: an entry is frozen once it is on the\n // main branch, so its body names paths and numbers as they stood, and some have moved since.\n const frozen = (file: string): boolean => isUnder(file, research.path);\n\n const living = [\n ...usable(tree, documents),\n ...walk(tree, docs.path).filter((file) => file.endsWith(\".md\") && !frozen(file)),\n ...usable(tree, linked),\n ];\n const linking = new Set([\n ...living,\n ...entries.flatMap((entry) => {\n const readme = `${entry.path}/README.md`;\n return entry.folder && kindOf(tree, readme) === \"file\" ? [readme] : [];\n }),\n ]);\n\n const scanned = usable(tree, codeRoots).map((base) => ({\n base,\n files: walk(tree, base).filter((file) => hasExtension(file, tree.extensions)),\n }));\n const atRoot = names(tree, \"\").filter(\n (name) =>\n hasExtension(name, tree.extensions) &&\n !tree.skip.has(name) &&\n !tree.leftOut.has(name) &&\n kindOf(tree, name) === \"file\",\n );\n const citing = [\n ...new Set([...living, ...scanned.flatMap((scan) => scan.files), ...atRoot]),\n ].filter((file) => file !== registerAt.path && !frozen(file) && !LOCKFILE.test(file));\n\n // With no register to read, every citation would fail: `scans` says so once instead.\n const held = kindOf(tree, registerAt.path) === \"file\";\n const register = readRegister(tree, registerAt.path);\n const wrongKind = researchKind === \"file\" ? namedFault(tree, research) : [];\n const leftOutFaults = leftOut.flatMap((path) =>\n kindOf(tree, path) === \"absent\" ? [`${path}, named by \\`leftOut\\`, is not there`] : [],\n );\n\n return {\n scans: [\n ...[...codeRoots, ...documents, docs, registerAt, ...linked].flatMap((one) =>\n namedFault(tree, one),\n ),\n ...wrongKind,\n ...leftOutFaults,\n ...scanned.flatMap((scan) =>\n scan.files.length === 0\n ? [`${scan.base === \"\" ? \".\" : scan.base} holds no file to scan for decision numbers`]\n : [],\n ),\n ...(held && register.rows.length === 0 ? [`${registerAt.path} holds no row`] : []),\n ...[...tree.broken].toSorted().map((path) => `${path} is a symbolic link that leads nowhere`),\n ],\n links: linkFaults(\n tree,\n [...linking].flatMap((file) => linksIn(tree, file)),\n ),\n register: held ? registerFaults(register) : [],\n citations: held\n ? citationFaults(register, [\n ...citing.flatMap((file) => citationsIn(tree, file)),\n ...citationsInRows(register),\n ])\n : [],\n research: researchFaults(tree, entries),\n };\n}\n"],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ClB,CAAC,GAAG,KAAK,SAAS,KAAK,MAAM,KAAK,KAAK,4CAA4C,IACnF,CAAC,CACP;GACA,GAAI,QAAQ,SAAS,KAAK,WAAW,IAAI,CAAC,GAAG,WAAW,KAAK,cAAc,IAAI,CAAC;GAChF,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,SAAS,GAAG,KAAK,uCAAuC;EAC9F;EACA,OAAO,WACL,MACA,CAAC,GAAG,OAAO,CAAC,CAAC,SAAS,SAAS,QAAQ,MAAM,IAAI,CAAC,CACpD;EACA,UAAU,OAAO,eAAe,QAAQ,IAAI,CAAC;EAC7C,WAAW,OACP,eAAe,UAAU,CACvB,GAAG,OAAO,SAAS,SAAS,YAAY,MAAM,IAAI,CAAC,GACnD,GAAG,gBAAgB,QAAQ,CAC7B,CAAC,IACD,CAAC;EACL,UAAU,eAAe,MAAM,OAAO;CACxC;AACF"}
package/dist/verify.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { s as plugin, t as RULE_IDS } from "./config-CD2iCM6L.mjs";
3
3
  import { createRequire } from "node:module";
4
- import { spawnSync } from "node:child_process";
5
4
  import { cpSync, existsSync, mkdtempSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
6
- import { tmpdir } from "node:os";
7
5
  import { join, resolve } from "node:path";
6
+ import { spawnSync } from "node:child_process";
7
+ import { tmpdir } from "node:os";
8
8
  import { fileURLToPath } from "node:url";
9
9
  //#region src/verify.ts
10
10
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rdjperron/lint",
3
- "version": "0.5.0",
4
- "description": "One Oxlint JS plugin, `rdjperron`: 20 rules against low-evidence code, with the config data, the fixture that proves each rule fires, and the command that checks it.",
3
+ "version": "0.6.0",
4
+ "description": "One Oxlint JS plugin, `rdjperron`: 20 rules against low-evidence code, with the config data, the fixture that proves each rule fires, the command that checks it, and the repository checks that hold a repo's links, decision register and research names.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -26,6 +26,10 @@
26
26
  "types": "./dist/config.d.mts",
27
27
  "default": "./dist/config.mjs"
28
28
  },
29
+ "./repo": {
30
+ "types": "./dist/repo.d.mts",
31
+ "default": "./dist/repo.mjs"
32
+ },
29
33
  "./package.json": "./package.json"
30
34
  },
31
35
  "dependencies": {