kibi-cli 0.14.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) 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 +53 -95
  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 +13 -2
  60. package/dist/commands/sync/manifest.d.ts.map +1 -1
  61. package/dist/commands/sync/manifest.js +31 -22
  62. package/dist/commands/sync/persistence.d.ts.map +1 -1
  63. package/dist/commands/sync/persistence.js +39 -1
  64. package/dist/extractors/markdown.d.ts +22 -2
  65. package/dist/extractors/markdown.d.ts.map +1 -1
  66. package/dist/extractors/markdown.js +50 -1
  67. package/dist/extractors/symbols-ts.d.ts.map +1 -1
  68. package/dist/extractors/symbols-ts.js +11 -1
  69. package/dist/logic/ir.d.ts +112 -0
  70. package/dist/logic/ir.d.ts.map +1 -0
  71. package/dist/logic/ir.js +729 -0
  72. package/dist/operations/autopilot/activation.d.ts +4 -0
  73. package/dist/operations/autopilot/activation.d.ts.map +1 -0
  74. package/dist/operations/autopilot/activation.js +130 -0
  75. package/dist/operations/autopilot/candidate-helpers.d.ts +13 -0
  76. package/dist/operations/autopilot/candidate-helpers.d.ts.map +1 -0
  77. package/dist/operations/autopilot/candidate-helpers.js +55 -0
  78. package/dist/operations/autopilot/candidates.d.ts +4 -0
  79. package/dist/operations/autopilot/candidates.d.ts.map +1 -0
  80. package/dist/operations/autopilot/candidates.js +114 -0
  81. package/dist/operations/autopilot/discovery-evidence.d.ts +10 -0
  82. package/dist/operations/autopilot/discovery-evidence.d.ts.map +1 -0
  83. package/dist/operations/autopilot/discovery-evidence.js +158 -0
  84. package/dist/operations/autopilot/discovery.d.ts +4 -0
  85. package/dist/operations/autopilot/discovery.d.ts.map +1 -0
  86. package/dist/operations/autopilot/discovery.js +100 -0
  87. package/dist/operations/autopilot/generate.d.ts +8 -0
  88. package/dist/operations/autopilot/generate.d.ts.map +1 -0
  89. package/dist/operations/autopilot/generate.js +112 -0
  90. package/dist/operations/autopilot/guidance-actions.d.ts +3 -0
  91. package/dist/operations/autopilot/guidance-actions.d.ts.map +1 -0
  92. package/dist/operations/autopilot/guidance-actions.js +79 -0
  93. package/dist/operations/autopilot/guidance.d.ts +14 -0
  94. package/dist/operations/autopilot/guidance.d.ts.map +1 -0
  95. package/dist/operations/autopilot/guidance.js +124 -0
  96. package/dist/operations/autopilot/markdown-candidates.d.ts +7 -0
  97. package/dist/operations/autopilot/markdown-candidates.d.ts.map +1 -0
  98. package/dist/operations/autopilot/markdown-candidates.js +134 -0
  99. package/dist/operations/autopilot/presentation.d.ts +13 -0
  100. package/dist/operations/autopilot/presentation.d.ts.map +1 -0
  101. package/dist/operations/autopilot/presentation.js +91 -0
  102. package/dist/operations/autopilot/requirement-claims.d.ts +3 -0
  103. package/dist/operations/autopilot/requirement-claims.d.ts.map +1 -0
  104. package/dist/operations/autopilot/requirement-claims.js +48 -0
  105. package/dist/operations/autopilot/types.d.ts +117 -0
  106. package/dist/operations/autopilot/types.d.ts.map +1 -0
  107. package/dist/operations/autopilot/types.js +8 -0
  108. package/dist/operations/modeling/logic-modeling.d.ts +22 -0
  109. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -0
  110. package/dist/operations/modeling/logic-modeling.js +111 -0
  111. package/dist/operations/modeling/model-requirement.d.ts +10 -0
  112. package/dist/operations/modeling/model-requirement.d.ts.map +1 -0
  113. package/dist/operations/modeling/model-requirement.js +164 -0
  114. package/dist/operations/modeling/predicate-applyplan.d.ts +6 -0
  115. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -0
  116. package/dist/operations/modeling/predicate-applyplan.js +117 -0
  117. package/dist/operations/modeling/predicate-catalog-1.d.ts +3 -0
  118. package/dist/operations/modeling/predicate-catalog-1.d.ts.map +1 -0
  119. package/dist/operations/modeling/predicate-catalog-1.js +200 -0
  120. package/dist/operations/modeling/predicate-catalog-2.d.ts +3 -0
  121. package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -0
  122. package/dist/operations/modeling/predicate-catalog-2.js +197 -0
  123. package/dist/operations/modeling/predicate-catalog-3.d.ts +3 -0
  124. package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -0
  125. package/dist/operations/modeling/predicate-catalog-3.js +193 -0
  126. package/dist/operations/modeling/predicate-catalog-4.d.ts +3 -0
  127. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -0
  128. package/dist/operations/modeling/predicate-catalog-4.js +149 -0
  129. package/dist/operations/modeling/predicate-catalog.d.ts +5 -0
  130. package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -0
  131. package/dist/operations/modeling/predicate-catalog.js +29 -0
  132. package/dist/operations/modeling/predicate-inference-1.d.ts +16 -0
  133. package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -0
  134. package/dist/operations/modeling/predicate-inference-1.js +161 -0
  135. package/dist/operations/modeling/predicate-inference-2.d.ts +19 -0
  136. package/dist/operations/modeling/predicate-inference-2.d.ts.map +1 -0
  137. package/dist/operations/modeling/predicate-inference-2.js +169 -0
  138. package/dist/operations/modeling/predicate-inference-3.d.ts +15 -0
  139. package/dist/operations/modeling/predicate-inference-3.d.ts.map +1 -0
  140. package/dist/operations/modeling/predicate-inference-3.js +163 -0
  141. package/dist/operations/modeling/predicate-inference.d.ts +5 -0
  142. package/dist/operations/modeling/predicate-inference.d.ts.map +1 -0
  143. package/dist/operations/modeling/predicate-inference.js +163 -0
  144. package/dist/operations/modeling/predicate-loader.d.ts +10 -0
  145. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -0
  146. package/dist/operations/modeling/predicate-loader.js +94 -0
  147. package/dist/operations/modeling/predicate-ranker.d.ts +3 -0
  148. package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -0
  149. package/dist/operations/modeling/predicate-ranker.js +62 -0
  150. package/dist/operations/modeling/predicate-score-1.d.ts +3 -0
  151. package/dist/operations/modeling/predicate-score-1.d.ts.map +1 -0
  152. package/dist/operations/modeling/predicate-score-1.js +121 -0
  153. package/dist/operations/modeling/predicate-score-2.d.ts +3 -0
  154. package/dist/operations/modeling/predicate-score-2.d.ts.map +1 -0
  155. package/dist/operations/modeling/predicate-score-2.js +122 -0
  156. package/dist/operations/modeling/predicate-score-3.d.ts +3 -0
  157. package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -0
  158. package/dist/operations/modeling/predicate-score-3.js +54 -0
  159. package/dist/operations/modeling/predicate-types.d.ts +64 -0
  160. package/dist/operations/modeling/predicate-types.d.ts.map +1 -0
  161. package/dist/operations/modeling/predicate-types.js +1 -0
  162. package/dist/operations/modeling/predicate-usage-hints-1.d.ts +3 -0
  163. package/dist/operations/modeling/predicate-usage-hints-1.d.ts.map +1 -0
  164. package/dist/operations/modeling/predicate-usage-hints-1.js +211 -0
  165. package/dist/operations/modeling/predicate-usage-hints-2.d.ts +3 -0
  166. package/dist/operations/modeling/predicate-usage-hints-2.d.ts.map +1 -0
  167. package/dist/operations/modeling/predicate-usage-hints-2.js +209 -0
  168. package/dist/operations/modeling/predicate-usage-hints-3.d.ts +3 -0
  169. package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -0
  170. package/dist/operations/modeling/predicate-usage-hints-3.js +45 -0
  171. package/dist/operations/modeling/predicate-utils.d.ts +23 -0
  172. package/dist/operations/modeling/predicate-utils.d.ts.map +1 -0
  173. package/dist/operations/modeling/predicate-utils.js +187 -0
  174. package/dist/operations/modeling/requirement-applyplan.d.ts +4 -0
  175. package/dist/operations/modeling/requirement-applyplan.d.ts.map +1 -0
  176. package/dist/operations/modeling/requirement-applyplan.js +44 -0
  177. package/dist/operations/modeling/requirement-heuristics.d.ts +4 -0
  178. package/dist/operations/modeling/requirement-heuristics.d.ts.map +1 -0
  179. package/dist/operations/modeling/requirement-heuristics.js +114 -0
  180. package/dist/operations/modeling/requirement-modeler.d.ts +8 -0
  181. package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -0
  182. package/dist/operations/modeling/requirement-modeler.js +70 -0
  183. package/dist/operations/modeling/requirement-types.d.ts +61 -0
  184. package/dist/operations/modeling/requirement-types.d.ts.map +1 -0
  185. package/dist/operations/modeling/requirement-types.js +1 -0
  186. package/dist/operations/modeling/requirement-utils.d.ts +10 -0
  187. package/dist/operations/modeling/requirement-utils.d.ts.map +1 -0
  188. package/dist/operations/modeling/requirement-utils.js +65 -0
  189. package/dist/operations/modeling/suggest-predicates.d.ts +6 -0
  190. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -0
  191. package/dist/operations/modeling/suggest-predicates.js +64 -0
  192. package/dist/operations/mutation/audit.d.ts +6 -0
  193. package/dist/operations/mutation/audit.d.ts.map +1 -0
  194. package/dist/operations/mutation/audit.js +22 -0
  195. package/dist/operations/mutation/contradictions.d.ts +10 -0
  196. package/dist/operations/mutation/contradictions.d.ts.map +1 -0
  197. package/dist/operations/mutation/contradictions.js +40 -0
  198. package/dist/operations/mutation/delete.d.ts +5 -0
  199. package/dist/operations/mutation/delete.d.ts.map +1 -0
  200. package/dist/operations/mutation/delete.js +67 -0
  201. package/dist/operations/mutation/relationships.d.ts +17 -0
  202. package/dist/operations/mutation/relationships.d.ts.map +1 -0
  203. package/dist/operations/mutation/relationships.js +142 -0
  204. package/dist/operations/mutation/save.d.ts +4 -0
  205. package/dist/operations/mutation/save.d.ts.map +1 -0
  206. package/dist/operations/mutation/save.js +14 -0
  207. package/dist/operations/mutation/serialization.d.ts +5 -0
  208. package/dist/operations/mutation/serialization.d.ts.map +1 -0
  209. package/dist/operations/mutation/serialization.js +88 -0
  210. package/dist/operations/mutation/strict-fact.d.ts +4 -0
  211. package/dist/operations/mutation/strict-fact.d.ts.map +1 -0
  212. package/dist/operations/mutation/strict-fact.js +132 -0
  213. package/dist/operations/mutation/symbol-granularity.d.ts +4 -0
  214. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -0
  215. package/dist/operations/mutation/symbol-granularity.js +109 -0
  216. package/dist/operations/mutation/symbol-refresh.d.ts +10 -0
  217. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -0
  218. package/dist/operations/mutation/symbol-refresh.js +105 -0
  219. package/dist/operations/mutation/types.d.ts +43 -0
  220. package/dist/operations/mutation/types.d.ts.map +1 -0
  221. package/dist/operations/mutation/types.js +1 -0
  222. package/dist/operations/mutation/upsert.d.ts +5 -0
  223. package/dist/operations/mutation/upsert.d.ts.map +1 -0
  224. package/dist/operations/mutation/upsert.js +103 -0
  225. package/dist/operations/mutation/validate-upsert.d.ts +5 -0
  226. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -0
  227. package/dist/operations/mutation/validate-upsert.js +50 -0
  228. package/dist/operations/mutation/validation.d.ts +5 -0
  229. package/dist/operations/mutation/validation.d.ts.map +1 -0
  230. package/dist/operations/mutation/validation.js +107 -0
  231. package/dist/operations/mutation/warnings.d.ts +4 -0
  232. package/dist/operations/mutation/warnings.d.ts.map +1 -0
  233. package/dist/operations/mutation/warnings.js +17 -0
  234. package/dist/operations/semantic-advisor/analysis-receipt.d.ts +5 -0
  235. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -0
  236. package/dist/operations/semantic-advisor/analysis-receipt.js +120 -0
  237. package/dist/operations/semantic-advisor/analyze-prose.d.ts +5 -0
  238. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -0
  239. package/dist/operations/semantic-advisor/analyze-prose.js +693 -0
  240. package/dist/operations/semantic-advisor/clauses.d.ts +10 -0
  241. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -0
  242. package/dist/operations/semantic-advisor/clauses.js +43 -0
  243. package/dist/operations/semantic-advisor/observation-plan.d.ts +3 -0
  244. package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -0
  245. package/dist/operations/semantic-advisor/observation-plan.js +31 -0
  246. package/dist/operations/semantic-advisor/predicate-rule.d.ts +14 -0
  247. package/dist/operations/semantic-advisor/predicate-rule.d.ts.map +1 -0
  248. package/dist/operations/semantic-advisor/predicate-rule.js +22 -0
  249. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +79 -0
  250. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -0
  251. package/dist/operations/semantic-advisor/predicate-rules-core.js +140 -0
  252. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +83 -0
  253. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -0
  254. package/dist/operations/semantic-advisor/predicate-rules-policy.js +150 -0
  255. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +48 -0
  256. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -0
  257. package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +102 -0
  258. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +71 -0
  259. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -0
  260. package/dist/operations/semantic-advisor/predicate-rules-product.js +133 -0
  261. package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts +29 -0
  262. package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts.map +1 -0
  263. package/dist/operations/semantic-advisor/prose-coverage-evaluator.js +54 -0
  264. package/dist/operations/semantic-advisor/shared.d.ts +19 -0
  265. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -0
  266. package/dist/operations/semantic-advisor/shared.js +209 -0
  267. package/dist/operations/semantic-advisor/strict-count-rules.d.ts +4 -0
  268. package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -0
  269. package/dist/operations/semantic-advisor/strict-count-rules.js +62 -0
  270. package/dist/operations/semantic-advisor/strict-rules.d.ts +4 -0
  271. package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -0
  272. package/dist/operations/semantic-advisor/strict-rules.js +106 -0
  273. package/dist/operations/semantic-advisor/types.d.ts +195 -0
  274. package/dist/operations/semantic-advisor/types.d.ts.map +1 -0
  275. package/dist/operations/semantic-advisor/types.js +1 -0
  276. package/dist/prolog/codec.d.ts.map +1 -1
  277. package/dist/prolog/codec.js +20 -3
  278. package/dist/prolog.d.ts +5 -0
  279. package/dist/prolog.d.ts.map +1 -1
  280. package/dist/prolog.js +89 -32
  281. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  282. package/dist/public/impact/diagnostics.js +8 -4
  283. package/dist/public/impact/full-kb-quality.d.ts +1 -1
  284. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  285. package/dist/public/impact/full-kb-quality.js +34 -1
  286. package/dist/public/impact/requirement-quality.d.ts.map +1 -1
  287. package/dist/public/impact/requirement-quality.js +6 -23
  288. package/dist/public/operations/catalog.d.ts +986 -0
  289. package/dist/public/operations/catalog.d.ts.map +1 -0
  290. package/dist/public/operations/catalog.js +42 -0
  291. package/dist/public/operations/check-executor.d.ts +21 -0
  292. package/dist/public/operations/check-executor.d.ts.map +1 -0
  293. package/dist/public/operations/check-executor.js +111 -0
  294. package/dist/public/operations/check-format-shared.d.ts +36 -0
  295. package/dist/public/operations/check-format-shared.d.ts.map +1 -0
  296. package/dist/public/operations/check-format-shared.js +107 -0
  297. package/dist/public/operations/check-helpers.d.ts +10 -0
  298. package/dist/public/operations/check-helpers.d.ts.map +1 -0
  299. package/dist/public/operations/check-helpers.js +107 -0
  300. package/dist/public/operations/discovery-entities.d.ts +14 -0
  301. package/dist/public/operations/discovery-entities.d.ts.map +1 -0
  302. package/dist/public/operations/discovery-entities.js +91 -0
  303. package/dist/public/operations/discovery-executors.d.ts +39 -0
  304. package/dist/public/operations/discovery-executors.d.ts.map +1 -0
  305. package/dist/public/operations/discovery-executors.js +101 -0
  306. package/dist/public/operations/index.d.ts +21 -0
  307. package/dist/public/operations/index.d.ts.map +1 -0
  308. package/dist/public/operations/index.js +19 -0
  309. package/dist/public/operations/node-ports.d.ts +15 -0
  310. package/dist/public/operations/node-ports.d.ts.map +1 -0
  311. package/dist/public/operations/node-ports.js +57 -0
  312. package/dist/public/operations/prolog-json.d.ts +5 -0
  313. package/dist/public/operations/prolog-json.d.ts.map +1 -0
  314. package/dist/public/operations/prolog-json.js +44 -0
  315. package/dist/public/operations/runtime-types.d.ts +69 -0
  316. package/dist/public/operations/runtime-types.d.ts.map +1 -0
  317. package/dist/public/operations/runtime-types.js +17 -0
  318. package/dist/public/operations/specs/autopilot.d.ts +82 -0
  319. package/dist/public/operations/specs/autopilot.d.ts.map +1 -0
  320. package/dist/public/operations/specs/autopilot.js +72 -0
  321. package/dist/public/operations/specs/check.d.ts +51 -0
  322. package/dist/public/operations/specs/check.d.ts.map +1 -0
  323. package/dist/public/operations/specs/check.js +65 -0
  324. package/dist/public/operations/specs/discovery.d.ts +94 -0
  325. package/dist/public/operations/specs/discovery.d.ts.map +1 -0
  326. package/dist/public/operations/specs/discovery.js +98 -0
  327. package/dist/public/operations/specs/modeling.d.ts +142 -0
  328. package/dist/public/operations/specs/modeling.d.ts.map +1 -0
  329. package/dist/public/operations/specs/modeling.js +133 -0
  330. package/dist/public/operations/specs/mutation-schemas.d.ts +268 -0
  331. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
  332. package/dist/public/operations/specs/mutation-schemas.js +294 -0
  333. package/dist/public/operations/specs/mutation.d.ts +56 -0
  334. package/dist/public/operations/specs/mutation.d.ts.map +1 -0
  335. package/dist/public/operations/specs/mutation.js +44 -0
  336. package/dist/public/operations/specs/reporting.d.ts +185 -0
  337. package/dist/public/operations/specs/reporting.d.ts.map +1 -0
  338. package/dist/public/operations/specs/reporting.js +158 -0
  339. package/dist/public/operations/specs/semantic.d.ts +81 -0
  340. package/dist/public/operations/specs/semantic.d.ts.map +1 -0
  341. package/dist/public/operations/specs/semantic.js +137 -0
  342. package/dist/public/operations/specs/skills.d.ts +70 -0
  343. package/dist/public/operations/specs/skills.d.ts.map +1 -0
  344. package/dist/public/operations/specs/skills.js +107 -0
  345. package/dist/public/operations/specs/sparql.d.ts +39 -0
  346. package/dist/public/operations/specs/sparql.d.ts.map +1 -0
  347. package/dist/public/operations/specs/sparql.js +121 -0
  348. package/dist/public/operations/specs/upsert.d.ts +291 -0
  349. package/dist/public/operations/specs/upsert.d.ts.map +1 -0
  350. package/dist/public/operations/specs/upsert.js +27 -0
  351. package/dist/public/operations/types.d.ts +24 -0
  352. package/dist/public/operations/types.d.ts.map +1 -0
  353. package/dist/public/operations/types.js +1 -0
  354. package/dist/public/schemas/entity.d.ts.map +1 -1
  355. package/dist/public/schemas/entity.js +317 -0
  356. package/dist/public/schemas/relationship.d.ts.map +1 -1
  357. package/dist/public/schemas/relationship.js +1 -0
  358. package/dist/public/skill-system/errors.d.ts +19 -0
  359. package/dist/public/skill-system/errors.d.ts.map +1 -0
  360. package/dist/public/skill-system/errors.js +36 -0
  361. package/dist/public/skill-system/loader.d.ts +9 -0
  362. package/dist/public/skill-system/loader.d.ts.map +1 -0
  363. package/dist/public/skill-system/loader.js +76 -0
  364. package/dist/public/skill-system/paths.d.ts +6 -0
  365. package/dist/public/skill-system/paths.d.ts.map +1 -0
  366. package/dist/public/skill-system/paths.js +25 -0
  367. package/dist/public/skill-system/types.d.ts +15 -0
  368. package/dist/public/skill-system/types.d.ts.map +1 -0
  369. package/dist/public/skill-system/types.js +1 -0
  370. package/dist/public/skill-system/validation.d.ts +10 -0
  371. package/dist/public/skill-system/validation.d.ts.map +1 -0
  372. package/dist/public/skill-system/validation.js +119 -0
  373. package/dist/public/skills/init-kibi/SKILL.md +62 -0
  374. package/dist/public/skills/kibi-freshness/SKILL.md +44 -0
  375. package/dist/public/skills/kibi-traceability/SKILL.md +54 -0
  376. package/dist/public/skills/kibi-usage/SKILL.md +145 -99
  377. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +112 -0
  378. package/dist/public/skills/kibi-usage/resources/logic-ir.md +43 -0
  379. package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
  380. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
  381. package/dist/public/skills/kibi-usage/resources/workflows.md +41 -3
  382. package/dist/public/skills.d.ts +4 -41
  383. package/dist/public/skills.d.ts.map +1 -1
  384. package/dist/public/skills.js +3 -270
  385. package/dist/public/symbol-granularity.d.ts +9 -0
  386. package/dist/public/symbol-granularity.d.ts.map +1 -1
  387. package/dist/public/symbol-granularity.js +16 -0
  388. package/dist/runtime/cli-runtime.d.ts +3 -0
  389. package/dist/runtime/cli-runtime.d.ts.map +1 -0
  390. package/dist/runtime/cli-runtime.js +96 -0
  391. package/dist/schemas/entity.schema.json +329 -3
  392. package/dist/traceability/staged-diagnostics.d.ts +2 -2
  393. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  394. package/dist/traceability/staged-diagnostics.js +17 -10
  395. package/dist/traceability/staged-impact-contract.js +1 -1
  396. package/dist/traceability/staged-symbols-manifest.d.ts +1 -0
  397. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  398. package/dist/traceability/staged-symbols-manifest.js +53 -24
  399. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  400. package/dist/traceability/symbol-extract.js +17 -1
  401. package/dist/traceability/temp-kb.d.ts.map +1 -1
  402. package/dist/traceability/temp-kb.js +47 -1
  403. package/dist/types/entities.d.ts +3 -0
  404. package/dist/types/entities.d.ts.map +1 -1
  405. package/dist/types/relationships.d.ts +1 -1
  406. package/dist/types/relationships.d.ts.map +1 -1
  407. package/dist/utils/rule-registry.d.ts.map +1 -1
  408. package/dist/utils/rule-registry.js +24 -0
  409. package/dist/utils/schema-version.d.ts +1 -1
  410. package/dist/utils/schema-version.js +1 -1
  411. package/package.json +60 -2
  412. package/src/public/impact/diagnostics.ts +18 -11
  413. package/src/public/impact/full-kb-quality.ts +30 -3
  414. package/src/public/impact/requirement-quality.ts +6 -26
  415. package/src/public/operations/catalog.ts +60 -0
  416. package/src/public/operations/check-executor.ts +185 -0
  417. package/src/public/operations/check-format-shared.ts +178 -0
  418. package/src/public/operations/check-helpers.ts +141 -0
  419. package/src/public/operations/discovery-entities.ts +122 -0
  420. package/src/public/operations/discovery-executors.ts +176 -0
  421. package/src/public/operations/index.ts +20 -0
  422. package/src/public/operations/node-ports.ts +78 -0
  423. package/src/public/operations/prolog-json.ts +71 -0
  424. package/src/public/operations/runtime-types.ts +106 -0
  425. package/src/public/operations/specs/autopilot.ts +98 -0
  426. package/src/public/operations/specs/check.ts +75 -0
  427. package/src/public/operations/specs/discovery.ts +126 -0
  428. package/src/public/operations/specs/modeling.ts +174 -0
  429. package/src/public/operations/specs/mutation-schemas.ts +326 -0
  430. package/src/public/operations/specs/mutation.ts +58 -0
  431. package/src/public/operations/specs/reporting.ts +249 -0
  432. package/src/public/operations/specs/semantic.ts +174 -0
  433. package/src/public/operations/specs/skills.ts +142 -0
  434. package/src/public/operations/specs/sparql.ts +149 -0
  435. package/src/public/operations/specs/upsert.ts +40 -0
  436. package/src/public/operations/types.ts +57 -0
  437. package/src/public/schemas/entity.ts +324 -1
  438. package/src/public/schemas/relationship.ts +1 -0
  439. package/src/public/skill-system/errors.ts +38 -0
  440. package/src/public/skill-system/loader.ts +108 -0
  441. package/src/public/skill-system/paths.ts +27 -0
  442. package/src/public/skill-system/types.ts +14 -0
  443. package/src/public/skill-system/validation.ts +175 -0
  444. package/src/public/skills/init-kibi/SKILL.md +62 -0
  445. package/src/public/skills/kibi-freshness/SKILL.md +44 -0
  446. package/src/public/skills/kibi-traceability/SKILL.md +54 -0
  447. package/src/public/skills/kibi-usage/SKILL.md +145 -99
  448. package/src/public/skills/kibi-usage/resources/fact-lanes.md +112 -0
  449. package/src/public/skills/kibi-usage/resources/logic-ir.md +43 -0
  450. package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
  451. package/src/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
  452. package/src/public/skills/kibi-usage/resources/workflows.md +41 -3
  453. package/src/public/skills.ts +18 -427
  454. package/src/public/symbol-granularity.ts +25 -0
  455. package/src/schemas/entity.schema.json +329 -3
  456. package/src/schemas/relationship.schema.json +1 -0
