@mark1russell7/conventions 0.6.0 → 0.7.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
@@ -37,7 +37,7 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
37
37
  | `typed-scripts` | Git keeps no JavaScript source (`.js`, `.mjs`, `.cjs`, `.jsx`, or a file with a `#!` line of `node`) and no shell script (`.sh`, `.bash`, `.zsh`, `.ps1`, or a `#!` line of a shell) of more than one line of code. Each script is TypeScript, which Node 22.18 and later starts directly. A file that must stay (generated output, vendored code, a configuration that a tool reads only as JavaScript) goes in `ignore` with its reason, so the list of exceptions can only get shorter. | fleet `typed-everything` (STRATEGY.md, direction 15). |
38
38
  | `typed-files` | Each TypeScript file that git keeps (`.ts`, `.tsx`, `.mts`, `.cts`, not `.d.ts`) is in the program of a tsconfig that a `typecheck` script names: the tests, the e2e specs, the scripts, the benches and the configs too. The rule reads the configs of each `tsc`, `tsgo` or `vue-tsc` (`-p`, `--project`, `-b`, or `tsconfig.json`) and of `svelte-check --tsconfig`, follows their `references`, and lists the files with `tsc --listFilesOnly`. A file that a covered file imports is covered. A config that does not exist, and a repository where no typecheck names a config, are a break. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
39
39
  | `tests-required` | No test runner passes when it finds no test: no `passWithNoTests: true` in a config of vitest, vite, jest or Playwright, and no `--passWithNoTests` in `package.json`. With the option, a broken include pattern turns the test gate green with no test run. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
40
- | `roadmap-parses` | Each roadmap that a workflow gives to the Status page (a `roadmap:` key) parses as `@mark1russell7/site-pages` reads it. The rule uses the parser of site-pages. Thus a pull request finds a bad row, and the Pages job on `main` does not stop on it. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
40
+ | `roadmap-parses` | Each call of the Pages workflow of the template (`reusable-pages.yml`) gives a `roadmap`, or `site-pages: false`. Without it, the Status page shows no item of the plan. Each roadmap that a workflow gives to the Status page (a `roadmap:` key) parses as `@mark1russell7/site-pages` reads it. The rule uses the parser of site-pages. Thus a pull request finds a bad row, and the Pages job on `main` does not stop on it. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
41
41
 
42
42
  The rule `release-files` needs the base of the change. On a pull request, the checkout is a merge commit, and the rule reads its two parents (`fetch-depth` 2 or more). In other runs, give `--base <ref>`. Without a base, the rule shows `skip`.
43
43
 
package/build/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as runCli } from "./run-BYTCunT5.js";
2
+ import { c as runCli } from "./run-MyvUGD5l.js";
3
3
  // src/cli.ts
