kibi-cli 2.31.1 → 2.35.1

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 (302) hide show
  1. package/dist/cli-register-proof.d.ts.map +1 -1
  2. package/dist/cli-register-proof.js +19 -7
  3. package/dist/cli-register-reporting.d.ts.map +1 -1
  4. package/dist/cli-register-reporting.js +2 -0
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +5 -1
  7. package/dist/commands/check-generated.d.ts +5 -1
  8. package/dist/commands/check-generated.d.ts.map +1 -1
  9. package/dist/commands/check-generated.js +24 -35
  10. package/dist/commands/check.d.ts +1 -0
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +14 -5
  13. package/dist/commands/discovery-table.d.ts.map +1 -1
  14. package/dist/commands/discovery-table.js +51 -4
  15. package/dist/commands/doctor.js +19 -4
  16. package/dist/commands/init-helpers.d.ts.map +1 -1
  17. package/dist/commands/init-helpers.js +8 -5
  18. package/dist/commands/migrate.d.ts.map +1 -1
  19. package/dist/commands/migrate.js +109 -5
  20. package/dist/commands/prove.d.ts +48 -1
  21. package/dist/commands/prove.d.ts.map +1 -1
  22. package/dist/commands/prove.js +293 -8
  23. package/dist/commands/report.d.ts +1 -0
  24. package/dist/commands/report.d.ts.map +1 -1
  25. package/dist/commands/report.js +70 -5
  26. package/dist/commands/signoff.d.ts.map +1 -1
  27. package/dist/commands/signoff.js +20 -1
  28. package/dist/commands/sync/manifest.d.ts +10 -1
  29. package/dist/commands/sync/manifest.d.ts.map +1 -1
  30. package/dist/commands/sync/manifest.js +106 -17
  31. package/dist/commands/sync/persistence.d.ts.map +1 -1
  32. package/dist/commands/sync/persistence.js +16 -5
  33. package/dist/commands/sync.d.ts.map +1 -1
  34. package/dist/commands/sync.js +19 -0
  35. package/dist/diagnostics.js +1 -1
  36. package/dist/engine.js +1 -1
  37. package/dist/extractors/markdown.d.ts +4 -2
  38. package/dist/extractors/markdown.d.ts.map +1 -1
  39. package/dist/extractors/markdown.js +17 -0
  40. package/dist/extractors/symbol-coordinates.js +2 -2
  41. package/dist/extractors/symbols-coordinator.d.ts +2 -4
  42. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  43. package/dist/extractors/symbols-coordinator.js +1 -2
  44. package/dist/operations/bootstrap/candidate-helpers.d.ts +3 -0
  45. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  46. package/dist/operations/bootstrap/candidate-helpers.js +4 -0
  47. package/dist/operations/migration/evidence-floor.d.ts +41 -0
  48. package/dist/operations/migration/evidence-floor.d.ts.map +1 -0
  49. package/dist/operations/migration/evidence-floor.js +230 -0
  50. package/dist/operations/migration/proof-contract-claims.d.ts +72 -0
  51. package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -0
  52. package/dist/operations/migration/proof-contract-claims.js +215 -0
  53. package/dist/operations/migration/schema6.d.ts +6 -0
  54. package/dist/operations/migration/schema6.d.ts.map +1 -1
  55. package/dist/operations/migration/schema6.js +92 -0
  56. package/dist/operations/migration/symbol-coordinates-refresh.d.ts +3 -2
  57. package/dist/operations/migration/symbol-coordinates-refresh.d.ts.map +1 -1
  58. package/dist/operations/migration/symbol-coordinates-refresh.js +4 -3
  59. package/dist/operations/migration/untrack-symbol-coordinates.d.ts +23 -0
  60. package/dist/operations/migration/untrack-symbol-coordinates.d.ts.map +1 -0
  61. package/dist/operations/migration/untrack-symbol-coordinates.js +67 -0
  62. package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -1
  63. package/dist/operations/modeling/requirement-modeler.js +48 -1
  64. package/dist/operations/modeling/requirement-types.d.ts +2 -1
  65. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  66. package/dist/operations/modeling/requirement-utils.d.ts +1 -1
  67. package/dist/operations/modeling/requirement-utils.d.ts.map +1 -1
  68. package/dist/operations/modeling/requirement-utils.js +8 -1
  69. package/dist/operations/mutation/omitted-properties.d.ts +11 -0
  70. package/dist/operations/mutation/omitted-properties.d.ts.map +1 -0
  71. package/dist/operations/mutation/omitted-properties.js +76 -0
  72. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  73. package/dist/operations/mutation/serialization.js +1 -0
  74. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  75. package/dist/operations/mutation/source-authoring.js +39 -20
  76. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  77. package/dist/operations/mutation/strict-fact.js +6 -2
  78. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  79. package/dist/operations/mutation/symbol-granularity.js +5 -3
  80. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  81. package/dist/operations/mutation/upsert.js +7 -1
  82. package/dist/operations/mutation/validation.d.ts +2 -0
  83. package/dist/operations/mutation/validation.d.ts.map +1 -1
  84. package/dist/operations/mutation/validation.js +4 -0
  85. package/dist/operations/proof/claim-bindings.d.ts +41 -0
  86. package/dist/operations/proof/claim-bindings.d.ts.map +1 -0
  87. package/dist/operations/proof/claim-bindings.js +364 -0
  88. package/dist/operations/proof/code-certificates.d.ts +155 -0
  89. package/dist/operations/proof/code-certificates.d.ts.map +1 -0
  90. package/dist/operations/proof/code-certificates.js +894 -0
  91. package/dist/operations/proof/code-models.d.ts +96 -0
  92. package/dist/operations/proof/code-models.d.ts.map +1 -0
  93. package/dist/operations/proof/code-models.js +601 -0
  94. package/dist/operations/proof/code-runner.d.ts +40 -0
  95. package/dist/operations/proof/code-runner.d.ts.map +1 -0
  96. package/dist/operations/proof/code-runner.js +164 -0
  97. package/dist/operations/proof/code-scope.d.ts +14 -1
  98. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  99. package/dist/operations/proof/code-scope.js +44 -2
  100. package/dist/operations/proof/compact-receipts.d.ts.map +1 -1
  101. package/dist/operations/proof/compact-receipts.js +4 -3
  102. package/dist/operations/proof/explain.d.ts +32 -0
  103. package/dist/operations/proof/explain.d.ts.map +1 -1
  104. package/dist/operations/proof/explain.js +91 -0
  105. package/dist/operations/proof/ingest-proof.d.ts +9 -1
  106. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  107. package/dist/operations/proof/ingest-proof.js +42 -2
  108. package/dist/operations/proof/receipt-compaction.d.ts +2 -0
  109. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -1
  110. package/dist/operations/proof/receipt-compaction.js +6 -2
  111. package/dist/operations/proof/regular-language.d.ts +89 -0
  112. package/dist/operations/proof/regular-language.d.ts.map +1 -0
  113. package/dist/operations/proof/regular-language.js +943 -0
  114. package/dist/operations/proof/source-code-readers.d.ts +12 -0
  115. package/dist/operations/proof/source-code-readers.d.ts.map +1 -0
  116. package/dist/operations/proof/source-code-readers.js +699 -0
  117. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  118. package/dist/operations/semantic-advisor/analyze-prose.js +2 -1
  119. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  120. package/dist/operations/semantic-advisor/shared.js +4 -0
  121. package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
  122. package/dist/operations/semantic-advisor/strict-count-rules.js +8 -2
  123. package/dist/operations/semantic-advisor/strict-rules.d.ts +8 -0
  124. package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -1
  125. package/dist/operations/semantic-advisor/strict-rules.js +234 -4
  126. package/dist/operations/semantic-advisor/types.d.ts +3 -2
  127. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  128. package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
  129. package/dist/plugins/approved-source-analyzers.generated.js +6 -6
  130. package/dist/prolog.d.ts.map +1 -1
  131. package/dist/prolog.js +13 -3
  132. package/dist/proof/command-test-report.d.ts +4 -3
  133. package/dist/proof/command-test-report.d.ts.map +1 -1
  134. package/dist/proof/command-test-report.js +4 -10
  135. package/dist/proof/evaluate.d.ts.map +1 -1
  136. package/dist/proof/evaluate.js +18 -2
  137. package/dist/proof/inspect.d.ts.map +1 -1
  138. package/dist/proof/inspect.js +58 -0
  139. package/dist/proof/producers/playwright-reporter.d.ts +3 -0
  140. package/dist/proof/producers/playwright-reporter.d.ts.map +1 -1
  141. package/dist/proof/producers/playwright-reporter.js +25 -2
  142. package/dist/proof/step-runner.d.ts +36 -0
  143. package/dist/proof/step-runner.d.ts.map +1 -0
  144. package/dist/proof/step-runner.js +234 -0
  145. package/dist/public/evidence-levels.d.ts +12 -0
  146. package/dist/public/evidence-levels.d.ts.map +1 -0
  147. package/dist/public/evidence-levels.js +19 -0
  148. package/dist/public/impact/coverage-depth-quality.d.ts +7 -0
  149. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
  150. package/dist/public/impact/coverage-depth-quality.js +59 -0
  151. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  152. package/dist/public/impact/full-kb-quality.js +3 -1
  153. package/dist/public/operations/catalog.d.ts +315 -11
  154. package/dist/public/operations/catalog.d.ts.map +1 -1
  155. package/dist/public/operations/check-executor.d.ts +2 -0
  156. package/dist/public/operations/check-executor.d.ts.map +1 -1
  157. package/dist/public/operations/check-executor.js +6 -0
  158. package/dist/public/operations/evidence-floor.d.ts +48 -0
  159. package/dist/public/operations/evidence-floor.d.ts.map +1 -0
  160. package/dist/public/operations/evidence-floor.js +143 -0
  161. package/dist/public/operations/migration-plan.d.ts +19 -5
  162. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  163. package/dist/public/operations/migration-plan.js +22 -5
  164. package/dist/public/operations/node-ports.d.ts.map +1 -1
  165. package/dist/public/operations/node-ports.js +4 -1
  166. package/dist/public/operations/proof-contract-claims.d.ts +26 -0
  167. package/dist/public/operations/proof-contract-claims.d.ts.map +1 -0
  168. package/dist/public/operations/proof-contract-claims.js +71 -0
  169. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  170. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  171. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  172. package/dist/public/operations/specs/check.d.ts +1 -1
  173. package/dist/public/operations/specs/composite.d.ts +16 -3
  174. package/dist/public/operations/specs/composite.d.ts.map +1 -1
  175. package/dist/public/operations/specs/modeling.d.ts +16 -3
  176. package/dist/public/operations/specs/modeling.d.ts.map +1 -1
  177. package/dist/public/operations/specs/modeling.js +22 -3
  178. package/dist/public/operations/specs/mutation-schemas.d.ts +289 -7
  179. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  180. package/dist/public/operations/specs/mutation-schemas.js +28 -4
  181. package/dist/public/operations/specs/proof.d.ts +9 -0
  182. package/dist/public/operations/specs/proof.d.ts.map +1 -1
  183. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  184. package/dist/public/operations/specs/reporting.js +19 -10
  185. package/dist/public/operations/specs/upsert.d.ts +289 -7
  186. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  187. package/dist/public/proof-certificates.d.ts +163 -0
  188. package/dist/public/proof-certificates.d.ts.map +1 -0
  189. package/dist/public/proof-certificates.js +419 -0
  190. package/dist/public/proof-protocol.d.ts +259 -3
  191. package/dist/public/proof-protocol.d.ts.map +1 -1
  192. package/dist/public/proof-protocol.js +524 -3
  193. package/dist/public/proof-receipt.d.ts +90 -6
  194. package/dist/public/proof-receipt.d.ts.map +1 -1
  195. package/dist/public/proof-receipt.js +88 -7
  196. package/dist/public/proof-sources.d.ts +102 -0
  197. package/dist/public/proof-sources.d.ts.map +1 -0
  198. package/dist/public/proof-sources.js +1292 -0
  199. package/dist/public/schemas/entity.d.ts.map +1 -1
  200. package/dist/public/schemas/entity.js +39 -2
  201. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
  202. package/dist/public/skills/kibi-commit-review/SKILL.md +8 -8
  203. package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
  204. package/dist/public/skills/kibi-decisions/SKILL.md +13 -2
  205. package/dist/public/skills/kibi-decisions/resources/decision-records.md +9 -1
  206. package/dist/public/skills/kibi-freshness/SKILL.md +5 -1
  207. package/dist/public/skills/kibi-traceability/SKILL.md +12 -1
  208. package/dist/public/skills/kibi-usage/SKILL.md +8 -4
  209. package/dist/public/skills/kibi-usage/resources/proof.md +221 -20
  210. package/dist/public/skills/kibi-usage/resources/workflows.md +4 -4
  211. package/dist/report/html-report.css +83 -11
  212. package/dist/report/html-report.d.ts +8 -0
  213. package/dist/report/html-report.d.ts.map +1 -1
  214. package/dist/report/html-report.js +214 -22
  215. package/dist/report/report-view.d.ts +2 -2
  216. package/dist/report/report-view.d.ts.map +1 -1
  217. package/dist/report/report-view.js +8 -0
  218. package/dist/schemas/entity.schema.json +404 -5
  219. package/dist/search-answer.d.ts.map +1 -1
  220. package/dist/search-answer.js +1 -0
  221. package/dist/signoff/html.d.ts.map +1 -1
  222. package/dist/signoff/html.js +3 -0
  223. package/dist/signoff/markdown.d.ts.map +1 -1
  224. package/dist/signoff/markdown.js +3 -0
  225. package/dist/signoff/model.d.ts +20 -0
  226. package/dist/signoff/model.d.ts.map +1 -1
  227. package/dist/signoff/model.js +20 -1
  228. package/dist/traceability/evidence-model.d.ts +13 -12
  229. package/dist/traceability/evidence-model.d.ts.map +1 -1
  230. package/dist/traceability/evidence-model.js +1 -1
  231. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  232. package/dist/traceability/impact-knowledge.js +1 -0
  233. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  234. package/dist/traceability/staged-diagnostics.js +24 -20
  235. package/dist/traceability/staged-impact-contract.d.ts +4 -4
  236. package/dist/traceability/staged-impact-contract.js +9 -9
  237. package/dist/traceability/staged-symbols-manifest.d.ts +11 -3
  238. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  239. package/dist/traceability/staged-symbols-manifest.js +47 -140
  240. package/dist/traceability/temp-kb.d.ts.map +1 -1
  241. package/dist/traceability/temp-kb.js +1 -0
  242. package/dist/types/entities.d.ts +5 -2
  243. package/dist/types/entities.d.ts.map +1 -1
  244. package/dist/utils/merge-driver-setup.d.ts +8 -1
  245. package/dist/utils/merge-driver-setup.d.ts.map +1 -1
  246. package/dist/utils/merge-driver-setup.js +23 -2
  247. package/dist/utils/rule-registry.generated.d.ts +10 -0
  248. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  249. package/dist/utils/rule-registry.generated.js +12 -0
  250. package/dist/utils/schema-version.d.ts +1 -1
  251. package/dist/utils/schema-version.d.ts.map +1 -1
  252. package/dist/utils/schema-version.js +7 -1
  253. package/dist/utils/strict-modeling.d.ts +3 -2
  254. package/dist/utils/strict-modeling.d.ts.map +1 -1
  255. package/dist/utils/strict-modeling.js +37 -4
  256. package/dist/workspace-cwd.d.ts +15 -0
  257. package/dist/workspace-cwd.d.ts.map +1 -0
  258. package/dist/workspace-cwd.js +86 -0
  259. package/package.json +6 -2
  260. package/schema/entities.pl +6 -0
  261. package/schema/validation.pl +7 -2
  262. package/src/public/evidence-levels.ts +23 -0
  263. package/src/public/impact/coverage-depth-quality.ts +73 -0
  264. package/src/public/impact/full-kb-quality.ts +6 -1
  265. package/src/public/operations/check-executor.ts +13 -0
  266. package/src/public/operations/evidence-floor.ts +203 -0
  267. package/src/public/operations/migration-plan.ts +39 -6
  268. package/src/public/operations/node-ports.ts +3 -1
  269. package/src/public/operations/proof-contract-claims.ts +103 -0
  270. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  271. package/src/public/operations/specs/modeling.ts +24 -5
  272. package/src/public/operations/specs/mutation-schemas.ts +30 -4
  273. package/src/public/operations/specs/reporting.ts +20 -10
  274. package/src/public/proof-certificates.ts +566 -0
  275. package/src/public/proof-protocol-types.d.ts +69 -1
  276. package/src/public/proof-protocol.ts +694 -3
  277. package/src/public/proof-receipt.ts +133 -7
  278. package/src/public/proof-sources.ts +1656 -0
  279. package/src/public/schemas/entity.ts +51 -3
  280. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
  281. package/src/public/skills/kibi-commit-review/SKILL.md +8 -8
  282. package/src/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
  283. package/src/public/skills/kibi-decisions/SKILL.md +13 -2
  284. package/src/public/skills/kibi-decisions/resources/decision-records.md +9 -1
  285. package/src/public/skills/kibi-freshness/SKILL.md +5 -1
  286. package/src/public/skills/kibi-traceability/SKILL.md +12 -1
  287. package/src/public/skills/kibi-usage/SKILL.md +8 -4
  288. package/src/public/skills/kibi-usage/resources/proof.md +221 -20
  289. package/src/public/skills/kibi-usage/resources/workflows.md +4 -4
  290. package/src/schemas/entity.schema.json +404 -5
  291. package/dist/commands/proof-impact.d.ts +0 -7
  292. package/dist/commands/proof-impact.d.ts.map +0 -1
  293. package/dist/commands/proof-impact.js +0 -39
  294. package/dist/operations/proof/baseline-diff.d.ts +0 -41
  295. package/dist/operations/proof/baseline-diff.d.ts.map +0 -1
  296. package/dist/operations/proof/baseline-diff.js +0 -153
  297. package/dist/operations/proof/impact.d.ts +0 -51
  298. package/dist/operations/proof/impact.d.ts.map +0 -1
  299. package/dist/operations/proof/impact.js +0 -138
  300. package/dist/traceability/reviewed-coordinate-refresh.d.ts +0 -10
  301. package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +0 -1
  302. package/dist/traceability/reviewed-coordinate-refresh.js +0 -49
