kibi-cli 0.14.0 → 0.16.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 (432) hide show
  1. package/bin/kibi +3 -1
  2. package/dist/cli-command.d.ts +5 -0
  3. package/dist/cli-command.d.ts.map +1 -0
  4. package/dist/cli-command.js +9 -0
  5. package/dist/cli-errors.d.ts +13 -0
  6. package/dist/cli-errors.d.ts.map +1 -0
  7. package/dist/cli-errors.js +26 -0
  8. package/dist/cli-input.d.ts +6 -0
  9. package/dist/cli-input.d.ts.map +1 -0
  10. package/dist/cli-input.js +54 -0
  11. package/dist/cli-json-command.d.ts +14 -0
  12. package/dist/cli-json-command.d.ts.map +1 -0
  13. package/dist/cli-json-command.js +96 -0
  14. package/dist/cli-protocol.d.ts +12 -0
  15. package/dist/cli-protocol.d.ts.map +1 -0
  16. package/dist/cli-protocol.js +37 -0
  17. package/dist/cli-register-foundation.d.ts +3 -0
  18. package/dist/cli-register-foundation.d.ts.map +1 -0
  19. package/dist/cli-register-foundation.js +90 -0
  20. package/dist/cli-register-maintenance.d.ts +3 -0
  21. package/dist/cli-register-maintenance.d.ts.map +1 -0
  22. package/dist/cli-register-maintenance.js +36 -0
  23. package/dist/cli-register-reporting.d.ts +3 -0
  24. package/dist/cli-register-reporting.d.ts.map +1 -0
  25. package/dist/cli-register-reporting.js +101 -0
  26. package/dist/cli-register-skills.d.ts +3 -0
  27. package/dist/cli-register-skills.d.ts.map +1 -0
  28. package/dist/cli-register-skills.js +71 -0
  29. package/dist/cli-validate.d.ts +18 -0
  30. package/dist/cli-validate.d.ts.map +1 -0
  31. package/dist/cli-validate.js +45 -0
  32. package/dist/cli.d.ts +4 -4
  33. package/dist/cli.d.ts.map +1 -1
  34. package/dist/cli.js +48 -211
  35. package/dist/commands/aggregated-checks.d.ts +1 -1
  36. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  37. package/dist/commands/aggregated-checks.js +28 -34
  38. package/dist/commands/check.d.ts +1 -1
  39. package/dist/commands/check.d.ts.map +1 -1
  40. package/dist/commands/check.js +52 -94
  41. package/dist/commands/coverage.d.ts.map +1 -1
  42. package/dist/commands/coverage.js +12 -17
  43. package/dist/commands/discovery-shared.d.ts +2 -1
  44. package/dist/commands/discovery-shared.d.ts.map +1 -1
  45. package/dist/commands/discovery-shared.js +6 -18
  46. package/dist/commands/gaps.d.ts.map +1 -1
  47. package/dist/commands/gaps.js +15 -19
  48. package/dist/commands/graph.d.ts.map +1 -1
  49. package/dist/commands/graph.js +15 -21
  50. package/dist/commands/query.d.ts +7 -7
  51. package/dist/commands/query.d.ts.map +1 -1
  52. package/dist/commands/query.js +98 -204
  53. package/dist/commands/search.d.ts +4 -4
  54. package/dist/commands/search.d.ts.map +1 -1
  55. package/dist/commands/search.js +14 -27
  56. package/dist/commands/status.d.ts +1 -1
  57. package/dist/commands/status.d.ts.map +1 -1
  58. package/dist/commands/status.js +6 -7
  59. package/dist/commands/sync/manifest.d.ts +1 -1
  60. package/dist/commands/sync/manifest.d.ts.map +1 -1
  61. package/dist/commands/sync/manifest.js +9 -17
  62. package/dist/commands/sync/persistence.d.ts.map +1 -1
  63. package/dist/commands/sync/persistence.js +22 -1
  64. package/dist/extractors/markdown.d.ts +14 -2
  65. package/dist/extractors/markdown.d.ts.map +1 -1
  66. package/dist/extractors/markdown.js +38 -1
  67. package/dist/extractors/symbols-ts.d.ts.map +1 -1
  68. package/dist/extractors/symbols-ts.js +11 -1
  69. package/dist/operations/autopilot/activation.d.ts +4 -0
  70. package/dist/operations/autopilot/activation.d.ts.map +1 -0
  71. package/dist/operations/autopilot/activation.js +130 -0
  72. package/dist/operations/autopilot/candidate-helpers.d.ts +13 -0
  73. package/dist/operations/autopilot/candidate-helpers.d.ts.map +1 -0
  74. package/dist/operations/autopilot/candidate-helpers.js +55 -0
  75. package/dist/operations/autopilot/candidates.d.ts +4 -0
  76. package/dist/operations/autopilot/candidates.d.ts.map +1 -0
  77. package/dist/operations/autopilot/candidates.js +114 -0
  78. package/dist/operations/autopilot/discovery-evidence.d.ts +10 -0
  79. package/dist/operations/autopilot/discovery-evidence.d.ts.map +1 -0
  80. package/dist/operations/autopilot/discovery-evidence.js +158 -0
  81. package/dist/operations/autopilot/discovery.d.ts +4 -0
  82. package/dist/operations/autopilot/discovery.d.ts.map +1 -0
  83. package/dist/operations/autopilot/discovery.js +100 -0
  84. package/dist/operations/autopilot/generate.d.ts +8 -0
  85. package/dist/operations/autopilot/generate.d.ts.map +1 -0
  86. package/dist/operations/autopilot/generate.js +112 -0
  87. package/dist/operations/autopilot/guidance-actions.d.ts +3 -0
  88. package/dist/operations/autopilot/guidance-actions.d.ts.map +1 -0
  89. package/dist/operations/autopilot/guidance-actions.js +79 -0
  90. package/dist/operations/autopilot/guidance.d.ts +14 -0
  91. package/dist/operations/autopilot/guidance.d.ts.map +1 -0
  92. package/dist/operations/autopilot/guidance.js +124 -0
  93. package/dist/operations/autopilot/markdown-candidates.d.ts +7 -0
  94. package/dist/operations/autopilot/markdown-candidates.d.ts.map +1 -0
  95. package/dist/operations/autopilot/markdown-candidates.js +134 -0
  96. package/dist/operations/autopilot/presentation.d.ts +13 -0
  97. package/dist/operations/autopilot/presentation.d.ts.map +1 -0
  98. package/dist/operations/autopilot/presentation.js +91 -0
  99. package/dist/operations/autopilot/requirement-claims.d.ts +3 -0
  100. package/dist/operations/autopilot/requirement-claims.d.ts.map +1 -0
  101. package/dist/operations/autopilot/requirement-claims.js +48 -0
  102. package/dist/operations/autopilot/types.d.ts +117 -0
  103. package/dist/operations/autopilot/types.d.ts.map +1 -0
  104. package/dist/operations/autopilot/types.js +8 -0
  105. package/dist/operations/modeling/model-requirement.d.ts +10 -0
  106. package/dist/operations/modeling/model-requirement.d.ts.map +1 -0
  107. package/dist/operations/modeling/model-requirement.js +108 -0
  108. package/dist/operations/modeling/predicate-applyplan.d.ts +6 -0
  109. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -0
  110. package/dist/operations/modeling/predicate-applyplan.js +104 -0
  111. package/dist/operations/modeling/predicate-catalog-1.d.ts +3 -0
  112. package/dist/operations/modeling/predicate-catalog-1.d.ts.map +1 -0
  113. package/dist/operations/modeling/predicate-catalog-1.js +200 -0
  114. package/dist/operations/modeling/predicate-catalog-2.d.ts +3 -0
  115. package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -0
  116. package/dist/operations/modeling/predicate-catalog-2.js +197 -0
  117. package/dist/operations/modeling/predicate-catalog-3.d.ts +3 -0
  118. package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -0
  119. package/dist/operations/modeling/predicate-catalog-3.js +193 -0
  120. package/dist/operations/modeling/predicate-catalog-4.d.ts +3 -0
  121. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -0
  122. package/dist/operations/modeling/predicate-catalog-4.js +149 -0
  123. package/dist/operations/modeling/predicate-catalog.d.ts +5 -0
  124. package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -0
  125. package/dist/operations/modeling/predicate-catalog.js +29 -0
  126. package/dist/operations/modeling/predicate-inference-1.d.ts +16 -0
  127. package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -0
  128. package/dist/operations/modeling/predicate-inference-1.js +161 -0
  129. package/dist/operations/modeling/predicate-inference-2.d.ts +19 -0
  130. package/dist/operations/modeling/predicate-inference-2.d.ts.map +1 -0
  131. package/dist/operations/modeling/predicate-inference-2.js +169 -0
  132. package/dist/operations/modeling/predicate-inference-3.d.ts +15 -0
  133. package/dist/operations/modeling/predicate-inference-3.d.ts.map +1 -0
  134. package/dist/operations/modeling/predicate-inference-3.js +163 -0
  135. package/dist/operations/modeling/predicate-inference.d.ts +5 -0
  136. package/dist/operations/modeling/predicate-inference.d.ts.map +1 -0
  137. package/dist/operations/modeling/predicate-inference.js +148 -0
  138. package/dist/operations/modeling/predicate-loader.d.ts +10 -0
  139. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -0
  140. package/dist/operations/modeling/predicate-loader.js +88 -0
  141. package/dist/operations/modeling/predicate-ranker.d.ts +3 -0
  142. package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -0
  143. package/dist/operations/modeling/predicate-ranker.js +24 -0
  144. package/dist/operations/modeling/predicate-score-1.d.ts +3 -0
  145. package/dist/operations/modeling/predicate-score-1.d.ts.map +1 -0
  146. package/dist/operations/modeling/predicate-score-1.js +121 -0
  147. package/dist/operations/modeling/predicate-score-2.d.ts +3 -0
  148. package/dist/operations/modeling/predicate-score-2.d.ts.map +1 -0
  149. package/dist/operations/modeling/predicate-score-2.js +122 -0
  150. package/dist/operations/modeling/predicate-score-3.d.ts +3 -0
  151. package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -0
  152. package/dist/operations/modeling/predicate-score-3.js +54 -0
  153. package/dist/operations/modeling/predicate-types.d.ts +61 -0
  154. package/dist/operations/modeling/predicate-types.d.ts.map +1 -0
  155. package/dist/operations/modeling/predicate-types.js +1 -0
  156. package/dist/operations/modeling/predicate-usage-hints-1.d.ts +3 -0
  157. package/dist/operations/modeling/predicate-usage-hints-1.d.ts.map +1 -0
  158. package/dist/operations/modeling/predicate-usage-hints-1.js +211 -0
  159. package/dist/operations/modeling/predicate-usage-hints-2.d.ts +3 -0
  160. package/dist/operations/modeling/predicate-usage-hints-2.d.ts.map +1 -0
  161. package/dist/operations/modeling/predicate-usage-hints-2.js +209 -0
  162. package/dist/operations/modeling/predicate-usage-hints-3.d.ts +3 -0
  163. package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -0
  164. package/dist/operations/modeling/predicate-usage-hints-3.js +45 -0
  165. package/dist/operations/modeling/predicate-utils.d.ts +23 -0
  166. package/dist/operations/modeling/predicate-utils.d.ts.map +1 -0
  167. package/dist/operations/modeling/predicate-utils.js +187 -0
  168. package/dist/operations/modeling/requirement-applyplan.d.ts +4 -0
  169. package/dist/operations/modeling/requirement-applyplan.d.ts.map +1 -0
  170. package/dist/operations/modeling/requirement-applyplan.js +44 -0
  171. package/dist/operations/modeling/requirement-heuristics.d.ts +4 -0
  172. package/dist/operations/modeling/requirement-heuristics.d.ts.map +1 -0
  173. package/dist/operations/modeling/requirement-heuristics.js +114 -0
  174. package/dist/operations/modeling/requirement-modeler.d.ts +8 -0
  175. package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -0
  176. package/dist/operations/modeling/requirement-modeler.js +70 -0
  177. package/dist/operations/modeling/requirement-types.d.ts +49 -0
  178. package/dist/operations/modeling/requirement-types.d.ts.map +1 -0
  179. package/dist/operations/modeling/requirement-types.js +1 -0
  180. package/dist/operations/modeling/requirement-utils.d.ts +10 -0
  181. package/dist/operations/modeling/requirement-utils.d.ts.map +1 -0
  182. package/dist/operations/modeling/requirement-utils.js +65 -0
  183. package/dist/operations/modeling/suggest-predicates.d.ts +6 -0
  184. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -0
  185. package/dist/operations/modeling/suggest-predicates.js +64 -0
  186. package/dist/operations/mutation/audit.d.ts +6 -0
  187. package/dist/operations/mutation/audit.d.ts.map +1 -0
  188. package/dist/operations/mutation/audit.js +22 -0
  189. package/dist/operations/mutation/contradictions.d.ts +10 -0
  190. package/dist/operations/mutation/contradictions.d.ts.map +1 -0
  191. package/dist/operations/mutation/contradictions.js +40 -0
  192. package/dist/operations/mutation/delete.d.ts +5 -0
  193. package/dist/operations/mutation/delete.d.ts.map +1 -0
  194. package/dist/operations/mutation/delete.js +67 -0
  195. package/dist/operations/mutation/relationships.d.ts +17 -0
  196. package/dist/operations/mutation/relationships.d.ts.map +1 -0
  197. package/dist/operations/mutation/relationships.js +134 -0
  198. package/dist/operations/mutation/save.d.ts +4 -0
  199. package/dist/operations/mutation/save.d.ts.map +1 -0
  200. package/dist/operations/mutation/save.js +14 -0
  201. package/dist/operations/mutation/serialization.d.ts +5 -0
  202. package/dist/operations/mutation/serialization.d.ts.map +1 -0
  203. package/dist/operations/mutation/serialization.js +85 -0
  204. package/dist/operations/mutation/strict-fact.d.ts +4 -0
  205. package/dist/operations/mutation/strict-fact.d.ts.map +1 -0
  206. package/dist/operations/mutation/strict-fact.js +67 -0
  207. package/dist/operations/mutation/symbol-granularity.d.ts +4 -0
  208. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -0
  209. package/dist/operations/mutation/symbol-granularity.js +109 -0
  210. package/dist/operations/mutation/symbol-refresh.d.ts +10 -0
  211. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -0
  212. package/dist/operations/mutation/symbol-refresh.js +105 -0
  213. package/dist/operations/mutation/types.d.ts +43 -0
  214. package/dist/operations/mutation/types.d.ts.map +1 -0
  215. package/dist/operations/mutation/types.js +1 -0
  216. package/dist/operations/mutation/upsert.d.ts +5 -0
  217. package/dist/operations/mutation/upsert.d.ts.map +1 -0
  218. package/dist/operations/mutation/upsert.js +103 -0
  219. package/dist/operations/mutation/validate-upsert.d.ts +5 -0
  220. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -0
  221. package/dist/operations/mutation/validate-upsert.js +50 -0
  222. package/dist/operations/mutation/validation.d.ts +5 -0
  223. package/dist/operations/mutation/validation.d.ts.map +1 -0
  224. package/dist/operations/mutation/validation.js +107 -0
  225. package/dist/operations/mutation/warnings.d.ts +4 -0
  226. package/dist/operations/mutation/warnings.d.ts.map +1 -0
  227. package/dist/operations/mutation/warnings.js +17 -0
  228. package/dist/operations/semantic-advisor/analysis-receipt.d.ts +5 -0
  229. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -0
  230. package/dist/operations/semantic-advisor/analysis-receipt.js +112 -0
  231. package/dist/operations/semantic-advisor/analyze-prose.d.ts +5 -0
  232. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -0
  233. package/dist/operations/semantic-advisor/analyze-prose.js +271 -0
  234. package/dist/operations/semantic-advisor/clauses.d.ts +10 -0
  235. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -0
  236. package/dist/operations/semantic-advisor/clauses.js +43 -0
  237. package/dist/operations/semantic-advisor/observation-plan.d.ts +3 -0
  238. package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -0
  239. package/dist/operations/semantic-advisor/observation-plan.js +19 -0
  240. package/dist/operations/semantic-advisor/predicate-rule.d.ts +14 -0
  241. package/dist/operations/semantic-advisor/predicate-rule.d.ts.map +1 -0
  242. package/dist/operations/semantic-advisor/predicate-rule.js +22 -0
  243. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +79 -0
  244. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -0
  245. package/dist/operations/semantic-advisor/predicate-rules-core.js +140 -0
  246. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +83 -0
  247. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -0
  248. package/dist/operations/semantic-advisor/predicate-rules-policy.js +150 -0
  249. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +48 -0
  250. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -0
  251. package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +102 -0
  252. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +71 -0
  253. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -0
  254. package/dist/operations/semantic-advisor/predicate-rules-product.js +133 -0
  255. package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts +29 -0
  256. package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts.map +1 -0
  257. package/dist/operations/semantic-advisor/prose-coverage-evaluator.js +54 -0
  258. package/dist/operations/semantic-advisor/shared.d.ts +18 -0
  259. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -0
  260. package/dist/operations/semantic-advisor/shared.js +209 -0
  261. package/dist/operations/semantic-advisor/strict-count-rules.d.ts +4 -0
  262. package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -0
  263. package/dist/operations/semantic-advisor/strict-count-rules.js +62 -0
  264. package/dist/operations/semantic-advisor/strict-rules.d.ts +4 -0
  265. package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -0
  266. package/dist/operations/semantic-advisor/strict-rules.js +106 -0
  267. package/dist/operations/semantic-advisor/types.d.ts +135 -0
  268. package/dist/operations/semantic-advisor/types.d.ts.map +1 -0
  269. package/dist/operations/semantic-advisor/types.js +1 -0
  270. package/dist/prolog/codec.d.ts.map +1 -1
  271. package/dist/prolog/codec.js +9 -2
  272. package/dist/prolog.d.ts +5 -0
  273. package/dist/prolog.d.ts.map +1 -1
  274. package/dist/prolog.js +82 -30
  275. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  276. package/dist/public/impact/diagnostics.js +8 -4
  277. package/dist/public/impact/full-kb-quality.d.ts +1 -1
  278. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  279. package/dist/public/impact/full-kb-quality.js +34 -1
  280. package/dist/public/impact/requirement-quality.d.ts.map +1 -1
  281. package/dist/public/impact/requirement-quality.js +6 -23
  282. package/dist/public/operations/catalog.d.ts +907 -0
  283. package/dist/public/operations/catalog.d.ts.map +1 -0
  284. package/dist/public/operations/catalog.js +42 -0
  285. package/dist/public/operations/check-executor.d.ts +21 -0
  286. package/dist/public/operations/check-executor.d.ts.map +1 -0
  287. package/dist/public/operations/check-executor.js +111 -0
  288. package/dist/public/operations/check-format-shared.d.ts +36 -0
  289. package/dist/public/operations/check-format-shared.d.ts.map +1 -0
  290. package/dist/public/operations/check-format-shared.js +107 -0
  291. package/dist/public/operations/check-helpers.d.ts +10 -0
  292. package/dist/public/operations/check-helpers.d.ts.map +1 -0
  293. package/dist/public/operations/check-helpers.js +107 -0
  294. package/dist/public/operations/discovery-entities.d.ts +14 -0
  295. package/dist/public/operations/discovery-entities.d.ts.map +1 -0
  296. package/dist/public/operations/discovery-entities.js +91 -0
  297. package/dist/public/operations/discovery-executors.d.ts +39 -0
  298. package/dist/public/operations/discovery-executors.d.ts.map +1 -0
  299. package/dist/public/operations/discovery-executors.js +101 -0
  300. package/dist/public/operations/index.d.ts +20 -0
  301. package/dist/public/operations/index.d.ts.map +1 -0
  302. package/dist/public/operations/index.js +18 -0
  303. package/dist/public/operations/node-ports.d.ts +15 -0
  304. package/dist/public/operations/node-ports.d.ts.map +1 -0
  305. package/dist/public/operations/node-ports.js +57 -0
  306. package/dist/public/operations/prolog-json.d.ts +5 -0
  307. package/dist/public/operations/prolog-json.d.ts.map +1 -0
  308. package/dist/public/operations/prolog-json.js +44 -0
  309. package/dist/public/operations/runtime-types.d.ts +69 -0
  310. package/dist/public/operations/runtime-types.d.ts.map +1 -0
  311. package/dist/public/operations/runtime-types.js +17 -0
  312. package/dist/public/operations/specs/autopilot.d.ts +82 -0
  313. package/dist/public/operations/specs/autopilot.d.ts.map +1 -0
  314. package/dist/public/operations/specs/autopilot.js +72 -0
  315. package/dist/public/operations/specs/check.d.ts +51 -0
  316. package/dist/public/operations/specs/check.d.ts.map +1 -0
  317. package/dist/public/operations/specs/check.js +62 -0
  318. package/dist/public/operations/specs/discovery.d.ts +94 -0
  319. package/dist/public/operations/specs/discovery.d.ts.map +1 -0
  320. package/dist/public/operations/specs/discovery.js +98 -0
  321. package/dist/public/operations/specs/modeling.d.ts +126 -0
  322. package/dist/public/operations/specs/modeling.d.ts.map +1 -0
  323. package/dist/public/operations/specs/modeling.js +117 -0
  324. package/dist/public/operations/specs/mutation-schemas.d.ts +233 -0
  325. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
  326. package/dist/public/operations/specs/mutation-schemas.js +267 -0
  327. package/dist/public/operations/specs/mutation.d.ts +56 -0
  328. package/dist/public/operations/specs/mutation.d.ts.map +1 -0
  329. package/dist/public/operations/specs/mutation.js +44 -0
  330. package/dist/public/operations/specs/reporting.d.ts +185 -0
  331. package/dist/public/operations/specs/reporting.d.ts.map +1 -0
  332. package/dist/public/operations/specs/reporting.js +158 -0
  333. package/dist/public/operations/specs/semantic.d.ts +53 -0
  334. package/dist/public/operations/specs/semantic.d.ts.map +1 -0
  335. package/dist/public/operations/specs/semantic.js +105 -0
  336. package/dist/public/operations/specs/skills.d.ts +70 -0
  337. package/dist/public/operations/specs/skills.d.ts.map +1 -0
  338. package/dist/public/operations/specs/skills.js +107 -0
  339. package/dist/public/operations/specs/sparql.d.ts +39 -0
  340. package/dist/public/operations/specs/sparql.d.ts.map +1 -0
  341. package/dist/public/operations/specs/sparql.js +121 -0
  342. package/dist/public/operations/specs/upsert.d.ts +256 -0
  343. package/dist/public/operations/specs/upsert.d.ts.map +1 -0
  344. package/dist/public/operations/specs/upsert.js +27 -0
  345. package/dist/public/operations/types.d.ts +24 -0
  346. package/dist/public/operations/types.d.ts.map +1 -0
  347. package/dist/public/operations/types.js +1 -0
  348. package/dist/public/schemas/entity.d.ts.map +1 -1
  349. package/dist/public/schemas/entity.js +27 -0
  350. package/dist/public/skill-system/errors.d.ts +19 -0
  351. package/dist/public/skill-system/errors.d.ts.map +1 -0
  352. package/dist/public/skill-system/errors.js +36 -0
  353. package/dist/public/skill-system/loader.d.ts +9 -0
  354. package/dist/public/skill-system/loader.d.ts.map +1 -0
  355. package/dist/public/skill-system/loader.js +76 -0
  356. package/dist/public/skill-system/paths.d.ts +6 -0
  357. package/dist/public/skill-system/paths.d.ts.map +1 -0
  358. package/dist/public/skill-system/paths.js +25 -0
  359. package/dist/public/skill-system/types.d.ts +15 -0
  360. package/dist/public/skill-system/types.d.ts.map +1 -0
  361. package/dist/public/skill-system/types.js +1 -0
  362. package/dist/public/skill-system/validation.d.ts +10 -0
  363. package/dist/public/skill-system/validation.d.ts.map +1 -0
  364. package/dist/public/skill-system/validation.js +119 -0
  365. package/dist/public/skills/init-kibi/SKILL.md +62 -0
  366. package/dist/public/skills/kibi-freshness/SKILL.md +44 -0
  367. package/dist/public/skills/kibi-traceability/SKILL.md +54 -0
  368. package/dist/public/skills/kibi-usage/SKILL.md +119 -99
  369. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +102 -0
  370. package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
  371. package/dist/public/skills/kibi-usage/resources/workflows.md +26 -3
  372. package/dist/public/skills.d.ts +4 -41
  373. package/dist/public/skills.d.ts.map +1 -1
  374. package/dist/public/skills.js +3 -270
  375. package/dist/runtime/cli-runtime.d.ts +3 -0
  376. package/dist/runtime/cli-runtime.d.ts.map +1 -0
  377. package/dist/runtime/cli-runtime.js +96 -0
  378. package/dist/schemas/entity.schema.json +23 -0
  379. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  380. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  381. package/dist/traceability/staged-symbols-manifest.d.ts +1 -0
  382. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  383. package/dist/traceability/staged-symbols-manifest.js +38 -27
  384. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  385. package/dist/traceability/symbol-extract.js +17 -1
  386. package/dist/traceability/temp-kb.d.ts.map +1 -1
  387. package/dist/traceability/temp-kb.js +34 -1
  388. package/dist/types/entities.d.ts +3 -0
  389. package/dist/types/entities.d.ts.map +1 -1
  390. package/dist/utils/rule-registry.d.ts.map +1 -1
  391. package/dist/utils/rule-registry.js +6 -0
  392. package/package.json +56 -2
  393. package/src/public/impact/diagnostics.ts +18 -11
  394. package/src/public/impact/full-kb-quality.ts +30 -3
  395. package/src/public/impact/requirement-quality.ts +6 -26
  396. package/src/public/operations/catalog.ts +60 -0
  397. package/src/public/operations/check-executor.ts +185 -0
  398. package/src/public/operations/check-format-shared.ts +178 -0
  399. package/src/public/operations/check-helpers.ts +141 -0
  400. package/src/public/operations/discovery-entities.ts +122 -0
  401. package/src/public/operations/discovery-executors.ts +176 -0
  402. package/src/public/operations/index.ts +19 -0
  403. package/src/public/operations/node-ports.ts +78 -0
  404. package/src/public/operations/prolog-json.ts +71 -0
  405. package/src/public/operations/runtime-types.ts +106 -0
  406. package/src/public/operations/specs/autopilot.ts +98 -0
  407. package/src/public/operations/specs/check.ts +72 -0
  408. package/src/public/operations/specs/discovery.ts +126 -0
  409. package/src/public/operations/specs/modeling.ts +154 -0
  410. package/src/public/operations/specs/mutation-schemas.ts +296 -0
  411. package/src/public/operations/specs/mutation.ts +58 -0
  412. package/src/public/operations/specs/reporting.ts +249 -0
  413. package/src/public/operations/specs/semantic.ts +135 -0
  414. package/src/public/operations/specs/skills.ts +142 -0
  415. package/src/public/operations/specs/sparql.ts +149 -0
  416. package/src/public/operations/specs/upsert.ts +40 -0
  417. package/src/public/operations/types.ts +57 -0
  418. package/src/public/schemas/entity.ts +27 -0
  419. package/src/public/skill-system/errors.ts +38 -0
  420. package/src/public/skill-system/loader.ts +108 -0
  421. package/src/public/skill-system/paths.ts +27 -0
  422. package/src/public/skill-system/types.ts +14 -0
  423. package/src/public/skill-system/validation.ts +175 -0
  424. package/src/public/skills/init-kibi/SKILL.md +62 -0
  425. package/src/public/skills/kibi-freshness/SKILL.md +44 -0
  426. package/src/public/skills/kibi-traceability/SKILL.md +54 -0
  427. package/src/public/skills/kibi-usage/SKILL.md +119 -99
  428. package/src/public/skills/kibi-usage/resources/fact-lanes.md +102 -0
  429. package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
  430. package/src/public/skills/kibi-usage/resources/workflows.md +26 -3
  431. package/src/public/skills.ts +18 -427
  432. package/src/schemas/entity.schema.json +23 -0
