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
@@ -1,9 +1,18 @@
1
+ // implements REQ-kibi-operation-interface-parity
2
+ import { escapeAtom } from "../../prolog/codec.js";
3
+ import { entityIdStyleWarnings } from "../../utils/entity-id-style.js";
1
4
  import { analyzeSemanticAdvisorInput } from "../semantic-advisor/analyze-prose.js";
2
5
  import { assertLogicalGroundingClaimKeys, assertSemanticInventoryBoundary, validateSemanticInventoryBoundary, } from "../semantic-advisor/ingestion-boundary.js";
6
+ import { assertPredicateArgumentVocabulary } from "./predicate-vocabulary-guard.js";
3
7
  import { validateLiveRelationshipTargets, validateRelationshipSources, } from "./relationships.js";
4
8
  import { validateSymbolGranularity } from "./symbol-granularity.js";
5
9
  import { effectiveRelationships, validateAppendOnlyProofReceipts, } from "./upsert.js";
6
10
  import { validateUpsertInput } from "./validation.js";
11
+ // implements REQ-kibi-entity-id-style
12
+ async function entityExists(prolog, id) {
13
+ const result = await prolog.query(`once(kb_entity('${escapeAtom(id)}', _Type, _Props))`);
14
+ return result.success;
15
+ }
7
16
  export async function executeValidateUpsert(input, context) {
8
17
  try {
9
18
  const validated = validateUpsertInput(input, context.clock());
@@ -26,11 +35,25 @@ export async function executeValidateUpsert(input, context) {
26
35
  assertSemanticInventoryBoundary({ ...input, relationships }, relationships, semantic.receipt);
27
36
  if (context.prolog !== undefined) {
28
37
  await assertLogicalGroundingClaimKeys(context.prolog, { ...input, relationships }, relationships);
38
+ await assertPredicateArgumentVocabulary(context.prolog, validated.entity);
29
39
  }
40
+ // Style warnings apply only to entities this upsert would create, so the
41
+ // existence read happens only when the ID actually has a style issue.
42
+ const candidateIdStyleWarnings = entityIdStyleWarnings({
43
+ id: input.id,
44
+ sourcePath: typeof validated.entity.source === "string"
45
+ ? validated.entity.source
46
+ : undefined,
47
+ });
48
+ const idStyleWarnings = candidateIdStyleWarnings.length > 0 &&
49
+ context.prolog &&
50
+ !(await entityExists(context.prolog, input.id))
51
+ ? candidateIdStyleWarnings
52
+ : [];
30
53
  const payload = {
31
54
  valid: true,
32
55
  errors: [],
33
- warnings: semantic.warnings,
56
+ warnings: [...semantic.warnings, ...idStyleWarnings],
34
57
  semanticAdvisor: semantic.receipt,
35
58
  normalizedPreview: validated.entity,
36
59
  };
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAkF/D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,IAAI,GACR,eAAe,CA0DjB;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA6F/D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,IAAI,GACR,eAAe,CA4DjB;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -11,7 +11,19 @@ const schema = entitySchema;
11
11
  const properties = schema.properties !== null && typeof schema.properties === "object"
12
12
  ? schema.properties
13
13
  : {};
14
- const validateEntity = ajv.compile({
14
+ // Compiled on first mutation: every CLI command imports this module, and
15
+ // most never validate an upsert.
16
+ let entityValidator;
17
+ let relationshipValidator;
18
+ function entitySchemaValidator() {
19
+ entityValidator ??= ajv.compile(upsertEntitySchema);
20
+ return entityValidator;
21
+ }
22
+ function relationshipSchemaValidator() {
23
+ relationshipValidator ??= ajv.compile(relationshipSchema);
24
+ return relationshipValidator;
25
+ }
26
+ const upsertEntitySchema = {
15
27
  ...schema,
16
28
  properties: {
17
29
  ...properties,
@@ -27,8 +39,7 @@ const validateEntity = ajv.compile({
27
39
  },
28
40
  symbol_role: { type: "string", enum: [...SYMBOL_ROLES] },
29
41
  },
30
- });
31
- const validateRelationship = ajv.compile(relationshipSchema);
42
+ };
32
43
  const ALIASES = new Map([
33
44
  ["subjectKey", "subject_key"],
34
45
  ["propertyKey", "property_key"],
@@ -83,6 +94,7 @@ export function validateUpsertInput(input, now) {
83
94
  entity.created_at ??= now.toISOString();
84
95
  entity.updated_at ??= now.toISOString();
85
96
  entity.source ??= "mcp://kibi/upsert";
97
+ const validateEntity = entitySchemaValidator();
86
98
  if (!validateEntity(entity)) {
87
99
  throw new Error(`Entity validation failed: ${formatEntityErrors(entity, validateEntity.errors ?? [])}`);
88
100
  }
@@ -105,6 +117,7 @@ export function validateUpsertInput(input, now) {
105
117
  }
106
118
  }
107
119
  const relationships = input.relationships ?? [];
120
+ const validateRelationship = relationshipSchemaValidator();
108
121
  relationships.forEach((relationship, index) => {
109
122
  if (!validateRelationship(relationship)) {
110
123
  const details = (validateRelationship.errors ?? [])
@@ -1 +1 @@
1
- {"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/apply-plan.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAGjF,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,uBAAuB,CAAC;AAqB/B,OAAO,KAAK,EACV,aAAa,EACb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9E,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,IAAI,CAMN;AAED,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,EACnE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,IAAI,CAaN;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,SAAS,cAAoB,GAC5B,eAAe,EAAE,CA2CnB;AAm+CD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,eAAe,CAAC;CACpC,CAAC,CA2BD"}
@@ -1,18 +1,19 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- import { existsSync, realpathSync } from "node:fs";
3
2
  import path from "node:path";
4
3
  import { OperationError } from "../../cli-errors.js";
5
4
  import { branchEnsureCommand, branchMigrateCommand, branchRecoverCommand, } from "../../commands/branch.js";
6
5
  import { migrateCommand } from "../../commands/migrate.js";
7
6
  import { syncCommand } from "../../commands/sync.js";
7
+ import { loadEntities } from "../../public/operations/discovery-entities.js";
8
8
  import { executeStatus } from "../../public/operations/discovery-executors.js";
9
- import { migrationPlanHash, } from "../../public/operations/migration-plan.js";
9
+ import { PREDICATE_SCHEMA_ALIGNMENT_CODE, migrationPlanHash, } from "../../public/operations/migration-plan.js";
10
10
  import { readMigrationConfigStatus } from "../../public/operations/migration-plan.js";
11
11
  import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
12
+ import { canonicalFilesystemPath } from "../../utils/canonical-path.js";
12
13
  import { isDerivedKbPath } from "../../utils/kb-paths.js";
13
14
  import { bootstrapEmptyKbSnapshotId, bootstrapPlanHash, } from "../bootstrap/types.js";
14
15
  import { executeDelete } from "../mutation/delete.js";
15
- import { writePendingSourceReceipt } from "../mutation/source-authoring.js";
16
+ import { retirePendingSourceReceipt, writePendingSourceReceipt, } from "../mutation/source-authoring.js";
16
17
  import { executeUpsert } from "../mutation/upsert.js";
17
18
  import { acquireWorkspaceMutationLock, releaseWorkspaceMutationLock, } from "../mutation/workspace-mutation-lock.js";
18
19
  import { compilePlanHash, } from "./compile-intent.js";
@@ -37,6 +38,21 @@ function isRecord(value) {
37
38
  function digest(value) {
38
39
  return createHash("sha256").update(value).digest("hex");
39
40
  }
41
+ /**
42
+ * Reconcile pending-source receipts with committed source writes: a written
43
+ * file is bound to its exact bytes until Git tracks it, and a deleted file
44
+ * must not leave a receipt that later syncs would report as missing.
45
+ */
46
+ function reconcilePendingSourceReceipts(workspaceRoot, writes) {
47
+ for (const write of writes) {
48
+ if ((write.mode ?? "write") === "delete") {
49
+ retirePendingSourceReceipt(workspaceRoot, write.path);
50
+ }
51
+ else if (write.afterHash !== null) {
52
+ writePendingSourceReceipt(workspaceRoot, write.path, write.afterHash);
53
+ }
54
+ }
55
+ }
40
56
  function relationships(step) {
41
57
  if (!Array.isArray(step.relationships))
42
58
  return [];
@@ -356,11 +372,7 @@ async function applySourceWrites(context, writes, planHash, allowReplay = false,
356
372
  throw new Error(`MUTATION_ALREADY_COMMITTED: source plan ${planHash} already crossed the authoritative commit boundary; use kb_apply_plan recoveryJournalId=${journalId} instead of retrying the original mutation`);
357
373
  }
358
374
  onCommitted();
359
- for (const entry of prior.entries) {
360
- if (entry.mode === "write" && entry.afterHash !== null) {
361
- writePendingSourceReceipt(context.workspaceRoot, entry.path, entry.afterHash);
362
- }
363
- }
375
+ reconcilePendingSourceReceipts(context.workspaceRoot, prior.entries);
364
376
  return { paths: priorPaths, rollback: async () => undefined, journalId };
365
377
  }
366
378
  }
@@ -415,14 +427,10 @@ async function applySourceWrites(context, writes, planHash, allowReplay = false,
415
427
  if (workspaceRelative === ".kb" || isDerivedKbPath(workspaceRelative)) {
416
428
  throw new Error("Apply plan failed: sourceWrites.path cannot target Kibi's derived .kb runtime trees");
417
429
  }
418
- let existingPath = absolute;
419
- while (!existsSync(existingPath) &&
420
- path.dirname(existingPath) !== existingPath) {
421
- existingPath = path.dirname(existingPath);
422
- }
423
- const realExisting = realpathSync.native(existingPath);
424
- if (realExisting !== root &&
425
- !realExisting.startsWith(`${root}${path.sep}`)) {
430
+ const realRoot = canonicalFilesystemPath(root);
431
+ const realExisting = canonicalFilesystemPath(absolute);
432
+ if (realExisting !== realRoot &&
433
+ !realExisting.startsWith(`${realRoot}${path.sep}`)) {
426
434
  throw new Error(`Apply plan failed: sourceWrites.path follows a symlink outside the workspace: ${write.path}`);
427
435
  }
428
436
  const existing = await context.fs
@@ -518,11 +526,7 @@ async function applySourceWrites(context, writes, planHash, allowReplay = false,
518
526
  // A newly authored file is intentionally excluded from ordinary Git
519
527
  // discovery until the operator stages it. The receipt binds that pending
520
528
  // input to the exact bytes committed by this plan.
521
- for (const write of writes) {
522
- if ((write.mode ?? "write") === "write" && write.afterHash !== null) {
523
- writePendingSourceReceipt(context.workspaceRoot, write.path, write.afterHash);
524
- }
525
- }
529
+ reconcilePendingSourceReceipts(context.workspaceRoot, writes);
526
530
  }
527
531
  catch (error) {
528
532
  if (sourceCommitted) {
@@ -609,11 +613,7 @@ async function executeSourceRecovery(args, context, onCommitted = () => undefine
609
613
  });
610
614
  }
611
615
  const sourceWrites = await applySourceWrites(context, writes, journal.planHash, true, onCommitted);
612
- for (const write of writes) {
613
- if (write.mode === "write" && write.afterHash !== null) {
614
- writePendingSourceReceipt(context.workspaceRoot, write.path, write.afterHash);
615
- }
616
- }
616
+ reconcilePendingSourceReceipts(context.workspaceRoot, writes);
617
617
  const sync = await syncCommand({
618
618
  workspaceRoot: context.workspaceRoot,
619
619
  rebuild: true,
@@ -1272,6 +1272,7 @@ async function executeApplyPlanUnlocked(args, context, onCommitted = () => undef
1272
1272
  structuredContent: payload,
1273
1273
  };
1274
1274
  }
1275
+ // implements REQ-agent-guided-migration-orchestration, REQ-cli-canonical-runtime, REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-change-to-proof-plan-compiler, REQ-kibi-predicate-vocabulary-migration
1275
1276
  export async function executeApplyPlan(args, context) {
1276
1277
  if (!context.fs || context.sourceMutationLockHeld === true)
1277
1278
  return executeApplyPlanUnlocked(args, context);
@@ -1508,7 +1509,46 @@ async function applyMigrationAction(action, context) {
1508
1509
  throw new Error("Coordinate refresh did not complete successfully.");
1509
1510
  return;
1510
1511
  }
1512
+ case PREDICATE_SCHEMA_ALIGNMENT_CODE:
1513
+ await applyPredicateSchemaAlignment(action, context);
1514
+ return;
1511
1515
  default:
1512
1516
  throw new Error(`Migration action '${action.code}' has no automatic executor.`);
1513
1517
  }
1514
1518
  }
1519
+ /**
1520
+ * Replay the planned kb_upsert for one predicate fact after confirming the
1521
+ * fact still has the namespace and alias spellings the plan was built from.
1522
+ */
1523
+ // implements REQ-kibi-predicate-vocabulary-migration
1524
+ async function applyPredicateSchemaAlignment(action, context) {
1525
+ const invocation = action.invocation;
1526
+ if (invocation.kind !== "operation" || invocation.name !== "kb_upsert")
1527
+ throw new Error("Predicate schema alignment requires its planned kb_upsert invocation.");
1528
+ const input = asUpsert(invocation.input);
1529
+ if (input.type !== "fact")
1530
+ throw new Error("Predicate schema alignment only rewrites fact entities.");
1531
+ const prolog = context.prolog ?? (await context.ensureProlog?.());
1532
+ if (!prolog)
1533
+ throw new Error("Predicate schema alignment requires a Prolog runtime.");
1534
+ const operationContext = { ...context, prolog, sourceFirst: true };
1535
+ const [current] = await loadEntities(prolog, { type: "fact", id: input.id });
1536
+ const evidence = action.evidence;
1537
+ const currentNamespace = typeof current?.predicate_namespace === "string" &&
1538
+ current.predicate_namespace !== ""
1539
+ ? current.predicate_namespace
1540
+ : "default";
1541
+ const currentArgs = Array.isArray(current?.predicate_args)
1542
+ ? current.predicate_args
1543
+ : [];
1544
+ const rewrites = Array.isArray(evidence.rewrites) ? evidence.rewrites : [];
1545
+ const unchanged = current !== undefined &&
1546
+ current.fact_kind === "predicate" &&
1547
+ currentNamespace === evidence.namespace &&
1548
+ rewrites.every((rewrite) => isRecord(rewrite) &&
1549
+ typeof rewrite.index === "number" &&
1550
+ currentArgs[rewrite.index] === rewrite.from);
1551
+ if (!unchanged)
1552
+ throw new Error(`Predicate fact ${input.id} changed since planning; rerun kibi check and approve the new plan.`);
1553
+ await executeUpsert(input, operationContext);
1554
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAEV,2BAA2B,EAE5B,MAAM,8BAA8B,CAAC;AAGtC,eAAO,MAAM,oBAAoB,EAAG,sBAA+B,CAAC;AAGpE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,eAAe,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACzD,cAAc,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,UAAU,CAAC,EAAE,SAA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BACf,SAAS,EAAE,SAAS;oBAClB,QAAQ,EAAE,MAAM,CAAC;oBACjB,IAAI,EAAE,MAAM,CAAC;oBACb,UAAU,EAAE,MAAM,CAAC;iBACpB,EAAE,CAAC;aACL,EAAE,CAAC;SACL,CAAC,GAAG,IAAI,CAAC;QACV,QAAQ,EAAE,QAAQ,CAAC;YACjB,QAAQ,EAAE,OAAO,CAAC;YAClB,UAAU,EAAE,MAAM,CAAC;YACnB,gBAAgB,EAAE,MAAM,CAAC;YACzB,aAAa,EAAE,SAAS;gBACtB,MAAM,EAAE,MAAM,CAAC;gBACf,QAAQ,EAAE,MAAM,CAAC;gBACjB,aAAa,EAAE,MAAM,CAAC;gBACtB,UAAU,EAAE,MAAM,CAAC;aACpB,EAAE,CAAC;SACL,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AA0eH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,aAAa,CAAC;CAClC,CAAC,CAyWD"}
1
+ {"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAKhC,OAAO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OAAO,GAAG,QAAQ,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AA0eH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,aAAa,CAAC;CAClC,CAAC,CA4WD"}
@@ -446,7 +446,9 @@ export async function executeCompileIntent(args, context) {
446
446
  diagnostics.push("Update target is unresolved: supply requirementId or improve the top candidate score and margin.");
447
447
  }
448
448
  }
449
- if (args.mode === "create")
449
+ // A caller-chosen ID names the requirement by what it governs and wins;
450
+ // the content-hash ID is only a fallback when none is supplied.
451
+ if (args.mode === "create" && !explicitId)
450
452
  requirementId = generatedRequirementId(intent);
451
453
  if (!requirementId)
452
454
  throw new Error("Compile intent failed: could not determine requirementId");
@@ -0,0 +1,17 @@
1
+ import type { PrologPort } from "../../public/operations/runtime-types.js";
2
+ /**
3
+ * Which symbols a proof receipt's per-contract binding covers. Receipt ingest
4
+ * (which writes `binding_hash`) and coverage (which checks it) must derive
5
+ * the same set, so both go through this module:
6
+ *
7
+ * - the contract's required proof symbols (the test's own executable code),
8
+ * - any symbols the test declares in `proof_bindings`,
9
+ * - every production symbol linked `covered_by` this test.
10
+ *
11
+ * Editing any of those symbols' source files changes the binding hash, so the
12
+ * receipt goes stale until the test is proven again on the new code.
13
+ */
14
+ export declare function receiptCodeScopeSymbolIds(contract: unknown, bindings: unknown, coveredBySymbols: readonly string[]): string[];
15
+ /** Map each test id to the symbols linked `covered_by` it, in one query. */
16
+ export declare function loadCoveredBySymbolsByTest(prolog: Pick<PrologPort, "query">): Promise<ReadonlyMap<string, readonly string[]>>;
17
+ //# sourceMappingURL=code-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-scope.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-scope.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;GAWG;AAEH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,EAAE,SAAS,MAAM,EAAE,GAClC,MAAM,EAAE,CAoBV;AAED,4EAA4E;AAE5E,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAiBjD"}
@@ -0,0 +1,60 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+ */
10
+ import { normalizeEntityId, parseTriples } from "../../prolog/codec.js";
11
+ /**
12
+ * Which symbols a proof receipt's per-contract binding covers. Receipt ingest
13
+ * (which writes `binding_hash`) and coverage (which checks it) must derive
14
+ * the same set, so both go through this module:
15
+ *
16
+ * - the contract's required proof symbols (the test's own executable code),
17
+ * - any symbols the test declares in `proof_bindings`,
18
+ * - every production symbol linked `covered_by` this test.
19
+ *
20
+ * Editing any of those symbols' source files changes the binding hash, so the
21
+ * receipt goes stale until the test is proven again on the new code.
22
+ */
23
+ // implements REQ-kibi-verification-evidence-contract
24
+ export function receiptCodeScopeSymbolIds(contract, bindings, coveredBySymbols) {
25
+ const ids = new Set();
26
+ const requiredProofs = contract !== null &&
27
+ typeof contract === "object" &&
28
+ Array.isArray(contract.required_proofs)
29
+ ? contract.required_proofs
30
+ : [];
31
+ for (const entry of [
32
+ ...requiredProofs,
33
+ ...(Array.isArray(bindings) ? bindings : []),
34
+ ]) {
35
+ const symbolId = entry !== null && typeof entry === "object"
36
+ ? entry.symbol_id
37
+ : undefined;
38
+ if (typeof symbolId === "string" && symbolId !== "")
39
+ ids.add(symbolId);
40
+ }
41
+ for (const symbolId of coveredBySymbols)
42
+ ids.add(symbolId);
43
+ return [...ids].sort();
44
+ }
45
+ /** Map each test id to the symbols linked `covered_by` it, in one query. */
46
+ // implements REQ-kibi-verification-evidence-contract
47
+ export async function loadCoveredBySymbolsByTest(prolog) {
48
+ const result = await prolog.query("findall([From,To,'covered_by'], kb_relationship(covered_by, From, To), Rels)");
49
+ if (!result.success) {
50
+ throw new Error(`covered_by relationship query failed: ${result.error ?? "Unknown error"}`);
51
+ }
52
+ const byTest = new Map();
53
+ for (const [rawFrom, rawTo] of parseTriples(result.bindings.Rels ?? "[]")) {
54
+ const testId = normalizeEntityId(rawTo);
55
+ const symbols = byTest.get(testId) ?? [];
56
+ symbols.push(normalizeEntityId(rawFrom));
57
+ byTest.set(testId, symbols);
58
+ }
59
+ return byTest;
60
+ }
@@ -24,11 +24,13 @@ export type IngestProofResult = Readonly<{
24
24
  unchanged: number;
25
25
  results: readonly IngestProofTestResult[];
26
26
  }>;
27
- export declare function executeIngestProof(args: IngestProofArgs, context: OperationContext): Promise<{
27
+ type IngestProofOutput = {
28
28
  content: Array<{
29
29
  type: "text";
30
30
  text: string;
31
31
  }>;
32
32
  structuredContent: IngestProofResult;
33
- }>;
33
+ };
34
+ export declare function executeIngestProof(args: IngestProofArgs, context: OperationContext): Promise<IngestProofOutput>;
35
+ export {};
34
36
  //# sourceMappingURL=ingest-proof.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ingest-proof.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/ingest-proof.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EAEd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