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,49 @@
1
+ import { analyzeSourceChanges } from "../plugins/source-change-analysis.js";
2
+ import { evaluateImpactReview, loadBaseImpactPolicy, } from "./impact-evaluator.js";
3
+ /** Authorize lexical coordinate migration only from a captured local staged review.
4
+ * Protected PR hosts must use their target-base evaluator, not this HEAD policy. */
5
+ export function createReviewedDecoratorCoordinateVerifier(snapshot, service, bindings) {
6
+ if (process.env.CI)
7
+ throw new Error("Reviewed partial coordinate migration is unavailable in CI without a protected target-base snapshot");
8
+ const policy = loadBaseImpactPolicy(snapshot);
9
+ let reviewValidation;
10
+ return async (path, analysis) => {
11
+ snapshot.assertUnchanged();
12
+ if (analysis.status !== "partial" ||
13
+ analysis.language !== "python" ||
14
+ analysis.sourceFile !== path ||
15
+ analysis.module.analysisMode !== "parser" ||
16
+ analysis.stamp?.pluginId !== "kibi-plugin-treesitter" ||
17
+ analysis.uncoveredRanges.length === 0 ||
18
+ analysis.providerId !== "kibi-plugin-treesitter.tree-sitter.v2" ||
19
+ analysis.diagnostics.length === 0 ||
20
+ analysis.providerFingerprint === null ||
21
+ !analysis.diagnostics.every((diagnostic) => diagnostic.code === "TREESITTER_DECORATOR_EXPANSION_UNAVAILABLE" &&
22
+ policy.allowedPartial.some((allowed) => allowed.providerId === analysis.providerId &&
23
+ allowed.providerFingerprint ===
24
+ `sha256:${analysis.providerFingerprint}` &&
25
+ allowed.diagnosticCode === diagnostic.code &&
26
+ allowed.limitationClass === "python-decorator-expansion")))
27
+ throw new Error(`Decorator coordinates for ${path} are not allowed by the captured base policy`);
28
+ reviewValidation ??= (async () => {
29
+ const analyses = await analyzeSourceChanges(snapshot.inventory, service);
30
+ // Use the same host normalization as staged check, without changing the
31
+ // original captured inventory used by the generated-byte comparison.
32
+ const evaluatedSnapshot = {
33
+ ...snapshot,
34
+ inventory: snapshot.inventory.map((file) => analyses.get(file.path)?.after?.status === "ok"
35
+ ? { ...file, analysisDepth: "symbol", disposition: "checked" }
36
+ : { ...file }),
37
+ };
38
+ const result = evaluateImpactReview(evaluatedSnapshot, {
39
+ ...bindings,
40
+ analyses,
41
+ });
42
+ if (!result.passed)
43
+ throw new Error(`Reviewed coordinate migration failed: ${result.diagnostics.map((diagnostic) => diagnostic.message).join("; ")}`);
44
+ snapshot.assertUnchanged();
45
+ })();
46
+ await reviewValidation;
47
+ snapshot.assertUnchanged();
48
+ };
49
+ }
@@ -0,0 +1,4 @@
1
+ import { type ExtractionResult } from "../extractors/markdown.js";
2
+ /** Compile authored knowledge from regular blobs of one immutable Git tree. */
3
+ export declare function readSnapshotKnowledge(readGit: (args: readonly string[]) => Buffer, tree: string, readBlobs?: (oids: readonly string[]) => ReadonlyMap<string, Buffer>): ExtractionResult[];
4
+ //# sourceMappingURL=snapshot-knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-knowledge.d.ts","sourceRoot":"","sources":["../../src/traceability/snapshot-knowledge.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,2BAA2B,CAAC;AAKnC,+EAA+E;AAE/E,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,EAC5C,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnE,gBAAgB,EAAE,CAyGpB"}
@@ -0,0 +1,98 @@
1
+ import { load as parseYaml } from "js-yaml";
2
+ import { extractFromManifestString } from "../extractors/manifest.js";
3
+ import { extractFromMarkdownString, } from "../extractors/markdown.js";
4
+ import { convertRecordToRelationship } from "../extractors/relationships.js";
5
+ import { isEntityLanePath } from "../utils/kb-paths.js";
6
+ /** Compile authored knowledge from regular blobs of one immutable Git tree. */
7
+ // implements REQ-014
8
+ export function readSnapshotKnowledge(readGit, tree, readBlobs) {
9
+ const entries = readGit(["ls-tree", "-r", "-z", tree, "--", ".kb"])
10
+ .toString("utf8")
11
+ .split("\0")
12
+ .filter(Boolean);
13
+ const authored = entries.filter((entry) => {
14
+ const file = entry.slice(entry.indexOf("\t") + 1);
15
+ return (file === ".kb/symbols.yaml" ||
16
+ file === ".kb/symbols.yml" ||
17
+ (isEntityLanePath(file) && file.endsWith(".md")) ||
18
+ (file.startsWith(".kb/relationships/") && /\.ya?ml$/.test(file)));
19
+ });
20
+ const blobs = readBlobs?.(authored.map((entry) => entry.slice(0, entry.indexOf("\t")).split(" ")[2] ?? ""));
21
+ const results = [];
22
+ const relationships = [];
23
+ for (const entry of authored) {
24
+ const tab = entry.indexOf("\t");
25
+ const metadata = entry.slice(0, tab).split(" ");
26
+ const file = entry.slice(tab + 1);
27
+ const isManifest = file === ".kb/symbols.yaml" || file === ".kb/symbols.yml";
28
+ const isEntity = isEntityLanePath(file) && file.endsWith(".md");
29
+ const isShard = file.startsWith(".kb/relationships/") && /\.ya?ml$/.test(file);
30
+ if (!isManifest && !isEntity && !isShard)
31
+ continue;
32
+ if (metadata[1] !== "blob" ||
33
+ !["100644", "100755"].includes(metadata[0] ?? ""))
34
+ throw new Error(`Snapshot knowledge must be a regular file: ${file}`);
35
+ const oid = metadata[2];
36
+ if (!oid)
37
+ throw new Error(`Missing snapshot object ID: ${file}`);
38
+ const content = new TextDecoder("utf-8", { fatal: true }).decode(blobs?.get(oid) ?? readGit(["cat-file", "blob", oid]));
39
+ if (isManifest)
40
+ results.push(...extractFromManifestString(content, file));
41
+ else if (isEntity) {
42
+ if (/^---\r?\n/.test(content))
43
+ results.push(extractFromMarkdownString(content, file));
44
+ }
45
+ else {
46
+ const parsed = parseYaml(content);
47
+ if (!parsed || !Array.isArray(parsed.relationships))
48
+ throw new Error(`Invalid snapshot relationship shard: ${file}`);
49
+ for (const row of parsed.relationships) {
50
+ if (!row ||
51
+ typeof row !== "object" ||
52
+ typeof row.type !== "string" ||
53
+ typeof row.from !== "string" ||
54
+ typeof row.to !== "string")
55
+ throw new Error(`Invalid snapshot relationship in ${file}`);
56
+ relationships.push(row);
57
+ }
58
+ }
59
+ }
60
+ const byId = new Map();
61
+ const duplicates = new Map();
62
+ for (const result of results) {
63
+ const previous = byId.get(result.entity.id);
64
+ if (previous) {
65
+ const declarations = duplicates.get(result.entity.id) ?? [previous];
66
+ declarations.push(result);
67
+ duplicates.set(result.entity.id, declarations);
68
+ }
69
+ else
70
+ byId.set(result.entity.id, result);
71
+ }
72
+ if (duplicates.size > 0)
73
+ throw new Error(`Duplicate snapshot entities: ${JSON.stringify([...duplicates].map(([id, declarations]) => ({
74
+ id,
75
+ declarations: declarations.map((row) => ({
76
+ title: row.entity.title,
77
+ status: row.entity.status,
78
+ source: row.entity.source,
79
+ sourceFile: row.sourceFile,
80
+ })),
81
+ })))}`);
82
+ for (const row of relationships) {
83
+ const relation = convertRecordToRelationship(row);
84
+ if (!relation)
85
+ continue;
86
+ const owner = byId.get(relation.from);
87
+ if (!owner || !byId.has(relation.to))
88
+ throw new Error(`Snapshot relationship has a missing endpoint: ${relation.from} -> ${relation.to}`);
89
+ owner.relationships.push(relation);
90
+ }
91
+ for (const result of results) {
92
+ for (const relation of result.relationships) {
93
+ if (!byId.has(relation.from) || !byId.has(relation.to))
94
+ throw new Error(`Snapshot relationship has a missing endpoint: ${relation.from} -> ${relation.to}`);
95
+ }
96
+ }
97
+ return results;
98
+ }
@@ -1,6 +1,6 @@
1
1
  import type { QualityDiagnostic } from "../public/impact/types.js";
