repopo 0.10.0 → 0.12.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 (229) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +41 -2
  3. package/THIRD-PARTY-LICENSES.txt +71 -11
  4. package/bin/dev.js +5 -1
  5. package/esm/baseCommand.d.ts +1 -1
  6. package/esm/baseCommand.d.ts.map +1 -1
  7. package/esm/baseCommand.js +6 -9
  8. package/esm/baseCommand.js.map +1 -1
  9. package/esm/commands/check-native.d.ts +25 -0
  10. package/esm/commands/check-native.d.ts.map +1 -0
  11. package/esm/commands/check-native.js +137 -0
  12. package/esm/commands/check-native.js.map +1 -0
  13. package/esm/commands/check.d.ts +8 -20
  14. package/esm/commands/check.d.ts.map +1 -1
  15. package/esm/commands/check.js +77 -186
  16. package/esm/commands/check.js.map +1 -1
  17. package/esm/commands/list.d.ts.map +1 -1
  18. package/esm/commands/list.js +5 -6
  19. package/esm/commands/list.js.map +1 -1
  20. package/esm/context.d.ts +13 -3
  21. package/esm/context.d.ts.map +1 -1
  22. package/esm/context.js +11 -1
  23. package/esm/context.js.map +1 -1
  24. package/esm/index.d.ts +6 -1
  25. package/esm/index.d.ts.map +1 -1
  26. package/esm/index.js +3 -0
  27. package/esm/index.js.map +1 -1
  28. package/esm/makePolicy.d.ts +29 -2
  29. package/esm/makePolicy.d.ts.map +1 -1
  30. package/esm/makePolicy.js +46 -2
  31. package/esm/makePolicy.js.map +1 -1
  32. package/esm/perf.d.ts +7 -2
  33. package/esm/perf.d.ts.map +1 -1
  34. package/esm/perf.js.map +1 -1
  35. package/esm/policies/CargoLicenceValidated.d.ts +41 -0
  36. package/esm/policies/CargoLicenceValidated.d.ts.map +1 -0
  37. package/esm/policies/CargoLicenceValidated.js +45 -0
  38. package/esm/policies/CargoLicenceValidated.js.map +1 -0
  39. package/esm/policies/CargoLintsConfigured.d.ts +30 -0
  40. package/esm/policies/CargoLintsConfigured.d.ts.map +1 -0
  41. package/esm/policies/CargoLintsConfigured.js +61 -0
  42. package/esm/policies/CargoLintsConfigured.js.map +1 -0
  43. package/esm/policies/CargoLockPolicy.d.ts +34 -0
  44. package/esm/policies/CargoLockPolicy.d.ts.map +1 -0
  45. package/esm/policies/CargoLockPolicy.js +57 -0
  46. package/esm/policies/CargoLockPolicy.js.map +1 -0
  47. package/esm/policies/CargoTomlRequired.d.ts +34 -0
  48. package/esm/policies/CargoTomlRequired.d.ts.map +1 -0
  49. package/esm/policies/CargoTomlRequired.js +77 -0
  50. package/esm/policies/CargoTomlRequired.js.map +1 -0
  51. package/esm/policies/CargoTomlSorted.d.ts +20 -0
  52. package/esm/policies/CargoTomlSorted.d.ts.map +1 -0
  53. package/esm/policies/CargoTomlSorted.js +164 -0
  54. package/esm/policies/CargoTomlSorted.js.map +1 -0
  55. package/esm/policies/ConditionalScripts.d.ts.map +1 -1
  56. package/esm/policies/ConditionalScripts.js +3 -2
  57. package/esm/policies/ConditionalScripts.js.map +1 -1
  58. package/esm/policies/ExactScripts.d.ts.map +1 -1
  59. package/esm/policies/ExactScripts.js +3 -2
  60. package/esm/policies/ExactScripts.js.map +1 -1
  61. package/esm/policies/GleamDepVersions.d.ts +25 -0
  62. package/esm/policies/GleamDepVersions.d.ts.map +1 -0
  63. package/esm/policies/GleamDepVersions.js +67 -0
  64. package/esm/policies/GleamDepVersions.js.map +1 -0
  65. package/esm/policies/GleamDocExists.d.ts +24 -0
  66. package/esm/policies/GleamDocExists.d.ts.map +1 -0
  67. package/esm/policies/GleamDocExists.js +39 -0
  68. package/esm/policies/GleamDocExists.js.map +1 -0
  69. package/esm/policies/GleamInternalModulesConfigured.d.ts +21 -0
  70. package/esm/policies/GleamInternalModulesConfigured.d.ts.map +1 -0
  71. package/esm/policies/GleamInternalModulesConfigured.js +30 -0
  72. package/esm/policies/GleamInternalModulesConfigured.js.map +1 -0
  73. package/esm/policies/GleamLicenceConfigured.d.ts +29 -0
  74. package/esm/policies/GleamLicenceConfigured.d.ts.map +1 -0
  75. package/esm/policies/GleamLicenceConfigured.js +34 -0
  76. package/esm/policies/GleamLicenceConfigured.js.map +1 -0
  77. package/esm/policies/GleamManifestCommitted.d.ts +9 -0
  78. package/esm/policies/GleamManifestCommitted.d.ts.map +1 -0
  79. package/esm/policies/GleamManifestCommitted.js +26 -0
  80. package/esm/policies/GleamManifestCommitted.js.map +1 -0
  81. package/esm/policies/GleamMonorepoConsistency.d.ts +30 -0
  82. package/esm/policies/GleamMonorepoConsistency.d.ts.map +1 -0
  83. package/esm/policies/GleamMonorepoConsistency.js +74 -0
  84. package/esm/policies/GleamMonorepoConsistency.js.map +1 -0
  85. package/esm/policies/GleamNameRestrictions.d.ts +25 -0
  86. package/esm/policies/GleamNameRestrictions.d.ts.map +1 -0
  87. package/esm/policies/GleamNameRestrictions.js +44 -0
  88. package/esm/policies/GleamNameRestrictions.js.map +1 -0
  89. package/esm/policies/GleamNoPathDepsInPublished.d.ts +22 -0
  90. package/esm/policies/GleamNoPathDepsInPublished.d.ts.map +1 -0
  91. package/esm/policies/GleamNoPathDepsInPublished.js +43 -0
  92. package/esm/policies/GleamNoPathDepsInPublished.js.map +1 -0
  93. package/esm/policies/GleamPathDepsValid.d.ts +9 -0
  94. package/esm/policies/GleamPathDepsValid.d.ts.map +1 -0
  95. package/esm/policies/GleamPathDepsValid.js +59 -0
  96. package/esm/policies/GleamPathDepsValid.js.map +1 -0
  97. package/esm/policies/GleamProjectStructure.d.ts +25 -0
  98. package/esm/policies/GleamProjectStructure.d.ts.map +1 -0
  99. package/esm/policies/GleamProjectStructure.js +33 -0
  100. package/esm/policies/GleamProjectStructure.js.map +1 -0
  101. package/esm/policies/GleamSharedDependencyVersions.d.ts +29 -0
  102. package/esm/policies/GleamSharedDependencyVersions.d.ts.map +1 -0
  103. package/esm/policies/GleamSharedDependencyVersions.js +101 -0
  104. package/esm/policies/GleamSharedDependencyVersions.js.map +1 -0
  105. package/esm/policies/GleamTomlRequired.d.ts +30 -0
  106. package/esm/policies/GleamTomlRequired.d.ts.map +1 -0
  107. package/esm/policies/GleamTomlRequired.js +37 -0
  108. package/esm/policies/GleamTomlRequired.js.map +1 -0
  109. package/esm/policies/GleamTomlSorted.d.ts +20 -0
  110. package/esm/policies/GleamTomlSorted.d.ts.map +1 -0
  111. package/esm/policies/GleamTomlSorted.js +153 -0
  112. package/esm/policies/GleamTomlSorted.js.map +1 -0
  113. package/esm/policies/GleamVersionConstraint.d.ts +20 -0
  114. package/esm/policies/GleamVersionConstraint.d.ts.map +1 -0
  115. package/esm/policies/GleamVersionConstraint.js +64 -0
  116. package/esm/policies/GleamVersionConstraint.js.map +1 -0
  117. package/esm/policies/HtmlFileHeaders.js +1 -1
  118. package/esm/policies/HtmlFileHeaders.js.map +1 -1
  119. package/esm/policies/NoBuildDirectory.d.ts +9 -0
  120. package/esm/policies/NoBuildDirectory.d.ts.map +1 -0
  121. package/esm/policies/NoBuildDirectory.js +29 -0
  122. package/esm/policies/NoBuildDirectory.js.map +1 -0
  123. package/esm/policies/NoTargetArtifacts.d.ts +8 -0
  124. package/esm/policies/NoTargetArtifacts.d.ts.map +1 -0
  125. package/esm/policies/NoTargetArtifacts.js +42 -0
  126. package/esm/policies/NoTargetArtifacts.js.map +1 -0
  127. package/esm/policies/NoUnsafeWithoutJustification.d.ts +24 -0
  128. package/esm/policies/NoUnsafeWithoutJustification.d.ts.map +1 -0
  129. package/esm/policies/NoUnsafeWithoutJustification.js +80 -0
  130. package/esm/policies/NoUnsafeWithoutJustification.js.map +1 -0
  131. package/esm/policies/NoWildcardDependencies.d.ts +30 -0
  132. package/esm/policies/NoWildcardDependencies.d.ts.map +1 -0
  133. package/esm/policies/NoWildcardDependencies.js +83 -0
  134. package/esm/policies/NoWildcardDependencies.js.map +1 -0
  135. package/esm/policies/PackageEsmType.d.ts.map +1 -1
  136. package/esm/policies/PackageEsmType.js +7 -5
  137. package/esm/policies/PackageEsmType.js.map +1 -1
  138. package/esm/policies/PackageJsonProperties.d.ts.map +1 -1
  139. package/esm/policies/PackageJsonProperties.js +12 -4
  140. package/esm/policies/PackageJsonProperties.js.map +1 -1
  141. package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts.map +1 -1
  142. package/esm/policies/PackageJsonRepoDirectoryProperty.js +3 -2
  143. package/esm/policies/PackageJsonRepoDirectoryProperty.js.map +1 -1
  144. package/esm/policies/PackageJsonSorted.d.ts.map +1 -1
  145. package/esm/policies/PackageJsonSorted.js +42 -7
  146. package/esm/policies/PackageJsonSorted.js.map +1 -1
  147. package/esm/policies/PackageLicense.d.ts.map +1 -1
  148. package/esm/policies/PackageLicense.js +1 -2
  149. package/esm/policies/PackageLicense.js.map +1 -1
  150. package/esm/policies/PackagePrivateField.d.ts.map +1 -1
  151. package/esm/policies/PackagePrivateField.js +3 -2
  152. package/esm/policies/PackagePrivateField.js.map +1 -1
  153. package/esm/policies/PackageReadme.js +2 -2
  154. package/esm/policies/PackageReadme.js.map +1 -1
  155. package/esm/policies/PackageScripts.d.ts.map +1 -1
  156. package/esm/policies/PackageScripts.js +3 -2
  157. package/esm/policies/PackageScripts.js.map +1 -1
  158. package/esm/policies/PackageTestScripts.js +3 -3
  159. package/esm/policies/PackageTestScripts.js.map +1 -1
  160. package/esm/policies/PublicApiDocumented.d.ts +21 -0
  161. package/esm/policies/PublicApiDocumented.d.ts.map +1 -0
  162. package/esm/policies/PublicApiDocumented.js +36 -0
  163. package/esm/policies/PublicApiDocumented.js.map +1 -0
  164. package/esm/policies/RequiredScripts.d.ts.map +1 -1
  165. package/esm/policies/RequiredScripts.js +3 -2
  166. package/esm/policies/RequiredScripts.js.map +1 -1
  167. package/esm/policies/RustDocExists.d.ts +24 -0
  168. package/esm/policies/RustDocExists.d.ts.map +1 -0
  169. package/esm/policies/RustDocExists.js +49 -0
  170. package/esm/policies/RustDocExists.js.map +1 -0
  171. package/esm/policies/RustToolchainExists.d.ts +20 -0
  172. package/esm/policies/RustToolchainExists.d.ts.map +1 -0
  173. package/esm/policies/RustToolchainExists.js +27 -0
  174. package/esm/policies/RustToolchainExists.js.map +1 -0
  175. package/esm/policies/RustfmtConfigExists.d.ts +20 -0
  176. package/esm/policies/RustfmtConfigExists.d.ts.map +1 -0
  177. package/esm/policies/RustfmtConfigExists.js +27 -0
  178. package/esm/policies/RustfmtConfigExists.js.map +1 -0
  179. package/esm/policies/SharedDependencyVersions.d.ts +24 -0
  180. package/esm/policies/SharedDependencyVersions.d.ts.map +1 -0
  181. package/esm/policies/SharedDependencyVersions.js +135 -0
  182. package/esm/policies/SharedDependencyVersions.js.map +1 -0
  183. package/esm/policies/WorkspaceInheritance.d.ts +24 -0
  184. package/esm/policies/WorkspaceInheritance.d.ts.map +1 -0
  185. package/esm/policies/WorkspaceInheritance.js +94 -0
  186. package/esm/policies/WorkspaceInheritance.js.map +1 -0
  187. package/esm/policies/WorkspaceMembersValid.d.ts +20 -0
  188. package/esm/policies/WorkspaceMembersValid.d.ts.map +1 -0
  189. package/esm/policies/WorkspaceMembersValid.js +88 -0
  190. package/esm/policies/WorkspaceMembersValid.js.map +1 -0
  191. package/esm/policies/constants.d.ts +8 -0
  192. package/esm/policies/constants.d.ts.map +1 -1
  193. package/esm/policies/constants.js +8 -0
  194. package/esm/policies/constants.js.map +1 -1
  195. package/esm/policies.d.ts +30 -0
  196. package/esm/policies.d.ts.map +1 -1
  197. package/esm/policies.js +51 -1
  198. package/esm/policies.js.map +1 -1
  199. package/esm/policy.d.ts +24 -0
  200. package/esm/policy.d.ts.map +1 -1
  201. package/esm/policy.js.map +1 -1
  202. package/esm/policyDefiners/defineCargoPolicy.d.ts +66 -0
  203. package/esm/policyDefiners/defineCargoPolicy.d.ts.map +1 -0
  204. package/esm/policyDefiners/defineCargoPolicy.js +60 -0
  205. package/esm/policyDefiners/defineCargoPolicy.js.map +1 -0
  206. package/esm/policyDefiners/defineFileHeaderPolicy.d.ts.map +1 -1
  207. package/esm/policyDefiners/defineFileHeaderPolicy.js +6 -7
  208. package/esm/policyDefiners/defineFileHeaderPolicy.js.map +1 -1
  209. package/esm/policyDefiners/defineGleamPolicy.d.ts +65 -0
  210. package/esm/policyDefiners/defineGleamPolicy.d.ts.map +1 -0
  211. package/esm/policyDefiners/defineGleamPolicy.js +59 -0
  212. package/esm/policyDefiners/defineGleamPolicy.js.map +1 -0
  213. package/esm/policyDefiners/spdxValidator.d.ts +74 -0
  214. package/esm/policyDefiners/spdxValidator.d.ts.map +1 -0
  215. package/esm/policyDefiners/spdxValidator.js +127 -0
  216. package/esm/policyDefiners/spdxValidator.js.map +1 -0
  217. package/esm/policyDefiners/tomlParser.d.ts +8 -0
  218. package/esm/policyDefiners/tomlParser.d.ts.map +1 -0
  219. package/esm/policyDefiners/tomlParser.js +17 -0
  220. package/esm/policyDefiners/tomlParser.js.map +1 -0
  221. package/esm/runner.d.ts +60 -0
  222. package/esm/runner.d.ts.map +1 -0
  223. package/esm/runner.js +174 -0
  224. package/esm/runner.js.map +1 -0
  225. package/esm/tsdoc-metadata.json +1 -1
  226. package/oclif.manifest.json +100 -3
  227. package/package.json +46 -31
  228. package/scripts/postinstall.mjs +154 -0
  229. package/sidecar/sidecar.mjs +468 -0