4
4
  try {
5
5
  process.exitCode = runCli(process.argv.slice(2), {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;;KAIC;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;EAC1C,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBA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AA+B,iBAAgB;;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBAwBG,OAAO,yBAAyB,IAAI;;;;;;wBCxNpC,aAAa,eAAe;;;;;wBA+C5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;;KAIC;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;EAC1C,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBAMxC,WAAY,gBAAgB;;qBAG5B,YAAa;;wBAGV,WAAW,cAAc;;;;;;wBASzB,WAAW;;wBA2BX,UAAU;;wBAUV,OAAO,cAAc;;qBAOxB,UAAW,aAAa;;;;;wBAMrB,aAAa,SAAS,K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FAULT_ALLOWED, F as DEPENDENCY_FIELDS, A as HOME_PATTERNS, u as RULES, N as STRICT_OPTIONS, t as USAGE, n as annotations, I as cleanPath, L as codePackages, p as configsOfScript, r as createContext, P as cuePreset, Z as defaultOptions, i as formatResult, q as globFolders, J as globToRegExp, R as hasFile, g as hasTests, z as inFolder, E as isGitSpecifier, D as isPinned, y as isSourcePath, B as keyLine, V as lineOf, a as listRules, H as matchesAny, M as noBuildOutput, j as noLocalPaths, Y as packageFolders, Q as parseConfig, U as parseJsonc, b as pathsOf, O as pinnedGitDeps, o as readConfig, W as readJsonc, T as releaseFiles, w as requiredScripts, S as roadmapOfLine, C as roadmapParses, s as runChecks, c as runCli, G as runGit, m as scriptsOf, x as sourceMain, K as specifiersOf, l as summaryMarkdown, v as testsRequired, _ as tsconfigTest, h as typedFiles, f as typedScripts, X as workspaceGlobs, d as workspaceProtocol } from "./run-BYTCunT5.js";
1
+ export { k as DEFAULT_ALLOWED, F as DEPENDENCY_FIELDS, A as HOME_PATTERNS, u as RULES, N as STRICT_OPTIONS, t as USAGE, n as annotations, I as cleanPath, L as codePackages, p as configsOfScript, r as createContext, P as cuePreset, Z as defaultOptions, i as formatResult, q as globFolders, J as globToRegExp, R as hasFile, g as hasTests, z as inFolder, E as isGitSpecifier, D as isPinned, y as isSourcePath, B as keyLine, V as lineOf, a as listRules, H as matchesAny, M as noBuildOutput, j as noLocalPaths, Y as packageFolders, Q as parseConfig, U as parseJsonc, b as pathsOf, O as pinnedGitDeps, o as readConfig, W as readJsonc, T as releaseFiles, w as requiredScripts, S as roadmapOfLine, C as roadmapParses, s as runChecks, c as runCli, G as runGit, m as scriptsOf, x as sourceMain, K as specifiersOf, l as summaryMarkdown, v as testsRequired, _ as tsconfigTest, h as typedFiles, f as typedScripts, X as workspaceGlobs, d as workspaceProtocol } from "./run-MyvUGD5l.js";
@@ -1612,6 +1612,46 @@ if (board) {
1612
1612
  */
1613
1613
  /** A workflow file. */
1614
1614
  const WORKFLOW = /^\.github\/workflows\/[^/]+\.ya?ml$/;
1615
+ /** This function tells if a line calls the Pages workflow of the template (`uses: ...reusable-pages.yml`). */
1616
+ function callsPages(line) {
1617
+ let text = line.trimStart();
1618
+ if (text.startsWith("- ")) text = text.slice(2).trimStart();
1619
+ if (!text.startsWith("uses:")) return false;
1620
+ const value = text.slice(5).trim();
1621
+ return /(?:^|\/)reusable-pages\.ya?ml(?:@|$|\s)/.test(value);
1622
+ }
1623
+ const indentOf = (line) => line.length - line.trimStart().length;
1624
+ /** This function tells if a line is `site-pages: false`: the site has no Status page. */
1625
+ function noStatusPage(line) {
1626
+ const text = line.trimStart();
1627
+ if (!text.startsWith("site-pages:")) return false;
1628
+ let value = text.slice(11);
1629
+ const comment = value.indexOf(" #");
1630
+ if (comment >= 0) value = value.slice(0, comment);
1631
+ return [
1632
+ "false",
1633
+ "\"false\"",
1634
+ "'false'"
1635
+ ].includes(value.trim());
1636
+ }
1637
+ /**
1638
+ * This function gives the line numbers of each call of the Pages workflow that gives no `roadmap` key. The key is in the
1639
+ * job of the call: the lines around it with the same indent or more. A job with `site-pages: false` has no Status page.
1640
+ */
1641
+ function callsWithoutRoadmap(lines) {
1642
+ const found = [];
1643
+ lines.forEach((line, index) => {
1644
+ if (!callsPages(line)) return;
1645
+ const indent = indentOf(line);
1646
+ const inJob = (text) => text.trim() === "" || indentOf(text) >= indent;
1647
+ let first = index;
1648
+ while (first > 0 && inJob(lines[first - 1] ?? "")) first -= 1;
1649
+ let last = index;
1650
+ while (last < lines.length - 1 && inJob(lines[last + 1] ?? "")) last += 1;
1651
+ if (!lines.slice(first, last + 1).some((text) => text.trimStart().startsWith("roadmap:") || noStatusPage(text))) found.push(index + 1);
1652
+ });
1653
+ return found;
1654
+ }
1615
1655
  /** This function gives the value of a `roadmap: <file>` line, or undefined for another line, an empty value or an expression. */
1616
1656
  function roadmapOfLine(line) {
1617
1657
  const text = line.trimStart();
@@ -1627,9 +1667,9 @@ function roadmapOfLine(line) {
1627
1667
  }
1628
1668
  const roadmapParses = {
1629
1669
  id: "roadmap-parses",
1630
- title: "Each roadmap that a workflow gives to the Status page (the input `roadmap`) parses as site-pages reads it.",
1631
- reason: "Only the Pages job on main reads the roadmap. A pull request with a bad table row passes each check, and then the build of the site stops and the site stays stale. On 2026-10-30, one repository had 3 red Pages runs in a row because of one row with 2 cells under a header with 4.",
1632
- fix: "Correct the row or the heading that the message names. Each table row has one cell for each column of its header, and the file has a table with an ID column and a Status column, or a heading \"### `id`: Title\".",
1670
+ title: "Each call of the Pages workflow gives a roadmap, and each roadmap that a workflow gives to the Status page (the input `roadmap`) parses as site-pages reads it.",
1671
+ reason: "Only the Pages job on main reads the roadmap. A pull request with a bad table row passes each check, and then the build of the site stops and the site stays stale. On 2026-10-30, one repository had 3 red Pages runs in a row because of one row with 2 cells under a header with 4. A site with no roadmap is the same fault with no error: its Status page shows no item of the plan, and each check is green. On 2026-10-30, 2 repositories had a site with no roadmap.",
1672
+ fix: "Give the roadmap file to the Pages workflow (`roadmap: docs/ROADMAP.md`). Correct the row or the heading that the message names. Each table row has one cell for each column of its header, and the file has a table with an ID column and a Status column, or a heading \"### `id`: Title\".",
1633
1673
  sources: [{
1634
1674
  repo: "fleet",
1635
1675
  rule: "fail-closed",
@@ -1644,21 +1684,29 @@ const roadmapParses = {
1644
1684
  const files = context.gitFiles();
1645
1685
  if (files === void 0) return { skipped: "the root is not in a git repository" };
1646
1686
  const named = [];
1647
- for (const file of files.filter((path) => WORKFLOW.test(path)).sort(byCode)) readFileSync(join(context.root, file), "utf8").split(/\r?\n/).forEach((line, index) => {
1648
- const roadmap = roadmapOfLine(line);
1649
- if (roadmap !== void 0) named.push({
1650
- roadmap,
1687
+ const breaks = [];
1688
+ for (const file of files.filter((path) => WORKFLOW.test(path)).sort(byCode)) {
1689
+ const lines = readFileSync(join(context.root, file), "utf8").split(/\r?\n/);
1690
+ lines.forEach((line, index) => {
1691
+ const roadmap = roadmapOfLine(line);
1692
+ if (roadmap !== void 0) named.push({
1693
+ roadmap,
1694
+ file,
1695
+ line: index + 1
1696
+ });
1697
+ });
1698
+ for (const line of callsWithoutRoadmap(lines)) breaks.push({
1651
1699
  file,
1652
- line: index + 1
1700
+ line,
1701
+ message: `${file} builds the site with the Pages workflow and gives no roadmap, so the Status page shows no roadmap item.`
1653
1702
  });
1654
- });
1703
+ }
1655
1704
  for (const roadmap of options["roadmaps"]) named.push({
1656
1705
  roadmap: cleanPath(roadmap),
1657
1706
  file: "the option roadmaps",
1658
1707
  line: 0
1659
1708
  });
1660
- if (named.length === 0) return { skipped: "no workflow names a roadmap (the input roadmap of the Pages workflow)" };
1661
- const breaks = [];
1709
+ if (named.length === 0 && breaks.length === 0) return { skipped: "no workflow builds a site with the Pages workflow, and no workflow names a roadmap" };
1662
1710
  const seen = /* @__PURE__ */ new Set();
1663
1711
  for (const { roadmap, file, line } of named) {
1664
1712
  if (seen.has(roadmap)) continue;
@@ -2641,4 +2689,4 @@ function runCli(args, io) {
2641
2689
  }
2642
2690
  export { HOME_PATTERNS as A, keyLine as B, roadmapParses as C, isPinned as D, isGitSpecifier as E, DEPENDENCY_FIELDS as F, runGit as G, matchesAny as H, cleanPath as I, globToRegExp as J, specifiersOf as K, codePackages as L, noBuildOutput as M, STRICT_OPTIONS as N, pinnedGitDeps as O, cuePreset as P, parseConfig as Q, hasFile as R, roadmapOfLine as S, releaseFiles as T, parseJsonc as U, lineOf as V, readJsonc as W, workspaceGlobs as X, packageFolders as Y, defaultOptions as Z, tsconfigTest as _, listRules as a, pathsOf as b, runCli as c, workspaceProtocol as d, typedScripts as f, hasTests as g, typedFiles as h, formatResult as i, noLocalPaths as j, DEFAULT_ALLOWED as k, summaryMarkdown as l, scriptsOf as m, annotations as n, readConfig as o, configsOfScript as p, globFolders as q, createContext as r, runChecks as s, USAGE as t, RULES as u, testsRequired as v, requiredScripts as w, sourceMain as x, isSourcePath as y, inFolder as z };
2643
2691
 
2644
- //# sourceMappingURL=run-BYTCunT5.js.map
2692
+ //# sourceMappingURL=run-MyvUGD5l.js.map