2
2
  import { type KibiImpactEvidence } from "./evidence-model.js";
3
- export type KibiImpactDiagnosticId = "kibi_impact_evidence_missing" | "symbols_manifest_stale" | "symbol_granularity_violation" | "symbol_semantic_review_needed" | "multi_requirement_symbol_review" | "duplicate_symbol_coordinate_review" | "component_mixed_purpose_review" | "broad_requirement_review" | "requirement_status_review" | "strict_fact_modeling_review" | "logical_coverage_review" | "kibi_impact_override_missing_rationale";
3
+ export type KibiImpactDiagnosticId = "kibi_impact_evidence_missing" | "symbols_manifest_stale" | "symbol_granularity_violation" | "symbol_semantic_review_needed" | "multi_requirement_symbol_review" | "duplicate_symbol_coordinate_review" | "component_mixed_purpose_review" | "broad_requirement_review" | "requirement_status_review" | "strict_fact_modeling_review" | "logical_coverage_review" | "kibi_impact_override_missing_rationale" | "entity_id_style_review";
4
4
  export interface KibiImpactDiagnostic extends QualityDiagnostic {
5
5
  /** Stable staged-enforcement diagnostic identifier. */
6
6
  id: KibiImpactDiagnosticId;
@@ -1 +1 @@
1
- {"version":3,"file":"staged-diagnostics.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAGL,KAAK,kBAAkB,EAKxB,MAAM,qBAAqB,CAAC;AAQ7B,MAAM,MAAM,sBAAsB,GAC9B,8BAA8B,GAC9B,wBAAwB,GACxB,8BAA8B,GAC9B,+BAA+B,GAC/B,iCAAiC,GACjC,oCAAoC,GACpC,gCAAgC,GAChC,0BAA0B,GAC1B,2BAA2B,GAC3B,6BAA6B,GAC7B,yBAAyB,GACzB,wCAAwC,CAAC;AAE7C,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,uDAAuD;IACvD,EAAE,EAAE,sBAAsB,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,iEAAiE;IACjE,KAAK,EAAE,S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B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAwID,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,kBAAkB,GAC3B,oBAAoB,CAoBtB;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,EAC5B,mBAAmB,GAAE,MAAmC,GACvD,oBAAoB,EAAE,CAiDxB"}
@@ -0,0 +1,12 @@
1
+ import type { StagedFile } from "./git-staged.js";
2
+ import type { KibiImpactDiagnostic } from "./staged-diagnostics.js";
3
+ /**
4
+ * Naming-style review for entity Markdown that this commit introduces.
5
+ *
6
+ * Only added or renamed files are evaluated: a staged edit to a committed
7
+ * legacy entity such as `REQ-003.md` is never reported, so the legacy numbered
8
+ * lanes stay grandfathered without a cutoff date or history lookup. The
9
+ * diagnostics are advisory and never block a commit.
10
+ */
11
+ export declare function createStagedEntityIdStyleDiagnostics(stagedFiles: readonly StagedFile[]): KibiImpactDiagnostic[];
12
+ //# sourceMappingURL=staged-entity-id-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staged-entity-id-style.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-entity-id-style.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;;GAOG;AAEH,wBAAgB,oCAAoC,CAClD,WAAW,EAAE,SAAS,UAAU,EAAE,GACjC,oBAAoB,EAAE,CAuBxB"}
@@ -0,0 +1,68 @@
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
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ import { extractFromMarkdownString } from "../extractors/markdown.js";
19
+ import { entityIdStyleIssues } from "../utils/entity-id-style.js";
20
+ import { isEntityLanePath } from "../utils/kb-paths.js";
21
+ /**
22
+ * Naming-style review for entity Markdown that this commit introduces.
23
+ *
24
+ * Only added or renamed files are evaluated: a staged edit to a committed
25
+ * legacy entity such as `REQ-003.md` is never reported, so the legacy numbered
26
+ * lanes stay grandfathered without a cutoff date or history lookup. The
27
+ * diagnostics are advisory and never block a commit.
28
+ */
29
+ // implements REQ-kibi-entity-id-style
30
+ export function createStagedEntityIdStyleDiagnostics(stagedFiles) {
31
+ const diagnostics = [];
32
+ for (const file of stagedFiles) {
33
+ if (file.status !== "A" && file.status !== "R")
34
+ continue;
35
+ if (!file.path.endsWith(".md") || !isEntityLanePath(file.path))
36
+ continue;
37
+ const id = readEntityId(file);
38
+ if (id === undefined)
39
+ continue;
40
+ for (const issue of entityIdStyleIssues({ id, sourcePath: file.path })) {
41
+ diagnostics.push({
42
+ id: "entity_id_style_review",
43
+ severity: "warning",
44
+ blocking: false,
45
+ category: "naming",
46
+ entityId: id,
47
+ source: file.path,
48
+ files: [file.path],
49
+ docs: ["docs/entity-schema.md"],
50
+ message: issue.message,
51
+ suggestion: issue.suggestion,
52
+ });
53
+ }
54
+ }
55
+ return diagnostics;
56
+ }
57
+ function readEntityId(file) {
58
+ if (file.content === undefined)
59
+ return undefined;
60
+ try {
61
+ const id = extractFromMarkdownString(file.content, file.path).entity.id;
62
+ return typeof id === "string" && id.trim() !== "" ? id.trim() : undefined;
63
+ }
64
+ catch {
65
+ // Frontmatter errors are reported by staged Markdown validation.
66
+ return undefined;
67
+ }
68
+ }
@@ -10,6 +10,24 @@ export interface StagedFileCoverageRecord {
10
10
  requirementIds: string[];
11
11
  evidencePaths: string[];
12
12
  providerId: string | null;
13
+ sourceAnalysis?: {
14
+ before: {
15
+ status: string;
16
+ language: string;
17
+ symbolCount: number;
18
+ providerId: string | null;
19
+ inputFingerprint: string;
20
+ providerFingerprint: string | null;
21
+ } | null;
22
+ after: {
23
+ status: string;
24
+ language: string;
25
+ symbolCount: number;
26
+ providerId: string | null;
27
+ inputFingerprint: string;
28
+ providerFingerprint: string | null;
29
+ } | null;
30
+ };
13
31
  }
14
32
  export interface StagedFileCoverageDiagnostic {
15
33
  id: "staged_file_ownership_missing" | "staged_file_impact_review_needed";
@@ -23,6 +41,11 @@ export interface StagedFileCoverageDiagnostic {
23
41
  }
24
42
  export interface StagedFileCoverageResult {
25
43
  version: typeof STAGED_FILE_COVERAGE_RESULT_VERSION;
44
+ snapshot?: {
45
+ baseTree: string;
46
+ headTree: string;
47
+ headCommit: string | null;
48
+ };
26
49
  files: StagedFileCoverageRecord[];
27
50
  diagnostics: StagedFileCoverageDiagnostic[];
28
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"staged-file-coverage.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-file-coverage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAO,MAAM,mCAAmC,EAC9C,8BAAuC,CAAC;AAE1C,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC7B,aAAa,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IAC3C,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAClC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAA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KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,CAAC;AA+OrD,2FAA2F;AAC3F,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,UAAU,EAAE,EAChC,MAAM,GAAE,SAA4B,GACnC,wBAAwB,CA0G1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"staged-impact-contract.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-impact-contract.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,0BAA0B,+GAI7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAC9B,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,CAAC;AAExB,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,sBAAsB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B,EAAE,OAAO,CAAC;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,sBAAsB,EACtB,4BAA4B,CA6B7B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,uBAAuB,GAC7B,sBAAsB,GAAG,IAAI,CAsB/B;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,GACX,wBAAwB,CAS1B;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAMT;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CA8B5E;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQvE"}
1
+ {"version":3,"file":"staged-impact-contract.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-impact-contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,+GAI7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAC9B,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,CAAC;AAExB,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,sBAAsB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B,EAAE,OAAO,CAAC;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,sBAAsB,EACtB,4BAA4B,CA6B7B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,uBAAuB,GAC7B,sBAAsB,GAAG,IAAI,CAsB/B;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,GACX,wBAAwB,CAS1B;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAMT;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CA8B5E;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEvE"}
@@ -1,14 +1,5 @@
1
+ import { isTsJsSourcePath } from "../plugins/source-classification.js";
1
2
  import { isEntityLanePath, isSymbolsManifestPath } from "../utils/kb-paths.js";
2
- const SUPPORTED_BEHAVIOR_SOURCE_EXTENSIONS = new Set([
3
- ".ts",
4
- ".tsx",
5
- ".js",
6
- ".jsx",
7
- ".mts",
8
- ".cts",
9
- ".mjs",
10
- ".cjs",
11
- ]);
12
3
  export const KIBI_IMPACT_DIAGNOSTIC_IDS = [
13
4
  "kibi_impact_evidence_missing",
14
5
  "symbols_manifest_stale",
@@ -118,12 +109,7 @@ export function isBehaviorSourceEdit(input) {
118
109
  return true;
119
110
  }
120
111
  export function isSupportedBehaviorSourcePath(filePath) {
121
- for (const extension of SUPPORTED_BEHAVIOR_SOURCE_EXTENSIONS) {
122
- if (filePath.endsWith(extension)) {
123
- return true;
124
- }
125
- }
126
- return false;
112
+ return isTsJsSourcePath(filePath);
127
113
  }
128
114
  function isEntityEvidenceMarkdown(filePath) {
129
115
  if (!filePath.endsWith(".md")) {
@@ -1,3 +1,4 @@
1
+ import type { SourceAnalysisResult } from "kibi-plugin-sdk";
1
2
  import { type ParsedCoordinateArtifact } from "../extractors/symbol-coordinates.js";
2
3
  import type { KibiImpactSymbolsManifestFileDetail } from "./evidence-model.js";
3
4
  import type { StagedFile } from "./git-staged.js";
@@ -29,9 +30,12 @@ export declare function assessStagedSymbolsManifest(options: {
29
30
  symbolsManifestPath: string;
30
31
  sourceFiles: StagedFile[];
31
32
  stagedFiles: StagedFile[];
33
+ readBaseFile?: (filePath: string) => string | null;
34
+ analyzeSource?: (filePath: string, content: string) => SourceAnalysisResult;
32
35
  }): StagedSymbolsManifestAssessment;
33
36
  export declare function collectStagedAuthoredSymbolsManifestEvidence(options: {
34
37
  sourceFiles: StagedFile[];
35
38
  stagedFiles: StagedFile[];
39
+ readBaseFile?: (filePath: string) => string | null;
36
40
  }): StagedAuthoredSymbolsManifestEvidence;
37
41
  //# sourceMappingURL=staged-symbols-manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"staged-symbols-manifest.d.ts","sourceRoot":"","sources":["../../src/traceability/staged-symbols-manifest.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,wBAAwB,EAG9B,MAAM,qCAAqC,CAAC;AAI7C,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0ClD,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,cAAc,CAAC;IACtD,WAAW,EAAE,MAAM,EAAE,CA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
@@ -215,11 +215,18 @@ function getChangedAuthoredEntityIds(headSymbols, stagedSymbols) {
215
215
  });
216
216
  return uniqueSorted(changedIds);
217
217
  }
218
- function normalizeExpectedSymbolsForStagedFile(stagedFile) {
219
- const analysis = analyzeSourceText(stagedFile.path, stagedFile.content ?? "");
218
+ function normalizeExpectedSymbolsForStagedFile(stagedFile, analyze, authoredTitles = new Set()) {
219
+ const analysis = (analyze ?? analyzeSourceText)(stagedFile.path, stagedFile.content ?? "");
220
220
  return analysis.symbols
221
221
  .map((symbol) => ({
222
- title: symbol.name,
222
+ title: (() => {
223
+ const qualified = symbol.qualifiedName;
224
+ if (!qualified ||
225
+ (authoredTitles.has(symbol.name) &&
226
+ analysis.symbols.filter((candidate) => candidate.name === symbol.name).length === 1))
227
+ return symbol.name;
228
+ return qualified;
229
+ })(),
223
230
  sourceFile: stagedFile.path,
224
231
  sourceLine: symbol.startLine,
225
232
  sourceColumn: symbol.startColumn,
@@ -290,7 +297,9 @@ export function assessStagedSymbolsManifest(options) {
290
297
  // assess several commits in the same checkout; a process-global cache would
291
298
  // otherwise reuse content from the previous HEAD.
292
299
  const headFileContentCache = new Map();
293
- const readAssessmentHeadFileContent = (filePath) => readHeadFileContent(filePath, headFileContentCache);
300
+ const readAssessmentHeadFileContent = (filePath) => options.readBaseFile
301
+ ? options.readBaseFile(filePath)
302
+ : readHeadFileContent(filePath, headFileContentCache);
294
303
  const headManifestRecords = parseManifestRecords(readAssessmentHeadFileContent(paths.symbolsPath), paths.symbolsPath);
295
304
  const headCoordinateArtifact = parseCoordinateArtifact(readAssessmentHeadFileContent(paths.coordinatesPath));
296
305
  const { stagedCoordinatesFile, stagedCoordinateArtifact, stagedManifestRecords, } = getEffectiveManifestRecords({
@@ -342,7 +351,7 @@ export function assessStagedSymbolsManifest(options) {
342
351
  const coarseTitles = new Set([...recordsByTitle.entries()]
343
352
  .filter(([, records]) => records.every(isDocumentedCoarseRecord))
344
353
  .map(([title]) => title));
345
- const expectedSymbols = normalizeExpectedSymbolsForStagedFile(sourceFile).filter((symbol) => !coarseTitles.has(symbol.title));
354
+ const expectedSymbols = normalizeExpectedSymbolsForStagedFile(sourceFile, options.analyzeSource, new Set(recordsByTitle.keys())).filter((symbol) => !coarseTitles.has(symbol.title));
346
355
  const baselineSymbols = normalizeManifestSymbolsForSourceFile(baselineMergedRecords, sourceFile.path);
347
356
  if (signaturesEqual(expectedSymbols, baselineSymbols)) {
348
357
  continue;
@@ -406,7 +415,9 @@ export function collectStagedAuthoredSymbolsManifestEvidence(options) {
406
415
  if (!stagedManifestFile) {
407
416
  return { path: paths.symbolsPath, entries: [], changedEntityIds: [] };
408
417
  }
409
- const headManifestRecords = parseManifestRecords(readHeadFileContent(paths.symbolsPath), paths.symbolsPath) ?? [];
418
+ const headManifestRecords = parseManifestRecords(options.readBaseFile
419
+ ? options.readBaseFile(paths.symbolsPath)
420
+ : readHeadFileContent(paths.symbolsPath), paths.symbolsPath) ?? [];
410
421
  const stagedManifestRecords = parseManifestRecords(stagedManifestFile.content, paths.symbolsPath);
411
422
  if (stagedManifestRecords === null) {
412
423
  return { path: paths.symbolsPath, entries: [], changedEntityIds: [] };
@@ -4,6 +4,7 @@ import { type SymbolKind, type SymbolRole } from "../public/symbol-granularity.j
4
4
  import type { HunkRange, StagedFile } from "./git-staged.js";
5
5
  type SourceAnalysisResult = SdkSourceAnalysisResult & {
6
6
  providerId?: string | null;
7
+ status?: "ok" | "partial" | "unsupported" | "failed";
7
8
  };
8
9
  type TraceabilityRelationship = {
9
10
  type: string;
@@ -38,11 +39,8 @@ export type ExtractSymbolsOptions = Readonly<{
38
39
  }>;
39
40
  export declare function extractSymbolsFromStagedFile(stagedFile: StagedFile, manifestLookup?: ManifestLookup, options?: ExtractSymbolsOptions): ExtractedSymbol[];
40
41
  /**
41
- * Async staged symbol extraction. Defaults to deterministic builtin analysis.
42
- * Pass an explicit `registry` only from allowlisted async surfaces that compose
43
- * replace/augment/shadow (e.g. symbol repair). Maintenance paths (`check`,
44
- * impact, sync, status, proof) must omit `registry` so external extractors
45
- * never participate.
42
+ * Async extraction from supplied snapshot bytes. Maintenance callers inject the
43
+ * shared, host-approved v2 analysis; legacy direct callers retain v1 behavior.
46
44
  */
47
45
  export declare function extractSymbolsFromStagedFileAsync(stagedFile: StagedFile, manifestLookup: ManifestLookup | undefined, options: ExtractSymbolsOptions & Readonly<{
48
46
  registry?: import("../plugins/registry.js").CapabilityRegistry;
@@ -1 +1 @@
1
- {"version":3,"file":"symbol-extract.d.ts","sourceRoot":"","sources":["../../src/traceability/symbol-extract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,IAAI,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EAEL,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EAEhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7D,KAAK,oBAAoB,GAAG,uBAAuB,GAAG;IACpD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAU7D,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAC5C;AAED,MA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AAC,EAAE,cAAc,EAC/B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,eAAe,EAAE,CAkCnB;AAED;;;GAGG;AAEH,wBAAsB,iCAAiC,CACrD,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,GAAG,SAAS,EAC1C,OAAO,EAAE,qBAAqB,GAC5B,QAAQ,CAAC;IACP,QAAQ,CAAC,EAAE,OAAO,wBAAwB,EAAE,kBAAkB,CAAC;CAChE,CAAC,GACH,OAAO,CAAC,eAAe,EAAE,CAAC,CAuB5B;AA0DD,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -51,7 +51,8 @@ function resolveSymbolTraceability(filePath, name, manifestLookup) {
51
51
  }
52
52
  const candidateManifestPaths = getCandidateManifestPaths(filePath);
53
53
  if (manifestLookup &&
54
- candidateManifestPaths.some((manifestPath) => manifestLookup.has(createManifestLookupSentinelKey(manifestPath)))) {
54
+ (manifestLookup.has(createManifestLookupSentinelKey(".kb/symbols.yaml")) ||
55
+ candidateManifestPaths.some((manifestPath) => manifestLookup.has(createManifestLookupSentinelKey(manifestPath))))) {
55
56
  return { id: createHashFallbackId(filePath, name) };
56
57
  }
57
58
  for (const manifestPath of candidateManifestPaths) {
@@ -193,52 +194,52 @@ stagedFile, manifestLookup, options) {
193
194
  return symbolsFromAnalysis(stagedFile, cached.result, manifestLookup);
194
195
  }
195
196
  /**
196
- * Async staged symbol extraction. Defaults to deterministic builtin analysis.
197
- * Pass an explicit `registry` only from allowlisted async surfaces that compose
198
- * replace/augment/shadow (e.g. symbol repair). Maintenance paths (`check`,
199
- * impact, sync, status, proof) must omit `registry` so external extractors
200
- * never participate.
197
+ * Async extraction from supplied snapshot bytes. Maintenance callers inject the
198
+ * shared, host-approved v2 analysis; legacy direct callers retain v1 behavior.
201
199
  */
202
200
  // implements REQ-capability-plugin-activation-disclosure-v1
203
201
  export async function extractSymbolsFromStagedFileAsync(stagedFile, manifestLookup, options) {
204
202
  const content = stagedFile.content ?? "";
205
- const sha = computeContentSha(`${content}|${stagedFile.path}|async|${options.registry ? "registry" : "custom"}`);
206
- const now = Date.now();
207
- let cached = analysisCache.get(sha);
208
- if (!cached || now - cached.ts > CACHE_TTL_MS) {
209
- try {
210
- let analysis = null;
211
- if (options.analyzeText) {
212
- analysis = await options.analyzeText(stagedFile.path, content);
213
- }
214
- else if (options.registry) {
215
- const { createSourceAnalysisService } = await import("../plugins/source-analysis-service.js");
216
- analysis = await createSourceAnalysisService({
217
- registry: options.registry,
218
- }).analyzeText(stagedFile.path, content);
219
- }
220
- else {
221
- analysis = analyzeWithBuiltinFallback(stagedFile.path, content);
222
- }
223
- cached = { result: analysis, ts: now };
224
- analysisCache.set(sha, cached);
225
- }
226
- catch {
227
- cached = { result: null, ts: now };
228
- analysisCache.set(sha, cached);
229
- }
203
+ // Do not cache by a generic "custom" provider key: provider/query versions
204
+ // and snapshot contexts differ. The host owns any structural-analysis cache.
205
+ let analysis;
206
+ if (options.analyzeText) {
207
+ analysis = await options.analyzeText(stagedFile.path, content);
230
208
  }
231
- return symbolsFromAnalysis(stagedFile, cached.result, manifestLookup);
209
+ else if (options.registry) {
210
+ const { createSourceAnalysisService } = await import("../plugins/source-analysis-service.js");
211
+ analysis = await createSourceAnalysisService({
212
+ registry: options.registry,
213
+ }).analyzeText(stagedFile.path, content);
214
+ }
215
+ else {
216
+ analysis = analyzeWithBuiltinFallback(stagedFile.path, content);
217
+ }
218
+ if (analysis?.status === "failed" || analysis?.status === "partial") {
219
+ throw new Error(`Source analysis ${analysis.status} for ${stagedFile.path}; complete symbol validation is unavailable`);
220
+ }
221
+ return symbolsFromAnalysis(stagedFile, analysis, manifestLookup);
232
222
  }
233
223
  function symbolsFromAnalysis(stagedFile, analysis, manifestLookup) {
234
224
  if (!analysis)
235
225
  return [];
226
+ if (analysis.status !== undefined) {
227
+ const locators = new Set();
228
+ for (const symbol of analysis.symbols) {
229
+ const locator = symbol.qualifiedName ?? symbol.name;
230
+ if (locators.has(locator))
231
+ throw new Error(`Ambiguous declaration locator '${locator}' in ${stagedFile.path}; authored identity cannot be assigned`);
232
+ locators.add(locator);
233
+ }
234
+ }
236
235
  const results = [];
237
236
  for (const symbol of analysis.symbols) {
238
237
  try {
239
- results.push(buildSymbolResult(stagedFile, symbol.name, symbol.kind, { startLine: symbol.startLine, endLine: symbol.endLine }, parseReqDirectives(symbol.directiveText ?? ""), manifestLookup));
238
+ results.push(buildSymbolResult(stagedFile, sourceSymbolLocator(symbol, analysis.symbols, stagedFile.path, manifestLookup), symbol.kind, { startLine: symbol.startLine, endLine: symbol.endLine }, parseReqDirectives(symbol.directiveText ?? ""), manifestLookup));
240
239
  }
241
- catch {
240
+ catch (error) {
241
+ if (analysis.status !== undefined)
242
+ throw error;
242
243
  void stagedFile.path;
243
244
  }
244
245
  }
@@ -259,3 +260,17 @@ function intersectingHunks(startLine, endLine, hunks) {
259
260
  }
260
261
  return out;
261
262
  }
263
+ // implements REQ-008
264
+ function sourceSymbolLocator(symbol, symbols, filePath, lookup) {
265
+ const qualified = symbol.qualifiedName;
266
+ if (!qualified || qualified === symbol.name)
267
+ return symbol.name;
268
+ if (lookup?.has(`${filePath}:${qualified}`))
269
+ return qualified;
270
+ // Preserve an authored legacy unqualified locator only when unambiguous.
271
+ if (symbols.filter((candidate) => candidate.name === symbol.name).length ===
272
+ 1 &&
273
+ lookup?.has(`${filePath}:${symbol.name}`))
274
+ return symbol.name;
275
+ return qualified;
276
+ }
@@ -24,7 +24,7 @@ export declare function _setPrologFactory(factory: (opts: {
24
24
  declare function consultOverlay(ctx: TempKbContext): Promise<void>;
25
25
  export { consultOverlay };
26
26
  export declare function projectStagedEntities(prolog: PrologProcess, results: ExtractionResult[]): Promise<void>;
27
- export declare function createTempKb(baseKbPath: string): Promise<TempKbContext>;
27
+ export declare function createTempKb(baseKbPath?: string): Promise<TempKbContext>;
28
28
  export declare function createOverlayFacts(symbols: ExtractedSymbol[]): string;
29
29
  export declare function cleanupTempKb(tempDir: string): Promise<void>;
30
30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