kibi-cli 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/dist/cli-operation-loader.d.ts.map +1 -1
  2. package/dist/cli-operation-loader.js +3 -0
  3. package/dist/cli-operation-metadata.d.ts +4 -0
  4. package/dist/cli-operation-metadata.d.ts.map +1 -1
  5. package/dist/cli-operation-metadata.js +5 -0
  6. package/dist/cli-protocol.d.ts.map +1 -1
  7. package/dist/cli-protocol.js +3 -2
  8. package/dist/cli-register-reporting.d.ts.map +1 -1
  9. package/dist/cli-register-reporting.js +4 -0
  10. package/dist/commands/aggregated-checks.d.ts +7 -0
  11. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  12. package/dist/commands/aggregated-checks.js +25 -1
  13. package/dist/commands/check-diff.d.ts +5 -0
  14. package/dist/commands/check-diff.d.ts.map +1 -0
  15. package/dist/commands/check-diff.js +62 -0
  16. package/dist/commands/check-generated.d.ts.map +1 -1
  17. package/dist/commands/check-generated.js +41 -18
  18. package/dist/commands/check.d.ts.map +1 -1
  19. package/dist/commands/check.js +231 -86
  20. package/dist/commands/doctor.d.ts.map +1 -1
  21. package/dist/commands/doctor.js +168 -53
  22. package/dist/commands/github-init.d.ts +1 -1
  23. package/dist/commands/github-init.d.ts.map +1 -1
  24. package/dist/commands/github-init.js +10 -3
  25. package/dist/commands/init-helpers.d.ts +17 -2
  26. package/dist/commands/init-helpers.d.ts.map +1 -1
  27. package/dist/commands/init-helpers.js +123 -23
  28. package/dist/commands/init.d.ts.map +1 -1
  29. package/dist/commands/init.js +110 -15
  30. package/dist/commands/prove.d.ts.map +1 -1
  31. package/dist/commands/prove.js +10 -18
  32. package/dist/commands/sync/cache.d.ts +20 -1
  33. package/dist/commands/sync/cache.d.ts.map +1 -1
  34. package/dist/commands/sync/cache.js +51 -2
  35. package/dist/commands/sync/discovery.d.ts.map +1 -1
  36. package/dist/commands/sync/discovery.js +1 -1
  37. package/dist/commands/sync/manifest.d.ts.map +1 -1
  38. package/dist/commands/sync/manifest.js +3 -1
  39. package/dist/commands/sync/persistence.d.ts.map +1 -1
  40. package/dist/commands/sync/persistence.js +8 -0
  41. package/dist/commands/sync.d.ts.map +1 -1
  42. package/dist/commands/sync.js +11 -3
  43. package/dist/engine.d.ts +41 -1
  44. package/dist/engine.d.ts.map +1 -1
  45. package/dist/engine.js +377 -80
  46. package/dist/extractors/manifest.d.ts.map +1 -1
  47. package/dist/extractors/manifest.js +66 -28
  48. package/dist/extractors/markdown.d.ts +2 -0
  49. package/dist/extractors/markdown.d.ts.map +1 -1
  50. package/dist/extractors/markdown.js +14 -3
  51. package/dist/extractors/relationships.d.ts.map +1 -1
  52. package/dist/extractors/relationships.js +1 -0
  53. package/dist/extractors/symbols-coordinator.d.ts +7 -0
  54. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  55. package/dist/extractors/symbols-coordinator.js +75 -39
  56. package/dist/intent-search.d.ts.map +1 -1
  57. package/dist/intent-search.js +68 -29
  58. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  59. package/dist/operations/bootstrap/generate.js +4 -3
  60. package/dist/operations/modeling/model-requirement.d.ts +1 -1
  61. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  62. package/dist/operations/modeling/model-requirement.js +176 -10
  63. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  64. package/dist/operations/modeling/predicate-applyplan.js +14 -2
  65. package/dist/operations/modeling/predicate-inference-1.js +1 -1
  66. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  67. package/dist/operations/modeling/predicate-loader.js +24 -0
  68. package/dist/operations/modeling/predicate-types.d.ts +4 -0
  69. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  70. package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
  71. package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
  72. package/dist/operations/modeling/predicate-vocabulary.js +169 -0
  73. package/dist/operations/modeling/requirement-types.d.ts +5 -0
  74. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  75. package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
  76. package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
  77. package/dist/operations/modeling/vocabulary-alignment.js +178 -0
  78. package/dist/operations/mutation/contradictions.d.ts +3 -0
  79. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  80. package/dist/operations/mutation/contradictions.js +29 -0
  81. package/dist/operations/mutation/delete.d.ts.map +1 -1
  82. package/dist/operations/mutation/delete.js +33 -1
  83. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
  84. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
  85. package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
  86. package/dist/operations/mutation/relationships.d.ts +1 -1
  87. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  88. package/dist/operations/mutation/relationships.js +1 -0
  89. package/dist/operations/mutation/saga.d.ts +5 -0
  90. package/dist/operations/mutation/saga.d.ts.map +1 -1
  91. package/dist/operations/mutation/saga.js +10 -0
  92. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  93. package/dist/operations/mutation/serialization.js +2 -0
  94. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  95. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  96. package/dist/operations/mutation/source-authoring.js +213 -52
  97. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  98. package/dist/operations/mutation/strict-fact.js +5 -0
  99. package/dist/operations/mutation/types.d.ts +17 -0
  100. package/dist/operations/mutation/types.d.ts.map +1 -1
  101. package/dist/operations/mutation/upsert.d.ts +6 -0
  102. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  103. package/dist/operations/mutation/upsert.js +77 -11
  104. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  105. package/dist/operations/mutation/validate-upsert.js +24 -1
  106. package/dist/operations/mutation/validation.d.ts.map +1 -1
  107. package/dist/operations/mutation/validation.js +16 -3
  108. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  109. package/dist/operations/planning/apply-plan.js +66 -26
  110. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  111. package/dist/operations/planning/compile-intent.js +3 -1
  112. package/dist/operations/proof/code-scope.d.ts +17 -0
  113. package/dist/operations/proof/code-scope.d.ts.map +1 -0
  114. package/dist/operations/proof/code-scope.js +60 -0
  115. package/dist/operations/proof/ingest-proof.d.ts +4 -2
  116. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  117. package/dist/operations/proof/ingest-proof.js +208 -74
  118. package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
  119. package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
  120. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  121. package/dist/operations/proof/prune-receipts.js +7 -5
  122. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  123. package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
  124. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  125. package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
  126. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  127. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  128. package/dist/operations/semantic-advisor/clauses.js +7 -1
  129. package/dist/performance-trace.d.ts +17 -0
  130. package/dist/performance-trace.d.ts.map +1 -0
  131. package/dist/performance-trace.js +134 -0
  132. package/dist/plugins/approved-source-analyzers.d.ts +13 -0
  133. package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
  134. package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
  135. package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
  136. package/dist/plugins/approved-source-analyzers.generated.js +77 -0
  137. package/dist/plugins/approved-source-analyzers.js +3 -0
  138. package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
  139. package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
  140. package/dist/plugins/compose-semantic-classifier.js +8 -3
  141. package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
  142. package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
  143. package/dist/plugins/compose-vocabulary-alignment.js +141 -0
  144. package/dist/plugins/external-allowlist.d.ts +7 -0
  145. package/dist/plugins/external-allowlist.d.ts.map +1 -1
  146. package/dist/plugins/external-allowlist.js +13 -0
  147. package/dist/plugins/index.d.ts +2 -0
  148. package/dist/plugins/index.d.ts.map +1 -1
  149. package/dist/plugins/index.js +4 -0
  150. package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
  151. package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
  152. package/dist/plugins/maintenance-source-analysis.js +191 -0
  153. package/dist/plugins/registry.d.ts +3 -1
  154. package/dist/plugins/registry.d.ts.map +1 -1
  155. package/dist/plugins/registry.js +27 -1
  156. package/dist/plugins/source-analysis-service.d.ts +36 -1
  157. package/dist/plugins/source-analysis-service.d.ts.map +1 -1
  158. package/dist/plugins/source-analysis-service.js +184 -27
  159. package/dist/plugins/source-change-analysis.d.ts +15 -0
  160. package/dist/plugins/source-change-analysis.d.ts.map +1 -0
  161. package/dist/plugins/source-change-analysis.js +54 -0
  162. package/dist/plugins/source-classification.d.ts +41 -0
  163. package/dist/plugins/source-classification.d.ts.map +1 -0
  164. package/dist/plugins/source-classification.js +490 -0
  165. package/dist/prolog/codec.d.ts.map +1 -1
  166. package/dist/prolog/codec.js +2 -0
  167. package/dist/prolog/swipl-resolver.d.ts +88 -0
  168. package/dist/prolog/swipl-resolver.d.ts.map +1 -0
  169. package/dist/prolog/swipl-resolver.js +446 -0
  170. package/dist/prolog.d.ts +51 -1
  171. package/dist/prolog.d.ts.map +1 -1
  172. package/dist/prolog.js +145 -15
  173. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  174. package/dist/public/diagnostic-usage.js +7 -25
  175. package/dist/public/impact/analyzer.d.ts.map +1 -1
  176. package/dist/public/impact/analyzer.js +56 -5
  177. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  178. package/dist/public/impact/diagnostics.js +3 -1
  179. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  180. package/dist/public/impact/full-kb-quality.js +4 -12
  181. package/dist/public/impact/manifest.d.ts.map +1 -1
  182. package/dist/public/impact/manifest.js +15 -1
  183. package/dist/public/impact/source-changes.d.ts.map +1 -1
  184. package/dist/public/impact/source-changes.js +35 -27
  185. package/dist/public/impact/types.d.ts +2 -0
  186. package/dist/public/impact/types.d.ts.map +1 -1
  187. package/dist/public/operations/catalog.d.ts +80 -7
  188. package/dist/public/operations/catalog.d.ts.map +1 -1
  189. package/dist/public/operations/catalog.js +2 -0
  190. package/dist/public/operations/check-executor.d.ts.map +1 -1
  191. package/dist/public/operations/check-executor.js +10 -2
  192. package/dist/public/operations/check-helpers.d.ts +6 -0
  193. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  194. package/dist/public/operations/check-helpers.js +21 -1
  195. package/dist/public/operations/contracts.d.ts.map +1 -1
  196. package/dist/public/operations/contracts.js +325 -8
  197. package/dist/public/operations/discovery-entities.d.ts +42 -2
  198. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  199. package/dist/public/operations/discovery-entities.js +195 -22
  200. package/dist/public/operations/discovery-executors.d.ts +1 -0
  201. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  202. package/dist/public/operations/discovery-executors.js +75 -46
  203. package/dist/public/operations/impact-review-preparation.d.ts +14 -0
  204. package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
  205. package/dist/public/operations/impact-review-preparation.js +379 -0
  206. package/dist/public/operations/index.d.ts +2 -0
  207. package/dist/public/operations/index.d.ts.map +1 -1
  208. package/dist/public/operations/index.js +2 -0
  209. package/dist/public/operations/migration-plan.d.ts +2 -0
  210. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  211. package/dist/public/operations/migration-plan.js +50 -0
  212. package/dist/public/operations/node-ports.d.ts.map +1 -1
  213. package/dist/public/operations/node-ports.js +1 -35
  214. package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
  215. package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
  216. package/dist/public/operations/predicate-schema-conformance.js +242 -0
  217. package/dist/public/operations/prolog-json.d.ts.map +1 -1
  218. package/dist/public/operations/prolog-json.js +9 -3
  219. package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
  220. package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
  221. package/dist/public/operations/proof-receipt-projection.js +36 -0
  222. package/dist/public/operations/result-envelope.d.ts +34 -1
  223. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  224. package/dist/public/operations/result-envelope.js +78 -2
  225. package/dist/public/operations/runtime-types.d.ts +1 -1
  226. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  227. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  228. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  229. package/dist/public/operations/specs/check-rules.generated.js +8 -1
  230. package/dist/public/operations/specs/check.d.ts +1 -1
  231. package/dist/public/operations/specs/discovery.d.ts +7 -1
  232. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  233. package/dist/public/operations/specs/discovery.js +7 -1
  234. package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
  235. package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
  236. package/dist/public/operations/specs/impact-review-preparation.js +43 -0
  237. package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
  238. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  239. package/dist/public/operations/specs/mutation-schemas.js +21 -3
  240. package/dist/public/operations/specs/reporting.d.ts +8 -0
  241. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  242. package/dist/public/operations/specs/reporting.js +46 -15
  243. package/dist/public/operations/specs/upsert.d.ts +28 -5
  244. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  245. package/dist/public/operations/specs/upsert.js +1 -1
  246. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  247. package/dist/public/operations/symbol-repair-plan.js +8 -3
  248. package/dist/public/operations/types.d.ts +1 -1
  249. package/dist/public/operations/types.d.ts.map +1 -1
  250. package/dist/public/schemas/entity.d.ts.map +1 -1
  251. package/dist/public/schemas/entity.js +22 -0
  252. package/dist/public/schemas/relationship.d.ts.map +1 -1
  253. package/dist/public/schemas/relationship.js +1 -0
  254. package/dist/public/skills/kibi-usage/SKILL.md +7 -3
  255. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  256. package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -0
  257. package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  258. package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  259. package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
  260. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  261. package/dist/public/telemetry-acceptance.js +21 -5
  262. package/dist/relationships/shards.d.ts +6 -0
  263. package/dist/relationships/shards.d.ts.map +1 -1
  264. package/dist/relationships/shards.js +26 -19
  265. package/dist/schemas/entity.schema.json +32 -0
  266. package/dist/traceability/analysis-gate.d.ts +39 -0
  267. package/dist/traceability/analysis-gate.d.ts.map +1 -0
  268. package/dist/traceability/analysis-gate.js +51 -0
  269. package/dist/traceability/git-change-snapshot.d.ts +27 -0
  270. package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
  271. package/dist/traceability/git-change-snapshot.js +411 -0
  272. package/dist/traceability/git-staged.d.ts +5 -1
  273. package/dist/traceability/git-staged.d.ts.map +1 -1
  274. package/dist/traceability/git-staged.js +16 -11
  275. package/dist/traceability/impact-evaluator.d.ts +54 -0
  276. package/dist/traceability/impact-evaluator.d.ts.map +1 -0
  277. package/dist/traceability/impact-evaluator.js +270 -0
  278. package/dist/traceability/impact-git-tree.d.ts +12 -0
  279. package/dist/traceability/impact-git-tree.d.ts.map +1 -0
  280. package/dist/traceability/impact-git-tree.js +46 -0
  281. package/dist/traceability/impact-knowledge.d.ts +16 -0
  282. package/dist/traceability/impact-knowledge.d.ts.map +1 -0
  283. package/dist/traceability/impact-knowledge.js +165 -0
  284. package/dist/traceability/impact-policy.d.ts +15 -0
  285. package/dist/traceability/impact-policy.d.ts.map +1 -0
  286. package/dist/traceability/impact-policy.js +48 -0
  287. package/dist/traceability/impact-policy.v1.schema.json +48 -0
  288. package/dist/traceability/impact-pr-diff.d.ts +5 -0
  289. package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
  290. package/dist/traceability/impact-pr-diff.js +83 -0
  291. package/dist/traceability/impact-record-validation.d.ts +9 -0
  292. package/dist/traceability/impact-record-validation.d.ts.map +1 -0
  293. package/dist/traceability/impact-record-validation.js +113 -0
  294. package/dist/traceability/impact-review.d.ts +148 -0
  295. package/dist/traceability/impact-review.d.ts.map +1 -0
  296. package/dist/traceability/impact-review.js +494 -0
  297. package/dist/traceability/impact-review.schema.json +365 -0
  298. package/dist/traceability/impact-side-evidence.d.ts +13 -0
  299. package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
  300. package/dist/traceability/impact-side-evidence.js +240 -0
  301. package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
  302. package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
  303. package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
  304. package/dist/traceability/snapshot-knowledge.d.ts +4 -0
  305. package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
  306. package/dist/traceability/snapshot-knowledge.js +98 -0
  307. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  308. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  309. package/dist/traceability/staged-entity-id-style.d.ts +12 -0
  310. package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
  311. package/dist/traceability/staged-entity-id-style.js +68 -0
  312. package/dist/traceability/staged-file-coverage.d.ts +23 -0
  313. package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
  314. package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
  315. package/dist/traceability/staged-impact-contract.js +2 -16
  316. package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
  317. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  318. package/dist/traceability/staged-symbols-manifest.js +17 -6
  319. package/dist/traceability/symbol-extract.d.ts +3 -5
  320. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  321. package/dist/traceability/symbol-extract.js +49 -34
  322. package/dist/traceability/temp-kb.d.ts +1 -1
  323. package/dist/traceability/temp-kb.d.ts.map +1 -1
  324. package/dist/traceability/temp-kb.js +57 -13
  325. package/dist/traceability/trusted-pr-event.d.ts +13 -0
  326. package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
  327. package/dist/traceability/trusted-pr-event.js +105 -0
  328. package/dist/traceability/validate.js +1 -1
  329. package/dist/types/entities.d.ts +2 -0
  330. package/dist/types/entities.d.ts.map +1 -1
  331. package/dist/types/relationships.d.ts +1 -1
  332. package/dist/types/relationships.d.ts.map +1 -1
  333. package/dist/utils/canonical-path.d.ts +3 -0
  334. package/dist/utils/canonical-path.d.ts.map +1 -0
  335. package/dist/utils/canonical-path.js +33 -0
  336. package/dist/utils/entity-id-style.d.ts +27 -0
  337. package/dist/utils/entity-id-style.d.ts.map +1 -0
  338. package/dist/utils/entity-id-style.js +81 -0
  339. package/dist/utils/git-repository-context.d.ts +50 -0
  340. package/dist/utils/git-repository-context.d.ts.map +1 -0
  341. package/dist/utils/git-repository-context.js +259 -0
  342. package/dist/utils/rule-registry.d.ts +5 -0
  343. package/dist/utils/rule-registry.d.ts.map +1 -1
  344. package/dist/utils/rule-registry.generated.d.ts +37 -0
  345. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  346. package/dist/utils/rule-registry.generated.js +44 -0
  347. package/dist/utils/strict-modeling.d.ts +7 -0
  348. package/dist/utils/strict-modeling.d.ts.map +1 -1
  349. package/dist/utils/strict-modeling.js +11 -0
  350. package/package.json +14 -5
  351. package/schema/entities.pl +60 -1
  352. package/schema/relationships.pl +17 -4
  353. package/schema/validation.pl +118 -20
  354. package/src/public/diagnostic-usage.ts +16 -24
  355. package/src/public/impact/analyzer.ts +88 -5
  356. package/src/public/impact/diagnostics.ts +7 -5
  357. package/src/public/impact/full-kb-quality.ts +4 -16
  358. package/src/public/impact/manifest.ts +14 -1
  359. package/src/public/impact/source-changes.ts +39 -34
  360. package/src/public/impact/types.ts +5 -0
  361. package/src/public/operations/catalog.ts +2 -0
  362. package/src/public/operations/check-executor.ts +12 -1
  363. package/src/public/operations/check-helpers.ts +27 -1
  364. package/src/public/operations/contracts.ts +404 -9
  365. package/src/public/operations/discovery-entities.ts +292 -23
  366. package/src/public/operations/discovery-executors.ts +91 -55
  367. package/src/public/operations/impact-review-preparation.ts +548 -0
  368. package/src/public/operations/index.ts +2 -0
  369. package/src/public/operations/migration-plan.ts +57 -0
  370. package/src/public/operations/node-ports.ts +1 -39
  371. package/src/public/operations/predicate-schema-conformance.ts +362 -0
  372. package/src/public/operations/prolog-json.ts +9 -3
  373. package/src/public/operations/proof-receipt-projection.ts +39 -0
  374. package/src/public/operations/result-envelope.ts +114 -2
  375. package/src/public/operations/runtime-types.ts +1 -1
  376. package/src/public/operations/specs/check-rules.generated.ts +8 -1
  377. package/src/public/operations/specs/discovery.ts +8 -1
  378. package/src/public/operations/specs/impact-review-preparation.ts +46 -0
  379. package/src/public/operations/specs/mutation-schemas.ts +23 -3
  380. package/src/public/operations/specs/reporting.ts +69 -22
  381. package/src/public/operations/specs/upsert.ts +1 -1
  382. package/src/public/operations/symbol-repair-plan.ts +13 -3
  383. package/src/public/operations/types.ts +1 -0
  384. package/src/public/schemas/entity.ts +22 -0
  385. package/src/public/schemas/relationship.ts +1 -0
  386. package/src/public/skills/kibi-usage/SKILL.md +7 -3
  387. package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  388. package/src/public/skills/kibi-usage/resources/operation-access.md +1 -0
  389. package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  390. package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  391. package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
  392. package/src/public/telemetry-acceptance.ts +37 -6
  393. package/src/schemas/entity.schema.json +32 -0
  394. package/src/schemas/relationship.schema.json +1 -0
  395. package/src/traceability/impact-policy.v1.schema.json +48 -0
  396. package/src/traceability/impact-review.schema.json +365 -0
  397. package/templates/github/kibi-badge.yml +0 -4
  398. package/templates/github/kibi-report.yml +0 -4