@@ -0,0 +1,24 @@
1
+ import type { PolicyDefinition } from "../policy.js";
2
+ /**
3
+ * Configuration for the WorkspaceInheritance policy.
4
+ *
5
+ * @alpha
6
+ */
7
+ export interface WorkspaceInheritanceConfig {
8
+ /**
9
+ * Package fields that should use workspace inheritance.
10
+ * @defaultValue ["version", "authors", "license", "repository"]
11
+ */
12
+ inherit?: string[];
13
+ /**
14
+ * Crate paths that are allowed to override inherited fields.
15
+ */
16
+ allowOverrides?: string[];
17
+ }
18
+ /**
19
+ * A policy that ensures Cargo workspace members inherit fields from the workspace config.
20
+ *
21
+ * @alpha
22
+ */
23
+ export declare const WorkspaceInheritance: PolicyDefinition<WorkspaceInheritanceConfig>;
24
+ //# sourceMappingURL=WorkspaceInheritance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceInheritance.d.ts","sourceRoot":"","sources":["../../src/policies/WorkspaceInheritance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA0DD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,0BAA0B,CAyD3E,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "pathe";
3
+ import { makePolicyDefinition } from "../makePolicy.js";
4
+ import { parseToml } from "../policyDefiners/tomlParser.js";
5
+ const DEFAULT_INHERIT_FIELDS = ["version", "authors", "license", "repository"];
6
+ /**
7
+ * Check if a member path matches any override pattern.
8
+ */
9
+ function isOverrideAllowed(member, allowOverrides) {
10
+ return allowOverrides.some((pattern) => {
11
+ if (pattern.endsWith("*")) {
12
+ return member.startsWith(pattern.slice(0, -1));
13
+ }
14
+ return member === pattern;
15
+ });
16
+ }
17
+ /**
18
+ * Check a single member's fields for workspace inheritance compliance.
19
+ */
20
+ async function checkMemberInheritance(member, root, availableFields, errors) {
21
+ const memberCargoPath = path.join(root, member, "Cargo.toml");
22
+ try {
23
+ const memberContent = await readFile(memberCargoPath, "utf-8");
24
+ const memberToml = await parseToml(memberContent);
25
+ const memberPkg = memberToml.package;
26
+ if (!memberPkg) {
27
+ return;
28
+ }
29
+ for (const field of availableFields) {
30
+ const value = memberPkg[field];
31
+ // Check if the field uses workspace inheritance
32
+ if (typeof value === "object" &&
33
+ value !== null &&
34
+ value.workspace === true) {
35
+ // Using workspace inheritance - good
36
+ continue;
37
+ }
38
+ if (value !== undefined) {
39
+ errors.push(`${member}: package.${field} should use workspace inheritance (${field}.workspace = true)`);
40
+ }
41
+ }
42
+ }
43
+ catch {
44
+ // Member might not exist (handled by WorkspaceMembersValid)
45
+ }
46
+ }
47
+ /**
48
+ * A policy that ensures Cargo workspace members inherit fields from the workspace config.
49
+ *
50
+ * @alpha
51
+ */
52
+ export const WorkspaceInheritance = makePolicyDefinition({
53
+ name: "WorkspaceInheritance",
54
+ description: "Ensures Cargo workspace members inherit shared fields (version, authors, etc.) from workspace config.",
55
+ match: /^Cargo\.toml$/,
56
+ handler: async ({ file, root, config }) => {
57
+ const content = await readFile(path.resolve(root, file), "utf-8");
58
+ const toml = await parseToml(content);
59
+ const workspace = toml.workspace;
60
+ if (!workspace) {
61
+ return true;
62
+ }
63
+ const members = workspace.members;
64
+ if (!members || members.length === 0) {
65
+ return true;
66
+ }
67
+ const inheritFields = config?.inherit ?? DEFAULT_INHERIT_FIELDS;
68
+ const allowOverrides = config?.allowOverrides ?? [];
69
+ // Check which fields are defined at the workspace level
70
+ const workspacePkg = (workspace.package ?? {});
71
+ const availableFields = inheritFields.filter((field) => workspacePkg[field] !== undefined);
72
+ if (availableFields.length === 0) {
73
+ return true;
74
+ }
75
+ const errors = [];
76
+ for (const member of members) {
77
+ if (member.includes("*")) {
78
+ continue;
79
+ }
80
+ if (isOverrideAllowed(member, allowOverrides)) {
81
+ continue;
82
+ }
83
+ await checkMemberInheritance(member, root, availableFields, errors);
84
+ }
85
+ if (errors.length > 0) {
86
+ return {
87
+ error: errors.join("; "),
88
+ manualFix: "Use workspace inheritance in member Cargo.toml files, e.g., `version.workspace = true`.",
89
+ };
90
+ }
91
+ return true;
92
+ },
93
+ });
94
+ //# sourceMappingURL=WorkspaceInheritance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceInheritance.js","sourceRoot":"","sources":["../../src/policies/WorkspaceInheritance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBA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C;QAEF,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACb,CAAC;QAED,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,SAAS;YACV,CAAC;YAED,IAAI,iBAAiB,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACV,CAAC;YAED,MAAM,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO;gBACN,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;gBACxB,SAAS,EACR,yFAAyF;aAC1F,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport path from \"pathe\";\nimport { makePolicyDefinition } from \"../makePolicy.js\";\nimport type { PolicyDefinition } from \"../policy.js\";\nimport { parseToml } from \"../policyDefiners/tomlParser.js\";\n\n/**\n * Configuration for the WorkspaceInheritance policy.\n *\n * @alpha\n */\nexport interface WorkspaceInheritanceConfig {\n\t/**\n\t * Package fields that should use workspace inheritance.\n\t * @defaultValue [\"version\", \"authors\", \"license\", \"repository\"]\n\t */\n\tinherit?: string[];\n\n\t/**\n\t * Crate paths that are allowed to override inherited fields.\n\t */\n\tallowOverrides?: string[];\n}\n\nconst DEFAULT_INHERIT_FIELDS = [\"version\", \"authors\", \"license\", \"repository\"];\n\n/**\n * Check if a member path matches any override pattern.\n */\nfunction isOverrideAllowed(member: string, allowOverrides: string[]): boolean {\n\treturn allowOverrides.some((pattern) => {\n\t\tif (pattern.endsWith(\"*\")) {\n\t\t\treturn member.startsWith(pattern.slice(0, -1));\n\t\t}\n\t\treturn member === pattern;\n\t});\n}\n\n/**\n * Check a single member's fields for workspace inheritance compliance.\n */\nasync function checkMemberInheritance(\n\tmember: string,\n\troot: string,\n\tavailableFields: string[],\n\terrors: string[],\n): Promise<void> {\n\tconst memberCargoPath = path.join(root, member, \"Cargo.toml\");\n\n\ttry {\n\t\tconst memberContent = await readFile(memberCargoPath, \"utf-8\");\n\t\tconst memberToml = await parseToml(memberContent);\n\t\tconst memberPkg = memberToml.package as Record<string, unknown> | undefined;\n\n\t\tif (!memberPkg) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const field of availableFields) {\n\t\t\tconst value = memberPkg[field];\n\t\t\t// Check if the field uses workspace inheritance\n\t\t\tif (\n\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\tvalue !== null &&\n\t\t\t\t(value as Record<string, unknown>).workspace === true\n\t\t\t) {\n\t\t\t\t// Using workspace inheritance - good\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (value !== undefined) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`${member}: package.${field} should use workspace inheritance (${field}.workspace = true)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Member might not exist (handled by WorkspaceMembersValid)\n\t}\n}\n\n/**\n * A policy that ensures Cargo workspace members inherit fields from the workspace config.\n *\n * @alpha\n */\nexport const WorkspaceInheritance: PolicyDefinition<WorkspaceInheritanceConfig> =\n\tmakePolicyDefinition({\n\t\tname: \"WorkspaceInheritance\",\n\t\tdescription:\n\t\t\t\"Ensures Cargo workspace members inherit shared fields (version, authors, etc.) from workspace config.\",\n\t\tmatch: /^Cargo\\.toml$/,\n\t\thandler: async ({ file, root, config }) => {\n\t\t\tconst content = await readFile(path.resolve(root, file), \"utf-8\");\n\t\t\tconst toml = await parseToml(content);\n\n\t\t\tconst workspace = toml.workspace as Record<string, unknown> | undefined;\n\t\t\tif (!workspace) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst members = workspace.members as string[] | undefined;\n\t\t\tif (!members || members.length === 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst inheritFields = config?.inherit ?? DEFAULT_INHERIT_FIELDS;\n\t\t\tconst allowOverrides = config?.allowOverrides ?? [];\n\n\t\t\t// Check which fields are defined at the workspace level\n\t\t\tconst workspacePkg = (workspace.package ?? {}) as Record<string, unknown>;\n\t\t\tconst availableFields = inheritFields.filter(\n\t\t\t\t(field) => workspacePkg[field] !== undefined,\n\t\t\t);\n\n\t\t\tif (availableFields.length === 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst errors: string[] = [];\n\n\t\t\tfor (const member of members) {\n\t\t\t\tif (member.includes(\"*\")) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (isOverrideAllowed(member, allowOverrides)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tawait checkMemberInheritance(member, root, availableFields, errors);\n\t\t\t}\n\n\t\t\tif (errors.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\terror: errors.join(\"; \"),\n\t\t\t\t\tmanualFix:\n\t\t\t\t\t\t\"Use workspace inheritance in member Cargo.toml files, e.g., `version.workspace = true`.\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t});\n"]}
@@ -0,0 +1,20 @@
1
+ import type { PolicyDefinition } from "../policy.js";
2
+ /**
3
+ * Configuration for the WorkspaceMembersValid policy.
4
+ *
5
+ * @alpha
6
+ */
7
+ export interface WorkspaceMembersValidConfig {
8
+ /**
9
+ * If true, validate that all member paths exist on disk.
10
+ * @defaultValue true
11
+ */
12
+ validatePaths?: boolean;
13
+ }
14
+ /**
15
+ * A policy that validates Cargo workspace member paths exist.
16
+ *
17
+ * @alpha
18
+ */
19
+ export declare const WorkspaceMembersValid: PolicyDefinition<WorkspaceMembersValidConfig>;
20
+ //# sourceMappingURL=WorkspaceMembersValid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceMembersValid.d.ts","sourceRoot":"","sources":["../../src/policies/WorkspaceMembersValid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAoDD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,2BAA2B,CA0C7E,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { existsSync, readdirSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "pathe";
4
+ import { makePolicyDefinition } from "../makePolicy.js";
5
+ import { parseToml } from "../policyDefiners/tomlParser.js";
6
+ const GLOB_SUFFIX_REGEX = /\/?\*\*?$/;
7
+ /**
8
+ * Expand a simple glob pattern (e.g., "crates/*") into matching directories.
9
+ */
10
+ function expandSimpleGlob(root, pattern) {
11
+ if (!pattern.includes("*")) {
12
+ return [pattern];
13
+ }
14
+ const base = pattern.replace(GLOB_SUFFIX_REGEX, "");
15
+ const baseDir = path.join(root, base);
16
+ if (!existsSync(baseDir)) {
17
+ return [];
18
+ }
19
+ try {
20
+ const entries = readdirSync(baseDir, { withFileTypes: true });
21
+ return entries
22
+ .filter((e) => e.isDirectory())
23
+ .filter((e) => existsSync(path.join(baseDir, e.name, "Cargo.toml")))
24
+ .map((e) => path.join(base, e.name));
25
+ }
26
+ catch {
27
+ return [];
28
+ }
29
+ }
30
+ /**
31
+ * Validate a single workspace member entry.
32
+ */
33
+ function validateMember(member, root, errors) {
34
+ if (member.includes("*")) {
35
+ // Expand glob and check each result
36
+ const expanded = expandSimpleGlob(root, member);
37
+ if (expanded.length === 0) {
38
+ errors.push(`Workspace member glob "${member}" matches no directories with Cargo.toml`);
39
+ }
40
+ }
41
+ else {
42
+ const memberPath = path.join(root, member);
43
+ if (!existsSync(memberPath)) {
44
+ errors.push(`Workspace member "${member}" does not exist`);
45
+ }
46
+ else if (!existsSync(path.join(memberPath, "Cargo.toml"))) {
47
+ errors.push(`Workspace member "${member}" exists but has no Cargo.toml`);
48
+ }
49
+ }
50
+ }
51
+ /**
52
+ * A policy that validates Cargo workspace member paths exist.
53
+ *
54
+ * @alpha
55
+ */
56
+ export const WorkspaceMembersValid = makePolicyDefinition({
57
+ name: "WorkspaceMembersValid",
58
+ description: "Validates that all Cargo workspace member paths exist and contain Cargo.toml files.",
59
+ match: /^Cargo\.toml$/,
60
+ handler: async ({ file, root, config }) => {
61
+ const validatePaths = config?.validatePaths ?? true;
62
+ const content = await readFile(path.resolve(root, file), "utf-8");
63
+ const toml = await parseToml(content);
64
+ const workspace = toml.workspace;
65
+ if (!workspace) {
66
+ return true;
67
+ }
68
+ const members = workspace.members;
69
+ if (!members || members.length === 0) {
70
+ return true;
71
+ }
72
+ if (!validatePaths) {
73
+ return true;
74
+ }
75
+ const errors = [];
76
+ for (const member of members) {
77
+ validateMember(member, root, errors);
78
+ }
79
+ if (errors.length > 0) {
80
+ return {
81
+ error: errors.join("; "),
82
+ manualFix: "Fix the workspace.members paths in root Cargo.toml to point to valid crate directories.",
83
+ };
84
+ }
85
+ return true;
86
+ },
87
+ });
88
+ //# sourceMappingURL=WorkspaceMembersValid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceMembersValid.js","sourceRoot":"","sources":["../../src/policies/WorkspaceMembersValid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAe5D,MAAM,iBAAiB,GAAG,W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YACtC,OAAO,IAAI,CAAC;QACb,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO;gBACN,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;gBACxB,SAAS,EACR,yFAAyF;aAC1F,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC,CAAC","sourcesContent":["import { existsSync, readdirSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport path from \"pathe\";\nimport { makePolicyDefinition } from \"../makePolicy.js\";\nimport type { PolicyDefinition } from \"../policy.js\";\nimport { parseToml } from \"../policyDefiners/tomlParser.js\";\n\n/**\n * Configuration for the WorkspaceMembersValid policy.\n *\n * @alpha\n */\nexport interface WorkspaceMembersValidConfig {\n\t/**\n\t * If true, validate that all member paths exist on disk.\n\t * @defaultValue true\n\t */\n\tvalidatePaths?: boolean;\n}\n\nconst GLOB_SUFFIX_REGEX = /\\/?\\*\\*?$/;\n\n/**\n * Expand a simple glob pattern (e.g., \"crates/*\") into matching directories.\n */\nfunction expandSimpleGlob(root: string, pattern: string): string[] {\n\tif (!pattern.includes(\"*\")) {\n\t\treturn [pattern];\n\t}\n\n\tconst base = pattern.replace(GLOB_SUFFIX_REGEX, \"\");\n\tconst baseDir = path.join(root, base);\n\n\tif (!existsSync(baseDir)) {\n\t\treturn [];\n\t}\n\n\ttry {\n\t\tconst entries = readdirSync(baseDir, { withFileTypes: true });\n\t\treturn entries\n\t\t\t.filter((e) => e.isDirectory())\n\t\t\t.filter((e) => existsSync(path.join(baseDir, e.name, \"Cargo.toml\")))\n\t\t\t.map((e) => path.join(base, e.name));\n\t} catch {\n\t\treturn [];\n\t}\n}\n\n/**\n * Validate a single workspace member entry.\n */\nfunction validateMember(member: string, root: string, errors: string[]): void {\n\tif (member.includes(\"*\")) {\n\t\t// Expand glob and check each result\n\t\tconst expanded = expandSimpleGlob(root, member);\n\t\tif (expanded.length === 0) {\n\t\t\terrors.push(\n\t\t\t\t`Workspace member glob \"${member}\" matches no directories with Cargo.toml`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst memberPath = path.join(root, member);\n\t\tif (!existsSync(memberPath)) {\n\t\t\terrors.push(`Workspace member \"${member}\" does not exist`);\n\t\t} else if (!existsSync(path.join(memberPath, \"Cargo.toml\"))) {\n\t\t\terrors.push(`Workspace member \"${member}\" exists but has no Cargo.toml`);\n\t\t}\n\t}\n}\n\n/**\n * A policy that validates Cargo workspace member paths exist.\n *\n * @alpha\n */\nexport const WorkspaceMembersValid: PolicyDefinition<WorkspaceMembersValidConfig> =\n\tmakePolicyDefinition({\n\t\tname: \"WorkspaceMembersValid\",\n\t\tdescription:\n\t\t\t\"Validates that all Cargo workspace member paths exist and contain Cargo.toml files.\",\n\t\tmatch: /^Cargo\\.toml$/,\n\t\thandler: async ({ file, root, config }) => {\n\t\t\tconst validatePaths = config?.validatePaths ?? true;\n\n\t\t\tconst content = await readFile(path.resolve(root, file), \"utf-8\");\n\t\t\tconst toml = await parseToml(content);\n\n\t\t\tconst workspace = toml.workspace as Record<string, unknown> | undefined;\n\t\t\tif (!workspace) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst members = workspace.members as string[] | undefined;\n\t\t\tif (!members || members.length === 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (!validatePaths) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst errors: string[] = [];\n\n\t\t\tfor (const member of members) {\n\t\t\t\tvalidateMember(member, root, errors);\n\t\t\t}\n\n\t\t\tif (errors.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\terror: errors.join(\"; \"),\n\t\t\t\t\tmanualFix:\n\t\t\t\t\t\t\"Fix the workspace.members paths in root Cargo.toml to point to valid crate directories.\",\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t});\n"]}
@@ -2,4 +2,12 @@
2
2
  * A regular expression that matches package.json files in path strings.
