kibi-cli 0.19.0 → 1.0.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 (506) hide show
  1. package/dist/cli-operation-loader.d.ts.map +1 -1
  2. package/dist/cli-operation-loader.js +53 -20
  3. package/dist/cli-operation-metadata.d.ts +20 -8
  4. package/dist/cli-operation-metadata.d.ts.map +1 -1
  5. package/dist/cli-operation-metadata.js +23 -8
  6. package/dist/cli-protocol.d.ts.map +1 -1
  7. package/dist/cli-protocol.js +38 -8
  8. package/dist/cli-register-foundation.d.ts.map +1 -1
  9. package/dist/cli-register-foundation.js +14 -2
  10. package/dist/cli-register-maintenance.d.ts.map +1 -1
  11. package/dist/cli-register-maintenance.js +26 -4
  12. package/dist/cli-register-reporting.d.ts.map +1 -1
  13. package/dist/cli-register-reporting.js +10 -0
  14. package/dist/cli-register-verification.d.ts +3 -0
  15. package/dist/cli-register-verification.d.ts.map +1 -0
  16. package/dist/cli-register-verification.js +16 -0
  17. package/dist/cli.d.ts.map +1 -1
  18. package/dist/cli.js +2 -0
  19. package/dist/commands/aggregated-checks.d.ts +1 -2
  20. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  21. package/dist/commands/aggregated-checks.js +14 -9
  22. package/dist/commands/branch.d.ts +36 -0
  23. package/dist/commands/branch.d.ts.map +1 -1
  24. package/dist/commands/branch.js +371 -40
  25. package/dist/commands/check.d.ts.map +1 -1
  26. package/dist/commands/check.js +20 -67
  27. package/dist/commands/discovery-shared.d.ts.map +1 -1
  28. package/dist/commands/discovery-shared.js +10 -19
  29. package/dist/commands/doctor.d.ts +4 -1
  30. package/dist/commands/doctor.d.ts.map +1 -1
  31. package/dist/commands/doctor.js +259 -24
  32. package/dist/commands/engine.d.ts.map +1 -1
  33. package/dist/commands/engine.js +10 -7
  34. package/dist/commands/gc.d.ts +5 -2
  35. package/dist/commands/gc.d.ts.map +1 -1
  36. package/dist/commands/gc.js +140 -71
  37. package/dist/commands/github-init.d.ts +56 -0
  38. package/dist/commands/github-init.d.ts.map +1 -0
  39. package/dist/commands/github-init.js +310 -0
  40. package/dist/commands/init-helpers.d.ts +1 -1
  41. package/dist/commands/init-helpers.d.ts.map +1 -1
  42. package/dist/commands/init-helpers.js +73 -25
  43. package/dist/commands/init.d.ts +2 -0
  44. package/dist/commands/init.d.ts.map +1 -1
  45. package/dist/commands/init.js +79 -24
  46. package/dist/commands/legacy-storage-migration.d.ts +54 -0
  47. package/dist/commands/legacy-storage-migration.d.ts.map +1 -0
  48. package/dist/commands/legacy-storage-migration.js +277 -0
  49. package/dist/commands/migrate.d.ts +7 -0
  50. package/dist/commands/migrate.d.ts.map +1 -1
  51. package/dist/commands/migrate.js +244 -91
  52. package/dist/commands/report.d.ts +24 -0
  53. package/dist/commands/report.d.ts.map +1 -0
  54. package/dist/commands/report.js +191 -0
  55. package/dist/commands/sync/cache.d.ts +16 -3
  56. package/dist/commands/sync/cache.d.ts.map +1 -1
  57. package/dist/commands/sync/cache.js +111 -4
  58. package/dist/commands/sync/discovery.d.ts +23 -2
  59. package/dist/commands/sync/discovery.d.ts.map +1 -1
  60. package/dist/commands/sync/discovery.js +196 -15
  61. package/dist/commands/sync/extraction.d.ts +8 -1
  62. package/dist/commands/sync/extraction.d.ts.map +1 -1
  63. package/dist/commands/sync/extraction.js +38 -4
  64. package/dist/commands/sync/manifest.d.ts +8 -5
  65. package/dist/commands/sync/manifest.d.ts.map +1 -1
  66. package/dist/commands/sync/manifest.js +142 -39
  67. package/dist/commands/sync/persistence.d.ts.map +1 -1
  68. package/dist/commands/sync/persistence.js +3 -0
  69. package/dist/commands/sync.d.ts +6 -0
  70. package/dist/commands/sync.d.ts.map +1 -1
  71. package/dist/commands/sync.js +304 -79
  72. package/dist/commands/verify.d.ts +10 -0
  73. package/dist/commands/verify.d.ts.map +1 -0
  74. package/dist/commands/verify.js +126 -0
  75. package/dist/diagnostics.d.ts +1 -1
  76. package/dist/diagnostics.d.ts.map +1 -1
  77. package/dist/engine.d.ts +96 -3
  78. package/dist/engine.d.ts.map +1 -1
  79. package/dist/engine.js +392 -23
  80. package/dist/env.d.ts.map +1 -1
  81. package/dist/env.js +5 -6
  82. package/dist/extractors/manifest.d.ts +8 -1
  83. package/dist/extractors/manifest.d.ts.map +1 -1
  84. package/dist/extractors/manifest.js +51 -9
  85. package/dist/extractors/markdown.d.ts +2 -1
  86. package/dist/extractors/markdown.d.ts.map +1 -1
  87. package/dist/extractors/markdown.js +21 -3
  88. package/dist/extractors/playwright-cases.d.ts +24 -0
  89. package/dist/extractors/playwright-cases.d.ts.map +1 -0
  90. package/dist/extractors/playwright-cases.js +126 -0
  91. package/dist/extractors/relationships.d.ts.map +1 -1
  92. package/dist/extractors/relationships.js +1 -0
  93. package/dist/extractors/symbol-coordinates.d.ts +81 -3
  94. package/dist/extractors/symbol-coordinates.d.ts.map +1 -1
  95. package/dist/extractors/symbol-coordinates.js +389 -51
  96. package/dist/extractors/symbols-coordinator.js +11 -1
  97. package/dist/intent-search.d.ts +60 -0
  98. package/dist/intent-search.d.ts.map +1 -0
  99. package/dist/intent-search.js +433 -0
  100. package/dist/operations/bootstrap/activation.d.ts.map +1 -0
  101. package/dist/operations/{autopilot → bootstrap}/activation.js +48 -31
  102. package/dist/operations/{autopilot → bootstrap}/candidate-helpers.d.ts.map +1 -1
  103. package/dist/operations/bootstrap/candidates.d.ts +4 -0
  104. package/dist/operations/{autopilot → bootstrap}/candidates.d.ts.map +1 -1
  105. package/dist/operations/{autopilot → bootstrap}/candidates.js +22 -8
  106. package/dist/operations/{autopilot → bootstrap}/discovery-evidence.d.ts +2 -2
  107. package/dist/operations/{autopilot → bootstrap}/discovery-evidence.d.ts.map +1 -1
  108. package/dist/operations/{autopilot → bootstrap}/discovery-evidence.js +46 -6
  109. package/dist/operations/{autopilot → bootstrap}/discovery.d.ts +1 -1
  110. package/dist/operations/bootstrap/discovery.d.ts.map +1 -0
  111. package/dist/operations/{autopilot → bootstrap}/discovery.js +21 -14
  112. package/dist/operations/bootstrap/generate.d.ts +8 -0
  113. package/dist/operations/bootstrap/generate.d.ts.map +1 -0
  114. package/dist/operations/bootstrap/generate.js +204 -0
  115. package/dist/operations/{autopilot → bootstrap}/guidance-actions.d.ts +2 -2
  116. package/dist/operations/{autopilot → bootstrap}/guidance-actions.d.ts.map +1 -1
  117. package/dist/operations/{autopilot → bootstrap}/guidance-actions.js +4 -4
  118. package/dist/operations/{autopilot → bootstrap}/guidance.d.ts +2 -2
  119. package/dist/operations/{autopilot → bootstrap}/guidance.d.ts.map +1 -1
  120. package/dist/operations/{autopilot → bootstrap}/guidance.js +2 -0
  121. package/dist/operations/{autopilot → bootstrap}/markdown-candidates.d.ts +2 -2
  122. package/dist/operations/{autopilot → bootstrap}/markdown-candidates.d.ts.map +1 -1
  123. package/dist/operations/{autopilot → bootstrap}/markdown-candidates.js +4 -3
  124. package/dist/operations/bootstrap/presentation.d.ts +15 -0
  125. package/dist/operations/bootstrap/presentation.d.ts.map +1 -0
  126. package/dist/operations/bootstrap/presentation.js +177 -0
  127. package/dist/operations/{autopilot → bootstrap}/requirement-claims.d.ts.map +1 -1
  128. package/dist/operations/{autopilot → bootstrap}/types.d.ts +63 -21
  129. package/dist/operations/bootstrap/types.d.ts.map +1 -0
  130. package/dist/operations/bootstrap/types.js +25 -0
  131. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  132. package/dist/operations/modeling/model-requirement.js +4 -17
  133. package/dist/operations/modeling/predicate-applicability.d.ts +16 -0
  134. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -0
  135. package/dist/operations/modeling/predicate-applicability.js +276 -0
  136. package/dist/operations/modeling/predicate-applyplan.d.ts +13 -2
  137. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  138. package/dist/operations/modeling/predicate-applyplan.js +100 -3
  139. package/dist/operations/modeling/predicate-bindings.d.ts +6 -0
  140. package/dist/operations/modeling/predicate-bindings.d.ts.map +1 -0
  141. package/dist/operations/modeling/predicate-bindings.js +122 -0
  142. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -1
  143. package/dist/operations/modeling/predicate-catalog-4.js +155 -0
  144. package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -1
  145. package/dist/operations/modeling/predicate-inference-1.js +8 -0
  146. package/dist/operations/modeling/predicate-inference-launcher.d.ts +10 -0
  147. package/dist/operations/modeling/predicate-inference-launcher.d.ts.map +1 -0
  148. package/dist/operations/modeling/predicate-inference-launcher.js +13 -0
  149. package/dist/operations/modeling/predicate-inference.d.ts.map +1 -1
  150. package/dist/operations/modeling/predicate-inference.js +4 -0
  151. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  152. package/dist/operations/modeling/predicate-loader.js +7 -0
  153. package/dist/operations/modeling/predicate-ranker.d.ts +8 -1
  154. package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
  155. package/dist/operations/modeling/predicate-ranker.js +156 -24
  156. package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -1
  157. package/dist/operations/modeling/predicate-score-3.js +6 -0
  158. package/dist/operations/modeling/predicate-types.d.ts +34 -0
  159. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  160. package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -1
  161. package/dist/operations/modeling/predicate-usage-hints-3.js +40 -0
  162. package/dist/operations/modeling/predicate-utils.d.ts.map +1 -1
  163. package/dist/operations/modeling/predicate-utils.js +2 -0
  164. package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
  165. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  166. package/dist/operations/modeling/suggest-predicates.js +170 -32
  167. package/dist/operations/mutation/delete.d.ts.map +1 -1
  168. package/dist/operations/mutation/delete.js +415 -19
  169. package/dist/operations/mutation/entity-projection.d.ts +11 -0
  170. package/dist/operations/mutation/entity-projection.d.ts.map +1 -0
  171. package/dist/operations/mutation/entity-projection.js +14 -0
  172. package/dist/operations/mutation/relationships.d.ts +10 -0
  173. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  174. package/dist/operations/mutation/relationships.js +71 -1
  175. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  176. package/dist/operations/mutation/serialization.js +1 -0
  177. package/dist/operations/mutation/source-authoring.d.ts +61 -0
  178. package/dist/operations/mutation/source-authoring.d.ts.map +1 -0
  179. package/dist/operations/mutation/source-authoring.js +543 -0
  180. package/dist/operations/mutation/symbol-compiler-lock.d.ts +51 -0
  181. package/dist/operations/mutation/symbol-compiler-lock.d.ts.map +1 -0
  182. package/dist/operations/mutation/symbol-compiler-lock.js +274 -0
  183. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  184. package/dist/operations/mutation/symbol-granularity.js +34 -3
  185. package/dist/operations/mutation/symbol-refresh.d.ts +18 -1
  186. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
  187. package/dist/operations/mutation/symbol-refresh.js +225 -63
  188. package/dist/operations/mutation/types.d.ts +57 -1
  189. package/dist/operations/mutation/types.d.ts.map +1 -1
  190. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  191. package/dist/operations/mutation/upsert.js +363 -24
  192. package/dist/operations/mutation/validation.d.ts.map +1 -1
  193. package/dist/operations/mutation/validation.js +1 -0
  194. package/dist/operations/planning/apply-plan.d.ts +117 -0
  195. package/dist/operations/planning/apply-plan.d.ts.map +1 -0
  196. package/dist/operations/planning/apply-plan.js +1437 -0
  197. package/dist/operations/planning/compile-intent.d.ts +106 -0
  198. package/dist/operations/planning/compile-intent.d.ts.map +1 -0
  199. package/dist/operations/planning/compile-intent.js +562 -0
  200. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  201. package/dist/operations/semantic-advisor/analyze-prose.js +6 -2
  202. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  203. package/dist/operations/semantic-advisor/clauses.js +15 -2
  204. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  205. package/dist/operations/semantic-advisor/ingestion-boundary.js +7 -3
  206. package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +51 -0
  207. package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -0
  208. package/dist/operations/semantic-advisor/predicate-rules-launcher.js +96 -0
  209. package/dist/operations/semantic-advisor/types.d.ts +13 -5
  210. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  211. package/dist/operations/verification/ingest-verification.d.ts +29 -0
  212. package/dist/operations/verification/ingest-verification.d.ts.map +1 -0
  213. package/dist/operations/verification/ingest-verification.js +192 -0
  214. package/dist/prolog/codec.d.ts.map +1 -1
  215. package/dist/prolog/codec.js +2 -1
  216. package/dist/prolog.d.ts.map +1 -1
  217. package/dist/prolog.js +27 -8
  218. package/dist/public/branch-resolver.d.ts +1 -0
  219. package/dist/public/branch-resolver.d.ts.map +1 -1
  220. package/dist/public/branch-resolver.js +1 -0
  221. package/dist/public/check-types.d.ts +2 -2
  222. package/dist/public/check-types.d.ts.map +1 -1
  223. package/dist/public/check-types.js +16 -16
  224. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  225. package/dist/public/diagnostic-usage.js +69 -1
  226. package/dist/public/distribution-parity.d.ts +1 -1
  227. package/dist/public/distribution-parity.d.ts.map +1 -1
  228. package/dist/public/distribution-parity.js +1 -0
  229. package/dist/public/ignore-policy.d.ts.map +1 -1
  230. package/dist/public/ignore-policy.js +16 -4
  231. package/dist/public/impact/coverage-depth-quality.d.ts +6 -1
  232. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
  233. package/dist/public/impact/coverage-depth-quality.js +21 -3
  234. package/dist/public/impact/full-kb-quality.d.ts +4 -2
  235. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  236. package/dist/public/impact/full-kb-quality.js +61 -1
  237. package/dist/public/impact/manifest.d.ts.map +1 -1
  238. package/dist/public/impact/manifest.js +2 -5
  239. package/dist/public/operational-artifacts.d.ts.map +1 -1
  240. package/dist/public/operational-artifacts.js +7 -1
  241. package/dist/public/operations/catalog.d.ts +682 -67
  242. package/dist/public/operations/catalog.d.ts.map +1 -1
  243. package/dist/public/operations/catalog.js +126 -4
  244. package/dist/public/operations/check-executor.d.ts +2 -2
  245. package/dist/public/operations/check-executor.d.ts.map +1 -1
  246. package/dist/public/operations/check-executor.js +72 -13
  247. package/dist/public/operations/check-format-shared.d.ts +3 -0
  248. package/dist/public/operations/check-format-shared.d.ts.map +1 -1
  249. package/dist/public/operations/check-format-shared.js +3 -0
  250. package/dist/public/operations/check-helpers.d.ts +27 -2
  251. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  252. package/dist/public/operations/check-helpers.js +62 -26
  253. package/dist/public/operations/contracts.d.ts +11 -0
  254. package/dist/public/operations/contracts.d.ts.map +1 -0
  255. package/dist/public/operations/contracts.js +325 -0
  256. package/dist/public/operations/discovery-executors.d.ts +37 -1
  257. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  258. package/dist/public/operations/discovery-executors.js +206 -6
  259. package/dist/public/operations/index.d.ts +9 -4
  260. package/dist/public/operations/index.d.ts.map +1 -1
  261. package/dist/public/operations/index.js +8 -3
  262. package/dist/public/operations/migration-plan.d.ts +101 -0
  263. package/dist/public/operations/migration-plan.d.ts.map +1 -0
  264. package/dist/public/operations/migration-plan.js +537 -0
  265. package/dist/public/operations/node-ports.d.ts.map +1 -1
  266. package/dist/public/operations/node-ports.js +68 -8
  267. package/dist/public/operations/prolog-json.d.ts +14 -0
  268. package/dist/public/operations/prolog-json.d.ts.map +1 -1
  269. package/dist/public/operations/prolog-json.js +44 -5
  270. package/dist/public/operations/repair-plan.d.ts.map +1 -1
  271. package/dist/public/operations/repair-plan.js +1 -0
  272. package/dist/public/operations/result-envelope.d.ts +13 -0
  273. package/dist/public/operations/result-envelope.d.ts.map +1 -0
  274. package/dist/public/operations/result-envelope.js +104 -0
  275. package/dist/public/operations/runtime-types.d.ts +97 -7
  276. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  277. package/dist/public/operations/source-relationship-parity.d.ts +13 -0
  278. package/dist/public/operations/source-relationship-parity.d.ts.map +1 -0
  279. package/dist/public/operations/source-relationship-parity.js +162 -0
  280. package/dist/public/operations/specs/{autopilot.d.ts → bootstrap.d.ts} +9 -9
  281. package/dist/public/operations/specs/bootstrap.d.ts.map +1 -0
  282. package/dist/public/operations/specs/{autopilot.js → bootstrap.js} +8 -7
  283. package/dist/public/operations/specs/check.d.ts +4 -4
  284. package/dist/public/operations/specs/check.d.ts.map +1 -1
  285. package/dist/public/operations/specs/check.js +4 -3
  286. package/dist/public/operations/specs/discovery.d.ts +87 -3
  287. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  288. package/dist/public/operations/specs/discovery.js +53 -3
  289. package/dist/public/operations/specs/modeling.d.ts +3 -3
  290. package/dist/public/operations/specs/modeling.js +3 -3
  291. package/dist/public/operations/specs/mutation-schemas.d.ts +190 -47
  292. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  293. package/dist/public/operations/specs/mutation-schemas.js +3 -1
  294. package/dist/public/operations/specs/mutation.d.ts +42 -2
  295. package/dist/public/operations/specs/mutation.d.ts.map +1 -1
  296. package/dist/public/operations/specs/mutation.js +26 -2
  297. package/dist/public/operations/specs/planning.d.ts +270 -0
  298. package/dist/public/operations/specs/planning.d.ts.map +1 -0
  299. package/dist/public/operations/specs/planning.js +191 -0
  300. package/dist/public/operations/specs/reporting.d.ts +4 -1
  301. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  302. package/dist/public/operations/specs/reporting.js +46 -1
  303. package/dist/public/operations/specs/upsert.d.ts +204 -47
  304. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  305. package/dist/public/operations/specs/upsert.js +9 -0
  306. package/dist/public/operations/specs/verification.d.ts +78 -0
  307. package/dist/public/operations/specs/verification.d.ts.map +1 -0
  308. package/dist/public/operations/specs/verification.js +62 -0
  309. package/dist/public/operations/symbol-repair-plan.d.ts +11 -0
  310. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -0
  311. package/dist/public/operations/symbol-repair-plan.js +123 -0
  312. package/dist/public/operations/types.d.ts +52 -1
  313. package/dist/public/operations/types.d.ts.map +1 -1
  314. package/dist/public/playwright-case-id.d.ts +8 -0
  315. package/dist/public/playwright-case-id.d.ts.map +1 -0
  316. package/dist/public/playwright-case-id.js +25 -0
  317. package/dist/public/schemas/entity.d.ts.map +1 -1
  318. package/dist/public/schemas/entity.js +4 -2
  319. package/dist/public/skills/kibi-bootstrap/SKILL.md +58 -0
  320. package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
  321. package/dist/public/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
  322. package/dist/public/skills/kibi-bootstrap/resources/operation-access.md +5 -0
  323. package/dist/public/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
  324. package/dist/public/skills/kibi-freshness/SKILL.md +39 -9
  325. package/dist/public/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
  326. package/dist/public/skills/kibi-freshness/resources/operation-access.md +6 -0
  327. package/dist/public/skills/kibi-freshness/resources/source-authoring.md +7 -0
  328. package/dist/public/skills/kibi-traceability/SKILL.md +47 -47
  329. package/dist/public/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
  330. package/dist/public/skills/kibi-traceability/resources/operation-access.md +5 -0
  331. package/dist/public/skills/kibi-traceability/resources/source-authoring.md +6 -0
  332. package/dist/public/skills/kibi-traceability/resources/traceability.md +8 -0
  333. package/dist/public/skills/kibi-usage/SKILL.md +115 -239
  334. package/dist/public/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
  335. package/dist/public/skills/kibi-usage/resources/kb-improvement.md +38 -0
  336. package/dist/public/skills/kibi-usage/resources/operation-access.md +36 -38
  337. package/dist/public/skills/kibi-usage/resources/relationship-directions.md +3 -3
  338. package/dist/public/skills/kibi-usage/resources/source-authoring.md +31 -0
  339. package/dist/public/skills/kibi-usage/resources/workflows.md +56 -3
  340. package/dist/public/symbol-granularity.d.ts +1 -1
  341. package/dist/public/symbol-granularity.d.ts.map +1 -1
  342. package/dist/public/symbol-granularity.js +1 -0
  343. package/dist/public/telemetry-acceptance.d.ts +7 -0
  344. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  345. package/dist/public/telemetry-acceptance.js +8 -1
  346. package/dist/public/telemetry-remediation.js +1 -1
  347. package/dist/public/verification-receipt.d.ts +206 -39
  348. package/dist/public/verification-receipt.d.ts.map +1 -1
  349. package/dist/public/verification-receipt.js +171 -4
  350. package/dist/relationships/shards.d.ts +16 -0
  351. package/dist/relationships/shards.d.ts.map +1 -1
  352. package/dist/relationships/shards.js +87 -2
  353. package/dist/report/brand.d.ts +19 -0
  354. package/dist/report/brand.d.ts.map +1 -0
  355. package/dist/report/brand.js +112 -0
  356. package/dist/report/html-report.d.ts +19 -0
  357. package/dist/report/html-report.d.ts.map +1 -0
  358. package/dist/report/html-report.js +963 -0
  359. package/dist/report/relative-time.d.ts +4 -0
  360. package/dist/report/relative-time.d.ts.map +1 -0
  361. package/dist/report/relative-time.js +46 -0
  362. package/dist/report/report-view.d.ts +17 -0
  363. package/dist/report/report-view.d.ts.map +1 -0
  364. package/dist/report/report-view.js +33 -0
  365. package/dist/report/repository.d.ts +35 -0
  366. package/dist/report/repository.d.ts.map +1 -0
  367. package/dist/report/repository.js +151 -0
  368. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  369. package/dist/runtime/cli-runtime.js +82 -22
  370. package/dist/schemas/entity.schema.json +1148 -273
  371. package/dist/traceability/evidence-model.d.ts +2 -2
  372. package/dist/traceability/evidence-model.d.ts.map +1 -1
  373. package/dist/traceability/evidence-model.js +2 -2
  374. package/dist/traceability/git-staged.d.ts.map +1 -1
  375. package/dist/traceability/git-staged.js +15 -40
  376. package/dist/traceability/markdown-validate.d.ts.map +1 -1
  377. package/dist/traceability/markdown-validate.js +12 -7
  378. package/dist/traceability/staged-impact-contract.d.ts +3 -3
  379. package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
  380. package/dist/traceability/staged-impact-contract.js +10 -38
  381. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  382. package/dist/traceability/staged-symbols-manifest.js +8 -3
  383. package/dist/traceability/temp-kb.d.ts.map +1 -1
  384. package/dist/traceability/temp-kb.js +3 -0
  385. package/dist/types/entities.d.ts +3 -0
  386. package/dist/types/entities.d.ts.map +1 -1
  387. package/dist/utils/branch-resolver.d.ts +24 -10
  388. package/dist/utils/branch-resolver.d.ts.map +1 -1
  389. package/dist/utils/branch-resolver.js +121 -38
  390. package/dist/utils/branch-store-locator.d.ts +23 -0
  391. package/dist/utils/branch-store-locator.d.ts.map +1 -0
  392. package/dist/utils/branch-store-locator.js +90 -0
  393. package/dist/utils/branch-store.d.ts +15 -0
  394. package/dist/utils/branch-store.d.ts.map +1 -0
  395. package/dist/utils/branch-store.js +130 -0
  396. package/dist/utils/config.d.ts +39 -37
  397. package/dist/utils/config.d.ts.map +1 -1
  398. package/dist/utils/config.js +107 -119
  399. package/dist/utils/kb-manifest.d.ts +35 -0
  400. package/dist/utils/kb-manifest.d.ts.map +1 -0
  401. package/dist/utils/kb-manifest.js +154 -0
  402. package/dist/utils/kb-paths.d.ts +54 -0
  403. package/dist/utils/kb-paths.d.ts.map +1 -0
  404. package/dist/utils/kb-paths.js +125 -0
  405. package/dist/utils/manifest-paths.d.ts +4 -4
  406. package/dist/utils/manifest-paths.d.ts.map +1 -1
  407. package/dist/utils/manifest-paths.js +8 -56
  408. package/dist/utils/rule-registry.d.ts +48 -20
  409. package/dist/utils/rule-registry.d.ts.map +1 -1
  410. package/dist/utils/rule-registry.js +82 -77
  411. package/dist/utils/schema-version.d.ts +5 -5
  412. package/dist/utils/schema-version.d.ts.map +1 -1
  413. package/dist/utils/schema-version.js +26 -6
  414. package/dist/utils/strict-modeling.d.ts +0 -4
  415. package/dist/utils/strict-modeling.d.ts.map +1 -1
  416. package/dist/utils/strict-modeling.js +7 -8
  417. package/dist/verification/playwright-reporter.d.ts +21 -0
  418. package/dist/verification/playwright-reporter.d.ts.map +1 -0
  419. package/dist/verification/playwright-reporter.js +114 -0
  420. package/package.json +46 -7
  421. package/schema/config.json +2 -2
  422. package/schema/manifest.json +26 -0
  423. package/src/public/branch-resolver.ts +1 -0
  424. package/src/public/check-types.ts +22 -19
  425. package/src/public/diagnostic-usage.ts +79 -1
  426. package/src/public/distribution-parity.ts +1 -0
  427. package/src/public/ignore-policy.ts +16 -10
  428. package/src/public/impact/coverage-depth-quality.ts +36 -0
  429. package/src/public/impact/full-kb-quality.ts +118 -5
  430. package/src/public/impact/manifest.ts +2 -4
  431. package/src/public/operational-artifacts.ts +9 -1
  432. package/src/public/operations/catalog.ts +146 -9
  433. package/src/public/operations/check-executor.ts +102 -15
  434. package/src/public/operations/check-format-shared.ts +6 -0
  435. package/src/public/operations/check-helpers.ts +74 -35
  436. package/src/public/operations/contracts.ts +366 -0
  437. package/src/public/operations/discovery-executors.ts +299 -12
  438. package/src/public/operations/index.ts +9 -4
  439. package/src/public/operations/migration-plan.ts +740 -0
  440. package/src/public/operations/node-ports.ts +84 -10
  441. package/src/public/operations/prolog-json.ts +60 -5
  442. package/src/public/operations/repair-plan.ts +1 -0
  443. package/src/public/operations/result-envelope.ts +136 -0
  444. package/src/public/operations/runtime-types.ts +91 -5
  445. package/src/public/operations/source-relationship-parity.ts +226 -0
  446. package/src/public/operations/specs/{autopilot.ts → bootstrap.ts} +17 -16
  447. package/src/public/operations/specs/check.ts +4 -3
  448. package/src/public/operations/specs/discovery.ts +57 -3
  449. package/src/public/operations/specs/modeling.ts +3 -3
  450. package/src/public/operations/specs/mutation-schemas.ts +6 -1
  451. package/src/public/operations/specs/mutation.ts +27 -2
  452. package/src/public/operations/specs/planning.ts +234 -0
  453. package/src/public/operations/specs/reporting.ts +55 -1
  454. package/src/public/operations/specs/upsert.ts +10 -0
  455. package/src/public/operations/specs/verification.ts +78 -0
  456. package/src/public/operations/symbol-repair-plan.ts +164 -0
  457. package/src/public/operations/types.ts +62 -1
  458. package/src/public/playwright-case-id.ts +35 -0
  459. package/src/public/schemas/entity.ts +7 -2
  460. package/src/public/skills/kibi-bootstrap/SKILL.md +58 -0
  461. package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +11 -0
  462. package/src/public/skills/kibi-bootstrap/resources/branch-lifecycle.md +7 -0
  463. package/src/public/skills/kibi-bootstrap/resources/operation-access.md +5 -0
  464. package/src/public/skills/kibi-bootstrap/resources/source-authoring.md +8 -0
  465. package/src/public/skills/kibi-freshness/SKILL.md +39 -9
  466. package/src/public/skills/kibi-freshness/resources/branch-lifecycle.md +7 -0
  467. package/src/public/skills/kibi-freshness/resources/operation-access.md +6 -0
  468. package/src/public/skills/kibi-freshness/resources/source-authoring.md +7 -0
  469. package/src/public/skills/kibi-traceability/SKILL.md +47 -47
  470. package/src/public/skills/kibi-traceability/resources/branch-lifecycle.md +7 -0
  471. package/src/public/skills/kibi-traceability/resources/operation-access.md +5 -0
  472. package/src/public/skills/kibi-traceability/resources/source-authoring.md +6 -0
  473. package/src/public/skills/kibi-traceability/resources/traceability.md +8 -0
  474. package/src/public/skills/kibi-usage/SKILL.md +115 -239
  475. package/src/public/skills/kibi-usage/resources/branch-lifecycle.md +31 -0
  476. package/src/public/skills/kibi-usage/resources/kb-improvement.md +38 -0
  477. package/src/public/skills/kibi-usage/resources/operation-access.md +36 -38
  478. package/src/public/skills/kibi-usage/resources/relationship-directions.md +3 -3
  479. package/src/public/skills/kibi-usage/resources/source-authoring.md +31 -0
  480. package/src/public/skills/kibi-usage/resources/workflows.md +56 -3
  481. package/src/public/symbol-granularity.ts +1 -0
  482. package/src/public/telemetry-acceptance.ts +16 -1
  483. package/src/public/telemetry-remediation.ts +1 -1
  484. package/src/public/verification-receipt.ts +248 -6
  485. package/src/schemas/entity.schema.json +1148 -273
  486. package/templates/github/kibi-badge.yml +86 -0
  487. package/templates/github/kibi-report.yml +84 -0
  488. package/dist/operations/autopilot/activation.d.ts.map +0 -1
  489. package/dist/operations/autopilot/candidates.d.ts +0 -4
  490. package/dist/operations/autopilot/discovery.d.ts.map +0 -1
  491. package/dist/operations/autopilot/generate.d.ts +0 -8
  492. package/dist/operations/autopilot/generate.d.ts.map +0 -1
  493. package/dist/operations/autopilot/generate.js +0 -112
  494. package/dist/operations/autopilot/presentation.d.ts +0 -13
  495. package/dist/operations/autopilot/presentation.d.ts.map +0 -1
  496. package/dist/operations/autopilot/presentation.js +0 -91
  497. package/dist/operations/autopilot/types.d.ts.map +0 -1
  498. package/dist/operations/autopilot/types.js +0 -8
  499. package/dist/public/operations/specs/autopilot.d.ts.map +0 -1
  500. package/dist/public/skills/init-kibi/SKILL.md +0 -62
  501. package/src/public/skills/init-kibi/SKILL.md +0 -62
  502. /package/dist/operations/{autopilot → bootstrap}/activation.d.ts +0 -0
  503. /package/dist/operations/{autopilot → bootstrap}/candidate-helpers.d.ts +0 -0
  504. /package/dist/operations/{autopilot → bootstrap}/candidate-helpers.js +0 -0
  505. /package/dist/operations/{autopilot → bootstrap}/requirement-claims.d.ts +0 -0
  506. /package/dist/operations/{autopilot → bootstrap}/requirement-claims.js +0 -0
