@evolith/core-domain 1.0.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 (532) hide show
  1. package/dist/application/agents/agent-ruleset-builder.d.ts +30 -0
  2. package/dist/application/agents/agent-ruleset-builder.js +75 -0
  3. package/dist/application/agents/agent-ruleset-builder.js.map +1 -0
  4. package/dist/application/agents/agent-ruleset-builder.spec.d.ts +1 -0
  5. package/dist/application/agents/agent-ruleset-builder.spec.js +135 -0
  6. package/dist/application/agents/agent-ruleset-builder.spec.js.map +1 -0
  7. package/dist/application/architecture/workspace-manager.strategy.d.ts +8 -0
  8. package/dist/application/architecture/workspace-manager.strategy.js +3 -0
  9. package/dist/application/architecture/workspace-manager.strategy.js.map +1 -0
  10. package/dist/application/generators/hexagonal-scaffolder.d.ts +6 -0
  11. package/dist/application/generators/hexagonal-scaffolder.js +259 -0
  12. package/dist/application/generators/hexagonal-scaffolder.js.map +1 -0
  13. package/dist/application/generators/hexagonal-scaffolder.spec.d.ts +1 -0
  14. package/dist/application/generators/hexagonal-scaffolder.spec.js +166 -0
  15. package/dist/application/generators/hexagonal-scaffolder.spec.js.map +1 -0
  16. package/dist/application/generators/mermaid-class-parser.d.ts +38 -0
  17. package/dist/application/generators/mermaid-class-parser.js +183 -0
  18. package/dist/application/generators/mermaid-class-parser.js.map +1 -0
  19. package/dist/application/generators/mermaid-class-parser.spec.d.ts +1 -0
  20. package/dist/application/generators/mermaid-class-parser.spec.js +148 -0
  21. package/dist/application/generators/mermaid-class-parser.spec.js.map +1 -0
  22. package/dist/application/index.d.ts +9 -0
  23. package/dist/application/index.js +26 -0
  24. package/dist/application/index.js.map +1 -0
  25. package/dist/application/ports/blueprint-repository.port.d.ts +6 -0
  26. package/dist/application/ports/blueprint-repository.port.js +3 -0
  27. package/dist/application/ports/blueprint-repository.port.js.map +1 -0
  28. package/dist/application/ports/event-bus.port.d.ts +5 -0
  29. package/dist/application/ports/event-bus.port.js +3 -0
  30. package/dist/application/ports/event-bus.port.js.map +1 -0
  31. package/dist/application/ports/index.d.ts +5 -0
  32. package/dist/application/ports/index.js +22 -0
  33. package/dist/application/ports/index.js.map +1 -0
  34. package/dist/application/ports/platform-detection.port.d.ts +9 -0
  35. package/dist/application/ports/platform-detection.port.js +3 -0
  36. package/dist/application/ports/platform-detection.port.js.map +1 -0
  37. package/dist/application/ports/webhook-notifier.port.d.ts +3 -0
  38. package/dist/application/ports/webhook-notifier.port.js +3 -0
  39. package/dist/application/ports/webhook-notifier.port.js.map +1 -0
  40. package/dist/application/ports/webhook-subscription.port.d.ts +13 -0
  41. package/dist/application/ports/webhook-subscription.port.js +3 -0
  42. package/dist/application/ports/webhook-subscription.port.js.map +1 -0
  43. package/dist/application/services/audit.service.d.ts +12 -0
  44. package/dist/application/services/audit.service.js +36 -0
  45. package/dist/application/services/audit.service.js.map +1 -0
  46. package/dist/application/services/catalog.service.d.ts +10 -0
  47. package/dist/application/services/catalog.service.js +84 -0
  48. package/dist/application/services/catalog.service.js.map +1 -0
  49. package/dist/application/services/evolith-config.service.d.ts +25 -0
  50. package/dist/application/services/evolith-config.service.js +120 -0
  51. package/dist/application/services/evolith-config.service.js.map +1 -0
  52. package/dist/application/services/gate-registry.service.d.ts +34 -0
  53. package/dist/application/services/gate-registry.service.js +104 -0
  54. package/dist/application/services/gate-registry.service.js.map +1 -0
  55. package/dist/application/services/index.d.ts +41 -0
  56. package/dist/application/services/index.js +25 -0
  57. package/dist/application/services/index.js.map +1 -0
  58. package/dist/application/services/initialize-project.spec.d.ts +5 -0
  59. package/dist/application/services/initialize-project.spec.js +228 -0
  60. package/dist/application/services/initialize-project.spec.js.map +1 -0
  61. package/dist/application/services/phase-transition.use-case.spec.d.ts +1 -0
  62. package/dist/application/services/phase-transition.use-case.spec.js +303 -0
  63. package/dist/application/services/phase-transition.use-case.spec.js.map +1 -0
  64. package/dist/application/services/project-scaffolder.service.d.ts +19 -0
  65. package/dist/application/services/project-scaffolder.service.js +194 -0
  66. package/dist/application/services/project-scaffolder.service.js.map +1 -0
  67. package/dist/application/services/satellite-evaluation-pipeline.service.d.ts +18 -0
  68. package/dist/application/services/satellite-evaluation-pipeline.service.js +206 -0
  69. package/dist/application/services/satellite-evaluation-pipeline.service.js.map +1 -0
  70. package/dist/application/services/sdlc-data-loader.service.d.ts +39 -0
  71. package/dist/application/services/sdlc-data-loader.service.js +112 -0
  72. package/dist/application/services/sdlc-data-loader.service.js.map +1 -0
  73. package/dist/application/services/services/command-executor.service.d.ts +3 -0
  74. package/dist/application/services/services/command-executor.service.js +13 -0
  75. package/dist/application/services/services/command-executor.service.js.map +1 -0
  76. package/dist/application/services/services/command-history.service.d.ts +39 -0
  77. package/dist/application/services/services/command-history.service.js +150 -0
  78. package/dist/application/services/services/command-history.service.js.map +1 -0
  79. package/dist/application/services/services/command-history.service.spec.d.ts +1 -0
  80. package/dist/application/services/services/command-history.service.spec.js +266 -0
  81. package/dist/application/services/services/command-history.service.spec.js.map +1 -0
  82. package/dist/application/services/services/command-providers.d.ts +1 -0
  83. package/dist/application/services/services/command-providers.js +17 -0
  84. package/dist/application/services/services/command-providers.js.map +1 -0
  85. package/dist/application/services/topology-catalog.service.d.ts +58 -0
  86. package/dist/application/services/topology-catalog.service.js +85 -0
  87. package/dist/application/services/topology-catalog.service.js.map +1 -0
  88. package/dist/application/sync/sync.service.d.ts +9 -0
  89. package/dist/application/sync/sync.service.js +88 -0
  90. package/dist/application/sync/sync.service.js.map +1 -0
  91. package/dist/application/sync/sync.service.spec.d.ts +1 -0
  92. package/dist/application/sync/sync.service.spec.js +76 -0
  93. package/dist/application/sync/sync.service.spec.js.map +1 -0
  94. package/dist/application/upgrade/satellite-upgrade-apply.d.ts +5 -0
  95. package/dist/application/upgrade/satellite-upgrade-apply.js +102 -0
  96. package/dist/application/upgrade/satellite-upgrade-apply.js.map +1 -0
  97. package/dist/application/upgrade/satellite-upgrade-diff.d.ts +6 -0
  98. package/dist/application/upgrade/satellite-upgrade-diff.js +130 -0
  99. package/dist/application/upgrade/satellite-upgrade-diff.js.map +1 -0
  100. package/dist/application/upgrade/satellite-upgrade-fs.d.ts +4 -0
  101. package/dist/application/upgrade/satellite-upgrade-fs.js +97 -0
  102. package/dist/application/upgrade/satellite-upgrade-fs.js.map +1 -0
  103. package/dist/application/upgrade/satellite-upgrade.service.d.ts +14 -0
  104. package/dist/application/upgrade/satellite-upgrade.service.js +78 -0
  105. package/dist/application/upgrade/satellite-upgrade.service.js.map +1 -0
  106. package/dist/application/upgrade/satellite-upgrade.service.spec.d.ts +1 -0
  107. package/dist/application/upgrade/satellite-upgrade.service.spec.js +231 -0
  108. package/dist/application/upgrade/satellite-upgrade.service.spec.js.map +1 -0
  109. package/dist/application/upgrade/satellite-upgrade.types.d.ts +31 -0
  110. package/dist/application/upgrade/satellite-upgrade.types.js +3 -0
  111. package/dist/application/upgrade/satellite-upgrade.types.js.map +1 -0
  112. package/dist/application/use-cases/evaluate-gate.use-case.d.ts +25 -0
  113. package/dist/application/use-cases/evaluate-gate.use-case.js +124 -0
  114. package/dist/application/use-cases/evaluate-gate.use-case.js.map +1 -0
  115. package/dist/application/use-cases/evaluate-gate.use-case.spec.d.ts +1 -0
  116. package/dist/application/use-cases/evaluate-gate.use-case.spec.js +112 -0
  117. package/dist/application/use-cases/evaluate-gate.use-case.spec.js.map +1 -0
  118. package/dist/application/use-cases/index.d.ts +7 -0
  119. package/dist/application/use-cases/index.js +24 -0
  120. package/dist/application/use-cases/index.js.map +1 -0
  121. package/dist/application/use-cases/initialize-project.use-case.d.ts +10 -0
  122. package/dist/application/use-cases/initialize-project.use-case.js +71 -0
  123. package/dist/application/use-cases/initialize-project.use-case.js.map +1 -0
  124. package/dist/application/use-cases/phase-transition.use-case.d.ts +22 -0
  125. package/dist/application/use-cases/phase-transition.use-case.js +100 -0
  126. package/dist/application/use-cases/phase-transition.use-case.js.map +1 -0
  127. package/dist/application/use-cases/propose-phase-advance.use-case.d.ts +15 -0
  128. package/dist/application/use-cases/propose-phase-advance.use-case.js +42 -0
  129. package/dist/application/use-cases/propose-phase-advance.use-case.js.map +1 -0
  130. package/dist/application/use-cases/propose-phase-advance.use-case.spec.d.ts +1 -0
  131. package/dist/application/use-cases/propose-phase-advance.use-case.spec.js +64 -0
  132. package/dist/application/use-cases/propose-phase-advance.use-case.spec.js.map +1 -0
  133. package/dist/application/use-cases/validate-blueprint.use-case.d.ts +32 -0
  134. package/dist/application/use-cases/validate-blueprint.use-case.js +179 -0
  135. package/dist/application/use-cases/validate-blueprint.use-case.js.map +1 -0
  136. package/dist/application/use-cases/validate-satellite.use-case.d.ts +25 -0
  137. package/dist/application/use-cases/validate-satellite.use-case.js +192 -0
  138. package/dist/application/use-cases/validate-satellite.use-case.js.map +1 -0
  139. package/dist/application/use-cases/validate-satellite.use-case.spec.d.ts +1 -0
  140. package/dist/application/use-cases/validate-satellite.use-case.spec.js +102 -0
  141. package/dist/application/use-cases/validate-satellite.use-case.spec.js.map +1 -0
  142. package/dist/application/use-cases/validate-workflow.use-case.d.ts +11 -0
  143. package/dist/application/use-cases/validate-workflow.use-case.js +121 -0
  144. package/dist/application/use-cases/validate-workflow.use-case.js.map +1 -0
  145. package/dist/application/validators/architecture/detectors.d.ts +7 -0
  146. package/dist/application/validators/architecture/detectors.js +128 -0
  147. package/dist/application/validators/architecture/detectors.js.map +1 -0
  148. package/dist/application/validators/architecture/import-graph.d.ts +5 -0
  149. package/dist/application/validators/architecture/import-graph.js +132 -0
  150. package/dist/application/validators/architecture/import-graph.js.map +1 -0
  151. package/dist/application/validators/architecture/types.d.ts +44 -0
  152. package/dist/application/validators/architecture/types.js +39 -0
  153. package/dist/application/validators/architecture/types.js.map +1 -0
  154. package/dist/application/validators/architecture-drift.service.d.ts +74 -0
  155. package/dist/application/validators/architecture-drift.service.js +268 -0
  156. package/dist/application/validators/architecture-drift.service.js.map +1 -0
  157. package/dist/application/validators/architecture-drift.service.spec.d.ts +1 -0
  158. package/dist/application/validators/architecture-drift.service.spec.js +144 -0
  159. package/dist/application/validators/architecture-drift.service.spec.js.map +1 -0
  160. package/dist/application/validators/architecture-validator.d.ts +14 -0
  161. package/dist/application/validators/architecture-validator.js +125 -0
  162. package/dist/application/validators/architecture-validator.js.map +1 -0
  163. package/dist/application/validators/blocking-criteria-validator.d.ts +29 -0
  164. package/dist/application/validators/blocking-criteria-validator.js +255 -0
  165. package/dist/application/validators/blocking-criteria-validator.js.map +1 -0
  166. package/dist/application/validators/build-vs-compose.schema.spec.d.ts +1 -0
  167. package/dist/application/validators/build-vs-compose.schema.spec.js +143 -0
  168. package/dist/application/validators/build-vs-compose.schema.spec.js.map +1 -0
  169. package/dist/application/validators/deep-architecture-analyzer.d.ts +9 -0
  170. package/dist/application/validators/deep-architecture-analyzer.js +73 -0
  171. package/dist/application/validators/deep-architecture-analyzer.js.map +1 -0
  172. package/dist/application/validators/deep-architecture-analyzer.spec.d.ts +1 -0
  173. package/dist/application/validators/deep-architecture-analyzer.spec.js +186 -0
  174. package/dist/application/validators/deep-architecture-analyzer.spec.js.map +1 -0
  175. package/dist/application/validators/evaluators/architecture-equivalence.spec.d.ts +1 -0
  176. package/dist/application/validators/evaluators/architecture-equivalence.spec.js +58 -0
  177. package/dist/application/validators/evaluators/architecture-equivalence.spec.js.map +1 -0
  178. package/dist/application/validators/evaluators/evaluator.interface.d.ts +14 -0
  179. package/dist/application/validators/evaluators/evaluator.interface.js +3 -0
  180. package/dist/application/validators/evaluators/evaluator.interface.js.map +1 -0
  181. package/dist/application/validators/evaluators/handlers/acl-rule.handler.d.ts +16 -0
  182. package/dist/application/validators/evaluators/handlers/acl-rule.handler.js +139 -0
  183. package/dist/application/validators/evaluators/handlers/acl-rule.handler.js.map +1 -0
  184. package/dist/application/validators/evaluators/handlers/architecture/agent-rules.d.ts +6 -0
  185. package/dist/application/validators/evaluators/handlers/architecture/agent-rules.js +131 -0
  186. package/dist/application/validators/evaluators/handlers/architecture/agent-rules.js.map +1 -0
  187. package/dist/application/validators/evaluators/handlers/architecture/ast-rules.d.ts +6 -0
  188. package/dist/application/validators/evaluators/handlers/architecture/ast-rules.js +151 -0
  189. package/dist/application/validators/evaluators/handlers/architecture/ast-rules.js.map +1 -0
  190. package/dist/application/validators/evaluators/handlers/architecture/config-rules.d.ts +6 -0
  191. package/dist/application/validators/evaluators/handlers/architecture/config-rules.js +60 -0
  192. package/dist/application/validators/evaluators/handlers/architecture/config-rules.js.map +1 -0
  193. package/dist/application/validators/evaluators/handlers/architecture/shared.d.ts +14 -0
  194. package/dist/application/validators/evaluators/handlers/architecture/shared.js +91 -0
  195. package/dist/application/validators/evaluators/handlers/architecture/shared.js.map +1 -0
  196. package/dist/application/validators/evaluators/handlers/architecture/structural-rules.d.ts +6 -0
  197. package/dist/application/validators/evaluators/handlers/architecture/structural-rules.js +208 -0
  198. package/dist/application/validators/evaluators/handlers/architecture/structural-rules.js.map +1 -0
  199. package/dist/application/validators/evaluators/handlers/architecture-rule.handler.d.ts +11 -0
  200. package/dist/application/validators/evaluators/handlers/architecture-rule.handler.js +39 -0
  201. package/dist/application/validators/evaluators/handlers/architecture-rule.handler.js.map +1 -0
  202. package/dist/application/validators/evaluators/handlers/architecture-rule.handler.spec.d.ts +1 -0
  203. package/dist/application/validators/evaluators/handlers/architecture-rule.handler.spec.js +212 -0
  204. package/dist/application/validators/evaluators/handlers/architecture-rule.handler.spec.js.map +1 -0
  205. package/dist/application/validators/evaluators/handlers/cli-release-rule.handler.d.ts +17 -0
  206. package/dist/application/validators/evaluators/handlers/cli-release-rule.handler.js +133 -0
  207. package/dist/application/validators/evaluators/handlers/cli-release-rule.handler.js.map +1 -0
  208. package/dist/application/validators/evaluators/handlers/cli-release-rule.handler.spec.d.ts +1 -0
  209. package/dist/application/validators/evaluators/handlers/cli-release-rule.handler.spec.js +89 -0
  210. package/dist/application/validators/evaluators/handlers/cli-release-rule.handler.spec.js.map +1 -0
  211. package/dist/application/validators/evaluators/handlers/cross-cutting-rule.handler.d.ts +25 -0
  212. package/dist/application/validators/evaluators/handlers/cross-cutting-rule.handler.js +244 -0
  213. package/dist/application/validators/evaluators/handlers/cross-cutting-rule.handler.js.map +1 -0
  214. package/dist/application/validators/evaluators/handlers/dependency-rule.handler.d.ts +17 -0
  215. package/dist/application/validators/evaluators/handlers/dependency-rule.handler.js +163 -0
  216. package/dist/application/validators/evaluators/handlers/dependency-rule.handler.js.map +1 -0
  217. package/dist/application/validators/evaluators/handlers/dependency-rule.handler.spec.d.ts +1 -0
  218. package/dist/application/validators/evaluators/handlers/dependency-rule.handler.spec.js +115 -0
  219. package/dist/application/validators/evaluators/handlers/dependency-rule.handler.spec.js.map +1 -0
  220. package/dist/application/validators/evaluators/handlers/evidence-rule.handler.d.ts +10 -0
  221. package/dist/application/validators/evaluators/handlers/evidence-rule.handler.js +102 -0
  222. package/dist/application/validators/evaluators/handlers/evidence-rule.handler.js.map +1 -0
  223. package/dist/application/validators/evaluators/handlers/evidence-rule.handler.spec.d.ts +1 -0
  224. package/dist/application/validators/evaluators/handlers/evidence-rule.handler.spec.js +94 -0
  225. package/dist/application/validators/evaluators/handlers/evidence-rule.handler.spec.js.map +1 -0
  226. package/dist/application/validators/evaluators/handlers/executive-scorecard-rule.handler.d.ts +15 -0
  227. package/dist/application/validators/evaluators/handlers/executive-scorecard-rule.handler.js +126 -0
  228. package/dist/application/validators/evaluators/handlers/executive-scorecard-rule.handler.js.map +1 -0
  229. package/dist/application/validators/evaluators/handlers/governance-rule.handler.d.ts +11 -0
  230. package/dist/application/validators/evaluators/handlers/governance-rule.handler.js +120 -0
  231. package/dist/application/validators/evaluators/handlers/governance-rule.handler.js.map +1 -0
  232. package/dist/application/validators/evaluators/handlers/governance-rule.handler.spec.d.ts +1 -0
  233. package/dist/application/validators/evaluators/handlers/governance-rule.handler.spec.js +107 -0
  234. package/dist/application/validators/evaluators/handlers/governance-rule.handler.spec.js.map +1 -0
  235. package/dist/application/validators/evaluators/handlers/mcp-rule.handler.d.ts +12 -0
  236. package/dist/application/validators/evaluators/handlers/mcp-rule.handler.js +91 -0
  237. package/dist/application/validators/evaluators/handlers/mcp-rule.handler.js.map +1 -0
  238. package/dist/application/validators/evaluators/handlers/mcp-rule.handler.spec.d.ts +1 -0
  239. package/dist/application/validators/evaluators/handlers/mcp-rule.handler.spec.js +92 -0
  240. package/dist/application/validators/evaluators/handlers/mcp-rule.handler.spec.js.map +1 -0
  241. package/dist/application/validators/evaluators/handlers/rule-handler.interface.d.ts +6 -0
  242. package/dist/application/validators/evaluators/handlers/rule-handler.interface.js +3 -0
  243. package/dist/application/validators/evaluators/handlers/rule-handler.interface.js.map +1 -0
  244. package/dist/application/validators/evaluators/handlers/satellite-contract-rule.handler.d.ts +14 -0
  245. package/dist/application/validators/evaluators/handlers/satellite-contract-rule.handler.js +105 -0
  246. package/dist/application/validators/evaluators/handlers/satellite-contract-rule.handler.js.map +1 -0
  247. package/dist/application/validators/evaluators/handlers/sdlc-rule.handler.d.ts +12 -0
  248. package/dist/application/validators/evaluators/handlers/sdlc-rule.handler.js +81 -0
  249. package/dist/application/validators/evaluators/handlers/sdlc-rule.handler.js.map +1 -0
  250. package/dist/application/validators/evaluators/handlers/taxonomy-rule.handler.d.ts +13 -0
  251. package/dist/application/validators/evaluators/handlers/taxonomy-rule.handler.js +136 -0
  252. package/dist/application/validators/evaluators/handlers/taxonomy-rule.handler.js.map +1 -0
  253. package/dist/application/validators/evaluators/handlers/taxonomy-rule.handler.spec.d.ts +1 -0
  254. package/dist/application/validators/evaluators/handlers/taxonomy-rule.handler.spec.js +96 -0
  255. package/dist/application/validators/evaluators/handlers/taxonomy-rule.handler.spec.js.map +1 -0
  256. package/dist/application/validators/evaluators/native-evaluator.d.ts +12 -0
  257. package/dist/application/validators/evaluators/native-evaluator.js +63 -0
  258. package/dist/application/validators/evaluators/native-evaluator.js.map +1 -0
  259. package/dist/application/validators/evaluators/opa-evaluator.d.ts +14 -0
  260. package/dist/application/validators/evaluators/opa-evaluator.js +151 -0
  261. package/dist/application/validators/evaluators/opa-evaluator.js.map +1 -0
  262. package/dist/application/validators/evaluators/opa-evaluator.spec.d.ts +1 -0
  263. package/dist/application/validators/evaluators/opa-evaluator.spec.js +96 -0
  264. package/dist/application/validators/evaluators/opa-evaluator.spec.js.map +1 -0
  265. package/dist/application/validators/evaluators/opa-input-builder.d.ts +27 -0
  266. package/dist/application/validators/evaluators/opa-input-builder.js +357 -0
  267. package/dist/application/validators/evaluators/opa-input-builder.js.map +1 -0
  268. package/dist/application/validators/evaluators/opa-input-builder.spec.d.ts +1 -0
  269. package/dist/application/validators/evaluators/opa-input-builder.spec.js +138 -0
  270. package/dist/application/validators/evaluators/opa-input-builder.spec.js.map +1 -0
  271. package/dist/application/validators/evidence-validator.d.ts +13 -0
  272. package/dist/application/validators/evidence-validator.js +195 -0
  273. package/dist/application/validators/evidence-validator.js.map +1 -0
  274. package/dist/application/validators/index.d.ts +4 -0
  275. package/dist/application/validators/index.js +21 -0
  276. package/dist/application/validators/index.js.map +1 -0
  277. package/dist/application/validators/modes/adhoc-validation.mode.d.ts +8 -0
  278. package/dist/application/validators/modes/adhoc-validation.mode.js +156 -0
  279. package/dist/application/validators/modes/adhoc-validation.mode.js.map +1 -0
  280. package/dist/application/validators/modes/adr-validation.mode.d.ts +7 -0
  281. package/dist/application/validators/modes/adr-validation.mode.js +183 -0
  282. package/dist/application/validators/modes/adr-validation.mode.js.map +1 -0
  283. package/dist/application/validators/modes/architecture-validation.mode.d.ts +7 -0
  284. package/dist/application/validators/modes/architecture-validation.mode.js +154 -0
  285. package/dist/application/validators/modes/architecture-validation.mode.js.map +1 -0
  286. package/dist/application/validators/modes/composable-validation-engine.d.ts +20 -0
  287. package/dist/application/validators/modes/composable-validation-engine.js +110 -0
  288. package/dist/application/validators/modes/composable-validation-engine.js.map +1 -0
  289. package/dist/application/validators/modes/index.d.ts +7 -0
  290. package/dist/application/validators/modes/index.js +16 -0
  291. package/dist/application/validators/modes/index.js.map +1 -0
  292. package/dist/application/validators/modes/ruleset-validation.mode.d.ts +6 -0
  293. package/dist/application/validators/modes/ruleset-validation.mode.js +143 -0
  294. package/dist/application/validators/modes/ruleset-validation.mode.js.map +1 -0
  295. package/dist/application/validators/modes/sdlc-validation.mode.d.ts +7 -0
  296. package/dist/application/validators/modes/sdlc-validation.mode.js +151 -0
  297. package/dist/application/validators/modes/sdlc-validation.mode.js.map +1 -0
  298. package/dist/application/validators/modes/validation-mode.interface.d.ts +34 -0
  299. package/dist/application/validators/modes/validation-mode.interface.js +3 -0
  300. package/dist/application/validators/modes/validation-mode.interface.js.map +1 -0
  301. package/dist/application/validators/phase-gate-validator.service.d.ts +77 -0
  302. package/dist/application/validators/phase-gate-validator.service.js +183 -0
  303. package/dist/application/validators/phase-gate-validator.service.js.map +1 -0
  304. package/dist/application/validators/phase-gate-validator.service.spec.d.ts +1 -0
  305. package/dist/application/validators/phase-gate-validator.service.spec.js +383 -0
  306. package/dist/application/validators/phase-gate-validator.service.spec.js.map +1 -0
  307. package/dist/application/validators/rule-evaluation-engine.d.ts +29 -0
  308. package/dist/application/validators/rule-evaluation-engine.js +41 -0
  309. package/dist/application/validators/rule-evaluation-engine.js.map +1 -0
  310. package/dist/application/validators/ruleset-id-loader.d.ts +3 -0
  311. package/dist/application/validators/ruleset-id-loader.js +109 -0
  312. package/dist/application/validators/ruleset-id-loader.js.map +1 -0
  313. package/dist/application/validators/ruleset-loader.d.ts +13 -0
  314. package/dist/application/validators/ruleset-loader.js +83 -0
  315. package/dist/application/validators/ruleset-loader.js.map +1 -0
  316. package/dist/application/validators/ruleset-validator-architecture.spec.d.ts +1 -0
  317. package/dist/application/validators/ruleset-validator-architecture.spec.js +174 -0
  318. package/dist/application/validators/ruleset-validator-architecture.spec.js.map +1 -0
  319. package/dist/application/validators/ruleset-validator.service.d.ts +18 -0
  320. package/dist/application/validators/ruleset-validator.service.js +154 -0
  321. package/dist/application/validators/ruleset-validator.service.js.map +1 -0
  322. package/dist/application/validators/ruleset-validator.types.d.ts +57 -0
  323. package/dist/application/validators/ruleset-validator.types.js +5 -0
  324. package/dist/application/validators/ruleset-validator.types.js.map +1 -0
  325. package/dist/common/request-context.d.ts +10 -0
  326. package/dist/common/request-context.js +14 -0
  327. package/dist/common/request-context.js.map +1 -0
  328. package/dist/domain/audit/audit-entry.d.ts +19 -0
  329. package/dist/domain/audit/audit-entry.js +3 -0
  330. package/dist/domain/audit/audit-entry.js.map +1 -0
  331. package/dist/domain/audit/audit-repository.port.d.ts +6 -0
  332. package/dist/domain/audit/audit-repository.port.js +3 -0
  333. package/dist/domain/audit/audit-repository.port.js.map +1 -0
  334. package/dist/domain/audit/index.d.ts +2 -0
  335. package/dist/domain/audit/index.js +19 -0
  336. package/dist/domain/audit/index.js.map +1 -0
  337. package/dist/domain/entities/blueprint.d.ts +41 -0
  338. package/dist/domain/entities/blueprint.js +82 -0
  339. package/dist/domain/entities/blueprint.js.map +1 -0
  340. package/dist/domain/entities/index.d.ts +73 -0
  341. package/dist/domain/entities/index.js +134 -0
  342. package/dist/domain/entities/index.js.map +1 -0
  343. package/dist/domain/errors/gate-authorization.error.d.ts +9 -0
  344. package/dist/domain/errors/gate-authorization.error.js +17 -0
  345. package/dist/domain/errors/gate-authorization.error.js.map +1 -0
  346. package/dist/domain/errors/index.d.ts +29 -0
  347. package/dist/domain/errors/index.js +73 -0
  348. package/dist/domain/errors/index.js.map +1 -0
  349. package/dist/domain/events/domain-event.d.ts +9 -0
  350. package/dist/domain/events/domain-event.js +14 -0
  351. package/dist/domain/events/domain-event.js.map +1 -0
  352. package/dist/domain/events/domain-events.d.ts +99 -0
  353. package/dist/domain/events/domain-events.js +49 -0
  354. package/dist/domain/events/domain-events.js.map +1 -0
  355. package/dist/domain/events/event-catalog.d.ts +7 -0
  356. package/dist/domain/events/event-catalog.js +82 -0
  357. package/dist/domain/events/event-catalog.js.map +1 -0
  358. package/dist/domain/events/index.d.ts +4 -0
  359. package/dist/domain/events/index.js +21 -0
  360. package/dist/domain/events/index.js.map +1 -0
  361. package/dist/domain/gate-evidence.d.ts +70 -0
  362. package/dist/domain/gate-evidence.js +46 -0
  363. package/dist/domain/gate-evidence.js.map +1 -0
  364. package/dist/domain/gate-evidence.spec.d.ts +1 -0
  365. package/dist/domain/gate-evidence.spec.js +173 -0
  366. package/dist/domain/gate-evidence.spec.js.map +1 -0
  367. package/dist/domain/index.d.ts +12 -0
  368. package/dist/domain/index.js +29 -0
  369. package/dist/domain/index.js.map +1 -0
  370. package/dist/domain/interfaces.d.ts +301 -0
  371. package/dist/domain/interfaces.js +5 -0
  372. package/dist/domain/interfaces.js.map +1 -0
  373. package/dist/domain/lifecycle/artifact-state-machine.d.ts +23 -0
  374. package/dist/domain/lifecycle/artifact-state-machine.js +50 -0
  375. package/dist/domain/lifecycle/artifact-state-machine.js.map +1 -0
  376. package/dist/domain/lifecycle/index.d.ts +2 -0
  377. package/dist/domain/lifecycle/index.js +19 -0
  378. package/dist/domain/lifecycle/index.js.map +1 -0
  379. package/dist/domain/lifecycle/phase-state-machine.d.ts +24 -0
  380. package/dist/domain/lifecycle/phase-state-machine.js +50 -0
  381. package/dist/domain/lifecycle/phase-state-machine.js.map +1 -0
  382. package/dist/domain/metrics/dora-calculator.d.ts +18 -0
  383. package/dist/domain/metrics/dora-calculator.js +146 -0
  384. package/dist/domain/metrics/dora-calculator.js.map +1 -0
  385. package/dist/domain/metrics/dora-calculator.spec.d.ts +1 -0
  386. package/dist/domain/metrics/dora-calculator.spec.js +172 -0
  387. package/dist/domain/metrics/dora-calculator.spec.js.map +1 -0
  388. package/dist/domain/metrics/git-log-reader.d.ts +14 -0
  389. package/dist/domain/metrics/git-log-reader.js +39 -0
  390. package/dist/domain/metrics/git-log-reader.js.map +1 -0
  391. package/dist/domain/metrics/git-log-reader.spec.d.ts +8 -0
  392. package/dist/domain/metrics/git-log-reader.spec.js +121 -0
  393. package/dist/domain/metrics/git-log-reader.spec.js.map +1 -0
  394. package/dist/domain/metrics/index.d.ts +2 -0
  395. package/dist/domain/metrics/index.js +19 -0
  396. package/dist/domain/metrics/index.js.map +1 -0
  397. package/dist/domain/models/normalized-rule.d.ts +10 -0
  398. package/dist/domain/models/normalized-rule.js +3 -0
  399. package/dist/domain/models/normalized-rule.js.map +1 -0
  400. package/dist/domain/ports/index.d.ts +2 -0
  401. package/dist/domain/ports/index.js +19 -0
  402. package/dist/domain/ports/index.js.map +1 -0
  403. package/dist/domain/ports/ruleset-repository.port.d.ts +4 -0
  404. package/dist/domain/ports/ruleset-repository.port.js +3 -0
  405. package/dist/domain/ports/ruleset-repository.port.js.map +1 -0
  406. package/dist/domain/ports/workflow-definition.port.d.ts +24 -0
  407. package/dist/domain/ports/workflow-definition.port.js +3 -0
  408. package/dist/domain/ports/workflow-definition.port.js.map +1 -0
  409. package/dist/domain/rbac/gate-role-enforcer.d.ts +16 -0
  410. package/dist/domain/rbac/gate-role-enforcer.js +46 -0
  411. package/dist/domain/rbac/gate-role-enforcer.js.map +1 -0
  412. package/dist/domain/rbac/index.d.ts +1 -0
  413. package/dist/domain/rbac/index.js +12 -0
  414. package/dist/domain/rbac/index.js.map +1 -0
  415. package/dist/domain/rbac/role.d.ts +19 -0
  416. package/dist/domain/rbac/role.js +79 -0
  417. package/dist/domain/rbac/role.js.map +1 -0
  418. package/dist/domain/satellite-manifest.d.ts +44 -0
  419. package/dist/domain/satellite-manifest.js +3 -0
  420. package/dist/domain/satellite-manifest.js.map +1 -0
  421. package/dist/domain/services/adr.service.d.ts +50 -0
  422. package/dist/domain/services/adr.service.js +129 -0
  423. package/dist/domain/services/adr.service.js.map +1 -0
  424. package/dist/domain/services/adr.service.spec.d.ts +1 -0
  425. package/dist/domain/services/adr.service.spec.js +141 -0
  426. package/dist/domain/services/adr.service.spec.js.map +1 -0
  427. package/dist/domain/services/default-workflow-definition.d.ts +40 -0
  428. package/dist/domain/services/default-workflow-definition.js +94 -0
  429. package/dist/domain/services/default-workflow-definition.js.map +1 -0
  430. package/dist/domain/services/index.d.ts +37 -0
  431. package/dist/domain/services/index.js +110 -0
  432. package/dist/domain/services/index.js.map +1 -0
  433. package/dist/domain/services/standards.service.d.ts +47 -0
  434. package/dist/domain/services/standards.service.js +129 -0
  435. package/dist/domain/services/standards.service.js.map +1 -0
  436. package/dist/domain/services/standards.service.spec.d.ts +1 -0
  437. package/dist/domain/services/standards.service.spec.js +600 -0
  438. package/dist/domain/services/standards.service.spec.js.map +1 -0
  439. package/dist/domain/verdict/index.d.ts +1 -0
  440. package/dist/domain/verdict/index.js +18 -0
  441. package/dist/domain/verdict/index.js.map +1 -0
  442. package/dist/domain/verdict/verdict.d.ts +22 -0
  443. package/dist/domain/verdict/verdict.js +50 -0
  444. package/dist/domain/verdict/verdict.js.map +1 -0
  445. package/dist/domain/webhook/webhook-subscription.d.ts +27 -0
  446. package/dist/domain/webhook/webhook-subscription.js +9 -0
  447. package/dist/domain/webhook/webhook-subscription.js.map +1 -0
  448. package/dist/domain/workflow/index.d.ts +1 -0
  449. package/dist/domain/workflow/index.js +18 -0
  450. package/dist/domain/workflow/index.js.map +1 -0
  451. package/dist/domain/workflow/workflow-definition.d.ts +33 -0
  452. package/dist/domain/workflow/workflow-definition.js +3 -0
  453. package/dist/domain/workflow/workflow-definition.js.map +1 -0
  454. package/dist/evidence/evidence-graph.d.ts +29 -0
  455. package/dist/evidence/evidence-graph.js +27 -0
  456. package/dist/evidence/evidence-graph.js.map +1 -0
  457. package/dist/evidence/index.d.ts +1 -0
  458. package/dist/evidence/index.js +18 -0
  459. package/dist/evidence/index.js.map +1 -0
  460. package/dist/gates/decision/gate-decision.d.ts +18 -0
  461. package/dist/gates/decision/gate-decision.js +23 -0
  462. package/dist/gates/decision/gate-decision.js.map +1 -0
  463. package/dist/gates/decision/index.d.ts +1 -0
  464. package/dist/gates/decision/index.js +18 -0
  465. package/dist/gates/decision/index.js.map +1 -0
  466. package/dist/gates/gate-evaluator.d.ts +15 -0
  467. package/dist/gates/gate-evaluator.js +37 -0
  468. package/dist/gates/gate-evaluator.js.map +1 -0
  469. package/dist/gates/index.d.ts +1 -0
  470. package/dist/gates/index.js +18 -0
  471. package/dist/gates/index.js.map +1 -0
  472. package/dist/index.d.ts +2 -0
  473. package/dist/index.js +19 -0
  474. package/dist/index.js.map +1 -0
  475. package/dist/infrastructure/audit/in-memory-audit-repository.d.ts +10 -0
  476. package/dist/infrastructure/audit/in-memory-audit-repository.js +44 -0
  477. package/dist/infrastructure/audit/in-memory-audit-repository.js.map +1 -0
  478. package/dist/infrastructure/audit/index.d.ts +2 -0
  479. package/dist/infrastructure/audit/index.js +19 -0
  480. package/dist/infrastructure/audit/index.js.map +1 -0
  481. package/dist/infrastructure/audit/jsonl-audit-repository.d.ts +12 -0
  482. package/dist/infrastructure/audit/jsonl-audit-repository.js +103 -0
  483. package/dist/infrastructure/audit/jsonl-audit-repository.js.map +1 -0
  484. package/dist/infrastructure/events/in-memory-event-bus.d.ts +9 -0
  485. package/dist/infrastructure/events/in-memory-event-bus.js +25 -0
  486. package/dist/infrastructure/events/in-memory-event-bus.js.map +1 -0
  487. package/dist/infrastructure/events/index.d.ts +4 -0
  488. package/dist/infrastructure/events/index.js +21 -0
  489. package/dist/infrastructure/events/index.js.map +1 -0
  490. package/dist/infrastructure/events/outbox.d.ts +27 -0
  491. package/dist/infrastructure/events/outbox.js +43 -0
  492. package/dist/infrastructure/events/outbox.js.map +1 -0
  493. package/dist/infrastructure/webhook/hmac-signer.d.ts +6 -0
  494. package/dist/infrastructure/webhook/hmac-signer.js +25 -0
  495. package/dist/infrastructure/webhook/hmac-signer.js.map +1 -0
  496. package/dist/infrastructure/webhook/in-memory-delivery-repository.d.ts +10 -0
  497. package/dist/infrastructure/webhook/in-memory-delivery-repository.js +25 -0
  498. package/dist/infrastructure/webhook/in-memory-delivery-repository.js.map +1 -0
  499. package/dist/infrastructure/webhook/in-memory-subscription-repository.d.ts +11 -0
  500. package/dist/infrastructure/webhook/in-memory-subscription-repository.js +28 -0
  501. package/dist/infrastructure/webhook/in-memory-subscription-repository.js.map +1 -0
  502. package/dist/infrastructure/webhook/index.d.ts +4 -0
  503. package/dist/infrastructure/webhook/index.js +21 -0
  504. package/dist/infrastructure/webhook/index.js.map +1 -0
  505. package/dist/infrastructure/webhook/webhook-dispatcher.d.ts +13 -0
  506. package/dist/infrastructure/webhook/webhook-dispatcher.js +91 -0
  507. package/dist/infrastructure/webhook/webhook-dispatcher.js.map +1 -0
  508. package/dist/phases/index.d.ts +1 -0
  509. package/dist/phases/index.js +18 -0
  510. package/dist/phases/index.js.map +1 -0
  511. package/dist/phases/phase-transition.d.ts +19 -0
  512. package/dist/phases/phase-transition.js +31 -0
  513. package/dist/phases/phase-transition.js.map +1 -0
  514. package/dist/phases/transition/index.d.ts +1 -0
  515. package/dist/phases/transition/index.js +18 -0
  516. package/dist/phases/transition/index.js.map +1 -0
  517. package/dist/phases/transition/phase-transition.model.d.ts +13 -0
  518. package/dist/phases/transition/phase-transition.model.js +21 -0
  519. package/dist/phases/transition/phase-transition.model.js.map +1 -0
  520. package/dist/providers/index.d.ts +1 -0
  521. package/dist/providers/index.js +18 -0
  522. package/dist/providers/index.js.map +1 -0
  523. package/dist/providers/provider.ports.d.ts +39 -0
  524. package/dist/providers/provider.ports.js +18 -0
  525. package/dist/providers/provider.ports.js.map +1 -0
  526. package/dist/tenancy/index.d.ts +1 -0
  527. package/dist/tenancy/index.js +18 -0
  528. package/dist/tenancy/index.js.map +1 -0
  529. package/dist/tenancy/tenant-authority.d.ts +22 -0
  530. package/dist/tenancy/tenant-authority.js +31 -0
  531. package/dist/tenancy/tenant-authority.js.map +1 -0
  532. package/package.json +80 -0
