@mark1russell7/conventions 0.47.1 → 0.47.3

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
@@ -179,6 +179,7 @@ An unknown rule, an unknown option, or an exception or a changed option without
179
179
  | `--no-base` | Do not use a default base. |
180
180
  | `--json` | Write the result as JSON. |
181
181
  | `pre-push <remote> [<url>]` | Examine the new commits of a push with the private name list. The git hook `pre-push` starts it. |
182
+ | `pre-push --base <ref> [--head <ref>]` | Examine the commits of `<base>..<head>` (the default head is `HEAD`) and the text of the pull request of the run, with the same rules. The shared CI starts it. |
182
183
  | `hook install` | Write the git hook `pre-push`. In CI, or outside a git repository, the command does nothing. |
183
184
 
184
185
  A run that `workflow_dispatch` starts has no pull request in its event file. A person can start the gates of a pull request in this way. For such a run, the shared CI finds the pull request of the branch, and gives two environment variables to the check:
@@ -202,6 +203,10 @@ git config --global conventions.privateNamesFile ~/private/private-names.json
202
203
 
203
204
  The environment variable `CONVENTIONS_PRIVATE_NAMES_FILE` has priority over the git configuration.
204
205
 
206
+ The settings can name more than one list. Add each more list with `git config --global --add conventions.privateNamesFile <path>`. In the environment variable, put `;` between the paths on Windows, and `:` on other systems.
207
+
208
+ The command merges the lists in their order. The index of a name in a break counts across the lists. When two lists have the same id, the push stops.
209
+
205
210
  The list is a JSON file. The schema [`schema/private-names.schema.json`](schema/private-names.schema.json) tells its fields, and the package has the schema. This example has made-up names:
206
211
 
207
212
  ```json
@@ -244,7 +249,9 @@ A break shows the commit, the place and the index of the name in the list. An ex
244
249
 
245
250
  When no list and no pattern is set, the command writes one line that starts with `conventions pre-push: No read`, and the push continues. A push with no read is not a pass. The push stops when the command cannot read the list that a setting names. It also stops when the list is not JSON, does not agree with the schema, or has a bad regular expression. The line of the stop gives the reason and the index of the entry, not its values.
246
251
 
247
- The check of CI continues to read the environment variable `CONVENTIONS_PRIVATE_PATTERNS` in the rule `no-local-paths`.
252
+ The check of CI continues to read the environment variable `CONVENTIONS_PRIVATE_PATTERNS` in the rule `no-local-paths`. In CI (`CI` or `GITHUB_ACTIONS` is set) with no private pattern, the rule cannot look for private names. Its result then shows `NO READ` and the reason, and GitHub shows a warning. The JSON result has the field `noRead`. The status of the rule does not change, so the rule still fails on a home folder. A local check shows no such note.
253
+
254
+ With `--base <ref>`, the command is the check of a change in CI. It examines each commit of `<base>..<head>` with the same rules as the hook. It also examines the title and the body of the pull request of the run, as the rule `no-local-paths` reads them. It reads no standard input. A break fails the check with the exit code 1, and the text tells that the check fails, not that the push stops. The step "Private names of the change" of the shared CI starts it with the list of the secret `CONVENTIONS_PRIVATE_NAMES` (`CI.md` of the template).
248
255
 
249
256
  ## The map of homes
250
257
 
@@ -312,5 +319,6 @@ The package also exports the functions of the tool:
312
319
  - `parsePrivateNames(text)` parses and checks a private name list. It throws a `PrivateNameListError` with a reason that shows no value of the list.
313
320
  - `lineNameHit(list, line, place)`, `pathNameHit(list, path)`, `firstNameMatch(line, names)`, `isCommonUse(line, index, rule)` and `isAllowedHit(allow, repo, path, id)` find the names of the list. They have no input or output.
314
321
  - `lineNameHits(list, line, place)` and `nameMatches(line, names)` give each name of a line, one hit for each name. A scan that counts the names uses them. The gate takes the first hit.
315
- - `privateNamesFile(env, git)`, `privatePatterns(env)` and `invalidPatternBreaks(patterns)` read the settings and the patterns.
316
- - `prePush(options, io)` is the command `pre-push`, and `installHook(options, io)` is the command `hook install`. `PRE_PUSH_HOOK` is the text of the hook.
322
+ - `privateNamesFiles(env, git)`, `privateNamesFile(env, git)`, `privatePatterns(env)` and `invalidPatternBreaks(patterns)` read the settings and the patterns. `privateNamesFiles` gives each path, and `privateNamesFile` gives one.
323
+ - `mergePrivateNames(lists)` merges the lists in order. It throws a `PrivateNameListError` when two lists have the same id.
324
+ - `prePush(options, io)` is the command `pre-push`. With the option `base`, it is the check of a change in CI. `installHook(options, io)` is the command `hook install`. `PRE_PUSH_HOOK` is the text of the hook.
package/build/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { c as runCli } from "./run-BrCo6Uuy.js";
2
+ import { c as runCli } from "./run-Ccfopw7M.js";
3
3
  import { readFileSync } from "node:fs";
4
4
  // src/cli.ts
5
5
  try {
6
6
  const args = process.argv.slice(2);
7
- const stdin = args[0] === "pre-push" && process.stdin.isTTY !== true ? readFileSync(0, "utf8") : void 0;
7
+ const stdin = args[0] === "pre-push" && !args.includes("--base") && process.stdin.isTTY !== true ? readFileSync(0, "utf8") : void 0;
8
8
  process.exitCode = runCli(args, {
9
9
  cwd: process.cwd(),
10
10
  env: process.env,
package/build/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The bin `conventions`. The work is in run.ts, so a test can start the same CLI in a fixture folder.\nimport { readFileSync } from \"node:fs\";\nimport { runCli } from \"./run.ts\";\n\ntry {\n const args = process.argv.slice(2);\n // Only the git hook pre-push gives a standard input: the refs of the push. A terminal gives none\n const stdin = args[0] === \"pre-push\" && process.stdin.isTTY !== true ? readFileSync(0, \"utf8\") : undefined;\n process.exitCode = runCli(args, {\n cwd: process.cwd(),\n env: process.env,\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n ...(stdin === undefined ? {} : { stdin }),\n });\n} catch (error) {\n process.stderr.write(`conventions: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n}\n"],"mappings":";;;;AAKA,IAAI;CACF,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CAEjC,MAAM,QAAQ,KAAK,OAAO,cAAc,QAAQ,MAAM,UAAU,OAAO,aAAa,GAAG,MAAM,IAAI,KAAA;CACjG,QAAQ,WAAW,OAAO,MAAM;EAC9B,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ;EACb,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;CACzC,CAAC;AACH,SAAS,OAAO;CACd,QAAQ,OAAO,MAAM,gBAAgB,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAChH,QAAQ,WAAW;AACrB"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The bin `conventions`. The work is in run.ts, so a test can start the same CLI in a fixture folder.\nimport { readFileSync } from \"node:fs\";\nimport { runCli } from \"./run.ts\";\n\ntry {\n const args = process.argv.slice(2);\n // Only the git hook pre-push gives a standard input: the refs of the push. A terminal gives none, and the check of a\n // change in CI (--base) reads none\n const stdin = args[0] === \"pre-push\" && !args.includes(\"--base\") && process.stdin.isTTY !== true ? readFileSync(0, \"utf8\") : undefined;\n process.exitCode = runCli(args, {\n cwd: process.cwd(),\n env: process.env,\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n ...(stdin === undefined ? {} : { stdin }),\n });\n} catch (error) {\n process.stderr.write(`conventions: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n}\n"],"mappings":";;;;AAKA,IAAI;CACF,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CAGjC,MAAM,QAAQ,KAAK,OAAO,cAAc,CAAC,KAAK,SAAS,QAAQ,KAAK,QAAQ,MAAM,UAAU,OAAO,aAAa,GAAG,MAAM,IAAI,KAAA;CAC7H,QAAQ,WAAW,OAAO,MAAM;EAC9B,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ;EACb,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;CACzC,CAAC;AACH,SAAS,OAAO;CACd,QAAQ,OAAO,MAAM,gBAAgB,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAChH,QAAQ,WAAW;AACrB"}
package/build/index.d.ts CHANGED
@@ -123,6 +123,12 @@ interface Rule {
123
123
  */
124
124
  readonly failsFrom?: string;
125
125
  check(context: RuleContext, options: Options): RuleOutcome;
126
+ /**
127
+ * This function gives the reason when the rule cannot read a part of its cases, for example a private source that CI
128
+ * does not give. It gives undefined when the rule reads each part. The check then shows "no read" and the reason with
129
+ * the result, so a part with no read does not show as a pass. The status of the rule does not change.
130
+ */
131
+ noRead?(context: RuleContext, options: Options): string | undefined;
126
132
  }
