repopo 0.12.0 → 0.14.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 (345) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +57 -90
  3. package/THIRD-PARTY-LICENSES.txt +169 -11
  4. package/bin/dev.js +0 -0
  5. package/esm/adapters/fluidFramework.d.ts +13 -9
  6. package/esm/adapters/fluidFramework.d.ts.map +1 -1
  7. package/esm/adapters/fluidFramework.js +20 -43
  8. package/esm/adapters/fluidFramework.js.map +1 -1
  9. package/esm/api.d.ts +66 -1
  10. package/esm/api.d.ts.map +1 -1
  11. package/esm/api.js +18 -1
  12. package/esm/api.js.map +1 -1
  13. package/esm/baseCommand.d.ts.map +1 -1
  14. package/esm/baseCommand.js +2 -2
  15. package/esm/baseCommand.js.map +1 -1
  16. package/esm/commands/check-native.d.ts +5 -3
  17. package/esm/commands/check-native.d.ts.map +1 -1
  18. package/esm/commands/check-native.js +35 -7
  19. package/esm/commands/check-native.js.map +1 -1
  20. package/esm/commands/check.d.ts +8 -21
  21. package/esm/commands/check.d.ts.map +1 -1
  22. package/esm/commands/check.js +98 -154
  23. package/esm/commands/check.js.map +1 -1
  24. package/esm/commands/list.d.ts.map +1 -1
  25. package/esm/commands/list.js +1 -0
  26. package/esm/commands/list.js.map +1 -1
  27. package/esm/concurrency.d.ts +3 -0
  28. package/esm/concurrency.d.ts.map +1 -0
  29. package/esm/concurrency.js +8 -0
  30. package/esm/concurrency.js.map +1 -0
  31. package/esm/config.d.ts +10 -39
  32. package/esm/config.d.ts.map +1 -1
  33. package/esm/config.js +3 -7
  34. package/esm/config.js.map +1 -1
  35. package/esm/context.d.ts +10 -1
  36. package/esm/context.d.ts.map +1 -1
  37. package/esm/context.js +19 -1
  38. package/esm/context.js.map +1 -1
  39. package/esm/executionContractError.d.ts +4 -0
  40. package/esm/executionContractError.d.ts.map +1 -0
  41. package/esm/executionContractError.js +4 -0
  42. package/esm/executionContractError.js.map +1 -0
  43. package/esm/fileCache.d.ts +12 -0
  44. package/esm/fileCache.d.ts.map +1 -0
  45. package/esm/fileCache.js +37 -0
  46. package/esm/fileCache.js.map +1 -0
  47. package/esm/filePaths.d.ts +2 -0
  48. package/esm/filePaths.d.ts.map +1 -0
  49. package/esm/filePaths.js +9 -0
  50. package/esm/filePaths.js.map +1 -0
  51. package/esm/generators.d.ts +0 -20
  52. package/esm/generators.d.ts.map +1 -1
  53. package/esm/generators.js.map +1 -1
  54. package/esm/index.d.ts +3 -16
  55. package/esm/index.d.ts.map +1 -1
  56. package/esm/index.js +3 -17
  57. package/esm/index.js.map +1 -1
  58. package/esm/makePolicy.d.ts +20 -100
  59. package/esm/makePolicy.d.ts.map +1 -1
  60. package/esm/makePolicy.js +46 -132
  61. package/esm/makePolicy.js.map +1 -1
  62. package/esm/perf.d.ts +5 -2
  63. package/esm/perf.d.ts.map +1 -1
  64. package/esm/perf.js +10 -9
  65. package/esm/perf.js.map +1 -1
  66. package/esm/policies/CargoLicenceValidated.d.ts +4 -4
  67. package/esm/policies/CargoLicenceValidated.d.ts.map +1 -1
  68. package/esm/policies/CargoLicenceValidated.js +9 -7
  69. package/esm/policies/CargoLicenceValidated.js.map +1 -1
  70. package/esm/policies/CargoLintsConfigured.d.ts +4 -4
  71. package/esm/policies/CargoLintsConfigured.d.ts.map +1 -1
  72. package/esm/policies/CargoLintsConfigured.js +19 -15
  73. package/esm/policies/CargoLintsConfigured.js.map +1 -1
  74. package/esm/policies/CargoLockPolicy.d.ts +4 -4
  75. package/esm/policies/CargoLockPolicy.d.ts.map +1 -1
  76. package/esm/policies/CargoLockPolicy.js +15 -11
  77. package/esm/policies/CargoLockPolicy.js.map +1 -1
  78. package/esm/policies/CargoTomlRequired.d.ts +5 -5
  79. package/esm/policies/CargoTomlRequired.d.ts.map +1 -1
  80. package/esm/policies/CargoTomlRequired.js +7 -7
  81. package/esm/policies/CargoTomlRequired.js.map +1 -1
  82. package/esm/policies/CargoTomlSorted.d.ts +4 -4
  83. package/esm/policies/CargoTomlSorted.d.ts.map +1 -1
  84. package/esm/policies/CargoTomlSorted.js +21 -17
  85. package/esm/policies/CargoTomlSorted.js.map +1 -1
  86. package/esm/policies/ConditionalScripts.d.ts +10 -8
  87. package/esm/policies/ConditionalScripts.d.ts.map +1 -1
  88. package/esm/policies/ConditionalScripts.js +24 -22
  89. package/esm/policies/ConditionalScripts.js.map +1 -1
  90. package/esm/policies/ExactScripts.d.ts +8 -6
  91. package/esm/policies/ExactScripts.d.ts.map +1 -1
  92. package/esm/policies/ExactScripts.js +15 -18
  93. package/esm/policies/ExactScripts.js.map +1 -1
  94. package/esm/policies/GleamDepVersions.d.ts +5 -5
  95. package/esm/policies/GleamDepVersions.d.ts.map +1 -1
  96. package/esm/policies/GleamDepVersions.js +5 -5
  97. package/esm/policies/GleamDepVersions.js.map +1 -1
  98. package/esm/policies/GleamDocExists.d.ts +4 -4
  99. package/esm/policies/GleamDocExists.d.ts.map +1 -1
  100. package/esm/policies/GleamDocExists.js +6 -6
  101. package/esm/policies/GleamDocExists.js.map +1 -1
  102. package/esm/policies/GleamInternalModulesConfigured.d.ts +4 -4
  103. package/esm/policies/GleamInternalModulesConfigured.d.ts.map +1 -1
  104. package/esm/policies/GleamInternalModulesConfigured.js +8 -6
  105. package/esm/policies/GleamInternalModulesConfigured.js.map +1 -1
  106. package/esm/policies/GleamLicenceConfigured.d.ts +4 -4
  107. package/esm/policies/GleamLicenceConfigured.d.ts.map +1 -1
  108. package/esm/policies/GleamLicenceConfigured.js +8 -6
  109. package/esm/policies/GleamLicenceConfigured.js.map +1 -1
  110. package/esm/policies/GleamManifestCommitted.d.ts +10 -3
  111. package/esm/policies/GleamManifestCommitted.d.ts.map +1 -1
  112. package/esm/policies/GleamManifestCommitted.js +10 -9
  113. package/esm/policies/GleamManifestCommitted.js.map +1 -1
  114. package/esm/policies/GleamMonorepoConsistency.d.ts +13 -5
  115. package/esm/policies/GleamMonorepoConsistency.d.ts.map +1 -1
  116. package/esm/policies/GleamMonorepoConsistency.js +10 -10
  117. package/esm/policies/GleamMonorepoConsistency.js.map +1 -1
  118. package/esm/policies/GleamNameRestrictions.d.ts +4 -4
  119. package/esm/policies/GleamNameRestrictions.d.ts.map +1 -1
  120. package/esm/policies/GleamNameRestrictions.js +6 -6
  121. package/esm/policies/GleamNameRestrictions.js.map +1 -1
  122. package/esm/policies/GleamNoPathDepsInPublished.d.ts +4 -4
  123. package/esm/policies/GleamNoPathDepsInPublished.d.ts.map +1 -1
  124. package/esm/policies/GleamNoPathDepsInPublished.js +6 -6
  125. package/esm/policies/GleamNoPathDepsInPublished.js.map +1 -1
  126. package/esm/policies/GleamPathDepsValid.d.ts +3 -3
  127. package/esm/policies/GleamPathDepsValid.d.ts.map +1 -1
  128. package/esm/policies/GleamPathDepsValid.js +5 -5
  129. package/esm/policies/GleamPathDepsValid.js.map +1 -1
  130. package/esm/policies/GleamProjectStructure.d.ts +11 -4
  131. package/esm/policies/GleamProjectStructure.d.ts.map +1 -1
  132. package/esm/policies/GleamProjectStructure.js +7 -8
  133. package/esm/policies/GleamProjectStructure.js.map +1 -1
  134. package/esm/policies/GleamSharedDependencyVersions.d.ts +12 -4
  135. package/esm/policies/GleamSharedDependencyVersions.d.ts.map +1 -1
  136. package/esm/policies/GleamSharedDependencyVersions.js +10 -10
  137. package/esm/policies/GleamSharedDependencyVersions.js.map +1 -1
  138. package/esm/policies/GleamTomlRequired.d.ts +4 -4
  139. package/esm/policies/GleamTomlRequired.d.ts.map +1 -1
  140. package/esm/policies/GleamTomlRequired.js +5 -5
  141. package/esm/policies/GleamTomlRequired.js.map +1 -1
  142. package/esm/policies/GleamTomlSorted.d.ts +4 -4
  143. package/esm/policies/GleamTomlSorted.d.ts.map +1 -1
  144. package/esm/policies/GleamTomlSorted.js +21 -17
  145. package/esm/policies/GleamTomlSorted.js.map +1 -1
  146. package/esm/policies/GleamVersionConstraint.d.ts +4 -4
  147. package/esm/policies/GleamVersionConstraint.d.ts.map +1 -1
  148. package/esm/policies/GleamVersionConstraint.js +14 -10
  149. package/esm/policies/GleamVersionConstraint.js.map +1 -1
  150. package/esm/policies/HtmlFileHeaders.d.ts +4 -2
  151. package/esm/policies/HtmlFileHeaders.d.ts.map +1 -1
  152. package/esm/policies/HtmlFileHeaders.js +1 -1
  153. package/esm/policies/HtmlFileHeaders.js.map +1 -1
  154. package/esm/policies/JsTsFileHeaders.d.ts +4 -2
  155. package/esm/policies/JsTsFileHeaders.d.ts.map +1 -1
  156. package/esm/policies/JsTsFileHeaders.js +1 -1
  157. package/esm/policies/JsTsFileHeaders.js.map +1 -1
  158. package/esm/policies/LicenseFileExists.d.ts +10 -4
  159. package/esm/policies/LicenseFileExists.d.ts.map +1 -1
  160. package/esm/policies/LicenseFileExists.js +27 -20
  161. package/esm/policies/LicenseFileExists.js.map +1 -1
  162. package/esm/policies/MaxChangedFiles.d.ts +17 -0
  163. package/esm/policies/MaxChangedFiles.d.ts.map +1 -0
  164. package/esm/policies/MaxChangedFiles.js +22 -0
  165. package/esm/policies/MaxChangedFiles.js.map +1 -0
  166. package/esm/policies/MutuallyExclusiveScripts.d.ts +8 -6
  167. package/esm/policies/MutuallyExclusiveScripts.d.ts.map +1 -1
  168. package/esm/policies/MutuallyExclusiveScripts.js +9 -13
  169. package/esm/policies/MutuallyExclusiveScripts.js.map +1 -1
  170. package/esm/policies/NoBuildDirectory.d.ts +9 -3
  171. package/esm/policies/NoBuildDirectory.d.ts.map +1 -1
  172. package/esm/policies/NoBuildDirectory.js +8 -13
  173. package/esm/policies/NoBuildDirectory.js.map +1 -1
  174. package/esm/policies/NoJsFileExtensions.d.ts +9 -3
  175. package/esm/policies/NoJsFileExtensions.d.ts.map +1 -1
  176. package/esm/policies/NoJsFileExtensions.js +9 -14
  177. package/esm/policies/NoJsFileExtensions.js.map +1 -1
  178. package/esm/policies/NoLargeBinaryFiles.d.ts +9 -4
  179. package/esm/policies/NoLargeBinaryFiles.d.ts.map +1 -1
  180. package/esm/policies/NoLargeBinaryFiles.js +10 -16
  181. package/esm/policies/NoLargeBinaryFiles.js.map +1 -1
  182. package/esm/policies/NoPrivateWorkspaceDependencies.d.ts +10 -6
  183. package/esm/policies/NoPrivateWorkspaceDependencies.d.ts.map +1 -1
  184. package/esm/policies/NoPrivateWorkspaceDependencies.js +12 -14
  185. package/esm/policies/NoPrivateWorkspaceDependencies.js.map +1 -1
  186. package/esm/policies/NoTargetArtifacts.d.ts +9 -3
  187. package/esm/policies/NoTargetArtifacts.d.ts.map +1 -1
  188. package/esm/policies/NoTargetArtifacts.js +9 -14
  189. package/esm/policies/NoTargetArtifacts.js.map +1 -1
  190. package/esm/policies/NoUnsafeWithoutJustification.d.ts +11 -4
  191. package/esm/policies/NoUnsafeWithoutJustification.d.ts.map +1 -1
  192. package/esm/policies/NoUnsafeWithoutJustification.js +8 -9
  193. package/esm/policies/NoUnsafeWithoutJustification.js.map +1 -1
  194. package/esm/policies/NoWildcardDependencies.d.ts +5 -5
  195. package/esm/policies/NoWildcardDependencies.d.ts.map +1 -1
  196. package/esm/policies/NoWildcardDependencies.js +6 -6
  197. package/esm/policies/NoWildcardDependencies.js.map +1 -1
  198. package/esm/policies/PackageAllowedScopes.d.ts +9 -5
  199. package/esm/policies/PackageAllowedScopes.d.ts.map +1 -1
  200. package/esm/policies/PackageAllowedScopes.js +15 -16
  201. package/esm/policies/PackageAllowedScopes.js.map +1 -1
  202. package/esm/policies/PackageEsmType.d.ts +7 -5
  203. package/esm/policies/PackageEsmType.d.ts.map +1 -1
  204. package/esm/policies/PackageEsmType.js +31 -31
  205. package/esm/policies/PackageEsmType.js.map +1 -1
  206. package/esm/policies/PackageFolderName.d.ts +8 -6
  207. package/esm/policies/PackageFolderName.d.ts.map +1 -1
  208. package/esm/policies/PackageFolderName.js +13 -16
  209. package/esm/policies/PackageFolderName.js.map +1 -1
  210. package/esm/policies/PackageJsonProperties.d.ts +5 -3
  211. package/esm/policies/PackageJsonProperties.d.ts.map +1 -1
  212. package/esm/policies/PackageJsonProperties.js +6 -17
  213. package/esm/policies/PackageJsonProperties.js.map +1 -1
  214. package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts +2 -7
  215. package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts.map +1 -1
  216. package/esm/policies/PackageJsonRepoDirectoryProperty.js +28 -42
  217. package/esm/policies/PackageJsonRepoDirectoryProperty.js.map +1 -1
  218. package/esm/policies/PackageJsonSorted.d.ts +2 -2
  219. package/esm/policies/PackageJsonSorted.d.ts.map +1 -1
  220. package/esm/policies/PackageJsonSorted.js +15 -30
  221. package/esm/policies/PackageJsonSorted.js.map +1 -1
  222. package/esm/policies/PackageLicense.d.ts +4 -4
  223. package/esm/policies/PackageLicense.d.ts.map +1 -1
  224. package/esm/policies/PackageLicense.js +31 -52
  225. package/esm/policies/PackageLicense.js.map +1 -1
  226. package/esm/policies/PackagePrivateField.d.ts +12 -8
  227. package/esm/policies/PackagePrivateField.d.ts.map +1 -1
  228. package/esm/policies/PackagePrivateField.js +31 -23
  229. package/esm/policies/PackagePrivateField.js.map +1 -1
  230. package/esm/policies/PackageReadme.d.ts +6 -5
  231. package/esm/policies/PackageReadme.d.ts.map +1 -1
  232. package/esm/policies/PackageReadme.js +22 -59
  233. package/esm/policies/PackageReadme.js.map +1 -1
  234. package/esm/policies/PackageScripts.d.ts +26 -22
  235. package/esm/policies/PackageScripts.d.ts.map +1 -1
  236. package/esm/policies/PackageScripts.js +39 -36
  237. package/esm/policies/PackageScripts.js.map +1 -1
  238. package/esm/policies/PackageTestScripts.d.ts +10 -6
  239. package/esm/policies/PackageTestScripts.d.ts.map +1 -1
  240. package/esm/policies/PackageTestScripts.js +14 -16
  241. package/esm/policies/PackageTestScripts.js.map +1 -1
  242. package/esm/policies/PublicApiDocumented.d.ts +4 -4
  243. package/esm/policies/PublicApiDocumented.d.ts.map +1 -1
  244. package/esm/policies/PublicApiDocumented.js +10 -8
  245. package/esm/policies/PublicApiDocumented.js.map +1 -1
  246. package/esm/policies/RequireCompanionChanges.d.ts +16 -0
  247. package/esm/policies/RequireCompanionChanges.d.ts.map +1 -0
  248. package/esm/policies/RequireCompanionChanges.js +42 -0
  249. package/esm/policies/RequireCompanionChanges.js.map +1 -0
  250. package/esm/policies/RequiredGitignorePatterns.d.ts +11 -4
  251. package/esm/policies/RequiredGitignorePatterns.d.ts.map +1 -1
  252. package/esm/policies/RequiredGitignorePatterns.js +29 -36
  253. package/esm/policies/RequiredGitignorePatterns.js.map +1 -1
  254. package/esm/policies/RequiredScripts.d.ts +9 -7
  255. package/esm/policies/RequiredScripts.d.ts.map +1 -1
  256. package/esm/policies/RequiredScripts.js +24 -24
  257. package/esm/policies/RequiredScripts.js.map +1 -1
  258. package/esm/policies/RustDocExists.d.ts +4 -4
  259. package/esm/policies/RustDocExists.d.ts.map +1 -1
  260. package/esm/policies/RustDocExists.js +6 -6
  261. package/esm/policies/RustDocExists.js.map +1 -1
  262. package/esm/policies/RustToolchainExists.d.ts +11 -4
  263. package/esm/policies/RustToolchainExists.d.ts.map +1 -1
  264. package/esm/policies/RustToolchainExists.js +10 -9
  265. package/esm/policies/RustToolchainExists.js.map +1 -1
  266. package/esm/policies/RustfmtConfigExists.d.ts +11 -4
  267. package/esm/policies/RustfmtConfigExists.d.ts.map +1 -1
  268. package/esm/policies/RustfmtConfigExists.js +10 -9
  269. package/esm/policies/RustfmtConfigExists.js.map +1 -1
  270. package/esm/policies/ScriptContains.d.ts +9 -7
  271. package/esm/policies/ScriptContains.d.ts.map +1 -1
  272. package/esm/policies/ScriptContains.js +9 -13
  273. package/esm/policies/ScriptContains.js.map +1 -1
  274. package/esm/policies/SharedDependencyVersions.d.ts +9 -4
  275. package/esm/policies/SharedDependencyVersions.d.ts.map +1 -1
  276. package/esm/policies/SharedDependencyVersions.js +28 -20
  277. package/esm/policies/SharedDependencyVersions.js.map +1 -1
  278. package/esm/policies/WorkspaceInheritance.d.ts +11 -4
  279. package/esm/policies/WorkspaceInheritance.d.ts.map +1 -1
  280. package/esm/policies/WorkspaceInheritance.js +10 -11
  281. package/esm/policies/WorkspaceInheritance.js.map +1 -1
  282. package/esm/policies/WorkspaceMembersValid.d.ts +11 -4
  283. package/esm/policies/WorkspaceMembersValid.d.ts.map +1 -1
  284. package/esm/policies/WorkspaceMembersValid.js +10 -11
  285. package/esm/policies/WorkspaceMembersValid.js.map +1 -1
  286. package/esm/policies/constants.d.ts.map +1 -1
  287. package/esm/policies/constants.js +1 -1
  288. package/esm/policies/constants.js.map +1 -1
  289. package/esm/policies.d.ts +15 -5
  290. package/esm/policies.d.ts.map +1 -1
  291. package/esm/policies.js +14 -5
  292. package/esm/policies.js.map +1 -1
  293. package/esm/policy.d.ts +67 -289
  294. package/esm/policy.d.ts.map +1 -1
  295. package/esm/policy.js +1 -122
  296. package/esm/policy.js.map +1 -1
  297. package/esm/policyDefiners/defineCargoPolicy.d.ts +25 -9
  298. package/esm/policyDefiners/defineCargoPolicy.d.ts.map +1 -1
  299. package/esm/policyDefiners/defineCargoPolicy.js +10 -28
  300. package/esm/policyDefiners/defineCargoPolicy.js.map +1 -1
  301. package/esm/policyDefiners/defineFileHeaderPolicy.d.ts +27 -14
  302. package/esm/policyDefiners/defineFileHeaderPolicy.d.ts.map +1 -1
  303. package/esm/policyDefiners/defineFileHeaderPolicy.js +16 -35
  304. package/esm/policyDefiners/defineFileHeaderPolicy.js.map +1 -1
  305. package/esm/policyDefiners/defineGleamPolicy.d.ts +25 -9
  306. package/esm/policyDefiners/defineGleamPolicy.d.ts.map +1 -1
  307. package/esm/policyDefiners/defineGleamPolicy.js +10 -27
  308. package/esm/policyDefiners/defineGleamPolicy.js.map +1 -1
  309. package/esm/policyDefiners/definePackagePolicy.d.ts +24 -13
  310. package/esm/policyDefiners/definePackagePolicy.d.ts.map +1 -1
  311. package/esm/policyDefiners/definePackagePolicy.js +9 -32
  312. package/esm/policyDefiners/definePackagePolicy.js.map +1 -1
  313. package/esm/policyDefiners/spdxValidator.d.ts +4 -12
  314. package/esm/policyDefiners/spdxValidator.d.ts.map +1 -1
  315. package/esm/policyDefiners/spdxValidator.js +26 -14
  316. package/esm/policyDefiners/spdxValidator.js.map +1 -1
  317. package/esm/policyExecution.d.ts +20 -0
  318. package/esm/policyExecution.d.ts.map +1 -0
  319. package/esm/policyExecution.js +234 -0
  320. package/esm/policyExecution.js.map +1 -0
  321. package/esm/repositoryChanges.d.ts +26 -0
  322. package/esm/repositoryChanges.d.ts.map +1 -0
  323. package/esm/repositoryChanges.js +172 -0
  324. package/esm/repositoryChanges.js.map +1 -0
  325. package/esm/repositoryFiles.d.ts +6 -0
  326. package/esm/repositoryFiles.d.ts.map +1 -0
  327. package/esm/repositoryFiles.js +11 -0
  328. package/esm/repositoryFiles.js.map +1 -0
  329. package/esm/runner.d.ts +73 -47
  330. package/esm/runner.d.ts.map +1 -1
  331. package/esm/runner.js +158 -144
  332. package/esm/runner.js.map +1 -1
  333. package/esm/settlePolicyPromise.d.ts +4 -0
  334. package/esm/settlePolicyPromise.d.ts.map +1 -0
  335. package/esm/settlePolicyPromise.js +10 -0
  336. package/esm/settlePolicyPromise.js.map +1 -0
  337. package/esm/tsdoc-metadata.json +1 -1
  338. package/esm/utils/safePaths.d.ts +9 -0
  339. package/esm/utils/safePaths.d.ts.map +1 -0
  340. package/esm/utils/safePaths.js +40 -0
  341. package/esm/utils/safePaths.js.map +1 -0
  342. package/oclif.manifest.json +57 -2
  343. package/package.json +42 -27
  344. package/scripts/benchmark.mjs +341 -0
  345. package/sidecar/sidecar.mjs +388 -417
