kibi-cli 2.1.0 → 2.3.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 (398) hide show
  1. package/dist/cli-operation-loader.d.ts.map +1 -1
  2. package/dist/cli-operation-loader.js +3 -0
  3. package/dist/cli-operation-metadata.d.ts +4 -0
  4. package/dist/cli-operation-metadata.d.ts.map +1 -1
  5. package/dist/cli-operation-metadata.js +5 -0
  6. package/dist/cli-protocol.d.ts.map +1 -1
  7. package/dist/cli-protocol.js +3 -2
  8. package/dist/cli-register-reporting.d.ts.map +1 -1
  9. package/dist/cli-register-reporting.js +4 -0
  10. package/dist/commands/aggregated-checks.d.ts +7 -0
  11. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  12. package/dist/commands/aggregated-checks.js +25 -1
  13. package/dist/commands/check-diff.d.ts +5 -0
  14. package/dist/commands/check-diff.d.ts.map +1 -0
  15. package/dist/commands/check-diff.js +62 -0
  16. package/dist/commands/check-generated.d.ts.map +1 -1
  17. package/dist/commands/check-generated.js +41 -18
  18. package/dist/commands/check.d.ts.map +1 -1
  19. package/dist/commands/check.js +231 -86
  20. package/dist/commands/doctor.d.ts.map +1 -1
  21. package/dist/commands/doctor.js +168 -53
  22. package/dist/commands/github-init.d.ts +1 -1
  23. package/dist/commands/github-init.d.ts.map +1 -1
  24. package/dist/commands/github-init.js +10 -3
  25. package/dist/commands/init-helpers.d.ts +17 -2
  26. package/dist/commands/init-helpers.d.ts.map +1 -1
  27. package/dist/commands/init-helpers.js +123 -23
  28. package/dist/commands/init.d.ts.map +1 -1
  29. package/dist/commands/init.js +110 -15
  30. package/dist/commands/prove.d.ts.map +1 -1
  31. package/dist/commands/prove.js +10 -18
  32. package/dist/commands/sync/cache.d.ts +20 -1
  33. package/dist/commands/sync/cache.d.ts.map +1 -1
  34. package/dist/commands/sync/cache.js +51 -2
  35. package/dist/commands/sync/discovery.d.ts.map +1 -1
  36. package/dist/commands/sync/discovery.js +1 -1
  37. package/dist/commands/sync/manifest.d.ts.map +1 -1
  38. package/dist/commands/sync/manifest.js +3 -1
  39. package/dist/commands/sync/persistence.d.ts.map +1 -1
  40. package/dist/commands/sync/persistence.js +8 -0
  41. package/dist/commands/sync.d.ts.map +1 -1
  42. package/dist/commands/sync.js +11 -3
  43. package/dist/engine.d.ts +41 -1
  44. package/dist/engine.d.ts.map +1 -1
  45. package/dist/engine.js +377 -80
  46. package/dist/extractors/manifest.d.ts.map +1 -1
  47. package/dist/extractors/manifest.js +66 -28
  48. package/dist/extractors/markdown.d.ts +2 -0
  49. package/dist/extractors/markdown.d.ts.map +1 -1
  50. package/dist/extractors/markdown.js +14 -3
  51. package/dist/extractors/relationships.d.ts.map +1 -1
  52. package/dist/extractors/relationships.js +1 -0
  53. package/dist/extractors/symbols-coordinator.d.ts +7 -0
  54. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  55. package/dist/extractors/symbols-coordinator.js +75 -39
  56. package/dist/intent-search.d.ts.map +1 -1
  57. package/dist/intent-search.js +68 -29
  58. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  59. package/dist/operations/bootstrap/generate.js +4 -3
  60. package/dist/operations/modeling/model-requirement.d.ts +1 -1
  61. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  62. package/dist/operations/modeling/model-requirement.js +176 -10
  63. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  64. package/dist/operations/modeling/predicate-applyplan.js +14 -2
  65. package/dist/operations/modeling/predicate-inference-1.js +1 -1
  66. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  67. package/dist/operations/modeling/predicate-loader.js +24 -0
  68. package/dist/operations/modeling/predicate-types.d.ts +4 -0
  69. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  70. package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
  71. package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
  72. package/dist/operations/modeling/predicate-vocabulary.js +169 -0
  73. package/dist/operations/modeling/requirement-types.d.ts +5 -0
  74. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  75. package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
  76. package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
  77. package/dist/operations/modeling/vocabulary-alignment.js +178 -0
  78. package/dist/operations/mutation/contradictions.d.ts +3 -0
  79. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  80. package/dist/operations/mutation/contradictions.js +29 -0
  81. package/dist/operations/mutation/delete.d.ts.map +1 -1
  82. package/dist/operations/mutation/delete.js +33 -1
  83. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
  84. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
  85. package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
  86. package/dist/operations/mutation/relationships.d.ts +1 -1
  87. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  88. package/dist/operations/mutation/relationships.js +1 -0
  89. package/dist/operations/mutation/saga.d.ts +5 -0
  90. package/dist/operations/mutation/saga.d.ts.map +1 -1
  91. package/dist/operations/mutation/saga.js +10 -0
  92. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  93. package/dist/operations/mutation/serialization.js +2 -0
  94. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  95. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  96. package/dist/operations/mutation/source-authoring.js +213 -52
  97. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  98. package/dist/operations/mutation/strict-fact.js +5 -0
  99. package/dist/operations/mutation/types.d.ts +17 -0
  100. package/dist/operations/mutation/types.d.ts.map +1 -1
  101. package/dist/operations/mutation/upsert.d.ts +6 -0
  102. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  103. package/dist/operations/mutation/upsert.js +77 -11
  104. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  105. package/dist/operations/mutation/validate-upsert.js +24 -1
  106. package/dist/operations/mutation/validation.d.ts.map +1 -1
  107. package/dist/operations/mutation/validation.js +16 -3
  108. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  109. package/dist/operations/planning/apply-plan.js +66 -26
  110. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  111. package/dist/operations/planning/compile-intent.js +3 -1
  112. package/dist/operations/proof/code-scope.d.ts +17 -0
  113. package/dist/operations/proof/code-scope.d.ts.map +1 -0
  114. package/dist/operations/proof/code-scope.js +60 -0
  115. package/dist/operations/proof/ingest-proof.d.ts +4 -2
  116. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  117. package/dist/operations/proof/ingest-proof.js +208 -74
  118. package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
  119. package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
  120. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  121. package/dist/operations/proof/prune-receipts.js +7 -5
  122. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  123. package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
  124. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  125. package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
  126. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  127. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  128. package/dist/operations/semantic-advisor/clauses.js +7 -1
  129. package/dist/performance-trace.d.ts +17 -0
  130. package/dist/performance-trace.d.ts.map +1 -0
  131. package/dist/performance-trace.js +134 -0
  132. package/dist/plugins/approved-source-analyzers.d.ts +13 -0
  133. package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
  134. package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
  135. package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
  136. package/dist/plugins/approved-source-analyzers.generated.js +77 -0
  137. package/dist/plugins/approved-source-analyzers.js +3 -0
  138. package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
  139. package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
  140. package/dist/plugins/compose-semantic-classifier.js +8 -3
  141. package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
  142. package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
  143. package/dist/plugins/compose-vocabulary-alignment.js +141 -0
  144. package/dist/plugins/external-allowlist.d.ts +7 -0
  145. package/dist/plugins/external-allowlist.d.ts.map +1 -1
  146. package/dist/plugins/external-allowlist.js +13 -0
  147. package/dist/plugins/index.d.ts +2 -0
  148. package/dist/plugins/index.d.ts.map +1 -1
  149. package/dist/plugins/index.js +4 -0
  150. package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
  151. package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
  152. package/dist/plugins/maintenance-source-analysis.js +191 -0
  153. package/dist/plugins/registry.d.ts +3 -1
  154. package/dist/plugins/registry.d.ts.map +1 -1
  155. package/dist/plugins/registry.js +27 -1
  156. package/dist/plugins/source-analysis-service.d.ts +36 -1
  157. package/dist/plugins/source-analysis-service.d.ts.map +1 -1
  158. package/dist/plugins/source-analysis-service.js +184 -27
  159. package/dist/plugins/source-change-analysis.d.ts +15 -0
  160. package/dist/plugins/source-change-analysis.d.ts.map +1 -0
  161. package/dist/plugins/source-change-analysis.js +54 -0
  162. package/dist/plugins/source-classification.d.ts +41 -0
  163. package/dist/plugins/source-classification.d.ts.map +1 -0
  164. package/dist/plugins/source-classification.js +490 -0
  165. package/dist/prolog/codec.d.ts.map +1 -1
  166. package/dist/prolog/codec.js +2 -0
  167. package/dist/prolog/swipl-resolver.d.ts +88 -0
  168. package/dist/prolog/swipl-resolver.d.ts.map +1 -0
  169. package/dist/prolog/swipl-resolver.js +446 -0
  170. package/dist/prolog.d.ts +51 -1
  171. package/dist/prolog.d.ts.map +1 -1
  172. package/dist/prolog.js +145 -15
  173. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  174. package/dist/public/diagnostic-usage.js +7 -25
  175. package/dist/public/impact/analyzer.d.ts.map +1 -1
  176. package/dist/public/impact/analyzer.js +56 -5
  177. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  178. package/dist/public/impact/diagnostics.js +3 -1
  179. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  180. package/dist/public/impact/full-kb-quality.js +4 -12
  181. package/dist/public/impact/manifest.d.ts.map +1 -1
  182. package/dist/public/impact/manifest.js +15 -1
  183. package/dist/public/impact/source-changes.d.ts.map +1 -1
  184. package/dist/public/impact/source-changes.js +35 -27
  185. package/dist/public/impact/types.d.ts +2 -0
  186. package/dist/public/impact/types.d.ts.map +1 -1
  187. package/dist/public/operations/catalog.d.ts +80 -7
  188. package/dist/public/operations/catalog.d.ts.map +1 -1
  189. package/dist/public/operations/catalog.js +2 -0
  190. package/dist/public/operations/check-executor.d.ts.map +1 -1
  191. package/dist/public/operations/check-executor.js +10 -2
  192. package/dist/public/operations/check-helpers.d.ts +6 -0
  193. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  194. package/dist/public/operations/check-helpers.js +21 -1
  195. package/dist/public/operations/contracts.d.ts.map +1 -1
  196. package/dist/public/operations/contracts.js +325 -8
  197. package/dist/public/operations/discovery-entities.d.ts +42 -2
  198. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  199. package/dist/public/operations/discovery-entities.js +195 -22
  200. package/dist/public/operations/discovery-executors.d.ts +1 -0
  201. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  202. package/dist/public/operations/discovery-executors.js +75 -46
  203. package/dist/public/operations/impact-review-preparation.d.ts +14 -0
  204. package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
  205. package/dist/public/operations/impact-review-preparation.js +379 -0
  206. package/dist/public/operations/index.d.ts +2 -0
  207. package/dist/public/operations/index.d.ts.map +1 -1
  208. package/dist/public/operations/index.js +2 -0
  209. package/dist/public/operations/migration-plan.d.ts +2 -0
  210. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  211. package/dist/public/operations/migration-plan.js +50 -0
  212. package/dist/public/operations/node-ports.d.ts.map +1 -1
  213. package/dist/public/operations/node-ports.js +1 -35
  214. package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
  215. package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
  216. package/dist/public/operations/predicate-schema-conformance.js +242 -0
  217. package/dist/public/operations/prolog-json.d.ts.map +1 -1
  218. package/dist/public/operations/prolog-json.js +9 -3
  219. package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
  220. package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
  221. package/dist/public/operations/proof-receipt-projection.js +36 -0
  222. package/dist/public/operations/result-envelope.d.ts +34 -1
  223. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  224. package/dist/public/operations/result-envelope.js +78 -2
  225. package/dist/public/operations/runtime-types.d.ts +1 -1
  226. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  227. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  228. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  229. package/dist/public/operations/specs/check-rules.generated.js +8 -1
  230. package/dist/public/operations/specs/check.d.ts +1 -1
  231. package/dist/public/operations/specs/discovery.d.ts +7 -1
  232. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  233. package/dist/public/operations/specs/discovery.js +7 -1
  234. package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
  235. package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
  236. package/dist/public/operations/specs/impact-review-preparation.js +43 -0
  237. package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
  238. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  239. package/dist/public/operations/specs/mutation-schemas.js +21 -3
  240. package/dist/public/operations/specs/reporting.d.ts +8 -0
  241. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  242. package/dist/public/operations/specs/reporting.js +46 -15
  243. package/dist/public/operations/specs/upsert.d.ts +28 -5
  244. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  245. package/dist/public/operations/specs/upsert.js +1 -1
  246. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  247. package/dist/public/operations/symbol-repair-plan.js +8 -3
  248. package/dist/public/operations/types.d.ts +1 -1
  249. package/dist/public/operations/types.d.ts.map +1 -1
  250. package/dist/public/schemas/entity.d.ts.map +1 -1
  251. package/dist/public/schemas/entity.js +22 -0
  252. package/dist/public/schemas/relationship.d.ts.map +1 -1
  253. package/dist/public/schemas/relationship.js +1 -0
  254. package/dist/public/skills/kibi-usage/SKILL.md +7 -3
  255. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  256. package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -0
  257. package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  258. package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  259. package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
  260. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  261. package/dist/public/telemetry-acceptance.js +21 -5
  262. package/dist/relationships/shards.d.ts +6 -0
  263. package/dist/relationships/shards.d.ts.map +1 -1
  264. package/dist/relationships/shards.js +26 -19
  265. package/dist/schemas/entity.schema.json +32 -0
  266. package/dist/traceability/analysis-gate.d.ts +39 -0
  267. package/dist/traceability/analysis-gate.d.ts.map +1 -0
  268. package/dist/traceability/analysis-gate.js +51 -0
  269. package/dist/traceability/git-change-snapshot.d.ts +27 -0
  270. package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
  271. package/dist/traceability/git-change-snapshot.js +411 -0
  272. package/dist/traceability/git-staged.d.ts +5 -1
  273. package/dist/traceability/git-staged.d.ts.map +1 -1
  274. package/dist/traceability/git-staged.js +16 -11
  275. package/dist/traceability/impact-evaluator.d.ts +54 -0
  276. package/dist/traceability/impact-evaluator.d.ts.map +1 -0
  277. package/dist/traceability/impact-evaluator.js +270 -0
  278. package/dist/traceability/impact-git-tree.d.ts +12 -0
  279. package/dist/traceability/impact-git-tree.d.ts.map +1 -0
  280. package/dist/traceability/impact-git-tree.js +46 -0
  281. package/dist/traceability/impact-knowledge.d.ts +16 -0
  282. package/dist/traceability/impact-knowledge.d.ts.map +1 -0
  283. package/dist/traceability/impact-knowledge.js +165 -0
  284. package/dist/traceability/impact-policy.d.ts +15 -0
  285. package/dist/traceability/impact-policy.d.ts.map +1 -0
  286. package/dist/traceability/impact-policy.js +48 -0
  287. package/dist/traceability/impact-policy.v1.schema.json +48 -0
  288. package/dist/traceability/impact-pr-diff.d.ts +5 -0
  289. package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
  290. package/dist/traceability/impact-pr-diff.js +83 -0
  291. package/dist/traceability/impact-record-validation.d.ts +9 -0
  292. package/dist/traceability/impact-record-validation.d.ts.map +1 -0
  293. package/dist/traceability/impact-record-validation.js +113 -0
  294. package/dist/traceability/impact-review.d.ts +148 -0
  295. package/dist/traceability/impact-review.d.ts.map +1 -0
  296. package/dist/traceability/impact-review.js +494 -0
  297. package/dist/traceability/impact-review.schema.json +365 -0
  298. package/dist/traceability/impact-side-evidence.d.ts +13 -0
  299. package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
  300. package/dist/traceability/impact-side-evidence.js +240 -0
  301. package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
  302. package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
  303. package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
  304. package/dist/traceability/snapshot-knowledge.d.ts +4 -0
  305. package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
  306. package/dist/traceability/snapshot-knowledge.js +98 -0
  307. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  308. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  309. package/dist/traceability/staged-entity-id-style.d.ts +12 -0
  310. package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
  311. package/dist/traceability/staged-entity-id-style.js +68 -0
  312. package/dist/traceability/staged-file-coverage.d.ts +23 -0
  313. package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
  314. package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
  315. package/dist/traceability/staged-impact-contract.js +2 -16
  316. package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
  317. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  318. package/dist/traceability/staged-symbols-manifest.js +17 -6
  319. package/dist/traceability/symbol-extract.d.ts +3 -5
  320. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  321. package/dist/traceability/symbol-extract.js +49 -34
  322. package/dist/traceability/temp-kb.d.ts +1 -1
  323. package/dist/traceability/temp-kb.d.ts.map +1 -1
  324. package/dist/traceability/temp-kb.js +57 -13
  325. package/dist/traceability/trusted-pr-event.d.ts +13 -0
  326. package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
  327. package/dist/traceability/trusted-pr-event.js +105 -0
  328. package/dist/traceability/validate.js +1 -1
  329. package/dist/types/entities.d.ts +2 -0
  330. package/dist/types/entities.d.ts.map +1 -1
  331. package/dist/types/relationships.d.ts +1 -1
  332. package/dist/types/relationships.d.ts.map +1 -1
  333. package/dist/utils/canonical-path.d.ts +3 -0
  334. package/dist/utils/canonical-path.d.ts.map +1 -0
  335. package/dist/utils/canonical-path.js +33 -0
  336. package/dist/utils/entity-id-style.d.ts +27 -0
  337. package/dist/utils/entity-id-style.d.ts.map +1 -0
  338. package/dist/utils/entity-id-style.js +81 -0
  339. package/dist/utils/git-repository-context.d.ts +50 -0
  340. package/dist/utils/git-repository-context.d.ts.map +1 -0
  341. package/dist/utils/git-repository-context.js +259 -0
  342. package/dist/utils/rule-registry.d.ts +5 -0
  343. package/dist/utils/rule-registry.d.ts.map +1 -1
  344. package/dist/utils/rule-registry.generated.d.ts +37 -0
  345. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  346. package/dist/utils/rule-registry.generated.js +44 -0
  347. package/dist/utils/strict-modeling.d.ts +7 -0
  348. package/dist/utils/strict-modeling.d.ts.map +1 -1
  349. package/dist/utils/strict-modeling.js +11 -0
  350. package/package.json +14 -5
  351. package/schema/entities.pl +60 -1
  352. package/schema/relationships.pl +17 -4
  353. package/schema/validation.pl +118 -20
  354. package/src/public/diagnostic-usage.ts +16 -24
  355. package/src/public/impact/analyzer.ts +88 -5
  356. package/src/public/impact/diagnostics.ts +7 -5
  357. package/src/public/impact/full-kb-quality.ts +4 -16
  358. package/src/public/impact/manifest.ts +14 -1
  359. package/src/public/impact/source-changes.ts +39 -34
  360. package/src/public/impact/types.ts +5 -0
  361. package/src/public/operations/catalog.ts +2 -0
  362. package/src/public/operations/check-executor.ts +12 -1
  363. package/src/public/operations/check-helpers.ts +27 -1
  364. package/src/public/operations/contracts.ts +404 -9
  365. package/src/public/operations/discovery-entities.ts +292 -23
  366. package/src/public/operations/discovery-executors.ts +91 -55
  367. package/src/public/operations/impact-review-preparation.ts +548 -0
  368. package/src/public/operations/index.ts +2 -0
  369. package/src/public/operations/migration-plan.ts +57 -0
  370. package/src/public/operations/node-ports.ts +1 -39
  371. package/src/public/operations/predicate-schema-conformance.ts +362 -0
  372. package/src/public/operations/prolog-json.ts +9 -3
  373. package/src/public/operations/proof-receipt-projection.ts +39 -0
  374. package/src/public/operations/result-envelope.ts +114 -2
  375. package/src/public/operations/runtime-types.ts +1 -1
  376. package/src/public/operations/specs/check-rules.generated.ts +8 -1
  377. package/src/public/operations/specs/discovery.ts +8 -1
  378. package/src/public/operations/specs/impact-review-preparation.ts +46 -0
  379. package/src/public/operations/specs/mutation-schemas.ts +23 -3
  380. package/src/public/operations/specs/reporting.ts +69 -22
  381. package/src/public/operations/specs/upsert.ts +1 -1
  382. package/src/public/operations/symbol-repair-plan.ts +13 -3
  383. package/src/public/operations/types.ts +1 -0
  384. package/src/public/schemas/entity.ts +22 -0
  385. package/src/public/schemas/relationship.ts +1 -0
  386. package/src/public/skills/kibi-usage/SKILL.md +7 -3
  387. package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  388. package/src/public/skills/kibi-usage/resources/operation-access.md +1 -0
  389. package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  390. package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  391. package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
  392. package/src/public/telemetry-acceptance.ts +37 -6
  393. package/src/schemas/entity.schema.json +32 -0
  394. package/src/schemas/relationship.schema.json +1 -0
  395. package/src/traceability/impact-policy.v1.schema.json +48 -0
  396. package/src/traceability/impact-review.schema.json +365 -0
  397. package/templates/github/kibi-badge.yml +0 -4
  398. package/templates/github/kibi-report.yml +0 -4