@@ -18,6 +18,15 @@
18
18
  // Typed fact field enums per proposal
19
19
  import { SYMBOL_ROLES } from "../symbol-granularity.js";
20
20
  const factConditionals = JSON.parse(`[
21
+ {
22
+ "if": {
23
+ "anyOf": [
24
+ { "required": ["claim_key"] },
25
+ { "required": ["claim_text"] }
26
+ ]
27
+ },
28
+ "then": { "required": ["claim_key", "claim_text"] }
29
+ },
21
30
  {
22
31
  "if": {
23
32
  "properties": {
@@ -50,6 +59,30 @@ const factConditionals = JSON.parse(`[
50
59
  }
51
60
  }
52
61
  },
62
+ {
63
+ "if": {
64
+ "properties": {
65
+ "type": { "const": "fact" },
66
+ "fact_kind": { "const": "rule_schema" }
67
+ },
68
+ "required": ["type", "fact_kind"]
69
+ },
70
+ "then": {
71
+ "required": ["rule_name", "argument_names", "argument_types"]
72
+ }
73
+ },
74
+ {
75
+ "if": {
76
+ "properties": {
77
+ "type": { "const": "fact" },
78
+ "fact_kind": { "const": "rule" }
79
+ },
80
+ "required": ["type", "fact_kind"]
81
+ },
82
+ "then": {
83
+ "required": ["rule_ir", "rule_hash", "rule_schema_id", "rule_name", "semantic_key"]
84
+ }
85
+ },
53
86
  {
54
87
  "if": {
55
88
  "properties": {
@@ -65,10 +98,205 @@ const factConditionals = JSON.parse(`[
65
98
  }
66
99
  }
67
100
  ]`);
101
+ // The persisted rule payload is still data, but its shape is constrained at
102
+ // the JSON boundary as well as by validateLogicIr. Keeping this vocabulary
103
+ // closed prevents a raw_goal/raw Prolog field from entering an upsert payload.
104
+ const logicTermSchema = {
105
+ oneOf: [
106
+ {
107
+ type: "object",
108
+ required: ["kind", "name", "type"],
109
+ properties: {
110
+ kind: { const: "var" },
111
+ name: { type: "string", pattern: "^[A-Z][A-Za-z0-9_]*$" },
112
+ type: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
113
+ },
114
+ additionalProperties: false,
115
+ },
116
+ {
117
+ type: "object",
118
+ required: ["kind", "value"],
119
+ properties: {
120
+ kind: { const: "const" },
121
+ value: { type: "string", minLength: 1 },
122
+ type: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
123
+ },
124
+ additionalProperties: false,
125
+ },
126
+ {
127
+ type: "object",
128
+ required: ["kind", "value"],
129
+ properties: {
130
+ kind: { const: "number" },
131
+ value: { type: "number" },
132
+ unit: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
133
+ },
134
+ additionalProperties: false,
135
+ },
136
+ {
137
+ type: "object",
138
+ required: ["kind", "value", "unit"],
139
+ properties: {
140
+ kind: { const: "duration" },
141
+ value: { type: "number", minimum: 0 },
142
+ unit: { type: "string", enum: ["ms", "s", "m", "h", "d", "w"] },
143
+ },
144
+ additionalProperties: false,
145
+ },
146
+ {
147
+ type: "object",
148
+ required: ["kind", "value"],
149
+ properties: {
150
+ kind: { const: "timestamp" },
151
+ value: { type: "string" },
152
+ },
153
+ additionalProperties: false,
154
+ },
155
+ {
156
+ type: "object",
157
+ required: ["kind", "start", "end"],
158
+ properties: {
159
+ kind: { const: "interval" },
160
+ start: { type: "string" },
161
+ end: { type: "string" },
162
+ },
163
+ additionalProperties: false,
164
+ },
165
+ ],
166
+ };
167
+ const logicAtomSchema = {
168
+ type: "object",
169
+ required: ["kind", "name", "args"],
170
+ properties: {
171
+ kind: { const: "atom" },
172
+ namespace: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
173
+ name: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
174
+ args: {
175
+ type: "array",
176
+ maxItems: 8,
177
+ items: { $ref: "#/$defs/logicTerm" },
178
+ },
179
+ polarity: { enum: ["positive", "negative"] },
180
+ closedWorld: { type: "boolean" },
181
+ },
182
+ additionalProperties: false,
183
+ };
184
+ const logicExpressionSchema = {
185
+ oneOf: [
186
+ { $ref: "#/$defs/logicAtom" },
187
+ {
188
+ type: "object",
189
+ required: ["kind", "items"],
190
+ properties: {
191
+ kind: { enum: ["all", "any"] },
192
+ items: {
193
+ type: "array",
194
+ minItems: 1,
195
+ maxItems: 32,
196
+ items: { $ref: "#/$defs/logicExpression" },
197
+ },
198
+ },
199
+ additionalProperties: false,
200
+ },
201
+ {
202
+ type: "object",
203
+ required: ["kind", "item"],
204
+ properties: {
205
+ kind: { const: "not" },
206
+ item: { $ref: "#/$defs/logicAtom" },
207
+ },
208
+ additionalProperties: false,
209
+ },
210
+ {
211
+ type: "object",
212
+ required: ["kind", "operator", "left", "right"],
213
+ properties: {
214
+ kind: { const: "compare" },
215
+ operator: { enum: ["eq", "neq", "lt", "lte", "gt", "gte"] },
216
+ left: { $ref: "#/$defs/logicTerm" },
217
+ right: { $ref: "#/$defs/logicTerm" },
218
+ },
219
+ additionalProperties: false,
220
+ },
221
+ {
222
+ type: "object",
223
+ required: ["kind", "atom", "operator", "value"],
224
+ properties: {
225
+ kind: { const: "count" },
226
+ atom: { $ref: "#/$defs/logicAtom" },
227
+ operator: { enum: ["eq", "neq", "lt", "lte", "gt", "gte"] },
228
+ value: { type: "integer", minimum: 0 },
229
+ },
230
+ additionalProperties: false,
231
+ },
232
+ {
233
+ type: "object",
234
+ required: ["kind", "relation", "left", "right"],
235
+ properties: {
236
+ kind: { const: "temporal" },
237
+ relation: {
238
+ enum: ["before", "after", "during", "overlaps", "starts", "finishes"],
239
+ },
240
+ left: { $ref: "#/$defs/logicTerm" },
241
+ right: { $ref: "#/$defs/logicTerm" },
242
+ },
243
+ additionalProperties: false,
244
+ },
245
+ ],
246
+ };
247
+ const logicRuleSchema = {
248
+ type: "object",
249
+ required: ["version", "kind", "modality"],
250
+ properties: {
251
+ version: { const: "kibi.logic.v1" },
252
+ kind: { enum: ["atom", "rule", "constraint"] },
253
+ modality: { enum: ["assert", "deny", "oblige", "permit", "forbid"] },
254
+ head: { $ref: "#/$defs/logicAtom" },
255
+ body: { $ref: "#/$defs/logicExpression" },
256
+ variables: {
257
+ type: "array",
258
+ maxItems: 32,
259
+ items: {
260
+ type: "object",
261
+ required: ["name", "type"],
262
+ properties: {
263
+ name: { type: "string", pattern: "^[A-Z][A-Za-z0-9_]*$" },
264
+ type: { type: "string", pattern: "^[a-z][a-z0-9_:.\\/-]*$" },
265
+ quantifier: { enum: ["forall", "exists"] },
266
+ },
267
+ additionalProperties: false,
268
+ },
269
+ },
270
+ exceptions: {
271
+ type: "array",
272
+ maxItems: 16,
273
+ items: { $ref: "#/$defs/logicExpression" },
274
+ },
275
+ scope: {
276
+ type: "object",
277
+ properties: {
278
+ authority: { type: "string" },
279
+ name: { type: "string" },
280
+ tags: { type: "array", items: { type: "string" } },
281
+ },
282
+ additionalProperties: false,
283
+ },
284
+ validFrom: { type: "string" },
285
+ validTo: { type: "string" },
286
+ ruleSchemaId: { type: "string", minLength: 1 },
287
+ },
288
+ additionalProperties: false,
289
+ };
68
290
  const entitySchema = {
69
291
  $id: "entity.schema.json",
70
292
  title: "Entity",
71
293
  type: "object",
294
+ $defs: {
295
+ logicTerm: logicTermSchema,
296
+ logicAtom: logicAtomSchema,
297
+ logicExpression: logicExpressionSchema,
298
+ logicRule: logicRuleSchema,
299
+ },
72
300
  properties: {
73
301
  id: { type: "string" },
74
302
  title: { type: "string" },
@@ -105,6 +333,59 @@ const entitySchema = {
105
333
  severity: { type: "string" },
106
334
  links: { type: "array", items: { type: "string" } },
107
335
  text_ref: { type: "string" },
336
+ logic_claims: {
337
+ type: "array",
338
+ minItems: 1,
339
+ uniqueItems: true,
340
+ items: { type: "string", pattern: "^CLAIM-[A-F0-9]{16}$" },
341
+ },
342
+ semantic_inventory: {
343
+ type: "array",
344
+ items: {
345
+ type: "object",
346
+ required: ["claim_key", "claim_text", "role", "status", "span"],
347
+ properties: {
348
+ claim_key: { type: "string", pattern: "^CLAIM-[A-F0-9]{16}$" },
349
+ claim_text: { type: "string", minLength: 1 },
350
+ role: {
351
+ type: "string",
352
+ enum: [
353
+ "normative",
354
+ "definition",
355
+ "descriptive",
356
+ "condition",
357
+ "exception",
358
+ "rationale",
359
+ "example",
360
+ "subjective",
361
+ ],
362
+ },
363
+ status: {
364
+ type: "string",
365
+ enum: [
366
+ "modeled",
367
+ "ambiguous",
368
+ "ontology_gap",
369
+ "nonlogical",
370
+ "missing",
371
+ ],
372
+ },
373
+ span: {
374
+ type: "object",
375
+ required: ["start", "end"],
376
+ properties: {
377
+ start: { type: "integer", minimum: 0 },
378
+ end: { type: "integer", minimum: 0 },
379
+ },
380
+ additionalProperties: false,
381
+ },
382
+ semantic_key: { type: "string" },
383
+ payload_hash: { type: "string" },
384
+ reason: { type: "string" },
385
+ },
386
+ additionalProperties: false,
387
+ },
388
+ },
108
389
  sourceFile: { type: "string" },
109
390
  granularity_reason: {
110
391
  type: "string",
@@ -150,6 +431,8 @@ const entitySchema = {
150
431
  "meta",
151
432
  "predicate_schema",
152
433
  "predicate",
434
+ "rule_schema",
435
+ "rule",
153
436
  ],
154
437
  },
155
438
  subject_key: { type: "string" },
@@ -170,6 +453,8 @@ const entitySchema = {
170
453
  valid_from: { type: "string" },
171
454
  valid_to: { type: "string" },
172
455
  canonical_key: { type: "string" },
456
+ claim_key: { type: "string", pattern: "^CLAIM-[A-F0-9]{16}$" },
457
+ claim_text: { type: "string" },
173
458
  predicate_name: { type: "string" },
174
459
  predicate_namespace: { type: "string" },
175
460
  predicate_arity: { type: "integer", minimum: 1 },
@@ -179,6 +464,13 @@ const entitySchema = {
179
464
  aliases: { type: "array", items: { type: "string" } },
180
465
  examples: { type: "array", items: { type: "string" } },
181
466
  predicate_args: { type: "array", items: { type: "string" } },
467
+ rule_ir: { $ref: "#/$defs/logicRule" },
468
+ rule_hash: { type: "string", pattern: "^[a-f0-9]{64}$" },
469
+ rule_schema_id: { type: "string", minLength: 1 },
470
+ rule_name: { type: "string", minLength: 1 },
471
+ semantic_key: { type: "string", pattern: "^SEM-[A-F0-9]{24}$" },
472
+ claim_span_start: { type: "integer", minimum: 0 },
473
+ claim_span_end: { type: "integer", minimum: 0 },
182
474
  },
183
475
  required: [
184
476
  "id",
@@ -190,6 +482,14 @@ const entitySchema = {
190
482
  "type",
191
483
  ],
192
484
  allOf: [
485
+ {
486
+ if: {
487
+ properties: { type: { const: "req" } },
488
+ },
489
+ else: {
490
+ not: { required: ["logic_claims"] },
491
+ },
492
+ },
193
493
  // Forbid fact-only fields on non-fact entities
194
494
  {
195
495
  if: {
@@ -216,6 +516,8 @@ const entitySchema = {
216
516
  { required: ["valid_from"] },
217
517
  { required: ["valid_to"] },
218
518
  { required: ["canonical_key"] },
519
+ { required: ["claim_key"] },
520
+ { required: ["claim_text"] },
219
521
  { required: ["predicate_name"] },
220
522
  { required: ["predicate_namespace"] },
221
523
  { required: ["predicate_arity"] },
@@ -225,6 +527,13 @@ const entitySchema = {
225
527
  { required: ["aliases"] },
226
528
  { required: ["examples"] },
227
529
  { required: ["predicate_args"] },
530
+ { required: ["rule_ir"] },
531
+ { required: ["rule_hash"] },
532
+ { required: ["rule_schema_id"] },
533
+ { required: ["rule_name"] },
534
+ { required: ["semantic_key"] },
535
+ { required: ["claim_span_start"] },
536
+ { required: ["claim_span_end"] },
228
537
  ],
229
538
  },
230
539
  },
@@ -242,6 +551,14 @@ const entitySchema = {
242
551
  },
243
552
  },
244
553
  },
554
+ {
555
+ if: {
556
+ properties: { type: { const: "req" } },
557
+ },
558
+ else: {
559
+ not: { required: ["semantic_inventory"] },
560
+ },
561
+ },
245
562
  ...factConditionals,
246
563
  ],
247
564
  additionalProperties: false,
@@ -1 +1 @@
1
- {"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -34,6 +34,7 @@ const relationshipSchema = {
34
34
  "constrains",
35
35
  "requires_property",
36
36
  "requires_predicate",
37
+ "requires_rule",
37
38
  "guards",
38
39
  "publishes",
39
40
  "consumes",
@@ -0,0 +1,19 @@
1
+ export declare class SkillNotFoundError extends Error {
2
+ constructor(id: string);
3
+ }
4
+ export declare class SkillResourceNotFoundError extends Error {
5
+ constructor(id: string, resourcePath: string);
6
+ }
7
+ export declare class SkillResourceOutOfBoundsError extends Error {
8
+ constructor(id: string, resourcePath: string);
9
+ }
10
+ export declare class SkillValidationError extends Error {
11
+ readonly field: string;
12
+ constructor(field: string, message: string);
13
+ }
14
+ export declare class SkillOversizeError extends Error {
15
+ readonly maxBytes: number;
16
+ readonly actualBytes: number;
17
+ constructor(pathLike: string, maxBytes: number, actualBytes: number);
18
+ }
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/public/skill-system/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,EAAE,EAAE,MAAM;CAIvB;AACD,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAI7C;AACD,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAI7C;AACD,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK3C;AACD,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBACjB,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAQpE"}
@@ -0,0 +1,36 @@
1
+ export class SkillNotFoundError extends Error {
2
+ constructor(id) {
3
+ super(`Skill not found: ${id}`);
4
+ this.name = "SkillNotFoundError";
5
+ }
6
+ }
7
+ export class SkillResourceNotFoundError extends Error {
8
+ constructor(id, resourcePath) {
9
+ super(`Skill resource not found: ${id}/${resourcePath}`);
10
+ this.name = "SkillResourceNotFoundError";
11
+ }
12
+ }
13
+ export class SkillResourceOutOfBoundsError extends Error {
14
+ constructor(id, resourcePath) {
15
+ super(`Skill resource escapes bundle root: ${id}/${resourcePath}`);
16
+ this.name = "SkillResourceOutOfBoundsError";
17
+ }
18
+ }
19
+ export class SkillValidationError extends Error {
20
+ field;
21
+ constructor(field, message) {
22
+ super(message);
23
+ this.name = "SkillValidationError";
24
+ this.field = field;
25
+ }
26
+ }
27
+ export class SkillOversizeError extends Error {
28
+ maxBytes;
29
+ actualBytes;
30
+ constructor(pathLike, maxBytes, actualBytes) {
31
+ super(`Skill file exceeds ${maxBytes} bytes: ${pathLike} (${actualBytes} bytes)`);
32
+ this.name = "SkillOversizeError";
33
+ this.maxBytes = maxBytes;
34
+ this.actualBytes = actualBytes;
35
+ }
36
+ }
@@ -0,0 +1,9 @@
1
+ import type { SkillBundle, SkillManifest } from "./types.js";
2
+ export declare function setBundledSkillsDir(dir: string): void;
3
+ export declare function resetBundledSkillsDir(): void;
4
+ export declare function listBundledSkills(): SkillManifest[];
5
+ export declare function loadBundledSkill(id: string): SkillBundle;
6
+ export declare function loadBundledSkillFrom(skillsDir: string, id: string): SkillBundle;
7
+ export declare function readBundledSkillResource(id: string, resourcePath: string): string;
8
+ export declare function readBundledSkillResourceFrom(skillsDir: string, id: string, resourcePath: string): string;
9
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/public/skill-system/loader.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAW7D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAErD;AACD,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AACD,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AACD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAExD;AAGD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,GACT,WAAW,CAIb;AACD,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAGD,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,GACnB,MAAM,CAER"}
@@ -0,0 +1,76 @@
1
+ import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { SkillNotFoundError, SkillResourceNotFoundError, SkillResourceOutOfBoundsError, } from "./errors.js";
5
+ import { SKILL_FILE_NAME, isPathOutOfBounds, isWithinRoot, normalizeResourcePath, } from "./paths.js";
6
+ import { RESOURCE_MAX_BYTES, assertMaxBytes, parseSkillBundle, } from "./validation.js";
7
+ const defaultBundledSkillsDir = resolve(dirname(fileURLToPath(import.meta.url)), "../skills");
8
+ let bundledSkillsDir = defaultBundledSkillsDir;
9
+ export function setBundledSkillsDir(dir) {
10
+ bundledSkillsDir = dir;
11
+ }
12
+ export function resetBundledSkillsDir() {
13
+ bundledSkillsDir = defaultBundledSkillsDir;
14
+ }
15
+ export function listBundledSkills() {
16
+ return listFrom(bundledSkillsDir);
17
+ }
18
+ export function loadBundledSkill(id) {
19
+ return loadBundledSkillFrom(bundledSkillsDir, id);
20
+ }
21
+ // implements REQ-reusable-skill-subsystem
22
+ // covered_by TEST-skill-cli-load-validate
23
+ export function loadBundledSkillFrom(skillsDir, id) {
24
+ const root = findRoot(resolve(skillsDir), id);
25
+ if (!root)
26
+ throw new SkillNotFoundError(id);
27
+ return parseSkillBundle(root);
28
+ }
29
+ export function readBundledSkillResource(id, resourcePath) {
30
+ return readBundle(loadBundledSkill(id), id, resourcePath);
31
+ }
32
+ // implements REQ-reusable-skill-subsystem
33
+ // covered_by TEST-skill-cli-load-validate
34
+ export function readBundledSkillResourceFrom(skillsDir, id, resourcePath) {
35
+ return readBundle(loadBundledSkillFrom(skillsDir, id), id, resourcePath);
36
+ }
37
+ function listFrom(dir) {
38
+ if (!existsSync(dir))
39
+ return [];
40
+ return readdirSync(dir, { withFileTypes: true })
41
+ .filter((entry) => entry.isDirectory())
42
+ .map((entry) => join(dir, entry.name))
43
+ .filter((root) => existsSync(join(root, SKILL_FILE_NAME)))
44
+ .map((root) => parseSkillBundle(root).manifest)
45
+ .sort((a, b) => a.id.localeCompare(b.id));
46
+ }
47
+ function findRoot(dir, id) {
48
+ return listRoots(dir).find((root) => parseSkillBundle(root).manifest.id === id);
49
+ }
50
+ function listRoots(dir) {
51
+ if (!existsSync(dir))
52
+ return [];
53
+ return readdirSync(dir, { withFileTypes: true })
54
+ .filter((entry) => entry.isDirectory())
55
+ .map((entry) => join(dir, entry.name))
56
+ .filter((root) => existsSync(join(root, SKILL_FILE_NAME)));
57
+ }
58
+ function readBundle(bundle, id, resourcePath) {
59
+ const resource = normalizeResourcePath(resourcePath);
60
+ if (!resource || isPathOutOfBounds(resourcePath))
61
+ throw new SkillResourceOutOfBoundsError(id, resourcePath);
62
+ if (!(bundle.manifest.resources ?? []).some((declared) => normalizeResourcePath(declared) === resource))
63
+ throw new SkillResourceNotFoundError(id, resourcePath);
64
+ const candidate = resolve(bundle.rootDir, resource);
65
+ try {
66
+ if (!isWithinRoot(realpathSync(bundle.rootDir), realpathSync(candidate)))
67
+ throw new SkillResourceOutOfBoundsError(id, resourcePath);
68
+ }
69
+ catch (error) {
70
+ if (error instanceof SkillResourceOutOfBoundsError)
71
+ throw error;
72
+ throw new SkillResourceNotFoundError(id, resourcePath);
73
+ }
74
+ assertMaxBytes(candidate, RESOURCE_MAX_BYTES);
75
+ return readFileSync(candidate, "utf8");
76
+ }
@@ -0,0 +1,6 @@
1
+ export declare const SKILL_FILE_NAME = "SKILL.md";
2
+ export declare function normalizeResourcePath(pathLike: string): string;
3
+ export declare function isPathOutOfBounds(pathLike: string): boolean;
4
+ export declare function isWithinRoot(rootDir: string, candidatePath: string): boolean;
5
+ export declare function resolveSkillFilePath(pathLike: string): string;
6
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/public/skill-system/paths.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AACD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAQ3D;AACD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAG5E;AACD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO7D"}
@@ -0,0 +1,25 @@
1
+ import { existsSync, statSync } from "node:fs";
2
+ import { isAbsolute, join, normalize, relative, resolve } from "node:path";
3
+ export const SKILL_FILE_NAME = "SKILL.md";
4
+ export function normalizeResourcePath(pathLike) {
5
+ return normalize(pathLike).replaceAll("\\", "/");
6
+ }
7
+ export function isPathOutOfBounds(pathLike) {
8
+ const normalized = normalizeResourcePath(pathLike);
9
+ return (isAbsolute(pathLike) ||
10
+ normalized === ".." ||
11
+ normalized.startsWith("../") ||
12
+ normalized.includes("/../"));
13
+ }
14
+ export function isWithinRoot(rootDir, candidatePath) {
15
+ const rel = relative(rootDir, candidatePath);
16
+ return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
17
+ }
18
+ export function resolveSkillFilePath(pathLike) {
19
+ const resolved = resolve(pathLike);
20
+ if (existsSync(resolved) && statSync(resolved).isDirectory())
21
+ return join(resolved, SKILL_FILE_NAME);
22
+ return resolved.endsWith(SKILL_FILE_NAME)
23
+ ? resolved
24
+ : join(resolved, SKILL_FILE_NAME);
25
+ }
@@ -0,0 +1,15 @@
1
+ export interface SkillManifest {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ version: string;
6
+ kibiCompatibility: string;
7
+ tags?: string[];
8
+ resources?: string[];
9
+ }
10
+ export interface SkillBundle {
11
+ manifest: SkillManifest;
12
+ body: string;
13
+ rootDir: string;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/public/skill-system/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AACD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { SkillValidationError } from "./errors.js";
2
+ import type { SkillBundle } from "./types.js";
3
+ export declare const RESOURCE_MAX_BYTES: number;
4
+ export declare function assertMaxBytes(pathLike: string, maxBytes: number): void;
5
+ export declare function parseSkillBundle(rootDir: string): SkillBundle;
6
+ export declare function validateSkillBundle(pathLike: string): {
7
+ valid: boolean;
8
+ errors: SkillValidationError[];
9
+ };
10
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/public/skill-system/validation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQvE,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,kBAAkB,QAAa,CAAC;AAC7C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGvE;AACD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAW7D;AACD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC,CAeA"}