3
3
  */
4
4
  export declare const PackageJsonRegexMatch: RegExp;
5
+ /**
6
+ * A regular expression that matches Cargo.toml files in path strings.
7
+ */
8
+ export declare const CargoTomlRegexMatch: RegExp;
9
+ /**
10
+ * A regular expression that matches gleam.toml files in path strings.
11
+ */
12
+ export declare const GleamTomlRegexMatch: RegExp;
5
13
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/policies/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAAyB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/policies/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAuB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAuB,CAAC"}
@@ -2,4 +2,12 @@
2
2
  * A regular expression that matches package.json files in path strings.
3
3
  */
4
4
  export const PackageJsonRegexMatch = /(^|\/)package\.json/i;
5
+ /**
6
+ * A regular expression that matches Cargo.toml files in path strings.
7
+ */
8
+ export const CargoTomlRegexMatch = /(^|\/)Cargo\.toml$/;
9
+ /**
10
+ * A regular expression that matches gleam.toml files in path strings.
11
+ */
12
+ export const GleamTomlRegexMatch = /(^|\/)gleam\.toml$/;
5
13
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/policies/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC","sourcesContent":["/**\n * A regular expression that matches package.json files in path strings.\n */\nexport const PackageJsonRegexMatch = /(^|\\/)package\\.json/i;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/policies/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC","sourcesContent":["/**\n * A regular expression that matches package.json files in path strings.\n */\nexport const PackageJsonRegexMatch = /(^|\\/)package\\.json/i;\n\n/**\n * A regular expression that matches Cargo.toml files in path strings.\n */\nexport const CargoTomlRegexMatch = /(^|\\/)Cargo\\.toml$/;\n\n/**\n * A regular expression that matches gleam.toml files in path strings.\n */\nexport const GleamTomlRegexMatch = /(^|\\/)gleam\\.toml$/;\n"]}
package/esm/policies.d.ts CHANGED
@@ -1,12 +1,35 @@
1
+ export { CargoLicenceValidated, type CargoLicenceValidatedConfig, } from "./policies/CargoLicenceValidated.js";
2
+ export { CargoLintsConfigured, type CargoLintsConfiguredConfig, } from "./policies/CargoLintsConfigured.js";
3
+ export { CargoLockPolicy, type CargoLockPolicyConfig, } from "./policies/CargoLockPolicy.js";
4
+ export { CargoTomlRequired, type CargoTomlRequiredConfig, } from "./policies/CargoTomlRequired.js";
5
+ export { CargoTomlSorted, type CargoTomlSortedConfig, } from "./policies/CargoTomlSorted.js";
1
6
  export { type ConditionalScriptEntry, type ConditionalScriptRule, ConditionalScripts, type ConditionalScriptsConfig, } from "./policies/ConditionalScripts.js";