@@ -0,0 +1,325 @@
1
+ const anyValue = {};
2
+ const recordValue = {
3
+ type: "object",
4
+ additionalProperties: true,
5
+ };
6
+ const recordArray = {
7
+ type: "array",
8
+ items: recordValue,
9
+ };
10
+ const valueArray = {
11
+ type: "array",
12
+ items: anyValue,
13
+ };
14
+ function objectData(properties, required = []) {
15
+ return {
16
+ type: "object",
17
+ additionalProperties: false,
18
+ ...(required.length > 0 ? { required } : {}),
19
+ properties,
20
+ };
21
+ }
22
+ const stringValue = { type: "string" };
23
+ const integerValue = { type: "integer" };
24
+ const numberValue = { type: "number" };
25
+ const booleanValue = { type: "boolean" };
26
+ const stringArray = {
27
+ type: "array",
28
+ items: stringValue,
29
+ };
30
+ /** Preserve JSON Schema's nullable scalar/object representation in every
31
+ * generated consumer contract. Using a `type` union keeps the catalog
32
+ * readable and lets the MCP bridge round-trip the same wire schema. */
33
+ function nullable(schema) {
34
+ const type = schema.type;
35
+ if (typeof type === "string") {
36
+ return { ...schema, type: [type, "null"] };
37
+ }
38
+ return { anyOf: [schema, { type: "null" }] };
39
+ }
40
+ /**
41
+ * The data contract is deliberately maintained separately from the operation
42
+ * implementations. Every catalog entry therefore has a concrete payload
43
+ * shape, while nested domain records can still evolve independently.
44
+ */
45
+ export const OPERATION_DATA_SCHEMAS = {
46
+ kb_skills_list: objectData({ skills: valueArray }, ["skills"]),
47
+ kb_skills_load: objectData({
48
+ metadata: recordValue,
49
+ body: stringValue,
50
+ resources: valueArray,
51
+ contentHash: stringValue,
52
+ sourceType: stringValue,
53
+ }),
54
+ kb_skills_read: objectData({ content: stringValue }, ["content"]),
55
+ kb_query: objectData({ entities: recordArray, count: integerValue }, [
56
+ "entities",
57
+ "count",
58
+ ]),
59
+ kb_search: objectData({ results: valueArray, count: integerValue, queryAnalysis: recordValue }, ["results", "count"]),
60
+ kb_status: objectData({
61
+ branch: stringValue,
62
+ snapshotId: stringValue,
63
+ syncedAt: { type: ["string", "null"] },
64
+ dirty: booleanValue,
65
+ syncState: stringValue,
66
+ kbPath: stringValue,
67
+ lastSyncSource: stringValue,
68
+ verificationSnapshot: stringValue,
69
+ verificationSnapshotAvailable: booleanValue,
70
+ verificationSnapshotDirty: booleanValue,
71
+ verificationSnapshotFileCount: integerValue,
72
+ verificationSnapshotVersion: stringValue,
73
+ verificationSnapshotError: stringValue,
74
+ staleReasons: recordArray,
75
+ staleReasonCount: integerValue,
76
+ staleReasonsTruncated: booleanValue,
77
+ branchAttachment: recordValue,
78
+ verificationSnapshotChanges: recordArray,
79
+ verificationSnapshotChangeCount: integerValue,
80
+ verificationSnapshotChangesTruncated: booleanValue,
81
+ branchStore: recordValue,
82
+ engineStatus: recordValue,
83
+ schemaStatus: recordValue,
84
+ migrationPlan: recordValue,
85
+ bootstrap: recordValue,
86
+ }),
87
+ kb_find_gaps: objectData({
88
+ rows: recordArray,
89
+ count: integerValue,
90
+ meta: recordValue,
91
+ }),
92
+ kb_coverage: objectData({
93
+ summary: recordValue,
94
+ rows: recordArray,
95
+ repairPlan: recordValue,
96
+ legacyMigrationPlan: recordValue,
97
+ symbolRepairPlan: recordValue,
98
+ migrationPlan: recordValue,
99
+ meta: recordValue,
100
+ }),
101
+ kb_graph: objectData({
102
+ nodes: recordArray,
103
+ edges: recordArray,
104
+ truncated: booleanValue,
105
+ meta: recordValue,
106
+ }),
107
+ kb_sparql_remote: objectData({ rows: valueArray }, ["rows"]),
108
+ kb_semantic_advisor: objectData({
109
+ receipt: recordValue,
110
+ warnings: stringArray,
111
+ }),
112
+ kb_model_requirement: objectData({
113
+ statement: stringValue,
114
+ claimKey: stringValue,
115
+ logicClaims: stringArray,
116
+ source: stringValue,
117
+ sourceFiles: stringArray,
118
+ claim: recordValue,
119
+ writeSet: recordValue,
120
+ applyPlan: recordArray,
121
+ isStrict: booleanValue,
122
+ confidence: numberValue,
123
+ extractionMode: stringValue,
124
+ extractionWarnings: stringArray,
125
+ warnings: recordArray,
126
+ migrationWarning: { type: ["string", "null"] },
127
+ logic: recordValue,
128
+ }),
129
+ kb_suggest_predicates: objectData({
130
+ text: stringValue,
131
+ claimKey: stringValue,
132
+ logicClaims: stringArray,
133
+ source: { type: ["string", "null"] },
134
+ requirementId: { type: ["string", "null"] },
135
+ subject: stringValue,
136
+ candidates: recordArray,
137
+ recommendedAction: {
138
+ type: "string",
139
+ enum: [
140
+ "apply_requires_predicate",
141
+ "provide_argument_bindings",
142
+ "resolve_schema_reference",
143
+ "record_ontology_gap",
144
+ ],
145
+ },
146
+ recommendedPredicateSchema: { type: ["object", "null"] },
147
+ applyPlan: recordArray,
148
+ relationshipPlan: { type: ["object", "null"] },
149
+ warnings: stringArray,
150
+ }),
151
+ kb_plan_bootstrap: objectData({
152
+ plan: recordValue,
153
+ version: stringValue,
154
+ planHash: stringValue,
155
+ status: stringValue,
156
+ expected: recordValue,
157
+ activation: recordValue,
158
+ contextQuestions: stringArray,
159
+ activationState: stringValue,
160
+ activationMode: stringValue,
161
+ bootstrapMode: stringValue,
162
+ activationReason: stringValue,
163
+ applyBlocked: booleanValue,
164
+ migrationWarning: { type: ["string", "null"] },
165
+ handoffMessage: stringValue,
166
+ confidence: recordValue,
167
+ tldr: stringValue,
168
+ promptBlock: stringValue,
169
+ recommendedActions: recordArray,
170
+ declaredContext: recordValue,
171
+ discoverySummary: recordValue,
172
+ candidates: recordArray,
173
+ actions: recordArray,
174
+ sourceWrites: recordArray,
175
+ suppressedCandidates: recordArray,
176
+ payoffSummary: recordValue,
177
+ diagnostics: stringArray,
178
+ }, ["plan", "diagnostics"]),
179
+ kb_validate_upsert: objectData({
180
+ valid: booleanValue,
181
+ errors: valueArray,
182
+ warnings: valueArray,
183
+ semanticAdvisor: nullable(recordValue),
184
+ normalizedPreview: nullable(recordValue),
185
+ }),
186
+ kb_upsert: objectData({
187
+ created: integerValue,
188
+ updated: integerValue,
189
+ relationships_created: integerValue,
190
+ warnings: valueArray,
191
+ semanticAdvisor: recordValue,
192
+ status: stringValue,
193
+ effectFailures: recordArray,
194
+ nextActions: recordArray,
195
+ sourceWrites: recordArray,
196
+ contradictionCheck: recordValue,
197
+ }),
198
+ kb_delete: objectData({
199
+ deleted: integerValue,
200
+ relationships_deleted: integerValue,
201
+ skipped: integerValue,
202
+ errors: valueArray,
203
+ error_codes: valueArray,
204
+ relationship_results: recordArray,
205
+ sync_required: booleanValue,
206
+ sourceWrites: recordArray,
207
+ deletionPlan: recordValue,
208
+ supersessionPlan: recordValue,
209
+ status: stringValue,
210
+ effectFailures: recordArray,
211
+ nextActions: recordArray,
212
+ }),
213
+ kb_check: objectData({
214
+ violations: valueArray,
215
+ count: integerValue,
216
+ diagnostics: recordArray,
217
+ qualityDiagnostics: recordArray,
218
+ impactDiagnostics: recordArray,
219
+ sourceFiles: stringArray,
220
+ extractedSymbols: recordArray,
221
+ linkedEntities: recordArray,
222
+ nextActions: valueArray,
223
+ migrationPlan: recordValue,
224
+ }),
225
+ kb_compile_intent: objectData({
226
+ version: stringValue,
227
+ planHash: stringValue,
228
+ status: stringValue,
229
+ expected: recordValue,
230
+ target: recordValue,
231
+ discovery: recordValue,
232
+ propositions: valueArray,
233
+ contradictionAnalysis: recordValue,
234
+ proposals: valueArray,
235
+ steps: valueArray,
236
+ sourceWrites: recordArray,
237
+ diagnostics: stringArray,
238
+ }),
239
+ kb_apply_plan: objectData({
240
+ version: stringValue,
241
+ outcome: stringValue,
242
+ planHash: stringValue,
243
+ changedEntities: integerValue,
244
+ changedRelationships: integerValue,
245
+ changedPaths: stringArray,
246
+ finalSnapshots: recordValue,
247
+ validationSummary: recordValue,
248
+ recoveryJournalId: { type: ["string", "null"] },
249
+ deleted: integerValue,
250
+ sourcePaths: stringArray,
251
+ actionResults: recordArray,
252
+ notes: stringArray,
253
+ remainingPlan: recordValue,
254
+ closeout: recordValue,
255
+ status: stringValue,
256
+ effectFailures: recordArray,
257
+ nextActions: recordArray,
258
+ }),
259
+ kb_ingest_verification: objectData({
260
+ receipt: recordValue,
261
+ testId: stringValue,
262
+ proofOutcome: stringValue,
263
+ receiptCount: integerValue,
264
+ upsert: recordValue,
265
+ status: stringValue,
266
+ effectFailures: recordArray,
267
+ nextActions: recordArray,
268
+ }),
269
+ };
270
+ const EFFECT_OVERRIDES = {
271
+ kb_skills_list: {},
272
+ kb_skills_load: {},
273
+ kb_skills_read: {},
274
+ kb_query: {},
275
+ kb_search: {},
276
+ kb_status: {},
277
+ kb_find_gaps: {},
278
+ kb_coverage: {},
279
+ kb_graph: {},
280
+ kb_sparql_remote: { "network-read": { openWorld: true } },
281
+ kb_semantic_advisor: {},
282
+ kb_model_requirement: {},
283
+ kb_suggest_predicates: {},
284
+ kb_plan_bootstrap: {},
285
+ kb_validate_upsert: {},
286
+ kb_upsert: {
287
+ "kb-write": { destructive: true, retrySafety: "unsafe" },
288
+ "workspace-write": { destructive: true, retrySafety: "unsafe" },
289
+ },
290
+ kb_delete: {
291
+ "kb-write": { destructive: true, retrySafety: "unsafe" },
292
+ "workspace-write": { destructive: true, retrySafety: "unsafe" },
293
+ },
294
+ kb_check: {},
295
+ kb_compile_intent: {},
296
+ kb_apply_plan: {
297
+ "kb-write": { destructive: true, retrySafety: "unsafe" },
298
+ "workspace-write": { destructive: true, retrySafety: "unsafe" },
299
+ },
300
+ kb_ingest_verification: {
301
+ "kb-write": { destructive: true, retrySafety: "unsafe" },
302
+ },
303
+ };
304
+ export function declaredEffects(operation, effects) {
305
+ const overrides = EFFECT_OVERRIDES[operation];
306
+ if (!overrides)
307
+ throw new Error(`Missing effect contract for ${operation}`);
308
+ const expected = new Set(effects);
309
+ const declarations = effects.map((kind) => {
310
+ const override = overrides[kind] ?? {};
311
+ return {
312
+ kind,
313
+ mutability: kind === "kb-write" || kind === "workspace-write"
314
+ ? "write"
315
+ : "read",
316
+ destructive: override.destructive === true,
317
+ retrySafety: override.retrySafety ?? (override.destructive ? "unsafe" : "safe"),
318
+ openWorld: override.openWorld === true,
319
+ };
320
+ });
321
+ if (new Set(declarations.map(({ kind }) => kind)).size !== expected.size) {
322
+ throw new Error(`Duplicate effect contract for ${operation}`);
323
+ }
324
+ return declarations;
325
+ }
@@ -1,4 +1,7 @@
1
+ import { type IntentSearchAnalysis, type IntentSearchFacets, type IntentSearchMatch, type SourceLocation } from "../../intent-search.js";
1
2
  import type { SearchMatch } from "../../search-ranking.js";
