@ploaness/governance 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/a11y-hit-target.d.ts.map +1 -1
  2. package/dist/a11y-hit-target.js +1 -21
  3. package/dist/a11y-hit-target.js.map +1 -1
  4. package/dist/a11y-incomplete.d.ts.map +1 -1
  5. package/dist/a11y-incomplete.js +1 -18
  6. package/dist/a11y-incomplete.js.map +1 -1
  7. package/dist/access-boundary.d.ts +43 -1
  8. package/dist/access-boundary.d.ts.map +1 -1
  9. package/dist/access-boundary.js +146 -5
  10. package/dist/access-boundary.js.map +1 -1
  11. package/dist/admin-view-coverage.d.ts.map +1 -1
  12. package/dist/admin-view-coverage.js +1 -17
  13. package/dist/admin-view-coverage.js.map +1 -1
  14. package/dist/asset-policy.d.ts.map +1 -1
  15. package/dist/asset-policy.js +1 -23
  16. package/dist/asset-policy.js.map +1 -1
  17. package/dist/axe-coverage.d.ts +3 -4
  18. package/dist/axe-coverage.d.ts.map +1 -1
  19. package/dist/axe-coverage.js +18 -51
  20. package/dist/axe-coverage.js.map +1 -1
  21. package/dist/blocklist-entries.d.ts +36 -0
  22. package/dist/blocklist-entries.d.ts.map +1 -0
  23. package/dist/blocklist-entries.js +338 -0
  24. package/dist/blocklist-entries.js.map +1 -0
  25. package/dist/blocklist.d.ts +91 -0
  26. package/dist/blocklist.d.ts.map +1 -0
  27. package/dist/blocklist.js +187 -0
  28. package/dist/blocklist.js.map +1 -0
  29. package/dist/checkov-check.d.ts +9 -0
  30. package/dist/checkov-check.d.ts.map +1 -0
  31. package/dist/checkov-check.js +4 -0
  32. package/dist/checkov-check.js.map +1 -0
  33. package/dist/checkov-checks-aws.d.ts +4 -0
  34. package/dist/checkov-checks-aws.d.ts.map +1 -0
  35. package/dist/checkov-checks-aws.js +93 -0
  36. package/dist/checkov-checks-aws.js.map +1 -0
  37. package/dist/checkov-checks-azure.d.ts +4 -0
  38. package/dist/checkov-checks-azure.d.ts.map +1 -0
  39. package/dist/checkov-checks-azure.js +32 -0
  40. package/dist/checkov-checks-azure.js.map +1 -0
  41. package/dist/checkov-checks-google.d.ts +6 -0
  42. package/dist/checkov-checks-google.d.ts.map +1 -0
  43. package/dist/checkov-checks-google.js +53 -0
  44. package/dist/checkov-checks-google.js.map +1 -0
  45. package/dist/checkov-policy.d.ts +63 -0
  46. package/dist/checkov-policy.d.ts.map +1 -0
  47. package/dist/checkov-policy.js +105 -0
  48. package/dist/checkov-policy.js.map +1 -0
  49. package/dist/container-failure.d.ts.map +1 -1
  50. package/dist/container-failure.js +1 -18
  51. package/dist/container-failure.js.map +1 -1
  52. package/dist/container-files.d.ts +16 -0
  53. package/dist/container-files.d.ts.map +1 -1
  54. package/dist/container-files.js +23 -8
  55. package/dist/container-files.js.map +1 -1
  56. package/dist/container-images.d.ts +43 -0
  57. package/dist/container-images.d.ts.map +1 -0
  58. package/dist/container-images.js +157 -0
  59. package/dist/container-images.js.map +1 -0
  60. package/dist/dependency-freshness.d.ts +8 -0
  61. package/dist/dependency-freshness.d.ts.map +1 -1
  62. package/dist/dependency-freshness.js +2 -18
  63. package/dist/dependency-freshness.js.map +1 -1
  64. package/dist/doc-blocks.d.ts.map +1 -1
  65. package/dist/doc-blocks.js +1 -13
  66. package/dist/doc-blocks.js.map +1 -1
  67. package/dist/editorconfig-policy.d.ts +7 -0
  68. package/dist/editorconfig-policy.d.ts.map +1 -1
  69. package/dist/editorconfig-policy.js +19 -12
  70. package/dist/editorconfig-policy.js.map +1 -1
  71. package/dist/environment-coherence.d.ts +59 -5
  72. package/dist/environment-coherence.d.ts.map +1 -1
  73. package/dist/environment-coherence.js +107 -27
  74. package/dist/environment-coherence.js.map +1 -1
  75. package/dist/environment-files.d.ts.map +1 -1
  76. package/dist/environment-files.js +1 -19
  77. package/dist/environment-files.js.map +1 -1
  78. package/dist/file-roles.d.ts +7 -2
  79. package/dist/file-roles.d.ts.map +1 -1
  80. package/dist/file-roles.js +10 -9
  81. package/dist/file-roles.js.map +1 -1
  82. package/dist/freshness-repair.d.ts +82 -0
  83. package/dist/freshness-repair.d.ts.map +1 -0
  84. package/dist/freshness-repair.js +91 -0
  85. package/dist/freshness-repair.js.map +1 -0
  86. package/dist/generated-denial.d.ts.map +1 -1
  87. package/dist/generated-denial.js +1 -9
  88. package/dist/generated-denial.js.map +1 -1
  89. package/dist/generated-drift.d.ts.map +1 -1
  90. package/dist/generated-drift.js +1 -12
  91. package/dist/generated-drift.js.map +1 -1
  92. package/dist/harness-package.d.ts +13 -0
  93. package/dist/harness-package.d.ts.map +1 -0
  94. package/dist/harness-package.js +20 -0
  95. package/dist/harness-package.js.map +1 -0
  96. package/dist/history-policy.d.ts.map +1 -1
  97. package/dist/history-policy.js +1 -7
  98. package/dist/history-policy.js.map +1 -1
  99. package/dist/image-assets.d.ts.map +1 -1
  100. package/dist/image-assets.js +1 -10
  101. package/dist/image-assets.js.map +1 -1
  102. package/dist/index.d.ts +20 -0
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +20 -0
  105. package/dist/index.js.map +1 -1
  106. package/dist/install-policy.d.ts +21 -0
  107. package/dist/install-policy.d.ts.map +1 -1
  108. package/dist/install-policy.js +53 -1
  109. package/dist/install-policy.js.map +1 -1
  110. package/dist/jsx-accessibility-scope.d.ts +17 -0
  111. package/dist/jsx-accessibility-scope.d.ts.map +1 -0
  112. package/dist/jsx-accessibility-scope.js +36 -0
  113. package/dist/jsx-accessibility-scope.js.map +1 -0
  114. package/dist/jsx-accessibility.d.ts +13 -0
  115. package/dist/jsx-accessibility.d.ts.map +1 -0
  116. package/dist/jsx-accessibility.js +188 -0
  117. package/dist/jsx-accessibility.js.map +1 -0
  118. package/dist/network-policy.d.ts.map +1 -1
  119. package/dist/network-policy.js +1 -12
  120. package/dist/network-policy.js.map +1 -1
  121. package/dist/oxlint-policy.d.ts +16 -0
  122. package/dist/oxlint-policy.d.ts.map +1 -0
  123. package/dist/oxlint-policy.js +28 -0
  124. package/dist/oxlint-policy.js.map +1 -0
  125. package/dist/oxlint-report.d.ts +29 -0
  126. package/dist/oxlint-report.d.ts.map +1 -0
  127. package/dist/oxlint-report.js +84 -0
  128. package/dist/oxlint-report.js.map +1 -0
  129. package/dist/oxlint-scope.d.ts +13 -0
  130. package/dist/oxlint-scope.d.ts.map +1 -0
  131. package/dist/oxlint-scope.js +46 -0
  132. package/dist/oxlint-scope.js.map +1 -0
  133. package/dist/oxlint-suppressions.d.ts +17 -0
  134. package/dist/oxlint-suppressions.d.ts.map +1 -0
  135. package/dist/oxlint-suppressions.js +72 -0
  136. package/dist/oxlint-suppressions.js.map +1 -0
  137. package/dist/paired-assets.d.ts.map +1 -1
  138. package/dist/paired-assets.js.map +1 -1
  139. package/dist/payload-access.d.ts +6 -0
  140. package/dist/payload-access.d.ts.map +1 -1
  141. package/dist/payload-access.js +166 -9
  142. package/dist/payload-access.js.map +1 -1
  143. package/dist/payload-bootstrap.d.ts +52 -0
  144. package/dist/payload-bootstrap.d.ts.map +1 -0
  145. package/dist/payload-bootstrap.js +195 -0
  146. package/dist/payload-bootstrap.js.map +1 -0
  147. package/dist/payload-configs.d.ts +0 -1
  148. package/dist/payload-configs.d.ts.map +1 -1
  149. package/dist/payload-configs.js +36 -17
  150. package/dist/payload-configs.js.map +1 -1
  151. package/dist/payload-database.d.ts +80 -0
  152. package/dist/payload-database.d.ts.map +1 -0
  153. package/dist/payload-database.js +164 -0
  154. package/dist/payload-database.js.map +1 -0
  155. package/dist/payload-defaults.d.ts +128 -0
  156. package/dist/payload-defaults.d.ts.map +1 -0
  157. package/dist/payload-defaults.js +295 -0
  158. package/dist/payload-defaults.js.map +1 -0
  159. package/dist/payload-policy.d.ts +21 -0
  160. package/dist/payload-policy.d.ts.map +1 -1
  161. package/dist/payload-policy.js +92 -43
  162. package/dist/payload-policy.js.map +1 -1
  163. package/dist/relationship-cleanup.d.ts.map +1 -1
  164. package/dist/relationship-cleanup.js +16 -16
  165. package/dist/relationship-cleanup.js.map +1 -1
  166. package/dist/release-age.d.ts.map +1 -1
  167. package/dist/release-age.js +1 -16
  168. package/dist/release-age.js.map +1 -1
  169. package/dist/request-limits.d.ts.map +1 -1
  170. package/dist/request-limits.js +1 -11
  171. package/dist/request-limits.js.map +1 -1
  172. package/dist/route-map.d.ts.map +1 -1
  173. package/dist/route-map.js +1 -16
  174. package/dist/route-map.js.map +1 -1
  175. package/dist/run-plan.d.ts.map +1 -1
  176. package/dist/run-plan.js +1 -19
  177. package/dist/run-plan.js.map +1 -1
  178. package/dist/secret-policy.d.ts.map +1 -1
  179. package/dist/secret-policy.js +1 -11
  180. package/dist/secret-policy.js.map +1 -1
  181. package/dist/settings-layering.d.ts +8 -30
  182. package/dist/settings-layering.d.ts.map +1 -1
  183. package/dist/settings-layering.js +19 -48
  184. package/dist/settings-layering.js.map +1 -1
  185. package/dist/settings.d.ts +9 -2
  186. package/dist/settings.d.ts.map +1 -1
  187. package/dist/settings.js.map +1 -1
  188. package/dist/shell-files.d.ts +45 -0
  189. package/dist/shell-files.d.ts.map +1 -0
  190. package/dist/shell-files.js +105 -0
  191. package/dist/shell-files.js.map +1 -0
  192. package/dist/source-security.d.ts +10 -0
  193. package/dist/source-security.d.ts.map +1 -1
  194. package/dist/source-security.js +88 -1
  195. package/dist/source-security.js.map +1 -1
  196. package/dist/source-text.d.ts +2 -0
  197. package/dist/source-text.d.ts.map +1 -1
  198. package/dist/source-text.js +7 -16
  199. package/dist/source-text.js.map +1 -1
  200. package/dist/terraform-files.d.ts +29 -0
  201. package/dist/terraform-files.d.ts.map +1 -0
  202. package/dist/terraform-files.js +50 -0
  203. package/dist/terraform-files.js.map +1 -0
  204. package/dist/terraform-policy.d.ts +13 -0
  205. package/dist/terraform-policy.d.ts.map +1 -0
  206. package/dist/terraform-policy.js +261 -0
  207. package/dist/terraform-policy.js.map +1 -0
  208. package/dist/terraform-providers.d.ts +28 -0
  209. package/dist/terraform-providers.d.ts.map +1 -0
  210. package/dist/terraform-providers.js +68 -0
  211. package/dist/terraform-providers.js.map +1 -0
  212. package/dist/toolchain-pins.d.ts +1 -1
  213. package/dist/toolchain-pins.d.ts.map +1 -1
  214. package/dist/toolchain-pins.js +11 -21
  215. package/dist/toolchain-pins.js.map +1 -1
  216. package/dist/version-policy.d.ts +7 -8
  217. package/dist/version-policy.d.ts.map +1 -1
  218. package/dist/version-policy.js +15 -26
  219. package/dist/version-policy.js.map +1 -1
  220. package/dist/vulnerability-policy.d.ts.map +1 -1
  221. package/dist/vulnerability-policy.js +1 -11
  222. package/dist/vulnerability-policy.js.map +1 -1
  223. package/dist/wiring-policy.d.ts.map +1 -1
  224. package/dist/wiring-policy.js +4 -1
  225. package/dist/wiring-policy.js.map +1 -1
  226. package/dist/wiring-violation.d.ts.map +1 -1
  227. package/dist/wiring-violation.js +1 -6
  228. package/dist/wiring-violation.js.map +1 -1
  229. package/dist/workspace-policy.d.ts.map +1 -1
  230. package/dist/workspace-policy.js +3 -9
  231. package/dist/workspace-policy.js.map +1 -1
  232. package/dist/yaml-blocks.d.ts +10 -0
  233. package/dist/yaml-blocks.d.ts.map +1 -1
  234. package/dist/yaml-blocks.js +20 -0
  235. package/dist/yaml-blocks.js.map +1 -1
  236. package/package.json +2 -2