@@ -0,0 +1,379 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { createMaintenanceSourceAnalysisService, fingerprintMaintenanceSourceSet, readSnapshotSourceConfig, } from "../../plugins/maintenance-source-analysis.js";
3
+ import { analyzeSourceChanges } from "../../plugins/source-change-analysis.js";
4
+ import { analysisObligation } from "../../traceability/analysis-gate.js";
5
+ import { captureDiffSnapshot, captureStagedSnapshot, } from "../../traceability/git-change-snapshot.js";
6
+ import { fingerprintImpactEvaluator, prepareImpactReview, } from "../../traceability/impact-evaluator.js";
7
+ import { IMPACT_EVALUATOR_VERSION, IMPACT_REVIEW_VERSION, canonicalJson, } from "../../traceability/impact-review.js";
8
+ import impactReviewRecordSchema from "../../traceability/impact-review.schema.json" with {
9
+ type: "json"
10
+ };
11
+ import { readSnapshotKnowledge } from "../../traceability/snapshot-knowledge.js";
12
+ const FULL_COMMIT_OID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
13
+ const SEMANTIC_RELATIONSHIPS = new Set([
14
+ "constrains",
15
+ "depends_on",
16
+ "requires_predicate",
17
+ "requires_property",
18
+ "requires_rule",
19
+ "specified_by",
20
+ "supersedes",
21
+ "validates",
22
+ "verified_by",
23
+ ]);
24
+ function compareText(left, right) {
25
+ return left < right ? -1 : left > right ? 1 : 0;
26
+ }
27
+ function gitText(root, args) {
28
+ return execFileSync("git", [...args], {
29
+ cwd: root,
30
+ encoding: "utf8",
31
+ maxBuffer: 64 * 1024 * 1024,
32
+ stdio: ["ignore", "pipe", "pipe"],
33
+ }).trim();
34
+ }
35
+ function resolveCommit(root, oid) {
36
+ return gitText(root, [
37
+ "rev-parse",
38
+ "--verify",
39
+ "--end-of-options",
40
+ `${oid}^{commit}`,
41
+ ]);
42
+ }
43
+ function treeForCommit(root, oid) {
44
+ return gitText(root, [
45
+ "rev-parse",
46
+ "--verify",
47
+ "--end-of-options",
48
+ `${oid}^{tree}`,
49
+ ]);
50
+ }
51
+ function assertExplicitDiffUnchanged(root, input, snapshot) {
52
+ const baseCommit = resolveCommit(root, input.baseCommit);
53
+ const headCommit = resolveCommit(root, input.headCommit);
54
+ if (baseCommit !== input.baseCommit ||
55
+ headCommit !== input.headCommit ||
56
+ snapshot.headCommit !== baseCommit ||
57
+ treeForCommit(root, baseCommit) !== snapshot.baseTree ||
58
+ treeForCommit(root, headCommit) !== snapshot.headTree)
59
+ throw new Error("Selected diff commit or tree identity changed during impact review preparation");
60
+ }
61
+ function snapshotIdentity(scope, snapshot) {
62
+ return {
63
+ kind: scope.kind,
64
+ baseCommit: scope.kind === "diff" ? scope.baseCommit : snapshot.headCommit,
65
+ baseTree: snapshot.baseTree,
66
+ headCommit: scope.kind === "diff" ? scope.headCommit : null,
67
+ headTree: snapshot.headTree,
68
+ headTreeSource: scope.kind === "diff" ? "commit" : "index",
69
+ };
70
+ }
71
+ function plainEntity(entity) {
72
+ return Object.fromEntries(Object.entries(entity)
73
+ .filter(([key]) => !["created_at", "updated_at", "proof_receipts"].includes(key))
74
+ .sort(([left], [right]) => compareText(left, right)));
75
+ }
76
+ function entityMap(snapshot, tree) {
77
+ return new Map(readSnapshotKnowledge(snapshot.readGit, tree, snapshot.readBlobs).map((row) => [
78
+ row.entity.id,
79
+ {
80
+ entity: row.entity,
81
+ relationships: row.relationships.map(({ type, from, to }) => ({
82
+ type,
83
+ from,
84
+ to,
85
+ })),
86
+ ...(row.sourceFile ? { sourceFile: row.sourceFile } : {}),
87
+ },
88
+ ]));
89
+ }
90
+ function requirementContext(id, rows, entities, allRows) {
91
+ const row = rows.get(id);
92
+ const binding = entities.get(id);
93
+ if (!row || !binding) {
94
+ return {
95
+ id,
96
+ state: "absent",
97
+ entityFingerprint: null,
98
+ artifactPath: null,
99
+ sourcePath: null,
100
+ relationships: [],
101
+ relatedEntities: [],
102
+ };
103
+ }
104
+ const relationships = [...allRows.entries()]
105
+ .flatMap(([ownerId, candidate]) => candidate.relationships
106
+ .filter((relationship) => SEMANTIC_RELATIONSHIPS.has(relationship.type) &&
107
+ (relationship.from === id || relationship.to === id))
108
+ .map((relationship) => ({ ownerId, ...relationship })))
109
+ .sort((left, right) => compareText(canonicalJson(left), canonicalJson(right)));
110
+ const relatedIds = [
111
+ ...new Set(relationships
112
+ .flatMap(({ from, to }) => [from, to])
113
+ .filter((relatedId) => relatedId !== id)),
114
+ ].sort();
115
+ return {
116
+ id,
117
+ state: "present",
118
+ entityFingerprint: binding.fingerprint,
119
+ artifactPath: binding.artifactPath,
120
+ sourcePath: binding.sourcePath ?? row.sourceFile ?? null,
121
+ entity: plainEntity(row.entity),
122
+ relationships: relationships.map(({ ownerId: _ownerId, ...edge }) => edge),
123
+ relatedEntities: relatedIds.flatMap((relatedId) => {
124
+ const related = allRows.get(relatedId);
125
+ if (!related)
126
+ return [];
127
+ const relatedBinding = entities.get(relatedId);
128
+ return [
129
+ {
130
+ id: relatedId,
131
+ type: related.entity.type ?? null,
132
+ entityFingerprint: relatedBinding?.fingerprint ?? null,
133
+ artifactPath: relatedBinding?.artifactPath ?? null,
134
+ sourcePath: relatedBinding?.sourcePath ?? related.sourceFile ?? null,
135
+ entity: plainEntity(related.entity),
136
+ },
137
+ ];
138
+ }),
139
+ };
140
+ }
141
+ function requirementScopes(prepared, snapshot) {
142
+ const before = entityMap(snapshot, snapshot.baseTree);
143
+ const after = entityMap(snapshot, snapshot.headTree);
144
+ return [...prepared.scopedRequirementIdsByPath.entries()]
145
+ .sort(([left], [right]) => compareText(left, right))
146
+ .map(([path, requirementIds]) => ({
147
+ path,
148
+ requirementIds: [...requirementIds].sort(),
149
+ before: [...requirementIds]
150
+ .sort()
151
+ .map((id) => requirementContext(id, before, prepared.baseEntities, before)),
152
+ after: [...requirementIds]
153
+ .sort()
154
+ .map((id) => requirementContext(id, after, prepared.headEntities, after)),
155
+ }));
156
+ }
157
+ function residualReviewObligations(prepared) {
158
+ const obligations = [];
159
+ for (const file of prepared.files) {
160
+ for (const side of ["before", "after"]) {
161
+ const analysis = file[side]?.analysis;
162
+ if (!analysis)
163
+ continue;
164
+ const obligation = analysisObligation(side, analysis, file.newHunkRanges);
165
+ if (obligation.kind === "unsupported_review") {
166
+ obligations.push({
167
+ path: file.path,
168
+ side,
169
+ status: analysis.status,
170
+ diagnosticCodes: [...analysis.diagnosticCodes].sort(),
171
+ kind: "unsupported_review",
172
+ wholeFile: true,
173
+ pending: true,
174
+ });
175
+ continue;
176
+ }
177
+ if (obligation.kind !== "partial_review")
178
+ continue;
179
+ const limitationClasses = new Set();
180
+ for (const code of analysis.diagnosticCodes) {
181
+ const allowed = prepared.policy.allowedPartial.find((entry) => entry.providerId === analysis.providerId &&
182
+ entry.providerFingerprint === analysis.providerFingerprint &&
183
+ entry.diagnosticCode === code);
184
+ if (allowed)
185
+ limitationClasses.add(allowed.limitationClass);
186
+ }
187
+ const limitationClass = [...limitationClasses][0];
188
+ if (limitationClasses.size !== 1 || limitationClass === undefined)
189
+ throw new Error(`Partial review obligation is not covered by the trusted policy: ${file.path} (${side})`);
190
+ obligations.push({
191
+ path: file.path,
192
+ side,
193
+ status: analysis.status,
194
+ diagnosticCodes: [...analysis.diagnosticCodes].sort(),
195
+ kind: "partial_review",
196
+ limitationClass,
197
+ ranges: obligation.ranges.map((range) => ({ ...range })),
198
+ pending: true,
199
+ });
200
+ }
201
+ }
202
+ return obligations.sort((left, right) => compareText(`${left.path}\0${left.side}`, `${right.path}\0${right.side}`));
203
+ }
204
+ function cloneRecordSchema() {
205
+ return JSON.parse(JSON.stringify(impactReviewRecordSchema));
206
+ }
207
+ function cloneRecordTemplateSchema() {
208
+ const schema = cloneRecordSchema();
209
+ schema.$id = "urn:kibi:impact-review-authoring-record-template:v1";
210
+ const properties = schema.properties;
211
+ properties.reviewedAt = { type: "null" };
212
+ const definitions = schema.$defs;
213
+ const reviewer = definitions.reviewer;
214
+ reviewer.properties.id = { type: "null" };
215
+ const file = definitions.file;
216
+ file.properties.analysisReviews = {
217
+ anyOf: [file.properties.analysisReviews, { type: "null" }],
218
+ };
219
+ file.properties.decision = {
220
+ anyOf: [file.properties.decision, { type: "null" }],
221
+ };
222
+ return schema;
223
+ }
224
+ function authoringContract(prepared) {
225
+ const recordHeaders = {
226
+ contractVersion: IMPACT_REVIEW_VERSION,
227
+ policy: {
228
+ id: prepared.policy.id,
229
+ version: prepared.policy.version,
230
+ fingerprint: prepared.policyFingerprint,
231
+ },
232
+ evaluator: {
233
+ contractVersion: IMPACT_EVALUATOR_VERSION,
234
+ fingerprint: prepared.evaluatorFingerprint,
235
+ },
236
+ scope: {
237
+ fingerprint: prepared.scopeFingerprint,
238
+ knowledgeFingerprint: prepared.knowledgeFingerprint,
239
+ providerSetFingerprint: prepared.providerSetFingerprint,
240
+ },
241
+ };
242
+ return {
243
+ templateVersion: "kibi.impact-review-authoring-template.v1",
244
+ isValidImpactReviewRecord: false,
245
+ instructions: "This template is reviewer input only. Author every decision, required analysis review, rationale, reviewer id, and reviewedAt before strict record validation. It is not an approval, signature, or proof receipt.",
246
+ authoredFields: [
247
+ "files[].decision",
248
+ "files[].analysisReviews",
249
+ "reviewer.id",
250
+ "reviewedAt",
251
+ ],
252
+ recordSchema: cloneRecordSchema(),
253
+ decisionSchema: { $ref: "urn:kibi:impact-review:v1#/$defs/decision" },
254
+ analysisReviewSchema: {
255
+ oneOf: [
256
+ { $ref: "urn:kibi:impact-review:v1#/$defs/unsupportedReview" },
257
+ { $ref: "urn:kibi:impact-review:v1#/$defs/partialReview" },
258
+ ],
259
+ },
260
+ templateSchema: {
261
+ $schema: "https://json-schema.org/draft/2020-12/schema",
262
+ $id: "urn:kibi:impact-review-authoring-template:v1",
263
+ type: "object",
264
+ additionalProperties: false,
265
+ required: ["templateVersion", "isValidImpactReviewRecord", "record"],
266
+ properties: {
267
+ templateVersion: {
268
+ const: "kibi.impact-review-authoring-template.v1",
269
+ },
270
+ isValidImpactReviewRecord: { const: false },
271
+ record: cloneRecordTemplateSchema(),
272
+ },
273
+ },
274
+ recordTemplate: {
275
+ templateVersion: "kibi.impact-review-authoring-template.v1",
276
+ isValidImpactReviewRecord: false,
277
+ record: {
278
+ ...recordHeaders,
279
+ reviewer: { id: null, source: "self-claimed-local" },
280
+ reviewedAt: null,
281
+ files: prepared.files
282
+ .slice()
283
+ .sort((left, right) => compareText(left.path, right.path))
284
+ .map((file) => ({
285
+ ...withoutAnalysisReviews(file),
286
+ analysisReviews: null,
287
+ decision: null,
288
+ })),
289
+ },
290
+ },
291
+ };
292
+ }
293
+ function withoutAnalysisReviews(file) {
294
+ const { analysisReviews: _analysisReviews, ...evidence } = file;
295
+ return evidence;
296
+ }
297
+ function completeFileEvidence(prepared) {
298
+ return prepared.files
299
+ .slice()
300
+ .sort((left, right) => compareText(left.path, right.path))
301
+ .map((file) => withoutAnalysisReviews(file));
302
+ }
303
+ function buildPreparation(scope, snapshot, prepared) {
304
+ return {
305
+ preparationVersion: "kibi.impact-review-preparation.v1",
306
+ status: "ready_for_authoring",
307
+ snapshot: snapshotIdentity(scope, snapshot),
308
+ recordHeaders: {
309
+ contractVersion: IMPACT_REVIEW_VERSION,
310
+ policy: {
311
+ id: prepared.policy.id,
312
+ version: prepared.policy.version,
313
+ fingerprint: prepared.policyFingerprint,
314
+ },
315
+ evaluator: {
316
+ contractVersion: IMPACT_EVALUATOR_VERSION,
317
+ fingerprint: prepared.evaluatorFingerprint,
318
+ },
319
+ scope: {
320
+ fingerprint: prepared.scopeFingerprint,
321
+ knowledgeFingerprint: prepared.knowledgeFingerprint,
322
+ providerSetFingerprint: prepared.providerSetFingerprint,
323
+ },
324
+ },
325
+ files: completeFileEvidence(prepared),
326
+ requirementScopes: requirementScopes(prepared, snapshot),
327
+ residualReviewObligations: residualReviewObligations(prepared),
328
+ authorship: authoringContract(prepared),
329
+ };
330
+ }
331
+ function validateDiffInput(scope) {
332
+ if (scope.kind === "diff" &&
333
+ (!FULL_COMMIT_OID.test(scope.baseCommit) ||
334
+ !FULL_COMMIT_OID.test(scope.headCommit)))
335
+ throw new Error("Diff scope requires full lowercase hexadecimal baseCommit and headCommit object IDs");
336
+ }
337
+ export async function executePrepareImpactReview(input, context) {
338
+ validateDiffInput(input.scope);
339
+ const workspaceRoot = context.workspaceRoot;
340
+ const snapshot = input.scope.kind === "staged"
341
+ ? captureStagedSnapshot(workspaceRoot)
342
+ : captureDiffSnapshot(workspaceRoot, input.scope.baseCommit, input.scope.headCommit);
343
+ if (input.scope.kind === "diff")
344
+ assertExplicitDiffUnchanged(workspaceRoot, input.scope, snapshot);
345
+ const trustedConfig = readSnapshotSourceConfig(snapshot, snapshot.baseTree);
346
+ const providerSetFingerprint = fingerprintMaintenanceSourceSet(workspaceRoot, trustedConfig);
347
+ const evaluatorFingerprint = fingerprintImpactEvaluator();
348
+ const service = createMaintenanceSourceAnalysisService(workspaceRoot, trustedConfig);
349
+ const analyses = await analyzeSourceChanges(snapshot.inventory, service);
350
+ const prepared = prepareImpactReview(snapshot, {
351
+ providerSetFingerprint,
352
+ evaluatorFingerprint,
353
+ analyses,
354
+ });
355
+ // Build all KB-derived context before the final snapshot/closure checks.
356
+ // Projection can be substantial, so checking only before it could return
357
+ // evidence for a workspace or evaluator closure that changed mid-projection.
358
+ const data = buildPreparation(input.scope, snapshot, prepared);
359
+ snapshot.assertUnchanged();
360
+ if (input.scope.kind === "diff")
361
+ assertExplicitDiffUnchanged(workspaceRoot, input.scope, snapshot);
362
+ const finalProviderFingerprint = fingerprintMaintenanceSourceSet(workspaceRoot, trustedConfig);
363
+ const finalEvaluatorFingerprint = fingerprintImpactEvaluator();
364
+ if (finalProviderFingerprint !== providerSetFingerprint ||
365
+ finalEvaluatorFingerprint !== evaluatorFingerprint)
366
+ throw new Error("Trusted source-provider or impact-evaluator closure changed during impact review preparation");
367
+ snapshot.assertUnchanged();
368
+ if (input.scope.kind === "diff")
369
+ assertExplicitDiffUnchanged(workspaceRoot, input.scope, snapshot);
370
+ return {
371
+ content: [
372
+ {
373
+ type: "text",
374
+ text: `Prepared complete ${input.scope.kind} impact-review authoring inputs; every review decision remains unauthored.`,
375
+ },
376
+ ],
377
+ structuredContent: data,
378
+ };
379
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./catalog.js";
2
2
  export * from "./check-executor.js";
3
+ export * from "./impact-review-preparation.js";
3
4
  export * from "./discovery-entities.js";
4
5
  export * from "./discovery-executors.js";
5
6
  export * from "./runtime-types.js";
@@ -10,6 +11,7 @@ export * from "./migration-plan.js";
10
11
  export * from "./symbol-repair-plan.js";
11
12
  export * from "./specs/bootstrap.js";
12
13
  export * from "./specs/check.js";
14
+ export * from "./specs/impact-review-preparation.js";
13
15
  export * from "./specs/discovery.js";
14
16
  export * from "./specs/modeling.js";
15
17
  export * from "./specs/planning.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/operations/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cA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AqC,CAAC;AACzD,cAAc,mBAAmB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./catalog.js";
2
2
  export * from "./check-executor.js";
3
+ export * from "./impact-review-preparation.js";
3
4
  export * from "./discovery-entities.js";
4
5
  export * from "./discovery-executors.js";
5
6
  export * from "./runtime-types.js";
@@ -10,6 +11,7 @@ export * from "./migration-plan.js";
10
11
  export * from "./symbol-repair-plan.js";
11
12
  export * from "./specs/bootstrap.js";
12
13
  export * from "./specs/check.js";
14
+ export * from "./specs/impact-review-preparation.js";
13
15
  export * from "./specs/discovery.js";
14
16
  export * from "./specs/modeling.js";
15
17
  export * from "./specs/planning.js";
@@ -70,6 +70,8 @@ export declare function compareReadyActionIds(left: string, right: string, byId:
70
70
  export declare function buildMigrationPlan(input?: PlanInput): MigrationPlan;
71
71
  export declare function mergeMigrationPlans(plans: readonly MigrationPlan[]): MigrationPlan;
72
72
  export declare function migrationAction(input: Partial<MigrationAction> & Pick<MigrationAction, "id" | "code">): MigrationAction;
73
+ /** Migration code for mechanical predicate namespace/alias repairs. */
74
+ export declare const PREDICATE_SCHEMA_ALIGNMENT_CODE = "predicate_schema_alignment";
73
75
  export declare function buildActionsFromCheck(input: {
74
76
  violations?: readonly Readonly<Record<string, unknown>>[];
75
77
  qualityDiagnostics?: readonly Readonly<Record<string, unknown>>[];
@@ -1 +1 @@
1
- {"version":3,"file":"migration-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/migration-plan.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AAExE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAChF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC;IACP,IAA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9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,CAAC;AAEH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,GACpB,qBAAqB,CA8BvB;AAwBD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC5D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC,GAAG,aAAa,CA6MhB"}
@@ -197,6 +197,51 @@ function actionDefaults(input) {
197
197
  export function migrationAction(input) {
198
198
  return actionDefaults(input);
199
199
  }
200
+ /**
201
+ * A predicate-schema-conformance finding whose repair is mechanical (move to
202
+ * the only matching schema namespace, rewrite declared aliases) becomes an
203
+ * automatic action carrying the exact kb_upsert input, so it is reviewable in
204
+ * the plan and replayable through either surface.
205
+ */
206
+ // implements REQ-kibi-predicate-vocabulary-migration
207
+ function predicateSchemaAlignmentAction(diagnostic) {
208
+ if (diagnostic.id !== "rule.predicate-schema-conformance")
209
+ return null;
210
+ const evidence = isRecord(diagnostic.evidence) ? diagnostic.evidence : null;
211
+ const repair = evidence !== null && isRecord(evidence.repair) ? evidence.repair : null;
212
+ if (repair === null ||
213
+ repair.type !== "fact" ||
214
+ typeof repair.id !== "string" ||
215
+ !isRecord(repair.properties)) {
216
+ return null;
217
+ }
218
+ return migrationAction({
219
+ id: `predicate-schema-alignment-${repair.id}`,
220
+ code: PREDICATE_SCHEMA_ALIGNMENT_CODE,
221
+ category: "semantic",
222
+ safety: "automatic",
223
+ autoApplicable: true,
224
+ invocation: { kind: "operation", name: "kb_upsert", input: repair },
225
+ affectedEntityIds: [repair.id],
226
+ affectedFiles: typeof diagnostic.source === "string" ? [diagnostic.source] : [],
227
+ postconditions: [
228
+ {
229
+ rule: "predicate-schema-conformance",
230
+ entityId: repair.id,
231
+ findings: 0,
232
+ },
233
+ ],
234
+ evidence: {
235
+ issue: evidence?.issue,
236
+ namespace: evidence?.namespace,
237
+ alignment: evidence?.alignment,
238
+ rewrites: evidence?.rewrites,
239
+ },
240
+ });
241
+ }
242
+ /** Migration code for mechanical predicate namespace/alias repairs. */
243
+ export const PREDICATE_SCHEMA_ALIGNMENT_CODE = "predicate_schema_alignment";
244
+ // implements REQ-agent-guided-migration-orchestration, REQ-kibi-predicate-vocabulary-migration
200
245
  export function buildActionsFromCheck(input) {
201
246
  const actions = [];
202
247
  for (const [index, violation] of (input.violations ?? []).entries()) {
@@ -225,6 +270,11 @@ export function buildActionsFromCheck(input) {
225
270
  ? diagnostic.suggestion
226
271
  : "Review this quality diagnostic.";
227
272
  const blocking = diagnostic.blocking === true;
273
+ const predicateRepair = predicateSchemaAlignmentAction(diagnostic);
274
+ if (predicateRepair !== null) {
275
+ actions.push(predicateRepair);
276
+ continue;
277
+ }
228
278
  actions.push(migrationAction({
229
279
  id: `diagnostic-${id}-${entityId || "workspace"}-${index + 1}`,
230
280
  code: `quality_${id}`,
@@ -1 +1 @@
1
- {"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../../src/public/operations/node-ports.ts"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EAAE,MAAM,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,KACrB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACjC,CAAC;AA2JF,eAAO,MAAM,cAAc,EAAE,kBAoB5B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAiBrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAEzB,CAAC"}
@@ -6,6 +6,7 @@ import path from "node:path";
6
6
  import { promisify } from "node:util";
7
7
  import fg from "fast-glob";
8
8
  import { createRepoIgnorePolicy } from "../ignore-policy.js";
9
+ import { snapshotFileContent } from "./proof-receipt-projection.js";
9
10
  const execFileAsync = promisify(execFile);
10
11
  const SNAPSHOT_EXCLUDED_PREFIXES = [
11
12
  ".changeset/",
@@ -36,41 +37,6 @@ const ALWAYS_IGNORED_GLOBS = [
36
37
  function includedSnapshotPath(relativePath) {
37
38
  return !SNAPSHOT_EXCLUDED_PREFIXES.some((prefix) => relativePath === prefix.slice(0, -1) || relativePath.startsWith(prefix));
38
39
  }
39
- function withoutProofReceiptFrontmatter(content) {
40
- const lines = content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
41
- if (lines[0]?.trim() !== "---")
42
- return content;
43
- let inFrontmatter = true;
44
- let skippingReceipts = false;
45
- const retained = [];
46
- for (const [index, line] of lines.entries()) {
47
- const trimmed = line.trim();
48
- if (index > 0 && inFrontmatter && trimmed === "---") {
49
- inFrontmatter = false;
50
- skippingReceipts = false;
51
- retained.push(line);
52
- continue;
53
- }
54
- if (inFrontmatter && /^proof_receipts\s*:/.test(line)) {
55
- skippingReceipts = true;
56
- continue;
57
- }
58
- if (inFrontmatter &&
59
- skippingReceipts &&
60
- /^[A-Za-z_][A-Za-z0-9_-]*\s*:/.test(line)) {
61
- skippingReceipts = false;
62
- }
63
- if (!skippingReceipts)
64
- retained.push(line);
65
- }
66
- return retained.join("");
67
- }
68
- function snapshotFileContent(relativePath, content) {
69
- if (relativePath.endsWith(".md")) {
70
- return Buffer.from(withoutProofReceiptFrontmatter(content.toString("utf8")));
71
- }
72
- return content;
73
- }
74
40
  /**
75
41
  * A tracked markdown file whose only change is proof-receipt frontmatter
76
42
  * cannot alter the snapshot hash (receipts are stripped before hashing), so it
@@ -0,0 +1,41 @@
1
+ import { type ArgumentRewrite, type UndeclaredArgument } from "../../operations/modeling/predicate-vocabulary.js";
2
+ import type { Violation } from "../../utils/rule-registry.js";
3
+ import type { PrologPort } from "./runtime-types.js";
4
+ type Entity = Readonly<Record<string, unknown>>;
5
+ /**
6
+ * Exact kb_upsert input that repairs one predicate fact mechanically: move it
7
+ * to the only namespace whose schema matches, and/or replace alias spellings
8
+ * with their declared constants. Present only when nothing is left for review.
9
+ */
10
+ export type PredicateFactRepair = Readonly<{
11
+ type: "fact";
12
+ id: string;
13
+ properties: Readonly<Record<string, unknown>>;
14
+ }>;
15
+ export type PredicateConformanceEvidence = Readonly<{
16
+ factId: string;
17
+ predicateName: string;
18
+ namespace: string;
19
+ arity: number;
20
+ issue: "missing_schema" | "undeclared_constant" | "alias_in_use";
21
+ schemaId: string | null;
22
+ alignment: Readonly<{
23
+ namespace: string;
24
+ schemaId: string;
25
+ origin: "project_local" | "built_in";
26
+ }> | null;
27
+ candidateNamespaces: readonly string[];
28
+ rewrites: readonly ArgumentRewrite[];
29
+ undeclared: readonly UndeclaredArgument[];
30
+ repair: PredicateFactRepair | null;
31
+ }>;
32
+ /**
33
+ * Predicate facts must match a schema (project-local, or the built-in catalog
34
+ * in the default namespace) with the same namespace, name, and arity, and
35
+ * must use declared constants where the schema closes an argument.
36
+ */
37
+ export declare function evaluatePredicateSchemaConformance(facts: readonly Entity[]): Violation[];
38
+ /** Load every fact once and evaluate predicate conformance. */
39
+ export declare function collectPredicateSchemaConformanceViolations(prolog: Pick<PrologPort, "query">): Promise<Violation[]>;
40
+ export {};
41
+ //# sourceMappingURL=predicate-schema-conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicate-schema-conformance.d.ts","sour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