127
133
  /** The fields of `package.json` that hold dependencies. */
128
134
  export declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
@@ -488,6 +494,13 @@ export declare class PrivateNameListError extends Error {
488
494
  * expression and the ids. It throws a `PrivateNameListError` when the text is not valid. The error shows no value of the text.
489
495
  */
490
496
  export declare function parsePrivateNames(text: string): PrivateNameList;
497
+ /**
498
+ * This function merges private name lists into one list, in order. The names of each list come after the names of the
499
+ * lists before it. Thus the index of a name in a result counts across the lists. `parsePrivateNames` makes sure that an
500
+ * entry of `allow` refers to a name of its own list. The function throws a `PrivateNameListError` when two lists have
501
+ * the same id. Then an entry of `allow` can refer to the two names.
502
+ */
503
+ export declare function mergePrivateNames(lists: readonly PrivateNameList[]): PrivateNameList;
491
504
  /**
492
505
  * This function tells if the word of `rule` at `index` of `line` is a common word or code, and not the name of the
493
506
  * project. Code is a type, a key or a part of a path. A common word comes after an article, in a title or before a noun.
@@ -578,6 +591,13 @@ export declare function privatePatterns(env: Readonly<Record<string, string | un
578
591
  * else the git configuration `conventions.privateNamesFile`. It gives undefined when neither has a value.
579
592
  */
580
593
  export declare function privateNamesFile(env: Readonly<Record<string, string | undefined>>, git: (args: readonly string[]) => string | undefined): string | undefined;
594
+ /**
595
+ * This function gives the paths of the private name lists, in order. The environment variable
596
+ * `CONVENTIONS_PRIVATE_NAMES_FILE` has priority. It has one path, or more paths with `separator` between them. The
597
+ * default `separator` is the `delimiter` of `node:path`: `;` on Windows, `:` on other systems. Else, each value of the git
598
+ * configuration `conventions.privateNamesFile` is a path. The function gives an empty array when neither has a value.
599
+ */
600
+ export declare function privateNamesFiles(env: Readonly<Record<string, string | undefined>>, git: (args: readonly string[]) => string | undefined, separator?: string): string[];
581
601
  /** This function gives a break for each private pattern that is not a valid regular expression. A break does not show the pattern. */
582
602
  export declare function invalidPatternBreaks(patterns: readonly PrivatePattern[]): Break[];
583
603
  /**
@@ -776,6 +796,11 @@ interface RuleResult {
776
796
  readonly ignored: number;
777
797
  /** The reason of `off`, of `ignore`, of `skipped`, or the message of `error`. */
778
798
  readonly note?: string;
799
+ /**
800
+ * The reason why the rule did not read a part of its cases (`Rule.noRead`). The output then shows "no read" with the
801
+ * status, so the part does not show as a pass. The status does not change.
802
+ */
803
+ readonly noRead?: string;
779
804
  }
780
805
  /** The result of `runChecks`. */