@@ -1,15 +1,5 @@
1
- // Conformance to the committed `.editorconfig`, plus the standard's line cap.
2
- //
3
- // The `.editorconfig` is a pinned managed file, so every project holds the same one - and until now
4
- // nothing checked a single file against it. The formatter covers only the globs it owns, which leaves
5
- // Markdown, YAML, shell scripts, and Dockerfiles free to carry a CRLF, a tab, a trailing space, or a
6
- // missing final newline.
7
- //
8
- // The expectations are read from the `.editorconfig` itself rather than restated here, so editing the
9
- // pinned file moves the gate with it and the gate cannot contradict the file it checks against. The one
10
- // value that does NOT come from there is the line cap: `max_line_length` is an editor hint that tells a
11
- // ruler where to sit, while the standard's 120 characters is a cap that binds as an error. A project's
12
- // formatter may aim shorter, and frequently does.
1
+ // Judge committed formatting and the authored-code line cap independently of filesystem access.
2
+ import { CODE_EXTENSIONS, hasExtension, matchesGlob } from './file-roles.js';
13
3
  /** The standard's line cap. Not configurable: a cap is never raised. */
14
4
  export const MAX_LINE_LENGTH = 120;
15
5
  const FIRST_LINE = 1;
@@ -80,6 +70,23 @@ const lineViolations = (content, rules, isLineLengthEnforced) => {
80
70
  });