@@ -0,0 +1,54 @@
1
+ import { analysisObligation, } from "../traceability/analysis-gate.js";
2
+ /** Files analyzed at once; pooled providers bound their own worker count. */
3
+ const SOURCE_ANALYSIS_CONCURRENCY = 4;
4
+ /** Analyze both versions without changing the complete inventory or assigning proof. */
5
+ // implements REQ-014
6
+ export async function analyzeSourceChanges(inventory, service) {
7
+ const files = inventory.filter((file) => file.analysisDepth !== "metadata" && !file.skipReason);
8
+ const results = new Array(files.length);
9
+ let next = 0;
10
+ const worker = async () => {
11
+ while (next < files.length) {
12
+ const index = next++;
13
+ const file = files[index];
14
+ const [before, after] = await Promise.all([
15
+ file.previousContent === undefined
16
+ ? null
17
+ : service.analyzeTextV2(file.oldPath ?? file.copyFromPath ?? file.path, file.previousContent),
18
+ file.content === undefined
19
+ ? null
20
+ : service.analyzeTextV2(file.path, file.content),
21
+ ]);
22
+ results[index] = { path: file.path, before, after };
23
+ }
24
+ };
25
+ await Promise.all(Array.from({ length: Math.min(SOURCE_ANALYSIS_CONCURRENCY, files.length) }, worker));
26
+ // Map order follows the inventory, independent of completion order.
27
+ return new Map(results.map((change) => [change.path, change]));
28
+ }
29
+ /** Adapt a host result to the shared analysis gate. */
30
+ // implements REQ-source-analysis-v2
31
+ export function gateAnalysis(result) {
32
+ return result
33
+ ? {
34
+ status: result.status,
35
+ diagnosticCodes: result.diagnostics.map((item) => item.code),
36
+ uncoveredRanges: result.uncoveredRanges,
37
+ }
38
+ : null;
39
+ }
40
+ /** Enforce the shared analysis gate when no impact policy accepts reviews. */
41
+ // implements REQ-source-analysis-v2
42
+ export function assertSourceAnalysisGate(inventory, analyses) {
43
+ for (const file of inventory) {
44
+ const analysis = analyses.get(file.path);
45
+ const after = analysis?.after ?? null;
46
+ const obligation = analysisObligation("after", gateAnalysis(after), file.hunkRanges);
47
+ if (obligation.kind !== "blocked" && obligation.kind !== "partial_review")
48
+ continue;
49
+ const detail = after?.diagnostics.map((d) => d.message).join("; ") ?? "";
50
+ throw new Error(obligation.kind === "blocked"
51
+ ? `Source analysis ${after?.status} for ${file.path}: ${detail}`
52
+ : `Source analysis partial for ${file.path} where the staged change touches uncovered lines (${obligation.ranges.map((range) => `${range.startLine}-${range.endLine}`).join(", ")}): ${detail}`);
53
+ }
54
+ }
@@ -0,0 +1,41 @@
1
+ export type SourceClassification = Readonly<{
2
+ kind: "language";
3
+ language: string;
4
+ source: "extension" | "shebang" | "explicit";
5
+ }> | Readonly<{
6
+ kind: "file-level";
7
+ language: string;
8
+ source: "extension" | "shebang" | "explicit";
9
+ reason: string;
10
+ }> | Readonly<{
11
+ kind: "ambiguous";
12
+ language: string;
13
+ candidates: readonly string[];
14
+ reason: string;
15
+ }> | Readonly<{
16
+ kind: "conflict";
17
+ language: "unknown";
18
+ extensionLanguage?: string;
19
+ shebangLanguage?: string;
20
+ explicitLanguage?: string;
21
+ reason: string;
22
+ }> | Readonly<{
23
+ kind: "unknown";
24
+ language: "unknown";
25
+ reason: string;
26
+ }>;
27
+ /**
28
+ * Extension-only language label for a path, or "unknown". This is the single
29
+ * extension table; callers that need content-aware classification (shebangs,
30
+ * explicit hints, ambiguity) must use classifySource instead.
31
+ */
32
+ export declare function extensionLanguage(filePath: string): string;
33
+ /** True for TypeScript/JavaScript paths handled by the ts-morph analyzer. */
34
+ export declare function isTsJsSourcePath(filePath: string): boolean;
35
+ /** True for paths whose language has qualified declaration analysis. */
36
+ export declare function isQualifiedSourcePath(filePath: string): boolean;
37
+ /** Every classified extension, for parity checks against provider catalogs. */
38
+ export declare function classifiedExtensions(): readonly string[];
39
+ /** Classifies a path and bounded snapshot prefix without executing the source or its interpreter. */
40
+ export declare function classifySource(filePath: string, content: string, explicitLanguageHint?: string): SourceClassification;
41
+ //# sourceMappingURL=source-classification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-classification.d.ts","sourceRoot":"","sources":["../../src/plugins/source-classification.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,CAAC;IACP,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;CAC9C,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAsGP;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,6EAA6E;AAE7E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED,wEAAwE;AAExE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAM/D;AAED,+EAA+E;AAE/E,wBAAgB,oBAAoB,IAAI,SAAS,MAAM,EAAE,CAExD;AAuQD,qGAAqG;AACrG,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,oBAAoB,CAAC,EAAE,MAAM,GAC5B,oBAAoB,CA2JtB"}
@@ -0,0 +1,490 @@
1
+ const MAX_SHEBANG_LENGTH = 512;
2
+ const MAX_SHEBANG_TOKENS = 16;
3
+ const MAX_TOKEN_LENGTH = 128;
4
+ const EXTENSIONS = {
5
+ ".bash": { kind: "language", language: "bash" },
6
+ ".c": { kind: "language", language: "c" },
7
+ ".cc": { kind: "language", language: "cpp" },
8
+ ".cjs": { kind: "language", language: "javascript" },
9
+ ".cpp": { kind: "language", language: "cpp" },
10
+ ".cs": { kind: "language", language: "csharp" },
11
+ ".cts": { kind: "language", language: "typescript" },
12
+ ".cxx": { kind: "language", language: "cpp" },
13
+ ".go": { kind: "language", language: "go" },
14
+ ".h": { kind: "ambiguous", language: "c-or-cpp", candidates: ["c", "cpp"] },
15
+ ".hcl": { kind: "language", language: "hcl" },
16
+ ".hh": { kind: "language", language: "cpp" },
17
+ ".hpp": { kind: "language", language: "cpp" },
18
+ ".hxx": { kind: "language", language: "cpp" },
19
+ ".html": {
20
+ kind: "file-level",
21
+ language: "html",
22
+ reason: "HTML is classified as a file-level document.",
23
+ },
24
+ ".java": { kind: "language", language: "java" },
25
+ ".js": { kind: "language", language: "javascript" },
26
+ ".jsx": { kind: "language", language: "javascript" },
27
+ ".json": {
28
+ kind: "file-level",
29
+ language: "json",
30
+ reason: "JSON is classified as a file-level document.",
31
+ },
32
+ ".kt": { kind: "language", language: "kotlin" },
33
+ ".mjs": { kind: "language", language: "javascript" },
34
+ ".mts": { kind: "language", language: "typescript" },
35
+ ".php": { kind: "language", language: "php" },
36
+ ".pl": {
37
+ kind: "ambiguous",
38
+ language: "perl-or-prolog",
39
+ candidates: ["perl", "prolog"],
40
+ },
41
+ ".py": { kind: "language", language: "python" },
42
+ ".pyi": { kind: "language", language: "python" },
43
+ ".rb": { kind: "language", language: "ruby" },
44
+ ".rs": { kind: "language", language: "rust" },
45
+ ".sh": {
46
+ kind: "file-level",
47
+ language: "shell",
48
+ reason: "A .sh extension does not identify a shell dialect.",
49
+ },
50
+ ".sql": {
51
+ kind: "file-level",
52
+ language: "sql",
53
+ reason: "SQL is classified as a file-level document.",
54
+ },
55
+ ".swift": { kind: "language", language: "swift" },
56
+ ".ts": { kind: "language", language: "typescript" },
57
+ ".tsx": { kind: "language", language: "typescript" },
58
+ ".tf": { kind: "language", language: "terraform" },
59
+ ".yaml": {
60
+ kind: "file-level",
61
+ language: "yaml",
62
+ reason: "YAML is classified as a file-level document.",
63
+ },
64
+ ".yml": {
65
+ kind: "file-level",
66
+ language: "yaml",
67
+ reason: "YAML is classified as a file-level document.",
68
+ },
69
+ ".css": {
70
+ kind: "file-level",
71
+ language: "css",
72
+ reason: "CSS is classified as a file-level document.",
73
+ },
74
+ };
75
+ /** Languages whose declarations the host analyzes with a qualified parser. */
76
+ const QUALIFIED_SOURCE_LANGUAGES = new Set([
77
+ "typescript",
78
+ "javascript",
79
+ "python",
80
+ "go",
81
+ "rust",
82
+ ]);
83
+ /**
84
+ * Extension-only language label for a path, or "unknown". This is the single
85
+ * extension table; callers that need content-aware classification (shebangs,
86
+ * explicit hints, ambiguity) must use classifySource instead.
87
+ */
88
+ // implements REQ-source-analysis-v2
89
+ export function extensionLanguage(filePath) {
90
+ return EXTENSIONS[extensionOf(filePath)]?.language ?? "unknown";
91
+ }
92
+ /** True for TypeScript/JavaScript paths handled by the ts-morph analyzer. */
93
+ // implements REQ-source-analysis-v2
94
+ export function isTsJsSourcePath(filePath) {
95
+ const language = extensionLanguage(filePath);
96
+ return language === "typescript" || language === "javascript";
97
+ }
98
+ /** True for paths whose language has qualified declaration analysis. */
99
+ // implements REQ-source-analysis-v2
100
+ export function isQualifiedSourcePath(filePath) {
101
+ const signal = EXTENSIONS[extensionOf(filePath)];
102
+ return (signal?.kind === "language" &&
103
+ QUALIFIED_SOURCE_LANGUAGES.has(signal.language));
104
+ }
105
+ /** Every classified extension, for parity checks against provider catalogs. */
106
+ // implements REQ-source-analysis-v2
107
+ export function classifiedExtensions() {
108
+ return Object.keys(EXTENSIONS).sort();
109
+ }
110
+ const FILE_LEVEL_LANGUAGES = new Set([
111
+ "css",
112
+ "html",
113
+ "json",
114
+ "perl",
115
+ "prolog",
116
+ "shell",
117
+ "sql",
118
+ "yaml",
119
+ ]);
120
+ const SHELL_INTERPRETERS = new Set([
121
+ "ash",
122
+ "busybox",
123
+ "csh",
124
+ "dash",
125
+ "fish",
126
+ "ksh",
127
+ "mksh",
128
+ "pwsh",
129
+ "sh",
130
+ "tcsh",
131
+ "yash",
132
+ "zsh",
133
+ ]);
134
+ function basename(value) {
135
+ return value.split(/[\\/]/).at(-1) ?? value;
136
+ }
137
+ function extensionOf(filePath) {
138
+ const name = basename(filePath);
139
+ const dot = name.lastIndexOf(".");
140
+ return dot <= 0 ? "" : name.slice(dot).toLowerCase();
141
+ }
142
+ function canonicalLanguage(value) {
143
+ const language = value.trim().toLowerCase();
144
+ if (language === "")
145
+ return undefined;
146
+ if (["py", "python", "python2", "python3"].includes(language))
147
+ return "python";
148
+ if (["bash", "bash5"].includes(language))
149
+ return "bash";
150
+ if (["rb", "ruby"].includes(language) || /^ruby\d+(?:\.\d+)*$/.test(language))
151
+ return "ruby";
152
+ if (["js", "javascript", "node", "nodejs"].includes(language))
153
+ return "javascript";
154
+ if (["ts", "typescript"].includes(language))
155
+ return "typescript";
156
+ if (["c++", "cpp", "cxx"].includes(language))
157
+ return "cpp";
158
+ if (["c#", "c-sharp", "csharp", "cs"].includes(language))
159
+ return "csharp";
160
+ if (["perl", "pl"].includes(language))
161
+ return "perl";
162
+ if (["prolog", "swipl"].includes(language))
163
+ return "prolog";
164
+ if (language === "tf")
165
+ return "terraform";
166
+ return language;
167
+ }
168
+ function tokenizeWords(value) {
169
+ const words = [];
170
+ let current = "";
171
+ let quote;
172
+ let escaped = false;
173
+ let started = false;
174
+ for (const character of value) {
175
+ if (escaped) {
176
+ current += character;
177
+ escaped = false;
178
+ started = true;
179
+ continue;
180
+ }
181
+ if (character === "\\" && quote !== "'") {
182
+ escaped = true;
183
+ started = true;
184
+ continue;
185
+ }
186
+ if (quote !== undefined) {
187
+ if (character === quote)
188
+ quote = undefined;
189
+ else
190
+ current += character;
191
+ started = true;
192
+ continue;
193
+ }
194
+ if (character === "'" || character === '"') {
195
+ quote = character;
196
+ started = true;
197
+ continue;
198
+ }
199
+ if (/\s/.test(character)) {
200
+ if (started) {
201
+ words.push(current);
202
+ if (words.length > MAX_SHEBANG_TOKENS)
203
+ return undefined;
204
+ current = "";
205
+ started = false;
206
+ }
207
+ continue;
208
+ }
209
+ current += character;
210
+ started = true;
211
+ if (current.length > MAX_TOKEN_LENGTH)
212
+ return undefined;
213
+ }
214
+ if (escaped || quote !== undefined)
215
+ return undefined;
216
+ if (started)
217
+ words.push(current);
218
+ return words.length > MAX_SHEBANG_TOKENS ? undefined : words;
219
+ }
220
+ function envCommand(arguments_) {
221
+ for (let index = 0; index < arguments_.length; index += 1) {
222
+ const argument = arguments_[index];
223
+ if (argument === undefined)
224
+ return undefined;
225
+ if (argument === "--")
226
+ return arguments_[index + 1];
227
+ if (argument === "-S" || argument === "--split-string") {
228
+ const commandText = arguments_.slice(index + 1).join(" ");
229
+ return commandInSplitString(commandText);
230
+ }
231
+ if (argument.startsWith("--split-string=")) {
232
+ return commandInSplitString(argument.slice("--split-string=".length));
233
+ }
234
+ if (argument === "-u" ||
235
+ argument === "--unset" ||
236
+ argument === "-C" ||
237
+ argument === "--chdir" ||
238
+ argument === "-a" ||
239
+ argument === "--argv0") {
240
+ index += 1;
241
+ continue;
242
+ }
243
+ if (argument === "-i" ||
244
+ argument === "--ignore-environment" ||
245
+ argument.startsWith("--unset=") ||
246
+ argument.startsWith("--chdir=") ||
247
+ argument.startsWith("--argv0=") ||
248
+ /^[A-Za-z_][A-Za-z0-9_]*=/.test(argument)) {
249
+ continue;
250
+ }
251
+ if (argument.startsWith("-"))
252
+ return undefined;
253
+ return argument;
254
+ }
255
+ return undefined;
256
+ }
257
+ function commandInSplitString(value) {
258
+ const words = tokenizeWords(value);
259
+ if (!words)
260
+ return undefined;
261
+ let index = 0;
262
+ while (index < words.length) {
263
+ const argument = words[index];
264
+ if (argument === undefined)
265
+ return undefined;
266
+ if (argument === "--")
267
+ return words[index + 1];
268
+ if (argument === "-i" || argument === "--ignore-environment") {
269
+ index += 1;
270
+ continue;
271
+ }
272
+ if (argument === "-u" || argument === "--unset") {
273
+ const name = words[index + 1];
274
+ if (name === undefined || name === "")
275
+ return undefined;
276
+ index += 2;
277
+ continue;
278
+ }
279
+ if (argument.startsWith("--unset=")) {
280
+ if (argument.length === "--unset=".length)
281
+ return undefined;
282
+ index += 1;
283
+ continue;
284
+ }
285
+ if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(argument)) {
286
+ index += 1;
287
+ continue;
288
+ }
289
+ if (argument.startsWith("-"))
290
+ return undefined;
291
+ return argument;
292
+ }
293
+ return undefined;
294
+ }
295
+ function interpreterFor(command) {
296
+ const name = basename(command).toLowerCase();
297
+ const withoutExe = name.endsWith(".exe") ? name.slice(0, -4) : name;
298
+ if (/^(?:python|python\d+(?:\.\d+)*)$/.test(withoutExe)) {
299
+ return { name: withoutExe, language: "python" };
300
+ }
301
+ if (/^ruby(?:\d+(?:\.\d+)*)?$/.test(withoutExe)) {
302
+ return { name: withoutExe, language: "ruby" };
303
+ }
304
+ if (["node", "nodejs"].includes(withoutExe)) {
305
+ return { name: withoutExe, language: "javascript" };
306
+ }
307
+ if (withoutExe === "bash" || /^bash\d+$/.test(withoutExe)) {
308
+ return { name: withoutExe, language: "bash" };
309
+ }
310
+ if (SHELL_INTERPRETERS.has(withoutExe)) {
311
+ return { name: withoutExe, family: "shell" };
312
+ }
313
+ if (/^(?:perl|perl\d+(?:\.\d+)*)$/.test(withoutExe)) {
314
+ return { name: withoutExe, language: "perl" };
315
+ }
316
+ if (["prolog", "swipl", "gprolog"].includes(withoutExe)) {
317
+ return { name: withoutExe, language: "prolog" };
318
+ }
319
+ return { name: withoutExe || "unknown" };
320
+ }
321
+ function shebangFor(content) {
322
+ const bomOffset = content.charCodeAt(0) === 0xfeff ? 1 : 0;
323
+ const prefix = content.slice(bomOffset, bomOffset + MAX_SHEBANG_LENGTH + 2);
324
+ if (!prefix.startsWith("#!"))
325
+ return undefined;
326
+ const lineEnd = prefix.search(/[\r\n]/);
327
+ if (lineEnd < 0 && content.length > bomOffset + MAX_SHEBANG_LENGTH + 2) {
328
+ return { name: "overlong-shebang" };
329
+ }
330
+ const line = prefix.slice(2, lineEnd < 0 ? undefined : lineEnd).trim();
331
+ const words = tokenizeWords(line);
332
+ if (!words || words.length === 0 || words[0] === undefined) {
333
+ return { name: "malformed-shebang" };
334
+ }
335
+ const executable = basename(words[0]).toLowerCase();
336
+ if (executable === "env") {
337
+ const command = envCommand(words.slice(1));
338
+ return command === undefined
339
+ ? { name: "malformed-env-shebang" }
340
+ : interpreterFor(command);
341
+ }
342
+ return interpreterFor(words[0]);
343
+ }
344
+ function classificationForLanguage(language, source) {
345
+ if (FILE_LEVEL_LANGUAGES.has(language)) {
346
+ return {
347
+ kind: "file-level",
348
+ language,
349
+ source,
350
+ reason: `${language} is retained as a file-level classification; no syntax extractor is selected.`,
351
+ };
352
+ }
353
+ return { kind: "language", language, source };
354
+ }
355
+ function isExtensionCompatibleWith(extension, language) {
356
+ if (extension.kind === "ambiguous")
357
+ return extension.candidates.includes(language);
358
+ if (extension.kind === "file-level" && extension.language === "shell") {
359
+ return language === "bash" || language === "shell";
360
+ }
361
+ return extension.language === language;
362
+ }
363
+ function conflict(reason, details = {}) {
364
+ return { kind: "conflict", language: "unknown", reason, ...details };
365
+ }
366
+ /** Classifies a path and bounded snapshot prefix without executing the source or its interpreter. */
367
+ export function classifySource(filePath, content, explicitLanguageHint) {
368
+ const extension = EXTENSIONS[extensionOf(filePath)];
369
+ const explicitRaw = explicitLanguageHint?.trim();
370
+ const explicit = explicitRaw ? canonicalLanguage(explicitRaw) : undefined;
371
+ const shebang = shebangFor(content);
372
+ const shebangLanguage = shebang?.language;
373
+ if (explicitRaw && explicit === undefined) {
374
+ return conflict(`The explicit language hint '${explicitRaw}' is not recognized.`);
375
+ }
376
+ if (explicit !== undefined) {
377
+ if (extension !== undefined &&
378
+ !isExtensionCompatibleWith(extension, explicit)) {
379
+ return conflict(`The explicit language '${explicit}' conflicts with the file extension classification.`, {
380
+ extensionLanguage: extension.language,
381
+ explicitLanguage: explicit,
382
+ ...(shebangLanguage === undefined ? {} : { shebangLanguage }),
383
+ });
384
+ }
385
+ if (shebang !== undefined) {
386
+ const shebangMatches = shebang.language === explicit ||
387
+ (shebang.family === "shell" && explicit === "shell");
388
+ if (!shebangMatches) {
389
+ return conflict(`The explicit language '${explicit}' conflicts with the snapshot shebang.`, {
390
+ ...(extension === undefined
391
+ ? {}
392
+ : { extensionLanguage: extension.language }),
393
+ ...(shebangLanguage === undefined ? {} : { shebangLanguage }),
394
+ explicitLanguage: explicit,
395
+ });
396
+ }
397
+ }
398
+ return classificationForLanguage(explicit, "explicit");
399
+ }
400
+ if (extension?.kind === "ambiguous") {
401
+ if (shebang === undefined) {
402
+ return {
403
+ kind: "ambiguous",
404
+ language: extension.language,
405
+ candidates: extension.candidates,
406
+ reason: `The '${extension.language === "c-or-cpp" ? ".h" : ".pl"}' extension does not select one language.`,
407
+ };
408
+ }
409
+ const resolvedLanguage = shebang.language;
410
+ if (resolvedLanguage !== undefined &&
411
+ extension.candidates.includes(resolvedLanguage)) {
412
+ return classificationForLanguage(resolvedLanguage, "shebang");
413
+ }
414
+ return conflict("The file extension is ambiguous and the shebang does not resolve it to a supported candidate.", {
415
+ extensionLanguage: extension.language,
416
+ ...(shebangLanguage === undefined ? {} : { shebangLanguage }),
417
+ });
418
+ }
419
+ const hasExtension = extensionOf(filePath) !== "";
420
+ if (extension !== undefined) {
421
+ if (shebang !== undefined) {
422
+ if (shebang.family === "shell") {
423
+ if (extension.language === "shell") {
424
+ return {
425
+ kind: "file-level",
426
+ language: "shell",
427
+ source: "shebang",
428
+ reason: `The ${shebang.name} shell dialect is retained as file-level source.`,
429
+ };
430
+ }
431
+ return conflict(`The ${shebang.name} shell shebang conflicts with the file extension language.`, {
432
+ extensionLanguage: extension.language,
433
+ shebangLanguage: "shell",
434
+ });
435
+ }
436
+ if (shebang.language !== undefined) {
437
+ if (!isExtensionCompatibleWith(extension, shebang.language)) {
438
+ return conflict(`The ${shebang.language} shebang conflicts with the file extension language.`, {
439
+ extensionLanguage: extension.language,
440
+ shebangLanguage: shebang.language,
441
+ });
442
+ }
443
+ return classificationForLanguage(shebang.language, "shebang");
444
+ }
445
+ return conflict(`The shebang interpreter '${shebang.name}' is not qualified for the file extension language.`, {
446
+ extensionLanguage: extension.language,
447
+ shebangLanguage: shebang.name,
448
+ });
449
+ }
450
+ if (extension.kind === "file-level") {
451
+ return {
452
+ kind: "file-level",
453
+ language: extension.language,
454
+ source: "extension",
455
+ reason: extension.reason,
456
+ };
457
+ }
458
+ return classificationForLanguage(extension.language, "extension");
459
+ }
460
+ if (hasExtension) {
461
+ return {
462
+ kind: "unknown",
463
+ language: "unknown",
464
+ reason: "The file extension is not present in the source language catalog.",
465
+ };
466
+ }
467
+ if (shebang === undefined) {
468
+ return {
469
+ kind: "unknown",
470
+ language: "unknown",
471
+ reason: "No recognized source extension or shebang is present.",
472
+ };
473
+ }
474
+ if (shebang.language !== undefined) {
475
+ return classificationForLanguage(shebang.language, "shebang");
476
+ }
477
+ if (shebang.family === "shell") {
478
+ return {
479
+ kind: "file-level",
480
+ language: "shell",
481
+ source: "shebang",
482
+ reason: `The ${shebang.name} shell dialect is retained as file-level source.`,
483
+ };
484
+ }
485
+ return {
486
+ kind: "unknown",
487
+ language: "unknown",
488
+ reason: `The '${shebang.name}' interpreter is not in the executable source catalog.`,
489
+ };
490
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/prolog/codec.ts"],"names":[],"mappings":"AAUA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAU5D;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GACrC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAO9B;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAClC,QAAQ,EAAE,CAAC,GACV,CAAC,GAAG,IAAI,CAEV;AAID,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EACtC,QAAQ,EAAE,MAAM,GACf,OAAO,CAoCT;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GACrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AAED,wBAAgB,sBAAsB,CAEpC,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGzB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqB3E;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoD3E;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CA6D5D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7E;AAuFD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtE;AAYD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAenD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmBlE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBzE;AAyCD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CA6DjE"}
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/prolog/codec.ts"],"names":[],"mappings":"AAUA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAU5D;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GACrC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAO9B;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAClC,QAAQ,EAAE,CAAC,GACV,CAAC,GAAG,IAAI,CAEV;AAID,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EACtC,QAAQ,EAAE,MAAM,GACf,OAAO,CAoCT;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GACrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AAED,wBAAgB,sBAAsB,CAEpC,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGzB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqB3E;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsD3E;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CA6D5D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7E;AAuFD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtE;AAYD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAenD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmBlE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBzE;AAyCD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CA6DjE"}
@@ -191,6 +191,8 @@ export function parsePropertyList(propsStr) {
191
191
  }
192
192
  let parsed = parsePrologValue(value);
193
193
  if ((key === "rule_ir" ||
194
+ key === "argument_constants" ||
195
+ key === "argument_aliases" ||
194
196
  key === "semantic_inventory" ||
195
197
  key === "proof_receipts" ||
196
198
  key === "proof_contract" ||