@mark1russell7/conventions 0.16.0 → 0.18.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
@@ -47,6 +47,7 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
47
47
  | `no-build-output` | Git keeps no file in a folder named `dist` or `build`. | client `no-build-output`, `no-dist`, `no-dist-commit`. Only one repository of the audit tells this rule. The `.gitignore` of the template has it for each repository. |
48
48
  | `no-local-paths` | No tracked file has the home folder of a user: `C:\Users\<name>`, `/Users/<name>` or `/home/<name>`. A CI user (`runner`), a name of one character and a placeholder (`<you>`) are not a break. | client `I12`. systems `no-identifying-names`, `no-private-identifiers`, `no-private-names`. coeval `no-private-names`. |
49
49
  | `release-files` | A pull request changes `.github/workflows/release.yml` or `scripts/release/` only with a line `Release-Edit: <reason>` in a commit message or in the body of the pull request. The commits of the release bot (the sync of the template) need no reason. | coeval `no-release-edit`, `no-release-edits`. crawler `no-release-edit`, `no-release-edits`. headroom `no-release-edits`, `release-files-frozen`. |
50
+ | `unreleased-change` | A change does not set a version that npm has: the release skips such a version. The rule compares the version of the head of the change with the version of its merge base, so a version that only the base branch changed does not count. A repository where each pull request sets its version sets the option `versionEachChange`. Then a change of the shipped files also raises the version, when npm has that version already. The files that ship are the files of the folder of the package, without the tests, the fixtures, the Markdown files and the configs (the option `unshipped`). When git tracks each entry of the field `files`, only those entries ship. A change of `package.json` ships when a field of the option `fields` changes, for example `exports`, but not the dependencies. On a push to the default branch, a version that the push sets breaks only when npm had it before the push. The release of the same push can publish it. An error of the registry makes the rule show `skip`. A repository with `.changeset/config.json`, a private package and a version `0.0.0` or `0.0.0-<stage>` are not examined. | rigor #18 and #20 (2026-11-02): two pull requests set the same version, and the second change did not get to npm. crawler, coeval, template `release.yml`. |
50
51
  | `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). |
51
52
  | `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). |
52
53
  | `main-check` | No script finds out that it is the main module by a compare of `process.argv[1]` with its own path. Through a link (for example `~/git` to `D:/git`), the two paths differ: the script does nothing, and it ends with exit code 0. A script uses `import.meta.main`, or `realpathSync` on each side. | fleet `main-check` (STRATEGY.md, 2026-11-02). |
@@ -56,9 +57,14 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
56
57
  | `gate-trigger` | No workflow has `paths` or `paths-ignore` on `on.pull_request` or `on.pull_request_target`. The ruleset needs the summary check `<Name> OK` of each gate, and a workflow with a path filter does not start on each pull request. Then its check is not there, the ruleset cannot ask for it, and a pull request can merge before the gate ends. A gate uses the actions `changes` and `gate-summary` of the template (`CI.md`, "A gate with paths"). | fleet `gate-trigger` (STRATEGY.md, 2026-11-02). |
57
58
  | `license-file` | Each public package has a license field, and a license file with the same license in its own folder. A public repository, or a repository with a public package, has a license file at its root. In a GitHub Actions run, the event file tells if the repository is public, and the option `license` (MIT by default) is the license of a root with no public package. npm packs only the license file of the folder of the package, and GitHub reads only the one of the root: on 2026-11-02 five public repositories showed no license on GitHub while npm said MIT. `conventions fix` writes the missing files. | fleet strategy (2026-11-02). |
58
59
  | `home-package` | A change does not add a function with a signature name of another home of the map (for example `median`, `mulberry32` or `writeFileAtomic`). A local copy drifts from the home and splits the fixes. On 2026-11-02 the fleet had 68 local statistics functions in 14 repositories. The rule examines only the lines that the change adds, so the copies that exist do not break. | fleet direction 18 (STRATEGY.md, 2026-11-02). |
60
+ | `pages-site` | A public repository has a workflow that calls the Pages workflow of the template (`mark1russell7/template/.github/workflows/reusable-pages.yml`, any ref), and the call deploys. A call with `deploy: false` makes a test site only. In a GitHub Actions run, the event file tells if the repository is public. Outside a run, the rule shows `skip`. On 2026-11-02 eight public repositories had no site with a Releases page and a Status page. | vex, crawler, client, coeval `pages.yml`. |
59
61
 
60
62
  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`. The rule also needs each commit of the change. A shallow checkout can end inside the change. Then the authors and the messages that the rule reads are not those of the change, so the rule shows `error`. A pull request of one commit is complete at depth 2. For a longer one, the CI of the template deepens the checkout to the merge base.
61
63
 
64
+ The rule `unreleased-change` also needs the base of the change and its merge base. The CI of the template deepens the checkout of each pull request to the merge base. Without it, the rule shows `skip`. The rule also reads a push to the default branch: the event file gives the commit before the push and the time of the push. With `versionEachChange`, two pull requests that set the same version break only on the push. The check of the second pull request passed before the first release.
65
+
66
+ A repository that collects changes and raises the version in a separate pull request keeps the default. Each pull request can then change the code with no version change.
67
+
62
68
  ## Configuration
63
69
 
64
70
  The field `conventions` of the root `package.json` sets the rules. An exception or a changed option needs a reason:
@@ -101,6 +107,10 @@ An unknown rule, an unknown option, or an exception or a changed option without
101
107
  | `release-files.paths` | `[".github/workflows/release.yml", "scripts/release/**"]` | The globs of the files of the release flow. |
102
108
  | `release-files.trailer` | `Release-Edit` | The key of the line that gives the reason. |
103
109
  | `release-files.authors` | `["mark1russell7-release-train[bot]"]` | The authors of the release flow. Their commits need no reason. |
110
+ | `unreleased-change.versionEachChange` | `false` | When `true`, each change of the shipped files raises the version. Set it when each pull request sets its version. |
111
+ | `unreleased-change.unshipped` | tests, fixtures, Markdown, configs, `docs/`, `scripts/` and dot folders | With `versionEachChange`: the globs of the files of a package, relative to its folder, that do not ship. `conventions --list` shows the full list. |
112
+ | `unreleased-change.fields` | `main`, `exports`, `bin`, `files`, `publishConfig` and more | With `versionEachChange`: the fields of `package.json` whose change ships. |
113
+ | `unreleased-change.registry` | `https://registry.npmjs.org` | The URL of the registry that has the versions. |
104
114
  | `typed-scripts.javascript` | `[".js", ".mjs", ".cjs", ".jsx"]` | The extensions of JavaScript source. |