81
71
  });
82
72
  };
73
+ /**
74
+ * Decide whether the standard's line cap binds for one file.
75
+ * @param filePath the repo-relative path.
76
+ * @param generatedArtefacts the globs the project declares generated.
77
+ * @returns true for an authored code file; false for prose and for generated output.
78
+ */
79
+ // A cap is a rule about how a person writes code, so it reaches code roles only - and only where a
80
+ // person wrote it. A generator emits what it emits: Payload renders each migration statement as one SQL
81
+ // string, and no formatter setting and no edit shortens it, because the file is frozen once applied.
82
+ // Holding a project to a cap it cannot satisfy would teach it to exclude the path from this gate
83
+ // altogether, which would cost the encoding and whitespace rules too - and those a generated file does
84
+ // satisfy, because the project runs its own formatter over the output.
85
+ // Matched as globs, not through `isGovernedCode`: `generatedArtefacts` is declared as globs and reaches
86
+ // ESLint's ignore list as globs, and `src/migrations/**` is not merely a different pattern under regex
87
+ // rules - `new RegExp` rejects it outright, so the gate would have thrown rather than reported.
88
+ export const isLineCapEnforced = (filePath, generatedArtefacts) => hasExtension(filePath, CODE_EXTENSIONS) &&
89
+ !generatedArtefacts.some((pattern) => matchesGlob(pattern, filePath));
83
90
  /**
84
91
  * Check one file against the committed configuration.
85
92
  * @param content the file's decoded content.
@@ -1 +1 @@
1
- {"version":3,"file":"editorconfig-policy.js","sourceRoot":"","sources":["../src/editorconfig-policy.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,oGAAoG;AACpG,sGAAsG;AACtG,qGAAqG;AACrG,yBAAyB;AACzB,EAAE;AACF,sGAAsG;AACtG,wGAAwG;AACxG,wGAAwG;AACxG,uGAAuG;AACvG,kDAAkD;AAElD,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAW,GAA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AAC,QAAQ,CAAC,IAAI,CAAC;QACjD,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;QACpE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO;QACL,GAAG,aAAa;QAChB,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC;QACvD,GAAG,YAAY;KAChB,CAAA;AACH,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  /** Where a variable was declared, for a message that names the two places rather than one. */
2
- export type EnvironmentOrigin = 'application' | 'compose';
2
+ export type EnvironmentOrigin = 'application' | 'compose' | 'dockerfile';
3
3
  /** An environment variable declared in one place and absent from another it has to reach. */
