@ai-primitives-hub/core 0.2.1 → 0.2.2-next.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 (336) hide show
  1. package/dist/domain/bundle/version.d.ts +13 -0
  2. package/dist/domain/bundle/version.d.ts.map +1 -1
  3. package/dist/domain/bundle/version.js +27 -0
  4. package/dist/domain/bundle/version.js.map +1 -1
  5. package/dist/domain/collection/apm-release-plan.d.ts +39 -0
  6. package/dist/domain/collection/apm-release-plan.d.ts.map +1 -0
  7. package/dist/domain/collection/apm-release-plan.js +185 -0
  8. package/dist/domain/collection/apm-release-plan.js.map +1 -0
  9. package/dist/domain/collection/contribution.d.ts +126 -0
  10. package/dist/domain/collection/contribution.d.ts.map +1 -0
  11. package/dist/domain/collection/contribution.js +462 -0
  12. package/dist/domain/collection/contribution.js.map +1 -0
  13. package/dist/domain/collection/diagnostics.d.ts +166 -0
  14. package/dist/domain/collection/diagnostics.d.ts.map +1 -0
  15. package/dist/domain/collection/diagnostics.js +3 -0
  16. package/dist/domain/collection/diagnostics.js.map +1 -0
  17. package/dist/domain/collection/manifest-validator.d.ts +3 -2
  18. package/dist/domain/collection/manifest-validator.d.ts.map +1 -1
  19. package/dist/domain/collection/manifest-validator.js +99 -17
  20. package/dist/domain/collection/manifest-validator.js.map +1 -1
  21. package/dist/domain/collection/release-manifest-plan.d.ts +9 -0
  22. package/dist/domain/collection/release-manifest-plan.d.ts.map +1 -1
  23. package/dist/domain/collection/release-manifest-plan.js +45 -14
  24. package/dist/domain/collection/release-manifest-plan.js.map +1 -1
  25. package/dist/domain/collection/validate.d.ts +5 -0
  26. package/dist/domain/collection/validate.d.ts.map +1 -1
  27. package/dist/domain/collection/validate.js +7 -2
  28. package/dist/domain/collection/validate.js.map +1 -1
  29. package/dist/domain/diagnostics/primitives/catalogue.d.ts +40 -0
  30. package/dist/domain/diagnostics/primitives/catalogue.d.ts.map +1 -0
  31. package/dist/domain/diagnostics/primitives/catalogue.js +78 -0
  32. package/dist/domain/diagnostics/primitives/catalogue.js.map +1 -0
  33. package/dist/domain/diagnostics/primitives/classifier.d.ts +81 -0
  34. package/dist/domain/diagnostics/primitives/classifier.d.ts.map +1 -0
  35. package/dist/domain/diagnostics/primitives/classifier.js +138 -0
  36. package/dist/domain/diagnostics/primitives/classifier.js.map +1 -0
  37. package/dist/domain/diagnostics/primitives/evaluators.d.ts +138 -0
  38. package/dist/domain/diagnostics/primitives/evaluators.d.ts.map +1 -0
  39. package/dist/domain/diagnostics/primitives/evaluators.js +485 -0
  40. package/dist/domain/diagnostics/primitives/evaluators.js.map +1 -0
  41. package/dist/domain/diagnostics/primitives/fixture.d.ts +97 -0
  42. package/dist/domain/diagnostics/primitives/fixture.d.ts.map +1 -0
  43. package/dist/domain/diagnostics/primitives/fixture.js +265 -0
  44. package/dist/domain/diagnostics/primitives/fixture.js.map +1 -0
  45. package/dist/domain/diagnostics/primitives/index.d.ts +18 -0
  46. package/dist/domain/diagnostics/primitives/index.d.ts.map +1 -0
  47. package/dist/domain/diagnostics/primitives/index.js +34 -0
  48. package/dist/domain/diagnostics/primitives/index.js.map +1 -0
  49. package/dist/domain/diagnostics/primitives/known-gaps.d.ts +50 -0
  50. package/dist/domain/diagnostics/primitives/known-gaps.d.ts.map +1 -0
  51. package/dist/domain/diagnostics/primitives/known-gaps.js +148 -0
  52. package/dist/domain/diagnostics/primitives/known-gaps.js.map +1 -0
  53. package/dist/domain/diagnostics/primitives/manifest-view.d.ts +28 -0
  54. package/dist/domain/diagnostics/primitives/manifest-view.d.ts.map +1 -0
  55. package/dist/domain/diagnostics/primitives/manifest-view.js +50 -0
  56. package/dist/domain/diagnostics/primitives/manifest-view.js.map +1 -0
  57. package/dist/domain/diagnostics/primitives/placements.d.ts +51 -0
  58. package/dist/domain/diagnostics/primitives/placements.d.ts.map +1 -0
  59. package/dist/domain/diagnostics/primitives/placements.js +76 -0
  60. package/dist/domain/diagnostics/primitives/placements.js.map +1 -0
  61. package/dist/domain/diagnostics/primitives/planner.d.ts +60 -0
  62. package/dist/domain/diagnostics/primitives/planner.d.ts.map +1 -0
  63. package/dist/domain/diagnostics/primitives/planner.js +60 -0
  64. package/dist/domain/diagnostics/primitives/planner.js.map +1 -0
  65. package/dist/domain/diagnostics/primitives/plugin-projection.d.ts +38 -0
  66. package/dist/domain/diagnostics/primitives/plugin-projection.d.ts.map +1 -0
  67. package/dist/domain/diagnostics/primitives/plugin-projection.js +173 -0
  68. package/dist/domain/diagnostics/primitives/plugin-projection.js.map +1 -0
  69. package/dist/domain/diagnostics/primitives/report.d.ts +122 -0
  70. package/dist/domain/diagnostics/primitives/report.d.ts.map +1 -0
  71. package/dist/domain/diagnostics/primitives/report.js +85 -0
  72. package/dist/domain/diagnostics/primitives/report.js.map +1 -0
  73. package/dist/domain/diagnostics/primitives/sandbox.d.ts +59 -0
  74. package/dist/domain/diagnostics/primitives/sandbox.d.ts.map +1 -0
  75. package/dist/domain/diagnostics/primitives/sandbox.js +193 -0
  76. package/dist/domain/diagnostics/primitives/sandbox.js.map +1 -0
  77. package/dist/domain/diagnostics/primitives/support-matrix.d.ts +36 -0
  78. package/dist/domain/diagnostics/primitives/support-matrix.d.ts.map +1 -0
  79. package/dist/domain/diagnostics/primitives/support-matrix.js +69 -0
  80. package/dist/domain/diagnostics/primitives/support-matrix.js.map +1 -0
  81. package/dist/domain/diagnostics/primitives/types.d.ts +117 -0
  82. package/dist/domain/diagnostics/primitives/types.d.ts.map +1 -0
  83. package/dist/domain/diagnostics/primitives/types.js +62 -0
  84. package/dist/domain/diagnostics/primitives/types.js.map +1 -0
  85. package/dist/domain/governance/catalogue.d.ts +11 -0
  86. package/dist/domain/governance/catalogue.d.ts.map +1 -0
  87. package/dist/domain/governance/catalogue.js +45 -0
  88. package/dist/domain/governance/catalogue.js.map +1 -0
  89. package/dist/domain/governance/effective-rules.d.ts +19 -0
  90. package/dist/domain/governance/effective-rules.d.ts.map +1 -0
  91. package/dist/domain/governance/effective-rules.js +49 -0
  92. package/dist/domain/governance/effective-rules.js.map +1 -0
  93. package/dist/domain/governance/evaluate.d.ts +16 -0
  94. package/dist/domain/governance/evaluate.d.ts.map +1 -0
  95. package/dist/domain/governance/evaluate.js +34 -0
  96. package/dist/domain/governance/evaluate.js.map +1 -0
  97. package/dist/domain/governance/hub-scope.d.ts +74 -0
  98. package/dist/domain/governance/hub-scope.d.ts.map +1 -0
  99. package/dist/domain/governance/hub-scope.js +202 -0
  100. package/dist/domain/governance/hub-scope.js.map +1 -0
  101. package/dist/domain/governance/hub-scoped-inventory.d.ts +22 -0
  102. package/dist/domain/governance/hub-scoped-inventory.d.ts.map +1 -0
  103. package/dist/domain/governance/hub-scoped-inventory.js +59 -0
  104. package/dist/domain/governance/hub-scoped-inventory.js.map +1 -0
  105. package/dist/domain/governance/index.d.ts +15 -0
  106. package/dist/domain/governance/index.d.ts.map +1 -0
  107. package/dist/domain/governance/index.js +31 -0
  108. package/dist/domain/governance/index.js.map +1 -0
  109. package/dist/domain/governance/rule-registry.d.ts +20 -0
  110. package/dist/domain/governance/rule-registry.d.ts.map +1 -0
  111. package/dist/domain/governance/rule-registry.js +40 -0
  112. package/dist/domain/governance/rule-registry.js.map +1 -0
  113. package/dist/domain/governance/rules/collection.d.ts +32 -0
  114. package/dist/domain/governance/rules/collection.d.ts.map +1 -0
  115. package/dist/domain/governance/rules/collection.js +153 -0
  116. package/dist/domain/governance/rules/collection.js.map +1 -0
  117. package/dist/domain/governance/rules/config.d.ts +15 -0
  118. package/dist/domain/governance/rules/config.d.ts.map +1 -0
  119. package/dist/domain/governance/rules/config.js +38 -0
  120. package/dist/domain/governance/rules/config.js.map +1 -0
  121. package/dist/domain/governance/rules/hub.d.ts +7 -0
  122. package/dist/domain/governance/rules/hub.d.ts.map +1 -0
  123. package/dist/domain/governance/rules/hub.js +10 -0
  124. package/dist/domain/governance/rules/hub.js.map +1 -0
  125. package/dist/domain/governance/types.d.ts +70 -0
  126. package/dist/domain/governance/types.d.ts.map +1 -0
  127. package/dist/domain/governance/types.js +7 -0
  128. package/dist/domain/governance/types.js.map +1 -0
  129. package/dist/domain/hub/diagnostics.d.ts +92 -0
  130. package/dist/domain/hub/diagnostics.d.ts.map +1 -0
  131. package/dist/domain/hub/diagnostics.js +11 -0
  132. package/dist/domain/hub/diagnostics.js.map +1 -0
  133. package/dist/domain/hub/profile-requirements.d.ts +16 -0
  134. package/dist/domain/hub/profile-requirements.d.ts.map +1 -0
  135. package/dist/domain/hub/profile-requirements.js +16 -0
  136. package/dist/domain/hub/profile-requirements.js.map +1 -0
  137. package/dist/domain/hub/replicate.d.ts +23 -0
  138. package/dist/domain/hub/replicate.d.ts.map +1 -1
  139. package/dist/domain/hub/replicate.js +13 -0
  140. package/dist/domain/hub/replicate.js.map +1 -1
  141. package/dist/domain/hub/types.d.ts +2 -0
  142. package/dist/domain/hub/types.d.ts.map +1 -1
  143. package/dist/domain/hub/validate.d.ts +150 -2
  144. package/dist/domain/hub/validate.d.ts.map +1 -1
  145. package/dist/domain/hub/validate.js +421 -37
  146. package/dist/domain/hub/validate.js.map +1 -1
  147. package/dist/domain/index.d.ts +17 -0
  148. package/dist/domain/index.d.ts.map +1 -1
  149. package/dist/domain/index.js +17 -0
  150. package/dist/domain/index.js.map +1 -1
  151. package/dist/domain/install/category.d.ts +31 -0
  152. package/dist/domain/install/category.d.ts.map +1 -0
  153. package/dist/domain/install/category.js +33 -0
  154. package/dist/domain/install/category.js.map +1 -0
  155. package/dist/domain/install/file-mode.d.ts +49 -0
  156. package/dist/domain/install/file-mode.d.ts.map +1 -0
  157. package/dist/domain/install/file-mode.js +54 -0
  158. package/dist/domain/install/file-mode.js.map +1 -0
  159. package/dist/domain/install/git-exclude.d.ts +22 -0
  160. package/dist/domain/install/git-exclude.d.ts.map +1 -0
  161. package/dist/domain/install/git-exclude.js +56 -0
  162. package/dist/domain/install/git-exclude.js.map +1 -0
  163. package/dist/domain/install/installable.d.ts +2 -0
  164. package/dist/domain/install/installable.d.ts.map +1 -1
  165. package/dist/domain/install/kind-route.d.ts +80 -0
  166. package/dist/domain/install/kind-route.d.ts.map +1 -0
  167. package/dist/domain/install/kind-route.js +135 -0
  168. package/dist/domain/install/kind-route.js.map +1 -0
  169. package/dist/domain/install/record-errors.d.ts +53 -0
  170. package/dist/domain/install/record-errors.d.ts.map +1 -0
  171. package/dist/domain/install/record-errors.js +104 -0
  172. package/dist/domain/install/record-errors.js.map +1 -0
  173. package/dist/domain/install/record-object.d.ts +21 -0
  174. package/dist/domain/install/record-object.d.ts.map +1 -0
  175. package/dist/domain/install/record-object.js +38 -0
  176. package/dist/domain/install/record-object.js.map +1 -0
  177. package/dist/domain/install/record-parse.d.ts +23 -0
  178. package/dist/domain/install/record-parse.d.ts.map +1 -0
  179. package/dist/domain/install/record-parse.js +73 -0
  180. package/dist/domain/install/record-parse.js.map +1 -0
  181. package/dist/domain/install/record-path.d.ts +26 -0
  182. package/dist/domain/install/record-path.d.ts.map +1 -0
  183. package/dist/domain/install/record-path.js +130 -0
  184. package/dist/domain/install/record-path.js.map +1 -0
  185. package/dist/domain/install/record-types.d.ts +183 -0
  186. package/dist/domain/install/record-types.d.ts.map +1 -0
  187. package/dist/domain/install/record-types.js +92 -0
  188. package/dist/domain/install/record-types.js.map +1 -0
  189. package/dist/domain/install/types.d.ts +2 -0
  190. package/dist/domain/install/types.d.ts.map +1 -1
  191. package/dist/domain/mcp/index.d.ts +1 -0
  192. package/dist/domain/mcp/index.d.ts.map +1 -1
  193. package/dist/domain/mcp/index.js +1 -0
  194. package/dist/domain/mcp/index.js.map +1 -1
  195. package/dist/domain/mcp/server-key.d.ts +35 -0
  196. package/dist/domain/mcp/server-key.d.ts.map +1 -0
  197. package/dist/domain/mcp/server-key.js +44 -0
  198. package/dist/domain/mcp/server-key.js.map +1 -0
  199. package/dist/domain/plugin/agent-plugin-spec.d.ts +8 -0
  200. package/dist/domain/plugin/agent-plugin-spec.d.ts.map +1 -1
  201. package/dist/domain/plugin/agent-plugin-spec.js +22 -8
  202. package/dist/domain/plugin/agent-plugin-spec.js.map +1 -1
  203. package/dist/domain/registry-error.d.ts +1 -1
  204. package/dist/domain/registry-error.d.ts.map +1 -1
  205. package/dist/domain/registry-error.js +2 -1
  206. package/dist/domain/registry-error.js.map +1 -1
  207. package/dist/domain/security/fingerprint.d.ts +18 -0
  208. package/dist/domain/security/fingerprint.d.ts.map +1 -0
  209. package/dist/domain/security/fingerprint.js +34 -0
  210. package/dist/domain/security/fingerprint.js.map +1 -0
  211. package/dist/domain/security/high-impact-rules.d.ts +30 -0
  212. package/dist/domain/security/high-impact-rules.d.ts.map +1 -0
  213. package/dist/domain/security/high-impact-rules.js +160 -0
  214. package/dist/domain/security/high-impact-rules.js.map +1 -0
  215. package/dist/domain/security/index.d.ts +10 -0
  216. package/dist/domain/security/index.d.ts.map +1 -0
  217. package/dist/domain/security/index.js +26 -0
  218. package/dist/domain/security/index.js.map +1 -0
  219. package/dist/domain/security/markdown-context.d.ts +17 -0
  220. package/dist/domain/security/markdown-context.d.ts.map +1 -0
  221. package/dist/domain/security/markdown-context.js +74 -0
  222. package/dist/domain/security/markdown-context.js.map +1 -0
  223. package/dist/domain/security/policy.d.ts +17 -0
  224. package/dist/domain/security/policy.d.ts.map +1 -0
  225. package/dist/domain/security/policy.js +31 -0
  226. package/dist/domain/security/policy.js.map +1 -0
  227. package/dist/domain/security/rating/findings-document.d.ts +22 -0
  228. package/dist/domain/security/rating/findings-document.d.ts.map +1 -0
  229. package/dist/domain/security/rating/findings-document.js +57 -0
  230. package/dist/domain/security/rating/findings-document.js.map +1 -0
  231. package/dist/domain/security/rating/index.d.ts +5 -0
  232. package/dist/domain/security/rating/index.d.ts.map +1 -0
  233. package/dist/domain/security/rating/index.js +21 -0
  234. package/dist/domain/security/rating/index.js.map +1 -0
  235. package/dist/domain/security/rating/scoring.d.ts +83 -0
  236. package/dist/domain/security/rating/scoring.d.ts.map +1 -0
  237. package/dist/domain/security/rating/scoring.js +115 -0
  238. package/dist/domain/security/rating/scoring.js.map +1 -0
  239. package/dist/domain/security/rating/security-rating-report.d.ts +111 -0
  240. package/dist/domain/security/rating/security-rating-report.d.ts.map +1 -0
  241. package/dist/domain/security/rating/security-rating-report.js +152 -0
  242. package/dist/domain/security/rating/security-rating-report.js.map +1 -0
  243. package/dist/domain/security/rating/types.d.ts +22 -0
  244. package/dist/domain/security/rating/types.d.ts.map +1 -0
  245. package/dist/domain/security/rating/types.js +11 -0
  246. package/dist/domain/security/rating/types.js.map +1 -0
  247. package/dist/domain/security/remediations.d.ts +17 -0
  248. package/dist/domain/security/remediations.d.ts.map +1 -0
  249. package/dist/domain/security/remediations.js +61 -0
  250. package/dist/domain/security/remediations.js.map +1 -0
  251. package/dist/domain/security/rule-engine.d.ts +8 -0
  252. package/dist/domain/security/rule-engine.d.ts.map +1 -0
  253. package/dist/domain/security/rule-engine.js +875 -0
  254. package/dist/domain/security/rule-engine.js.map +1 -0
  255. package/dist/domain/security/suppression.d.ts +19 -0
  256. package/dist/domain/security/suppression.d.ts.map +1 -0
  257. package/dist/domain/security/suppression.js +78 -0
  258. package/dist/domain/security/suppression.js.map +1 -0
  259. package/dist/domain/security/types.d.ts +91 -0
  260. package/dist/domain/security/types.d.ts.map +1 -0
  261. package/dist/domain/security/types.js +10 -0
  262. package/dist/domain/security/types.js.map +1 -0
  263. package/dist/index.d.ts +8 -0
  264. package/dist/index.d.ts.map +1 -1
  265. package/dist/index.js +12 -1
  266. package/dist/index.js.map +1 -1
  267. package/dist/ports/app-storage.d.ts +11 -15
  268. package/dist/ports/app-storage.d.ts.map +1 -1
  269. package/dist/ports/app-storage.js +8 -8
  270. package/dist/ports/argv-process-runner.d.ts +6 -0
  271. package/dist/ports/argv-process-runner.d.ts.map +1 -0
  272. package/dist/ports/argv-process-runner.js +3 -0
  273. package/dist/ports/argv-process-runner.js.map +1 -0
  274. package/dist/ports/bundle-extractor.d.ts +16 -3
  275. package/dist/ports/bundle-extractor.d.ts.map +1 -1
  276. package/dist/ports/collection-contribution.d.ts +36 -0
  277. package/dist/ports/collection-contribution.d.ts.map +1 -0
  278. package/dist/ports/collection-contribution.js +3 -0
  279. package/dist/ports/collection-contribution.js.map +1 -0
  280. package/dist/ports/filesystem.d.ts +12 -0
  281. package/dist/ports/filesystem.d.ts.map +1 -1
  282. package/dist/ports/hub-collection-index.d.ts +27 -0
  283. package/dist/ports/hub-collection-index.d.ts.map +1 -0
  284. package/dist/ports/hub-collection-index.js +3 -0
  285. package/dist/ports/hub-collection-index.js.map +1 -0
  286. package/dist/ports/hub-contribution.d.ts +158 -0
  287. package/dist/ports/hub-contribution.d.ts.map +1 -0
  288. package/dist/ports/hub-contribution.js +3 -0
  289. package/dist/ports/hub-contribution.js.map +1 -0
  290. package/dist/ports/index.d.ts +12 -0
  291. package/dist/ports/index.d.ts.map +1 -1
  292. package/dist/ports/index.js +12 -0
  293. package/dist/ports/index.js.map +1 -1
  294. package/dist/ports/primitive-diagnostics-driver.d.ts +96 -0
  295. package/dist/ports/primitive-diagnostics-driver.d.ts.map +1 -0
  296. package/dist/ports/primitive-diagnostics-driver.js +3 -0
  297. package/dist/ports/primitive-diagnostics-driver.js.map +1 -0
  298. package/dist/ports/record-fs.d.ts +46 -0
  299. package/dist/ports/record-fs.d.ts.map +1 -0
  300. package/dist/ports/record-fs.js +9 -0
  301. package/dist/ports/record-fs.js.map +1 -0
  302. package/dist/ports/registry-operations.d.ts +3 -2
  303. package/dist/ports/registry-operations.d.ts.map +1 -1
  304. package/dist/ports/release-lookup.d.ts +24 -0
  305. package/dist/ports/release-lookup.d.ts.map +1 -0
  306. package/dist/ports/release-lookup.js +7 -0
  307. package/dist/ports/release-lookup.js.map +1 -0
  308. package/dist/ports/release-source.d.ts +17 -3
  309. package/dist/ports/release-source.d.ts.map +1 -1
  310. package/dist/ports/repository-exclusion.d.ts +30 -0
  311. package/dist/ports/repository-exclusion.d.ts.map +1 -0
  312. package/dist/ports/repository-exclusion.js +3 -0
  313. package/dist/ports/repository-exclusion.js.map +1 -0
  314. package/dist/ports/schema-validator.d.ts +25 -0
  315. package/dist/ports/schema-validator.d.ts.map +1 -0
  316. package/dist/ports/schema-validator.js +7 -0
  317. package/dist/ports/schema-validator.js.map +1 -0
  318. package/dist/ports/security-report-store.d.ts +9 -0
  319. package/dist/ports/security-report-store.d.ts.map +1 -0
  320. package/dist/ports/security-report-store.js +4 -0
  321. package/dist/ports/security-report-store.js.map +1 -0
  322. package/dist/ports/security-scan-engine.d.ts +32 -0
  323. package/dist/ports/security-scan-engine.d.ts.map +1 -0
  324. package/dist/ports/security-scan-engine.js +6 -0
  325. package/dist/ports/security-scan-engine.js.map +1 -0
  326. package/dist/ports/security-scan-input.d.ts +63 -0
  327. package/dist/ports/security-scan-input.d.ts.map +1 -0
  328. package/dist/ports/security-scan-input.js +3 -0
  329. package/dist/ports/security-scan-input.js.map +1 -0
  330. package/dist/ports/source-adapter.d.ts +11 -0
  331. package/dist/ports/source-adapter.d.ts.map +1 -1
  332. package/dist/public/schemas/collection.schema.json +0 -1
  333. package/dist/public/schemas/hub-governance.schema.json +21 -0
  334. package/dist/public/schemas/install-record.schema.json +343 -0
  335. package/dist/public/schemas/security-rating-report.schema.json +113 -0
  336. package/package.json +2 -2
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.semanticHubValue = semanticHubValue;
4
+ exports.assertHubScopeDocument = assertHubScopeDocument;
5
+ exports.computeHubScope = computeHubScope;
6
+ exports.selectHubScope = selectHubScope;
7
+ exports.hubScopeLocationMapper = hubScopeLocationMapper;
8
+ /**
9
+ * Stable serialization ignores mapping order, but preserves meaningful array order.
10
+ * @param value
11
+ */
12
+ function semanticHubValue(value) {
13
+ if (Array.isArray(value)) {
14
+ return `[${value.map((entry) => semanticHubValue(entry)).join(',')}]`;
15
+ }
16
+ if (value !== null && typeof value === 'object') {
17
+ return `{${Object.entries(value).toSorted(([a], [b]) => a.localeCompare(b)).map(([key, entry]) => `${JSON.stringify(key)}:${semanticHubValue(entry)}`).join(',')}}`;
18
+ }
19
+ return JSON.stringify(value) ?? 'undefined';
20
+ }
21
+ /**
22
+ * Validate identity before building maps: duplicates must never be overwritten.
23
+ * @param value
24
+ */
25
+ function assertHubScopeDocument(value) {
26
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
27
+ throw new Error('Hub root must be a mapping.');
28
+ }
29
+ const root = value;
30
+ for (const kind of ['sources', 'profiles']) {
31
+ const entries = root[kind] === undefined && kind === 'profiles' ? [] : root[kind];
32
+ if (!Array.isArray(entries)) {
33
+ throw new Error(`${kind} must be an array.`);
34
+ }
35
+ const ids = new Set();
36
+ for (const candidate of entries) {
37
+ const entry = candidate !== null && typeof candidate === 'object' ? candidate : {};
38
+ if (typeof entry.id !== 'string' || !/^[a-zA-Z0-9_-]{1,50}$/.test(entry.id)) {
39
+ throw new Error(`Malformed ${kind} ID.`);
40
+ }
41
+ if (ids.has(entry.id)) {
42
+ throw new Error(`Duplicate ${kind} ID '${entry.id}'.`);
43
+ }
44
+ ids.add(entry.id);
45
+ if (kind === 'profiles' && Array.isArray(entry.bundles)) {
46
+ for (const reference of entry.bundles) {
47
+ const ref = reference !== null && typeof reference === 'object' ? reference : {};
48
+ if (typeof ref.id !== 'string' || !/^[\w.-]{1,200}$/.test(ref.id)
49
+ || typeof ref.source !== 'string' || !/^[a-zA-Z0-9_-]{1,50}$/.test(ref.source)) {
50
+ throw new Error('Malformed profile reference ID.');
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ const entities = (doc, kind) => doc[kind] ?? [];
58
+ const bundles = (entity) => Array.isArray(entity.bundles) ? entity.bundles : [];
59
+ const sorted = (values) => [...new Set(values)].toSorted();
60
+ const referenceKey = (ref) => semanticHubValue(ref);
61
+ /**
62
+ * Compute changed identities and the surviving dependency closure against explicit head data.
63
+ * @param base
64
+ * @param head
65
+ * @param explicit
66
+ * @param explicit.sourceIds
67
+ * @param explicit.profileIds
68
+ */
69
+ function computeHubScope(base, head, explicit) {
70
+ assertHubScopeDocument(base);
71
+ assertHubScopeDocument(head);
72
+ const changes = (kind) => {
73
+ const before = new Map(entities(base, kind).map((e) => [e.id, e]));
74
+ const after = new Map(entities(head, kind).map((e) => [e.id, e]));
75
+ return {
76
+ added: sorted([...after.keys()].filter((id) => !before.has(id))),
77
+ modified: sorted([...after.keys()].filter((id) => before.has(id) && semanticHubValue(before.get(id)) !== semanticHubValue(after.get(id)))),
78
+ removed: sorted([...before.keys()].filter((id) => !after.has(id)))
79
+ };
80
+ };
81
+ const sources = changes('sources');
82
+ const profiles = changes('profiles');
83
+ if (explicit) {
84
+ for (const [kind, ids] of [['sources', explicit.sourceIds], ['profiles', explicit.profileIds]]) {
85
+ if (new Set(ids).size !== ids.length || ids.some((id) => !entities(head, kind).some((e) => e.id === id))) {
86
+ throw new Error(`Unknown or duplicate ${kind} scope ID.`);
87
+ }
88
+ }
89
+ }
90
+ const changedSources = new Set(explicit?.sourceIds ?? [...sources.added, ...sources.modified, ...sources.removed]);
91
+ const selectedProfiles = new Set(explicit?.profileIds ?? [...profiles.added, ...profiles.modified]);
92
+ const reasons = [];
93
+ for (const id of changedSources) {
94
+ reasons.push({ entity: 'source', id, reason: explicit ? 'explicit selection' : 'semantic source change' });
95
+ }
96
+ const references = [];
97
+ const removedReferences = [];
98
+ for (const profile of entities(base, 'profiles')) {
99
+ const remaining = entities(head, 'profiles').find((p) => p.id === profile.id);
100
+ const after = new Set((remaining ? bundles(remaining) : []).map((ref) => referenceKey(ref)));
101
+ for (const ref of bundles(profile)) {
102
+ if (!after.has(referenceKey(ref))) {
103
+ removedReferences.push({ profileId: profile.id, source: String(ref.source), id: String(ref.id), version: String(ref.version) });
104
+ }
105
+ }
106
+ }
107
+ for (const id of profiles.removed) {
108
+ reasons.push({ entity: 'profile', id, reason: 'profile removed' });
109
+ }
110
+ for (const profile of entities(head, 'profiles')) {
111
+ const dependent = bundles(profile).some((ref) => changedSources.has(String(ref.source)));
112
+ if (dependent) {
113
+ selectedProfiles.add(profile.id);
114
+ }
115
+ if (!selectedProfiles.has(profile.id)) {
116
+ continue;
117
+ }
118
+ reasons.push({ entity: 'profile', id: profile.id, reason: dependent ? 'depends on changed source' : (explicit ? 'explicit selection' : 'semantic profile change') });
119
+ const old = entities(base, 'profiles').find((p) => p.id === profile.id);
120
+ const before = new Set((old ? bundles(old) : []).map((ref) => referenceKey(ref)));
121
+ for (const ref of bundles(profile)) {
122
+ if (explicit?.profileIds.includes(profile.id) || changedSources.has(String(ref.source)) || !before.has(referenceKey(ref))) {
123
+ references.push({ profileId: profile.id, source: String(ref.source), id: String(ref.id), version: String(ref.version) });
124
+ }
125
+ }
126
+ }
127
+ const globals = (doc) => Object.fromEntries(Object.entries(doc).filter(([key]) => key !== 'sources' && key !== 'profiles'));
128
+ const globalChanged = semanticHubValue(globals(base)) !== semanticHubValue(globals(head));
129
+ const sourceIds = sorted([...changedSources].filter((id) => head.sources.some((s) => s.id === id)).concat(references.map((r) => r.source).filter((id) => head.sources.some((s) => s.id === id))));
130
+ for (const id of sourceIds) {
131
+ if (!changedSources.has(id)) {
132
+ reasons.push({ entity: 'source', id, reason: 'required by selected reference' });
133
+ }
134
+ }
135
+ return { schemaVersion: 1, sources, profiles, sourceIds, profileIds: sorted(selectedProfiles),
136
+ references: references.toSorted((a, b) => semanticHubValue(a).localeCompare(semanticHubValue(b))),
137
+ removedReferences: removedReferences.toSorted((a, b) => semanticHubValue(a).localeCompare(semanticHubValue(b))), reasons, globalChanged,
138
+ noOp: !globalChanged && changedSources.size === 0 && selectedProfiles.size === 0 && profiles.removed.length === 0 };
139
+ }
140
+ /**
141
+ * Project only selected head entities/references; retain global settings verbatim.
142
+ * @param head
143
+ * @param scope
144
+ */
145
+ function selectHubScope(head, scope) {
146
+ return { ...head, sources: head.sources.filter((s) => scope.sourceIds.includes(s.id)), profiles: entities(head, 'profiles').filter((p) => scope.profileIds.includes(p.id)).map((p) => ({ ...p,
147
+ bundles: Array.isArray(p.bundles)
148
+ ? bundles(p).filter((ref) => scope.references.some((r) => r.profileId === p.id && r.source === String(ref.source) && r.id === String(ref.id) && r.version === String(ref.version)))
149
+ : p.bundles
150
+ })) };
151
+ }
152
+ /**
153
+ * Validators see the projected (scoped) document, so their messages carry its indexes.
154
+ * Map every source, profile and bundle index back to the real hub configuration.
155
+ * @param projected The document the validator saw.
156
+ * @param head The full head hub configuration.
157
+ */
158
+ function hubScopeLocationMapper(projected, head) {
159
+ const sourceIndex = (index) => {
160
+ const id = projected.sources[index]?.id;
161
+ const found = head.sources.findIndex((source) => source.id === id);
162
+ return found === -1 ? undefined : found;
163
+ };
164
+ const profileIndex = (index) => {
165
+ const id = entities(projected, 'profiles')[index]?.id;
166
+ const found = entities(head, 'profiles').findIndex((profile) => profile.id === id);
167
+ return found === -1 ? undefined : found;
168
+ };
169
+ const bundleIndex = (projectedProfile, index) => {
170
+ const profile = entities(projected, 'profiles')[projectedProfile];
171
+ const original = entities(head, 'profiles').find((candidate) => candidate.id === profile?.id);
172
+ const bundle = profile ? bundles(profile)[index] : undefined;
173
+ if (!original || bundle === undefined) {
174
+ return undefined;
175
+ }
176
+ const key = referenceKey(bundle);
177
+ const found = bundles(original).findIndex((candidate) => candidate === bundle || referenceKey(candidate) === key);
178
+ return found === -1 ? undefined : found;
179
+ };
180
+ const or = (mapped, fallback) => mapped === undefined ? fallback : String(mapped);
181
+ return (message) => message
182
+ .replaceAll(/\/profiles\/(\d+)\/bundles\/(\d+)/g, (match, p, b) => {
183
+ const profile = profileIndex(Number(p));
184
+ const bundle = bundleIndex(Number(p), Number(b));
185
+ return profile === undefined || bundle === undefined ? match : `/profiles/${profile}/bundles/${bundle}`;
186
+ })
187
+ .replaceAll(/profile\[(\d+)\]\.bundle\[(\d+)\]/g, (match, p, b) => {
188
+ const profile = profileIndex(Number(p));
189
+ const bundle = bundleIndex(Number(p), Number(b));
190
+ return profile === undefined || bundle === undefined ? match : `profile[${profile}].bundle[${bundle}]`;
191
+ })
192
+ .replaceAll(/\/profiles\/(\d+)(?!\d|\/bundles\/\d)/g, (match, p) => `/profiles/${or(profileIndex(Number(p)), p)}`)
193
+ .replaceAll(/profile\[(\d+)\](?!\.bundle\[)/g, (match, p) => `profile[${or(profileIndex(Number(p)), p)}]`)
194
+ .replaceAll(/\/sources\/(\d+)/g, (match, s) => `/sources/${or(sourceIndex(Number(s)), s)}`)
195
+ .replaceAll(/source\[(\d+)\]/g, (match, s) => `source[${or(sourceIndex(Number(s)), s)}]`)
196
+ .replaceAll(/Profile '([^']+)' bundle #(\d+)/g, (match, id, n) => {
197
+ const position = entities(projected, 'profiles').findIndex((profile) => profile.id === id);
198
+ const bundle = position === -1 ? undefined : bundleIndex(position, Number(n) - 1);
199
+ return bundle === undefined ? match : `Profile '${id}' bundle #${bundle + 1}`;
200
+ });
201
+ }
202
+ //# sourceMappingURL=hub-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-scope.js","sourceRoot":"","sources":["../../../src/domain/governance/hub-scope.ts"],"names":[],"mappings":";;AA6BA,4CAQC;AAMD,wDA+BC;AAeD,0CAsEC;AAOD,wCAOC;AAQD,wDA2CC;AAvMD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACxE,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,C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CAAC;IAChF,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { GovernanceCollection, HubCollectionInventory } from '../../ports';
2
+ import { type HubScope, type HubScopeDocument } from './hub-scope';
3
+ /**
4
+ * Full enabled collection inventories are context, not an audit of other source types.
5
+ * @param head
6
+ * @param scope
7
+ */
8
+ export declare function hubScopeInventoryDocument(head: HubScopeDocument, scope: HubScope): HubScopeDocument;
9
+ /**
10
+ * Canonical identities for selected profile references, shared by live and central inventories.
11
+ * @param head
12
+ * @param references
13
+ */
14
+ export declare function hubCollectionReferences(head: HubScopeDocument, references: HubScope['references']): GovernanceCollection[];
15
+ /**
16
+ * Keep competing owners as context only for IDs selected for publication.
17
+ * @param head
18
+ * @param scope
19
+ * @param inventory
20
+ */
21
+ export declare function scopedHubInventory(head: HubScopeDocument, scope: HubScope, inventory: HubCollectionInventory): HubCollectionInventory;
22
+ //# sourceMappingURL=hub-scoped-inventory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-scoped-inventory.d.ts","sourceRoot":"","sources":["../../../src/domain/governance/hub-scoped-inventory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AAKrB;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,GAAG,gBAAgB,CAQnG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,oBAAoB,EAAE,CAY1H;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,sBAAsB,GAAG,sBAAsB,CAerI"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hubScopeInventoryDocument = hubScopeInventoryDocument;
4
+ exports.hubCollectionReferences = hubCollectionReferences;
5
+ exports.scopedHubInventory = scopedHubInventory;
6
+ const hub_scope_1 = require("./hub-scope");
7
+ const collection_1 = require("./rules/collection");
8
+ /**
9
+ * Full enabled collection inventories are context, not an audit of other source types.
10
+ * @param head
11
+ * @param scope
12
+ */
13
+ function hubScopeInventoryDocument(head, scope) {
14
+ const selected = (0, hub_scope_1.selectHubScope)(head, scope);
15
+ const needsCollections = selected.sources.some((source) => source.enabled === true
16
+ && ['github', 'awesome-copilot', 'local-awesome-copilot'].includes(String(source.type)));
17
+ return { ...selected, sources: needsCollections
18
+ ? head.sources.filter((source) => source.enabled === true && ['github', 'awesome-copilot', 'local-awesome-copilot'].includes(String(source.type)))
19
+ : [] };
20
+ }
21
+ /**
22
+ * Canonical identities for selected profile references, shared by live and central inventories.
23
+ * @param head
24
+ * @param references
25
+ */
26
+ function hubCollectionReferences(head, references) {
27
+ const sources = new Map(head.sources.map((source) => [source.id, source]));
28
+ return references.map((ref) => {
29
+ const source = sources.get(ref.source);
30
+ let id = ref.id;
31
+ if (source?.type === 'github') {
32
+ const repository = typeof source.url === 'string' ? source.url : `https://github.com/${typeof source.repository === 'string' ? source.repository : ''}`;
33
+ const slug = repository.replace(/^https?:\/\/[^/]+\//, '').replace(/\.git$/, '').replace(/\/$/, '');
34
+ id = (0, collection_1.canonicalHubCollectionId)(ref.id, slug);
35
+ }
36
+ return { sourceId: ref.source, id };
37
+ });
38
+ }
39
+ /**
40
+ * Keep competing owners as context only for IDs selected for publication.
41
+ * @param head
42
+ * @param scope
43
+ * @param inventory
44
+ */
45
+ function scopedHubInventory(head, scope, inventory) {
46
+ const changed = new Set([...scope.sources.added, ...scope.sources.modified,
47
+ ...scope.reasons.filter((r) => r.entity === 'source' && r.reason === 'explicit selection').map((r) => r.id)]);
48
+ const references = hubCollectionReferences(head, scope.references);
49
+ const candidates = (inventory.releaseCandidates ?? inventory.collections).filter((c) => head.sources.some((source) => source.id === c.sourceId && source.enabled === true)
50
+ && (changed.has(c.sourceId) || references.some((r) => r.sourceId === c.sourceId && r.id === c.id)));
51
+ const relevantIds = new Set(candidates.map((c) => c.id));
52
+ // An ID alone does not attribute a collision: at least one selected owner
53
+ // must actually occur in the head inventory. Missing publication is separate.
54
+ const collisionIds = new Set(inventory.collections.filter((c) => candidates.some((candidate) => candidate.sourceId === c.sourceId && candidate.id === c.id)).map((c) => c.id));
55
+ const needsUniqueness = relevantIds.size > 0 || head.sources.some((s) => changed.has(s.id) && s.enabled && ['github', 'awesome-copilot'].includes(String(s.type)));
56
+ return { collections: inventory.collections.filter((c) => collisionIds.has(c.id)), releaseCandidates: candidates,
57
+ unverifiedSources: needsUniqueness ? inventory.unverifiedSources : [] };
58
+ }
59
+ //# sourceMappingURL=hub-scoped-inventory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-scoped-inventory.js","sourceRoot":"","sources":["../../../src/domain/governance/hub-scoped-inventory.ts"],"names":[],"mappings":";;AAkBA,8DAQC;AAOD,0DAYC;AAQD,gDAeC;AAhED,2CAIqB;AACrB,mDAE4B;AAE5B;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,IAAsB,EAAE,KAAe;IAC/E,MAAM,QAAQ,GAAG,IAAA,0BAAc,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI;WAC7E,CAAC,QAAQ,EAAE,iBAAiB,EAAE,uBAAuB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,gB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CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,0EAA0E;IAC1E,8EAA8E;IAC9E,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAC7F,SAAS,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,IAAI,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnK,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,EAAE,UAAU;QAC9G,iBAAiB,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Governance domain: rule registry, rules, policy and verdict. Pure: no IO.
3
+ * @module domain/governance
4
+ */
5
+ export * from './types';
6
+ export * from './rule-registry';
7
+ export * from './rules/config';
8
+ export * from './rules/collection';
9
+ export * from './rules/hub';
10
+ export * from './effective-rules';
11
+ export * from './evaluate';
12
+ export * from './catalogue';
13
+ export * from './hub-scope';
14
+ export * from './hub-scoped-inventory';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/governance/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Governance domain: rule registry, rules, policy and verdict. Pure: no IO.
19
+ * @module domain/governance
20
+ */
21
+ __exportStar(require("./types"), exports);
22
+ __exportStar(require("./rule-registry"), exports);
23
+ __exportStar(require("./rules/config"), exports);
24
+ __exportStar(require("./rules/collection"), exports);
25
+ __exportStar(require("./rules/hub"), exports);
26
+ __exportStar(require("./effective-rules"), exports);
27
+ __exportStar(require("./evaluate"), exports);
28
+ __exportStar(require("./catalogue"), exports);
29
+ __exportStar(require("./hub-scope"), exports);
30
+ __exportStar(require("./hub-scoped-inventory"), exports);
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/governance/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,0CAAwB;AACxB,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC;AACnC,8CAA4B;AAC5B,oDAAkC;AAClC,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,yDAAuC"}
@@ -0,0 +1,20 @@
1
+ import type { GovernanceRule, GovernanceSubject } from './types';
2
+ export declare const GOVERNANCE_RULES: readonly GovernanceRule[];
3
+ /**
4
+ * Look up a rule by id.
5
+ * @param id Rule id, for example HUB001.
6
+ */
7
+ export declare function getGovernanceRule(id: string): GovernanceRule | undefined;
8
+ /**
9
+ * Rules that apply to one subject.
10
+ * @param subject
11
+ */
12
+ export declare function rulesForSubject(subject: GovernanceSubject): GovernanceRule[];
13
+ /** Configurable floor rules: policy can neither disable nor downgrade them. */
14
+ export declare const FLOOR_RULE_IDS: readonly string[];
15
+ /**
16
+ * True when a rule id belongs to the floor.
17
+ * @param ruleId
18
+ */
19
+ export declare function isFloorRule(ruleId: string): boolean;
20
+ //# sourceMappingURL=rule-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-registry.d.ts","sourceRoot":"","sources":["../../../src/domain/governance/rule-registry.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAER,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAExE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAE5E;AAED,+EAA+E;AAC/E,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAAqG,CAAC;AAElJ;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FLOOR_RULE_IDS = exports.GOVERNANCE_RULES = void 0;
4
+ exports.getGovernanceRule = getGovernanceRule;
5
+ exports.rulesForSubject = rulesForSubject;
6
+ exports.isFloorRule = isFloorRule;
7
+ /**
8
+ * The governance rule registry: every rule id, its subjects, default severity and flags.
9
+ * @module domain/governance/rule-registry
10
+ */
11
+ const collection_1 = require("./rules/collection");
12
+ const config_1 = require("./rules/config");
13
+ const hub_1 = require("./rules/hub");
14
+ exports.GOVERNANCE_RULES = [
15
+ ...collection_1.COLLECTION_RULES, ...hub_1.HUB_RULES, ...config_1.CONFIG_RULES
16
+ ].toSorted((a, b) => a.id.localeCompare(b.id));
17
+ /**
18
+ * Look up a rule by id.
19
+ * @param id Rule id, for example HUB001.
20
+ */
21
+ function getGovernanceRule(id) {
22
+ return exports.GOVERNANCE_RULES.find((rule) => rule.id === id);
23
+ }
24
+ /**
25
+ * Rules that apply to one subject.
26
+ * @param subject
27
+ */
28
+ function rulesForSubject(subject) {
29
+ return exports.GOVERNANCE_RULES.filter((rule) => rule.subjects.includes(subject));
30
+ }
31
+ /** Configurable floor rules: policy can neither disable nor downgrade them. */
32
+ exports.FLOOR_RULE_IDS = exports.GOVERNANCE_RULES.filter((rule) => !rule.disableable && rule.configurable).map((rule) => rule.id);
33
+ /**
34
+ * True when a rule id belongs to the floor.
35
+ * @param ruleId
36
+ */
37
+ function isFloorRule(ruleId) {
38
+ return exports.FLOOR_RULE_IDS.includes(ruleId);
39
+ }
40
+ //# sourceMappingURL=rule-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-registry.js","sourceRoot":"","sources":["../../../src/domain/governance/rule-registry.ts"],"names":[],"mappings":";;;AA0BA,8CAEC;AAMD,0CAEC;AASD,kCAEC;AA/CD;;;GAGG;AACH,mDAE4B;AAC5B,2CAEwB;AACxB,qCAEqB;AAMR,QAAA,gBAAgB,GAA8B;IACzD,GAAG,6BAAgB,EAAE,GAAG,eAAS,EAAE,GAAG,qBAAY;CACnD,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/C;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACzD,CAAC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,OAA0B;IACxD,OAAO,wBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,+EAA+E;AAClE,QAAA,cAAc,GAAsB,wBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAElJ;;;GAGG;AACH,SAAgB,WAAW,CAAC,MAAc;IACxC,OAAO,sBAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Collection rules COL001-COL006. Pure: adapters supply release and inventory evidence.
3
+ * @module domain/governance/rules/collection
4
+ */
5
+ import type { GovernanceCollection, HubCollectionInventory, ReleaseLookupResult } from '../../../ports';
6
+ import type { AllCollectionsResult } from '../../collection/types';
7
+ import type { GovernanceFinding, GovernanceRule } from '../types';
8
+ export declare const COLLECTION_RULES: readonly GovernanceRule[];
9
+ /**
10
+ * Adapt existing collection validator results without duplicating structural validation.
11
+ * @param result Output of the established repository-wide collection validator.
12
+ */
13
+ export declare function collectionGovernanceFindings(result: AllCollectionsResult): GovernanceFinding[];
14
+ /**
15
+ * Remove only a known repository prefix and the established GitHub version suffix.
16
+ * @param bundleId Runtime bundle id or canonical collection id.
17
+ * @param repositorySlug `owner/repo` of the GitHub source.
18
+ */
19
+ export declare function canonicalHubCollectionId(bundleId: string, repositorySlug: string): string;
20
+ /**
21
+ * Translate release evidence (COL002) while preserving unknown-data provenance.
22
+ * @param collection Canonical collection identity.
23
+ * @param result Release lookup evidence.
24
+ */
25
+ export declare function releaseFindings(collection: GovernanceCollection, result: ReleaseLookupResult): GovernanceFinding[];
26
+ /**
27
+ * Detect collisions across source identities (COL004) and report incomplete inventories.
28
+ * @param inventory Canonical hub-wide collection inventory.
29
+ * @param candidates
30
+ */
31
+ export declare function hubCollectionFindings(inventory: HubCollectionInventory, candidates?: readonly GovernanceCollection[]): GovernanceFinding[];
32
+ //# sourceMappingURL=collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../../src/domain/governance/rules/collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EACV,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAarD,CAAC;AAuBF;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,EAAE,CAgB9F;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAIzF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,GAAG,iBAAiB,EAAE,CAmBlH;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,EAAE,UAAU,GAAE,SAAS,oBAAoB,EAAO,GAAG,iBAAiB,EAAE,CA+C9I"}