105
115
  | `typed-scripts.shell` | `[".sh", ".bash", ".zsh", ".ps1"]` | The extensions of shell scripts. |
106
116
  | `typed-scripts.shellLines` | `1` | The most lines of code of a shell script (a launcher). Empty lines and comments do not count. |
@@ -123,7 +133,7 @@ An unknown rule, an unknown option, or an exception or a changed option without
123
133
  | `--list` | Show each rule: the reason, the fix, the options, the state and the audit rows. |
124
134
  | `--root <folder>` | The root of the repository. The default is the current folder. |
125
135
  | `--rule <id>` | Only this rule. Use it again for more rules. |
126
- | `--base <ref>` | The base commit of the change, for the rules `release-files` and `home-package`. |
136
+ | `--base <ref>` | The base commit of the change, for the rules `release-files`, `home-package` and `unreleased-change`. |
127
137
  | `--json` | Write the result as JSON. |
128
138
 
129
139
  ## The map of homes
package/build/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as runCli } from "./run-uE1CPx4q.js";
2
+ import { c as runCli } from "./run-C1iqxBTB.js";
3
3
  // src/cli.ts
4
4
  try {
5
5
  process.exitCode = runCli(process.argv.slice(2), {
package/build/index.d.ts CHANGED
@@ -256,6 +256,16 @@ export declare const DEFAULT_ALLOWED: readonly string[];
256
256
  /** The forms of a home folder: Windows, macOS and Linux. The group `user` is the name of the user. */
257
257
  export declare const HOME_PATTERNS: readonly RegExp[];
258
258
  export declare const noLocalPaths: Rule;
259
+ /** The Pages workflow of the template, as a call from another repository and as a call from the template itself. */
260
+ export declare const PAGES_WORKFLOWS: readonly string[];
261
+ /** A call of the Pages workflow: its line (from 1), and false when its job sets `deploy: false`. */
262
+ interface PagesCall {
263
+ readonly line: number;
264
+ readonly deploys: boolean;
265
+ }
266
+ /** This function gives each call of a workflow of `workflows` in the text of a workflow file. The ref after `@` can be any ref. */
267
+ export declare function pagesCalls(text: string, workflows?: readonly string[]): PagesCall[];
268
+ export declare const pagesSite: Rule;
259
269
  /** This function tells if a specifier gets the package from git, not from a registry or the workspace. */
260
270
  export declare function isGitSpecifier(spec: string): boolean;
261
271
  /**
@@ -301,6 +311,32 @@ export declare const TRAIN_SCOPES: readonly ["@mark1russell7/*", "@procedures/*"
301
311
  /** 7 days, in minutes. */
302
312
  export declare const IGNORE_AFTER = 10080;
303
313
  export declare const trustPolicy: Rule;
314
+ /**
315
+ * The answer of the registry for one package, or an error. The answer has each version that npm has or had (none for a
316
+ * new package) and the time of each publish (ISO 8601).
317
+ */
318
+ type RegistryAnswer = {
319
+ readonly versions: readonly string[];
320
+ readonly times?: Readonly<Record<string, string>>;
321
+ } | {
322
+ readonly error: string;
323
+ };
324
+ /** This function gives the answer of the registry at the URL `registry` for each package name of `names`. */
325
+ type RegistryLookup = (names: readonly string[], registry: string) => ReadonlyMap<string, RegistryAnswer>;
326
+ /** The registry of npm. */
327
+ export declare const NPM_REGISTRY = "https://registry.npmjs.org";
328
+ /** The globs of the files of a package, relative to its folder, that do not ship: tests, fixtures, docs and configs. */
329
+ export declare const UNSHIPPED_FILES: readonly string[];
330
+ /** The fields of `package.json` that change what the package gives to a user. A change of the dependencies is not here. */
331
+ export declare const SHIPPED_FIELDS: readonly string[];
332
+ /**
333
+ * This function asks the registry for the versions of each package, in one child process of Node. A version that npm
334
+ * removed stays in the answer, because npm does not accept it again.
335
+ */
336
+ export declare const npmLookup: RegistryLookup;
337
+ /** This function makes the rule with the registry lookup `lookup`. The tests give a fake lookup. */
338
+ export declare function unreleasedChangeRule(lookup?: RegistryLookup): Rule;
339
+ export declare const unreleasedChange: Rule;
304
340
  export declare const workspaceProtocol: Rule;
305
341
  /** Each rule of the check. */
306
342
  export declare const RULES: readonly Rule[];
@@ -404,5 +440,5 @@ export declare function workspaceGlobs(root: string): string[] | undefined;
404
440
  * The result has absolute paths, in the order of the code units.
405
441
  */
406
442
  export declare function packageFolders(root: string, globs?: readonly string[] | undefined): string[];
407
- export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeState, Manifest, OptionSpec, OptionValue, Options, PackageInfo, PathFilter, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult };
443
+ export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeState, Manifest, OptionSpec, OptionValue, Options, PackageInfo, PagesCall, PathFilter, RegistryAnswer, RegistryLookup, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult };
408
444
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.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/runner-budget.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/trust-policy.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,e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YAAY,QAAQ;;wBAYpB,UAAU,QAAQ,+BAA+B,iBAAgB;;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBA6BG,OAAO,yBAAyB,IAAI;;;;;;wBC1RpC,aAAa,eAAe;;;;;wBAsD5B,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/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.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/trust-policy.ts","../src/rules/unreleased-change.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;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,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;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBA6BG,OAAO,yBAAyB,IAAI;;;;;;wBC1RpC,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
package/build/index.js CHANGED
@@ -1 +1 @@
1
- export { ct as ACTIONS_COMMIT, I as DEFAULT_ALLOWED, ht as DEPENDENCY_FIELDS, et as HOMES, st as HOME_EXPORTS, L as HOME_PATTERNS, p as IGNORE_AFTER, U as LICENSE_TEXTS, tt as MAP_RULE, B as REAL_COMPARE, d as RULES, pt as STRICT_OPTIONS, m as TRAIN_SCOPES, t as USAGE, n as annotations, W as authorOf, gt as cleanPath, _t as codePackages, _ as configsOfScript, lt as convertGate, r as createContext, mt as cuePreset, Y as declaredName, Mt as defaultOptions, nt as findHomes, i as formatResult, ut as gateTrigger, Ot as globFolders, kt as globToRegExp, vt as hasFile, V as hasImportMetaMain, x as hasTests, X as homePackage, yt as inFolder, N as isGitSpecifier, P as isPinned, C as isSourcePath, bt as keyLine, G as licenseFile, K as licenseFileOf, xt as lineOf, a as listRules, H as mainCheck, rt as mapMarkdown, it as mapText, St as matchesAny, at as mergeHomes, Z as messageOf, q as mitText, z as noBuildOutput, R as noLocalPaths, At as packageFolders, Nt as parseConfig, Ct as parseJsonc, w as pathsOf, F as pinnedGitDeps, dt as prPathFilters, o as readConfig, wt as readJsonc, ot as readOverlay, M as releaseFiles, Tt as replaceLine, Q as repoOf, J as repositoryIsPublic, E as repositoryOfRemote, j as requiredScripts, k as roadmapOfLine, A as roadmapParses, s as runChecks, c as runCli, l as runFix, Et as runGit, D as runnerBudget, O as scheduleMinute, v as scriptsOf, $ as signaturesOf, T as sourceMain, Dt as specifiersOf, u as summaryMarkdown, ft as summaryName, b as testsRequired, h as trustPolicy, S as tsconfigTest, y as typedFiles, g as typedScripts, jt as workspaceGlobs, f as workspaceProtocol } from "./run-uE1CPx4q.js";
1
+ export { _t as ACTIONS_COMMIT, G as DEFAULT_ALLOWED, wt as DEPENDENCY_FIELDS, lt as HOMES, gt as HOME_EXPORTS, K as HOME_PATTERNS, y as IGNORE_AFTER, Q as LICENSE_TEXTS, ut as MAP_RULE, p as NPM_REGISTRY, H as PAGES_WORKFLOWS, Y as REAL_COMPARE, d as RULES, m as SHIPPED_FIELDS, St as STRICT_OPTIONS, b as TRAIN_SCOPES, h as UNSHIPPED_FILES, t as USAGE, n as annotations, $ as authorOf, Tt as cleanPath, Et as codePackages, C as configsOfScript, vt as convertGate, r as createContext, Ct as cuePreset, it as declaredName, Vt as defaultOptions, dt as findHomes, i as formatResult, yt as gateTrigger, Lt as globFolders, Rt as globToRegExp, Dt as hasFile, X as hasImportMetaMain, D as hasTests, at as homePackage, Ot as inFolder, z as isGitSpecifier, B as isPinned, k as isSourcePath, kt as keyLine, et as licenseFile, tt as licenseFileOf, At as lineOf, a as listRules, Z as mainCheck, ft as mapMarkdown, pt as mapText, jt as matchesAny, mt as mergeHomes, ot as messageOf, nt as mitText, J as noBuildOutput, q as noLocalPaths, g as npmLookup, zt as packageFolders, U as pagesCalls, W as pagesSite, Ht as parseConfig, Mt as parseJsonc, A as pathsOf, V as pinnedGitDeps, bt as prPathFilters, o as readConfig, Nt as readJsonc, ht as readOverlay, R as releaseFiles, Pt as replaceLine, st as repoOf, rt as repositoryIsPublic, M as repositoryOfRemote, L as requiredScripts, F as roadmapOfLine, I as roadmapParses, s as runChecks, c as runCli, l as runFix, Ft as runGit, N as runnerBudget, P as scheduleMinute, w as scriptsOf, ct as signaturesOf, j as sourceMain, It as specifiersOf, u as summaryMarkdown, xt as summaryName, E as testsRequired, x as trustPolicy, O as tsconfigTest, T as typedFiles, S as typedScripts, _ as unreleasedChange, v as unreleasedChangeRule, Bt as workspaceGlobs, f as workspaceProtocol } from "./run-C1iqxBTB.js";
@@ -854,8 +854,41 @@ const gateTrigger = {
854
854
  }
855
855
  };
