kibi-cli 2.0.0 → 2.2.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 (377) hide show
  1. package/dist/cli-protocol.d.ts.map +1 -1
  2. package/dist/cli-protocol.js +3 -2
  3. package/dist/cli-register-proof.d.ts.map +1 -1
  4. package/dist/cli-register-proof.js +25 -1
  5. package/dist/cli-register-reporting.d.ts.map +1 -1
  6. package/dist/cli-register-reporting.js +6 -0
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +2 -0
  9. package/dist/commands/aggregated-checks.d.ts +7 -0
  10. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  11. package/dist/commands/aggregated-checks.js +25 -1
  12. package/dist/commands/check-generated.d.ts +7 -0
  13. package/dist/commands/check-generated.d.ts.map +1 -0
  14. package/dist/commands/check-generated.js +192 -0
  15. package/dist/commands/check.d.ts.map +1 -1
  16. package/dist/commands/check.js +24 -15
  17. package/dist/commands/doctor.d.ts.map +1 -1
  18. package/dist/commands/doctor.js +227 -25
  19. package/dist/commands/engine.d.ts.map +1 -1
  20. package/dist/commands/engine.js +3 -1
  21. package/dist/commands/github-init.d.ts +1 -1
  22. package/dist/commands/github-init.d.ts.map +1 -1
  23. package/dist/commands/github-init.js +1 -1
  24. package/dist/commands/init-helpers.d.ts +17 -2
  25. package/dist/commands/init-helpers.d.ts.map +1 -1
  26. package/dist/commands/init-helpers.js +136 -30
  27. package/dist/commands/init.d.ts.map +1 -1
  28. package/dist/commands/init.js +110 -15
  29. package/dist/commands/proof-explain.d.ts +10 -0
  30. package/dist/commands/proof-explain.d.ts.map +1 -0
  31. package/dist/commands/proof-explain.js +45 -0
  32. package/dist/commands/proof-impact.d.ts +7 -0
  33. package/dist/commands/proof-impact.d.ts.map +1 -0
  34. package/dist/commands/proof-impact.js +39 -0
  35. package/dist/commands/proof-migrate-legacy.js +1 -1
  36. package/dist/commands/proof-prune.js +1 -1
  37. package/dist/commands/prove.d.ts.map +1 -1
  38. package/dist/commands/prove.js +14 -22
  39. package/dist/commands/report.d.ts.map +1 -1
  40. package/dist/commands/report.js +17 -2
  41. package/dist/commands/sync/cache.d.ts +20 -1
  42. package/dist/commands/sync/cache.d.ts.map +1 -1
  43. package/dist/commands/sync/cache.js +51 -2
  44. package/dist/commands/sync/discovery.d.ts.map +1 -1
  45. package/dist/commands/sync/discovery.js +1 -1
  46. package/dist/commands/sync/manifest.d.ts +1 -0
  47. package/dist/commands/sync/manifest.d.ts.map +1 -1
  48. package/dist/commands/sync/manifest.js +18 -16
  49. package/dist/commands/sync/persistence.d.ts.map +1 -1
  50. package/dist/commands/sync/persistence.js +14 -0
  51. package/dist/commands/sync.d.ts.map +1 -1
  52. package/dist/commands/sync.js +11 -3
  53. package/dist/engine.d.ts +29 -1
  54. package/dist/engine.d.ts.map +1 -1
  55. package/dist/engine.js +259 -89
  56. package/dist/env/bootstrap.d.ts +84 -0
  57. package/dist/env/bootstrap.d.ts.map +1 -0
  58. package/dist/env/bootstrap.js +310 -0
  59. package/dist/extractors/manifest.d.ts.map +1 -1
  60. package/dist/extractors/manifest.js +67 -29
  61. package/dist/extractors/markdown.d.ts +4 -0
  62. package/dist/extractors/markdown.d.ts.map +1 -1
  63. package/dist/extractors/markdown.js +33 -3
  64. package/dist/extractors/relationships.d.ts.map +1 -1
  65. package/dist/extractors/relationships.js +1 -0
  66. package/dist/extractors/symbols-coordinator.d.ts +8 -0
  67. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  68. package/dist/extractors/symbols-coordinator.js +40 -0
  69. package/dist/extractors/symbols-ts.d.ts +8 -19
  70. package/dist/extractors/symbols-ts.d.ts.map +1 -1
  71. package/dist/extractors/symbols-ts.js +33 -503
  72. package/dist/intent-search.d.ts.map +1 -1
  73. package/dist/intent-search.js +68 -30
  74. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  75. package/dist/operations/bootstrap/generate.js +4 -3
  76. package/dist/operations/modeling/model-requirement.d.ts +1 -1
  77. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  78. package/dist/operations/modeling/model-requirement.js +179 -9
  79. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  80. package/dist/operations/modeling/predicate-applyplan.js +14 -2
  81. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  82. package/dist/operations/modeling/predicate-loader.js +24 -0
  83. package/dist/operations/modeling/predicate-types.d.ts +4 -0
  84. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  85. package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
  86. package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
  87. package/dist/operations/modeling/predicate-vocabulary.js +169 -0
  88. package/dist/operations/modeling/requirement-types.d.ts +5 -0
  89. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  90. package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
  91. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  92. package/dist/operations/modeling/suggest-predicates.js +30 -3
  93. package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
  94. package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
  95. package/dist/operations/modeling/vocabulary-alignment.js +178 -0
  96. package/dist/operations/mutation/contradictions.d.ts +3 -0
  97. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  98. package/dist/operations/mutation/contradictions.js +29 -0
  99. package/dist/operations/mutation/delete.d.ts.map +1 -1
  100. package/dist/operations/mutation/delete.js +33 -1
  101. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
  102. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
  103. package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
  104. package/dist/operations/mutation/relationships.d.ts +1 -1
  105. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  106. package/dist/operations/mutation/relationships.js +1 -0
  107. package/dist/operations/mutation/saga.d.ts +5 -0
  108. package/dist/operations/mutation/saga.d.ts.map +1 -1
  109. package/dist/operations/mutation/saga.js +10 -0
  110. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  111. package/dist/operations/mutation/serialization.js +2 -0
  112. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  113. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  114. package/dist/operations/mutation/source-authoring.js +65 -26
  115. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  116. package/dist/operations/mutation/strict-fact.js +5 -0
  117. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  118. package/dist/operations/mutation/symbol-granularity.js +9 -87
  119. package/dist/operations/mutation/types.d.ts +17 -0
  120. package/dist/operations/mutation/types.d.ts.map +1 -1
  121. package/dist/operations/mutation/upsert.d.ts +6 -0
  122. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  123. package/dist/operations/mutation/upsert.js +72 -4
  124. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  125. package/dist/operations/mutation/validate-upsert.js +24 -1
  126. package/dist/operations/mutation/validation.d.ts.map +1 -1
  127. package/dist/operations/mutation/validation.js +16 -3
  128. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  129. package/dist/operations/planning/apply-plan.js +61 -17
  130. package/dist/operations/planning/compile-intent.d.ts +49 -0
  131. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  132. package/dist/operations/planning/compile-intent.js +66 -4
  133. package/dist/operations/proof/baseline-diff.d.ts +41 -0
  134. package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
  135. package/dist/operations/proof/baseline-diff.js +153 -0
  136. package/dist/operations/proof/code-scope.d.ts +17 -0
  137. package/dist/operations/proof/code-scope.d.ts.map +1 -0
  138. package/dist/operations/proof/code-scope.js +60 -0
  139. package/dist/operations/proof/explain.d.ts +75 -0
  140. package/dist/operations/proof/explain.d.ts.map +1 -0
  141. package/dist/operations/proof/explain.js +294 -0
  142. package/dist/operations/proof/impact.d.ts +45 -0
  143. package/dist/operations/proof/impact.d.ts.map +1 -0
  144. package/dist/operations/proof/impact.js +118 -0
  145. package/dist/operations/proof/ingest-proof.d.ts +4 -2
  146. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  147. package/dist/operations/proof/ingest-proof.js +251 -77
  148. package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
  149. package/dist/operations/proof/migrate-legacy-receipts.js +28 -22
  150. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  151. package/dist/operations/proof/prune-receipts.js +8 -6
  152. package/dist/operations/proof/receipt-document.js +2 -2
  153. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  154. package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
  155. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  156. package/dist/operations/semantic-advisor/analyze-prose.js +18 -67
  157. package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
  158. package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
  159. package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
  160. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
  161. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
  162. package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
  163. package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
  164. package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
  165. package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
  166. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
  167. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
  168. package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
  169. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
  170. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
  171. package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
  172. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
  173. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
  174. package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
  175. package/dist/operations/semantic-advisor/types.d.ts +1 -0
  176. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  177. package/dist/plugins/compose-ontology-packs.d.ts +51 -0
  178. package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
  179. package/dist/plugins/compose-ontology-packs.js +257 -0
  180. package/dist/plugins/compose-semantic-classifier.d.ts +47 -0
  181. package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
  182. package/dist/plugins/compose-semantic-classifier.js +216 -0
  183. package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
  184. package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
  185. package/dist/plugins/compose-vocabulary-alignment.js +141 -0
  186. package/dist/plugins/external-allowlist.d.ts +17 -0
  187. package/dist/plugins/external-allowlist.d.ts.map +1 -0
  188. package/dist/plugins/external-allowlist.js +29 -0
  189. package/dist/plugins/index.d.ts +11 -0
  190. package/dist/plugins/index.d.ts.map +1 -0
  191. package/dist/plugins/index.js +37 -0
  192. package/dist/plugins/load-plugin.d.ts +19 -0
  193. package/dist/plugins/load-plugin.d.ts.map +1 -0
  194. package/dist/plugins/load-plugin.js +59 -0
  195. package/dist/plugins/project-config.d.ts +28 -0
  196. package/dist/plugins/project-config.d.ts.map +1 -0
  197. package/dist/plugins/project-config.js +90 -0
  198. package/dist/plugins/registry.d.ts +94 -0
  199. package/dist/plugins/registry.d.ts.map +1 -0
  200. package/dist/plugins/registry.js +359 -0
  201. package/dist/plugins/resolve-package.d.ts +47 -0
  202. package/dist/plugins/resolve-package.d.ts.map +1 -0
  203. package/dist/plugins/resolve-package.js +262 -0
  204. package/dist/plugins/source-analysis-service.d.ts +44 -0
  205. package/dist/plugins/source-analysis-service.d.ts.map +1 -0
  206. package/dist/plugins/source-analysis-service.js +232 -0
  207. package/dist/prolog/codec.d.ts.map +1 -1
  208. package/dist/prolog/codec.js +2 -0
  209. package/dist/prolog/janitor.d.ts.map +1 -1
  210. package/dist/prolog/janitor.js +1 -1
  211. package/dist/prolog/store-lock.d.ts +1 -1
  212. package/dist/prolog/store-lock.d.ts.map +1 -1
  213. package/dist/prolog.d.ts +36 -0
  214. package/dist/prolog.d.ts.map +1 -1
  215. package/dist/prolog.js +78 -9
  216. package/dist/proof/inspect.js +1 -1
  217. package/dist/proof/producers/playwright-case-id.js +2 -2
  218. package/dist/proof/producers/playwright-reporter.js +4 -4
  219. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  220. package/dist/public/diagnostic-usage.js +7 -25
  221. package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
  222. package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
  223. package/dist/public/extractors/symbols-coordinator.js +1 -1
  224. package/dist/public/impact/analyzer.d.ts +1 -1
  225. package/dist/public/impact/analyzer.d.ts.map +1 -1
  226. package/dist/public/impact/analyzer.js +6 -4
  227. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  228. package/dist/public/impact/full-kb-quality.js +4 -12
  229. package/dist/public/operations/catalog.d.ts +39 -7
  230. package/dist/public/operations/catalog.d.ts.map +1 -1
  231. package/dist/public/operations/check-executor.d.ts.map +1 -1
  232. package/dist/public/operations/check-executor.js +11 -3
  233. package/dist/public/operations/check-helpers.d.ts +7 -1
  234. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  235. package/dist/public/operations/check-helpers.js +22 -2
  236. package/dist/public/operations/contracts.d.ts.map +1 -1
  237. package/dist/public/operations/contracts.js +51 -12
  238. package/dist/public/operations/discovery-entities.d.ts +53 -1
  239. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  240. package/dist/public/operations/discovery-entities.js +219 -12
  241. package/dist/public/operations/discovery-executors.d.ts +1 -0
  242. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  243. package/dist/public/operations/discovery-executors.js +93 -59
  244. package/dist/public/operations/migration-plan.d.ts +2 -0
  245. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  246. package/dist/public/operations/migration-plan.js +50 -0
  247. package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
  248. package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
  249. package/dist/public/operations/predicate-schema-conformance.js +242 -0
  250. package/dist/public/operations/prolog-json.d.ts +1 -1
  251. package/dist/public/operations/prolog-json.d.ts.map +1 -1
  252. package/dist/public/operations/prolog-json.js +16 -10
  253. package/dist/public/operations/result-envelope.d.ts +34 -1
  254. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  255. package/dist/public/operations/result-envelope.js +78 -2
  256. package/dist/public/operations/runtime-types.d.ts +17 -2
  257. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  258. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  259. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  260. package/dist/public/operations/specs/check-rules.generated.js +9 -1
  261. package/dist/public/operations/specs/check.d.ts +1 -1
  262. package/dist/public/operations/specs/discovery.d.ts +10 -1
  263. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  264. package/dist/public/operations/specs/discovery.js +10 -1
  265. package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
  266. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  267. package/dist/public/operations/specs/mutation-schemas.js +21 -3
  268. package/dist/public/operations/specs/proof.js +1 -1
  269. package/dist/public/operations/specs/reporting.d.ts +9 -0
  270. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  271. package/dist/public/operations/specs/reporting.js +48 -17
  272. package/dist/public/operations/specs/semantic.d.ts +1 -1
  273. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  274. package/dist/public/operations/specs/semantic.js +54 -4
  275. package/dist/public/operations/specs/upsert.d.ts +28 -5
  276. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  277. package/dist/public/operations/specs/upsert.js +1 -1
  278. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  279. package/dist/public/operations/symbol-repair-plan.js +11 -4
  280. package/dist/public/operations/types.d.ts +5 -0
  281. package/dist/public/operations/types.d.ts.map +1 -1
  282. package/dist/public/proof-protocol.js +4 -4
  283. package/dist/public/schemas/entity.d.ts.map +1 -1
  284. package/dist/public/schemas/entity.js +22 -0
  285. package/dist/public/schemas/relationship.d.ts.map +1 -1
  286. package/dist/public/schemas/relationship.js +1 -0
  287. package/dist/public/skills/kibi-usage/SKILL.md +10 -3
  288. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  289. package/dist/public/skills/kibi-usage/resources/proof.md +45 -0
  290. package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  291. package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  292. package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
  293. package/dist/public/symbol-granularity.d.ts +1 -1
  294. package/dist/public/symbol-granularity.d.ts.map +1 -1
  295. package/dist/public/symbol-granularity.generated.d.ts.map +1 -1
  296. package/dist/public/symbol-granularity.generated.js +38 -5
  297. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  298. package/dist/public/telemetry-acceptance.js +21 -5
  299. package/dist/relationships/shards.d.ts +6 -0
  300. package/dist/relationships/shards.d.ts.map +1 -1
  301. package/dist/relationships/shards.js +26 -19
  302. package/dist/report/html-report.css +1239 -281
  303. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  304. package/dist/runtime/cli-runtime.js +18 -0
  305. package/dist/schemas/entity.schema.json +32 -0
  306. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  307. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  308. package/dist/traceability/staged-entity-id-style.d.ts +12 -0
  309. package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
  310. package/dist/traceability/staged-entity-id-style.js +68 -0
  311. package/dist/traceability/symbol-extract.d.ts +24 -7
  312. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  313. package/dist/traceability/symbol-extract.js +64 -208
  314. package/dist/traceability/temp-kb.d.ts.map +1 -1
  315. package/dist/traceability/temp-kb.js +8 -0
  316. package/dist/traceability/validate.js +1 -1
  317. package/dist/types/entities.d.ts +2 -0
  318. package/dist/types/entities.d.ts.map +1 -1
  319. package/dist/types/relationships.d.ts +1 -1
  320. package/dist/types/relationships.d.ts.map +1 -1
  321. package/dist/utils/entity-id-style.d.ts +27 -0
  322. package/dist/utils/entity-id-style.d.ts.map +1 -0
  323. package/dist/utils/entity-id-style.js +81 -0
  324. package/dist/utils/git-repository-context.d.ts +50 -0
  325. package/dist/utils/git-repository-context.d.ts.map +1 -0
  326. package/dist/utils/git-repository-context.js +259 -0
  327. package/dist/utils/rule-registry.d.ts +5 -0
  328. package/dist/utils/rule-registry.d.ts.map +1 -1
  329. package/dist/utils/rule-registry.generated.d.ts +42 -0
  330. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  331. package/dist/utils/rule-registry.generated.js +50 -0
  332. package/dist/utils/strict-modeling.d.ts +7 -0
  333. package/dist/utils/strict-modeling.d.ts.map +1 -1
  334. package/dist/utils/strict-modeling.js +11 -0
  335. package/package.json +14 -11
  336. package/schema/entities.pl +60 -1
  337. package/schema/relationships.pl +17 -4
  338. package/schema/validation.pl +118 -20
  339. package/src/public/diagnostic-usage.ts +16 -24
  340. package/src/public/extractors/symbols-coordinator.ts +1 -0
  341. package/src/public/impact/analyzer.ts +15 -12
  342. package/src/public/impact/full-kb-quality.ts +4 -16
  343. package/src/public/operations/check-executor.ts +13 -2
  344. package/src/public/operations/check-helpers.ts +29 -3
  345. package/src/public/operations/contracts.ts +59 -12
  346. package/src/public/operations/discovery-entities.ts +327 -12
  347. package/src/public/operations/discovery-executors.ts +110 -61
  348. package/src/public/operations/migration-plan.ts +57 -0
  349. package/src/public/operations/predicate-schema-conformance.ts +362 -0
  350. package/src/public/operations/prolog-json.ts +22 -8
  351. package/src/public/operations/result-envelope.ts +114 -2
  352. package/src/public/operations/runtime-types.ts +22 -3
  353. package/src/public/operations/specs/check-rules.generated.ts +9 -1
  354. package/src/public/operations/specs/discovery.ts +11 -1
  355. package/src/public/operations/specs/mutation-schemas.ts +23 -3
  356. package/src/public/operations/specs/proof.ts +1 -1
  357. package/src/public/operations/specs/reporting.ts +71 -24
  358. package/src/public/operations/specs/semantic.ts +79 -17
  359. package/src/public/operations/specs/upsert.ts +1 -1
  360. package/src/public/operations/symbol-repair-plan.ts +16 -7
  361. package/src/public/operations/types.ts +5 -0
  362. package/src/public/proof-fingerprint.ts +1 -1
  363. package/src/public/proof-protocol-types.d.ts +1 -1
  364. package/src/public/proof-protocol.ts +4 -4
  365. package/src/public/schemas/entity.ts +22 -0
  366. package/src/public/schemas/relationship.ts +1 -0
  367. package/src/public/skills/kibi-usage/SKILL.md +10 -3
  368. package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  369. package/src/public/skills/kibi-usage/resources/proof.md +45 -0
  370. package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  371. package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  372. package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
  373. package/src/public/symbol-granularity.generated.ts +45 -12
  374. package/src/public/symbol-granularity.ts +3 -3
  375. package/src/public/telemetry-acceptance.ts +37 -6
  376. package/src/schemas/entity.schema.json +32 -0
  377. package/src/schemas/relationship.schema.json +1 -0