781
806
  interface CheckResult {
@@ -824,7 +849,8 @@ export declare function formatResult(result: CheckResult): string;
824
849
  export declare function summaryMarkdown(result: CheckResult): string;
825
850
  /**
826
851
  * This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request.
827
- * A break of a rule that only warns gives a `::warning` command.
852
+ * A break of a rule that only warns gives a `::warning` command. A rule with no read of a part gives a `::warning` command
853
+ * with the reason.
828
854
  */
829
855
  export declare function annotations(result: CheckResult): string;
830
856
  /** This function gives the text of `--list`: each rule, its reason, its fix, its options, its state and its audit sources. */
@@ -853,8 +879,18 @@ interface PrePushOptions {
853
879
  * With no URL, the command asks `git remote get-url`.
854
880
  */
855
881
  readonly url?: string;
856
- /** The standard input of the hook: a line `<local ref> <local sha> <remote ref> <remote sha>` for each ref of the push. */
882
+ /**
883
+ * The standard input of the hook: a line `<local ref> <local sha> <remote ref> <remote sha>` for each ref of the push.
884
+ * The command does not read it when `base` has a value.
885
+ */
857
886
  readonly input: string;
887
+ /**
888
+ * The base commit of a change, for a check in CI. With a base, the command examines each commit of `base..head`, not
889
+ * the refs of `input`. It also examines the title and the body of the pull request of the run (`pullRequestOfRun`).
890
+ */
891
+ readonly base?: string;
892
+ /** The last commit of the change of `base`. The default is `HEAD`. */
893
+ readonly head?: string;
858
894
  readonly env: Readonly<Record<string, string | undefined>>;
859
895
  /** The root of the working tree. A relative path of the private name list starts at the root. */
860
896
  readonly root: string;
@@ -867,6 +903,11 @@ interface PrePushOptions {
867
903
  * This function is the command `conventions pre-push`. It examines each new commit of the push: its message, the paths
868
904
  * that it adds or changes, and each line that it adds. It writes the breaks to `stderr`, and gives the exit code: 1 on a
869
905
  * break, 0 on a pass. With no private name list and no private pattern, it writes the line `NO_READ_LINE` and gives 0.
906
+ * The settings can name more than one list (`privateNamesFiles`). The command then examines the merge of the lists.
907
+ *
908
+ * With the option `base`, the command is the check of a change in CI. It examines each commit of `base..head` with
909
+ * the same rules, and the title and the body of the pull request of the run. A message then tells that the check fails,
910
+ * not that the push stops.
870
911
  */
871
912
  export declare function prePush(options: PrePushOptions, io: Pick<CliIo, "stderr">): number;
872
913
  /** The marker line of the hook that `conventions hook install` writes. The command rewrites only a hook with this line. */
@@ -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-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.ts","../src/map.ts","../src/rules/home-module.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/coverage-provider.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/private-names.ts","../src/rules/no-local-paths.ts","../src/rules/pack-no-buildinfo.ts","../src/rules/publish-text-safe.ts","../src/rules/exports-require.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/site-check-in-ci.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/job-fails.ts","../src/rules/playwright-install.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.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/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.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;;WAEA;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;qBAG3C;;UAGI;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;;;;;;;WAOA;EACT,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;;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SAAS,aAAa,IAAI,KAAK;;qBCzX9C,cAAc,SAAS;WAA0B;WAA0B;;UCuIvE;WACN;WACA;WACA;;WAEA;WACA;;;UAIM;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;WACA,gBAAgB;;;UAIV;;WAEN;;WAEA;;WAEA;;WAEA;WACA,iBAAiB;WACjB,eAAe;;;wBAgGV,aAAa,cAAc,eAAe;;;;;;;wBAmD1C,WAAW,cAAc,eAAe;;;;;;;;qBC1T3C;;wBAGG,QAAQ,cAAc,iBAAiB;;;;;;;;wBAavC,iBAAiB,kBAAkB,iBAAiB;;wBA+BpD,OAAO,cAAc;;;;;wBAQrB,aAAa,cAAc,iBAAiB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.ts","../src/map.ts","../src/rules/home-module.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/coverage-provider.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/private-names.ts","../src/rules/no-local-paths.ts","../src/rules/pack-no-buildinfo.ts","../src/rules/publish-text-safe.ts","../src/rules/exports-require.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/site-check-in-ci.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/job-fails.ts","../src/rules/playwright-install.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.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/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.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;;WAEA;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;qBAG3C;;UAGI;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;;;;;;;WAOA;EACT,MAAM,SAAS,aAAa,SAAS,UAAU;;;;;;EAM/C,QAAQ,SAAS,aAAa,SAAS;;;qBAO5B;;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,KAAK,oDAAoD;;UC/N9E;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCxCxD;qBA4FA,WAAW;qBC5CX,iBAAiB;;UCzCb;WACN;WACA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ACA,gBAAgB;;;UAIV;;WAEN;;WAEA;;WAEA;;WAEA;WACA,iBAAiB;WACjB,eAAe;;;wBAgGV,aAAa,cAAc,eAAe;;;;;;;wBAmD1C,WAAW,cAAc,eAAe;;;;;;;;qBC1T3C;;wBAGG,QAAQ,cAAc,iBAAiB;;;;;;;;wBAavC,iBAAiB,kBAAkB,iBAAiB;;wBA+BpD,OAAO,cAAc;;;;;wBAQrB,aAAa,cAAc,iBAAiB"}
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as unreleasedChangeRule, $n as keyLine, $t as repositoryIsPublic, A as typedFiles, An as setupCue, At as privatePatterns, B as roadmapParses, Bn as prPathFilters, Bt as parsePrivateNames, C as versionTitle, Cn as hasTests, Ct as HOME_PATTERNS, D as typedScripts, Dn as SHARED_WORKFLOWS, Dt as invalidPatternBreaks, E as trustPolicy, En as SHARED_CI, Et as PRIVATE_PATTERNS_VARIABLE, F as HOME_TIMEOUT_MS, Fn as securityOneJob, Ft as isAllowedHit, G as publishedMinor, Gn as STRICT_OPTIONS, Gt as mainCheck, H as releaseFiles, Hn as gateAfterCancel, Ht as noBuildOutput, I as blockHash, In as withOneJob, It as isCommonUse, J as NPM_REGISTRY, Jn as RULE_WARN_DAYS, Jt as LICENSE_TEXTS, K as publishedMinorRule, Kn as cuePreset, Kt as coverageProvider, L as githubFetch, Ln as ACTIONS_COMMIT, Lt as lineNameHit, M as isSourcePath, Mn as SECURITY_SCAN_INPUTS, Mt as PRIVATE_NAME_LIST, N as pathsOf, Nn as SECURITY_TIMEOUT_MINUTES, Nt as PrivateNameListError, O as configsOfScript, On as callsSharedCi, Ot as noLocalPaths, P as sourceMain, Pn as securityCallers, Pt as firstNameMatch, Q as unreleasedChange, Qn as inFolder, Qt as mitText, R as sharedDocsRule, Rn as convertGate, Rt as lineNameHits, S as setVersions, Sn as serviceRunMain, St as DEFAULT_ALLOWED, T as TRAIN_SCOPES, Tn as SHARED_ACTIONS, Tt as PRIVATE_NAMES_FILE_VARIABLE, U as lockedVersions, Un as readAction, Ut as REAL_COMPARE, V as requiredScripts, Vn as summaryName, Vt as pathNameHit, W as minorOf, Wn as readWorkflow, Wt as hasImportMetaMain, X as UNSHIPPED_FILES, Xn as codePackages, Xt as licenseFile, Y as SHIPPED_FIELDS, Yn as cleanPath, Yt as authorOf, Z as npmLookup, Zn as hasFile, Zt as licenseFileOf, _ as workspaceProtocol, _n as npmDrift, _t as pagesCalls, a as listRules, an as homePackage, ar as runGit, at as swallowsTests, b as yamlFaults, bn as SERVICE_PACKAGE, bt as publishTextSafe, c as runCli, cn as reposOf, cr as parseConfig, ct as isPinned, d as HOOK_MARKER, dn as HOMES, dt as pagesAfterRelease, en as homeModule, er as lineOf, et as playwrightInstall, f as NO_READ_LINE, fn as MAP_RULE, ft as repositoryOfRemote, g as RULES, gn as mergeHomes, gt as PAGES_WORKFLOWS, h as prePush, hn as mapText, ht as pushMainOnly, i as formatResult, in as declaredName, ir as replaceLine, it as startsTests, j as testsRequired, jn as SECURITY_SCAN_COMMIT, jt as privateTextBreaks, k as scriptsOf, kn as sharedCi, kt as privateNamesFile, l as runFix, ln as signaturesOf, lt as pinnedGitDeps, m as installHook, mn as mapMarkdown, mt as scheduleMinute, n as annotations, nn as moduleUses, nr as parseJsonc, nt as jobFails, o as readConfig, on as messageOf, or as specifiersOf, ot as pipeFails, p as PRE_PUSH_HOOK, pn as findHomes, pt as runnerBudget, q as reachOf, qn as DEPENDENCY_FIELDS, qt as apiReportScript, r as createContext, rn as modulesOf, rr as readJsonc, rt as parseAdvisory, s as runChecks, sn as repoOf, sr as defaultOptions, st as isGitSpecifier, t as USAGE, tn as moduleMessage, tr as matchesAny, tt as hiddenFailures, u as summaryMarkdown, un as HOME_EXPORTS, ut as siteCheckInCi, v as GITHUB_YAML, vn as npmNames, vt as pagesSite, w as IGNORE_AFTER, wn as tsconfigTest, wt as PRIVATE_NAMES_FILE_CONFIG, x as namedVersions, xn as runCalls, xt as packNoBuildinfo, y as workflowParses, yn as readOverlay, yt as exportsRequire, z as roadmapOfLine, zn as gateTrigger, zt as nameMatches } from "./run-BrCo6Uuy.js";
1
+ import { $ as unreleasedChangeRule, $n as hasFile, $t as licenseFileOf, A as typedFiles, An as callsSharedCi, At as privateNamesFiles, B as roadmapParses, Bn as convertGate, Bt as mergePrivateNames, C as versionTitle, Cn as runCalls, Ct as HOME_PATTERNS, D as typedScripts, Dn as SHARED_ACTIONS, Dt as invalidPatternBreaks, E as trustPolicy, En as tsconfigTest, Et as PRIVATE_PATTERNS_VARIABLE, F as HOME_TIMEOUT_MS, Fn as SECURITY_TIMEOUT_MINUTES, Ft as firstNameMatch, G as publishedMinor, Gn as readAction, Gt as REAL_COMPARE, H as releaseFiles, Hn as prPathFilters, Ht as parsePrivateNames, I as blockHash, In as securityCallers, It as isAllowedHit, J as NPM_REGISTRY, Jn as cuePreset, Jt as coverageProvider, K as publishedMinorRule, Kn as readWorkflow, Kt as hasImportMetaMain, L as githubFetch, Ln as securityOneJob, Lt as isCommonUse, M as isSourcePath, Mn as setupCue, Mt as privateTextBreaks, N as pathsOf, Nn as SECURITY_SCAN_COMMIT, Nt as PRIVATE_NAME_LIST, O as configsOfScript, On as SHARED_CI, Ot as noLocalPaths, P as sourceMain, Pn as SECURITY_SCAN_INPUTS, Pt as PrivateNameListError, Q as unreleasedChange, Qn as codePackages, Qt as licenseFile, R as sharedDocsRule, Rn as withOneJob, Rt as lineNameHit, S as setVersions, Sn as SERVICE_PACKAGE, St as DEFAULT_ALLOWED, T as TRAIN_SCOPES, Tn as hasTests, Tt as PRIVATE_NAMES_FILE_VARIABLE, U as lockedVersions, Un as summaryName, Ut as pathNameHit, V as requiredScripts, Vn as gateTrigger, Vt as nameMatches, W as minorOf, Wn as gateAfterCancel, Wt as noBuildOutput, X as UNSHIPPED_FILES, Xn as RULE_WARN_DAYS, Xt as LICENSE_TEXTS, Y as SHIPPED_FIELDS, Yn as DEPENDENCY_FIELDS, Yt as apiReportScript, Z as npmLookup, Zn as cleanPath, Zt as authorOf, _ as workspaceProtocol, _n as mapText, _t as pagesCalls, a as listRules, an as modulesOf, ar as readJsonc, at as swallowsTests, b as yamlFaults, bn as npmNames, bt as publishTextSafe, c as runCli, cn as messageOf, cr as specifiersOf, ct as isPinned, d as HOOK_MARKER, dn as signaturesOf, dt as pagesAfterRelease, en as mitText, er as inFolder, et as playwrightInstall, f as NO_READ_LINE, fn as HOME_EXPORTS, ft as repositoryOfRemote, g as RULES, gn as mapMarkdown, gt as PAGES_WORKFLOWS, h as prePush, hn as findHomes, ht as pushMainOnly, i as formatResult, in as moduleUses, ir as parseJsonc, it as startsTests, j as testsRequired, jn as sharedCi, jt as privatePatterns, k as scriptsOf, kn as SHARED_WORKFLOWS, kt as privateNamesFile, l as runFix, ln as repoOf, lr as defaultOptions, lt as pinnedGitDeps, m as installHook, mn as MAP_RULE, mt as scheduleMinute, n as annotations, nn as homeModule, nr as lineOf, nt as jobFails, o as readConfig, on as declaredName, or as replaceLine, ot as pipeFails, p as PRE_PUSH_HOOK, pn as HOMES, pt as runnerBudget, q as reachOf, qn as STRICT_OPTIONS, qt as mainCheck, r as createContext, rn as moduleMessage, rr as matchesAny, rt as parseAdvisory, s as runChecks, sn as homePackage, sr as runGit, st as isGitSpecifier, t as USAGE, tn as repositoryIsPublic, tr as keyLine, tt as hiddenFailures, u as summaryMarkdown, un as reposOf, ur as parseConfig, ut as siteCheckInCi, v as GITHUB_YAML, vn as mergeHomes, vt as pagesSite, w as IGNORE_AFTER, wn as serviceRunMain, wt as PRIVATE_NAMES_FILE_CONFIG, x as namedVersions, xn as readOverlay, xt as packNoBuildinfo, y as workflowParses, yn as npmDrift, yt as exportsRequire, z as roadmapOfLine, zn as ACTIONS_COMMIT, zt as lineNameHits } from "./run-Ccfopw7M.js";
2
2
  import { OWNERS, ownerOf, ownersOf, sharedNames } from "./owners.js";
3
3
  import { i as packageFolders, n as globFolders, r as globToRegExp, s as workspaceGlobs } from "./workspace-Cx7p7bWn.js";
4
4
  // src/release-text.ts
@@ -66,6 +66,6 @@ function releaseNotes(name, version, changelog) {
66
66
  if (section.length <= 1e5) return section;
67
67
  return `${section.slice(0, MAX_NOTES)}\n\n(The CHANGELOG.md of \`${name}\` has the full text.)`;
68
68
  }
69
- export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, OWNERS, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, RULE_WARN_DAYS, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, coverageProvider, createContext, cuePreset, declaredName, defaultOptions, exportsRequire, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, hiddenFailures, homeModule, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, jobFails, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, moduleMessage, moduleUses, modulesOf, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmDrift, npmLookup, npmNames, npmUrl, ownerOf, ownersOf, packNoBuildinfo, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseAdvisory, parseConfig, parseJsonc, parsePrivateNames, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, playwrightInstall, prPathFilters, prePush, privateNamesFile, privatePatterns, privateTextBreaks, publishTextSafe, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readAction, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, reposOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, sharedNames, signaturesOf, siteCheckInCi, sourceMain, specifiersOf, startsTests, summaryMarkdown, summaryName, swallowsTests, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
69
+ export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, OWNERS, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, RULE_WARN_DAYS, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, coverageProvider, createContext, cuePreset, declaredName, defaultOptions, exportsRequire, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, hiddenFailures, homeModule, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, jobFails, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, mergePrivateNames, messageOf, minorOf, mitText, moduleMessage, moduleUses, modulesOf, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmDrift, npmLookup, npmNames, npmUrl, ownerOf, ownersOf, packNoBuildinfo, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseAdvisory, parseConfig, parseJsonc, parsePrivateNames, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, playwrightInstall, prPathFilters, prePush, privateNamesFile, privateNamesFiles, privatePatterns, privateTextBreaks, publishTextSafe, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readAction, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, reposOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, sharedNames, signaturesOf, siteCheckInCi, sourceMain, specifiersOf, startsTests, summaryMarkdown, summaryName, swallowsTests, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
70
70
 
71
71
  //# sourceMappingURL=index.js.map
@@ -3,7 +3,7 @@ import { OWNERS } from "./owners.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { spawnSync } from "node:child_process";
5
5
  import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
6
- import { basename, dirname, extname, isAbsolute, join, posix, relative, resolve } from "node:path";
6
+ import { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve } from "node:path";
7
7
  import { SECRET_SHAPES, findSecretShapes, findSecretShapesInValue, redactSecretShapes } from "@mark1russell7/text/redact";
8
8
  import { createHash } from "node:crypto";
9
9
  import { parseAllDocuments } from "yaml";
@@ -97,6 +97,8 @@ function replaceLine(text, line, lines) {
97
97
  }
98
98
  /** The days from the release of a new rule to its day `failsFrom`, at the least. In this time the owners fix the breaks. */
99
99
  const RULE_WARN_DAYS = 14;
100
+ /** This function tells if the environment is a CI run: `CI` is `true` or `1`, or `GITHUB_ACTIONS` is `true`. */
101
+ const isCi = (env) => ["true", "1"].includes((env["CI"] ?? "").toLowerCase()) || env["GITHUB_ACTIONS"] === "true";
100
102
  /** The fields of `package.json` that hold dependencies. */
101
103
  const DEPENDENCY_FIELDS = [
102
104
  "dependencies",
@@ -13831,6 +13833,27 @@ function parsePrivateNames(text) {
13831
13833
  allow: allow.map((entry, index) => allowedOf(entry, `allow entry ${String(index + 1)} of ${PRIVATE_NAME_LIST}`, ids))
13832
13834
  };
13833
13835
  }
13836
+ /**
13837
+ * This function merges private name lists into one list, in order. The names of each list come after the names of the
13838
+ * lists before it. Thus the index of a name in a result counts across the lists. `parsePrivateNames` makes sure that an
13839
+ * entry of `allow` refers to a name of its own list. The function throws a `PrivateNameListError` when two lists have
13840
+ * the same id. Then an entry of `allow` can refer to the two names.
13841
+ */
13842
+ function mergePrivateNames(lists) {
13843
+ const ids = /* @__PURE__ */ new Set();
13844
+ const names = [];
13845
+ lists.forEach((list, at) => {
13846
+ for (const rule of list.names) {
13847
+ if (ids.has(rule.id)) throw new PrivateNameListError(`name ${String(names.length + 1)} of ${PRIVATE_NAME_LIST} (list ${String(at + 1)}): the id is also the id of a name of an earlier list`);
13848
+ ids.add(rule.id);
13849
+ names.push(rule);
13850
+ }
13851
+ });
13852
+ return {
13853
+ names,
13854
+ allow: lists.flatMap((list) => list.allow)
13855
+ };
13856
+ }
13834
13857
  /** The words before a name in code: a declaration, a type or an operator. */
13835
13858
  const CODE_BEFORE = /\b(class|interface|type|new|extends|implements|const|let|enum|struct|typeof|instanceof|as)\s+$/;
13836
13859
  /** A line of code that imports or exports names. */
@@ -14140,6 +14163,22 @@ function privateNamesFile(env, git) {
14140
14163
  ])?.trim() ?? "";
14141
14164
  return fromGit === "" ? void 0 : fromGit;
14142
14165
  }