2
7
  export { ExactScripts, type ExactScriptsConfig, } from "./policies/ExactScripts.js";
8
+ export { GleamDepVersions, type GleamDepVersionsConfig, } from "./policies/GleamDepVersions.js";
9
+ export { GleamDocExists, type GleamDocExistsConfig, } from "./policies/GleamDocExists.js";
10
+ export { GleamInternalModulesConfigured, type GleamInternalModulesConfiguredConfig, } from "./policies/GleamInternalModulesConfigured.js";
11
+ export { GleamLicenceConfigured, type GleamLicenceConfiguredConfig, } from "./policies/GleamLicenceConfigured.js";
12
+ export { GleamManifestCommitted } from "./policies/GleamManifestCommitted.js";
13
+ export { GleamMonorepoConsistency, type GleamMonorepoConsistencyConfig, } from "./policies/GleamMonorepoConsistency.js";
14
+ export { GleamNameRestrictions, type GleamNameRestrictionsConfig, } from "./policies/GleamNameRestrictions.js";
15
+ export { GleamNoPathDepsInPublished, type GleamNoPathDepsInPublishedConfig, } from "./policies/GleamNoPathDepsInPublished.js";
16
+ export { GleamPathDepsValid } from "./policies/GleamPathDepsValid.js";
17
+ export { GleamProjectStructure, type GleamProjectStructureConfig, } from "./policies/GleamProjectStructure.js";
18
+ export { GleamSharedDependencyVersions, type GleamSharedDependencyVersionsConfig, } from "./policies/GleamSharedDependencyVersions.js";
19
+ export { GleamTomlRequired, type GleamTomlRequiredConfig, } from "./policies/GleamTomlRequired.js";
20
+ export { GleamTomlSorted, type GleamTomlSortedConfig, } from "./policies/GleamTomlSorted.js";
21
+ export { GleamVersionConstraint, type GleamVersionConstraintConfig, } from "./policies/GleamVersionConstraint.js";
3
22
  export { HtmlFileHeaders } from "./policies/HtmlFileHeaders.js";