@@ -1 +1 @@
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,G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8BAA8B;AAC9B,OAAO,EACN,mBAAmB,GAEnB,MAAM,mCAAmC,CAAC;AAC3C,qBAAqB;AACrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAEN,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"]}
1
+ {"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,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;AAC1C,OAAO,EACN,YAAY,GAEZ,MAAM,4BAA4B,CAAC;AACpC,4BAA4B;AAC5B,OAAO,EACN,gBAAgB,GAEhB,MAAM,gCAAgC,CAAC;AACxC,+BAA+B;AAC/B,OAAO,EACN,cAAc,GAEd,MAAM,8BAA8B,CAAC;AACtC,kCAAkC;AAClC,OAAO,EACN,8BAA8B,GAE9B,MAAM,8CAA8C,CAAC;AACtD,yBAAyB;AACzB,OAAO,EACN,sBAAsB,GAEtB,MAAM,sCAAsC,CAAC;AAC9C,mCAAmC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,0BAA0B;AAC1B,OAAO,EACN,wBAAwB,GAExB,MAAM,wCAAwC,CAAC;AAChD,wBAAwB;AACxB,OAAO,EACN,qBAAqB,GAErB,MAAM,qCAAqC,CAAC;AAC7C,iCAAiC;AACjC,OAAO,EACN,0BAA0B,GAE1B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EACN,qBAAqB,GAErB,MAAM,qCAAqC,CAAC;AAC7C,2CAA2C;AAC3C,OAAO,EACN,6BAA6B,GAE7B,MAAM,6CAA6C,CAAC;AACrD,4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AM,gDAAgD,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACN,cAAc,GAEd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,mBAAmB,GAEnB,MAAM,mCAAmC,CAAC;AAC3C,0BAA0B;AAC1B,OAAO,EACN,aAAa,GAEb,MAAM,6BAA6B,CAAC;AACrC,mEAAmE;AACnE,OAAO,EAEN,cAAc,GAId,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,kBAAkB,GAElB,MAAM,kCAAkC,CAAC;AAC1C,8BAA8B;AAC9B,OAAO,EACN,mBAAmB,GAEnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,qBAAqB;AACrB,OAAO,EACN,yBAAyB,GAEzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAEN,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":["/**\n * Built-in file and repository policies and their configuration types.\n *\n * Use `makePolicy()` from `repopo` or `repopo/api` to configure these definitions.\n *\n * @packageDocumentation\n */\n\n// 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 {\n\tLicenseFileExists,\n\ttype LicenseFileExistsSettings,\n} from \"./policies/LicenseFileExists.js\";\nexport {\n\tMaxChangedFiles,\n\ttype MaxChangedFilesConfig,\n} from \"./policies/MaxChangedFiles.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 {\n\tNoLargeBinaryFiles,\n\ttype NoLargeBinaryFilesSettings,\n} from \"./policies/NoLargeBinaryFiles.js\";\n// Dependency policies\nexport {\n\tNoPrivateWorkspaceDependencies,\n\ttype NoPrivateWorkspaceDependenciesSettings,\n} 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 {\n\tPackageJsonProperties,\n\ttype PackageJsonPropertiesSettings,\n} 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\";\nexport { RequireCompanionChanges } from \"./policies/RequireCompanionChanges.js\";\n// Gitignore policies\nexport {\n\tRequiredGitignorePatterns,\n\ttype RequiredGitignorePatternsSettings,\n} 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\";\nexport type {\n\tFileHeaderGeneratorConfig,\n\tFileHeaderPolicyConfig,\n} from \"./policyDefiners/defineFileHeaderPolicy.js\";\n"]}
package/esm/policy.d.ts CHANGED
@@ -1,313 +1,91 @@
1
1
  import type { Operation } from "effection";