@@ -1,5 +1,12 @@
1
+ /**
2
+ * The command that runs the project's local kibi, chosen from its lockfile so
3
+ * a pnpm, Yarn or Bun repository is not told to use npm.
4
+ */
5
+ export declare function localKibiCommand(cwd: string): string;
1
6
  /** How to route the authored manifests to `kibi merge-driver`. */
2
- export declare const MERGE_DRIVER_SETUP = "Add to .gitattributes: \".kb/symbols.yaml merge=kibi\" and \".kb/relationships/*.yaml merge=kibi\"; then run: git config merge.kibi.driver \"npm exec --no -- kibi merge-driver %O %A %B\" (see docs/cli-reference.md#kibi-merge-driver-base-current-other).";
7
+ export declare function mergeDriverSetup(cwd?: string): string;
8
+ /** The npm form of {@link mergeDriverSetup}. */
9
+ export declare const MERGE_DRIVER_SETUP: string;
3
10
  /**
4
11
  * What keeps Git from resolving `.kb/symbols.yaml` with `kibi merge-driver`:
5
12
  * the attribute that routes the file to it, and the driver command. Empty
@@ -1 +1 @@
1
- {"version":3,"file":"merge-driver-setup.d.ts","sourceRoot":"","sources":["../../src/utils/merge-driver-setup.ts"],"names":[],"mappings":"AAsBA,kEAAkE;AAElE,eAAO,MAAM,kBAAkB,iQAC2N,CAAC;AAwB3P;;;;;GAKG;AAEH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAiBpE"}
1
+ {"version":3,"file":"merge-driver-setup.d.ts","sourceRoot":"","sources":["../../src/utils/merge-driver-setup.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AAEH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,kEAAkE;AAElE,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,gDAAgD;AAEhD,eAAO,MAAM,kBAAkB,QAAqB,CAAC;AAwBrD;;;;;GAKG;AAEH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAiBpE"}
@@ -16,11 +16,32 @@
16
16
  along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  import { execFileSync } from "node:child_process";
19
- import { readFileSync } from "node:fs";
19
+ import { existsSync, readFileSync } from "node:fs";
20
20
  import path from "node:path";
21
+ /**
22
+ * The command that runs the project's local kibi, chosen from its lockfile so
23
+ * a pnpm, Yarn or Bun repository is not told to use npm.
24
+ */
25
+ // implements REQ-cli-doctor
26
+ export function localKibiCommand(cwd) {
27
+ const has = (file) => existsSync(path.join(cwd, file));
28
+ if (has("pnpm-lock.yaml"))
29
+ return "pnpm exec kibi";
30
+ if (has("yarn.lock"))
31
+ return "yarn exec kibi";
32
+ if (has("bun.lock") || has("bun.lockb"))
33
+ return "bunx --no-install kibi";
34
+ return "npm exec --no -- kibi";
35
+ }
21
36
  /** How to route the authored manifests to `kibi merge-driver`. */