4
4
  export interface EnvironmentViolation {
5
5
  readonly name: string;
@@ -11,6 +11,18 @@ export interface WorkflowFile {
11
11
  readonly file: string;
12
12
  readonly content: string;
13
13
  }
14
+ /** A Dockerfile, as the rule needs it: what to call it in a finding, and what it declares. */
15
+ export interface DockerfileSource {
16
+ readonly file: string;
17
+ readonly content: string;
18
+ }
19
+ /** One member's image build: the files whose reads it inlines, and the Dockerfiles that build it. */
20
+ export interface ImageBuild {
21
+ /** Contents of the validated module and the framework configuration, where the member has them. */
22
+ readonly sources: readonly string[];
23
+ /** Every Dockerfile that builds this member. Empty when the member ships no image. */
24
+ readonly dockerfiles: readonly DockerfileSource[];
25
+ }
14
26
  /** Inputs for {@link findEnvironmentViolations}, already read so the core stays pure. */
15
27
  export interface EnvironmentInputs {
16
28
  /** The contents of every validated environment module the repository holds, one per member. */
@@ -21,6 +33,8 @@ export interface EnvironmentInputs {
21
33
  readonly composeSources: readonly string[];
22
34
  /** Every workflow the repository ships. Only the verifying ones are judged. */
23
35
  readonly workflows: readonly WorkflowFile[];
36
+ /** One entry per member: what its build inlines, and the images that must declare it. */
37
+ readonly builds: readonly ImageBuild[];
24
38
  }
25
39
  /**
26
40
  * The module a Payload project reads `process.env` in, which is the only module ploaness exempts from
@@ -43,6 +57,15 @@ export declare const ENVIRONMENT_READ_EXEMPTIONS: readonly string[];
43
57
  * `.env.sample` has documented its variables just as well as one using `.env.example`.
44
58
  */
45
59
  export declare const ENVIRONMENT_EXAMPLE_FILES: readonly string[];
60
+ /**
61
+ * The framework configuration a member may hold at its own root.
62
+ *
63
+ * It is evaluated during the image build, so a variable it reads is one the build has to be given - and
64
+ * it sits outside `sourceRoots`, which is why the `process.env` ban never reached it and why this rule
65
+ * has to. Every spelling present is read, unlike the example files above, because a project ships one
66
+ * and reading all of them cannot produce two answers that disagree.
67
+ */
68
+ export declare const BUILD_CONFIGURATION_FILES: readonly string[];
46
69
  /**
47
70
  * The variables an application reads out of its validated environment module.
48
71
  * @param source the contents of that module.
@@ -61,6 +84,22 @@ export declare const documentedEnvironmentNames: (example: string) => readonly s
61
84
  * @returns each name once, sorted.
62
85
  */
63
86
  export declare const interpolatedEnvironmentNames: (compose: string) => readonly string[];
87
+ /**
88
+ * The variables a file's reads inline into the image at build time.
89
+ * @param source the contents of a validated environment module or a framework configuration.
90
+ * @returns each name once, sorted.
91
+ */
92
+ export declare const inlinedEnvironmentNames: (source: string) => readonly string[];
93
+ /**
94
+ * The build arguments a Dockerfile declares, in every stage and under either spelling.
95
+ *
96
+ * Every stage, because `ARG` scope is per stage and which stage runs the build is not a fact this text
97
+ * can establish. Reading the file as one namespace can only ACCEPT a declaration that sits in the wrong
98
+ * stage; resolving stages by guessing which `RUN` is the build would REJECT correct files.
99
+ * @param dockerfile the Dockerfile body.
100
+ * @returns each name once, sorted.
101
+ */
102
+ export declare const declaredBuildArguments: (dockerfile: string) => readonly string[];
64
103
  /**
65
104
  * The variables a workflow supplies, by any means and at any nesting depth.
66
105
  * @param workflow the contents of the workflow file.
@@ -73,15 +112,30 @@ export declare const workflowSuppliedNames: (workflow: string) => readonly strin
73
112
  * @returns true when the workflow invokes verification or a single gate.
74
113
  */
75
114
  export declare const isVerifyingWorkflow: (workflow: string) => boolean;
115
+ /**
116
+ * The Dockerfiles that build one member: those inside its own directory, and - for the member at the
117
+ * repository root - those no other member owns.
118
+ * @param memberPath the member's repo-relative path, `.` at the repository root.
119
+ * @param everyMemberPath every governed member's path.
120
+ * @param dockerfiles every Dockerfile the repository tracks.
121
+ * @returns the Dockerfiles that build this member, in the order given.
122
+ */
123
+ export declare const dockerfilesBuilding: (memberPath: string, everyMemberPath: readonly string[], dockerfiles: readonly DockerfileSource[]) => readonly DockerfileSource[];
76
124
  /**
77
125
  * Every environment variable declared in one place and absent from another it has to reach.
78
126
  *
79
- * Three containments, each one-directional. What the application reads must be documented. What a
127
+ * Four containments, each one-directional. What the application reads must be documented. What a
80
128
  * compose file interpolates must be documented, because `docker compose config` reads the example file
81
- * a developer copied. And what a compose file interpolates must be supplied by every workflow that
82
- * verifies, because a workflow has no copied file to interpolate from.
129
+ * a developer copied. What a compose file interpolates must be supplied by every workflow that
130
+ * verifies, because a workflow has no copied file to interpolate from. And what a build inlines must be
131
+ * declared as an `ARG`, because docker discards a `--build-arg` the Dockerfile never named and warns
132
+ * rather than failing - so the value is absent from the image and nothing says so.
133
+ *
134
+ * The inlined names feed the Dockerfile containment ALONE. Joining them to the example-file rule would
135
+ * report a member that documents its public variables in its own example file rather than the
136
+ * repository's, which is where they belong and where this reader does not look.
83
137
  * @param inputs the files, already read.
84
- * @returns the violations, sorted by name within each rule. An empty array means the four places agree.
138
+ * @returns the violations, sorted by name within each rule. An empty array means the five places agree.
85
139
  */
86
140
  export declare const findEnvironmentViolations: (inputs: EnvironmentInputs) => readonly EnvironmentViolation[];
87
141
  //# sourceMappingURL=environment-coherence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment-coherence.d.ts","sourceRoot":"","sources":["../src/environment-coherence.ts"],"names":[],"mappings":"AAwBA,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,SAAS,CAAA;AAEzD,6FAA6F;AAC7F,MAAM,WA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pC,QAAQ,iBAAiB,KACxB,SAAS,oBAAoB,EAqC/B,CAAA"}
@@ -1,26 +1,6 @@
1
- // Environment-coherence policy: the pure logic that finds an environment variable declared in one place
2
- // and missing from another it must also reach. The `environment` gate in
3
- // packages/cli/src/checks/environment.ts reads the files.
4
- //
5
- // A variable lands in more than one place by nature, and nothing links those places. The application
6
- // reads it, `.env.example` documents it for a clone, a compose file interpolates it, and a workflow
7
- // exports it into the job. Miss one and the failure is somewhere other than where the omission is: a
8
- // clone boots on a default it never chose, or `docker compose config` fails on CI alone, several steps
9
- // from the commit that added the name. This is the sibling of document-references.ts and
10
- // config-references.ts, applied to environment variables instead of scripts, docs, or config paths.
11
- //
12
- // EVERY RULE IS ONE-DIRECTIONAL, which is what makes the gate false-positive-free. What is read, or
13
- // interpolated, must be documented; what is documented need not be read. `.env.example` legitimately
14
- // carries an optional variable no code path requires - a key for a manual script, a value only a
15
- // developer regenerating an asset ever sets - and demanding the reverse containment would report those
16
- // as rot.
17
- //
18
- // It is NOT a YAML parser and must not become one, for the reason yaml-blocks.ts states. The workflow
19
- // half asks only whether a name appears in the file at all, not whether it appears in the block that
20
- // would put it in the job's environment. That is deliberate: adjudicating YAML scoping would need a
21
- // parser, and the mistake this gate exists to catch is forgetting the variable altogether rather than
22
- // declaring it one nesting level from where it was needed. Over-accepting costs a missed finding;
23
- // guessing at scope would cost a wrong one.
1
+ // Require environment reads, example declarations, compose interpolation, verifying workflows, and the
2
+ // build arguments an image declares to agree.
3
+ import { logicalLines } from './container-images.js';
24
4
  /**
25
5
  * The module a Payload project reads `process.env` in, which is the only module ploaness exempts from
26
6
  * the ban and therefore the only one this rule can read a variable name out of.
@@ -49,6 +29,19 @@ export const ENVIRONMENT_EXAMPLE_FILES = [
49
29
  '.env.sample',
50
30
  '.env.template',
51
31
  ];
32
+ /**
33
+ * The framework configuration a member may hold at its own root.
34
+ *
35
+ * It is evaluated during the image build, so a variable it reads is one the build has to be given - and
36
+ * it sits outside `sourceRoots`, which is why the `process.env` ban never reached it and why this rule
37
+ * has to. Every spelling present is read, unlike the example files above, because a project ships one
38
+ * and reading all of them cannot produce two answers that disagree.
39
+ */
40
+ export const BUILD_CONFIGURATION_FILES = [
41
+ 'next.config.ts',
42
+ 'next.config.mjs',
43
+ 'next.config.js',
44
+ ];
52
45
  // BRACKET ACCESS ONLY, and that is the rule rather than a shortcut. `process.env` is an index
53
46
  // signature, so a variable this project invented can only be read with brackets; a variable node or the
54
47
  // framework DECLARES - `NODE_ENV` above all - is a known property and is read with a dot. The two forms
@@ -63,6 +56,23 @@ const EXAMPLE_ASSIGNMENT = /^[ \t]*(?:export[ \t]+)?(?<name>[A-Za-z_]\w*)[ \t]*=
63
56
  // gate's business. The braced form alone is read: `$NAME` is legal in compose and rare in practice, and
64
57
  // telling it apart from a `$$` escape or a shell fragment inside a `command:` is guesswork.
65
58
  const COMPOSE_INTERPOLATION = /\$\{(?<name>[A-Z_]\w*)\}/gi;
59
+ // BOTH ACCESS FORMS, and the PREFIX is what makes that sound rather than a relaxation of the rule
60
+ // above. `NEXT_PUBLIC_` is reserved by the framework for values the project invents; no runtime declares
61
+ // one, so a dotted read of a prefixed name cannot be naming an ambient variable the way
62
+ // `process.env.NODE_ENV` does. It is also the ONLY form the bundler substitutes, because the
63
+ // substitution is textual - so the dotted read is not merely admissible here, it is the read that makes
64
+ // the value a build input at all. A name read through a plain record parameter is not matched: nothing
65
+ // is inlined there, and the value arrives from whoever built the record.
66
+ const INLINED_DOTTED_READ = /process\.env\.(?<name>NEXT_PUBLIC_\w+)/g;
67
+ const INLINED_BRACKETED_READ = /process\.env\[\s*(?<quote>['"])(?<name>NEXT_PUBLIC_\w+)\k<quote>\s*\]/g;
68
+ // A build-argument DECLARATION, with or without a default. The compose analogue above puts
69
+ // `${NAME:-5432}` out of scope because a default SUPPLIES the value and the claim was that something
70
+ // must supply it. This containment runs the other way - the Dockerfile is the side that must DECLARE -
71
+ // and `ARG NAME=x` declares NAME just as `ARG NAME` does: `--build-arg NAME=...` is honoured either way
72
+ // and the read resolves. What this rule is about is a name the file never mentions.
73
+ const ARG_DECLARATION = /^[ \t]*ARG[ \t]+(?<names>\S.*)$/i;
74
+ const ARGUMENT_SEPARATOR = /[ \t]+/;
75
+ const DEFAULT_SEPARATOR = '=';
66
76
  // A name a workflow supplies: a mapping key in SCREAMING_SNAKE, or a reference to a secret, a variable,
67
77
  // or the job environment. The key form is matched at any indentation, for the reason the header states.
68
78
  const WORKFLOW_KEY = /^[ \t]*(?<name>[A-Z_][A-Z0-9_]*)[ \t]*:/gm;
@@ -95,6 +105,32 @@ export const documentedEnvironmentNames = (example) => uniqueSorted(namesMatchin
95
105
  * @returns each name once, sorted.
96
106
  */
97
107
  export const interpolatedEnvironmentNames = (compose) => uniqueSorted(namesMatching(compose, COMPOSE_INTERPOLATION));
108
+ /**
109
+ * The variables a file's reads inline into the image at build time.
110
+ * @param source the contents of a validated environment module or a framework configuration.
111
+ * @returns each name once, sorted.
112
+ */
113
+ export const inlinedEnvironmentNames = (source) => uniqueSorted([
114
+ ...namesMatching(source, INLINED_DOTTED_READ),
115
+ ...namesMatching(source, INLINED_BRACKETED_READ),
116
+ ]);
117
+ const argumentNamesIn = (declaration) => declaration
118
+ .split(ARGUMENT_SEPARATOR)
119
+ .map((token) => token.split(DEFAULT_SEPARATOR)[0] ?? '')
120
+ .filter((name) => name.length > 0);
121
+ /**
122
+ * The build arguments a Dockerfile declares, in every stage and under either spelling.
123
+ *
124
+ * Every stage, because `ARG` scope is per stage and which stage runs the build is not a fact this text
125
+ * can establish. Reading the file as one namespace can only ACCEPT a declaration that sits in the wrong
126
+ * stage; resolving stages by guessing which `RUN` is the build would REJECT correct files.
127
+ * @param dockerfile the Dockerfile body.
128
+ * @returns each name once, sorted.
129
+ */
130
+ export const declaredBuildArguments = (dockerfile) => uniqueSorted(logicalLines(dockerfile).flatMap((line) => {
131
+ const names = ARG_DECLARATION.exec(line)?.groups?.['names'];
132
+ return names === undefined ? [] : argumentNamesIn(names);
133
+ }));
98
134
  /**
99
135
  * The variables a workflow supplies, by any means and at any nesting depth.
100
136
  * @param workflow the contents of the workflow file.
@@ -110,6 +146,22 @@ export const workflowSuppliedNames = (workflow) => uniqueSorted([
110
146
  * @returns true when the workflow invokes verification or a single gate.
111
147
  */
112
148
  export const isVerifyingWorkflow = (workflow) => VERIFYING_COMMANDS.some((command) => workflow.includes(command));
149
+ const ROOT_MEMBER = '.';
150
+ // The member a path belongs to: the deepest one whose directory contains it, the same rule a working
151
+ // directory is resolved by, so a nested member keeps its own image instead of inheriting its parent's.
152
+ const ownerOf = (file, everyMemberPath) => [...everyMemberPath]
153
+ .filter((candidate) => candidate !== ROOT_MEMBER && file.startsWith(`${candidate}/`))
154
+ .toSorted((left, right) => right.length - left.length)
155
+ .at(0) ?? ROOT_MEMBER;
156
+ /**
157
+ * The Dockerfiles that build one member: those inside its own directory, and - for the member at the
158
+ * repository root - those no other member owns.
159
+ * @param memberPath the member's repo-relative path, `.` at the repository root.
160
+ * @param everyMemberPath every governed member's path.
161
+ * @param dockerfiles every Dockerfile the repository tracks.
162
+ * @returns the Dockerfiles that build this member, in the order given.
163
+ */
164
+ export const dockerfilesBuilding = (memberPath, everyMemberPath, dockerfiles) => dockerfiles.filter((dockerfile) => ownerOf(dockerfile.file, everyMemberPath) === memberPath);
113
165
  const undocumented = (names, documented, origin, reason) => names
114
166
  .filter((name) => !documented.has(name))
115
167
  .map((name) => ({ name, origin, reason }));
@@ -126,15 +178,42 @@ const missingFromWorkflow = (names, workflow) => {
126
178
  ].join(' '),
127
179
  }));
128
180
  };
181
+ const missingBuildArguments = (build) => {
182
+ // A member that ships no image owes no build argument. One-directional, like every rule above.
183
+ if (build.dockerfiles.length === 0) {
184
+ return [];
185
+ }
186
+ const declared = new Set(build.dockerfiles.flatMap((dockerfile) => declaredBuildArguments(dockerfile.content)));
187
+ const files = build.dockerfiles
188
+ .map((dockerfile) => dockerfile.file)
189
+ .join(', ');
190
+ return uniqueSorted(build.sources.flatMap((source) => inlinedEnvironmentNames(source)))
191
+ .filter((name) => !declared.has(name))
192
+ .map((name) => ({
193
+ name,
194
+ origin: 'dockerfile',
195
+ reason: [
196
+ `inlined into the image at build time but declared by no ARG in ${files},`,
197
+ 'so docker discards the --build-arg that supplies it and warns rather than failing:',
198
+ `add "ARG ${name}" to the stage that runs the build`,
199
+ ].join(' '),
200
+ }));
201
+ };
129
202
  /**
130
203
  * Every environment variable declared in one place and absent from another it has to reach.
131
204
  *
132
- * Three containments, each one-directional. What the application reads must be documented. What a
205
+ * Four containments, each one-directional. What the application reads must be documented. What a
133
206
  * compose file interpolates must be documented, because `docker compose config` reads the example file
134
- * a developer copied. And what a compose file interpolates must be supplied by every workflow that
135
- * verifies, because a workflow has no copied file to interpolate from.
207
+ * a developer copied. What a compose file interpolates must be supplied by every workflow that
208
+ * verifies, because a workflow has no copied file to interpolate from. And what a build inlines must be
209
+ * declared as an `ARG`, because docker discards a `--build-arg` the Dockerfile never named and warns
210
+ * rather than failing - so the value is absent from the image and nothing says so.
211
+ *
212
+ * The inlined names feed the Dockerfile containment ALONE. Joining them to the example-file rule would
213
+ * report a member that documents its public variables in its own example file rather than the
214
+ * repository's, which is where they belong and where this reader does not look.
136
215
  * @param inputs the files, already read.
137
- * @returns the violations, sorted by name within each rule. An empty array means the four places agree.
216
+ * @returns the violations, sorted by name within each rule. An empty array means the five places agree.
138
217
  */
139
218
  export const findEnvironmentViolations = (inputs) => {
140
219
  const documented = new Set(inputs.example === undefined ? [] : documentedEnvironmentNames(inputs.example));
@@ -145,6 +224,7 @@ export const findEnvironmentViolations = (inputs) => {
145
224
  ...undocumented(read, documented, 'application', 'read by the validated environment module but documented in no example file'),
146
225
  ...undocumented(interpolated, documented, 'compose', 'interpolated by a compose file but documented in no example file'),
147
226
  ...verifying.flatMap((workflow) => missingFromWorkflow(interpolated, workflow)),
227
+ ...inputs.builds.flatMap((build) => missingBuildArguments(build)),
148
228
  ];
149
229
  };
150
230
  //# sourceMappingURL=environment-coherence.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment-coherence.js","sourceRoot":"","sources":["../src/environment-coherence.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,yEAAyE;AACzE,0DAA0D;AAC1D,EAAE;AACF,qGAAqG;AACrG,oGAAoG;AACpG,qGAAqG;AACrG,uGAAuG;AACvG,yFAAyF;AACzF,oGAAoG;AACpG,EAAE;AACF,oGAAoG;AACpG,qGAAqG;AACrG,iGAAiG;AACjG,uGAAuG;AACvG,UAAU;AACV,EAAE;AACF,sGAAsG;AACtG,qGAAqG;AACrG,oGAAoG;AACpG,sGAAsG;AACtG,kGAAkG;AAClG,4CAA4C;AA8B5C;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAW,wBAAwB,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,4BAA4B;IAC5B,cAAc;CACf,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,cAAc;IACd,aAAa;IACb,eAAe;CAChB,CAAA;AAED,8FAA8F;AAC9F,wGAAwG;AACxG,wGAAwG;AACxG,iGAAiG;AACjG,yEAAyE;AACzE,MAAM,cAAc,GAAW,qEAAqE,CAAA;AAEpG,sGAAsG;AACtG,0DAA0D;AAC1D,MAAM,kBAAkB,GAAW,wDAAwD,CAAA;AAE3F,uGAAuG;AACvG,mGAAmG;AACnG,wGAAwG;AACxG,4FAA4F;AAC5F,MAAM,qBAAqB,GAAW,4BAA4B,CAAA;AAElE,wGAAwG;AACxG,wGAAwG;AACxG,MAAM,YAAY,GAAW,2CAA2C,CAAA;AACxE,MAAM,0BAA0B,GAC9B,4DAA4D,CAAA;AAE9D,gGAAgG;AAChG,wGAAwG;AACxG,6FAA6F;AAC7F,MAAM,kBAAkB,GAAsB,CAAC,iBAAiB,EAAE,eAAe,EAAE,YAAY,CAAC,CAAA;AAEhG,8FAA8F;AAC9F,qGAAqG;AAC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,kBAAkB,CAAC,OAAO,CAAC,CAAC,MAAc,EAAqB,EAAE,CACtE,oBAAoB,CAAC,MAAM,CAAC,CAC7B,CACF,CAAA;IACD,MAAM,YAAY,GAAsB,YAAY,CAClD,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAc,EAAqB,EAAE,CAClE,4BAA4B,CAAC,MAAM,CAAC,CACrC,CACF,CAAA;IACD,MAAM,SAAS,GAA4B,MAAM,CAAC,SAAS,CAAC,MAAM,CAChE,CAAC,QAAsB,EAAW,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAC3E,CAAA;IACD,OAAO;QACL,GAAG,YAAY,CACb,IAAI,EACJ,UAAU,EACV,aAAa,EACb,4EAA4E,CAC7E;QACD,GAAG,YAAY,CACb,YAAY,EACZ,UAAU,EACV,SAAS,EACT,kEAAkE,CACnE;QACD,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,QAAsB,EAAmC,EAAE,CAC/E,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAC5C;KACF,CAAA;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"environment-coherence.js","sourceRoot":"","sources":["../src/environment-coherence.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,8CAA8C;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AA8CpD;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAW,wBAAwB,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,4BAA4B;IAC5B,cAAc;CACf,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,cAAc;IACd,aAAa;IACb,eAAe;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;CACjB,CAAA;AAED,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AE,KACnE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAe/B,CAAA"}
1
+ {"version":3,"file":"environment-files.d.ts","sourceRoot":"","sources":["../src/environment-files.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAA2B,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,gBAAgB,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,KAChD,SAAS,MAAM,EAC6D,CAAA;AAE/E;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAI,WAAW,MAAM,KAAG,MAAM,GAAG,SASnD,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,aAAa,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,KACnE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAe/B,CAAA"}
@@ -1,22 +1,4 @@
1
- // The environment files a run of the project reads into its own process.
2
- //
3
- // A Payload config validates `process.env` at module scope, so anything that boots the project boots
4
- // its configuration first. Next reads these files itself, which is why the application under test never
5
- // had a problem - but a test runner does not, and the runner ploaness ships a Playwright config for
6
- // boots the project in its OWN process: an end-to-end helper that seeds a user through `getPayload`
7
- // evaluates `payload.config.ts` at spec-collection time, before a browser or a server is involved.
8
- //
9
- // The project used to load them from its own `playwright.config.ts`. The wiring gate now requires that
10
- // file to be a bare re-export, which removes the only seam it had, so the harness that took the seam
11
- // away owes the load. Vitest is the other half of the same shape and keeps its own answer: a project
12
- // writes `vitest.setup.ts` and ploaness loads it, which is a seam the project still owns.
13
- //
14
- // The order is the part that carries meaning, and it is stated here rather than at the call site so
15
- // that it is measured: `packages/config` is an analyzer configuration that no coverage floor reads,
16
- // while everything in this package is unit-tested. Nothing loaded later may replace a value already
17
- // set, so the file that must win is read first, and a variable the real environment already carries -
18
- // a CI secret, a `DATABASE_URL` exported by a service container - outranks every file, because it was
19
- // there before any of them was read.
1
+ // Declare environment file precedence shared by analysis, tests, and application startup.
20
2
  /**
21
3
  * The environment files a run reads, highest precedence first. `.env.local` leads because it is the
22
4
  * personal, untracked override of `.env`; the managed `.gitignore` ignores both, which is what makes
@@ -1 +1 @@
1
- {"version":3,"file":"environment-files.js","sourceRoot":"","sources":["../src/environment-files.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,qGAAqG;AACrG,wGAAwG;AACxG,oGAAoG;AACpG,oGAAoG;AACpG,mGAAmG;AACnG,EAAE;AACF,uGAAuG;AACvG,qGAAqG;AACrG,qGAAqG;AACrG,0FAA0F;AAC1F,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,oGAAoG;AACpG,sGAAsG;AACtG,sGAAsG;AACtG,qCAAqC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,cAAiD,EAC9B,EAAE,CACrB,qBAAqB,CAAC,MAAM,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAA;AAE/E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,SAAiB,EAAsB,EAAE;IAC9D,IAAI,CAAC;QACH,MAAM,IAAI,GAAW,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAA;QAC5C,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,+FAA+F;QAC/F,kFAAkF;QAClF,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAAqD,EACrD,WAAoE,EAClC,EAAE,CACpC,MAAM,CAAC,WAAW,CAChB,WAAW;KACR,OAAO,CACN,CACE,IAAkD,EACT,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CACnE;KACA,MAAM,CACL,CAAC,KAA4C,EAA6B,EAAE,CAC1E,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAC5D;IACD,kGAAkG;IAClG,mEAAmE;KAClE,UAAU,EAAE,CAChB,CAAA"}
1
+ {"version":3,"file":"environment-files.js","sourceRoot":"","sources":["../src/environment-files.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,cAAiD,EAC9B,EAAE,CACrB,qBAAqB,CAAC,MAAM,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAA;AAE/E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,SAAiB,EAAsB,EAAE;IAC9D,IAAI,CAAC;QACH,MAAM,IAAI,GAAW,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAA;QAC5C,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,+FAA+F;QAC/F,kFAAkF;QAClF,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAAqD,EACrD,WAAoE,EAClC,EAAE,CACpC,MAAM,CAAC,WAAW,CAChB,WAAW;KACR,OAAO,CACN,CACE,IAAkD,EACT,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CACnE;KACA,MAAM,CACL,CAAC,KAA4C,EAA6B,EAAE,CAC1E,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAC5D;IACD,kGAAkG;IAClG,mEAAmE;KAClE,UAAU,EAAE,CAChB,CAAA"}
@@ -15,13 +15,18 @@ export declare const isBinary: (bytes: Uint8Array) => boolean;
15
15
  * @returns true when the path ends with one of them.
16
16
  */
17
17
  export declare const hasExtension: (filePath: string, extensions: readonly string[]) => boolean;
18
+ /** A role regex evaluated either at the repository root or inside its declaring member. */
19
+ export type RolePattern = string | {
20
+ readonly memberPath: string;
21
+ readonly pattern: string;
22
+ };
18
23
  /**
19
24
  * Decide whether a path is excluded by a declared role pattern.
20
25
  * @param filePath the repo-relative path.
21
26
  * @param patterns the declared exclusion patterns.
22
27
  * @returns true when any pattern matches.
23
28
  */
24
- export declare const matchesRole: (filePath: string, patterns: readonly string[]) => boolean;
29
+ export declare const matchesRole: (filePath: string, patterns: readonly RolePattern[]) => boolean;
25
30
  /**
26
31
  * Whether a repo-relative path matches a glob pattern of the kind the coverage settings carry.
27
32
  * @param pattern the glob, such as `src/app/**` or `src/**\/*.tsx`.
@@ -35,5 +40,5 @@ export declare const matchesGlob: (pattern: string, filePath: string) => boolean
35
40
  * @param excluded the declared generated-role patterns.
36
41
  * @returns true when the file is code and no declared role excludes it.
37
42
  */
38
- export declare const isGovernedCode: (filePath: string, excluded: readonly string[]) => boolean;
43
+ export declare const isGovernedCode: (filePath: string, excluded: readonly RolePattern[]) => boolean;
39
44
  //# sourceMappingURL=file-roles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-roles.d.ts","sourceRoot":"","sources":["../src/file-roles.ts"],"names":[],"mappings":"AAYA,sGAAsG;AACtG,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAU5C,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAA6B,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,UAAU,KAAG,OACM,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,EAAE,YAAY,SAAS,MAAM,EAAE,KAAG,OACA,CAAA;AAE/E;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,EAAE,UAAU,SAAS,MAAM,EAAE,KAAG,OACK,CAAA;AA2BjF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,OAG9C,CAAA;AAElB;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,EAAE,UAAU,SAAS,MAAM,EAAE,KAAG,OACF,CAAA"}
1
+ {"version":3,"file":"file-roles.d.ts","sourceRoot":"","sources":["../src/file-roles.ts"],"names":[],"mappings":"AAKA,sGAAsG;AACtG,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAW5C,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAA6B,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,UAAU,KAAG,OACM,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,EAAE,YAAY,SAAS,MAAM,EAAE,KAAG,OACA,CAAA;AAE/E,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAY5F;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,EAAE,UAAU,SAAS,WAAW,EAAE,KAAG,OACI,CAAA;AA2BrF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,OAG9C,CAAA;AAElB;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,EAAE,UAAU,SAAS,WAAW,EAAE,KAAG,OACP,CAAA"}
@@ -1,17 +1,11 @@
1
- // File roles: the categories a repository can determine from a file itself and uses to include or
2
- // exclude it from a check.
3
- //
4
- // The typography ban used to carry its own allowlist of ten extensions, which is the wrong shape for a
5
- // rule that reaches "every tracked file the repository does not exclude by role": a `.css`, a `.adoc`,
6
- // a shell script, or a Dockerfile went unscanned, and every new text format arrived unscanned until
7
- // someone remembered to extend the list. A role predicate is default-safe in the opposite direction -
8
- // a new format is covered by construction, and exclusion is the thing that must be stated.
1
+ // Identify source, generated, binary, and prose roles so exclusions follow file meaning rather than tool defaults.
9
2
  /** How much of a file is inspected before deciding it is text. Enough to reach any real header. */
10
3
  const BINARY_PROBE_BYTES = 8192;
11
4
  /** Extensions the Code Rules apply to, used where a rule is about code rather than about any text. */
12
5
  export const CODE_EXTENSIONS = [
13
6
  '.ts',
14
7
  '.tsx',
8
+ '.jsx',
15
9
  '.mts',
16
10
  '.cts',
17
11
  '.js',
@@ -35,13 +29,20 @@ export const isBinary = (bytes) => bytes.subarray(0, BINARY_PROBE_BYTES).include
35
29
  * @returns true when the path ends with one of them.
36
30
  */
37
31
  export const hasExtension = (filePath, extensions) => extensions.some((extension) => filePath.endsWith(extension));
32
+ const matchesPattern = (filePath, pattern) => {
33
+ if (typeof pattern === 'string') {
34
+ return new RegExp(pattern).test(filePath);
35
+ }
36
+ const prefix = `${pattern.memberPath}/`;
37
+ return (filePath.startsWith(prefix) && new RegExp(pattern.pattern).test(filePath.slice(prefix.length)));
38
+ };
38
39
  /**
39
40
  * Decide whether a path is excluded by a declared role pattern.
40
41
  * @param filePath the repo-relative path.
41
42
  * @param patterns the declared exclusion patterns.
42
43
  * @returns true when any pattern matches.
43
44
  */
44
- export const matchesRole = (filePath, patterns) => patterns.some((pattern) => new RegExp(pattern).test(filePath));
45
+ export const matchesRole = (filePath, patterns) => patterns.some((pattern) => matchesPattern(filePath, pattern));
45
46
  // The glob dialect the coverage settings are written in, which is not the regex dialect `matchesRole`
46
47
  // reads. `**/` crosses directory boundaries and `*` does not, which is the whole distinction between
47
48
  // `src/**/*.tsx` and `src/*.tsx`; collapsing the two would silently widen every pattern that uses one.
@@ -1 +1 @@
1
- {"version":3,"file":"file-roles.js","sourceRoot":"","sources":["../src/file-roles.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,2BAA2B;AAC3B,EAAE;AACF,uGAAuG;AACvG,uGAAuG;AACvG,oGAAoG;AACpG,sGAAsG;AACtG,2FAA2F;AAE3F,mGAAmG;AACnG,MAAM,kBAAkB,GAAW,IAAI,CAAA;AAEvC,sGAAsG;AACtG,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAA;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,gBAAgB,GAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAE3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAW,EAAE,CACrD,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,UAA6B,EAAW,EAAE,CACvF,UAAU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,CAAC,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA"}
@@ -0,0 +1,82 @@
1
+ import type { DeclaredCoordinate, FreshnessFinding, ManifestSource } from './dependency-freshness.js';
2
+ /**
3
+ * Who can act on a freshness finding.
4
+ *
5
+ * - `project`: declared by this repository at a version it chooses. Change the declaration.
6
+ * - `pin`: declared by this repository at a version ploaness decides. The wiring gate holds the
7
+ * declaration to the pin, so the repair is a ploaness release that carries the newer one.
8
+ * - `inherited`: declared in a manifest this repository inherits from ploaness. The same repair, with
9
+ * no line in the project to edit at all.
10
+ */
11
+ export type FreshnessRepair = 'project' | 'pin' | 'inherited';
12
+ /** The order the groups print in: what the reader can act on first. */
13
+ export declare const REPAIR_ORDER: readonly FreshnessRepair[];
14
+ /** What the report needs to know about whose version a name is. */
15
+ export interface FreshnessOwnership {
16
+ /** Every name whose exact version ploaness pins for a project that declares it. */
17
+ readonly pinnedByHarness: ReadonlySet<string>;
18
+ /**
19
+ * True when the repository under judgement is ploaness itself. Its pins are a file it tracks, so a
20
+ * pinned coordinate there is the project's to change like any other.
21
+ */
22
+ readonly isHarnessItself: boolean;
23
+ }
24
+ /** One group of the report: the findings that share a repair, under the line that states it. */
25
+ export interface FreshnessSection {
26
+ readonly repair: FreshnessRepair;
27
+ /** The action for every finding beneath it, stated once. */
28
+ readonly heading: string;
29
+ readonly findings: readonly FreshnessFinding[];
30
+ }
31
+ /**
32
+ * Whether this repository is ploaness: it tracks the manifest of the package called `ploaness`.
33
+ *
34
+ * Decided from what the tree contains rather than from a flag, for the reason a member's kind is
35
+ * derived from what it declares: nothing can describe itself into a weaker reading. Read from the
36
+ * project's own manifests only, because in a consumer the same name arrives as an INHERITED manifest,
37
+ * and that is exactly the case this must answer `false` for.
38
+ * @param manifests every manifest the gate read, the project's own and the inherited ones.
39
+ * @returns true when a manifest the project tracks is ploaness's own.
40
+ */
41
+ export declare const isHarnessRepository: (manifests: readonly ManifestSource[]) => boolean;
42
+ /**
43
+ * Whether ploaness decides the version a project declares a name at.
44
+ *
45
+ * Three rules, each one the wiring gate already enforces and each derived from it rather than restated:
46
+ * a pinned name must match the pin, a `@payloadcms/*` package must match the pinned `payload`, and a
47
+ * `@ploaness/*` package must match the declared `ploaness`. `ploaness` itself is the one exception,
48
+ * and it proves the third rule: the release is the single version a project is entitled to choose,
49
+ * and upgrading it is the repair every line in the two harness groups names.
50
+ * @param name the declared name.
51
+ * @param pinnedByHarness every name ploaness pins.
52
+ * @returns true when the project may not change the version on its own.
53
+ */
54
+ export declare const isVersionDecidedByHarness: (name: string, pinnedByHarness: ReadonlySet<string>) => boolean;
55
+ /**
56
+ * Whose repair one coordinate is.
57
+ * @param coordinate the declared coordinate, with the manifest that declares it.
58
+ * @param ownership whose version each name is.
59
+ * @returns the group the finding belongs in.
60
+ */
61
+ export declare const repairOf: (coordinate: DeclaredCoordinate, ownership: FreshnessOwnership) => FreshnessRepair;
62
+ /**
63
+ * Whether a finding is the harness release itself, in the project's own manifest.
64
+ *
65
+ * It is the one line in the project group whose repair is every harness line's repair, so the report
66
+ * says so on it.
67
+ * @param finding the finding to classify.
68
+ * @returns true for `ploaness` declared by the project.
69
+ */
70
+ export declare const isHarnessRelease: (finding: DeclaredCoordinate) => boolean;
71
+ /**
72
+ * Sort the report's findings into the three repair groups, in the order they print.
73
+ *
74
+ * Every group is returned, empty or not, so the caller decides what an empty one prints as; the
75
+ * order within a group is the order the findings arrived in, which is manifest order, so the same tree
76
+ * yields the same report.
77
+ * @param findings every finding the report will print.
78
+ * @param ownership whose version each name is.
79
+ * @returns the three groups, each under its heading.
80
+ */
81
+ export declare const sectionFreshnessReport: (findings: readonly FreshnessFinding[], ownership: FreshnessOwnership) => readonly FreshnessSection[];
82
+ //# sourceMappingURL=freshness-repair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"freshness-repair.d.ts","sourceRoot":"","sources":["../src/freshness-repair.ts"],"names":[],"mappings":"A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