2
- /**
3
- * A type representing a policy name.
4
- *
5
- * @alpha
6
- */
2
+ import type { RepositoryFile } from "./repositoryChanges.js";
3
+ /** Display name of a policy. @public */
7
4
  export type PolicyName = string;
8
- /**
9
- * A stable identifier for a configured policy instance.
10
- *
11
- * @alpha
12
- */
5
+ /** Stable configured-instance identity. @public */
13
6
  export type PolicyInstanceId = string;
14
- /**
15
- * Arguments passed to policy handler functions.
16
- *
17
- * @alpha
18
- */
7
+ /** Arguments supplied to a file handler. @public */
19
8
  export interface PolicyArgs<C = void> {
20
- /**
21
- * Path to the file, relative to the repo root.
22
- */
23
9
  file: string;
24
- /**
25
- * Absolute path to the root of the repo.
26
- */
27
10
  root: string;
28
- /**
29
- * If true, the handler should resolve any violations automatically if possible.
30
- */
31
11
  resolve: boolean;
32
- /**
33
- * Optional configuration for the policy.
34
- */
35
12
  config?: C | undefined;
36
13
  }
37
- /**
38
- * @deprecated Use {@link PolicyArgs} instead.
39
- * @alpha
40
- */
41
- export type PolicyFunctionArguments<C> = PolicyArgs<C>;
42
- /**
43
- * A policy error returned when a file fails a policy check.
44
- *
45
- * @alpha
46
- */
47
- export interface PolicyError {
48
- /**
49
- * The error message describing what failed.
50
- */
51
- error: string;
52
- /**
53
- * Set to `true` if the policy violation can be fixed automatically.
54
- */
55
- fixable?: boolean | undefined;
56
- /**
57
- * Set to `true` if the violation was successfully fixed (only set when resolve=true).
58
- */
59
- fixed?: boolean | undefined;
60
- /**
61
- * An optional string that tells the user how to manually fix the failure.
62
- */
63
- manualFix?: string | undefined;
14
+ /** Arguments supplied to a repository/change handler; stdin selection never limits entries. @public */
15
+ export interface RepositoryPolicyArgs<C = void> extends Omit<PolicyArgs<C>, "file"> {
16
+ files: readonly string[];
17
+ /** Matching eligible inventory, including unchanged files and deleted paths. */
18
+ entries: readonly RepositoryFile[];
64
19
  }
65
- /**
66
- * The result of a policy handler.
67
- * Returns `true` if the file passes the policy, or a {@link PolicyError} if it fails.
68
- *
69
- * @alpha
70
- */
71
- export type PolicyResult = true | PolicyError;
72
- /**
73
- * A policy failure (legacy format).
74
- *
75
- * @deprecated Use {@link PolicyError} instead, which has a simpler API.
76
- *
77
- * @alpha
78
- */
79
- export interface PolicyFailure {
80
- /**
81
- * Name of the policy that failed.
82
- */
83
- name: PolicyName;
84
- /**
85
- * Path to the file that failed the policy.
86
- */
87
- file: string;
88
- /**
89
- * Set to `true` if the policy can be fixed automatically.
90
- */
91
- autoFixable?: boolean | undefined;
92
- /**
93
- * An optional error message accompanying the failure.
94
- */
95
- errorMessages: string[];
96
- /**
97
- * An optional string that tells the user how to fix the failure(s).
98
- */
20
+ /** A single independently actionable violation or recorded fix. @public */
21
+ export interface PolicyFinding {
22
+ message: string;
99
23
  manualFix?: string | undefined;
24
+ fixStatus?: "available" | "fixed" | "failed" | undefined;
25
+ /** Repo-relative affected files. Only repository handlers may supply this. */
26
+ files?: readonly string[] | undefined;
100
27
  }
101
- /**
102
- * The result of an automatic fix for a failing policy (legacy format).
103
- *
104
- * @deprecated Use {@link PolicyError} with `fixed: boolean` instead.
105
- *
106
- * @alpha
107
- */
108
- export interface PolicyFixResult extends PolicyFailure {
109
- /**
110
- * Set to true if the failure was resolved by the automated fixer.
111
- */
112
- resolved: boolean;
113
- }
114
- /**
115
- * Result type that accepts both legacy and new formats.
116
- *
117
- * @alpha
118
- */
119
- export type PolicyHandlerResult = true | PolicyFailure | PolicyFixResult | PolicyError;
120
- /**
121
- * A policy handler function that checks a file against a policy.
122
- *
123
- * @remarks
124
- * Policy handlers can be implemented in two ways:
125
- * - As an async function returning a Promise
126
- * - As an Effection generator function returning an Operation
127
- *
128
- * Both styles are supported. Async handlers are automatically wrapped for Effection.
129
- *
130
- * Handlers can return either the legacy format ({@link PolicyFailure}) or
131
- * the new format ({@link PolicyError}). The new format is simpler and recommended
132
- * for new policies.
133
- *
134
- * @alpha
135
- */
136
- export type PolicyHandler<C = unknown | undefined> = ((args: PolicyArgs<C>) => Promise<PolicyHandlerResult>) | ((args: PolicyArgs<C>) => Operation<PolicyHandlerResult>);
137
- /**
138
- * A standalone resolver function that can fix policy violations (legacy format).
139
- *
140
- * @deprecated Use {@link PolicyResolver} instead, which uses {@link PolicyError}.
141
- *
142
- * @alpha
143
- */
144
- export type PolicyStandaloneResolver<C = undefined> = (args: Omit<PolicyArgs<C>, "resolve">) => Promise<PolicyFixResult> | Operation<PolicyFixResult>;
145
- /**
146
- * A standalone resolver function using the new format.
147
- *
148
- * @alpha
149
- */
150
- export type PolicyResolver<C = void> = (args: Omit<PolicyArgs<C>, "resolve">) => Promise<PolicyError> | Operation<PolicyError>;
151
- /**
152
- * Interface describing the shape of a policy definition.
153
- *
154
- * @typeParam C - Type of configuration object used by the policy
155
- *
156
- * @alpha
157
- */
158
- export interface PolicyShape<C = void> {
159
- /**
160
- * The name of the policy; displayed in UI and used in settings.
161
- */
28
+ /** Empty means pass. Fixed findings remain visible. @public */
29
+ export type PolicyResult = readonly PolicyFinding[];
30
+ /** Standalone file fixers receive and return the complete findings list. @public */
31
+ export type PolicyResolver<C = void> = {
32
+ resolve(args: Omit<PolicyArgs<C>, "resolve"> & {
33
+ findings: PolicyResult;
34
+ }): Promise<PolicyResult> | Operation<PolicyResult>;
35
+ }["resolve"];
36
+ /** File scope is the default. @public */
37
+ export interface FilePolicyDefinition<C = void> {
162
38
  name: PolicyName;
163
- /**
164
- * A detailed description of the policy and its purpose.
165
- */
166
39
  description: string;
167
- /**
168
- * A regular expression that matches files this policy applies to.
169
- */
40
+ scope?: "file";
170
41
  match: RegExp;
171
- /**
172
- * The handler function that checks if a file complies with the policy.
173
- */
174
- handler: PolicyHandler<C>;
175
- /**
176
- * An optional resolver function that can automatically fix violations.
177
- */
178
- resolver?: PolicyStandaloneResolver<C> | undefined;
179
- /**
180
- * A default configuration that will be used if none is provided.
181
- */
42
+ handler(args: PolicyArgs<C>): Promise<PolicyResult> | Operation<PolicyResult>;
43
+ resolver?: PolicyResolver<C> | undefined;
182
44
  defaultConfig?: C | undefined;
45
+ requiresConfig?: boolean | undefined;
183
46
  }
184
- /**
185
- * Abstract base class for creating policies with object-based construction.
186
- *
187
- * @remarks
188
- * This class accepts a {@link PolicyShape} object in its constructor,
189
- * making it easier to add new optional properties in the future without breaking changes.
190
- *
191
- * @alpha
192
- */
193
- export declare abstract class Policy<C = void> implements PolicyShape<C> {
194
- readonly name: string;
195
- readonly description: string;
196
- readonly match: RegExp;
197
- readonly handler: PolicyHandler<C>;
198
- readonly defaultConfig?: C | undefined;
199
- readonly resolver?: PolicyStandaloneResolver<C> | undefined;
200
- constructor(definition: PolicyShape<C>);
47
+ /** Repository/change scopes run once over matching inventory; fixers are inline only. @public */
48
+ export interface RepositoryPolicyDefinition<C = void> {
49
+ name: PolicyName;
50
+ description: string;
51
+ /** Changes scope requests Git status annotation (PR mode by default). */
52
+ scope: "repository" | "changes";
53
+ /** Match repo-relative paths, including either rename endpoint; omitted means all entries. */
54
+ match?: RegExp | undefined;
55
+ handler(args: RepositoryPolicyArgs<C>): Promise<PolicyResult> | Operation<PolicyResult>;
56
+ resolver?: never;
57
+ defaultConfig?: C | undefined;
58
+ requiresConfig?: boolean | undefined;
201
59
  }
202
- /**
203
- * @deprecated Use {@link PolicyShape} instead.
204
- * @alpha
205
- */
206
- export type PolicyDefinition<C = undefined> = PolicyShape<C>;
207
- /**
208
- * A policy instance with configuration and exclusion settings applied.
209
- *
210
- * @typeParam C - Type of configuration object used by the policy
211
- *
212
- * @alpha
213
- */
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;
221
- /**
222
- * The configuration applied to this policy instance.
223
- */
60
+ /** A canonical policy definition. @public */
61
+ export type PolicyDefinition<C = void> = FilePolicyDefinition<C> | RepositoryPolicyDefinition<C>;
62
+ /** Async and Effection file handlers are supported. @public */
63
+ export type PolicyHandler<C = void> = FilePolicyDefinition<C>["handler"];
64
+ /** Async and Effection repository handlers are supported. @public */
65
+ export type RepositoryPolicyHandler<C = void> = RepositoryPolicyDefinition<C>["handler"];
66
+ /** Exclude undefined (including void) while preserving allowed null values. @internal */
67
+ export type DefinedConfig<C> = NonNullable<C> | (C & null);
68
+ /** Instance configuration and repo-relative regex exclusions. @public */
69
+ export interface PolicyOptions<C = void> {
224
70
  config?: C | undefined;
225
- /**
226
- * File paths matching these patterns will be excluded from this policy.
227
- * @deprecated Use `excludeFiles` instead for backward compatibility.
228
- */
229
- exclude?: (string | RegExp)[] | undefined;
230
- /**
231
- * File paths matching these patterns will be excluded from this policy.
232
- */
233
- excludeFiles?: (string | RegExp)[] | undefined;
234
- /**
235
- * Internal normalized handler (always an Effection Operation).
236
- * This is set by the policy() function and used by the execution engine.
237
- * @internal
238
- */
239
- _internalHandler?: (args: PolicyArgs<C>) => Operation<PolicyHandlerResult>;
240
- }
241
- /**
242
- * Settings for configuring a policy instance.
243
- * @alpha
244
- */
245
- export interface PolicyInstanceSettings<C> {
246
- /**
247
- * A stable identifier for this configured policy instance.
248
- */
71
+ exclude?: readonly (string | RegExp)[] | undefined;
249
72
  instanceId?: PolicyInstanceId | undefined;
250
- /**
251
- * An array of strings/regular expressions. File paths that match any of these expressions will be completely excluded
252
- * from policy.
253
- *
254
- * Paths will be matched relative to the root of the repo.
255
- */
256
- excludeFiles?: (string | RegExp)[];
257
- /**
258
- * The config that is applied to the policy instance.
259
- */
260
- config?: C | undefined;
261
73
  }
262
- /**
263
- * @deprecated Use {@link ConfiguredPolicy} instead.
264
- * @alpha
265
- */
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> & {
74
+ /** A configured file policy. @public */
75
+ export type ConfiguredFilePolicy<C = void> = FilePolicyDefinition<C> & PolicyOptions<C>;
76
+ /** A configured repository policy. @public */
77
+ export type ConfiguredRepositoryPolicy<C = void> = RepositoryPolicyDefinition<C> & PolicyOptions<C>;
78
+ /** A configured policy, retaining scope discrimination. @public */
79
+ export type ConfiguredPolicy<C = unknown> = ConfiguredFilePolicy<C> | ConfiguredRepositoryPolicy<C>;
80
+ /** A configured policy with a validated stable identity. @public */
81
+ export type IdentifiedPolicy<C = unknown> = ConfiguredPolicy<C> & {
273
82
  instanceId: PolicyInstanceId;
274
83
  };
275
- /**
276
- * Type guard to check if a result is a {@link PolicyFixResult} (legacy).
277
- *
278
- * @deprecated Use {@link isPolicyError} instead when working with the new {@link PolicyError} format.
279
- *
280
- * @alpha
281
- */
282
- export declare function isPolicyFixResult(toCheck: any): toCheck is PolicyFixResult;
283
- /**
284
- * Type guard to check if a result is a PolicyError (new format).
285
- *
286
- * @alpha
287
- */
288
- export declare function isPolicyError(toCheck: any): toCheck is PolicyError;
289
- /**
290
- * Type guard to check if a result is a {@link PolicyFailure} (legacy format).
291
- *
292
- * @deprecated Use {@link isPolicyError} instead when working with the new {@link PolicyError} format.
293
- *
294
- * @alpha
295
- */
296
- export declare function isPolicyFailure(toCheck: any): toCheck is PolicyFailure;
297
- /**
298
- * Converts a legacy PolicyFailure/PolicyFixResult to the new PolicyError format.
299
- * @internal
300
- */
301
- export declare function convertLegacyResult(result: PolicyHandlerResult, _file: string): PolicyResult;
302
- /**
303
- * Converts a new PolicyError to the legacy PolicyFailure format.
304
- * @internal
305
- */
306
- export declare function convertToLegacyResult(result: PolicyError, policyName: string, file: string): PolicyFailure | PolicyFixResult;
307
- /**
308
- * Default policies included with repopo.
309
- *
310
- * @alpha
311
- */
312
- export declare const DefaultPolicies: Policy<any>[];
84
+ /** The default definitions, configured when no policies are supplied. @public */
85
+ export declare const DefaultPolicies: readonly [{
86
+ name: string;
87
+ description: string;
88
+ match: RegExp;
89
+ handler: () => Operation<PolicyFinding[]>;
90
+ }, FilePolicyDefinition<void>, FilePolicyDefinition<void>];
313
91
  //# sourceMappingURL=policy.d.ts.map
@@ -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,MAAM,gBAAgB,GAAG,MAAM,CAAC;AA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,yEAAyE;AACzE,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,IAAI;IACtC,MAAM,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IACnD,UAAU,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC1C;AAED,wCAAwC;AACxC,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,IAAI,IAAI,oBAAoB,CAAC,CAAC,CAAC,GACnE,aAAa,CAAC,CAAC,CAAC,CAAC;AAClB,8CAA8C;AAC9C,MAAM,MAAM,0BAA0B,CAAC,CAAC,GAAG,IAAI,IAC9C,0BAA0B,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAClD,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,OAAO,IACrC,oBAAoB,CAAC,CAAC,CAAC,GACvB,0BAA0B,CAAC,CAAC,CAAC,CAAC;AACjC,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IACjE,UAAU,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,eAAe;;;;;0DAIlB,CAAC"}
package/esm/policy.js CHANGED
@@ -1,128 +1,7 @@
1
1
  import { NoJsFileExtensions } from "./policies/NoJsFileExtensions.js";
2
2
  import { PackageJsonRepoDirectoryProperty } from "./policies/PackageJsonRepoDirectoryProperty.js";
3
3
  import { PackageJsonSorted } from "./policies/PackageJsonSorted.js";
4
- /**
5
- * Abstract base class for creating policies with object-based construction.
6
- *
7
- * @remarks
8
- * This class accepts a {@link PolicyShape} object in its constructor,
9
- * making it easier to add new optional properties in the future without breaking changes.
10
- *
11
- * @alpha
12
- */
13
- export class Policy {
14
- name;
15
- description;
16
- match;
17
- handler;
18
- defaultConfig;
19
- resolver;
20
- constructor(definition) {
21
- this.name = definition.name;
22
- this.description = definition.description;
23
- this.match = definition.match;
24
- this.handler = definition.handler;
25
- this.defaultConfig = definition.defaultConfig;
26
- this.resolver = definition.resolver;
27
- }
28
- }
29
- // ============================================================================
30
- // Type Guards
31
- // ============================================================================
32
- /**
33
- * Type guard to check if a result is a {@link PolicyFixResult} (legacy).
34
- *
35
- * @deprecated Use {@link isPolicyError} instead when working with the new {@link PolicyError} format.
36
- *
37
- * @alpha
38
- */
39
- // biome-ignore lint/suspicious/noExplicitAny: type guard
40
- export function isPolicyFixResult(toCheck) {
41
- if (typeof toCheck !== "object" || toCheck === null) {
42
- return false;
43
- }
44
- return "resolved" in toCheck;
45
- }
46
- /**
47
- * Type guard to check if a result is a PolicyError (new format).
48
- *
49
- * @alpha
50
- */
51
- // biome-ignore lint/suspicious/noExplicitAny: type guard
52
- export function isPolicyError(toCheck) {
53
- if (typeof toCheck !== "object" || toCheck === null) {
54
- return false;
55
- }
56
- return "error" in toCheck && typeof toCheck.error === "string";
57
- }
58
- /**
59
- * Type guard to check if a result is a {@link PolicyFailure} (legacy format).
60
- *
61
- * @deprecated Use {@link isPolicyError} instead when working with the new {@link PolicyError} format.
62
- *
63
- * @alpha
64
- */
65
- // biome-ignore lint/suspicious/noExplicitAny: type guard
66
- export function isPolicyFailure(toCheck) {
67
- if (typeof toCheck !== "object" || toCheck === null) {
68
- return false;
69
- }
70
- return "errorMessages" in toCheck && Array.isArray(toCheck.errorMessages);
71
- }
72
- // ============================================================================
73
- // Conversion Functions
74
- // ============================================================================
75
- /**
76
- * Converts a legacy PolicyFailure/PolicyFixResult to the new PolicyError format.
77
- * @internal
78
- */
79
- export function convertLegacyResult(result, _file) {
80
- if (result === true) {
81
- return true;
82
- }
83
- // Check if it's already the new format
84
- if (isPolicyError(result)) {
85
- return result;
86
- }
87
- // It's a legacy PolicyFailure or PolicyFixResult
88
- const error = result.errorMessages?.join("; ") ?? "Policy violation";
89
- const isFixResult = isPolicyFixResult(result);
90
- return {
91
- error,
92
- fixable: result.autoFixable ?? false,
93
- fixed: isFixResult ? result.resolved : undefined,
94
- manualFix: result.manualFix,
95
- };
96
- }
97
- /**
98
- * Converts a new PolicyError to the legacy PolicyFailure format.
99
- * @internal
100
- */
101
- export function convertToLegacyResult(result, policyName, file) {
102
- const base = {
103
- name: policyName,
104
- file,
105
- autoFixable: result.fixable,
106
- errorMessages: [result.error],
107
- manualFix: result.manualFix,
108
- };
109
- if (result.fixed !== undefined) {
110
- return {
111
- ...base,
112
- resolved: result.fixed,
113
- };
114
- }
115
- return base;
116
- }
117
- // ============================================================================
118
- // Default Policies
119
- // ============================================================================
120
- /**
121
- * Default policies included with repopo.
122
- *
123
- * @alpha
124
- */
125
- // biome-ignore lint/suspicious/noExplicitAny: FIXME
4
+ /** The default definitions, configured when no policies are supplied. @public */
126
5
  export const DefaultPolicies = [
127
6
  NoJsFileExtensions,
128
7
  PackageJsonRepoDirectoryProperty,
package/esm/policy.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA8OpE;;;;;;;;GAQG;AACH,MAAM,OAAgB,MAAM;IACX,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,KAAK,CAAS;IACd,OAAO,CAAmB;IAC1B,aAAa,CAAiB;IAC9B,QAAQ,CAA2C;IAEnE,YAAmB,UAA0B;QAC5C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAA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B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,iDAAiD;IACjD,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC;IACrE,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAE9C,OAAO;QACN,KAAK;QACL,OAAO,EAAE,MAAM,CAAC,WAAW,IAAI,KAAK;QACpC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QAChD,SAAS,EAAE,MAAM,CAAC,SAAS;KAC3B,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACpC,MAAmB,EACnB,UAAkB,EAClB,IAAY;IAEZ,MAAM,IAAI,GAAkB;QAC3B,IAAI,EAAE,UAAU;QAChB,IAAI;QACJ,WAAW,EAAE,MAAM,CAAC,OAAO;QAC3B,aAAa,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;KAC3B,CAAC;IAEF,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO;YACN,GAAG,IAAI;YACP,QAAQ,EAAE,MAAM,CAAC,KAAK;SACI,CAAC;IAC7B,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;GAIG;AACH,oDAAoD;AACpD,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC7C,kBAAkB;IAClB,gCAAgC;IAChC,iBAAiB;CACR,CAAC","sourcesContent":["import type { Operation } from \"effection\";\nimport { NoJsFileExtensions } from \"./policies/NoJsFileExtensions.js\";\nimport { PackageJsonRepoDirectoryProperty } from \"./policies/PackageJsonRepoDirectoryProperty.js\";\nimport { PackageJsonSorted } from \"./policies/PackageJsonSorted.js\";\n\n/**\n * A type representing a policy name.\n *\n * @alpha\n */\nexport type PolicyName = string;\n\n/**\n * A stable identifier for a configured policy instance.\n *\n * @alpha\n */\nexport type PolicyInstanceId = string;\n\n/**\n * Arguments passed to policy handler functions.\n *\n * @alpha\n */\nexport interface PolicyArgs<C = void> {\n\t/**\n\t * Path to the file, relative to the repo root.\n\t */\n\tfile: string;\n\n\t/**\n\t * Absolute path to the root of the repo.\n\t */\n\troot: string;\n\n\t/**\n\t * If true, the handler should resolve any violations automatically if possible.\n\t */\n\tresolve: boolean;\n\n\t/**\n\t * Optional configuration for the policy.\n\t */\n\tconfig?: C | undefined;\n}\n\n/**\n * @deprecated Use {@link PolicyArgs} instead.\n * @alpha\n */\nexport type PolicyFunctionArguments<C> = PolicyArgs<C>;\n\n// ============================================================================\n// New Result Types\n// ============================================================================\n\n/**\n * A policy error returned when a file fails a policy check.\n *\n * @alpha\n */\nexport interface PolicyError {\n\t/**\n\t * The error message describing what failed.\n\t */\n\terror: string;\n\n\t/**\n\t * Set to `true` if the policy violation can be fixed automatically.\n\t */\n\tfixable?: boolean | undefined;\n\n\t/**\n\t * Set to `true` if the violation was successfully fixed (only set when resolve=true).\n\t */\n\tfixed?: boolean | undefined;\n\n\t/**\n\t * An optional string that tells the user how to manually fix the failure.\n\t */\n\tmanualFix?: string | undefined;\n}\n\n/**\n * The result of a policy handler.\n * Returns `true` if the file passes the policy, or a {@link PolicyError} if it fails.\n *\n * @alpha\n */\nexport type PolicyResult = true | PolicyError;\n\n// ============================================================================\n// Legacy Result Types (Still supported for backward compatibility)\n// ============================================================================\n\n/**\n * A policy failure (legacy format).\n *\n * @deprecated Use {@link PolicyError} instead, which has a simpler API.\n *\n * @alpha\n */\nexport interface PolicyFailure {\n\t/**\n\t * Name of the policy that failed.\n\t */\n\tname: PolicyName;\n\n\t/**\n\t * Path to the file that failed the policy.\n\t */\n\tfile: string;\n\n\t/**\n\t * Set to `true` if the policy can be fixed automatically.\n\t */\n\tautoFixable?: boolean | undefined;\n\n\t/**\n\t * An optional error message accompanying the failure.\n\t */\n\terrorMessages: string[];\n\n\t/**\n\t * An optional string that tells the user how to fix the failure(s).\n\t */\n\tmanualFix?: string | undefined;\n}\n\n/**\n * The result of an automatic fix for a failing policy (legacy format).\n *\n * @deprecated Use {@link PolicyError} with `fixed: boolean` instead.\n *\n * @alpha\n */\nexport interface PolicyFixResult extends PolicyFailure {\n\t/**\n\t * Set to true if the failure was resolved by the automated fixer.\n\t */\n\tresolved: boolean;\n}\n\n/**\n * Result type that accepts both legacy and new formats.\n *\n * @alpha\n */\nexport type PolicyHandlerResult =\n\t| true\n\t| PolicyFailure\n\t| PolicyFixResult\n\t| PolicyError;\n\n// ============================================================================\n// Handler Types\n// ============================================================================\n\n/**\n * A policy handler function that checks a file against a policy.\n *\n * @remarks\n * Policy handlers can be implemented in two ways:\n * - As an async function returning a Promise\n * - As an Effection generator function returning an Operation\n *\n * Both styles are supported. Async handlers are automatically wrapped for Effection.\n *\n * Handlers can return either the legacy format ({@link PolicyFailure}) or\n * the new format ({@link PolicyError}). The new format is simpler and recommended\n * for new policies.\n *\n * @alpha\n */\nexport type PolicyHandler<C = unknown | undefined> =\n\t| ((args: PolicyArgs<C>) => Promise<PolicyHandlerResult>)\n\t| ((args: PolicyArgs<C>) => Operation<PolicyHandlerResult>);\n\n/**\n * A standalone resolver function that can fix policy violations (legacy format).\n *\n * @deprecated Use {@link PolicyResolver} instead, which uses {@link PolicyError}.\n *\n * @alpha\n */\nexport type PolicyStandaloneResolver<C = undefined> = (\n\targs: Omit<PolicyArgs<C>, \"resolve\">,\n) => Promise<PolicyFixResult> | Operation<PolicyFixResult>;\n\n/**\n * A standalone resolver function using the new format.\n *\n * @alpha\n */\nexport type PolicyResolver<C = void> = (\n\targs: Omit<PolicyArgs<C>, \"resolve\">,\n) => Promise<PolicyError> | Operation<PolicyError>;\n\n// ============================================================================\n// Policy Definition Types\n// ============================================================================\n\n/**\n * Interface describing the shape of a policy definition.\n *\n * @typeParam C - Type of configuration object used by the policy\n *\n * @alpha\n */\nexport interface PolicyShape<C = void> {\n\t/**\n\t * The name of the policy; displayed in UI and used in settings.\n\t */\n\tname: PolicyName;\n\n\t/**\n\t * A detailed description of the policy and its purpose.\n\t */\n\tdescription: string;\n\n\t/**\n\t * A regular expression that matches files this policy applies to.\n\t */\n\tmatch: RegExp;\n\n\t/**\n\t * The handler function that checks if a file complies with the policy.\n\t */\n\thandler: PolicyHandler<C>;\n\n\t/**\n\t * An optional resolver function that can automatically fix violations.\n\t */\n\tresolver?: PolicyStandaloneResolver<C> | undefined;\n\n\t/**\n\t * A default configuration that will be used if none is provided.\n\t */\n\tdefaultConfig?: C | undefined;\n}\n\n/**\n * Abstract base class for creating policies with object-based construction.\n *\n * @remarks\n * This class accepts a {@link PolicyShape} object in its constructor,\n * making it easier to add new optional properties in the future without breaking changes.\n *\n * @alpha\n */\nexport abstract class Policy<C = void> implements PolicyShape<C> {\n\tpublic readonly name: string;\n\tpublic readonly description: string;\n\tpublic readonly match: RegExp;\n\tpublic readonly handler: PolicyHandler<C>;\n\tpublic readonly defaultConfig?: C | undefined;\n\tpublic readonly resolver?: PolicyStandaloneResolver<C> | undefined;\n\n\tpublic constructor(definition: PolicyShape<C>) {\n\t\tthis.name = definition.name;\n\t\tthis.description = definition.description;\n\t\tthis.match = definition.match;\n\t\tthis.handler = definition.handler;\n\t\tthis.defaultConfig = definition.defaultConfig;\n\t\tthis.resolver = definition.resolver;\n\t}\n}\n\n/**\n * @deprecated Use {@link PolicyShape} instead.\n * @alpha\n */\nexport type PolicyDefinition<C = undefined> = PolicyShape<C>;\n\n/**\n * A policy instance with configuration and exclusion settings applied.\n *\n * @typeParam C - Type of configuration object used by the policy\n *\n * @alpha\n */\nexport interface ConfiguredPolicy<C = void> extends PolicyShape<C> {\n\t/**\n\t * An optional stable identifier for this configured policy instance.\n\t *\n\t * This is required when the same policy definition is configured more than once.\n\t */\n\tinstanceId?: PolicyInstanceId | undefined;\n\n\t/**\n\t * The configuration applied to this policy instance.\n\t */\n\tconfig?: C | undefined;\n\n\t/**\n\t * File paths matching these patterns will be excluded from this policy.\n\t * @deprecated Use `excludeFiles` instead for backward compatibility.\n\t */\n\texclude?: (string | RegExp)[] | undefined;\n\n\t/**\n\t * File paths matching these patterns will be excluded from this policy.\n\t */\n\texcludeFiles?: (string | RegExp)[] | undefined;\n\n\t/**\n\t * Internal normalized handler (always an Effection Operation).\n\t * This is set by the policy() function and used by the execution engine.\n\t * @internal\n\t */\n\t_internalHandler?: (args: PolicyArgs<C>) => Operation<PolicyHandlerResult>;\n}\n\n/**\n * Settings for configuring a policy instance.\n * @alpha\n */\nexport interface PolicyInstanceSettings<C> {\n\t/**\n\t * A stable identifier for this configured policy instance.\n\t */\n\tinstanceId?: PolicyInstanceId | undefined;\n\n\t/**\n\t * An array of strings/regular expressions. File paths that match any of these expressions will be completely excluded\n\t * from policy.\n\t *\n\t * Paths will be matched relative to the root of the repo.\n\t */\n\texcludeFiles?: (string | RegExp)[];\n\n\t/**\n\t * The config that is applied to the policy instance.\n\t */\n\tconfig?: C | undefined;\n}\n\n/**\n * @deprecated Use {@link ConfiguredPolicy} instead.\n * @alpha\n */\nexport type PolicyInstance<C = undefined> = ConfiguredPolicy<C>;\n\n/**\n * A configured policy instance with its runtime identity assigned.\n *\n * @alpha\n */\nexport type IdentifiedPolicy<C = undefined> = ConfiguredPolicy<C> & {\n\tinstanceId: PolicyInstanceId;\n};\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard to check if a result is a {@link PolicyFixResult} (legacy).\n *\n * @deprecated Use {@link isPolicyError} instead when working with the new {@link PolicyError} format.\n *\n * @alpha\n */\n// biome-ignore lint/suspicious/noExplicitAny: type guard\nexport function isPolicyFixResult(toCheck: any): toCheck is PolicyFixResult {\n\tif (typeof toCheck !== \"object\" || toCheck === null) {\n\t\treturn false;\n\t}\n\treturn \"resolved\" in toCheck;\n}\n\n/**\n * Type guard to check if a result is a PolicyError (new format).\n *\n * @alpha\n */\n// biome-ignore lint/suspicious/noExplicitAny: type guard\nexport function isPolicyError(toCheck: any): toCheck is PolicyError {\n\tif (typeof toCheck !== \"object\" || toCheck === null) {\n\t\treturn false;\n\t}\n\treturn \"error\" in toCheck && typeof toCheck.error === \"string\";\n}\n\n/**\n * Type guard to check if a result is a {@link PolicyFailure} (legacy format).\n *\n * @deprecated Use {@link isPolicyError} instead when working with the new {@link PolicyError} format.\n *\n * @alpha\n */\n// biome-ignore lint/suspicious/noExplicitAny: type guard\nexport function isPolicyFailure(toCheck: any): toCheck is PolicyFailure {\n\tif (typeof toCheck !== \"object\" || toCheck === null) {\n\t\treturn false;\n\t}\n\treturn \"errorMessages\" in toCheck && Array.isArray(toCheck.errorMessages);\n}\n\n// ============================================================================\n// Conversion Functions\n// ============================================================================\n\n/**\n * Converts a legacy PolicyFailure/PolicyFixResult to the new PolicyError format.\n * @internal\n */\nexport function convertLegacyResult(\n\tresult: PolicyHandlerResult,\n\t_file: string,\n): PolicyResult {\n\tif (result === true) {\n\t\treturn true;\n\t}\n\n\t// Check if it's already the new format\n\tif (isPolicyError(result)) {\n\t\treturn result;\n\t}\n\n\t// It's a legacy PolicyFailure or PolicyFixResult\n\tconst error = result.errorMessages?.join(\"; \") ?? \"Policy violation\";\n\tconst isFixResult = isPolicyFixResult(result);\n\n\treturn {\n\t\terror,\n\t\tfixable: result.autoFixable ?? false,\n\t\tfixed: isFixResult ? result.resolved : undefined,\n\t\tmanualFix: result.manualFix,\n\t};\n}\n\n/**\n * Converts a new PolicyError to the legacy PolicyFailure format.\n * @internal\n */\nexport function convertToLegacyResult(\n\tresult: PolicyError,\n\tpolicyName: string,\n\tfile: string,\n): PolicyFailure | PolicyFixResult {\n\tconst base: PolicyFailure = {\n\t\tname: policyName,\n\t\tfile,\n\t\tautoFixable: result.fixable,\n\t\terrorMessages: [result.error],\n\t\tmanualFix: result.manualFix,\n\t};\n\n\tif (result.fixed !== undefined) {\n\t\treturn {\n\t\t\t...base,\n\t\t\tresolved: result.fixed,\n\t\t} satisfies PolicyFixResult;\n\t}\n\n\treturn base;\n}\n\n// ============================================================================\n// Default Policies\n// ============================================================================\n\n/**\n * Default policies included with repopo.\n *\n * @alpha\n */\n// biome-ignore lint/suspicious/noExplicitAny: FIXME\nexport const DefaultPolicies: Policy<any>[] = [\n\tNoJsFileExtensions,\n\tPackageJsonRepoDirectoryProperty,\n\tPackageJsonSorted,\n] as const;\n"]}
1
+ {"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA2GpE,iFAAiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,kBAAkB;IAClB,gCAAgC;IAChC,iBAAiB;CACR,CAAC","sourcesContent":["import type { Operation } from \"effection\";\nimport { NoJsFileExtensions } from \"./policies/NoJsFileExtensions.js\";\nimport { PackageJsonRepoDirectoryProperty } from \"./policies/PackageJsonRepoDirectoryProperty.js\";\nimport { PackageJsonSorted } from \"./policies/PackageJsonSorted.js\";\nimport type { RepositoryFile } from \"./repositoryChanges.js\";\n\n/** Display name of a policy. @public */\nexport type PolicyName = string;\n/** Stable configured-instance identity. @public */\nexport type PolicyInstanceId = string;\n\n/** Arguments supplied to a file handler. @public */\nexport interface PolicyArgs<C = void> {\n\tfile: string;\n\troot: string;\n\tresolve: boolean;\n\tconfig?: C | undefined;\n}\n\n/** Arguments supplied to a repository/change handler; stdin selection never limits entries. @public */\nexport interface RepositoryPolicyArgs<C = void>\n\textends Omit<PolicyArgs<C>, \"file\"> {\n\tfiles: readonly string[];\n\t/** Matching eligible inventory, including unchanged files and deleted paths. */\n\tentries: readonly RepositoryFile[];\n}\n\n/** A single independently actionable violation or recorded fix. @public */\nexport interface PolicyFinding {\n\tmessage: string;\n\tmanualFix?: string | undefined;\n\tfixStatus?: \"available\" | \"fixed\" | \"failed\" | undefined;\n\t/** Repo-relative affected files. Only repository handlers may supply this. */\n\tfiles?: readonly string[] | undefined;\n}\n\n/** Empty means pass. Fixed findings remain visible. @public */\nexport type PolicyResult = readonly PolicyFinding[];\n\n/** Standalone file fixers receive and return the complete findings list. @public */\nexport type PolicyResolver<C = void> = {\n\tresolve(\n\t\targs: Omit<PolicyArgs<C>, \"resolve\"> & { findings: PolicyResult },\n\t): Promise<PolicyResult> | Operation<PolicyResult>;\n}[\"resolve\"];\n\n/** File scope is the default. @public */\nexport interface FilePolicyDefinition<C = void> {\n\tname: PolicyName;\n\tdescription: string;\n\tscope?: \"file\";\n\tmatch: RegExp;\n\thandler(args: PolicyArgs<C>): Promise<PolicyResult> | Operation<PolicyResult>;\n\tresolver?: PolicyResolver<C> | undefined;\n\tdefaultConfig?: C | undefined;\n\trequiresConfig?: boolean | undefined;\n}\n\n/** Repository/change scopes run once over matching inventory; fixers are inline only. @public */\nexport interface RepositoryPolicyDefinition<C = void> {\n\tname: PolicyName;\n\tdescription: string;\n\t/** Changes scope requests Git status annotation (PR mode by default). */\n\tscope: \"repository\" | \"changes\";\n\t/** Match repo-relative paths, including either rename endpoint; omitted means all entries. */\n\tmatch?: RegExp | undefined;\n\thandler(\n\t\targs: RepositoryPolicyArgs<C>,\n\t): Promise<PolicyResult> | Operation<PolicyResult>;\n\tresolver?: never;\n\tdefaultConfig?: C | undefined;\n\trequiresConfig?: boolean | undefined;\n}\n\n/** A canonical policy definition. @public */\nexport type PolicyDefinition<C = void> =\n\t| FilePolicyDefinition<C>\n\t| RepositoryPolicyDefinition<C>;\n\n/** Async and Effection file handlers are supported. @public */\nexport type PolicyHandler<C = void> = FilePolicyDefinition<C>[\"handler\"];\n/** Async and Effection repository handlers are supported. @public */\nexport type RepositoryPolicyHandler<C = void> =\n\tRepositoryPolicyDefinition<C>[\"handler\"];\n\n/** Exclude undefined (including void) while preserving allowed null values. @internal */\nexport type DefinedConfig<C> = NonNullable<C> | (C & null);\n\n/** Instance configuration and repo-relative regex exclusions. @public */\nexport interface PolicyOptions<C = void> {\n\tconfig?: C | undefined;\n\texclude?: readonly (string | RegExp)[] | undefined;\n\tinstanceId?: PolicyInstanceId | undefined;\n}\n\n/** A configured file policy. @public */\nexport type ConfiguredFilePolicy<C = void> = FilePolicyDefinition<C> &\n\tPolicyOptions<C>;\n/** A configured repository policy. @public */\nexport type ConfiguredRepositoryPolicy<C = void> =\n\tRepositoryPolicyDefinition<C> & PolicyOptions<C>;\n/** A configured policy, retaining scope discrimination. @public */\nexport type ConfiguredPolicy<C = unknown> =\n\t| ConfiguredFilePolicy<C>\n\t| ConfiguredRepositoryPolicy<C>;\n/** A configured policy with a validated stable identity. @public */\nexport type IdentifiedPolicy<C = unknown> = ConfiguredPolicy<C> & {\n\tinstanceId: PolicyInstanceId;\n};\n\n/** The default definitions, configured when no policies are supplied. @public */\nexport const DefaultPolicies = [\n\tNoJsFileExtensions,\n\tPackageJsonRepoDirectoryProperty,\n\tPackageJsonSorted,\n] as const;\n"]}