22
37
  // implements REQ-cli-doctor
23
- export const MERGE_DRIVER_SETUP = 'Add to .gitattributes: ".kb/symbols.yaml merge=kibi" and ".kb/relationships/*.yaml merge=kibi"; then run: git config merge.kibi.driver "npm exec --no -- kibi merge-driver %O %A %B" (see docs/cli-reference.md#kibi-merge-driver-base-current-other).';
38
+ export function mergeDriverSetup(cwd) {
39
+ const command = cwd === undefined ? "npm exec --no -- kibi" : localKibiCommand(cwd);
40
+ return `Add to .gitattributes: ".kb/symbols.yaml merge=kibi" and ".kb/relationships/*.yaml merge=kibi"; then run: git config merge.kibi.driver "${command} merge-driver %O %A %B" (see docs/cli-reference.md#kibi-merge-driver-base-current-other).`;
41
+ }
42
+ /** The npm form of {@link mergeDriverSetup}. */
43
+ // implements REQ-cli-doctor
44
+ export const MERGE_DRIVER_SETUP = mergeDriverSetup();
24
45
  function gitOutput(cwd, args) {
25
46
  try {
26
47
  return execFileSync("git", [...args], {
@@ -279,5 +279,15 @@ export declare const GENERATED_RULES: readonly [{
279
279
  readonly description: "Advisory: a property context, atom or decision key whose facts the consistency checker cannot compare (mixed value types or units, an unsupported operator or polarity, or a contradiction whose validity windows never overlap); it never counts as consistent";
280
280
  readonly enforcementClass: "advisory";
281
281
  readonly category: "integrity";
282
+ }, {
283
+ readonly name: "evidence-floor";
284
+ readonly description: "Every current requirement's computed evidence level (proved, tested, asserted, unverified) must reach its floor: required_evidence when set, otherwise tested for a firm requirement and no floor for any other. Receipts that are only older than the code count as pending re-proof and pass, unless kibi check runs with --fresh-evidence, which also needs a clean proof snapshot";
285
+ readonly enforcementClass: "canonical";
286
+ readonly category: "integrity";
287
+ }, {
288
+ readonly name: "proof-contract-claims";
289
+ readonly description: "From schema 12, every certificate-kind proof contract (exhaustive, typecheck, arithmetic, smt, rule, state_machine, regex) must name the claims it proves in proves, and each named claim must be a modeled claim of a current requirement the test reaches through its scenarios, grounded by a fact that proof kind can express or attest";
290
+ readonly enforcementClass: "canonical";
291
+ readonly category: "integrity";
282
292
  }];
283
293
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqYlB,CAAC"}
1
+ {"version":3,"file":"rule-registry.generated.d.ts","sourceRoot":"","sources":["../../src/utils/rule-registry.generated.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmZlB,CAAC"}
@@ -344,4 +344,16 @@ export const GENERATED_RULES = [
344
344
  enforcementClass: "advisory",
345
345
  category: "integrity",
346
346
  },
347
+ {
348
+ name: "evidence-floor",
349
+ description: "Every current requirement's computed evidence level (proved, tested, asserted, unverified) must reach its floor: required_evidence when set, otherwise tested for a firm requirement and no floor for any other. Receipts that are only older than the code count as pending re-proof and pass, unless kibi check runs with --fresh-evidence, which also needs a clean proof snapshot",
350
+ enforcementClass: "canonical",
351
+ category: "integrity",
352
+ },
353
+ {
354
+ name: "proof-contract-claims",
355
+ description: "From schema 12, every certificate-kind proof contract (exhaustive, typecheck, arithmetic, smt, rule, state_machine, regex) must name the claims it proves in proves, and each named claim must be a modeled claim of a current requirement the test reaches through its scenarios, grounded by a fact that proof kind can express or attest",
356
+ enforcementClass: "canonical",
357
+ category: "integrity",
358
+ },
347
359
  ];
@@ -1,4 +1,4 @@
1
- export declare const LATEST_KB_SCHEMA_VERSION = 10;
1
+ export declare const LATEST_KB_SCHEMA_VERSION = 13;
2
2
  export interface SchemaVersionStatus {
3
3
  status: "missing" | "invalid" | "older" | "current" | "newer";
4
4
  currentVersion: number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAC9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GACrD,IAAI,GACJ,SAAS,CAAC;AAGd,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,IAAI,CAgBf;AAGD,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,CAgDrB"}
1
+ {"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAC9D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GACrD,IAAI,GACJ,SAAS,CAAC;AAGd,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,IAAI,CAgBf;AAGD,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,CAgDrB"}
@@ -22,7 +22,13 @@
22
22
  // "Why this changed" section on new supersedes.
23
23
  // Schema 10 reads a requirement or ADR without firmness as firm unless an
24
24
  // agent wrote it.
25
- export const LATEST_KB_SCHEMA_VERSION = 10;
25
+ // Schema 11 checks each current requirement's evidence level against its
26
+ // floor (required_evidence, else tested when firm).
27
+ // Schema 12 requires every certificate-kind proof contract to name the
28
+ // claims it proves.
29
+ // Schema 13 derives symbol coordinates on every sync and keeps
30
+ // .kb/symbol-coordinates.yaml out of Git.
31
+ export const LATEST_KB_SCHEMA_VERSION = 13;
26
32
  // implements REQ-003
27
33
  export function normalizeSchemaVersion(schemaVersion) {
28
34
  if (schemaVersion === undefined || schemaVersion === null) {
@@ -4,8 +4,9 @@ export interface SemanticClaim {
4
4
  source: string;
5
5
  subjectKey: string;
6
6
  propertyKey: string;
7
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "neq" | "bool" | "polarity";
8
- value: string | number | boolean;
7
+ operator: "eq" | "gt" | "gte" | "lt" | "lte" | "neq" | "bool" | "polarity" | "matches" | "includes" | "subset_of" | "excludes";
8
+ /** A list of strings is a set value (operator eq, includes, subset_of or excludes). */
9
+ value: string | number | boolean | readonly string[];
9
10
  confidence: number;
10
11
  provenance?: string;
11
12
  }
@@ -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,CAAC;IACpB,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;IAC3E,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,gBAAgB,GAAG,OAAO,CAC7B,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,YAAY,CAAC,GAAG,UAAU,CAC3D,GAAG;IACF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,UAAU,CACzB,KAAK,SAAS,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,EAC7C,WAAW,SA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AQ,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,CAwH3E;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,GACtC,cAAc,EAAE,CAkBlB;AAQD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAexD;AAgCD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,GACb,MAAM,CAMR;AAiPD;;;;GAIG;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -226,6 +226,8 @@ export function normalizeSourceKey(value) {
226
226
  return normalized;
227
227
  }
228
228
  function normalizeStableValue(value) {
229
+ if (Array.isArray(value))
230
+ return normalizeStableValue([...new Set(value)].sort().join("|"));
229
231
  if (typeof value === "string") {
230
232
  const normalized = value
231
233
  .trim()
@@ -279,8 +281,20 @@ function buildUniqueTags(tags) {
279
281
  function buildPropertyFactTitle(normalizedPropertyKey, claim) {
280
282
  const label = humanizeKey(normalizedPropertyKey);
281
283
  if (claim.operator === "polarity") {
282
- return `${label} ${normalizePolarityValue(claim.value) === "forbid" ? "forbidden" : "required"}`;
284
+ return `${label} ${normalizePolarityValue(scalarValue(claim.value)) === "forbid" ? "forbidden" : "required"}`;
283
285
  }
286
+ if (Array.isArray(claim.value)) {
287
+ const setLabel = claim.operator === "includes"
288
+ ? "includes"
289
+ : claim.operator === "subset_of"
290
+ ? "within"
291
+ : claim.operator === "excludes"
292
+ ? "excludes"
293
+ : "=";
294
+ return `${label} ${setLabel} ${claim.value.join(", ")}`;
295
+ }
296
+ if (claim.operator === "matches")
297
+ return `${label} matches ${String(claim.value)}`;
284
298
  const operatorLabel = claim.operator === "bool"
285
299
  ? "="
286
300
  : claim.operator === "eq"
@@ -297,19 +311,32 @@ function buildPropertyFactTitle(normalizedPropertyKey, claim) {
297
311
  return `${label} ${operatorLabel} ${String(claim.value)}`;
298
312
  }
299
313
  function buildPropertyFactFields(claim) {
314
+ // implements REQ-kibi-source-proof-kinds
315
+ if (Array.isArray(claim.value))
316
+ return {
317
+ operator: claim.operator,
318
+ value_type: "set",
319
+ value_set: [...new Set(claim.value)].sort(),
320
+ };
321
+ if (claim.operator === "matches")
322
+ return {
323
+ operator: "matches",
324
+ value_type: "string",
325
+ value_string: String(claim.value),
326
+ };
300
327
  if (claim.operator === "polarity") {
301
328
  return {
302
329
  operator: "eq",
303
330
  value_type: "bool",
304
331
  value_bool: true,
305
- polarity: normalizePolarityValue(claim.value),
332
+ polarity: normalizePolarityValue(scalarValue(claim.value)),
306
333
  };
307
334
  }
308
335
  if (claim.operator === "bool") {
309
336
  return {
310
337
  operator: "eq",
311
338
  value_type: "bool",
312
- value_bool: normalizeBooleanValue(claim.value),
339
+ value_bool: normalizeBooleanValue(scalarValue(claim.value)),
313
340
  };
314
341
  }
315
342
  return {
@@ -328,7 +355,7 @@ function numericClaimValue(claim) {
328
355
  /^\s*-?\d+(?:\.\d+)?\s*$/.test(claim.value)) {
329
356
  return Number(claim.value);
330
357
  }
331
- return claim.value;
358
+ return scalarValue(claim.value);
332
359
  }
333
360
  function buildTypedValueFields(value) {
334
361
  if (typeof value === "boolean") {
@@ -420,3 +447,9 @@ function buildEntitySourcePath(directory, entityId) {
420
447
  export function factSourcePath(factId) {
421
448
  return buildEntitySourcePath(resolveEntitySourcePaths().facts, factId);
422
449
  }
450
+ /** A claim value as one scalar: a set value joins its members. */
451
+ function scalarValue(value) {
452
+ return Array.isArray(value)
453
+ ? value.join("|")
454
+ : value;
455
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Run from a subdirectory of a Kibi workspace against that workspace's KB,
3
+ * the way git finds its repository: walk up to the nearest directory with
4
+ * `.kb/manifest.json`. Without this, a command run from `apps/server/`
5
+ * compiles a second, empty branch store there and reports an empty KB.
6
+ * An explicit KIBI_WORKSPACE (or alias) and `kibi init` keep the given
7
+ * directory. Relative path option values keep meaning what the user typed:
8
+ * the result is the directory to run in and argv with those values made
9
+ * absolute.
10
+ */
11
+ export declare function resolveWorkspaceCwd(argv: readonly string[], cwd: string, env: NodeJS.ProcessEnv): Readonly<{
12
+ cwd: string;
13
+ argv: string[];
14
+ }>;
15
+ //# sourceMappingURL=workspace-cwd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-cwd.d.ts","sourceRoot":"","sources":["../src/workspace-cwd.ts"],"names":[],"mappings":"AAqEA;;;;;;;;;GASG;AAEH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAS3C"}
@@ -0,0 +1,86 @@
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 fs from "node:fs";
19
+ import path from "node:path";
20
+ const WORKSPACE_ENV_KEYS = [
21
+ "KIBI_WORKSPACE",
22
+ "KIBI_PROJECT_ROOT",
23
+ "KIBI_ROOT",
24
+ ];
25
+ /** Options whose value is a file or directory the user named from their shell. */
26
+ const PATH_OPTIONS = new Set([
27
+ "--input",
28
+ "--output",
29
+ "--certificates",
30
+ "--write-certificates",
31
+ ]);
32
+ /** Commands that act on the current directory itself, never on an enclosing KB. */
33
+ const CWD_COMMANDS = new Set(["init"]);
34
+ function enclosingKbRoot(start) {
35
+ let current = path.resolve(start);
36
+ while (true) {
37
+ if (fs.existsSync(path.join(current, ".kb", "manifest.json")))
38
+ return current;
39
+ const parent = path.dirname(current);
40
+ if (parent === current)
41
+ return null;
42
+ current = parent;
43
+ }
44
+ }
45
+ function absolutePathArgs(argv, base) {
46
+ const absolute = (value) => value === "-" || path.isAbsolute(value) ? value : path.resolve(base, value);
47
+ const result = [];
48
+ for (let index = 0; index < argv.length; index += 1) {
49
+ const arg = argv[index] ?? "";
50
+ const eq = arg.indexOf("=");
51
+ if (eq > 0 && PATH_OPTIONS.has(arg.slice(0, eq))) {
52
+ result.push(`${arg.slice(0, eq)}=${absolute(arg.slice(eq + 1))}`);
53
+ continue;
54
+ }
55
+ result.push(arg);
56
+ const next = argv[index + 1];
57
+ if (PATH_OPTIONS.has(arg) && next !== undefined && !next.startsWith("--")) {
58
+ result.push(absolute(next));
59
+ index += 1;
60
+ }
61
+ }
62
+ return result;
63
+ }
64
+ /**
65
+ * Run from a subdirectory of a Kibi workspace against that workspace's KB,
66
+ * the way git finds its repository: walk up to the nearest directory with
67
+ * `.kb/manifest.json`. Without this, a command run from `apps/server/`
68
+ * compiles a second, empty branch store there and reports an empty KB.
69
+ * An explicit KIBI_WORKSPACE (or alias) and `kibi init` keep the given
70
+ * directory. Relative path option values keep meaning what the user typed:
71
+ * the result is the directory to run in and argv with those values made
72
+ * absolute.
73
+ */
74
+ // implements REQ-cli-subdirectory-workspace
75
+ export function resolveWorkspaceCwd(argv, cwd, env) {
76
+ const unchanged = { cwd, argv: [...argv] };
77
+ if (WORKSPACE_ENV_KEYS.some((key) => (env[key] ?? "").trim() !== ""))
78
+ return unchanged;
79
+ const command = argv.slice(2).find((arg) => !arg.startsWith("-"));
80
+ if (command === undefined || CWD_COMMANDS.has(command))
81
+ return unchanged;
82
+ const root = enclosingKbRoot(cwd);
83
+ if (root === null || root === path.resolve(cwd))
84
+ return unchanged;
85
+ return { cwd: root, argv: absolutePathArgs(argv, cwd) };
86
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cli",
3
- "version": "2.31.1",
3
+ "version": "2.35.1",
4
4
  "type": "module",
5
5
  "description": "Kibi CLI for knowledge base management",
6
6
  "engines": {
@@ -92,6 +92,10 @@
92
92
  "types": "./dist/public/extractors/markdown.d.ts",
93
93
  "default": "./dist/public/extractors/markdown.js"
94
94
  },
95
+ "./proof-certificates": {
96
+ "types": "./dist/public/proof-certificates.d.ts",
97
+ "default": "./dist/public/proof-certificates.js"
98
+ },
95
99
  "./schemas/entity": {
96
100
  "types": "./dist/public/schemas/entity.d.ts",
97
101
  "default": "./dist/public/schemas/entity.js"
@@ -235,7 +239,7 @@
235
239
  "fast-glob": "^3.2.12",
236
240
  "gray-matter": "^4.0.3",
237
241
  "js-yaml": "^4.1.0",
238
- "kibi-core": "^0.23.0",
242
+ "kibi-core": "^0.26.1",
239
243
  "kibi-plugin-builtin": "^0.5.3",
240
244
  "kibi-plugin-sdk": "^0.5.0",
241
245
  "kibi-swipl": "^1.0.1",
@@ -56,6 +56,9 @@ entity_property(req, exempts_claims, list).
56
56
  % Absent reads as default.
57
57
  entity_property(req, firmness, atom).
58
58
  entity_property(adr, firmness, atom).
59
+ % The weakest evidence level a current requirement accepts: proved, tested,
60
+ % asserted or unverified. Absent: tested when firm, otherwise unverified.
61
+ entity_property(req, required_evidence, atom).
59
62
  % Intended outcome of a scenario: success, rejection or error.
60
63
  entity_property(scenario, expects, atom).
61
64
 
@@ -69,6 +72,8 @@ entity_property(fact, value_string, string).
69
72
  entity_property(fact, value_int, integer).
70
73
  entity_property(fact, value_number, number).
71
74
  entity_property(fact, value_bool, boolean).
75
+ % The exact members of a set fact (value_type set).
76
+ entity_property(fact, value_set, list).
72
77
  entity_property(fact, unit, string).
73
78
  entity_property(fact, scope, string).
74
79
  entity_property(fact, polarity, atom).
@@ -150,6 +155,7 @@ optional_property(req, rationale).
150
155
  optional_property(req, exempts_claims).
151
156
  optional_property(req, firmness).
152
157
  optional_property(adr, firmness).
158
+ optional_property(req, required_evidence).
153
159
  optional_property(test, verification_scope).
154
160
  optional_property(test, verification_perspective).
155
161
  optional_property(test, proof_contract).
@@ -108,6 +108,7 @@ is_fact_only_field(value_string).
108
108
  is_fact_only_field(value_int).
109
109
  is_fact_only_field(value_number).
110
110
  is_fact_only_field(value_bool).
111
+ is_fact_only_field(value_set).
111
112
  is_fact_only_field(unit).
112
113
  is_fact_only_field(scope).
113
114
  is_fact_only_field(polarity).
@@ -156,6 +157,8 @@ validate_fact_shape(property_value, Props) :-
156
157
  valid_operator(Op),
157
158
  memberchk(value_type=VT, Props),
158
159
  valid_value_type(VT),
160
+ ( Op == matches -> VT == string ; true ),
161
+ ( memberchk(Op, [includes, subset_of, excludes]) -> VT == set ; true ),
159
162
  exactly_one_value_field(Props),
160
163
  value_type_matches_field(VT, Props),
161
164
  valid_optional_fact_enums(Props),
@@ -224,10 +227,10 @@ text_atom(Value, Atom) :- atom(Value), !, Atom = Value.
224
227
  text_atom(Value, Atom) :- string(Value), atom_string(Atom, Value).
225
228
 
226
229
  % valid_operator(+Op)
227
- valid_operator(Op) :- memberchk(Op, [eq, neq, lt, lte, gt, gte]), !.
230
+ valid_operator(Op) :- memberchk(Op, [eq, neq, lt, lte, gt, gte, matches, includes, subset_of, excludes]), !.
228
231
 
229
232
  % valid_value_type(+VT)
230
- valid_value_type(ValueType) :- memberchk(ValueType, [string, int, number, bool]), !.
233
+ valid_value_type(ValueType) :- memberchk(ValueType, [string, int, number, bool, set]), !.
231
234
 
232
235
  % valid_polarity_in_props(+Props)
233
236
  % Validates polarity if present; succeeds if no polarity in props
@@ -299,6 +302,7 @@ is_value_field(value_string).
299
302
  is_value_field(value_int).
300
303
  is_value_field(value_number).
301
304
  is_value_field(value_bool).
305
+ is_value_field(value_set).
302
306
 
303
307
  % value_type_matches_field(+ValueType, +Props)
304
308
  % Ensures that value_type matches the actual value field present
@@ -306,6 +310,7 @@ value_type_matches_field(string, Props) :- memberchk(value_string=_, Props), !.
306
310
  value_type_matches_field(int, Props) :- memberchk(value_int=_, Props), !.
307
311
  value_type_matches_field(number, Props) :- memberchk(value_number=_, Props), !.
308
312
  value_type_matches_field(bool, Props) :- memberchk(value_bool=_, Props), !.
313
+ value_type_matches_field(set, Props) :- memberchk(value_set=_, Props), !.
309
314
 
310
315
  % valid_origin_in_props(+Props)
311
316
  % Entity provenance travels as a JSON object string (or a dict). When present
@@ -0,0 +1,23 @@
1
+ /**
2
+ * How strong the evidence behind a requirement is, strongest first. proved: a
3
+ * re-checkable certificate covers every case. tested: fresh passing E2E
4
+ * receipts cover every linked scenario. asserted: a person stands behind it.
5
+ * unverified: an agent wrote it and no person approved it. The same list is
6
+ * the vocabulary of required_evidence, a requirement's evidence floor.
7
+ */
8
+ // implements REQ-kibi-evidence-levels, REQ-kibi-evidence-floors
9
+ export const EVIDENCE_LEVELS = [
10
+ "proved",
11
+ "tested",
12
+ "asserted",
13
+ "unverified",
14
+ ] as const;
15
+
16
+ // implements REQ-kibi-evidence-levels
17
+ export type EvidenceLevel = (typeof EVIDENCE_LEVELS)[number];
18
+
19
+ /** Higher is stronger: unverified 0 through proved 3. */
20
+ // implements REQ-kibi-evidence-floors
21
+ export function evidenceRank(level: EvidenceLevel): number {
22
+ return EVIDENCE_LEVELS.length - 1 - EVIDENCE_LEVELS.indexOf(level);
23
+ }
@@ -2,6 +2,7 @@ import type {
2
2
  ExtractedEntity,
3
3
  ExtractionResult,
4
4
  } from "../../extractors/markdown.js";
5
+ import { COARSE_GRANULARITY_REASONS } from "../symbol-granularity.generated.js";
5
6
  import type { QualityDiagnostic } from "./types.js";
6
7
 
7
8
  type ReviewableCoverageDepth =
@@ -347,3 +348,75 @@ export function createCoverageDepthQualityDiagnostics(
347
348
  (left.entityId ?? "").localeCompare(right.entityId ?? ""),
348
349
  );
349
350
  }
351
+
352
+ const COARSE_REASONS: ReadonlySet<string> = new Set(COARSE_GRANULARITY_REASONS);
353
+
354
+ /**
355
+ * Requirements whose every implementing production symbol is a whole-file
356
+ * anchor (a coarse granularity_reason). Coverage then only says some test
357
+ * touches the file, so `tested` evidence is cheap; narrower behavioral
358
+ * symbols would tie it to the code that implements the claim.
359
+ */
360
+ // implements REQ-audit-quality-diagnostics-v1
361
+ export function createCoarseAnchorQualityDiagnostics(
362
+ manifestResults: readonly ExtractionResult[],
363
+ ): readonly QualityDiagnostic[] {
364
+ const superseded = supersededRequirementIds(manifestResults);
365
+ const anchorsByRequirement = new Map<string, ExtractedEntity[]>();
366
+ for (const result of manifestResults) {
367
+ if (result.entity.type !== "symbol") continue;
368
+ // Executable test code is not a production symbol.
369
+ if (result.relationships.some((rel) => rel.type === "executable_for"))
370
+ continue;
371
+ for (const relationship of result.relationships) {
372
+ if (relationship.type !== "implements") continue;
373
+ const list = anchorsByRequirement.get(relationship.to) ?? [];
374
+ list.push(result.entity);
375
+ anchorsByRequirement.set(relationship.to, list);
376
+ }
377
+ }
378
+ return manifestResults
379
+ .filter(
380
+ (result) =>
381
+ result.entity.type === "req" &&
382
+ isReviewableRequirement(result.entity, superseded),
383
+ )
384
+ .flatMap((result): QualityDiagnostic[] => {
385
+ const symbols = uniqueEntities(
386
+ anchorsByRequirement.get(result.entity.id) ?? [],
387
+ );
388
+ if (
389
+ symbols.length === 0 ||
390
+ !symbols.every((symbol) =>
391
+ COARSE_REASONS.has(symbol.granularity_reason ?? ""),
392
+ )
393
+ )
394
+ return [];
395
+ const requirement = result.entity;
396
+ return [
397
+ {
398
+ id: "coarse_anchor_only_review",
399
+ severity: "review",
400
+ blocking: false,
401
+ category: "coverage",
402
+ entityId: requirement.id,
403
+ source: requirement.source,
404
+ files: [requirement.source],
405
+ message: `Requirement ${requirement.id} (${requirement.title}) is implemented only by whole-file anchors, so its coverage says a test touches those files, not the code behind the claim.`,
406
+ suggestion:
407
+ "Link the functions, methods or types that implement the requirement with implements (and covered_by to their tests); keep the file anchor only for genuinely module-level behavior.",
408
+ evidence: {
409
+ requirementId: requirement.id,
410
+ title: requirement.title,
411
+ symbols: symbols.map((symbol) => ({
412
+ id: symbol.id,
413
+ granularityReason: symbol.granularity_reason ?? "",
414
+ })),
415
+ },
416
+ },
417
+ ];
418
+ })
419
+ .toSorted((left, right) =>
420
+ (left.entityId ?? "").localeCompare(right.entityId ?? ""),
421
+ );
422
+ }
@@ -24,7 +24,10 @@ import {
24
24
  createTelemetryAcceptanceDiagnostics,
25
25
  parseTelemetryUsageLog,
26
26
  } from "../telemetry-acceptance.js";
27
- import { createCoverageDepthQualityDiagnostics } from "./coverage-depth-quality.js";
27
+ import {
28
+ createCoarseAnchorQualityDiagnostics,
29
+ createCoverageDepthQualityDiagnostics,
30
+ } from "./coverage-depth-quality.js";
28
31
  import { createRequirementQualityDiagnostics } from "./requirement-quality.js";
29
32
  import { createSymbolQualityDiagnostics } from "./symbol-quality.js";
30
33
  import type { QualityDiagnostic } from "./types.js";
@@ -297,6 +300,7 @@ function toExtractedEntity(entity: Record<string, unknown>): ExtractedEntity {
297
300
  "aliases",
298
301
  "examples",
299
302
  "predicate_args",
303
+ "value_set",
300
304
  ] as const) {
301
305
  const values = optionalStringArrayField(entity, field);
302
306
  if (values !== undefined) extracted[field] = values;
@@ -786,6 +790,7 @@ export async function collectFullKbQualityDiagnostics(
786
790
  : {}),
787
791
  }),
788
792
  ...coverageDepthDiagnostics,
793
+ ...createCoarseAnchorQualityDiagnostics(manifestResults),
789
794
  ...createSymbolQualityDiagnostics({
790
795
  manifestResults,
791
796
  symbolsByFile: new Map(),
@@ -46,6 +46,7 @@ import { collectCheckPolicyViolations } from "./check-policy-rules.js";
46
46
  import { collectDecisionFirmnessViolations } from "./decision-firmness.js";
47
47
  import { executeStatus } from "./discovery-executors.js";
48
48
  import { collectEntityContextViolations } from "./entity-context.js";
49
+ import { collectEvidenceFloorViolations } from "./evidence-floor.js";
49
50
  import {
50
51
  buildActionsFromCheck,
51
52
  buildMigrationPlan,
@@ -53,6 +54,7 @@ import {
53
54
  } from "./migration-plan.js";
54
55
  import { collectOriginReviewViolations } from "./origin-review.js";
55
56
  import { collectPredicateSchemaConformanceViolations } from "./predicate-schema-conformance.js";
57
+ import { collectProofContractClaimViolations } from "./proof-contract-claims.js";
56
58
  import type { OperationContext, PrologPort } from "./runtime-types.js";
57
59
  import {
58
60
  SOURCE_PATH_DANGLING_RULE,
@@ -72,6 +74,8 @@ export type CheckInput = {
72
74
  readonly includeWorkingTreeDiff?: boolean;
73
75
  readonly includeImpactDiagnostics?: boolean;
74
76
  readonly maxDiagnostics?: number;
77
+ /** evidence-floor judges receipts as they are and needs a clean snapshot. */
78
+ readonly freshEvidence?: boolean;
75
79
  };
76
80
 
77
81
  export type CheckPayload = CheckStructuredContent;
@@ -393,6 +397,13 @@ export async function executeCheck(
393
397
  rulesAllowlist,
394
398
  workspaceRoot,
395
399
  );
400
+ const evidenceFloorFindings = await collectEvidenceFloorViolations(
401
+ context,
402
+ rulesAllowlist,
403
+ { freshEvidence: args.freshEvidence === true },
404
+ );
405
+ const proofContractClaimFindings =
406
+ await collectProofContractClaimViolations(context, rulesAllowlist);
396
407
  const partitioned = partitionCheckFindings([
397
408
  ...aggregatedFindings,
398
409
  ...queryPlanViolations,
@@ -404,6 +415,8 @@ export async function executeCheck(
404
415
  ...entityContextFindings,
405
416
  ...decisionFirmnessFindings,
406
417
  ...checkPolicyFindings,
418
+ ...evidenceFloorFindings,
419
+ ...proofContractClaimFindings,
407
420
  ]);
408
421
  const violations: Violation[] = partitioned.violations;
409
422
  const evaluated = await describeEvaluation(prolog, rulesAllowlist);