4
23
  export { JsTsFileHeaders } from "./policies/JsTsFileHeaders.js";
5
24
  export { LicenseFileExists } from "./policies/LicenseFileExists.js";
6
25
  export { MutuallyExclusiveScripts, type MutuallyExclusiveScriptsConfig, } from "./policies/MutuallyExclusiveScripts.js";
26
+ export { NoBuildDirectory } from "./policies/NoBuildDirectory.js";
7
27
  export { NoJsFileExtensions } from "./policies/NoJsFileExtensions.js";
8
28
  export { NoLargeBinaryFiles } from "./policies/NoLargeBinaryFiles.js";
9
29
  export { NoPrivateWorkspaceDependencies } from "./policies/NoPrivateWorkspaceDependencies.js";
30
+ export { NoTargetArtifacts } from "./policies/NoTargetArtifacts.js";
31
+ export { NoUnsafeWithoutJustification, type NoUnsafeWithoutJustificationConfig, } from "./policies/NoUnsafeWithoutJustification.js";
32
+ export { NoWildcardDependencies, type NoWildcardDependenciesConfig, } from "./policies/NoWildcardDependencies.js";
10
33
  export { PackageAllowedScopes, type PackageAllowedScopesConfig, } from "./policies/PackageAllowedScopes.js";
11
34
  export { PackageEsmType, type PackageEsmTypeConfig, } from "./policies/PackageEsmType.js";
12
35
  export { PackageFolderName, type PackageFolderNameConfig, } from "./policies/PackageFolderName.js";
@@ -18,8 +41,15 @@ export { PackagePrivateField, type PackagePrivateFieldConfig, } from "./policies
18
41
  export { PackageReadme, type PackageReadmeSettings, } from "./policies/PackageReadme.js";