856
856
  // src/change.ts
857
- /** This function gives the range of the change: the option `--base`, or the merge commit of a pull request. */
858
- function rangeOf(context) {
857
+ /**
858
+ * The change that a check examines: the option `--base`, the merge commit of a pull request, or a push to the default
859
+ * branch. The rule release-files reads its changed files, and the runner reads the files that it adds.
860
+ */
861
+ /** This function gives the range of the commits of a push to the default branch, from the event file of GitHub Actions. */
862
+ function pushRange(context) {
863
+ const file = context.env["GITHUB_EVENT_PATH"];
864
+ let event;
865
+ try {
866
+ event = file === void 0 || file === "" || !existsSync(file) ? void 0 : JSON.parse(readFileSync(file, "utf8"));
867
+ } catch {
868
+ event = void 0;
869
+ }
870
+ if (event === void 0) return { skipped: "the push has no event file (GITHUB_EVENT_PATH)" };
871
+ const branch = event.repository?.default_branch;
872
+ if (typeof branch !== "string" || event.ref !== `refs/heads/${branch}`) return { skipped: "the push is not to the default branch: the pull request of the branch has the change" };
873
+ const before = typeof event.before === "string" ? event.before : "";
874
+ if (!/^[0-9a-f]{40,64}$/.test(before) || /^0+$/.test(before)) return { skipped: "the push has no commit before it" };
875
+ if (context.git([
876
+ "rev-parse",
877
+ "--verify",
878
+ "--quiet",
879
+ `${before}^{commit}`
880
+ ]) === void 0) return { skipped: `the checkout does not have ${before}, the commit before the push: fetch it, or set fetch-depth to 0` };
881
+ return {
882
+ diff: [before, "HEAD"],
883
+ log: [`${before}..HEAD`],
884
+ ends: [before, "HEAD"]
885
+ };
886
+ }
887
+ /**
888
+ * This function gives the range of the change: the option `--base`, or the merge commit of a pull request. With the
889
+ * option `push`, a push to the default branch gives the commits of the push: from the commit before the push to HEAD.
890
+ */
891
+ function rangeOf(context, options = {}) {
859
892
  if (context.base !== void 0) {
860
893
  if (context.git([
861
894
  "rev-parse",
@@ -870,6 +903,7 @@ function rangeOf(context) {
870
903
  };
871
904
  }
872
905
  const event = context.env["GITHUB_EVENT_NAME"];
906
+ if (event === "push" && options.push === true) return pushRange(context);
873
907
  if (event !== "pull_request" && event !== "pull_request_target") return { skipped: "no base: the rule runs on a pull request, or with --base <ref>" };
874
908
  if ((context.git([
875
909
  "rev-list",
@@ -7044,6 +7078,68 @@ const noLocalPaths = {
7044
7078
  return breaks;
7045
7079
  }
7046
7080
  };
7081
+ // src/rules/pages-site.ts
7082
+ /**
7083
+ * The rule `pages-site`: a public repository has a site. A workflow uses the Pages workflow of the template, and the
7084
+ * call deploys.
7085
+ */
7086
+ /** The Pages workflow of the template, as a call from another repository and as a call from the template itself. */
7087
+ const PAGES_WORKFLOWS = ["mark1russell7/template/.github/workflows/reusable-pages.yml", "./.github/workflows/reusable-pages.yml"];
7088
+ /** This function gives each call of a workflow of `workflows` in the text of a workflow file. The ref after `@` can be any ref. */
7089
+ function pagesCalls(text, workflows = PAGES_WORKFLOWS) {
7090
+ const lines = workflowLines(text);
7091
+ const names = new Set(workflows.map((name) => name.toLowerCase()));
7092
+ const calls = [];
7093
+ lines.forEach((line, index) => {
7094
+ const uses = keyValue(line, "uses");
7095
+ if (uses === void 0 || !names.has((uses.split("@")[0] ?? "").toLowerCase())) return;
7096
+ let job = index - 1;
7097
+ while (job >= 0 && ((lines[job] ?? "").trim() === "" || indentOf$1(lines[job] ?? "") >= indentOf$1(line))) job -= 1;
7098
+ const body = job < 0 ? [line] : lines.slice(job, blockEnd(lines, job));
7099
+ calls.push({
7100
+ line: index + 1,
7101
+ deploys: !body.some((text) => keyValue(text, "deploy") === "false")
7102
+ });
7103
+ });
7104
+ return calls;
7105
+ }
7106
+ const pagesSite = {
7107
+ id: "pages-site",
7108
+ title: "A public repository has a workflow that calls the Pages workflow of the template (`reusable-pages.yml`, any ref), and the call deploys.",
7109
+ reason: "Each public project has a site with its Releases page and its Status page, so a reader sees the versions and the open work. On 2026-11-02 eight public repositories had no site: typeset, algebra, headroom, release-train, optional, ste-lint, lag-hud and template.",
7110
+ fix: "Add `.github/workflows/pages.yml` with a job `uses: mark1russell7/template/.github/workflows/reusable-pages.yml@<commit> # main` and the permissions of CI.md (\"Pages\"). Give `build`, `out` and `roadmap: docs/ROADMAP.md`. After the build, the job starts `site-pages build`, which adds the Releases page and the Status page. Then set the Pages source to \"GitHub Actions\": `gh api -X POST repos/<owner>/<repo>/pages -f build_type=workflow`.",
7111
+ sources: [
7112
+ "vex",
7113
+ "crawler",
7114
+ "client",
7115
+ "coeval"
7116
+ ].map((repo) => ({
7117
+ repo,
7118
+ rule: "pages-site",
7119
+ doc: ".github/workflows/pages.yml (a call of reusable-pages.yml of the template)"
7120
+ })),
7121
+ options: { workflows: {
7122
+ type: "strings",
7123
+ default: PAGES_WORKFLOWS,
7124
+ description: "The workflows that deploy a site, without the ref after `@`."
7125
+ } },
7126
+ check(context, options) {
7127
+ const visible = repositoryIsPublic(context);
7128
+ if (visible === void 0) return { skipped: "outside a GitHub Actions run, the rule cannot tell if the repository is public" };
7129
+ if (!visible) return [];
7130
+ const files = context.gitFiles();
7131
+ if (files === void 0) return { skipped: "the root is not in a git repository" };
7132
+ const calls = files.filter((path) => WORKFLOW$1.test(path)).sort(byCode).flatMap((file) => pagesCalls(readFileSync(join(context.root, file), "utf8"), options["workflows"]).map((call) => ({
7133
+ file,
7134
+ ...call
7135
+ })));
7136
+ if (calls.some((call) => call.deploys)) return [];
7137
+ return [{
7138
+ file: ".github/workflows/pages.yml",
7139
+ message: `The repository is public, and no workflow deploys its site with the Pages workflow of the template.${calls.length === 0 ? "" : ` The calls in ${[...new Set(calls.map((call) => call.file))].join(", ")} have deploy: false.`}`
7140
+ }];
7141
+ }
7142
+ };
7047
7143
  // src/rules/pinned-git-deps.ts
7048
7144
  /**
7049
7145
  * The rule `pinned-git-deps`: a dependency from git names a full commit.
@@ -9271,6 +9367,273 @@ const trustPolicy = {
9271
9367
  return breaks;
9272
9368
  }
9273
9369
  };
9370
+ // src/rules/unreleased-change.ts
9371
+ /**
9372
+ * The rule `unreleased-change`: a change does not set a version that npm has. With the option `versionEachChange`, a
9373
+ * change of the files that a published package ships also raises its version. Else the release skips the change.
9374
+ */
9375
+ /** The registry of npm. */
9376
+ const NPM_REGISTRY = "https://registry.npmjs.org";
9377
+ /** The globs of the files of a package, relative to its folder, that do not ship: tests, fixtures, docs and configs. */
9378
+ const UNSHIPPED_FILES = [
9379
+ "**/*.md",
9380
+ "**/*.{test,spec}.*",
9381
+ "**/{test,tests,__tests__,fixtures,__fixtures__,__snapshots__,bench,benches,benchmarks,e2e}/**",
9382
+ "**/*.{bench,e2e}.*",
9383
+ "**/.*/**",
9384
+ "**/tsconfig*.json",
9385
+ "**/*.config.*",
9386
+ "docs/**",
9387
+ "examples/**",
9388
+ "scripts/**",
9389
+ "site/**",
9390
+ "LICENSE*",
9391
+ "pnpm-lock.yaml",
9392
+ "pnpm-workspace.yaml"
9393
+ ];
9394
+ /** The fields of `package.json` that change what the package gives to a user. A change of the dependencies is not here. */
9395
+ const SHIPPED_FIELDS = [
9396
+ "main",
9397
+ "module",
9398
+ "types",
9399
+ "typings",
9400
+ "exports",
9401
+ "imports",
9402
+ "bin",
9403
+ "files",
9404
+ "type",
9405
+ "publishConfig",
9406
+ "sideEffects",
9407
+ "browser"
9408
+ ];
9409
+ /** The script that `npmLookup` starts in a child process of Node, so that the rule stays synchronous. */
9410
+ const LOOKUP_SCRIPT = `
9411
+ const [registry, ...names] = process.argv.slice(1);
9412
+ let base = registry;
9413
+ while (base.endsWith("/")) base = base.slice(0, -1);
9414
+ Promise.all(names.map(async (name) => {
9415
+ try {
9416
+ const response = await fetch(base + "/" + name.replace("/", "%2f"), { headers: { accept: "application/json" }, signal: AbortSignal.timeout(20000) });
9417
+ if (response.status === 404) return [name, { versions: [] }];
9418
+ if (!response.ok) return [name, { error: "HTTP " + response.status }];
9419
+ const data = await response.json();
9420
+ const times = Object.fromEntries(Object.entries(data.time ?? {}).filter(([key]) => key !== "created" && key !== "modified"));
9421
+ return [name, { versions: [...new Set([...Object.keys(data.versions ?? {}), ...Object.keys(times)])], times }];
9422
+ } catch (error) {
9423
+ return [name, { error: String(error && error.message ? error.message : error) }];
9424
+ }
9425
+ })).then((entries) => process.stdout.write(JSON.stringify(Object.fromEntries(entries))));
9426
+ `;
9427
+ /**
9428
+ * This function asks the registry for the versions of each package, in one child process of Node. A version that npm
9429
+ * removed stays in the answer, because npm does not accept it again.
9430
+ */
9431
+ const npmLookup = (names, registry) => {
9432
+ const fail = (error) => new Map(names.map((name) => [name, { error }]));
9433
+ if (names.length === 0) return /* @__PURE__ */ new Map();
9434
+ const result = spawnSync(process.execPath, [
9435
+ "-e",
9436
+ LOOKUP_SCRIPT,
9437
+ registry,
9438
+ ...names
9439
+ ], {
9440
+ encoding: "utf8",
9441
+ timeout: 6e4,
9442
+ windowsHide: true
9443
+ });
9444
+ if (result.error !== void 0 || result.status !== 0) return fail(result.error?.message ?? `the lookup ended with exit code ${String(result.status)}`);
9445
+ try {
9446
+ const answers = JSON.parse(result.stdout);
9447
+ return new Map(names.map((name) => [name, answers[name] ?? { error: "no answer" }]));
9448
+ } catch {
9449
+ return fail("the lookup gave no JSON");
9450
+ }
9451
+ };
9452
+ /** This function gives the strings of a field of `package.json` that is a list of strings. */
9453
+ const stringsOf = (manifest, field) => {
9454
+ const value = manifest[field];
9455
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
9456
+ };
9457
+ /** This function tells if a path relative to the root is in the folder `folder`. The root is `""`. */
9458
+ const inside = (folder, path) => folder === "" || path.startsWith(`${folder}/`);
9459
+ /** This function gives the globs of an entry of the field `files`: the entry, and each path under it. */
9460
+ const entryGlobs = (entry) => {
9461
+ let glob = cleanPath(entry);
9462
+ while (glob.endsWith("/")) glob = glob.slice(0, -1);
9463
+ return [glob, `${glob}/**`];
9464
+ };
9465
+ /** This function reads the manifest of the text of a `package.json` file, or gives undefined. */
9466
+ function parseManifest(text) {
9467
+ if (text === void 0) return void 0;
9468
+ try {
9469
+ const parsed = JSON.parse(text);
9470
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
9471
+ } catch {
9472
+ return;
9473
+ }
9474
+ }
9475
+ /** This function tells if a version is a placeholder before the first release: `0.0.0` or `0.0.0-<stage>`. */
9476
+ const isPlaceholder = (version) => /^0\.0\.0(?:[-+].*)?$/.test(version);
9477
+ /** The published packages of the repository: the root package and the code packages that are not private and have a name and a version. */
9478
+ function publishedOf(context) {
9479
+ const all = [context.rootPackage, ...codePackages(context)];
9480
+ return all.filter((pkg, index) => all.findIndex((other) => other.file === pkg.file) === index).filter((pkg) => pkg.manifest["private"] !== true && typeof pkg.manifest["name"] === "string" && typeof pkg.manifest["version"] === "string");
9481
+ }
9482
+ /** This function gives the time of the push in milliseconds, from the field `repository.pushed_at` of the event file. */
9483
+ function pushedAt(context) {
9484
+ const file = context.env["GITHUB_EVENT_PATH"];
9485
+ if (file === void 0 || file === "" || !existsSync(file)) return void 0;
9486
+ try {
9487
+ const value = JSON.parse(readFileSync(file, "utf8")).repository?.pushed_at;
9488
+ if (typeof value === "number") return value * 1e3;
9489
+ return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? Date.parse(value) : void 0;
9490
+ } catch {
9491
+ return;
9492
+ }
9493
+ }
9494
+ /** This function gives the shipped files of `pkg` in the list `changed`, relative to the folder of the package. */
9495
+ function shippedFiles(pkg, changed, before, context, unshipped, fields) {
9496
+ const folders = context.packages.map((other) => other.folder).filter((folder) => folder !== "");
9497
+ const own = (path) => inside(pkg.folder, path) && (pkg.folder !== "" || !folders.some((folder) => inside(folder, path)));
9498
+ const relative = (path) => pkg.folder === "" ? path : path.slice(pkg.folder.length + 1);
9499
+ const entries = stringsOf(pkg.manifest, "files");
9500
+ const positive = entries.filter((entry) => !entry.startsWith("!"));
9501
+ const negative = entries.filter((entry) => entry.startsWith("!")).flatMap((entry) => entryGlobs(entry.slice(1)));
9502
+ const ownTracked = (context.gitFiles() ?? []).filter(own).map(relative);
9503
+ const whitelist = positive.length > 0 && positive.every((entry) => ownTracked.some((path) => matchesAny(path, entryGlobs(entry))));
9504
+ const ships = (path) => path !== "package.json" && !matchesAny(path, unshipped) && (!whitelist || positive.some((entry) => matchesAny(path, entryGlobs(entry))) && !matchesAny(path, negative));
9505
+ const files = changed.filter(own).map(relative).filter(ships);
9506
+ if (changed.includes(pkg.file) && before !== void 0 && fields.some((field) => JSON.stringify(before[field]) !== JSON.stringify(pkg.manifest[field]))) files.push("package.json");
9507
+ return files;
9508
+ }
9509
+ /** This function makes the rule with the registry lookup `lookup`. The tests give a fake lookup. */
9510
+ function unreleasedChangeRule(lookup = npmLookup) {
9511
+ return {
9512
+ id: "unreleased-change",
9513
+ title: "A change does not set a version that npm has. With `versionEachChange`, a change of the shipped files also raises the version.",
9514
+ reason: "The release workflow publishes each version that npm does not have, and it skips the others. When two pull requests set the same version, the second merge changes the code but no version, and nothing fails (rigor #18 and #20, 2026-11-02).",
9515
+ fix: "Raise the version of the package in a pull request to a version that npm does not have, with the SemVer rules (RELEASING.md). Then the release workflow publishes the change.",
9516
+ sources: [{
9517
+ repo: "rigor",
9518
+ rule: "unreleased-change",
9519
+ doc: "pull requests #18 and #20 (2026-11-02): two pull requests set the same version"
9520
+ }, ...[
9521
+ "crawler",
9522
+ "coeval",
9523
+ "template"
9524
+ ].map((repo) => ({
9525
+ repo,
9526
+ rule: "unreleased-change",
9527
+ doc: ".github/workflows/release.yml (it starts on a change of a version, and it skips each version that npm has)"
9528
+ }))],
9529
+ options: {
9530
+ versionEachChange: {
9531
+ type: "boolean",
9532
+ default: false,
9533
+ description: "True when each pull request sets its version: a change of the shipped files with a version that npm has breaks, also on a push. False when a separate pull request raises the version."
9534
+ },
9535
+ unshipped: {
9536
+ type: "strings",
9537
+ default: UNSHIPPED_FILES,
9538
+ description: "With `versionEachChange`: the globs of the files of a package, relative to its folder, that do not ship."
9539
+ },
9540
+ fields: {
9541
+ type: "strings",
9542
+ default: SHIPPED_FIELDS,
9543
+ description: "With `versionEachChange`: the fields of `package.json` whose change ships. The dependencies are not in the default list."
9544
+ },
9545
+ registry: {
9546
+ type: "string",
9547
+ default: NPM_REGISTRY,
9548
+ description: "The URL of the registry that has the versions."
9549
+ }
9550
+ },
9551
+ check(context, options) {
9552
+ if (hasFile(context.root, ".changeset/config.json")) return { skipped: "the repository uses Changesets: the changesets raise the versions, and the changeset check examines them" };
9553
+ const published = publishedOf(context).filter((pkg) => !isPlaceholder(String(pkg.manifest["version"])));
9554
+ if (published.length === 0) return { skipped: "the repository has no published package with a release version" };
9555
+ const range = rangeOf(context, { push: true });
9556
+ if ("skipped" in range) return range;
9557
+ const strict = options["versionEachChange"] === true;
9558
+ const push = context.base === void 0 && context.env["GITHUB_EVENT_NAME"] === "push";
9559
+ const out = strict ? context.git([
9560
+ "diff",
9561
+ "--name-only",
9562
+ "--no-renames",
9563
+ ...range.diff
9564
+ ]) : "";
9565
+ if (out === void 0) return { skipped: "git cannot give the changed files of the change" };
9566
+ const changed = out.split(/\r?\n/).filter((file) => file !== "");
9567
+ const unshipped = Array.isArray(options["unshipped"]) ? options["unshipped"] : UNSHIPPED_FILES;
9568
+ const fields = Array.isArray(options["fields"]) ? options["fields"] : SHIPPED_FIELDS;
9569
+ const registry = typeof options["registry"] === "string" ? options["registry"] : NPM_REGISTRY;
9570
+ const fork = push ? range.ends[0] : context.git(["merge-base", ...range.ends])?.trim();
9571
+ const notes = [];
9572
+ if (fork === void 0) notes.push(`the checkout does not have the merge base of ${range.ends.join(" and ")}, so the rule cannot tell if the change sets a version`);
9573
+ const manifestAt = (ref, pkg) => ref === "HEAD" ? pkg.manifest : parseManifest(context.git(["show", `${ref}:${pkg.file}`]));
9574
+ const versionOf = (manifest) => typeof manifest?.["version"] === "string" ? manifest["version"] : void 0;
9575
+ const candidates = [];
9576
+ for (const pkg of published) {
9577
+ const atStart = manifestAt(range.ends[0], pkg);
9578
+ const set = versionOf(manifestAt(range.ends[1], pkg));
9579
+ const before = fork === void 0 ? void 0 : versionOf(fork === range.ends[0] ? atStart : manifestAt(fork, pkg));
9580
+ const sets = fork !== void 0 && set !== void 0 && !isPlaceholder(set) && set !== before ? set : void 0;
9581
+ const files = strict ? shippedFiles(pkg, changed, atStart, context, unshipped, fields) : [];
9582
+ if (sets === void 0 && files.length === 0) continue;
9583
+ candidates.push({
9584
+ pkg,
9585
+ name: String(pkg.manifest["name"]),
9586
+ version: String(pkg.manifest["version"]),
9587
+ sets,
9588
+ start: versionOf(atStart),
9589
+ files
9590
+ });
9591
+ }
9592
+ if (candidates.length === 0) return notes.length > 0 ? { skipped: notes.join("; ") } : [];
9593
+ const answers = lookup(candidates.map((candidate) => candidate.name), registry);
9594
+ const pushTime = push ? pushedAt(context) : void 0;
9595
+ const breaks = [];
9596
+ for (const candidate of candidates) {
9597
+ const answer = answers.get(candidate.name) ?? { error: "no answer" };
9598
+ if ("error" in answer) {
9599
+ notes.push(`the registry did not answer for ${candidate.name}: ${answer.error}`);
9600
+ continue;
9601
+ }
9602
+ const line = lineOf(candidate.pkg.text, "\"version\"");
9603
+ const at = {
9604
+ file: candidate.pkg.file,
9605
+ ...line === void 0 ? {} : { line }
9606
+ };
9607
+ if (candidate.sets !== void 0) {
9608
+ const sets = candidate.sets;
9609
+ if (!answer.versions.includes(sets)) continue;
9610
+ if (push) {
9611
+ const time = Date.parse(answer.times?.[sets] ?? "");
9612
+ if (pushTime === void 0 || Number.isNaN(time)) {
9613
+ notes.push(`the rule cannot tell if npm had ${candidate.name}@${sets} before the push`);
9614
+ continue;
9615
+ }
9616
+ if (time >= pushTime) continue;
9617
+ }
9618
+ breaks.push({
9619
+ ...at,
9620
+ message: `${candidate.name}: the change sets the version ${sets}, but ${sets} is on npm already. Raise the version (SemVer) in a pull request.`
9621
+ });
9622
+ } else if (strict && candidate.files.length > 0 && candidate.start === candidate.version && answer.versions.includes(candidate.version)) {
9623
+ const shown = candidate.files.slice(0, 3).map((file) => candidate.pkg.folder === "" ? file : `${candidate.pkg.folder}/${file}`);
9624
+ const more = candidate.files.length > shown.length ? ` and ${String(candidate.files.length - shown.length)} more` : "";
9625
+ breaks.push({
9626
+ ...at,
9627
+ message: `${candidate.name}: the change is not released, because ${candidate.version} is on npm already. Raise the version (SemVer) in a pull request. The change ships ${shown.join(", ")}${more}.`
9628
+ });
9629
+ }
9630
+ }
9631
+ if (breaks.length === 0 && notes.length > 0) return { skipped: notes.join("; ") };
9632
+ return breaks;
9633
+ }
9634
+ };
9635
+ }
9636
+ const unreleasedChange = unreleasedChangeRule();
9274
9637
  // src/rules/workspace-protocol.ts
9275
9638
  /**
9276
9639
  * The rule `workspace-protocol`: a package uses another package of the workspace through `workspace:`.
@@ -9348,6 +9711,7 @@ const RULES = [
9348
9711
  noBuildOutput,
9349
9712
  noLocalPaths,
9350
9713
  releaseFiles,
9714
+ unreleasedChange,
9351
9715
  typedScripts,
9352
9716
  typedFiles,
9353
9717
  mainCheck,
@@ -9356,7 +9720,8 @@ const RULES = [
9356
9720
  runnerBudget,
9357
9721
  gateTrigger,
9358
9722
  homePackage,
9359
- licenseFile
9723
+ licenseFile,
9724
+ pagesSite
9360
9725
  ];
9361
9726
  // src/run.ts
9362
9727
  /**
@@ -9752,6 +10117,6 @@ function runMap(args, io) {
9752
10117
  else io.stdout(mapText(found));
9753
10118
  return 0;
9754
10119
  }
9755
- export { signaturesOf as $, roadmapParses as A, packageFolders as At, REAL_COMPARE as B, isSourcePath as C, parseJsonc as Ct, runnerBudget as D, specifiersOf as Dt, repositoryOfRemote as E, runGit as Et, pinnedGitDeps as F, licenseFile as G, mainCheck as H, DEFAULT_ALLOWED as I, repositoryIsPublic as J, licenseFileOf as K, HOME_PATTERNS as L, releaseFiles as M, defaultOptions as Mt, isGitSpecifier as N, parseConfig as Nt, scheduleMinute as O, globFolders as Ot, isPinned as P, repoOf as Q, noLocalPaths as R, tsconfigTest as S, matchesAny as St, sourceMain as T, replaceLine as Tt, LICENSE_TEXTS as U, hasImportMetaMain as V, authorOf as W, homePackage as X, declaredName as Y, messageOf as Z, configsOfScript as _, codePackages as _t, listRules as a, mergeHomes as at, testsRequired as b, keyLine as bt, runCli as c, ACTIONS_COMMIT as ct, RULES as d, prPathFilters as dt, HOMES as et, workspaceProtocol as f, summaryName as ft, typedScripts as g, cleanPath as gt, trustPolicy as h, DEPENDENCY_FIELDS as ht, formatResult as i, mapText as it, requiredScripts as j, workspaceGlobs as jt, roadmapOfLine as k, globToRegExp as kt, runFix as l, convertGate as lt, TRAIN_SCOPES as m, cuePreset as mt, annotations as n, findHomes as nt, readConfig as o, readOverlay as ot, IGNORE_AFTER as p, STRICT_OPTIONS as pt, mitText as q, createContext as r, mapMarkdown as rt, runChecks as s, HOME_EXPORTS as st, USAGE as t, MAP_RULE as tt, summaryMarkdown as u, gateTrigger as ut, scriptsOf as v, hasFile as vt, pathsOf as w, readJsonc as wt, hasTests as x, lineOf as xt, typedFiles as y, inFolder as yt, noBuildOutput as z };
10120
+ export { authorOf as $, pathsOf as A, lineOf as At, isPinned as B, workspaceGlobs as Bt, configsOfScript as C, cuePreset as Ct, hasTests as D, hasFile as Dt, testsRequired as E, codePackages as Et, roadmapOfLine as F, runGit as Ft, DEFAULT_ALLOWED as G, PAGES_WORKFLOWS as H, parseConfig as Ht, roadmapParses as I, specifiersOf as It, noBuildOutput as J, HOME_PATTERNS as K, requiredScripts as L, globFolders as Lt, repositoryOfRemote as M, parseJsonc as Mt, runnerBudget as N, readJsonc as Nt, tsconfigTest as O, inFolder as Ot, scheduleMinute as P, replaceLine as Pt, LICENSE_TEXTS as Q, releaseFiles as R, globToRegExp as Rt, typedScripts as S, STRICT_OPTIONS as St, typedFiles as T, cleanPath as Tt, pagesCalls as U, pinnedGitDeps as V, defaultOptions as Vt, pagesSite as W, hasImportMetaMain as X, REAL_COMPARE as Y, mainCheck as Z, unreleasedChange as _, ACTIONS_COMMIT as _t, listRules as a, homePackage as at, TRAIN_SCOPES as b, prPathFilters as bt, runCli as c, signaturesOf as ct, RULES as d, findHomes as dt, licenseFile as et, workspaceProtocol as f, mapMarkdown as ft, npmLookup as g, HOME_EXPORTS as gt, UNSHIPPED_FILES as h, readOverlay as ht, formatResult as i, declaredName as it, sourceMain as j, matchesAny as jt, isSourcePath as k, keyLine as kt, runFix as l, HOMES as lt, SHIPPED_FIELDS as m, mergeHomes as mt, annotations as n, mitText as nt, readConfig as o, messageOf as ot, NPM_REGISTRY as p, mapText as pt, noLocalPaths as q, createContext as r, repositoryIsPublic as rt, runChecks as s, repoOf as st, USAGE as t, licenseFileOf as tt, summaryMarkdown as u, MAP_RULE as ut, unreleasedChangeRule as v, convertGate as vt, scriptsOf as w, DEPENDENCY_FIELDS as wt, trustPolicy as x, summaryName as xt, IGNORE_AFTER as y, gateTrigger as yt, isGitSpecifier as z, packageFolders as zt };
9756
10121
 
9757
- //# sourceMappingURL=run-uE1CPx4q.js.map
10122
+ //# sourceMappingURL=run-C1iqxBTB.js.map