@@ -0,0 +1,151 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.OpaEvaluator = void 0;
40
+ const path = __importStar(require("path"));
41
+ const opa_wasm_1 = require("@open-policy-agent/opa-wasm");
42
+ const opa_input_builder_1 = require("./opa-input-builder");
43
+ const ajv_1 = __importDefault(require("ajv"));
44
+ const ajv_formats_1 = __importDefault(require("ajv-formats"));
45
+ class OpaEvaluator {
46
+ constructor(fs, logger) {
47
+ this.fs = fs;
48
+ this.logger = logger;
49
+ this.policyCache = null;
50
+ this.schemaCache = new Map();
51
+ this.inputBuilder = new opa_input_builder_1.OpaInputBuilder(fs);
52
+ this.ajv = new ajv_1.default({ allErrors: true, strict: false });
53
+ (0, ajv_formats_1.default)(this.ajv);
54
+ }
55
+ async validateInput(category, input, corePath) {
56
+ const schemaPath = path.join(corePath, 'rulesets', 'opa', 'schemas', `${category}.input.schema.json`);
57
+ if (!await this.fs.exists(schemaPath)) {
58
+ return null;
59
+ }
60
+ try {
61
+ let validate = this.schemaCache.get(schemaPath);
62
+ if (!validate) {
63
+ const schemaContent = await this.fs.readFile(schemaPath);
64
+ const schema = JSON.parse(schemaContent);
65
+ validate = this.ajv.compile(schema);
66
+ this.schemaCache.set(schemaPath, validate);
67
+ }
68
+ const valid = validate(input);
69
+ if (!valid) {
70
+ return this.ajv.errorsText(validate.errors, { separator: '; ' });
71
+ }
72
+ }
73
+ catch (err) {
74
+ const msg = err instanceof Error ? err.message : String(err);
75
+ return `Failed to compile/run input schema validation: ${msg}`;
76
+ }
77
+ return null;
78
+ }
79
+ async evaluateAll(rules, ctx) {
80
+ const wasmPath = path.join(ctx.corePath, 'rulesets', 'opa', 'policy.wasm');
81
+ if (!await this.fs.exists(wasmPath)) {
82
+ this.logger.warn(`OPA WebAssembly policy not found at ${wasmPath}. Please compile the .rego rules.`);
83
+ return rules.map(rule => ({
84
+ rule,
85
+ result: 'skipped',
86
+ message: 'OPA Wasm policy not compiled yet.',
87
+ }));
88
+ }
89
+ try {
90
+ if (!this.policyCache) {
91
+ const wasmBuffer = await this.fs.readFileBuffer(wasmPath);
92
+ this.policyCache = await (0, opa_wasm_1.loadPolicy)(wasmBuffer);
93
+ }
94
+ const input = await this.inputBuilder.build(ctx);
95
+ const categories = Array.from(new Set(rules.map(r => r.category)));
96
+ const categoryErrors = new Map();
97
+ for (const cat of categories) {
98
+ const error = await this.validateInput(cat, input, ctx.corePath);
99
+ if (error) {
100
+ categoryErrors.set(cat, error);
101
+ }
102
+ }
103
+ const passedRules = [];
104
+ const failedResults = [];
105
+ for (const rule of rules) {
106
+ const schemaError = categoryErrors.get(rule.category);
107
+ if (schemaError) {
108
+ failedResults.push({
109
+ rule,
110
+ result: 'failed',
111
+ message: `OPA Input Schema Validation Failed: ${schemaError}`,
112
+ });
113
+ }
114
+ else {
115
+ passedRules.push(rule);
116
+ }
117
+ }
118
+ let opaResults = [];
119
+ if (passedRules.length > 0) {
120
+ const resultSet = this.policyCache.evaluate(input);
121
+ const violations = (resultSet?.[0]?.result) ? resultSet[0].result : [];
122
+ opaResults = passedRules.map(rule => {
123
+ const ruleViolations = violations.filter((v) => v.id === rule.id);
124
+ if (ruleViolations.length > 0) {
125
+ return {
126
+ rule,
127
+ result: 'failed',
128
+ message: ruleViolations.map((v) => v.message).join('; '),
129
+ };
130
+ }
131
+ return {
132
+ rule,
133
+ result: 'passed'
134
+ };
135
+ });
136
+ }
137
+ return [...failedResults, ...opaResults];
138
+ }
139
+ catch (err) {
140
+ const msg = err instanceof Error ? err.message : String(err);
141
+ this.logger.error(`Failed to evaluate OPA policy: ${msg}`);
142
+ return rules.map(rule => ({
143
+ rule,
144
+ result: 'skipped',
145
+ message: `OPA Engine Error: ${msg}`
146
+ }));
147
+ }
148
+ }
149
+ }
150
+ exports.OpaEvaluator = OpaEvaluator;
151
+ //# sourceMappingURL=opa-evaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opa-evaluator.js","sourceRoot":"","sources":["../../../../src/application/validators/evaluators/opa-evaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAI7B,0DAAyD;AACzD,2DAAsD;AACtD,8CAAsB;AACtB,8DAAqC;AAErC,MAAa,YAAY;IAMvB,YACmB,EAAe,EACf,MAAe;QADf,OAAE,GAAF,EAAE,CAAa;QACf,WAAM,GAAN,MAAM,CAAS;QAP1B,gBAAW,GAAQ,IAAI,CAAC;QAGxB,gBAAW,GAAqB,IAAI,GAAG,EAAE,CAAC;QAMhD,IAAI,CAAC,YAAY,GAAG,IAAI,mCAAe,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,IAAI,aAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,IAAA,qBAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IA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A0B,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;yBAClF,CAAC;oBACJ,CAAC;oBACD,OAAO;wBACL,IAAI;wBACJ,MAAM,EAAE,QAAQ;qBACjB,CAAC;gBACJ,CAAC,CAAC,CAAC;YACL,CAAC;YAED,OAAO,CAAC,GAAG,aAAa,EAAE,GAAG,UAAU,CAAC,CAAC;QAE3C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;YAC3D,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxB,IAAI;gBACJ,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,qBAAqB,GAAG,EAAE;aACpC,CAAC,CAAC,CAAC;QACN,CAAC;IACH,CAAC;CACF;AA1HD,oCA0HC"}
@@ -0,0 +1,96 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const opa_evaluator_1 = require("./opa-evaluator");
37
+ const mocks_1 = require("../../../test/mocks");
38
+ const path = __importStar(require("path"));
39
+ jest.mock('@open-policy-agent/opa-wasm', () => {
40
+ return {
41
+ loadPolicy: jest.fn().mockResolvedValue({
42
+ evaluate: jest.fn().mockReturnValue([
43
+ {
44
+ result: [
45
+ { id: 'DEP-01', message: 'package.json#dependencies.lodash=^4.17.21 (Caret pinning not allowed)' }
46
+ ]
47
+ }
48
+ ])
49
+ })
50
+ };
51
+ });
52
+ describe('OpaEvaluator', () => {
53
+ let fs;
54
+ let logger;
55
+ let evaluator;
56
+ beforeEach(() => {
57
+ fs = (0, mocks_1.createMockFileSystem)();
58
+ logger = (0, mocks_1.createMockLogger)();
59
+ evaluator = new opa_evaluator_1.OpaEvaluator(fs, logger);
60
+ });
61
+ afterEach(() => {
62
+ jest.clearAllMocks();
63
+ });
64
+ const mockRule = {
65
+ id: 'DEP-01',
66
+ severity: 'MUST',
67
+ category: 'version-pinning',
68
+ title: 'Dependency Pinning',
69
+ description: 'All dependencies must be strictly pinned',
70
+ blocking: true,
71
+ sourceFile: 'rules.json',
72
+ };
73
+ const ctx = {
74
+ satellitePath: '/satellite',
75
+ corePath: '/core',
76
+ };
77
+ it('should skip evaluation if policy.wasm is not present', async () => {
78
+ const results = await evaluator.evaluateAll([mockRule], ctx);
79
+ expect(results).toHaveLength(1);
80
+ expect(results[0].result).toBe('skipped');
81
+ expect(results[0].message).toMatch(/OPA Wasm policy not compiled yet/);
82
+ const warnLogs = logger.getLogsByLevel('WARN');
83
+ expect(warnLogs.length).toBeGreaterThan(0);
84
+ expect(warnLogs[0].message).toMatch(/OPA WebAssembly policy not found/);
85
+ });
86
+ it('should evaluate rules using the loaded Wasm policy if present', async () => {
87
+ const wasmPath = path.join('/core', 'rulesets', 'opa', 'policy.wasm');
88
+ // Write fake wasm bytes
89
+ fs.setFile(wasmPath, 'fake-wasm-content');
90
+ const results = await evaluator.evaluateAll([mockRule], ctx);
91
+ expect(results).toHaveLength(1);
92
+ expect(results[0].result).toBe('failed');
93
+ expect(results[0].message).toContain('Caret pinning not allowed');
94
+ });
95
+ });
96
+ //# sourceMappingURL=opa-evaluator.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opa-evaluator.spec.js","sourceRoot":"","sources":["../../../../src/application/validators/evaluators/opa-evaluator.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA+C;AAC/C,+CAA6E;AAG7E,2CAA6B;AAE7B,IAAI,CAAC,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,OAAO;QACL,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;YACtC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;gBAClC;oBACE,MAAM,EAAE;wBACN,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,uEAAuE,EAAE;qBACnG;iBACF;aACF,CAAC;SACH,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,EAA2C,CAAC;IAChD,IAAI,MAA2C,CAAC;IAChD,IAAI,SAAuB,CAAC;IAE5B,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,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E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;QAC7E,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;QAEtE,wBAAwB;QACxB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;QAE1C,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;QAE7D,MAAM,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { IFileSystem } from '../../../domain/interfaces';
2
+ import { EvaluationContext } from './evaluator.interface';
3
+ export declare class OpaInputBuilder {
4
+ private readonly fs;
5
+ constructor(fs: IFileSystem);
6
+ build(ctx: EvaluationContext): Promise<unknown>;
7
+ private safeReadJson;
8
+ private safeReadFile;
9
+ private readAgenticAiConfiguration;
10
+ private readServerlessConfiguration;
11
+ private readEventDrivenConfiguration;
12
+ private readDataMeshConfiguration;
13
+ private readEdgeComputingConfiguration;
14
+ private asRecord;
15
+ private asStringArray;
16
+ private isRestrictedAccess;
17
+ private isPositiveNumber;
18
+ private pathsOverlap;
19
+ private getTopLevelDirs;
20
+ private readWorkflows;
21
+ private readEvidence;
22
+ private listAdrs;
23
+ private listFilesRecursive;
24
+ private hasCompiledTests;
25
+ private readWorkspacePackageJsons;
26
+ private analyzeSourceFiles;
27
+ }
@@ -0,0 +1,357 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.OpaInputBuilder = void 0;
37
+ const path = __importStar(require("path"));
38
+ class OpaInputBuilder {
39
+ constructor(fs) {
40
+ this.fs = fs;
41
+ }
42
+ async build(ctx) {
43
+ const satelliteWorkflows = await this.readWorkflows(ctx.satellitePath);
44
+ const coreEvidence = await this.readEvidence(ctx.corePath);
45
+ const mcpServerContent = await this.safeReadFile(path.join(ctx.corePath, 'sdk', 'cli', 'src', 'core', 'mcp', 'server.ts'));
46
+ const agenticAi = await this.readAgenticAiConfiguration(ctx.satellitePath);
47
+ const serverless = await this.readServerlessConfiguration(ctx.satellitePath);
48
+ const eventDriven = await this.readEventDrivenConfiguration(ctx.satellitePath);
49
+ const dataMesh = await this.readDataMeshConfiguration(ctx.satellitePath);
50
+ const edgeComputing = await this.readEdgeComputingConfiguration(ctx.satellitePath);
51
+ const input = {
52
+ satellitePath: ctx.satellitePath,
53
+ corePath: ctx.corePath,
54
+ satellite: {
55
+ packageJson: await this.safeReadJson(path.join(ctx.satellitePath, 'package.json')),
56
+ hasPackageLock: await this.fs.exists(path.join(ctx.satellitePath, 'package-lock.json')),
57
+ hasDependabot: await this.fs.exists(path.join(ctx.satellitePath, '.github', 'dependabot.yml')),
58
+ hasRenovate: await this.fs.exists(path.join(ctx.satellitePath, '.renovaterc.json')),
59
+ directories: await this.getTopLevelDirs(ctx.satellitePath),
60
+ hasContracts: await this.fs.exists(path.join(ctx.satellitePath, 'contracts')),
61
+ hasAcl: await this.fs.exists(path.join(ctx.satellitePath, 'acl')),
62
+ hasEvents: await this.fs.exists(path.join(ctx.satellitePath, 'events')) || await this.fs.exists(path.join(ctx.satellitePath, 'src', 'events')),
63
+ hasExtractionReadiness: await this.fs.exists(path.join(ctx.satellitePath, 'docs', 'extraction-readiness.md')),
64
+ hasDockerfile: await this.fs.exists(path.join(ctx.satellitePath, 'Dockerfile')),
65
+ serverless,
66
+ eventDriven,
67
+ dataMesh,
68
+ edgeComputing,
69
+ hasAsyncApiConfig: await this.fs.exists(path.join(ctx.satellitePath, 'asyncapi.yaml')) || await this.fs.exists(path.join(ctx.satellitePath, 'asyncapi.json')),
70
+ agenticAi,
71
+ hasOtel: await this.fs.exists(path.join(ctx.satellitePath, 'otel.config.js')) || await this.fs.exists(path.join(ctx.satellitePath, 'opentelemetry.config.js')) || await this.fs.exists(path.join(ctx.satellitePath, 'src', 'instrumentation.ts')),
72
+ workflows: satelliteWorkflows,
73
+ workspacePackageJsons: await this.readWorkspacePackageJsons(ctx.satellitePath),
74
+ sourceFiles: await this.analyzeSourceFiles(ctx.satellitePath)
75
+ },
76
+ core: {
77
+ packageJson: await this.safeReadJson(path.join(ctx.corePath, 'package.json')),
78
+ hasPackageLock: await this.fs.exists(path.join(ctx.corePath, 'package-lock.json')),
79
+ hasDependabot: await this.fs.exists(path.join(ctx.corePath, '.github', 'dependabot.yml')),
80
+ directories: await this.getTopLevelDirs(ctx.corePath),
81
+ adrs: await this.listAdrs(ctx.corePath),
82
+ evidence: coreEvidence,
83
+ cli: {
84
+ hasMainJs: await this.fs.exists(path.join(ctx.corePath, 'sdk', 'cli', 'dist', 'main.js')),
85
+ hasTests: await this.hasCompiledTests(ctx.corePath),
86
+ hasReadme: await this.fs.exists(path.join(ctx.corePath, 'sdk', 'cli', 'README.md')),
87
+ hasArchitectureMd: await this.fs.exists(path.join(ctx.corePath, 'sdk', 'cli', 'ARCHITECTURE.md')),
88
+ hasPackageLock: await this.fs.exists(path.join(ctx.corePath, 'sdk', 'cli', 'package-lock.json')),
89
+ mcpServerSource: mcpServerContent
90
+ }
91
+ }
92
+ };
93
+ return input;
94
+ }
95
+ async safeReadJson(filePath) {
96
+ if (await this.fs.exists(filePath)) {
97
+ try {
98
+ return await this.fs.readJson(filePath);
99
+ }
100
+ catch {
101
+ return null;
102
+ }
103
+ }
104
+ return null;
105
+ }
106
+ async safeReadFile(filePath) {
107
+ if (await this.fs.exists(filePath)) {
108
+ try {
109
+ return await this.fs.readFile(filePath);
110
+ }
111
+ catch {
112
+ return null;
113
+ }
114
+ }
115
+ return null;
116
+ }
117
+ async readAgenticAiConfiguration(root) {
118
+ const config = await this.safeReadJson(path.join(root, 'agent.config.json'));
119
+ const agent = this.asRecord(config?.agent);
120
+ const sandbox = this.asRecord(config?.sandbox);
121
+ const toolPolicy = this.asRecord(config?.toolPolicy);
122
+ const contextPolicy = this.asRecord(config?.contextPolicy);
123
+ const audit = this.asRecord(config?.audit);
124
+ const budgets = this.asRecord(config?.operationalBudgets);
125
+ const concurrency = this.asRecord(budgets?.mcpToolConcurrency);
126
+ const credentials = this.asRecord(config?.credentialLifecycle);
127
+ const revocation = this.asRecord(credentials?.revocation);
128
+ const promptSources = this.asStringArray(config?.promptSources);
129
+ const implementationRoots = this.asStringArray(config?.implementationRoots);
130
+ const runbooksPath = typeof budgets?.runbooksPath === 'string' ? budgets.runbooksPath : '';
131
+ const runbooksExists = runbooksPath.length > 0 && await this.fs.exists(path.isAbsolute(runbooksPath) ? runbooksPath : path.join(root, runbooksPath));
132
+ return {
133
+ hasIdentity: typeof agent?.id === 'string' && agent.id.length > 0 && this.asStringArray(agent.capabilities).length > 0,
134
+ hasIsolatedSandbox: sandbox?.mode === 'isolated' && this.isRestrictedAccess(sandbox.network) && this.isRestrictedAccess(sandbox.process),
135
+ hasSeparatedPromptAndImplementation: promptSources.length > 0 && implementationRoots.length > 0 && !this.pathsOverlap(promptSources, implementationRoots),
136
+ requiresApprovalForMutativeTools: toolPolicy?.mutative === 'approval-required',
137
+ hasEphemeralSandboxLimits: sandbox?.ephemeral === true && this.isPositiveNumber(sandbox.maxDurationSeconds) && this.isPositiveNumber(sandbox.maxMemoryMb) && this.isPositiveNumber(sandbox.maxCpuCores),
138
+ hasTrustedContextPolicy: contextPolicy?.untrustedContent === 'data-only' && contextPolicy?.provenanceRequired === true && contextPolicy?.toolOutputSchemaValidation === true,
139
+ hasAccountableActions: toolPolicy?.capabilityDelegation === 'scoped-and-expiring' && audit?.appendOnly === true && audit?.correlationId === 'required',
140
+ hasOperationalBudgets: this.isPositiveNumber(budgets?.maxPromptTokens) && this.isPositiveNumber(budgets?.maxCompletionTokens) && this.isPositiveNumber(budgets?.maxContextWindowTokens) && this.isPositiveNumber(concurrency?.maxInFlight) && this.isPositiveNumber(concurrency?.perToolMaxInFlight) && runbooksExists,
141
+ hasCredentialLifecycle: this.isPositiveNumber(credentials?.delegationMaxTtlSeconds) && this.isPositiveNumber(credentials?.rotationCadenceDays) && (revocation?.onIncident === 'immediate' || revocation?.onIncident === 'scheduled') && this.isPositiveNumber(revocation?.maxPropagationSeconds),
142
+ };
143
+ }
144
+ async readServerlessConfiguration(root) {
145
+ const config = await this.safeReadJson(path.join(root, 'serverless.config.json'));
146
+ const pkg = this.asRecord(config?.package);
147
+ const coldStart = this.asRecord(config?.coldStart);
148
+ const maxSizeMb = pkg?.maxSizeMb;
149
+ return {
150
+ hasContract: Boolean(config),
151
+ isStateless: config?.stateless === true,
152
+ hasBoundedPackage: typeof maxSizeMb === 'number' && Number.isFinite(maxSizeMb) && maxSizeMb > 0 && maxSizeMb <= 50,
153
+ hasColdStartReadiness: typeof coldStart?.maxInitMilliseconds === 'number' && Number.isFinite(coldStart.maxInitMilliseconds) && coldStart.maxInitMilliseconds > 0 && coldStart?.lazyInitialization === true,
154
+ };
155
+ }
156
+ async readEventDrivenConfiguration(root) {
157
+ const config = await this.safeReadJson(path.join(root, 'event-driven.config.json'));
158
+ return {
159
+ hasStrictAsyncApi: config?.strictAsyncApi === true,
160
+ hasOutbox: config?.transactionalOutbox === true,
161
+ hasDlq: config?.deadLetterQueue === true,
162
+ };
163
+ }
164
+ async readDataMeshConfiguration(root) {
165
+ const config = await this.safeReadJson(path.join(root, 'data-mesh.config.json'));
166
+ return {
167
+ isDataProduct: config?.isDataProduct === true,
168
+ hasDataContracts: config?.hasDataContracts === true,
169
+ federatedGovernance: config?.federatedGovernance === true,
170
+ };
171
+ }
172
+ async readEdgeComputingConfiguration(root) {
173
+ const config = await this.safeReadJson(path.join(root, 'edge-computing.config.json'));
174
+ return {
175
+ syncStrategy: typeof config?.syncStrategy === 'string' ? config.syncStrategy : '',
176
+ edgeIsolation: config?.edgeIsolation === true,
177
+ conflictResolution: typeof config?.conflictResolution === 'string' ? config.conflictResolution : '',
178
+ };
179
+ }
180
+ asRecord(value) {
181
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
182
+ }
183
+ asStringArray(value) {
184
+ return Array.isArray(value) ? value.filter((item) => typeof item === 'string' && item.length > 0) : [];
185
+ }
186
+ isRestrictedAccess(value) {
187
+ return value === 'deny' || value === 'allowlist';
188
+ }
189
+ isPositiveNumber(value) {
190
+ return typeof value === 'number' && Number.isFinite(value) && value > 0;
191
+ }
192
+ pathsOverlap(left, right) {
193
+ return left.some(leftPath => right.some(rightPath => {
194
+ const normalizedLeft = leftPath.replace(/\\+|\/+/g, '/').replace(/\/$/, '');
195
+ const normalizedRight = rightPath.replace(/\\+|\/+/g, '/').replace(/\/$/, '');
196
+ return normalizedLeft === normalizedRight || normalizedLeft.startsWith(`${normalizedRight}/`) || normalizedRight.startsWith(`${normalizedLeft}/`);
197
+ }));
198
+ }
199
+ async getTopLevelDirs(dir) {
200
+ if (!await this.fs.exists(dir))
201
+ return [];
202
+ const entries = await this.fs.readdirNames(dir);
203
+ const dirs = [];
204
+ for (const entry of entries) {
205
+ if (entry === '.' || entry === '..')
206
+ continue;
207
+ const stat = await this.fs.stat(path.join(dir, entry));
208
+ if (stat.isDirectory())
209
+ dirs.push(entry);
210
+ }
211
+ return dirs;
212
+ }
213
+ async readWorkflows(root) {
214
+ const workflowsDir = path.join(root, '.github', 'workflows');
215
+ const result = {};
216
+ if (!await this.fs.exists(workflowsDir))
217
+ return result;
218
+ const entries = await this.fs.readdirNames(workflowsDir);
219
+ for (const entry of entries) {
220
+ if (entry.endsWith('.yml') || entry.endsWith('.yaml')) {
221
+ const content = await this.safeReadFile(path.join(workflowsDir, entry));
222
+ if (content)
223
+ result[entry] = content;
224
+ }
225
+ }
226
+ return result;
227
+ }
228
+ async readEvidence(root) {
229
+ const evidenceDir = path.join(root, '.harness', 'evidence');
230
+ const result = {};
231
+ if (!await this.fs.exists(evidenceDir))
232
+ return result;
233
+ const entries = await this.fs.readdirNames(evidenceDir);
234
+ for (const entry of entries) {
235
+ if (entry.endsWith('.json')) {
236
+ const content = await this.safeReadJson(path.join(evidenceDir, entry));
237
+ if (content)
238
+ result[entry] = content;
239
+ }
240
+ }
241
+ return result;
242
+ }
243
+ async listAdrs(root) {
244
+ const adrDir = path.join(root, 'reference', 'architecture', 'adrs');
245
+ if (!await this.fs.exists(adrDir))
246
+ return [];
247
+ return this.listFilesRecursive(adrDir);
248
+ }
249
+ async listFilesRecursive(dir) {
250
+ const files = [];
251
+ const entries = await this.fs.readdirNames(dir);
252
+ for (const entry of entries) {
253
+ if (entry === '.' || entry === '..')
254
+ continue;
255
+ const full = path.join(dir, entry);
256
+ const stat = await this.fs.stat(full);
257
+ if (stat.isDirectory()) {
258
+ files.push(...await this.listFilesRecursive(full));
259
+ }
260
+ else {
261
+ files.push(full);
262
+ }
263
+ }
264
+ return files;
265
+ }
266
+ async hasCompiledTests(root) {
267
+ const distDir = path.join(root, 'sdk', 'cli', 'dist');
268
+ if (!await this.fs.exists(distDir))
269
+ return false;
270
+ const files = await this.listFilesRecursive(distDir);
271
+ return files.some(f => f.includes('.spec.') || f.includes('.test.'));
272
+ }
273
+ async readWorkspacePackageJsons(rootPath) {
274
+ const rootPkgPath = path.join(rootPath, 'package.json');
275
+ const files = [];
276
+ const rootPkg = await this.safeReadJson(rootPkgPath);
277
+ if (!rootPkg)
278
+ return files;
279
+ files.push({ path: rootPkgPath, content: rootPkg });
280
+ const workspaces = rootPkg["workspaces"];
281
+ const patterns = Array.isArray(workspaces)
282
+ ? workspaces
283
+ : (workspaces?.packages ?? []);
284
+ for (const pattern of patterns) {
285
+ const base = pattern.replace(/\/\*.*$/, '');
286
+ const wsBase = path.join(rootPath, base);
287
+ if (await this.fs.exists(wsBase)) {
288
+ const entries = await this.fs.readdirNames(wsBase);
289
+ for (const entry of entries) {
290
+ if (entry === '.' || entry === '..')
291
+ continue;
292
+ const pkgPath = path.join(wsBase, entry, 'package.json');
293
+ const pkg = await this.safeReadJson(pkgPath);
294
+ if (pkg)
295
+ files.push({ path: pkgPath, content: pkg });
296
+ }
297
+ }
298
+ }
299
+ return files;
300
+ }
301
+ async analyzeSourceFiles(rootPath) {
302
+ const srcPath = path.join(rootPath, 'src');
303
+ if (!await this.fs.exists(srcPath))
304
+ return [];
305
+ const allFiles = await this.listFilesRecursive(srcPath);
306
+ const tsFiles = allFiles.filter(f => f.endsWith('.ts'));
307
+ const sourceFilesInfo = [];
308
+ let ts;
309
+ try {
310
+ ts = await Promise.resolve().then(() => __importStar(require('typescript')));
311
+ }
312
+ catch {
313
+ for (const file of tsFiles) {
314
+ const content = await this.safeReadFile(file);
315
+ sourceFilesInfo.push({ path: file, content: content || '' });
316
+ }
317
+ return sourceFilesInfo;
318
+ }
319
+ for (const file of tsFiles) {
320
+ const content = await this.safeReadFile(file) || '';
321
+ const info = {
322
+ path: file.replace(rootPath, ''),
323
+ content: content,
324
+ hasAstImport: false,
325
+ hasManualInstantiation: false,
326
+ hasUiImport: false,
327
+ usesRegexForCode: content.includes('RegExp') || content.includes('.match(')
328
+ };
329
+ if (!file.endsWith('.spec.ts') && !file.endsWith('.test.ts')) {
330
+ const sourceFile = ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
331
+ const checkNode = (node) => {
332
+ if (ts.isImportDeclaration(node)) {
333
+ const importPath = node.moduleSpecifier.getText().replace(/['"]/g, '');
334
+ if (importPath === 'typescript' || importPath === '@babel/parser') {
335
+ info.hasAstImport = true;
336
+ }
337
+ if (['@clack/prompts', 'inquirer', 'commander', 'express'].includes(importPath)) {
338
+ info.hasUiImport = true;
339
+ }
340
+ }
341
+ if (ts.isNewExpression(node)) {
342
+ const className = node.expression.getText();
343
+ if (/(Service|UseCase|Repository|Adapter)$/.test(className)) {
344
+ info.hasManualInstantiation = true;
345
+ }
346
+ }
347
+ ts.forEachChild(node, checkNode);
348
+ };
349
+ checkNode(sourceFile);
350
+ }
351
+ sourceFilesInfo.push(info);
352
+ }
353
+ return sourceFilesInfo;
354
+ }
355
+ }
356
+ exports.OpaInputBuilder = OpaInputBuilder;
357
+ //# sourceMappingURL=opa-input-builder.js.map