@@ -1,5 +1,5 @@
1
1
  export interface BaseRelationship {
2
- type: "depends_on" | "specified_by" | "verified_by" | "validates" | "implements" | "covered_by" | "executable_for" | "constrained_by" | "constrains" | "requires_property" | "requires_predicate" | "requires_rule" | "guards" | "publishes" | "consumes" | "supersedes" | "relates_to";
2
+ type: "depends_on" | "specified_by" | "verified_by" | "validates" | "implements" | "covered_by" | "executable_for" | "constrained_by" | "constrains" | "requires_property" | "requires_predicate" | "requires_rule" | "guards" | "publishes" | "consumes" | "supersedes" | "restates" | "relates_to";
3
3
  from: string;
4
4
  to: string;
5
5
  created_at?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/types/relationships.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,YAAY,GACZ,cAAc,GACd,aAAa,GACb,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/types/relationships.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,YAAY,GACZ,cAAc,GACd,aAAa,GACb,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,UAAU,GACV,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** Purely numeric entity ID such as `REQ-001` or `ADR-12`. */
2
+ export declare const NUMERIC_ENTITY_ID_PATTERN: RegExp;
3
+ export type EntityIdStyleIssue = Readonly<{
4
+ code: "numeric_id" | "stem_mismatch";
5
+ message: string;
6
+ suggestion: string;
7
+ }>;
8
+ export declare function isNumericEntityId(id: string): boolean;
9
+ /**
10
+ * Filename stem for an authored Markdown source, or undefined for non-Markdown
11
+ * sources (symbol manifests, code files, runtime `mcp://` provenance).
12
+ */
13
+ export declare function markdownSourceStem(sourcePath: string | undefined): string | undefined;
14
+ /**
15
+ * Style issues for one newly created entity. Callers decide whether the entity
16
+ * is new; this function never inspects the KB.
17
+ */
18
+ export declare function entityIdStyleIssues(input: {
19
+ readonly id: string;
20
+ readonly sourcePath?: string | undefined;
21
+ }): EntityIdStyleIssue[];
22
+ /** Plain-text warnings for mutation receipts. */
23
+ export declare function entityIdStyleWarnings(input: {
24
+ readonly id: string;
25
+ readonly sourcePath?: string | undefined;
26
+ }): string[];
27
+ //# sourceMappingURL=entity-id-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-id-style.d.ts","sourceRoot":"","sources":["../../src/utils/entity-id-style.ts"],"names":[],"mappings":"AAiCA,8DAA8D;AAE9D,eAAO,MAAM,yBAAyB,QAAiB,CAAC;AAGxD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,YAAY,GAAG,eAAe,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAGH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;GAGG;AAEH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,GAAG,SAAS,CAOpB;AAED;;;GAGG;AAEH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,GAAG,kBAAkB,EAAE,CAoBvB;AAED,iDAAiD;AAEjD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,GAAG,MAAM,EAAE,CAIX"}
@@ -0,0 +1,81 @@
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
+ /**
19
+ * Entity naming style (`entity-id-style`).
20
+ *
21
+ * Entities are named by what they govern (`REQ-cli-gc`), never by "the next
22
+ * number". The compiled KB cannot tell a legacy numbered entity from a new one
23
+ * (`created_at` is stamped at sync time when frontmatter omits it), so purely
24
+ * numeric IDs are reported only at creation boundaries: a `kb_upsert` that
25
+ * creates the entity, and staged added/renamed entity Markdown. Committed
26
+ * legacy entities such as `REQ-003` are therefore never flagged. The Prolog
27
+ * half of the rule (`check_entity_id_style/1`) reports filename-stem/`id`
28
+ * mismatches over the whole KB.
29
+ */
30
+ import * as path from "node:path";
31
+ /** Purely numeric entity ID such as `REQ-001` or `ADR-12`. */
32
+ // implements REQ-kibi-entity-id-style
33
+ export const NUMERIC_ENTITY_ID_PATTERN = /^[A-Z]+-\d+$/;
34
+ // implements REQ-kibi-entity-id-style
35
+ export function isNumericEntityId(id) {
36
+ return NUMERIC_ENTITY_ID_PATTERN.test(id.trim());
37
+ }
38
+ /**
39
+ * Filename stem for an authored Markdown source, or undefined for non-Markdown
40
+ * sources (symbol manifests, code files, runtime `mcp://` provenance).
41
+ */
42
+ // implements REQ-kibi-entity-id-style
43
+ export function markdownSourceStem(sourcePath) {
44
+ if (sourcePath === undefined)
45
+ return undefined;
46
+ const normalized = sourcePath.trim().replaceAll("\\", "/");
47
+ if (!normalized.endsWith(".md") || normalized.includes("://")) {
48
+ return undefined;
49
+ }
50
+ return path.posix.basename(normalized, ".md");
51
+ }
52
+ /**
53
+ * Style issues for one newly created entity. Callers decide whether the entity
54
+ * is new; this function never inspects the KB.
55
+ */
56
+ // implements REQ-kibi-entity-id-style
57
+ export function entityIdStyleIssues(input) {
58
+ const id = input.id.trim();
59
+ const issues = [];
60
+ if (isNumericEntityId(id)) {
61
+ issues.push({
62
+ code: "numeric_id",
63
+ message: `Entity ID ${id} is a sequence number; parallel branches pick the same next number and collide.`,
64
+ suggestion: "Name the entity by what it governs: <TYPE>-<area>-<behavior> in kebab-case (for example REQ-cli-gc). kb_search the area first and update or supersede an existing entity when one already covers the behavior.",
65
+ });
66
+ }
67
+ const stem = markdownSourceStem(input.sourcePath);
68
+ if (stem !== undefined && stem !== id) {
69
+ issues.push({
70
+ code: "stem_mismatch",
71
+ message: `Entity ID ${id} does not match its filename stem ${stem}.`,
72
+ suggestion: `Rename the file to ${id}.md or set frontmatter id: ${stem} so the file name and identity stay aligned.`,
73
+ });
74
+ }
75
+ return issues;
76
+ }
77
+ /** Plain-text warnings for mutation receipts. */
78
+ // implements REQ-kibi-entity-id-style
79
+ export function entityIdStyleWarnings(input) {
80
+ return entityIdStyleIssues(input).map((issue) => `entity-id-style: ${issue.message} ${issue.suggestion}`);
81
+ }
@@ -0,0 +1,50 @@
1
+ export interface GitRepositoryContext {
2
+ /** Root of the current working tree (the worktree, when linked). */
3
+ worktreeRoot: string;
4
+ /** Absolute Git directory of the current worktree. */
5
+ gitDir: string;
6
+ /** Absolute repository-common Git directory (shared across worktrees). */
7
+ commonGitDir: string;
8
+ /** Absolute hooks directory Git will actually execute (honors core.hooksPath). */
9
+ effectiveHooksDir: string;
10
+ isLinkedWorktree: boolean;
11
+ /**
12
+ * Primary checkout root, only when it can be validated as a real checkout
13
+ * (`git -C <candidate> rev-parse --show-toplevel` resolves to the
14
+ * candidate). Null for bare repositories, separate-git-dir layouts, and any
15
+ * candidate that is not itself a working tree.
16
+ */
17
+ primaryWorktreeRoot: string | null;
18
+ /** Raw core.hooksPath value when configured, else null. */
19
+ hooksPathConfig: string | null;
20
+ /** Config origin line (from --show-origin) for the configured hooksPath. */
21
+ hooksPathOrigin: string | null;
22
+ }
23
+ export type GitRepositoryResolution = {
24
+ status: "ok";
25
+ context: GitRepositoryContext;
26
+ } | {
27
+ status: "not-a-repository";
28
+ } | {
29
+ status: "git-unavailable";
30
+ } | {
31
+ status: "git-refused";
32
+ /** First Git diagnostic (or fs detail) explaining the refusal. */
33
+ reason: string;
34
+ } | {
35
+ status: "unsupported";
36
+ reason: string;
37
+ };
38
+ /**
39
+ * Resolve the effective Git repository context for `cwd` by asking Git
40
+ * instead of assuming `<cwd>/.git`. The result distinguishes "no repository"
41
+ * (callers may fall back to standalone-workspace behavior) from repositories
42
+ * Kibi must not touch (bare repositories) and directories where Git refused
43
+ * operationally (dubious ownership, unreadable `.git`, access failures) — the
44
+ * last must never be mistaken for "no repository", because that would send
45
+ * callers into standalone workspace writes.
46
+ *
47
+ * implements REQ-git-hook-effective-install
48
+ */
49
+ export declare function resolveGitRepository(cwd?: string): GitRepositoryResolution;
50
+ //# sourceMappingURL=git-repository-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-repository-context.d.ts","sourceRoot":"","sources":["../../src/utils/git-repository-context.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,2DAA2D;IAC3D,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,kBAAkB,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,iBAAiB,CAAA;CAAE,GAC7B;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAqH9C;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,GAAE,MAAsB,GAC1B,uBAAuB,CAmJzB"}
@@ -0,0 +1,259 @@
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 { execFileSync } from "node:child_process";
19
+ import { lstatSync } from "node:fs";
20
+ import * as path from "node:path";
21
+ // `git rev-parse --path-format=absolute` requires git 2.31 (2021-03). Older
22
+ // git returns cwd-relative paths for --git-dir/--git-common-dir/--git-path,
23
+ // which are resolved against the caller's cwd below.
24
+ const PATH_FORMAT_MINIMUM = { major: 2, minor: 31 };
25
+ // Git's generic absence answer also covers directories it cannot read (an
26
+ // unreadable `.git` yields the same "not a git repository" fatal). Only an
27
+ // explicit absence diagnostic may classify a directory as standalone.
28
+ const NOT_A_REPOSITORY_RE = /not a (git )?repository/i;
29
+ /**
30
+ * Environment for diagnostic-parsing Git subprocesses: failure classification
31
+ * matches English diagnostics, so the child locale is pinned to C while every
32
+ * other environment value (and Git configuration) is preserved. The parent
33
+ * process's locale is never mutated.
34
+ */
35
+ function gitEnv() {
36
+ return { ...process.env, LC_ALL: "C", LANG: "C" };
37
+ }
38
+ function runGitChecked(cwd, args) {
39
+ try {
40
+ return {
41
+ output: execFileSync("git", args, {
42
+ cwd,
43
+ encoding: "utf8",
44
+ env: gitEnv(),
45
+ stdio: ["ignore", "pipe", "pipe"],
46
+ timeout: 10_000,
47
+ maxBuffer: 1024 * 1024,
48
+ }).trim(),
49
+ failure: null,
50
+ };
51
+ }
52
+ catch (error) {
53
+ const stderr = error.stderr;
54
+ const text = typeof stderr === "string" ? stderr : stderr?.toString("utf8");
55
+ const firstLine = text
56
+ ?.split("\n")
57
+ .map((line) => line.trim())
58
+ .find(Boolean) ?? null;
59
+ return { output: null, failure: firstLine };
60
+ }
61
+ }
62
+ function runGit(cwd, args) {
63
+ return runGitChecked(cwd, args).output;
64
+ }
65
+ /**
66
+ * Decide whether a failed repository probe means the directory genuinely has
67
+ * no repository (standalone fallback is allowed) or Git refused for an
68
+ * operational reason (dubious ownership, access, timeouts, anything
69
+ * unrecognized) where callers must refuse before writing.
70
+ */
71
+ function classifyGitFailure(failure) {
72
+ if (failure !== null && NOT_A_REPOSITORY_RE.test(failure)) {
73
+ return "not-a-repository";
74
+ }
75
+ return "refused";
76
+ }
77
+ /**
78
+ * On Git's absence answer, find the nearest `.git` entry (file, directory, or
79
+ * symlink) at or above `start`. Git reports the same generic "not a git
80
+ * repository" fatal for entries it cannot fully read (restricted permissions
81
+ * on objects/refs/HEAD, ownership checks) as for true absence, so a present
82
+ * marker means the context is unresolved: callers must conservatively refuse
83
+ * with the marker instead of treating the directory as standalone. Null means
84
+ * no marker exists up to the filesystem root: the directory genuinely has no
85
+ * repository and standalone handling is legitimate.
86
+ */
87
+ function findRepositoryMarker(start) {
88
+ let current = path.resolve(start);
89
+ for (;;) {
90
+ const entry = path.join(current, ".git");
91
+ try {
92
+ lstatSync(entry);
93
+ return entry;
94
+ }
95
+ catch (error) {
96
+ const code = error.code;
97
+ if (code === "EACCES" || code === "EPERM") {
98
+ // The entry cannot even be inspected: treat it as present.
99
+ return entry;
100
+ }
101
+ // ENOENT and friends: no entry at this level; keep walking.
102
+ }
103
+ const parent = path.dirname(current);
104
+ if (parent === current)
105
+ return null;
106
+ current = parent;
107
+ }
108
+ }
109
+ function parseGitVersion(versionOutput) {
110
+ const match = /^git version (\d+)\.(\d+)(\.\d+)?/.exec(versionOutput);
111
+ if (!match)
112
+ return null;
113
+ return { major: Number(match[1]), minor: Number(match[2]) };
114
+ }
115
+ function resolveAgainstCwd(candidate, cwd) {
116
+ return path.isAbsolute(candidate) ? candidate : path.resolve(cwd, candidate);
117
+ }
118
+ /**
119
+ * Resolve the effective Git repository context for `cwd` by asking Git
120
+ * instead of assuming `<cwd>/.git`. The result distinguishes "no repository"
121
+ * (callers may fall back to standalone-workspace behavior) from repositories
122
+ * Kibi must not touch (bare repositories) and directories where Git refused
123
+ * operationally (dubious ownership, unreadable `.git`, access failures) — the
124
+ * last must never be mistaken for "no repository", because that would send
125
+ * callers into standalone workspace writes.
126
+ *
127
+ * implements REQ-git-hook-effective-install
128
+ */
129
+ export function resolveGitRepository(cwd = process.cwd()) {
130
+ const versionProbe = runGitChecked(cwd, ["--version"]);
131
+ if (versionProbe.output === null) {
132
+ const marker = findRepositoryMarker(cwd);
133
+ if (marker !== null) {
134
+ return {
135
+ status: "git-refused",
136
+ reason: `Git is unavailable, but a .git entry exists at ${marker}; refusing to guess.`,
137
+ };
138
+ }
139
+ return { status: "git-unavailable" };
140
+ }
141
+ const toplevel = runGitChecked(cwd, ["rev-parse", "--show-toplevel"]);
142
+ if (toplevel.output === null) {
143
+ // A bare repository has no working tree (--show-toplevel fails) but is
144
+ // still a repository; treat it as unsupported instead of "no repository"
145
+ // so callers refuse to write workspace state into it.
146
+ const gitDirProbe = runGitChecked(cwd, ["rev-parse", "--git-dir"]);
147
+ if (gitDirProbe.output !== null) {
148
+ return {
149
+ status: "unsupported",
150
+ reason: "Bare repository: no working tree to attach Kibi to.",
151
+ };
152
+ }
153
+ if (classifyGitFailure(toplevel.failure) === "not-a-repository") {
154
+ // Git's absence answer also fires when a `.git` entry exists but some
155
+ // of its internals (objects, refs, HEAD) are unreadable; conservatively
156
+ // refuse with the marker instead of a standalone-directory verdict.
157
+ const marker = findRepositoryMarker(cwd);
158
+ if (marker !== null) {
159
+ return {
160
+ status: "git-refused",
161
+ reason: `Git reported no repository, but a .git entry exists at ${marker} (${toplevel.failure ?? "git produced no diagnostic output"}); refusing to guess.`,
162
+ };
163
+ }
164
+ return { status: "not-a-repository" };
165
+ }
166
+ return {
167
+ status: "git-refused",
168
+ reason: `Git refused to inspect this directory: ${toplevel.failure ??
169
+ gitDirProbe.failure ??
170
+ "git produced no diagnostic output"}`,
171
+ };
172
+ }
173
+ const version = parseGitVersion(versionProbe.output);
174
+ const absolute = version !== null &&
175
+ (version.major > PATH_FORMAT_MINIMUM.major ||
176
+ (version.major === PATH_FORMAT_MINIMUM.major &&
177
+ version.minor >= PATH_FORMAT_MINIMUM.minor));
178
+ const formatArgs = absolute ? ["--path-format=absolute"] : [];
179
+ const gitDirRaw = runGitChecked(cwd, [
180
+ "rev-parse",
181
+ ...formatArgs,
182
+ "--git-dir",
183
+ ]);
184
+ const commonGitDirRaw = runGitChecked(cwd, [
185
+ "rev-parse",
186
+ ...formatArgs,
187
+ "--git-common-dir",
188
+ ]);
189
+ const hooksDirRaw = runGitChecked(cwd, [
190
+ "rev-parse",
191
+ ...formatArgs,
192
+ "--git-path",
193
+ "hooks",
194
+ ]);
195
+ if (gitDirRaw.output === null ||
196
+ commonGitDirRaw.output === null ||
197
+ hooksDirRaw.output === null) {
198
+ const detail = gitDirRaw.failure ??
199
+ commonGitDirRaw.failure ??
200
+ hooksDirRaw.failure ??
201
+ "git produced no diagnostic output";
202
+ return {
203
+ status: "git-refused",
204
+ reason: `Git refused to report its directory layout for this repository: ${detail}`,
205
+ };
206
+ }
207
+ // Without --path-format the outputs above are relative to cwd (or absolute
208
+ // for linked-worktree git dirs); normalize everything against cwd.
209
+ const worktreeRoot = toplevel.output;
210
+ const gitDir = resolveAgainstCwd(gitDirRaw.output, cwd);
211
+ const commonGitDir = resolveAgainstCwd(commonGitDirRaw.output, cwd);
212
+ const effectiveHooksDir = resolveAgainstCwd(hooksDirRaw.output, cwd);
213
+ const originLine = runGit(cwd, [
214
+ "config",
215
+ "--show-origin",
216
+ "--get",
217
+ "core.hooksPath",
218
+ ]);
219
+ let hooksPathConfig = null;
220
+ let hooksPathOrigin = null;
221
+ if (originLine) {
222
+ const separator = originLine.lastIndexOf("\t");
223
+ if (separator >= 0) {
224
+ hooksPathOrigin = originLine.slice(0, separator).trim();
225
+ hooksPathConfig = originLine.slice(separator + 1).trim();
226
+ }
227
+ else {
228
+ hooksPathConfig = originLine.trim();
229
+ }
230
+ }
231
+ const isLinkedWorktree = gitDir !== commonGitDir;
232
+ let primaryWorktreeRoot = null;
233
+ if (path.basename(commonGitDir) === ".git") {
234
+ const candidate = path.dirname(commonGitDir);
235
+ // Validate the candidate as a real checkout: a linked worktree of a bare
236
+ // repository also has commonDir `<bare>/.git`, and dirname of that is the
237
+ // bare holder directory, not a checkout.
238
+ const candidateToplevel = runGit(candidate, [
239
+ "rev-parse",
240
+ "--show-toplevel",
241
+ ]);
242
+ if (candidateToplevel === candidate) {
243
+ primaryWorktreeRoot = candidate;
244
+ }
245
+ }
246
+ return {
247
+ status: "ok",
248
+ context: {
249
+ worktreeRoot,
250
+ gitDir,
251
+ commonGitDir,
252
+ effectiveHooksDir,
253
+ isLinkedWorktree,
254
+ primaryWorktreeRoot,
255
+ hooksPathConfig,
256
+ hooksPathOrigin,
257
+ },
258
+ };
259
+ }
@@ -21,6 +21,11 @@ export interface RuleDefinition {
21
21
  /** Kibi-owned role of this rule in the enforcement contract. */
22
22
  enforcementClass: RuleEnforcementClass;
23
23
  category: "coverage" | "integrity" | "lifecycle" | "traceability";
24
+ /**
25
+ * Severity for non-canonical findings rendered as quality diagnostics.
26
+ * Omitted means "warning"; "info" marks purely informational signals.
27
+ */
28
+ diagnosticSeverity?: "warning" | "info";
24
29
  }
25
30
  /** A single KB check violation. */
26
31
  export interface Violation {
@@ -1 +1 @@
1
- {"version":3,"file":"rule-registry.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.ts"],"names":[],"mappings":"AAgCA,MAAM,MAAM,oBAAoB;AAC9B;;;;GAIG;AACD,WAAW;AACb;;;GAGG;GACD,UAAU;AACZ;;;GAGG;GACD,WAAW,CAAC;AAEhB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,QAAQ,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,cAAc,CAAC;CACnE;AAED,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,QAAQ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IAClE;;;OAGG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CACzC;AAED,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC9C;AAED,sEAAsE;AACtE,eAAO,MAAM,KAAK,EAAE,SAAS,cAAc,EAAoB,CAAC;AAIhE;;GAEG;AACH,eAAO,MAAM,UAAU,aAAoC,CAAC;AAE5D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE1E;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,GACX,oBAAoB,GAAG,SAAS,CAElC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,oBAAoB,GACrC,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,GAAG,CAAC,MAAM,CAAC,CAM7C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,MAAM,CAAC,CAM/C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;GAQG;AAEH,wBAAgB,iBAAiB,CAC/B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GACjC,GAAG,CAAC,MAAM,CAAC,CAOb;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK5D"}
@@ -93,5 +93,47 @@ export declare const GENERATED_RULES: readonly [{
93
93
  readonly description: "Every inventoried assertive proposition is modeled or explicitly classified";
94
94
  readonly enforcementClass: "migration";
95
95
  readonly category: "integrity";
96
+ }, {
97
+ readonly name: "proof-contract-symbols";
98
+ readonly description: "Detect unresolved required_proofs.symbol_id values, type-shape required proofs, and proof_bindings.source_file disagreement with the named symbol sourceFile";
99
+ readonly enforcementClass: "advisory";
100
+ readonly category: "integrity";
101
+ }, {
102
+ readonly name: "entity-id-style";
103
+ readonly description: "Entity IDs name the governed behavior and match their filename stem; new purely numeric IDs are reported at creation boundaries";
104
+ readonly enforcementClass: "advisory";
105
+ readonly category: "lifecycle";
106
+ }, {
107
+ readonly name: "domain-redundancy";
108
+ readonly description: "Two current requirements must not ground the identical logical term or share a ground fact unless linked by supersedes or restates";
109
+ readonly enforcementClass: "advisory";
110
+ readonly category: "integrity";
111
+ }, {
112
+ readonly name: "domain-implication";
113
+ readonly description: "Informational: one requirement's numeric bound strictly implies another requirement's bound on the same subject and property";
114
+ readonly enforcementClass: "advisory";
115
+ readonly category: "integrity";
116
+ readonly diagnosticSeverity: "info";
117
+ }, {
118
+ readonly name: "subject-key-identity";
119
+ readonly description: "Subject keys must name a shared component, not be derived from a requirement ID";
120
+ readonly enforcementClass: "advisory";
121
+ readonly category: "integrity";
122
+ }, {
123
+ readonly name: "subject-key-shape";
124
+ readonly description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments";
125
+ readonly enforcementClass: "advisory";
126
+ readonly category: "integrity";
127
+ }, {
128
+ readonly name: "ontology-quality";
129
+ readonly description: "Informational: predicate schemas whose argument values mostly occur in only one fact are carrying prose instead of a shared vocabulary";
130
+ readonly enforcementClass: "advisory";
131
+ readonly category: "integrity";
132
+ readonly diagnosticSeverity: "info";
133
+ }, {
134
+ readonly name: "predicate-schema-conformance";
135
+ readonly description: "Predicate facts match a predicate_schema (project-local, or the built-in catalog in the default namespace) and use its declared argument constants";
136
+ readonly enforcementClass: "advisory";
137
+ readonly category: "integrity";
96
138
  }];
97
139
  //# sourceMappingURL=rule-registry.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmIlB,CAAC"}
1
+ {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6LlB,CAAC"}
@@ -122,4 +122,54 @@ export const GENERATED_RULES = [
122
122
  enforcementClass: "migration",
123
123
  category: "integrity",
124
124
  },
125
+ {
126
+ name: "proof-contract-symbols",
127
+ description: "Detect unresolved required_proofs.symbol_id values, type-shape required proofs, and proof_bindings.source_file disagreement with the named symbol sourceFile",
128
+ enforcementClass: "advisory",
129
+ category: "integrity",
130
+ },
131
+ {
132
+ name: "entity-id-style",
133
+ description: "Entity IDs name the governed behavior and match their filename stem; new purely numeric IDs are reported at creation boundaries",
134
+ enforcementClass: "advisory",
135
+ category: "lifecycle",
136
+ },
137
+ {
138
+ name: "domain-redundancy",
139
+ description: "Two current requirements must not ground the identical logical term or share a ground fact unless linked by supersedes or restates",
140
+ enforcementClass: "advisory",
141
+ category: "integrity",
142
+ },
143
+ {
144
+ name: "domain-implication",
145
+ description: "Informational: one requirement's numeric bound strictly implies another requirement's bound on the same subject and property",
146
+ enforcementClass: "advisory",
147
+ category: "integrity",
148
+ diagnosticSeverity: "info",
149
+ },
150
+ {
151
+ name: "subject-key-identity",
152
+ description: "Subject keys must name a shared component, not be derived from a requirement ID",
153
+ enforcementClass: "advisory",
154
+ category: "integrity",
155
+ },
156
+ {
157
+ name: "subject-key-shape",
158
+ description: "Subject keys follow dotted component.aspect[.sub] with lowercase snake segments",
159
+ enforcementClass: "advisory",
160
+ category: "integrity",
161
+ },
162
+ {
163
+ name: "ontology-quality",
164
+ description: "Informational: predicate schemas whose argument values mostly occur in only one fact are carrying prose instead of a shared vocabulary",
165
+ enforcementClass: "advisory",
166
+ category: "integrity",
167
+ diagnosticSeverity: "info",
168
+ },
169
+ {
170
+ name: "predicate-schema-conformance",
171
+ description: "Predicate facts match a predicate_schema (project-local, or the built-in catalog in the default namespace) and use its declared argument constants",
172
+ enforcementClass: "advisory",
173
+ category: "integrity",
174
+ },
125
175
  ];
@@ -52,6 +52,13 @@ interface ObservationWriteSet {
52
52
  }
53
53
  export type StrictWriteSet = StrictRequirementWriteSet | ObservationWriteSet;
54
54
  export declare function normalizeSubjectKey(value: string): string;
55
+ /**
56
+ * Subject-key convention checked by `subject-key-shape`: dotted
57
+ * component.aspect[.sub] with lowercase snake segments. Mirrors
58
+ * valid_subject_key/1 in packages/core/src/semantic_quality.pl.
59
+ */
60
+ export declare const SUBJECT_KEY_CONVENTION: RegExp;
61
+ export declare function isConventionalSubjectKey(value: string): boolean;
55
62
  export declare function normalizePropertyKey(value: string): string;
56
63
  export declare function buildStableRequirementIds(claim: SemanticClaim): StableRequirementIds;
57
64
  export declare function buildStrictWriteSet(input: StrictModelInput): StrictWriteSet;
@@ -1 +1 @@
1
- {"version":3,"file":"strict-modeling.d.ts","sourceRoot":"","sources":["../../src/utils/strict-modeling.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CA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,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,yBAAyB;IACjC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACjC,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,mBAAmB;IAC3B,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,yBAAyB,GAAG,mBAAmB,CAAC;AAE7E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBzD;AAED;;;;GAIG;AAEH,eAAO,MAAM,sBAAsB,QACoC,CAAC;AAGxE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAe1D;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,aAAa,GACnB,oBAAoB,CAwBtB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,CAsH3E;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,GACtC,cAAc,EAAE,CAkBlB;AAiDD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,GACb,MAAM,CAMR"}
@@ -33,6 +33,17 @@ export function normalizeSubjectKey(value) {
33
33
  }
34
34
  return normalized;
35
35
  }
36
+ /**
37
+ * Subject-key convention checked by `subject-key-shape`: dotted
38
+ * component.aspect[.sub] with lowercase snake segments. Mirrors
39
+ * valid_subject_key/1 in packages/core/src/semantic_quality.pl.
40
+ */
41
+ // implements REQ-kibi-subject-vocabulary
42
+ export const SUBJECT_KEY_CONVENTION = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*(?:\.[a-z][a-z0-9]*(?:_[a-z0-9]+)*)+$/;
43
+ // implements REQ-kibi-subject-vocabulary
44
+ export function isConventionalSubjectKey(value) {
45
+ return SUBJECT_KEY_CONVENTION.test(value);
46
+ }
36
47
  export function normalizePropertyKey(value) {
37
48
  const normalized = value
38
49
  .trim()