19
42
  export { type ConditionalScriptRule as LegacyConditionalScriptRule, PackageScripts, type PackageScriptsSettings, type RequiredScriptEntry as LegacyRequiredScriptEntry, type ScriptMustContainRule, } from "./policies/PackageScripts.js";
20
43
  export { PackageTestScripts, type PackageTestScriptsConfig, } from "./policies/PackageTestScripts.js";
44
+ export { PublicApiDocumented, type PublicApiDocumentedConfig, } from "./policies/PublicApiDocumented.js";
21
45
  export { RequiredGitignorePatterns } from "./policies/RequiredGitignorePatterns.js";
22
46
  export { type RequiredScriptEntry, RequiredScripts, type RequiredScriptsConfig, } from "./policies/RequiredScripts.js";
47
+ export { RustDocExists, type RustDocExistsConfig, } from "./policies/RustDocExists.js";
48
+ export { RustfmtConfigExists, type RustfmtConfigExistsConfig, } from "./policies/RustfmtConfigExists.js";
49
+ export { RustToolchainExists, type RustToolchainExistsConfig, } from "./policies/RustToolchainExists.js";
23
50
  export { ScriptContains, type ScriptContainsConfig, type ScriptContainsRule, } from "./policies/ScriptContains.js";
51
+ export { SharedDependencyVersions, type SharedDependencyVersionsConfig, } from "./policies/SharedDependencyVersions.js";
52
+ export { WorkspaceInheritance, type WorkspaceInheritanceConfig, } from "./policies/WorkspaceInheritance.js";
53
+ export { WorkspaceMembersValid, type WorkspaceMembersValidConfig, } from "./policies/WorkspaceMembersValid.js";
24
54
  export { DefaultPolicies } from "./policy.js";
25
55
  //# sourceMappingURL=policies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,kBAAkB,EAClB,KAAK,wBAAwB,GAC7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACN,wBAAwB,EACxB,KAAK,8BAA8B,GACnC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAE9F,OAAO,EACN,oBAAoB,EACpB,KAAK,0BAA0B,GAC/B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACN,cAAc,EACd,KAAK,oBAAoB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iBAAiB,EACjB,KAAK,uBAAuB,GAC5B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACN,cAAc,EACd,KAAK,sBAAsB,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,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C7B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACN,mBAAmB,EACnB,KAAK,yBAAyB,GAC9B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EACN,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,qBAAqB,GAC1B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACN,aAAa,EACb,KAAK,mBAAmB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,mBAAmB,EACnB,KAAK,yBAAyB,GAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,mBAAmB,EACnB,KAAK,yBAAyB,GAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,wBAAwB,EACxB,KAAK,8BAA8B,GACnC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,oBAAoB,EACpB,KAAK,0BAA0B,GAC/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,qBAAqB,EACrB,KAAK,2BAA2B,GAChC,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
package/esm/policies.js CHANGED
@@ -1,19 +1,58 @@
1
- // New focused script policies (replacements for PackageScripts)
1
+ // Cargo.toml / Rust policies
2
2
  // biome-ignore lint/performance/noBarrelFile: intentional public API entry point for policies
3
+ export { CargoLicenceValidated, } from "./policies/CargoLicenceValidated.js";
4
+ export { CargoLintsConfigured, } from "./policies/CargoLintsConfigured.js";
5
+ export { CargoLockPolicy, } from "./policies/CargoLockPolicy.js";
6
+ export { CargoTomlRequired, } from "./policies/CargoTomlRequired.js";
7
+ export { CargoTomlSorted, } from "./policies/CargoTomlSorted.js";
8
+ // New focused script policies (replacements for PackageScripts)
3
9
  export { ConditionalScripts, } from "./policies/ConditionalScripts.js";
4
10
  export { ExactScripts, } from "./policies/ExactScripts.js";
11
+ // Gleam dependency policies
12
+ export { GleamDepVersions, } from "./policies/GleamDepVersions.js";
13
+ // Gleam documentation policies
14
+ export { GleamDocExists, } from "./policies/GleamDocExists.js";
15
+ // Gleam internal modules policies
16
+ export { GleamInternalModulesConfigured, } from "./policies/GleamInternalModulesConfigured.js";
17
+ // Gleam licence policies
18
+ export { GleamLicenceConfigured, } from "./policies/GleamLicenceConfigured.js";
19
+ // Gleam project structure policies
20
+ export { GleamManifestCommitted } from "./policies/GleamManifestCommitted.js";
21
+ // Gleam monorepo policies
22
+ export { GleamMonorepoConsistency, } from "./policies/GleamMonorepoConsistency.js";
23
+ // Gleam naming policies
24
+ export { GleamNameRestrictions, } from "./policies/GleamNameRestrictions.js";
25
+ // Gleam path dependency policies
26
+ export { GleamNoPathDepsInPublished, } from "./policies/GleamNoPathDepsInPublished.js";
27
+ export { GleamPathDepsValid } from "./policies/GleamPathDepsValid.js";
28
+ export { GleamProjectStructure, } from "./policies/GleamProjectStructure.js";
29
+ // Gleam shared dependency version policies
30
+ export { GleamSharedDependencyVersions, } from "./policies/GleamSharedDependencyVersions.js";
31
+ // Gleam toml field policies
32
+ export { GleamTomlRequired, } from "./policies/GleamTomlRequired.js";
33
+ export { GleamTomlSorted, } from "./policies/GleamTomlSorted.js";
34
+ // Gleam version constraint policies
35
+ export { GleamVersionConstraint, } from "./policies/GleamVersionConstraint.js";
5
36
  // File header policies
6
37
  export { HtmlFileHeaders } from "./policies/HtmlFileHeaders.js";
7
38
  export { JsTsFileHeaders } from "./policies/JsTsFileHeaders.js";
8
39
  // License policies
9
40
  export { LicenseFileExists } from "./policies/LicenseFileExists.js";
10
41
  export { MutuallyExclusiveScripts, } from "./policies/MutuallyExclusiveScripts.js";
42
+ // Build directory policies
43
+ export { NoBuildDirectory } from "./policies/NoBuildDirectory.js";
11
44
  // File extension policies
12
45
  export { NoJsFileExtensions } from "./policies/NoJsFileExtensions.js";
13
46
  // File size policies
14
47
  export { NoLargeBinaryFiles } from "./policies/NoLargeBinaryFiles.js";
15
48
  // Dependency policies
16
49
  export { NoPrivateWorkspaceDependencies } from "./policies/NoPrivateWorkspaceDependencies.js";
50
+ // Rust build artifact policies
51
+ export { NoTargetArtifacts } from "./policies/NoTargetArtifacts.js";
52
+ // Rust unsafe code policies
53
+ export { NoUnsafeWithoutJustification, } from "./policies/NoUnsafeWithoutJustification.js";
54
+ // Rust dependency policies
55
+ export { NoWildcardDependencies, } from "./policies/NoWildcardDependencies.js";
17
56
  // Package naming policies
18
57
  export { PackageAllowedScopes, } from "./policies/PackageAllowedScopes.js";
19
58
  // Package type policies
@@ -30,10 +69,21 @@ export { PackageReadme, } from "./policies/PackageReadme.js";
30
69
  // Package script policies (legacy - prefer focused policies above)
31
70
  export { PackageScripts, } from "./policies/PackageScripts.js";
32
71
  export { PackageTestScripts, } from "./policies/PackageTestScripts.js";
72
+ // Rust documentation policies
73
+ export { PublicApiDocumented, } from "./policies/PublicApiDocumented.js";
33
74
  // Gitignore policies
34
75
  export { RequiredGitignorePatterns } from "./policies/RequiredGitignorePatterns.js";
35
76
  export { RequiredScripts, } from "./policies/RequiredScripts.js";
77
+ // Rust documentation file policies
78
+ export { RustDocExists, } from "./policies/RustDocExists.js";
79
+ // Rust project structure policies
80
+ export { RustfmtConfigExists, } from "./policies/RustfmtConfigExists.js";
81
+ export { RustToolchainExists, } from "./policies/RustToolchainExists.js";
36
82
  export { ScriptContains, } from "./policies/ScriptContains.js";