14166
+ /**
14167
+ * This function gives the paths of the private name lists, in order. The environment variable
14168
+ * `CONVENTIONS_PRIVATE_NAMES_FILE` has priority. It has one path, or more paths with `separator` between them. The
14169
+ * default `separator` is the `delimiter` of `node:path`: `;` on Windows, `:` on other systems. Else, each value of the git
14170
+ * configuration `conventions.privateNamesFile` is a path. The function gives an empty array when neither has a value.
14171
+ */
14172
+ function privateNamesFiles(env, git, separator = delimiter) {
14173
+ const fromEnv = (env["CONVENTIONS_PRIVATE_NAMES_FILE"] ?? "").split(separator).map((path) => path.trim()).filter((path) => path !== "");
14174
+ if (fromEnv.length > 0) return fromEnv;
14175
+ return (git([
14176
+ "config",
14177
+ "--type=path",
14178
+ "--get-all",
14179
+ "conventions.privateNamesFile"
14180
+ ]) ?? "").split(/\r?\n/).map((path) => path.trim()).filter((path) => path !== "");
14181
+ }
14143
14182
  /** This function gives a break for each private pattern that is not a valid regular expression. A break does not show the pattern. */
14144
14183
  function invalidPatternBreaks(patterns) {
14145
14184
  return patterns.filter((pattern) => compilePattern(pattern.source) === void 0).map((pattern) => ({
@@ -14265,6 +14304,10 @@ const noLocalPaths = {
14265
14304
  }
14266
14305
  for (const change of changeTexts(context)) add(textBreaks(change.name, change.text, matchers, {}));
14267
14306
  return breaks;
14307
+ },
14308
+ noRead(context) {
14309
+ if (!isCi(context.env) || privatePatterns(context.env).length > 0) return void 0;
14310
+ return `CI gives no ${PRIVATE_PATTERNS_VARIABLE}, so the rule did not look for private names. It looked only for home folders and the patterns of its options.`;
14268
14311
  }
14269
14312
  };
14270
14313
  // src/tsconfig.ts
@@ -19583,30 +19626,48 @@ function repoOfPush(options) {
19583
19626
  * This function is the command `conventions pre-push`. It examines each new commit of the push: its message, the paths
19584
19627
  * that it adds or changes, and each line that it adds. It writes the breaks to `stderr`, and gives the exit code: 1 on a
19585
19628
  * break, 0 on a pass. With no private name list and no private pattern, it writes the line `NO_READ_LINE` and gives 0.
19629
+ * The settings can name more than one list (`privateNamesFiles`). The command then examines the merge of the lists.
19630
+ *
19631
+ * With the option `base`, the command is the check of a change in CI. It examines each commit of `base..head` with
19632
+ * the same rules, and the title and the body of the pull request of the run. A message then tells that the check fails,
19633
+ * not that the push stops.
19586
19634
  */
19587
19635
  function prePush(options, io) {
19588
19636
  const readFile = options.readFile ?? ((path) => readFileSync(path, "utf8"));
19589
- const file = privateNamesFile(options.env, options.git);
19637
+ const change = options.base !== void 0;
19638
+ const stops = change ? "The check fails." : "The push stops.";
19639
+ const files = privateNamesFiles(options.env, options.git);
19590
19640
  const patterns = privatePatterns(options.env);
19591
- if (file === void 0 && patterns.length === 0) {
19641
+ if (files.length === 0 && patterns.length === 0) {
19592
19642
  io.stderr(`${NO_READ_LINE}\n`);
19593
19643
  return 0;
19594
19644
  }
19595
19645
  let names;
19596
- if (file !== void 0) {
19597
- const source = (options.env["CONVENTIONS_PRIVATE_NAMES_FILE"]?.trim() ?? "") !== "" ? PRIVATE_NAMES_FILE_VARIABLE : `the git config ${PRIVATE_NAMES_FILE_CONFIG}`;
19598
- let text;
19599
- try {
19600
- text = readFile(resolve(options.root, file));
19601
- } catch (error) {
19602
- io.stderr(`conventions pre-push: Cannot read the private name list that ${source} names: ${readReason(error)}. Correct the setting or the file. The push stops.\n`);
19603
- return 1;
19646
+ if (files.length > 0) {
19647
+ const source = privateNamesFiles({ ["CONVENTIONS_PRIVATE_NAMES_FILE"]: options.env["CONVENTIONS_PRIVATE_NAMES_FILE"] }, () => void 0).length > 0 ? PRIVATE_NAMES_FILE_VARIABLE : `the git config ${PRIVATE_NAMES_FILE_CONFIG}`;
19648
+ const lists = [];
19649
+ for (const [at, file] of files.entries()) {
19650
+ const which = files.length === 1 ? `the private name list that ${source} names` : `private name list ${String(at + 1)} of the ${String(files.length)} that ${source} names`;
19651
+ let text;
19652
+ try {
19653
+ text = readFile(resolve(options.root, file));
19654
+ } catch (error) {
19655
+ io.stderr(`conventions pre-push: Cannot read ${which}: ${readReason(error)}. Correct the setting or the file. ${stops}\n`);
19656
+ return 1;
19657
+ }
19658
+ try {
19659
+ lists.push(parsePrivateNames(text));
19660
+ } catch (error) {
19661
+ const reason = error instanceof PrivateNameListError ? error.reason : "the parse failed";
19662
+ io.stderr(`conventions pre-push: ${which.charAt(0).toUpperCase()}${which.slice(1)} is not valid: ${reason}. Correct the file. ${stops}\n`);
19663
+ return 1;
19664
+ }
19604
19665
  }
19605
19666
  try {
19606
- names = parsePrivateNames(text);
19667
+ names = mergePrivateNames(lists);
19607
19668
  } catch (error) {
19608
- const reason = error instanceof PrivateNameListError ? error.reason : "the parse failed";
19609
- io.stderr(`conventions pre-push: The private name list that ${source} names is not valid: ${reason}. Correct the file. The push stops.\n`);
19669
+ const reason = error instanceof PrivateNameListError ? error.reason : "the merge failed";
19670
+ io.stderr(`conventions pre-push: The private name lists that ${source} names are not valid together: ${reason}. Give each name its own id. ${stops}\n`);
19610
19671
  return 1;
19611
19672
  }
19612
19673
  }
@@ -19618,7 +19679,21 @@ function prePush(options, io) {
19618
19679
  const home = homeSettings(options.root, readFile);
19619
19680
  const breaks = invalidPatternBreaks(patterns);
19620
19681
  const commits = /* @__PURE__ */ new Set();
19621
- for (const line of options.input.split(/\r?\n/)) {
19682
+ if (options.base !== void 0) {
19683
+ const head = options.head ?? "HEAD";
19684
+ const listed = options.git([
19685
+ "rev-list",
19686
+ head,
19687
+ `^${options.base}`,
19688
+ "--"
19689
+ ]);
19690
+ if (listed === void 0) {
19691
+ io.stderr(`conventions pre-push: git cannot list the commits of ${options.base}..${head}. ${stops}\n`);
19692
+ return 1;
19693
+ }
19694
+ for (const sha of listed.split(/\r?\n/)) if (SHA.test(sha.trim())) commits.add(sha.trim());
19695
+ }
19696
+ for (const line of change ? [] : options.input.split(/\r?\n/)) {
19622
19697
  if (line.trim() === "") continue;
19623
19698
  const [localRef, localSha, , remoteSha] = line.trim().split(/\s+/);
19624
19699
  if (localSha === void 0 || remoteSha === void 0 || !SHA.test(localSha) || !SHA.test(remoteSha)) {
@@ -19647,22 +19722,34 @@ function prePush(options, io) {
19647
19722
  for (const sha of commits) {
19648
19723
  const read = readCommit(sha, privates, home, repo, options.git);
19649
19724
  if (read === void 0) {
19650
- io.stderr(`conventions pre-push: git cannot show the commit ${sha.slice(0, 12)}. The push stops.\n`);
19725
+ io.stderr(`conventions pre-push: git cannot show the commit ${sha.slice(0, 12)}. ${stops}\n`);
19651
19726
  return 1;
19652
19727
  }
19653
19728
  for (const item of read.breaks) breaks.push(item);
19654
19729
  lines += read.lines;
19655
19730
  }
19731
+ const pullRequest = change ? pullRequestOfRun(options.env) : void 0;
19732
+ let texts = 0;
19733
+ for (const [name, text] of [["pull request title", pullRequest?.title], ["pull request body", pullRequest?.body]]) {
19734
+ if (text === void 0) continue;
19735
+ texts += 1;
19736
+ for (const item of privateTextBreaks(name, text, privates, {
19737
+ allow: home.allow,
19738
+ homes: home.on
19739
+ })) breaks.push(item);
19740
+ lines += text === "" ? 0 : text.replace(/\r?\n$/, "").split(/\r?\n/).length;
19741
+ }
19742
+ const read = `${String(commits.size)} commits${texts > 0 ? " and the text of the pull request" : ""}, ${String(lines)} lines read`;
19656
19743
  if (breaks.length === 0) {
19657
- io.stderr(`conventions pre-push: ${String(commits.size)} commits, ${String(lines)} lines read, 0 breaks.\n`);
19744
+ io.stderr(`conventions pre-push: ${read}, 0 breaks.\n`);
19658
19745
  return 0;
19659
19746
  }
19660
- const out = [`conventions pre-push: ${String(commits.size)} commits, ${String(lines)} lines read, ${String(breaks.length)} breaks. The push stops.`];
19747
+ const out = [`conventions pre-push: ${read}, ${String(breaks.length)} breaks. ${stops}`];
19661
19748
  for (const item of breaks) {
19662
19749
  out.push(` ${placeOf$1(item)} ${item.message}`);
19663
19750
  if (item.fix !== void 0) out.push(` fix: ${item.fix}`);
19664
19751
  }
19665
- out.push("Change the commits (git commit --amend, or git rebase), and push again.");
19752
+ out.push(change ? "Remove each text from the commits (git commit --amend, or git rebase) and from the pull request. Then push again." : "Change the commits (git commit --amend, or git rebase), and push again.");
19666
19753
  io.stderr(`${out.join("\n")}\n`);
19667
19754
  return 1;
19668
19755
  }
@@ -19700,8 +19787,6 @@ if [ -x "$bin" ] && node -e 'let v;try{v=JSON.parse(require("fs").readFileSync(p
19700
19787
  fi
19701
19788
  exec pnpm dlx @mark1russell7/conventions@${ownVersion()} pre-push "$@"
19702
19789
  `;
19703
- /** This function tells if the environment is a CI run. */
19704
- const isCi = (env) => ["true", "1"].includes((env["CI"] ?? "").toLowerCase()) || env["GITHUB_ACTIONS"] === "true";
19705
19790
  /**
19706
19791
  * This function is the command `conventions hook install`. It writes the hook `pre-push` into the hooks folder of git,
19707
19792
  * so it uses the folder of `core.hooksPath` and works in a worktree. It keeps a hook that does not have `HOOK_MARKER`, and writes a warning.
@@ -19872,12 +19957,19 @@ function runChecks(options) {
19872
19957
  const warns = breaks.length > 0 && rule.failsFrom !== void 0 && today < rule.failsFrom;
19873
19958
  const reason = warns ? [ruleConfig.reason, `The rule fails from ${rule.failsFrom ?? ""}.`].filter((text) => text !== void 0).join(" ") : ruleConfig.reason;
19874
19959
  const note = reason === void 0 ? {} : { note: reason };
19960
+ let noRead;
19961
+ try {
19962
+ noRead = rule.noRead?.(context, ruleConfig.options);
19963
+ } catch (error) {
19964
+ noRead = `the rule cannot tell what it read: ${error instanceof Error ? error.message : String(error)}`;
19965
+ }
19875
19966
  results.push({
19876
19967
  ...base,
19877
19968
  status: breaks.length === 0 ? "pass" : warns ? "warn" : "break",
19878
19969
  breaks,
19879
19970
  ignored,
19880
- ...note
19971
+ ...note,
19972
+ ...noRead === void 0 ? {} : { noRead }
19881
19973
  });
19882
19974
  }
19883
19975
  return {
@@ -19939,7 +20031,8 @@ const placeOf = (item) => item.line === void 0 ? item.file : `${item.file}:${ite
19939
20031
  function formatResult(result) {
19940
20032
  const count = (status) => result.rules.filter((rule) => rule.status === status).length;
19941
20033
  const breaks = result.rules.filter((rule) => rule.status === "break").reduce((sum, rule) => sum + rule.breaks.length, 0);
19942
- const out = [`conventions: ${result.rules.length} rules: ${count("pass")} pass, ${count("break")} with ${breaks} break(s), ${count("warn")} warn, ${count("off")} off, ${count("skipped")} skipped, ${count("error")} error(s).`, ""];
20034
+ const noReads = result.rules.filter((rule) => rule.noRead !== void 0).length;
20035
+ const out = [`conventions: ${result.rules.length} rules: ${count("pass")} pass, ${count("break")} with ${breaks} break(s), ${count("warn")} warn, ${count("off")} off, ${count("skipped")} skipped, ${count("error")} error(s)${noReads > 0 ? `, ${noReads} with no read` : ""}.`, ""];
19943
20036
  const label = {
19944
20037
  pass: "pass ",
19945
20038
  break: "BREAK",
@@ -19951,6 +20044,7 @@ function formatResult(result) {
19951
20044
  for (const rule of result.rules) {
19952
20045
  const extra = rule.ignored > 0 ? ` (${rule.ignored} ignored: ${rule.note ?? ""})` : rule.note !== void 0 && rule.status !== "pass" ? ` (${rule.note})` : "";
19953
20046
  out.push(`${label[rule.status]} ${rule.id}${rule.breaks.length > 0 ? `: ${rule.breaks.length} break(s)` : ""}${extra}`);
20047
+ if (rule.noRead !== void 0) out.push(` NO READ: ${rule.noRead}`);
19954
20048
  for (const item of rule.breaks.slice(0, MAX_SHOWN)) {
19955
20049
  out.push(` ${placeOf(item)} ${item.message}${(item.edits ?? []).length > 0 ? " (conventions fix writes the fix)" : ""}`);
19956
20050
  if (item.fix !== void 0) out.push(` fix: ${item.fix}`);
@@ -19974,7 +20068,8 @@ function summaryMarkdown(result) {
19974
20068
  for (const rule of result.rules) {
19975
20069
  const shown = rule.status === "break" ? `${rule.breaks.length} break(s)` : rule.status === "warn" ? `warn: ${rule.breaks.length} break(s)` : rule.status;
19976
20070
  const note = rule.ignored > 0 ? `${rule.ignored} ignored: ${rule.note ?? ""}` : rule.note ?? "";
19977
- out.push(`| \`${rule.id}\` | ${shown} | ${cell(note)} |`);
20071
+ const noRead = rule.noRead === void 0 ? "" : `no read: ${rule.noRead}`;
20072
+ out.push(`| \`${rule.id}\` | ${shown}${noRead === "" ? "" : ", no read"} | ${cell([noRead, note].filter((text) => text !== "").join(" "))} |`);
19978
20073
  }
19979
20074
  const broken = result.rules.filter((rule) => rule.breaks.length > 0);
19980
20075
  for (const rule of broken) {
@@ -19990,13 +20085,17 @@ const escapeData = (text) => text.replace(/%/g, "%25").replace(/\r/g, "%0D").rep
19990
20085
  const escapeProperty = (text) => escapeData(text).replace(/:/g, "%3A").replace(/,/g, "%2C");
19991
20086
  /**
19992
20087
  * This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request.
19993
- * A break of a rule that only warns gives a `::warning` command.
20088
+ * A break of a rule that only warns gives a `::warning` command. A rule with no read of a part gives a `::warning` command
20089
+ * with the reason.
19994
20090
  */
19995
20091
  function annotations(result) {
19996
20092
  const out = [];
19997
- for (const rule of result.rules) for (const item of rule.breaks) {
19998
- const line = item.line === void 0 ? "" : `,line=${item.line}`;
19999
- out.push(`::${rule.status === "warn" ? "warning" : "error"} file=${escapeProperty(item.file)}${line},title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`${item.message} Fix: ${item.fix ?? rule.fix}`)}`);
20093
+ for (const rule of result.rules) {
20094
+ if (rule.noRead !== void 0) out.push(`::warning title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`No read: ${rule.noRead}`)}`);
20095
+ for (const item of rule.breaks) {
20096
+ const line = item.line === void 0 ? "" : `,line=${item.line}`;
20097
+ out.push(`::${rule.status === "warn" ? "warning" : "error"} file=${escapeProperty(item.file)}${line},title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`${item.message} Fix: ${item.fix ?? rule.fix}`)}`);
20098
+ }
20000
20099
  }
20001
20100
  return out.length === 0 ? "" : `${out.join("\n")}\n`;
20002
20101
  }
@@ -20023,6 +20122,7 @@ const USAGE = `Usage: conventions check [options]
20023
20122
  conventions --list
20024
20123
  conventions map [words] [--markdown | --json] [--overlay <file>]
20025
20124
  conventions pre-push <remote> [<url>]
20125
+ conventions pre-push --base <ref> [--head <ref>]
20026
20126
  conventions hook install
20027
20127
 
20028
20128
  check Start each rule. Exit code 1 when a rule has a break.
@@ -20035,7 +20135,10 @@ const USAGE = `Usage: conventions check [options]
20035
20135
  lines. Exit code 1 on a break. The list is the JSON file of CONVENTIONS_PRIVATE_NAMES_FILE, else
20036
20136
  of the git config conventions.privateNamesFile. CONVENTIONS_PRIVATE_PATTERNS adds one regular
20037
20137
  expression on each line. With neither, it writes a "No read" line and gives 0.
20038
- hook install Write the hook pre-push into the hooks folder of git. It keeps a hook that it did not write.
20138
+ With --base, it is the check of a change in CI. It examines each commit of <base>..<head>
20139
+ (the default head is HEAD) with the same rules, and the title and the body of the pull
20140
+ request of the run. It reads no standard input.
20141
+ hook install Write the hook pre-push into the hooks folder of git. It keeps a hook that it did not write.
20039
20142
  In CI, or outside a git repository, it does nothing.
20040
20143
 
20041
20144
  --root <folder> The root of the repository. The default is the current folder.
@@ -20211,20 +20314,41 @@ function runMap(args, io) {
20211
20314
  else io.stdout(mapText(found));
20212
20315
  return 0;
20213
20316
  }
20214
- /** The command `pre-push`: the arguments of the git hook, the remote and its URL. */
20317
+ /**
20318
+ * The command `pre-push`: the arguments of the git hook, the remote and its URL. Or the options `--base` and `--head` of
20319
+ * the check of a change in CI. Then the remote is `origin`.
20320
+ */
20215
20321
  function runPrePush(args, io) {
20216
- const remote = args[0];
20217
- if (remote === void 0 || remote.startsWith("-") || args.length > 2) {
20218
- io.stderr(`conventions: The command pre-push takes the name of the remote and, after it, its URL.\n\n${USAGE}`);
20322
+ const positional = [];
20323
+ const range = {};
20324
+ let usage = false;
20325
+ for (let index = 0; index < args.length; index++) {
20326
+ const arg = args[index] ?? "";
20327
+ if (arg === "--base" || arg === "--head") {
20328
+ const value = args[++index];
20329
+ if (value === void 0 || value === "" || value.startsWith("-")) usage = true;
20330
+ else range[arg === "--base" ? "base" : "head"] = value;
20331
+ } else if (arg.startsWith("-")) usage = true;
20332
+ else positional.push(arg);
20333
+ }
20334
+ const { base, head } = range;
20335
+ const remote = base === void 0 ? positional[0] : "origin";
20336
+ if (usage || remote === void 0 || (base === void 0 ? head !== void 0 || positional.length > 2 : positional.length > 0)) {
20337
+ io.stderr(`conventions: The command pre-push takes the name of the remote and, after it, its URL. In CI, it takes --base <ref> and, as an option, --head <ref>.\n\n${USAGE}`);
20219
20338
  return 2;
20220
20339
  }
20221
20340
  const top = runGit(io.cwd, ["rev-parse", "--show-toplevel"])?.trim() ?? "";
20222
20341
  const root = top === "" ? io.cwd : top;
20223
- const url = args[1];
20342
+ const url = base === void 0 ? positional[1] : void 0;
20343
+ const change = base === void 0 ? {} : {
20344
+ base,
20345
+ ...head === void 0 ? {} : { head }
20346
+ };
20224
20347
  return prePush({
20225
20348
  remote,
20226
20349
  ...url === void 0 ? {} : { url },
20227
- input: io.stdin ?? "",
20350
+ ...change,
20351
+ input: base === void 0 ? io.stdin ?? "" : "",
20228
20352
  env: io.env,
20229
20353
  root,
20230
20354
  git: (gitArgs) => runGit(root, gitArgs)
@@ -20242,6 +20366,6 @@ function runHook(args, io) {
20242
20366
  git: (gitArgs) => runGit(io.cwd, gitArgs)
20243
20367
  }, io);
20244
20368
  }
20245
- export { unreleasedChangeRule as $, keyLine as $n, repositoryIsPublic as $t, typedFiles as A, setupCue as An, privatePatterns as At, roadmapParses as B, prPathFilters as Bn, parsePrivateNames as Bt, versionTitle as C, hasTests as Cn, HOME_PATTERNS as Ct, typedScripts as D, SHARED_WORKFLOWS as Dn, invalidPatternBreaks as Dt, trustPolicy as E, SHARED_CI as En, PRIVATE_PATTERNS_VARIABLE as Et, HOME_TIMEOUT_MS as F, securityOneJob as Fn, isAllowedHit as Ft, publishedMinor as G, STRICT_OPTIONS as Gn, mainCheck as Gt, releaseFiles as H, gateAfterCancel as Hn, noBuildOutput as Ht, blockHash as I, withOneJob as In, isCommonUse as It, NPM_REGISTRY as J, RULE_WARN_DAYS as Jn, LICENSE_TEXTS as Jt, publishedMinorRule as K, cuePreset as Kn, coverageProvider as Kt, githubFetch as L, ACTIONS_COMMIT as Ln, lineNameHit as Lt, isSourcePath as M, SECURITY_SCAN_INPUTS as Mn, PRIVATE_NAME_LIST as Mt, pathsOf as N, SECURITY_TIMEOUT_MINUTES as Nn, PrivateNameListError as Nt, configsOfScript as O, callsSharedCi as On, noLocalPaths as Ot, sourceMain as P, securityCallers as Pn, firstNameMatch as Pt, unreleasedChange as Q, inFolder as Qn, mitText as Qt, sharedDocsRule as R, convertGate as Rn, lineNameHits as Rt, setVersions as S, serviceRunMain as Sn, DEFAULT_ALLOWED as St, TRAIN_SCOPES as T, SHARED_ACTIONS as Tn, PRIVATE_NAMES_FILE_VARIABLE as Tt, lockedVersions as U, readAction as Un, REAL_COMPARE as Ut, requiredScripts as V, summaryName as Vn, pathNameHit as Vt, minorOf as W, readWorkflow as Wn, hasImportMetaMain as Wt, UNSHIPPED_FILES as X, codePackages as Xn, licenseFile as Xt, SHIPPED_FIELDS as Y, cleanPath as Yn, authorOf as Yt, npmLookup as Z, hasFile as Zn, licenseFileOf as Zt, workspaceProtocol as _, npmDrift as _n, pagesCalls as _t, listRules as a, homePackage as an, runGit as ar, swallowsTests as at, yamlFaults as b, SERVICE_PACKAGE as bn, publishTextSafe as bt, runCli as c, reposOf as cn, parseConfig as cr, isPinned as ct, HOOK_MARKER as d, HOMES as dn, pagesAfterRelease as dt, homeModule as en, lineOf as er, playwrightInstall as et, NO_READ_LINE as f, MAP_RULE as fn, repositoryOfRemote as ft, RULES as g, mergeHomes as gn, PAGES_WORKFLOWS as gt, prePush as h, mapText as hn, pushMainOnly as ht, formatResult as i, declaredName as in, replaceLine as ir, startsTests as it, testsRequired as j, SECURITY_SCAN_COMMIT as jn, privateTextBreaks as jt, scriptsOf as k, sharedCi as kn, privateNamesFile as kt, runFix as l, signaturesOf as ln, pinnedGitDeps as lt, installHook as m, mapMarkdown as mn, scheduleMinute as mt, annotations as n, moduleUses as nn, parseJsonc as nr, jobFails as nt, readConfig as o, messageOf as on, specifiersOf as or, pipeFails as ot, PRE_PUSH_HOOK as p, findHomes as pn, runnerBudget as pt, reachOf as q, DEPENDENCY_FIELDS as qn, apiReportScript as qt, createContext as r, modulesOf as rn, readJsonc as rr, parseAdvisory as rt, runChecks as s, repoOf as sn, defaultOptions as sr, isGitSpecifier as st, USAGE as t, moduleMessage as tn, matchesAny as tr, hiddenFailures as tt, summaryMarkdown as u, HOME_EXPORTS as un, siteCheckInCi as ut, GITHUB_YAML as v, npmNames as vn, pagesSite as vt, IGNORE_AFTER as w, tsconfigTest as wn, PRIVATE_NAMES_FILE_CONFIG as wt, namedVersions as x, runCalls as xn, packNoBuildinfo as xt, workflowParses as y, readOverlay as yn, exportsRequire as yt, roadmapOfLine as z, gateTrigger as zn, nameMatches as zt };
20369
+ export { unreleasedChangeRule as $, hasFile as $n, licenseFileOf as $t, typedFiles as A, callsSharedCi as An, privateNamesFiles as At, roadmapParses as B, convertGate as Bn, mergePrivateNames as Bt, versionTitle as C, runCalls as Cn, HOME_PATTERNS as Ct, typedScripts as D, SHARED_ACTIONS as Dn, invalidPatternBreaks as Dt, trustPolicy as E, tsconfigTest as En, PRIVATE_PATTERNS_VARIABLE as Et, HOME_TIMEOUT_MS as F, SECURITY_TIMEOUT_MINUTES as Fn, firstNameMatch as Ft, publishedMinor as G, readAction as Gn, REAL_COMPARE as Gt, releaseFiles as H, prPathFilters as Hn, parsePrivateNames as Ht, blockHash as I, securityCallers as In, isAllowedHit as It, NPM_REGISTRY as J, cuePreset as Jn, coverageProvider as Jt, publishedMinorRule as K, readWorkflow as Kn, hasImportMetaMain as Kt, githubFetch as L, securityOneJob as Ln, isCommonUse as Lt, isSourcePath as M, setupCue as Mn, privateTextBreaks as Mt, pathsOf as N, SECURITY_SCAN_COMMIT as Nn, PRIVATE_NAME_LIST as Nt, configsOfScript as O, SHARED_CI as On, noLocalPaths as Ot, sourceMain as P, SECURITY_SCAN_INPUTS as Pn, PrivateNameListError as Pt, unreleasedChange as Q, codePackages as Qn, licenseFile as Qt, sharedDocsRule as R, withOneJob as Rn, lineNameHit as Rt, setVersions as S, SERVICE_PACKAGE as Sn, DEFAULT_ALLOWED as St, TRAIN_SCOPES as T, hasTests as Tn, PRIVATE_NAMES_FILE_VARIABLE as Tt, lockedVersions as U, summaryName as Un, pathNameHit as Ut, requiredScripts as V, gateTrigger as Vn, nameMatches as Vt, minorOf as W, gateAfterCancel as Wn, noBuildOutput as Wt, UNSHIPPED_FILES as X, RULE_WARN_DAYS as Xn, LICENSE_TEXTS as Xt, SHIPPED_FIELDS as Y, DEPENDENCY_FIELDS as Yn, apiReportScript as Yt, npmLookup as Z, cleanPath as Zn, authorOf as Zt, workspaceProtocol as _, mapText as _n, pagesCalls as _t, listRules as a, modulesOf as an, readJsonc as ar, swallowsTests as at, yamlFaults as b, npmNames as bn, publishTextSafe as bt, runCli as c, messageOf as cn, specifiersOf as cr, isPinned as ct, HOOK_MARKER as d, signaturesOf as dn, pagesAfterRelease as dt, mitText as en, inFolder as er, playwrightInstall as et, NO_READ_LINE as f, HOME_EXPORTS as fn, repositoryOfRemote as ft, RULES as g, mapMarkdown as gn, PAGES_WORKFLOWS as gt, prePush as h, findHomes as hn, pushMainOnly as ht, formatResult as i, moduleUses as in, parseJsonc as ir, startsTests as it, testsRequired as j, sharedCi as jn, privatePatterns as jt, scriptsOf as k, SHARED_WORKFLOWS as kn, privateNamesFile as kt, runFix as l, repoOf as ln, defaultOptions as lr, pinnedGitDeps as lt, installHook as m, MAP_RULE as mn, scheduleMinute as mt, annotations as n, homeModule as nn, lineOf as nr, jobFails as nt, readConfig as o, declaredName as on, replaceLine as or, pipeFails as ot, PRE_PUSH_HOOK as p, HOMES as pn, runnerBudget as pt, reachOf as q, STRICT_OPTIONS as qn, mainCheck as qt, createContext as r, moduleMessage as rn, matchesAny as rr, parseAdvisory as rt, runChecks as s, homePackage as sn, runGit as sr, isGitSpecifier as st, USAGE as t, repositoryIsPublic as tn, keyLine as tr, hiddenFailures as tt, summaryMarkdown as u, reposOf as un, parseConfig as ur, siteCheckInCi as ut, GITHUB_YAML as v, mergeHomes as vn, pagesSite as vt, IGNORE_AFTER as w, serviceRunMain as wn, PRIVATE_NAMES_FILE_CONFIG as wt, namedVersions as x, readOverlay as xn, packNoBuildinfo as xt, workflowParses as y, npmDrift as yn, exportsRequire as yt, roadmapOfLine as z, ACTIONS_COMMIT as zn, lineNameHits as zt };
20246
20370
 
20247
- //# sourceMappingURL=run-BrCo6Uuy.js.map
20371
+ //# sourceMappingURL=run-Ccfopw7M.js.map