3
+ import { type BranchStoreInspection } from "../../utils/branch-store.js";
4
+ import { type MigrationConfigStatus, type MigrationPlan } from "./migration-plan.js";
2
5
  import type { OperationContext } from "./runtime-types.js";
3
6
  import type { OperationResult } from "./types.js";
4
7
  export type QueryInput = {
@@ -18,10 +21,15 @@ export type SearchInput = {
18
21
  readonly type?: string;
19
22
  readonly limit?: number;
20
23
  readonly offset?: number;
24
+ readonly rankingMode?: "legacy" | "intent-v1";
25
+ readonly semanticFacets?: IntentSearchFacets;
26
+ readonly sourceLocations?: readonly SourceLocation[];
27
+ readonly minScore?: number;
21
28
  };
22
29
  export type SearchPayload = {
23
- readonly results: readonly SearchMatch[];
30
+ readonly results: readonly (SearchMatch | IntentSearchMatch)[];
24
31
  readonly count: number;
32
+ readonly queryAnalysis?: IntentSearchAnalysis;
25
33
  };
26
34
  export type StatusInput = Readonly<Record<string, never>>;
27
35
  export type StatusPayload = {
@@ -38,6 +46,34 @@ export type StatusPayload = {
38
46
  readonly verificationSnapshotFileCount?: number;
39
47
  readonly verificationSnapshotVersion?: string;
40
48
  readonly verificationSnapshotError?: string;
49
+ readonly staleReasons?: readonly Record<string, unknown>[];
50
+ readonly staleReasonCount?: number;
51
+ readonly staleReasonsTruncated?: boolean;
52
+ readonly branchAttachment?: {
53
+ readonly gitBranch: string;
54
+ readonly kbBranch: string;
55
+ readonly kind: "exact" | "explicit_override" | "legacy_compat";
56
+ readonly migrationRequired: boolean;
57
+ };
58
+ readonly verificationSnapshotChanges?: readonly Record<string, unknown>[];
59
+ readonly verificationSnapshotChangeCount?: number;
60
+ readonly verificationSnapshotChangesTruncated?: boolean;
61
+ readonly branchStore?: BranchStoreInspection;
62
+ readonly engineStatus?: {
63
+ readonly state: "healthy" | "unavailable";
64
+ readonly errorCode?: string;
65
+ readonly detail?: string;
66
+ readonly recoveryRequired: boolean;
67
+ };
68
+ readonly schemaStatus?: MigrationConfigStatus;
69
+ readonly migrationPlan?: MigrationPlan;
70
+ readonly bootstrap?: {
71
+ readonly activationState: string;
72
+ readonly activationMode: string;
73
+ readonly planEligible: boolean;
74
+ readonly reason: string;
75
+ readonly nextAction?: Readonly<Record<string, unknown>>;
76
+ };
41
77
  };
42
78
  export declare function executeQuery(input: QueryInput, context: OperationContext): Promise<OperationResult<QueryPayload>>;
43
79
  export declare function executeSearch(input: SearchInput, context: OperationContext): Promise<OperationResult<SearchPayload>>;
@@ -1 +1 @@
1
- {"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAO3D,O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,YAAY,CAAC,CAAC,CA6DxC;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CA+FzC;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CA+NzC"}
@@ -1,6 +1,12 @@
1
+ import { EngineClient } from "../../engine.js";
2
+ import { executeIntentSearch, validateIntentSearchInput, } from "../../intent-search.js";
3
+ import { classifyActivation } from "../../operations/bootstrap/activation.js";
1
4
  import { rankEntities } from "../../search-ranking.js";
5
+ import { resolveBranchAttachment } from "../../utils/branch-resolver.js";
6
+ import { branchStoreReason, inspectBranchStore, } from "../../utils/branch-store.js";
2
7
  import { loadEntities, paginateResults, validateEntityType, } from "./discovery-entities.js";
3
- import { runOperationJsonQuery } from "./prolog-json.js";
8
+ import { buildActionsFromStatus, readMigrationConfigStatus, } from "./migration-plan.js";
9
+ import { OperationJsonDecodeError, runOperationJsonQuery, } from "./prolog-json.js";
4
10
  import { readWorkspaceSnapshot } from "./workspace-snapshot.js";
5
11
  function requireProlog(context) {
6
12
  if (!context.prolog) {
@@ -75,7 +81,7 @@ export async function executeQuery(input, context) {
75
81
  }
76
82
  export async function executeSearch(input, context) {
77
83
  // implements REQ-kibi-operation-interface-parity, REQ-mcp-search-discovery
78
- const { query, type, limit = 20, offset = 0 } = input;
84
+ const { query, type, limit = 20, offset = 0, rankingMode = "legacy", semanticFacets, sourceLocations, minScore, } = input;
79
85
  const trimmedQuery = query.trim();
80
86
  if (!trimmedQuery) {
81
87
  throw new Error("Search execution failed: query must be a non-empty string");
@@ -83,6 +89,34 @@ export async function executeSearch(input, context) {
83
89
  validateEntityType(type);
84
90
  try {
85
91
  const prolog = requireProlog(context);
92
+ const intentMode = rankingMode === "intent-v1" ||
93
+ semanticFacets !== undefined ||
94
+ sourceLocations !== undefined;
95
+ if (intentMode) {
96
+ const intentInput = {
97
+ query: trimmedQuery,
98
+ ...(type !== undefined ? { type } : {}),
99
+ ...(semanticFacets !== undefined ? { semanticFacets } : {}),
100
+ ...(sourceLocations !== undefined ? { sourceLocations } : {}),
101
+ ...(minScore !== undefined ? { minScore } : {}),
102
+ };
103
+ validateIntentSearchInput(intentInput);
104
+ const intentResult = await executeIntentSearch(intentInput, prolog, context.workspaceRoot);
105
+ const paginated = paginateResults(intentResult.matches, limit, offset);
106
+ const text = intentResult.matches.length === 0
107
+ ? `No intent search results for '${trimmedQuery}' (abstained).`
108
+ : `Found ${intentResult.matches.length} intent search results for '${trimmedQuery}'. Showing ${paginated.length} (offset ${offset}, limit ${limit}): ${paginated
109
+ .map((match) => `${String(match.entity.id ?? "")} [${match.reasons.join(", ")}]`)
110
+ .join(", ")}`;
111
+ return {
112
+ content: [{ type: "text", text }],
113
+ structuredContent: {
114
+ results: paginated,
115
+ count: intentResult.matches.length,
116
+ queryAnalysis: intentResult.analysis,
117
+ },
118
+ };
119
+ }
86
120
  const indexedCandidates = prolog.searchEntities
87
121
  ? await prolog.searchEntities({
88
122
  query: trimmedQuery,
@@ -118,13 +152,106 @@ export async function executeSearch(input, context) {
118
152
  export async function executeStatus(_input, context) {
119
153
  // implements REQ-kibi-operation-interface-parity, REQ-cli-status-pre-first-sync
120
154
  try {
121
- const payload = await runOperationJsonQuery(requireProlog(context), "status.pl", "status:kb_status_json(JsonString)", "Status execution");
122
- if (!isStatusPayload(payload)) {
123
- throw new Error("Status execution query returned an invalid payload");
155
+ const attachment = context.branchAttachment ??
156
+ resolveBranchAttachment(context.workspaceRoot);
157
+ if ("error" in attachment) {
158
+ throw new Error(`Failed to resolve active branch: ${attachment.error}`);
124
159
  }
160
+ let payload;
161
+ const store = inspectBranchStore(context.workspaceRoot, attachment.kbBranch);
162
+ let engineStatus;
163
+ let ownedEngine;
164
+ if (store.state !== "healthy") {
165
+ // Status is deliberately safe before first sync and during recovery. Starting
166
+ // EngineClient would initialise (or attempt to repair) the store, which turns
167
+ // a diagnostic read into an accidental mutation.
168
+ payload = {
169
+ branch: attachment.kbBranch,
170
+ snapshotId: store.state === "missing" ? "missing" : "unavailable",
171
+ syncedAt: null,
172
+ dirty: true,
173
+ syncState: "unknown",
174
+ kbPath: store.path,
175
+ lastSyncSource: "unavailable",
176
+ staleReasons: [],
177
+ staleReasonCount: 0,
178
+ staleReasonsTruncated: false,
179
+ };
180
+ }
181
+ else
182
+ try {
183
+ const prolog = context.prolog ??
184
+ (() => {
185
+ ownedEngine = new EngineClient({
186
+ workspaceRoot: context.workspaceRoot,
187
+ branch: attachment.kbBranch,
188
+ timeout: 15_000,
189
+ });
190
+ return ownedEngine;
191
+ })();
192
+ payload = await runOperationJsonQuery(prolog, "status.pl", "status:kb_status_json(JsonString)", "Status execution");
193
+ if (!isStatusPayload(payload)) {
194
+ throw new Error("Status execution query returned an invalid payload");
195
+ }
196
+ // The Prolog status module sees the compiled directory key. The public
197
+ // contract exposes the exact Git branch identity instead.
198
+ payload = { ...payload, branch: attachment.kbBranch };
199
+ }
200
+ catch (error) {
201
+ const message = error instanceof Error ? error.message : String(error);
202
+ engineStatus = {
203
+ state: "unavailable",
204
+ errorCode: error instanceof OperationJsonDecodeError
205
+ ? error.code
206
+ : "engine_status_unavailable",
207
+ detail: message,
208
+ recoveryRequired: false,
209
+ };
210
+ payload = {
211
+ branch: attachment.kbBranch,
212
+ snapshotId: "unavailable",
213
+ syncedAt: null,
214
+ dirty: true,
215
+ syncState: "unknown",
216
+ kbPath: store.path,
217
+ lastSyncSource: "unavailable",
218
+ staleReasons: [],
219
+ staleReasonCount: 0,
220
+ staleReasonsTruncated: false,
221
+ };
222
+ }
223
+ finally {
224
+ await ownedEngine?.terminate();
225
+ }
125
226
  const snapshotEvidence = await readWorkspaceSnapshot(context);
227
+ const existingReasons = payload.staleReasons ?? [];
228
+ const storeReason = branchStoreReason(store);
229
+ const engineReason = engineStatus
230
+ ? {
231
+ code: engineStatus.errorCode ?? "engine_status_unavailable",
232
+ path: store.path,
233
+ entityIds: [],
234
+ detail: engineStatus.detail ??
235
+ "The branch store is structurally readable but the engine status response is unavailable.",
236
+ remediation: {
237
+ command_argv: ["kibi", "engine", "stop"],
238
+ applyRequired: false,
239
+ },
240
+ }
241
+ : null;
242
+ const staleReasons = [
243
+ ...existingReasons,
244
+ ...(storeReason ? [storeReason] : []),
245
+ ...(engineReason ? [engineReason] : []),
246
+ ].sort((left, right) => String(left.path ?? "").localeCompare(String(right.path ?? "")));
126
247
  const enrichedPayload = {
127
248
  ...payload,
249
+ branchAttachment: attachment,
250
+ branchStore: store,
251
+ ...(engineStatus ? { engineStatus } : {}),
252
+ staleReasons,
253
+ staleReasonCount: staleReasons.length,
254
+ staleReasonsTruncated: false,
128
255
  verificationSnapshot: snapshotEvidence.available
129
256
  ? snapshotEvidence.snapshot.hash
130
257
  : "unknown",
@@ -134,9 +261,82 @@ export async function executeStatus(_input, context) {
134
261
  verificationSnapshotDirty: snapshotEvidence.snapshot.dirty,
135
262
  verificationSnapshotFileCount: snapshotEvidence.snapshot.fileCount,
136
263
  verificationSnapshotVersion: snapshotEvidence.snapshot.version,
264
+ verificationSnapshotChanges: snapshotEvidence.snapshot.changes ?? [],
265
+ verificationSnapshotChangeCount: snapshotEvidence.snapshot.changeCount ?? 0,
266
+ verificationSnapshotChangesTruncated: snapshotEvidence.snapshot.changesTruncated ?? false,
137
267
  }
138
268
  : { verificationSnapshotError: snapshotEvidence.error }),
139
269
  };
270
+ const schemaStatus = readMigrationConfigStatus(context.workspaceRoot);
271
+ const migrationPlan = buildActionsFromStatus({
272
+ workspaceRoot: context.workspaceRoot,
273
+ branchAttachment: attachment,
274
+ branchStore: store,
275
+ staleReasons,
276
+ verificationSnapshotAvailable: snapshotEvidence.available,
277
+ ...(snapshotEvidence.available
278
+ ? { verificationSnapshotDirty: snapshotEvidence.snapshot.dirty }
279
+ : {}),
280
+ kbSnapshotId: payload.snapshotId,
281
+ workspaceSnapshot: snapshotEvidence.available
282
+ ? snapshotEvidence.snapshot.hash
283
+ : null,
284
+ configStatus: schemaStatus,
285
+ });
286
+ const bootstrapSourceFiles = context.fs?.glob
287
+ ? await context.fs.glob([
288
+ ".kb/requirements/**/*.md",
289
+ ".kb/scenarios/**/*.md",
290
+ ".kb/tests/**/*.md",
291
+ ".kb/adrs/**/*.md",
292
+ ".kb/adr/**/*.md",
293
+ ".kb/flags/**/*.md",
294
+ ".kb/events/**/*.md",
295
+ ".kb/facts/**/*.md",
296
+ ], { cwd: context.workspaceRoot })
297
+ : [];
298
+ const bootstrapActivation = await classifyActivation(context, bootstrapSourceFiles);
299
+ const statusWithPlan = {
300
+ ...enrichedPayload,
301
+ schemaStatus,
302
+ migrationPlan,
303
+ bootstrap: {
304
+ activationState: bootstrapActivation.activationState,
305
+ activationMode: bootstrapActivation.activationMode,
306
+ planEligible: bootstrapActivation.activationState === "root_active_thin" &&
307
+ !bootstrapActivation.applyBlocked,
308
+ reason: bootstrapActivation.reason,
309
+ nextAction: bootstrapActivation.activationState === "root_uninitialized"
310
+ ? {
311
+ operation: "kibi init",
312
+ reason: bootstrapActivation.reason,
313
+ required: true,
314
+ }
315
+ : bootstrapActivation.activationState === "root_partial"
316
+ ? {
317
+ operation: "kibi doctor",
318
+ reason: bootstrapActivation.reason,
319
+ required: true,
320
+ }
321
+ : bootstrapActivation.activationState === "vendored_only"
322
+ ? {
323
+ operation: "move-to-project-root",
324
+ reason: bootstrapActivation.reason,
325
+ required: true,
326
+ }
327
+ : bootstrapActivation.activationState === "root_active_thin"
328
+ ? {
329
+ operation: "kb_plan_bootstrap",
330
+ reason: bootstrapActivation.reason,
331
+ required: true,
332
+ }
333
+ : {
334
+ operation: "continue-kibi-workflow",
335
+ reason: bootstrapActivation.reason,
336
+ required: false,
337
+ },
338
+ },
339
+ };
140
340
  return {
141
341
  content: [
142
342
  {
@@ -144,7 +344,7 @@ export async function executeStatus(_input, context) {
144
344
  text: `Branch ${payload.branch} is ${payload.syncState} (snapshot ${payload.snapshotId}, dirty=${payload.dirty}, verificationSnapshot=${enrichedPayload.verificationSnapshot})`,
145
345
  },
146
346
  ],
147
- structuredContent: enrichedPayload,
347
+ structuredContent: statusWithPlan,
148
348
  };
149
349
  }
150
350
  catch (error) {