83
+ // Cargo workspace policies
84
+ export { SharedDependencyVersions, } from "./policies/SharedDependencyVersions.js";
85
+ export { WorkspaceInheritance, } from "./policies/WorkspaceInheritance.js";
86
+ export { WorkspaceMembersValid, } from "./policies/WorkspaceMembersValid.js";
37
87
  // Default policies
38
88
  export { DefaultPolicies } from "./policy.js";
39
89
  //# sourceMappingURL=policies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies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,CAAC;AAC1C,qBAAqB;AACrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAEN,eAAe,GAEf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,cAAc,GAGd,MAAM,8BAA8B,CAAC;AAEtC,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC","sourcesContent":["// New focused script policies (replacements for PackageScripts)\n// biome-ignore lint/performance/noBarrelFile: intentional public API entry point for policies\nexport {\n\ttype ConditionalScriptEntry,\n\ttype ConditionalScriptRule,\n\tConditionalScripts,\n\ttype ConditionalScriptsConfig,\n} from \"./policies/ConditionalScripts.js\";\nexport {\n\tExactScripts,\n\ttype ExactScriptsConfig,\n} from \"./policies/ExactScripts.js\";\n// File header policies\nexport { HtmlFileHeaders } from \"./policies/HtmlFileHeaders.js\";\nexport { JsTsFileHeaders } from \"./policies/JsTsFileHeaders.js\";\n// License policies\nexport { LicenseFileExists } from \"./policies/LicenseFileExists.js\";\nexport {\n\tMutuallyExclusiveScripts,\n\ttype MutuallyExclusiveScriptsConfig,\n} from \"./policies/MutuallyExclusiveScripts.js\";\n// File extension policies\nexport { NoJsFileExtensions } from \"./policies/NoJsFileExtensions.js\";\n// File size policies\nexport { NoLargeBinaryFiles } from \"./policies/NoLargeBinaryFiles.js\";\n// Dependency policies\nexport { NoPrivateWorkspaceDependencies } from \"./policies/NoPrivateWorkspaceDependencies.js\";\n// Package naming policies\nexport {\n\tPackageAllowedScopes,\n\ttype PackageAllowedScopesConfig,\n} from \"./policies/PackageAllowedScopes.js\";\n// Package type policies\nexport {\n\tPackageEsmType,\n\ttype PackageEsmTypeConfig,\n} from \"./policies/PackageEsmType.js\";\nexport {\n\tPackageFolderName,\n\ttype PackageFolderNameConfig,\n} from \"./policies/PackageFolderName.js\";\n// Package.json field policies\nexport { PackageJsonProperties } from \"./policies/PackageJsonProperties.js\";\nexport { PackageJsonRepoDirectoryProperty } from \"./policies/PackageJsonRepoDirectoryProperty.js\";\nexport { PackageJsonSorted } from \"./policies/PackageJsonSorted.js\";\nexport {\n\tPackageLicense,\n\ttype PackageLicenseSettings,\n} from \"./policies/PackageLicense.js\";\nexport {\n\tPackagePrivateField,\n\ttype PackagePrivateFieldConfig,\n} from \"./policies/PackagePrivateField.js\";\n// Package readme policies\nexport {\n\tPackageReadme,\n\ttype PackageReadmeSettings,\n} from \"./policies/PackageReadme.js\";\n// Package script policies (legacy - prefer focused policies above)\nexport {\n\ttype ConditionalScriptRule as LegacyConditionalScriptRule,\n\tPackageScripts,\n\ttype PackageScriptsSettings,\n\ttype RequiredScriptEntry as LegacyRequiredScriptEntry,\n\ttype ScriptMustContainRule,\n} from \"./policies/PackageScripts.js\";\nexport {\n\tPackageTestScripts,\n\ttype PackageTestScriptsConfig,\n} from \"./policies/PackageTestScripts.js\";\n// Gitignore policies\nexport { RequiredGitignorePatterns } from \"./policies/RequiredGitignorePatterns.js\";\nexport {\n\ttype RequiredScriptEntry,\n\tRequiredScripts,\n\ttype RequiredScriptsConfig,\n} from \"./policies/RequiredScripts.js\";\nexport {\n\tScriptContains,\n\ttype ScriptContainsConfig,\n\ttype ScriptContainsRule,\n} from \"./policies/ScriptContains.js\";\n\n// Default policies\nexport { DefaultPolicies } from \"./policy.js\";\n"]}