@@ -0,0 +1,100 @@
1
+ import path from "node:path";
2
+ import { getSchemaVersionStatus } from "../../public/schema-version.js";
3
+ import { classifyActivation } from "./activation.js";
4
+ import { scanEvidence } from "./discovery-evidence.js";
5
+ import { AUTOPILOT_PROVIDER_ORDER, } from "./types.js";
6
+ const EXCLUDED_ROOTS = [
7
+ ".git",
8
+ ".kb",
9
+ ".venv",
10
+ "build",
11
+ "coverage",
12
+ "dist",
13
+ "node_modules",
14
+ "target",
15
+ "third-party",
16
+ "third_party",
17
+ "vendor",
18
+ "vendors",
19
+ "venv",
20
+ ];
21
+ const LANGUAGE_NAMES = {
22
+ ts: "typescript",
23
+ tsx: "typescript",
24
+ mts: "typescript",
25
+ cts: "typescript",
26
+ js: "javascript",
27
+ jsx: "javascript",
28
+ mjs: "javascript",
29
+ cjs: "javascript",
30
+ py: "python",
31
+ rb: "ruby",
32
+ rs: "rust",
33
+ };
34
+ async function migrationWarning(context) {
35
+ try {
36
+ const raw = await context.fs?.readFile(path.join(context.workspaceRoot, ".kb", "config.json"));
37
+ return getSchemaVersionStatus(JSON.parse(raw ?? "{}") ?? undefined).warning;
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ }
43
+ function languages(evidence) {
44
+ return [
45
+ ...new Set(evidence
46
+ .filter((item) => item.kind === "source_symbols")
47
+ .map((item) => {
48
+ const extension = path.extname(item.label).slice(1);
49
+ return LANGUAGE_NAMES[extension] ?? extension;
50
+ })),
51
+ ].sort();
52
+ }
53
+ function frameworks(evidence) {
54
+ return [
55
+ ...new Set(evidence.flatMap((item) => Array.isArray(item.data.frameworks)
56
+ ? item.data.frameworks.filter((value) => typeof value === "string")
57
+ : [])),
58
+ ].sort();
59
+ }
60
+ // implements REQ-mcp-init-kibi-autopilot-v1, REQ-kibi-operation-interface-parity
61
+ export async function discoverAutopilot(context) {
62
+ const scan = await scanEvidence(context);
63
+ const ignored = new Set(scan.ignoredSources);
64
+ const activation = await classifyActivation(context, scan.files.filter((file) => !ignored.has(file)));
65
+ const evidence = activation.allowCandidateGeneration
66
+ ? [...scan.evidence]
67
+ : [];
68
+ evidence.sort((left, right) => AUTOPILOT_PROVIDER_ORDER.indexOf(left.provider) -
69
+ AUTOPILOT_PROVIDER_ORDER.indexOf(right.provider) ||
70
+ left.label.localeCompare(right.label));
71
+ const providersRun = activation.allowCandidateGeneration
72
+ ? [...AUTOPILOT_PROVIDER_ORDER]
73
+ : [];
74
+ const providerCounts = Object.fromEntries(AUTOPILOT_PROVIDER_ORDER.map((provider) => [
75
+ provider,
76
+ evidence.filter((item) => item.provider === provider).length,
77
+ ]));
78
+ return {
79
+ activation,
80
+ evidence,
81
+ ignoredSources: scan.ignoredSources,
82
+ migrationWarning: await migrationWarning(context),
83
+ summary: {
84
+ activationState: activation.activationState,
85
+ activationMode: activation.activationMode,
86
+ applyBlocked: activation.applyBlocked,
87
+ reason: activation.reason,
88
+ ...(activation.handoffMessage
89
+ ? { handoffMessage: activation.handoffMessage }
90
+ : {}),
91
+ providersRun,
92
+ providerCounts,
93
+ detectedLanguages: languages(evidence),
94
+ detectedTestFrameworks: frameworks(evidence),
95
+ excludedRoots: [...EXCLUDED_ROOTS].sort(),
96
+ truncated: false,
97
+ scanWarnings: [...new Set(scan.warnings)].sort(),
98
+ },
99
+ };
100
+ }
@@ -0,0 +1,8 @@
1
+ import type { OperationContext } from "../../public/operations/runtime-types.js";
2
+ import type { AutopilotGenerateArgs, AutopilotGenerateResult, Candidate } from "./types.js";
3
+ export declare function selectAutopilotCandidates(input: readonly Candidate[], existingIds: ReadonlySet<string>, entityTypes: readonly string[] | undefined, maximum: number): {
4
+ readonly candidates: readonly Candidate[];
5
+ readonly suppressed: readonly Readonly<Record<string, unknown>>[];
6
+ };
7
+ export declare function executeAutopilotGenerate(args: AutopilotGenerateArgs, context: OperationContext): Promise<AutopilotGenerateResult>;
8
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/autopilot/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAIjF,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACV,MAAM,YAAY,CAAC;AAsBpB,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CACnE,CAiDA;AAiBD,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,uBAAuB,CAAC,CAgDlC"}
@@ -0,0 +1,112 @@
1
+ import { loadEntities } from "../../public/operations/discovery-entities.js";
2
+ import { buildAutopilotCandidates } from "./candidates.js";
3
+ import { discoverAutopilot } from "./discovery.js";
4
+ import { presentAutopilot } from "./presentation.js";
5
+ function clamp(value, minimum, maximum) {
6
+ return Math.max(minimum, Math.min(maximum, value));
7
+ }
8
+ function titleKey(candidate) {
9
+ return `${candidate.entityType}::${candidate.title.trim().toLowerCase().replace(/\s+/g, " ")}`;
10
+ }
11
+ function firstUpsertId(candidate) {
12
+ const first = candidate.applyPlan[0];
13
+ if (typeof first?.id === "string")
14
+ return first.id;
15
+ const properties = first?.properties;
16
+ return properties !== null &&
17
+ typeof properties === "object" &&
18
+ "id" in properties &&
19
+ typeof properties.id === "string"
20
+ ? properties.id
21
+ : "";
22
+ }
23
+ export function selectAutopilotCandidates(input, existingIds, entityTypes, maximum) {
24
+ const allowed = entityTypes && entityTypes.length > 0 ? new Set(entityTypes) : null;
25
+ const sorted = input
26
+ .filter((candidate) => allowed?.has(candidate.entityType) ?? true)
27
+ .sort((left, right) => right.confidence - left.confidence ||
28
+ left.sourcePath.localeCompare(right.sourcePath))
29
+ .slice(0, maximum);
30
+ const typedTitles = new Set(sorted
31
+ .filter((candidate) => candidate.sourceKind === "typed_markdown")
32
+ .map(titleKey));
33
+ const selected = new Map();
34
+ const suppressed = [];
35
+ const suppress = (candidate, reason) => {
36
+ suppressed.push({
37
+ candidateId: candidate.candidateId,
38
+ reason,
39
+ sourcePath: candidate.sourcePath,
40
+ entityType: candidate.entityType,
41
+ });
42
+ };
43
+ for (const candidate of sorted) {
44
+ if (existingIds.has(firstUpsertId(candidate))) {
45
+ suppress(candidate, "entity_exists");
46
+ continue;
47
+ }
48
+ const key = titleKey(candidate);
49
+ if (candidate.sourceKind === "generic_markdown" && typedTitles.has(key)) {
50
+ suppress(candidate, "shadowed_by_typed_source");
51
+ continue;
52
+ }
53
+ const previous = selected.get(key);
54
+ if (!previous) {
55
+ selected.set(key, candidate);
56
+ continue;
57
+ }
58
+ const keepCandidate = candidate.confidence > previous.confidence ||
59
+ (candidate.confidence === previous.confidence &&
60
+ candidate.sourcePath < previous.sourcePath);
61
+ suppress(keepCandidate ? previous : candidate, "duplicate_title");
62
+ if (keepCandidate)
63
+ selected.set(key, candidate);
64
+ }
65
+ return { candidates: [...selected.values()], suppressed };
66
+ }
67
+ async function existingEntityIds(context) {
68
+ if (!context.prolog)
69
+ return new Set();
70
+ try {
71
+ const entities = await loadEntities(context.prolog, {});
72
+ return new Set(entities.map((entity) => String(entity.id ?? "")).filter(Boolean));
73
+ }
74
+ catch {
75
+ return new Set();
76
+ }
77
+ }
78
+ // implements REQ-mcp-init-kibi-autopilot-v1, REQ-kibi-operation-interface-parity
79
+ export async function executeAutopilotGenerate(args, context) {
80
+ const includeGenericMarkdown = args.includeGenericMarkdown ?? true;
81
+ const minConfidence = clamp(args.minConfidence ?? 0.8, 0.6, 0.95);
82
+ const maxCandidates = clamp(Math.trunc(args.maxCandidates ?? 50), 1, 200);
83
+ const [discovery, existingIds] = await Promise.all([
84
+ discoverAutopilot(context),
85
+ existingEntityIds(context),
86
+ ]);
87
+ const built = discovery.activation.allowCandidateGeneration
88
+ ? buildAutopilotCandidates(discovery.evidence, existingIds, minConfidence, includeGenericMarkdown)
89
+ : { candidates: [], sourceOnlySignals: [] };
90
+ const filteredSignals = args.entityTypes && args.entityTypes.length > 0
91
+ ? built.sourceOnlySignals.filter((signal) => args.entityTypes?.includes(signal.kind))
92
+ : built.sourceOnlySignals;
93
+ const selected = selectAutopilotCandidates(built.candidates.filter((candidate) => candidate.confidence >= minConfidence), existingIds, args.entityTypes, maxCandidates);
94
+ const ignored = discovery.ignoredSources.map((sourcePath) => ({
95
+ candidateId: "",
96
+ reason: "ignored_source",
97
+ sourcePath,
98
+ entityType: "",
99
+ }));
100
+ return presentAutopilot({
101
+ root: context.workspaceRoot,
102
+ activation: discovery.activation,
103
+ discoverySummary: discovery.summary,
104
+ migrationWarning: discovery.migrationWarning,
105
+ ...(args.bootstrapContext
106
+ ? { bootstrapContext: args.bootstrapContext }
107
+ : {}),
108
+ candidates: selected.candidates,
109
+ sourceOnlySignals: filteredSignals,
110
+ suppressedCandidates: [...selected.suppressed, ...ignored],
111
+ });
112
+ }
@@ -0,0 +1,3 @@
1
+ import type { ActivationPolicy, AutopilotDeclaredContext, Candidate, SourceOnlySignal } from "./types.js";
2
+ export declare function buildActions(root: string, activation: ActivationPolicy, declared: AutopilotDeclaredContext, candidates: readonly Candidate[], signals: readonly SourceOnlySignal[]): readonly Readonly<Record<string, unknown>>[];
3
+ //# sourceMappingURL=guidance-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/autopilot/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAgBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAuE9C"}
@@ -0,0 +1,79 @@
1
+ import path from "node:path";
2
+ function relative(root, target) {
3
+ const value = path.relative(root, target);
4
+ return value.startsWith("..") || path.isAbsolute(value)
5
+ ? target.split(path.sep).join("/")
6
+ : value.split(path.sep).join("/");
7
+ }
8
+ function summary(values, limit = 3) {
9
+ if (values.length === 0)
10
+ return "workspace evidence";
11
+ return values.length <= limit
12
+ ? values.join(", ")
13
+ : `${values.slice(0, limit).join(", ")} +${values.length - limit} more`;
14
+ }
15
+ export function buildActions(root, activation, declared, candidates, signals) {
16
+ const result = [];
17
+ let order = 1;
18
+ const targets = [
19
+ ...new Set([
20
+ ...declared.sourceOfTruthPaths,
21
+ ...declared.priorityRoots,
22
+ ...signals.map((signal) => relative(root, signal.sourcePath)),
23
+ ]),
24
+ ];
25
+ result.push({
26
+ order: order++,
27
+ kind: "query",
28
+ description: targets.length > 0
29
+ ? `Review ${summary(targets)} before authoring or applying bootstrap output.`
30
+ : "Review workspace evidence and existing KB records before applying bootstrap output.",
31
+ });
32
+ if (activation.activationMode === "attached_thin_handoff" ||
33
+ activation.activationMode === "attached_seeded_handoff") {
34
+ result.push({
35
+ order: order++,
36
+ kind: "handoff",
37
+ description: "Use kb_search to explore existing KB entities and understand current coverage.",
38
+ });
39
+ result.push({
40
+ order: order++,
41
+ kind: "handoff",
42
+ description: "Use kb_query or kb_graph with task-relevant IDs to inspect cited KB context.",
43
+ });
44
+ result.push({
45
+ order: order++,
46
+ kind: "handoff",
47
+ description: activation.activationMode === "attached_thin_handoff"
48
+ ? "Use kb_find_gaps to identify coverage holes and guide incremental KB growth."
49
+ : "Use kb_coverage to review traceability and identify areas needing attention.",
50
+ });
51
+ }
52
+ if (activation.applyBlocked)
53
+ result.push({
54
+ order: order++,
55
+ kind: "handoff",
56
+ description: activation.handoffMessage ?? activation.reason,
57
+ });
58
+ else if (candidates.length > 0)
59
+ result.push({
60
+ order: order++,
61
+ kind: "upsert",
62
+ description: `Review and optionally upsert ${candidates.length} safe candidate(s) from deterministic evidence.`,
63
+ candidateIds: candidates.map((candidate) => candidate.candidateId),
64
+ });
65
+ if (signals.length > 0)
66
+ result.push({
67
+ order: order++,
68
+ kind: "handoff",
69
+ description: `Author ${[...new Set(signals.map((signal) => signal.kind.toUpperCase()))].join("/")} entities manually from source-only evidence.`,
70
+ });
71
+ result.push({
72
+ order,
73
+ kind: "check",
74
+ description: declared.verificationAnchors.length > 0
75
+ ? `After approved kb_upsert calls, run kb_check and verify ${summary(declared.verificationAnchors, 2)}.`
76
+ : "After approved kb_upsert calls, run kb_check to validate the resulting graph.",
77
+ });
78
+ return result;
79
+ }
@@ -0,0 +1,14 @@
1
+ import type { ActivationPolicy, AutopilotDeclaredContext, Candidate, SourceOnlySignal } from "./types.js";
2
+ export declare function buildGuidance(input: {
3
+ readonly root: string;
4
+ readonly activation: ActivationPolicy;
5
+ readonly declared: AutopilotDeclaredContext;
6
+ readonly candidates: readonly Candidate[];
7
+ readonly signals: readonly SourceOnlySignal[];
8
+ readonly warnings: readonly string[];
9
+ }): {
10
+ readonly promptBlock: string;
11
+ readonly confidence: Readonly<Record<string, unknown>>;
12
+ readonly actions: readonly Readonly<Record<string, unknown>>[];
13
+ };
14
+ //# sourceMappingURL=guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/autopilot/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAyJpB,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG;IACF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAChE,CA0BA"}
@@ -0,0 +1,124 @@
1
+ import path from "node:path";
2
+ import { buildActions } from "./guidance-actions.js";
3
+ function relative(root, target) {
4
+ const value = path.relative(root, target);
5
+ return value.startsWith("..") || path.isAbsolute(value)
6
+ ? target.split(path.sep).join("/")
7
+ : value.split(path.sep).join("/");
8
+ }
9
+ function summary(values, limit = 3) {
10
+ if (values.length === 0)
11
+ return "workspace evidence";
12
+ return values.length <= limit
13
+ ? values.join(", ")
14
+ : `${values.slice(0, limit).join(", ")} +${values.length - limit} more`;
15
+ }
16
+ function counts(candidates) {
17
+ const result = {};
18
+ for (const candidate of candidates)
19
+ result[candidate.entityType] = (result[candidate.entityType] ?? 0) + 1;
20
+ return result;
21
+ }
22
+ function prompt(root, activation, declared, candidates, signals, warnings) {
23
+ const bullets = [];
24
+ bullets.push(activation.applyBlocked
25
+ ? `- Apply blocked: ${activation.reason}`
26
+ : `- Mode: ${activation.activationMode} (${activation.activationState}).`);
27
+ if (declared.projectSummary)
28
+ bullets.push(`- Summary: ${declared.projectSummary}`);
29
+ if (declared.sourceOfTruthPaths.length > 0)
30
+ bullets.push(`- Source of truth: ${summary(declared.sourceOfTruthPaths)}.`);
31
+ if (candidates.length > 0) {
32
+ const formatted = Object.entries(counts(candidates))
33
+ .sort(([left], [right]) => left.localeCompare(right))
34
+ .map(([type, count]) => `${type} ${count}`)
35
+ .join(", ");
36
+ bullets.push(`- Safe candidates: ${candidates.length} (${formatted}).`);
37
+ }
38
+ if (signals.length > 0) {
39
+ const kinds = [
40
+ ...new Set(signals.map((signal) => signal.kind.toUpperCase())),
41
+ ].join("/");
42
+ const paths = [
43
+ ...new Set(signals.map((signal) => relative(root, signal.sourcePath))),
44
+ ];
45
+ bullets.push(`- Author ${kinds} manually from ${summary(paths)}; keep them out of speculative candidate output.`);
46
+ }
47
+ else if (declared.verificationAnchors.length > 0)
48
+ bullets.push(`- Verify after kb_check with ${summary(declared.verificationAnchors, 2)}.`);
49
+ if (activation.activationMode === "attached_thin_handoff" ||
50
+ activation.activationMode === "attached_seeded_handoff")
51
+ bullets.push("- Handoff: use kb_search, kb_query, or gap/coverage tools to work with existing KB.");
52
+ if (warnings.length > 0)
53
+ bullets.push(`- Scan diagnostics: ${warnings.length} warning(s) during evidence collection.`);
54
+ const words = bullets.slice(0, 5).join("\n").split(/\s+/).filter(Boolean);
55
+ const selected = words.slice(0, 120);
56
+ if (words.length > 120 && selected.length > 0)
57
+ selected[selected.length - 1] = `${selected[selected.length - 1]}…`;
58
+ return selected.join(" ").replaceAll(" - ", "\n- ");
59
+ }
60
+ function confidence(activation, declared, candidates, signals, promptBlock) {
61
+ const reasons = [];
62
+ let score = candidates.length > 0 ? 0.68 : 0.44;
63
+ if (activation.applyBlocked) {
64
+ score -= 0.24;
65
+ reasons.push("Current workspace posture blocks direct application.");
66
+ }
67
+ else {
68
+ score += 0.12;
69
+ reasons.push("Workspace posture allows read-only bootstrap synthesis.");
70
+ }
71
+ score += {
72
+ cold_start_bootstrap: 0.1,
73
+ repair_bootstrap: -0.05,
74
+ attached_thin_handoff: -0.12,
75
+ attached_seeded_handoff: -0.18,
76
+ vendored_blocked: -0.25,
77
+ }[activation.activationMode];
78
+ reasons.push(`${activation.activationMode} determined the bootstrap posture.`);
79
+ if (declared.projectSummary ||
80
+ declared.sourceOfTruthPaths.length +
81
+ declared.sourceOfTruthNotes.length +
82
+ declared.priorityRoots.length +
83
+ declared.verificationAnchors.length >
84
+ 0) {
85
+ score += 0.08;
86
+ reasons.push("Declared bootstrap context grounds the output.");
87
+ }
88
+ else
89
+ reasons.push("No declared bootstrap context was supplied.");
90
+ if (signals.length > 0) {
91
+ score += 0.04;
92
+ reasons.push("Source-only evidence was routed into authoring guidance.");
93
+ }
94
+ if (candidates.length === 0) {
95
+ score -= 0.08;
96
+ reasons.push("No safe candidates were synthesized from current evidence.");
97
+ }
98
+ else
99
+ reasons.push(`${candidates.length} safe candidate(s) are ready for review.`);
100
+ if (!promptBlock) {
101
+ score -= 0.05;
102
+ reasons.push("Prompt block could not be assembled within the handoff budget.");
103
+ }
104
+ const rounded = Math.round(Math.max(0, Math.min(1, score)) * 100) / 100;
105
+ const level = rounded > 0.7 ? "high" : rounded >= 0.4 ? "medium" : "low";
106
+ const policy = level === "high"
107
+ ? "full_actions"
108
+ : level === "medium"
109
+ ? "review_required"
110
+ : "handoff_only";
111
+ if (level !== "high")
112
+ reasons.push(level === "medium"
113
+ ? "Medium confidence: review recommended before applying."
114
+ : "Low confidence: handoff-only output with diagnostic guidance.");
115
+ return { score: rounded, level, reasons, policy };
116
+ }
117
+ export function buildGuidance(input) {
118
+ const promptBlock = prompt(input.root, input.activation, input.declared, input.candidates, input.signals, input.warnings);
119
+ return {
120
+ promptBlock,
121
+ confidence: confidence(input.activation, input.declared, input.candidates, input.signals, promptBlock),
122
+ actions: buildActions(input.root, input.activation, input.declared, input.candidates, input.signals),
123
+ };
124
+ }
@@ -0,0 +1,7 @@
1
+ import type { AutopilotEvidence, Candidate, SourceOnlySignal } from "./types.js";
2
+ export type CandidateBuildResult = {
3
+ readonly candidates: readonly Candidate[];
4
+ readonly sourceOnlySignals: readonly SourceOnlySignal[];
5
+ };
6
+ export declare function markdownCandidates(item: AutopilotEvidence, existingIds: ReadonlySet<string>, minConfidence: number): CandidateBuildResult;
7
+ //# sourceMappingURL=markdown-candidates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-candidates.d.ts","sourceRoot":"","sources":["../../../src/operations/autopilot/markdown-candidates.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACzD,CAAC;AA0HF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,GACpB,oBAAoB,CAoDtB"}
@@ -0,0 +1,134 @@
1
+ import path from "node:path";
2
+ import { buildStrictWriteSet } from "../../utils/strict-modeling.js";
3
+ import { confidenceBand, slug, strictPlan, upsert, } from "./candidate-helpers.js";
4
+ import { claimFor } from "./requirement-claims.js";
5
+ function headingSignals(heading, sourcePath, textRef, minConfidence) {
6
+ const result = [];
7
+ for (const [kind, pattern, confidence] of [
8
+ ["req", /\brequirements?\b/i, 0.84],
9
+ ["scenario", /\bscenarios?\b/i, 0.83],
10
+ ["test", /\b(tests?|verification)\b/i, 0.82],
11
+ ]) {
12
+ if (pattern.test(heading) && confidence >= minConfidence) {
13
+ result.push({
14
+ kind,
15
+ title: `Author ${kind} from ${heading}`,
16
+ sourcePath,
17
+ confidence,
18
+ evidence: [`generic_heading:${textRef}`],
19
+ });
20
+ }
21
+ }
22
+ return result;
23
+ }
24
+ function genericHeadingCandidate(item, heading, line, existingIds, minConfidence) {
25
+ const relativePath = item.relativePath ?? item.label;
26
+ const type = /\badr\b|architectur.*decision/i.test(heading)
27
+ ? "adr"
28
+ : /\b(observations?|facts?|notes?)\b/i.test(heading)
29
+ ? "fact"
30
+ : null;
31
+ const confidence = type === "adr" ? 0.9 : type === "fact" ? 0.8 : 0;
32
+ if (!type || confidence < minConfidence)
33
+ return null;
34
+ const id = `${type === "adr" ? "ADR" : "FACT"}-GEN-${slug(heading, 60) || slug(path.basename(relativePath))}`.toUpperCase();
35
+ if (existingIds.has(id))
36
+ return null;
37
+ const entity = {
38
+ type,
39
+ id,
40
+ title: heading,
41
+ status: type === "adr" ? "proposed" : "active",
42
+ ...(type === "fact" ? { fact_kind: "observation" } : {}),
43
+ source: `autopilot:generic:${relativePath}`,
44
+ text_ref: `${relativePath}#L${line}`,
45
+ };
46
+ return {
47
+ candidateId: `gen:${relativePath}:${type}:${slug(heading)}`,
48
+ entityType: type,
49
+ title: heading,
50
+ sourceKind: "generic_markdown",
51
+ sourcePath: item.absolutePath ?? relativePath,
52
+ confidence,
53
+ confidenceBand: confidenceBand(confidence),
54
+ evidence: [`generic_heading:${relativePath}#L${line}`],
55
+ relationships: [],
56
+ applyPlan: [upsert(entity)],
57
+ };
58
+ }
59
+ function requirementCandidate(item, statement, line, heading, headingLine, existingIds, minConfidence) {
60
+ const relativePath = item.relativePath ?? item.label;
61
+ const base = /\bshall\b/i.test(statement)
62
+ ? 0.86
63
+ : /\bmust\b/i.test(statement)
64
+ ? 0.84
65
+ : 0.78;
66
+ const confidence = Math.min(0.95, base +
67
+ (heading &&
68
+ /requirements?|constraints?|polic(?:y|ies)|rules?/i.test(heading)
69
+ ? 0.08
70
+ : 0));
71
+ if (confidence < minConfidence)
72
+ return null;
73
+ const claim = claimFor(statement, relativePath, confidence, `${relativePath}#L${line}`);
74
+ if (!claim)
75
+ return null;
76
+ const writeSet = buildStrictWriteSet({ claim, statement });
77
+ if (!writeSet.isStrict || existingIds.has(writeSet.req.id))
78
+ return null;
79
+ return {
80
+ candidateId: `norm:${writeSet.req.id.toLowerCase()}`,
81
+ entityType: "req",
82
+ title: statement,
83
+ sourceKind: "generic_markdown",
84
+ sourcePath: item.absolutePath ?? relativePath,
85
+ confidence,
86
+ confidenceBand: confidenceBand(confidence),
87
+ evidence: [
88
+ `normative_statement:${relativePath}#L${line}`,
89
+ ...(heading ? [`generic_heading:${relativePath}#L${headingLine}`] : []),
90
+ ],
91
+ relationships: writeSet.relationships.map(({ type, from, to }) => ({
92
+ type,
93
+ from,
94
+ to,
95
+ })),
96
+ applyPlan: strictPlan(writeSet),
97
+ };
98
+ }
99
+ export function markdownCandidates(item, existingIds, minConfidence) {
100
+ const candidates = [];
101
+ const sourceOnlySignals = [];
102
+ const relativePath = item.relativePath ?? item.label;
103
+ let heading;
104
+ let headingLine = 0;
105
+ let fenced = false;
106
+ for (const [index, line] of (item.content ?? "").split(/\r?\n/).entries()) {
107
+ if (/^\s*(```|~~~)/.test(line)) {
108
+ fenced = !fenced;
109
+ continue;
110
+ }
111
+ if (fenced)
112
+ continue;
113
+ const match = line.match(/^\s*#+\s*(.+)$/);
114
+ if (match?.[1]) {
115
+ heading = match[1].trim();
116
+ headingLine = index + 1;
117
+ const candidate = genericHeadingCandidate(item, heading, headingLine, existingIds, minConfidence);
118
+ if (candidate)
119
+ candidates.push(candidate);
120
+ sourceOnlySignals.push(...headingSignals(heading, item.absolutePath ?? relativePath, `${relativePath}#L${headingLine}`, minConfidence));
121
+ continue;
122
+ }
123
+ const statement = line
124
+ .replace(/^\s*[-*+]\s+/, "")
125
+ .replace(/^\s*\d+[.)]\s+/, "")
126
+ .trim();
127
+ if (!statement || !/\b(must|shall|should)\b/i.test(statement))
128
+ continue;
129
+ const candidate = requirementCandidate(item, statement, index + 1, heading, headingLine, existingIds, minConfidence);
130
+ if (candidate)
131
+ candidates.push(candidate);
132
+ }
133
+ return { candidates, sourceOnlySignals };
134
+ }
@@ -0,0 +1,13 @@
1
+ import type { ActivationPolicy, AutopilotBootstrapContext, AutopilotDeclaredContext, AutopilotGenerateResult, Candidate, DiscoverySummary, SourceOnlySignal } from "./types.js";
2
+ export declare function normalizeBootstrapContext(input?: AutopilotBootstrapContext): AutopilotDeclaredContext;
3
+ export declare function presentAutopilot(input: {
4
+ readonly root: string;
5
+ readonly activation: ActivationPolicy;
6
+ readonly discoverySummary: DiscoverySummary;
7
+ readonly migrationWarning: string | null;
8
+ readonly bootstrapContext?: AutopilotBootstrapContext;
9
+ readonly candidates: readonly Candidate[];
10
+ readonly sourceOnlySignals: readonly SourceOnlySignal[];
11
+ readonly suppressedCandidates: readonly Readonly<Record<string, unknown>>[];
12
+ }): AutopilotGenerateResult;
13
+ //# sourceMappingURL=presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/operations/autopilot/presentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAQpB,wBAAgB,yBAAyB,CACvC,KAAK,CAAC,EAAE,yBAAyB,GAChC,wBAAwB,CAS1B;AAgBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;IACtD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,oBAAoB,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC7E,GAAG,uBAAuB,CAoE1B"}