1
+ {"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,8FAA8F;AAC9F,OAAO,EACN,qBAAqB,GAErB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,oBAAoB,GAEpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,eAAe,GAEf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,iBAAiB,GAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,eAAe,GAEf,MAAM,+BAA+B,CAAC;AACvC,gEAAgE;AAChE,OAAO,EAGN,kBAAkB,GAElB,MAAM,kCAAkC,CAAC;AAC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N,eAAe,GAEf,MAAM,+BAA+B,CAAC;AACvC,mCAAmC;AACnC,OAAO,EACN,aAAa,GAEb,MAAM,6BAA6B,CAAC;AACrC,kCAAkC;AAClC,OAAO,EACN,mBAAmB,GAEnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,mBAAmB,GAEnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,cAAc,GAGd,MAAM,8BAA8B,CAAC;AACtC,2BAA2B;AAC3B,OAAO,EACN,wBAAwB,GAExB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,oBAAoB,GAEpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,qBAAqB,GAErB,MAAM,qCAAqC,CAAC;AAC7C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC","sourcesContent":["// Cargo.toml / Rust policies\n// biome-ignore lint/performance/noBarrelFile: intentional public API entry point for policies\nexport {\n\tCargoLicenceValidated,\n\ttype CargoLicenceValidatedConfig,\n} from \"./policies/CargoLicenceValidated.js\";\nexport {\n\tCargoLintsConfigured,\n\ttype CargoLintsConfiguredConfig,\n} from \"./policies/CargoLintsConfigured.js\";\nexport {\n\tCargoLockPolicy,\n\ttype CargoLockPolicyConfig,\n} from \"./policies/CargoLockPolicy.js\";\nexport {\n\tCargoTomlRequired,\n\ttype CargoTomlRequiredConfig,\n} from \"./policies/CargoTomlRequired.js\";\nexport {\n\tCargoTomlSorted,\n\ttype CargoTomlSortedConfig,\n} from \"./policies/CargoTomlSorted.js\";\n// New focused script policies (replacements for PackageScripts)\nexport {\n\ttype ConditionalScriptEntry,\n\ttype ConditionalScriptRule,\n\tConditionalScripts,\n\ttype ConditionalScriptsConfig,\n} from \"./policies/ConditionalScripts.js\";\nexport {\n\tExactScripts,\n\ttype ExactScriptsConfig,\n} from \"./policies/ExactScripts.js\";\n// Gleam dependency policies\nexport {\n\tGleamDepVersions,\n\ttype GleamDepVersionsConfig,\n} from \"./policies/GleamDepVersions.js\";\n// Gleam documentation policies\nexport {\n\tGleamDocExists,\n\ttype GleamDocExistsConfig,\n} from \"./policies/GleamDocExists.js\";\n// Gleam internal modules policies\nexport {\n\tGleamInternalModulesConfigured,\n\ttype GleamInternalModulesConfiguredConfig,\n} from \"./policies/GleamInternalModulesConfigured.js\";\n// Gleam licence policies\nexport {\n\tGleamLicenceConfigured,\n\ttype GleamLicenceConfiguredConfig,\n} from \"./policies/GleamLicenceConfigured.js\";\n// Gleam project structure policies\nexport { GleamManifestCommitted } from \"./policies/GleamManifestCommitted.js\";\n// Gleam monorepo policies\nexport {\n\tGleamMonorepoConsistency,\n\ttype GleamMonorepoConsistencyConfig,\n} from \"./policies/GleamMonorepoConsistency.js\";\n// Gleam naming policies\nexport {\n\tGleamNameRestrictions,\n\ttype GleamNameRestrictionsConfig,\n} from \"./policies/GleamNameRestrictions.js\";\n// Gleam path dependency policies\nexport {\n\tGleamNoPathDepsInPublished,\n\ttype GleamNoPathDepsInPublishedConfig,\n} from \"./policies/GleamNoPathDepsInPublished.js\";\nexport { GleamPathDepsValid } from \"./policies/GleamPathDepsValid.js\";\nexport {\n\tGleamProjectStructure,\n\ttype GleamProjectStructureConfig,\n} from \"./policies/GleamProjectStructure.js\";\n// Gleam shared dependency version policies\nexport {\n\tGleamSharedDependencyVersions,\n\ttype GleamSharedDependencyVersionsConfig,\n} from \"./policies/GleamSharedDependencyVersions.js\";\n// Gleam toml field policies\nexport {\n\tGleamTomlRequired,\n\ttype GleamTomlRequiredConfig,\n} from \"./policies/GleamTomlRequired.js\";\nexport {\n\tGleamTomlSorted,\n\ttype GleamTomlSortedConfig,\n} from \"./policies/GleamTomlSorted.js\";\n// Gleam version constraint policies\nexport {\n\tGleamVersionConstraint,\n\ttype GleamVersionConstraintConfig,\n} from \"./policies/GleamVersionConstraint.js\";\n// File header policies\nexport { HtmlFileHeaders } from \"./policies/HtmlFileHeaders.js\";\nexport { JsTsFileHeaders } from \"./policies/JsTsFileHeaders.js\";\n// License policies\nexport { LicenseFileExists } from \"./policies/LicenseFileExists.js\";\nexport {\n\tMutuallyExclusiveScripts,\n\ttype MutuallyExclusiveScriptsConfig,\n} from \"./policies/MutuallyExclusiveScripts.js\";\n// Build directory policies\nexport { NoBuildDirectory } from \"./policies/NoBuildDirectory.js\";\n// File extension policies\nexport { NoJsFileExtensions } from \"./policies/NoJsFileExtensions.js\";\n// File size policies\nexport { NoLargeBinaryFiles } from \"./policies/NoLargeBinaryFiles.js\";\n// Dependency policies\nexport { NoPrivateWorkspaceDependencies } from \"./policies/NoPrivateWorkspaceDependencies.js\";\n// Rust build artifact policies\nexport { NoTargetArtifacts } from \"./policies/NoTargetArtifacts.js\";\n// Rust unsafe code policies\nexport {\n\tNoUnsafeWithoutJustification,\n\ttype NoUnsafeWithoutJustificationConfig,\n} from \"./policies/NoUnsafeWithoutJustification.js\";\n// Rust dependency policies\nexport {\n\tNoWildcardDependencies,\n\ttype NoWildcardDependenciesConfig,\n} from \"./policies/NoWildcardDependencies.js\";\n// Package naming policies\nexport {\n\tPackageAllowedScopes,\n\ttype PackageAllowedScopesConfig,\n} from \"./policies/PackageAllowedScopes.js\";\n// Package type policies\nexport {\n\tPackageEsmType,\n\ttype PackageEsmTypeConfig,\n} from \"./policies/PackageEsmType.js\";\nexport {\n\tPackageFolderName,\n\ttype PackageFolderNameConfig,\n} from \"./policies/PackageFolderName.js\";\n// Package.json field policies\nexport { PackageJsonProperties } from \"./policies/PackageJsonProperties.js\";\nexport { PackageJsonRepoDirectoryProperty } from \"./policies/PackageJsonRepoDirectoryProperty.js\";\nexport { PackageJsonSorted } from \"./policies/PackageJsonSorted.js\";\nexport {\n\tPackageLicense,\n\ttype PackageLicenseSettings,\n} from \"./policies/PackageLicense.js\";\nexport {\n\tPackagePrivateField,\n\ttype PackagePrivateFieldConfig,\n} from \"./policies/PackagePrivateField.js\";\n// Package readme policies\nexport {\n\tPackageReadme,\n\ttype PackageReadmeSettings,\n} from \"./policies/PackageReadme.js\";\n// Package script policies (legacy - prefer focused policies above)\nexport {\n\ttype ConditionalScriptRule as LegacyConditionalScriptRule,\n\tPackageScripts,\n\ttype PackageScriptsSettings,\n\ttype RequiredScriptEntry as LegacyRequiredScriptEntry,\n\ttype ScriptMustContainRule,\n} from \"./policies/PackageScripts.js\";\nexport {\n\tPackageTestScripts,\n\ttype PackageTestScriptsConfig,\n} from \"./policies/PackageTestScripts.js\";\n// Rust documentation policies\nexport {\n\tPublicApiDocumented,\n\ttype PublicApiDocumentedConfig,\n} from \"./policies/PublicApiDocumented.js\";\n// Gitignore policies\nexport { RequiredGitignorePatterns } from \"./policies/RequiredGitignorePatterns.js\";\nexport {\n\ttype RequiredScriptEntry,\n\tRequiredScripts,\n\ttype RequiredScriptsConfig,\n} from \"./policies/RequiredScripts.js\";\n// Rust documentation file policies\nexport {\n\tRustDocExists,\n\ttype RustDocExistsConfig,\n} from \"./policies/RustDocExists.js\";\n// Rust project structure policies\nexport {\n\tRustfmtConfigExists,\n\ttype RustfmtConfigExistsConfig,\n} from \"./policies/RustfmtConfigExists.js\";\nexport {\n\tRustToolchainExists,\n\ttype RustToolchainExistsConfig,\n} from \"./policies/RustToolchainExists.js\";\nexport {\n\tScriptContains,\n\ttype ScriptContainsConfig,\n\ttype ScriptContainsRule,\n} from \"./policies/ScriptContains.js\";\n// Cargo workspace policies\nexport {\n\tSharedDependencyVersions,\n\ttype SharedDependencyVersionsConfig,\n} from \"./policies/SharedDependencyVersions.js\";\nexport {\n\tWorkspaceInheritance,\n\ttype WorkspaceInheritanceConfig,\n} from \"./policies/WorkspaceInheritance.js\";\nexport {\n\tWorkspaceMembersValid,\n\ttype WorkspaceMembersValidConfig,\n} from \"./policies/WorkspaceMembersValid.js\";\n// Default policies\nexport { DefaultPolicies } from \"./policy.js\";\n"]}
package/esm/policy.d.ts CHANGED
@@ -5,6 +5,12 @@ import type { Operation } from "effection";
5
5
  * @alpha
6
6
  */
7
7
  export type PolicyName = string;
8
+ /**
9
+ * A stable identifier for a configured policy instance.
10
+ *
11
+ * @alpha
12
+ */
13
+ export type PolicyInstanceId = string;
8
14
  /**
9
15
  * Arguments passed to policy handler functions.
10
16
  *
@@ -206,6 +212,12 @@ export type PolicyDefinition<C = undefined> = PolicyShape<C>;
206
212
  * @alpha
207
213
  */
208
214
  export interface ConfiguredPolicy<C = void> extends PolicyShape<C> {
215
+ /**
216
+ * An optional stable identifier for this configured policy instance.
217
+ *
218
+ * This is required when the same policy definition is configured more than once.
219
+ */
220
+ instanceId?: PolicyInstanceId | undefined;
209
221
  /**
210
222
  * The configuration applied to this policy instance.
211
223
  */
@@ -231,6 +243,10 @@ export interface ConfiguredPolicy<C = void> extends PolicyShape<C> {
231
243
  * @alpha
232
244
  */
233
245
  export interface PolicyInstanceSettings<C> {
246
+ /**
247
+ * A stable identifier for this configured policy instance.
248
+ */
249
+ instanceId?: PolicyInstanceId | undefined;
234
250
  /**
235
251
  * An array of strings/regular expressions. File paths that match any of these expressions will be completely excluded
236
252
  * from policy.
@@ -248,6 +264,14 @@ export interface PolicyInstanceSettings<C> {
248
264
  * @alpha
249
265
  */
250
266
  export type PolicyInstance<C = undefined> = ConfiguredPolicy<C>;
267
+ /**
268
+ * A configured policy instance with its runtime identity assigned.
269
+ *
270
+ * @alpha
271
+ */
272
+ export type IdentifiedPolicy<C = undefined> = ConfiguredPolicy<C> & {
273
+ instanceId: PolicyInstanceId;
274
+ };
251
275
  /**
252
276
  * Type guard to check if a result is a {@link PolicyFixResult} (legacy).
253
277
  *
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,IAAI;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAE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