@opensip-cli/core 0.1.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 (604) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/config-resolution.test.d.ts +2 -0
  5. package/dist/__tests__/config-resolution.test.d.ts.map +1 -0
  6. package/dist/__tests__/config-resolution.test.js +94 -0
  7. package/dist/__tests__/config-resolution.test.js.map +1 -0
  8. package/dist/__tests__/public-api.test.d.ts +16 -0
  9. package/dist/__tests__/public-api.test.d.ts.map +1 -0
  10. package/dist/__tests__/public-api.test.js +209 -0
  11. package/dist/__tests__/public-api.test.js.map +1 -0
  12. package/dist/__tests__/signal-batch.test.d.ts +2 -0
  13. package/dist/__tests__/signal-batch.test.d.ts.map +1 -0
  14. package/dist/__tests__/signal-batch.test.js +39 -0
  15. package/dist/__tests__/signal-batch.test.js.map +1 -0
  16. package/dist/__tests__/signal-sink.test.d.ts +2 -0
  17. package/dist/__tests__/signal-sink.test.d.ts.map +1 -0
  18. package/dist/__tests__/signal-sink.test.js +25 -0
  19. package/dist/__tests__/signal-sink.test.js.map +1 -0
  20. package/dist/__tests__/strip-utils.test.d.ts +2 -0
  21. package/dist/__tests__/strip-utils.test.d.ts.map +1 -0
  22. package/dist/__tests__/strip-utils.test.js +397 -0
  23. package/dist/__tests__/strip-utils.test.js.map +1 -0
  24. package/dist/__tests__/text-tree.test.d.ts +2 -0
  25. package/dist/__tests__/text-tree.test.d.ts.map +1 -0
  26. package/dist/__tests__/text-tree.test.js +31 -0
  27. package/dist/__tests__/text-tree.test.js.map +1 -0
  28. package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts +2 -0
  29. package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts.map +1 -0
  30. package/dist/baseline/__tests__/fingerprint-strategy.test.js +69 -0
  31. package/dist/baseline/__tests__/fingerprint-strategy.test.js.map +1 -0
  32. package/dist/baseline/fingerprint-strategy.d.ts +70 -0
  33. package/dist/baseline/fingerprint-strategy.d.ts.map +1 -0
  34. package/dist/baseline/fingerprint-strategy.js +90 -0
  35. package/dist/baseline/fingerprint-strategy.js.map +1 -0
  36. package/dist/config-resolution.d.ts +27 -0
  37. package/dist/config-resolution.d.ts.map +1 -0
  38. package/dist/config-resolution.js +92 -0
  39. package/dist/config-resolution.js.map +1 -0
  40. package/dist/index.d.ts +81 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +165 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/languages/__tests__/content-filter-dispatch.test.d.ts +2 -0
  45. package/dist/languages/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
  46. package/dist/languages/__tests__/content-filter-dispatch.test.js +87 -0
  47. package/dist/languages/__tests__/content-filter-dispatch.test.js.map +1 -0
  48. package/dist/languages/__tests__/non-code-formats.test.d.ts +2 -0
  49. package/dist/languages/__tests__/non-code-formats.test.d.ts.map +1 -0
  50. package/dist/languages/__tests__/non-code-formats.test.js +31 -0
  51. package/dist/languages/__tests__/non-code-formats.test.js.map +1 -0
  52. package/dist/languages/__tests__/parse-cache.test.d.ts +2 -0
  53. package/dist/languages/__tests__/parse-cache.test.d.ts.map +1 -0
  54. package/dist/languages/__tests__/parse-cache.test.js +228 -0
  55. package/dist/languages/__tests__/parse-cache.test.js.map +1 -0
  56. package/dist/languages/__tests__/registry.test.d.ts +2 -0
  57. package/dist/languages/__tests__/registry.test.d.ts.map +1 -0
  58. package/dist/languages/__tests__/registry.test.js +193 -0
  59. package/dist/languages/__tests__/registry.test.js.map +1 -0
  60. package/dist/languages/__tests__/workspace-unit-contract.test.d.ts +2 -0
  61. package/dist/languages/__tests__/workspace-unit-contract.test.d.ts.map +1 -0
  62. package/dist/languages/__tests__/workspace-unit-contract.test.js +66 -0
  63. package/dist/languages/__tests__/workspace-unit-contract.test.js.map +1 -0
  64. package/dist/languages/adapter.d.ts +66 -0
  65. package/dist/languages/adapter.d.ts.map +1 -0
  66. package/dist/languages/adapter.js +2 -0
  67. package/dist/languages/adapter.js.map +1 -0
  68. package/dist/languages/content-filter-dispatch.d.ts +36 -0
  69. package/dist/languages/content-filter-dispatch.d.ts.map +1 -0
  70. package/dist/languages/content-filter-dispatch.js +75 -0
  71. package/dist/languages/content-filter-dispatch.js.map +1 -0
  72. package/dist/languages/generic-types.d.ts +22 -0
  73. package/dist/languages/generic-types.d.ts.map +1 -0
  74. package/dist/languages/generic-types.js +3 -0
  75. package/dist/languages/generic-types.js.map +1 -0
  76. package/dist/languages/index.d.ts +12 -0
  77. package/dist/languages/index.d.ts.map +1 -0
  78. package/dist/languages/index.js +7 -0
  79. package/dist/languages/index.js.map +1 -0
  80. package/dist/languages/non-code-formats.d.ts +37 -0
  81. package/dist/languages/non-code-formats.d.ts.map +1 -0
  82. package/dist/languages/non-code-formats.js +45 -0
  83. package/dist/languages/non-code-formats.js.map +1 -0
  84. package/dist/languages/parse-cache-class.d.ts +69 -0
  85. package/dist/languages/parse-cache-class.d.ts.map +1 -0
  86. package/dist/languages/parse-cache-class.js +135 -0
  87. package/dist/languages/parse-cache-class.js.map +1 -0
  88. package/dist/languages/parse-cache.d.ts +54 -0
  89. package/dist/languages/parse-cache.d.ts.map +1 -0
  90. package/dist/languages/parse-cache.js +88 -0
  91. package/dist/languages/parse-cache.js.map +1 -0
  92. package/dist/languages/registry.d.ts +35 -0
  93. package/dist/languages/registry.d.ts.map +1 -0
  94. package/dist/languages/registry.js +123 -0
  95. package/dist/languages/registry.js.map +1 -0
  96. package/dist/languages/strip-scanners.d.ts +170 -0
  97. package/dist/languages/strip-scanners.d.ts.map +1 -0
  98. package/dist/languages/strip-scanners.js +233 -0
  99. package/dist/languages/strip-scanners.js.map +1 -0
  100. package/dist/languages/strip-utils.d.ts +66 -0
  101. package/dist/languages/strip-utils.d.ts.map +1 -0
  102. package/dist/languages/strip-utils.js +88 -0
  103. package/dist/languages/strip-utils.js.map +1 -0
  104. package/dist/languages/text-tree.d.ts +44 -0
  105. package/dist/languages/text-tree.d.ts.map +1 -0
  106. package/dist/languages/text-tree.js +34 -0
  107. package/dist/languages/text-tree.js.map +1 -0
  108. package/dist/languages/workspace-unit.d.ts +18 -0
  109. package/dist/languages/workspace-unit.d.ts.map +1 -0
  110. package/dist/languages/workspace-unit.js +2 -0
  111. package/dist/languages/workspace-unit.js.map +1 -0
  112. package/dist/lib/__tests__/config-version.test.d.ts +12 -0
  113. package/dist/lib/__tests__/config-version.test.d.ts.map +1 -0
  114. package/dist/lib/__tests__/config-version.test.js +92 -0
  115. package/dist/lib/__tests__/config-version.test.js.map +1 -0
  116. package/dist/lib/__tests__/diagnostics-bus.test.d.ts +7 -0
  117. package/dist/lib/__tests__/diagnostics-bus.test.d.ts.map +1 -0
  118. package/dist/lib/__tests__/diagnostics-bus.test.js +44 -0
  119. package/dist/lib/__tests__/diagnostics-bus.test.js.map +1 -0
  120. package/dist/lib/__tests__/env-registry.test.d.ts +7 -0
  121. package/dist/lib/__tests__/env-registry.test.d.ts.map +1 -0
  122. package/dist/lib/__tests__/env-registry.test.js +82 -0
  123. package/dist/lib/__tests__/env-registry.test.js.map +1 -0
  124. package/dist/lib/__tests__/errors.test.d.ts +2 -0
  125. package/dist/lib/__tests__/errors.test.d.ts.map +1 -0
  126. package/dist/lib/__tests__/errors.test.js +218 -0
  127. package/dist/lib/__tests__/errors.test.js.map +1 -0
  128. package/dist/lib/__tests__/format.test.d.ts +2 -0
  129. package/dist/lib/__tests__/format.test.d.ts.map +1 -0
  130. package/dist/lib/__tests__/format.test.js +23 -0
  131. package/dist/lib/__tests__/format.test.js.map +1 -0
  132. package/dist/lib/__tests__/ids.test.d.ts +2 -0
  133. package/dist/lib/__tests__/ids.test.d.ts.map +1 -0
  134. package/dist/lib/__tests__/ids.test.js +80 -0
  135. package/dist/lib/__tests__/ids.test.js.map +1 -0
  136. package/dist/lib/__tests__/logger.test.d.ts +2 -0
  137. package/dist/lib/__tests__/logger.test.d.ts.map +1 -0
  138. package/dist/lib/__tests__/logger.test.js +284 -0
  139. package/dist/lib/__tests__/logger.test.js.map +1 -0
  140. package/dist/lib/__tests__/package-version.test.d.ts +2 -0
  141. package/dist/lib/__tests__/package-version.test.d.ts.map +1 -0
  142. package/dist/lib/__tests__/package-version.test.js +47 -0
  143. package/dist/lib/__tests__/package-version.test.js.map +1 -0
  144. package/dist/lib/__tests__/paths.test.d.ts +5 -0
  145. package/dist/lib/__tests__/paths.test.d.ts.map +1 -0
  146. package/dist/lib/__tests__/paths.test.js +59 -0
  147. package/dist/lib/__tests__/paths.test.js.map +1 -0
  148. package/dist/lib/__tests__/payload-version.test.d.ts +2 -0
  149. package/dist/lib/__tests__/payload-version.test.d.ts.map +1 -0
  150. package/dist/lib/__tests__/payload-version.test.js +35 -0
  151. package/dist/lib/__tests__/payload-version.test.js.map +1 -0
  152. package/dist/lib/__tests__/phantom-detect.test.d.ts +10 -0
  153. package/dist/lib/__tests__/phantom-detect.test.d.ts.map +1 -0
  154. package/dist/lib/__tests__/phantom-detect.test.js +84 -0
  155. package/dist/lib/__tests__/phantom-detect.test.js.map +1 -0
  156. package/dist/lib/__tests__/project-context.test.d.ts +10 -0
  157. package/dist/lib/__tests__/project-context.test.d.ts.map +1 -0
  158. package/dist/lib/__tests__/project-context.test.js +240 -0
  159. package/dist/lib/__tests__/project-context.test.js.map +1 -0
  160. package/dist/lib/__tests__/registry.test.d.ts +2 -0
  161. package/dist/lib/__tests__/registry.test.d.ts.map +1 -0
  162. package/dist/lib/__tests__/registry.test.js +333 -0
  163. package/dist/lib/__tests__/registry.test.js.map +1 -0
  164. package/dist/lib/__tests__/retry.test.d.ts +2 -0
  165. package/dist/lib/__tests__/retry.test.d.ts.map +1 -0
  166. package/dist/lib/__tests__/retry.test.js +71 -0
  167. package/dist/lib/__tests__/retry.test.js.map +1 -0
  168. package/dist/lib/__tests__/run-diagnostics.test.d.ts +9 -0
  169. package/dist/lib/__tests__/run-diagnostics.test.d.ts.map +1 -0
  170. package/dist/lib/__tests__/run-diagnostics.test.js +61 -0
  171. package/dist/lib/__tests__/run-diagnostics.test.js.map +1 -0
  172. package/dist/lib/__tests__/run-scope.test.d.ts +2 -0
  173. package/dist/lib/__tests__/run-scope.test.d.ts.map +1 -0
  174. package/dist/lib/__tests__/run-scope.test.js +202 -0
  175. package/dist/lib/__tests__/run-scope.test.js.map +1 -0
  176. package/dist/lib/__tests__/run-timer.test.d.ts +2 -0
  177. package/dist/lib/__tests__/run-timer.test.d.ts.map +1 -0
  178. package/dist/lib/__tests__/run-timer.test.js +152 -0
  179. package/dist/lib/__tests__/run-timer.test.js.map +1 -0
  180. package/dist/lib/__tests__/severity-policy.test.d.ts +6 -0
  181. package/dist/lib/__tests__/severity-policy.test.d.ts.map +1 -0
  182. package/dist/lib/__tests__/severity-policy.test.js +47 -0
  183. package/dist/lib/__tests__/severity-policy.test.js.map +1 -0
  184. package/dist/lib/__tests__/telemetry.test.d.ts +2 -0
  185. package/dist/lib/__tests__/telemetry.test.d.ts.map +1 -0
  186. package/dist/lib/__tests__/telemetry.test.js +212 -0
  187. package/dist/lib/__tests__/telemetry.test.js.map +1 -0
  188. package/dist/lib/__tests__/verdict-policy.test.d.ts +7 -0
  189. package/dist/lib/__tests__/verdict-policy.test.d.ts.map +1 -0
  190. package/dist/lib/__tests__/verdict-policy.test.js +91 -0
  191. package/dist/lib/__tests__/verdict-policy.test.js.map +1 -0
  192. package/dist/lib/__tests__/yaml.test.d.ts +6 -0
  193. package/dist/lib/__tests__/yaml.test.d.ts.map +1 -0
  194. package/dist/lib/__tests__/yaml.test.js +79 -0
  195. package/dist/lib/__tests__/yaml.test.js.map +1 -0
  196. package/dist/lib/config-version.d.ts +49 -0
  197. package/dist/lib/config-version.d.ts.map +1 -0
  198. package/dist/lib/config-version.js +56 -0
  199. package/dist/lib/config-version.js.map +1 -0
  200. package/dist/lib/diagnostics-bus.d.ts +48 -0
  201. package/dist/lib/diagnostics-bus.d.ts.map +1 -0
  202. package/dist/lib/diagnostics-bus.js +74 -0
  203. package/dist/lib/diagnostics-bus.js.map +1 -0
  204. package/dist/lib/env-registry.d.ts +108 -0
  205. package/dist/lib/env-registry.d.ts.map +1 -0
  206. package/dist/lib/env-registry.js +92 -0
  207. package/dist/lib/env-registry.js.map +1 -0
  208. package/dist/lib/errors.d.ts +132 -0
  209. package/dist/lib/errors.d.ts.map +1 -0
  210. package/dist/lib/errors.js +160 -0
  211. package/dist/lib/errors.js.map +1 -0
  212. package/dist/lib/execution/__tests__/execution.test.d.ts +7 -0
  213. package/dist/lib/execution/__tests__/execution.test.d.ts.map +1 -0
  214. package/dist/lib/execution/__tests__/execution.test.js +254 -0
  215. package/dist/lib/execution/__tests__/execution.test.js.map +1 -0
  216. package/dist/lib/execution/index.d.ts +15 -0
  217. package/dist/lib/execution/index.d.ts.map +1 -0
  218. package/dist/lib/execution/index.js +10 -0
  219. package/dist/lib/execution/index.js.map +1 -0
  220. package/dist/lib/execution/options.d.ts +32 -0
  221. package/dist/lib/execution/options.d.ts.map +1 -0
  222. package/dist/lib/execution/options.js +15 -0
  223. package/dist/lib/execution/options.js.map +1 -0
  224. package/dist/lib/execution/pipeline.d.ts +36 -0
  225. package/dist/lib/execution/pipeline.d.ts.map +1 -0
  226. package/dist/lib/execution/pipeline.js +38 -0
  227. package/dist/lib/execution/pipeline.js.map +1 -0
  228. package/dist/lib/execution/retry.d.ts +38 -0
  229. package/dist/lib/execution/retry.d.ts.map +1 -0
  230. package/dist/lib/execution/retry.js +56 -0
  231. package/dist/lib/execution/retry.js.map +1 -0
  232. package/dist/lib/execution/run-with-timeout.d.ts +46 -0
  233. package/dist/lib/execution/run-with-timeout.d.ts.map +1 -0
  234. package/dist/lib/execution/run-with-timeout.js +86 -0
  235. package/dist/lib/execution/run-with-timeout.js.map +1 -0
  236. package/dist/lib/execution/schedule.d.ts +62 -0
  237. package/dist/lib/execution/schedule.d.ts.map +1 -0
  238. package/dist/lib/execution/schedule.js +130 -0
  239. package/dist/lib/execution/schedule.js.map +1 -0
  240. package/dist/lib/format.d.ts +17 -0
  241. package/dist/lib/format.d.ts.map +1 -0
  242. package/dist/lib/format.js +26 -0
  243. package/dist/lib/format.js.map +1 -0
  244. package/dist/lib/ids.d.ts +13 -0
  245. package/dist/lib/ids.d.ts.map +1 -0
  246. package/dist/lib/ids.js +48 -0
  247. package/dist/lib/ids.js.map +1 -0
  248. package/dist/lib/logger.d.ts +166 -0
  249. package/dist/lib/logger.d.ts.map +1 -0
  250. package/dist/lib/logger.js +283 -0
  251. package/dist/lib/logger.js.map +1 -0
  252. package/dist/lib/package-version.d.ts +17 -0
  253. package/dist/lib/package-version.d.ts.map +1 -0
  254. package/dist/lib/package-version.js +52 -0
  255. package/dist/lib/package-version.js.map +1 -0
  256. package/dist/lib/paths.d.ts +139 -0
  257. package/dist/lib/paths.d.ts.map +1 -0
  258. package/dist/lib/paths.js +105 -0
  259. package/dist/lib/paths.js.map +1 -0
  260. package/dist/lib/payload-version.d.ts +15 -0
  261. package/dist/lib/payload-version.d.ts.map +1 -0
  262. package/dist/lib/payload-version.js +24 -0
  263. package/dist/lib/payload-version.js.map +1 -0
  264. package/dist/lib/phantom-detect.d.ts +21 -0
  265. package/dist/lib/phantom-detect.d.ts.map +1 -0
  266. package/dist/lib/phantom-detect.js +76 -0
  267. package/dist/lib/phantom-detect.js.map +1 -0
  268. package/dist/lib/project-context.d.ts +66 -0
  269. package/dist/lib/project-context.d.ts.map +1 -0
  270. package/dist/lib/project-context.js +112 -0
  271. package/dist/lib/project-context.js.map +1 -0
  272. package/dist/lib/recipe-id.d.ts +13 -0
  273. package/dist/lib/recipe-id.d.ts.map +1 -0
  274. package/dist/lib/recipe-id.js +15 -0
  275. package/dist/lib/recipe-id.js.map +1 -0
  276. package/dist/lib/registry.d.ts +98 -0
  277. package/dist/lib/registry.d.ts.map +1 -0
  278. package/dist/lib/registry.js +152 -0
  279. package/dist/lib/registry.js.map +1 -0
  280. package/dist/lib/retry.d.ts +26 -0
  281. package/dist/lib/retry.d.ts.map +1 -0
  282. package/dist/lib/retry.js +48 -0
  283. package/dist/lib/retry.js.map +1 -0
  284. package/dist/lib/run-diagnostics.d.ts +64 -0
  285. package/dist/lib/run-diagnostics.d.ts.map +1 -0
  286. package/dist/lib/run-diagnostics.js +25 -0
  287. package/dist/lib/run-diagnostics.js.map +1 -0
  288. package/dist/lib/run-scope.d.ts +167 -0
  289. package/dist/lib/run-scope.d.ts.map +1 -0
  290. package/dist/lib/run-scope.js +176 -0
  291. package/dist/lib/run-scope.js.map +1 -0
  292. package/dist/lib/run-timer.d.ts +82 -0
  293. package/dist/lib/run-timer.d.ts.map +1 -0
  294. package/dist/lib/run-timer.js +79 -0
  295. package/dist/lib/run-timer.js.map +1 -0
  296. package/dist/lib/scope-types.d.ts +172 -0
  297. package/dist/lib/scope-types.d.ts.map +1 -0
  298. package/dist/lib/scope-types.js +27 -0
  299. package/dist/lib/scope-types.js.map +1 -0
  300. package/dist/lib/severity-policy.d.ts +38 -0
  301. package/dist/lib/severity-policy.d.ts.map +1 -0
  302. package/dist/lib/severity-policy.js +44 -0
  303. package/dist/lib/severity-policy.js.map +1 -0
  304. package/dist/lib/telemetry.d.ts +93 -0
  305. package/dist/lib/telemetry.d.ts.map +1 -0
  306. package/dist/lib/telemetry.js +144 -0
  307. package/dist/lib/telemetry.js.map +1 -0
  308. package/dist/lib/ui-context.d.ts +34 -0
  309. package/dist/lib/ui-context.d.ts.map +1 -0
  310. package/dist/lib/ui-context.js +16 -0
  311. package/dist/lib/ui-context.js.map +1 -0
  312. package/dist/lib/verdict-policy.d.ts +71 -0
  313. package/dist/lib/verdict-policy.d.ts.map +1 -0
  314. package/dist/lib/verdict-policy.js +82 -0
  315. package/dist/lib/verdict-policy.js.map +1 -0
  316. package/dist/lib/yaml.d.ts +74 -0
  317. package/dist/lib/yaml.d.ts.map +1 -0
  318. package/dist/lib/yaml.js +118 -0
  319. package/dist/lib/yaml.js.map +1 -0
  320. package/dist/plugins/__tests__/as-if-external.test.d.ts +18 -0
  321. package/dist/plugins/__tests__/as-if-external.test.d.ts.map +1 -0
  322. package/dist/plugins/__tests__/as-if-external.test.js +159 -0
  323. package/dist/plugins/__tests__/as-if-external.test.js.map +1 -0
  324. package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts +8 -0
  325. package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts.map +1 -0
  326. package/dist/plugins/__tests__/authored-tool-discovery.test.js +97 -0
  327. package/dist/plugins/__tests__/authored-tool-discovery.test.js.map +1 -0
  328. package/dist/plugins/__tests__/capability-discovery.test.d.ts +2 -0
  329. package/dist/plugins/__tests__/capability-discovery.test.d.ts.map +1 -0
  330. package/dist/plugins/__tests__/capability-discovery.test.js +349 -0
  331. package/dist/plugins/__tests__/capability-discovery.test.js.map +1 -0
  332. package/dist/plugins/__tests__/capability-from-manifest.test.d.ts +2 -0
  333. package/dist/plugins/__tests__/capability-from-manifest.test.d.ts.map +1 -0
  334. package/dist/plugins/__tests__/capability-from-manifest.test.js +172 -0
  335. package/dist/plugins/__tests__/capability-from-manifest.test.js.map +1 -0
  336. package/dist/plugins/__tests__/capability-loader.test.d.ts +2 -0
  337. package/dist/plugins/__tests__/capability-loader.test.d.ts.map +1 -0
  338. package/dist/plugins/__tests__/capability-loader.test.js +122 -0
  339. package/dist/plugins/__tests__/capability-loader.test.js.map +1 -0
  340. package/dist/plugins/__tests__/capability-registry.test.d.ts +2 -0
  341. package/dist/plugins/__tests__/capability-registry.test.d.ts.map +1 -0
  342. package/dist/plugins/__tests__/capability-registry.test.js +185 -0
  343. package/dist/plugins/__tests__/capability-registry.test.js.map +1 -0
  344. package/dist/plugins/__tests__/discover.test.d.ts +2 -0
  345. package/dist/plugins/__tests__/discover.test.d.ts.map +1 -0
  346. package/dist/plugins/__tests__/discover.test.js +311 -0
  347. package/dist/plugins/__tests__/discover.test.js.map +1 -0
  348. package/dist/plugins/__tests__/loader.test.d.ts +2 -0
  349. package/dist/plugins/__tests__/loader.test.d.ts.map +1 -0
  350. package/dist/plugins/__tests__/loader.test.js +191 -0
  351. package/dist/plugins/__tests__/loader.test.js.map +1 -0
  352. package/dist/plugins/__tests__/manifest-discovery.test.d.ts +2 -0
  353. package/dist/plugins/__tests__/manifest-discovery.test.d.ts.map +1 -0
  354. package/dist/plugins/__tests__/manifest-discovery.test.js +132 -0
  355. package/dist/plugins/__tests__/manifest-discovery.test.js.map +1 -0
  356. package/dist/plugins/__tests__/manifest-loader.test.d.ts +2 -0
  357. package/dist/plugins/__tests__/manifest-loader.test.d.ts.map +1 -0
  358. package/dist/plugins/__tests__/manifest-loader.test.js +434 -0
  359. package/dist/plugins/__tests__/manifest-loader.test.js.map +1 -0
  360. package/dist/plugins/__tests__/marker-discovery.test.d.ts +2 -0
  361. package/dist/plugins/__tests__/marker-discovery.test.d.ts.map +1 -0
  362. package/dist/plugins/__tests__/marker-discovery.test.js +164 -0
  363. package/dist/plugins/__tests__/marker-discovery.test.js.map +1 -0
  364. package/dist/plugins/__tests__/node-modules-walk.test.d.ts +2 -0
  365. package/dist/plugins/__tests__/node-modules-walk.test.d.ts.map +1 -0
  366. package/dist/plugins/__tests__/node-modules-walk.test.js +76 -0
  367. package/dist/plugins/__tests__/node-modules-walk.test.js.map +1 -0
  368. package/dist/plugins/__tests__/package-entry.test.d.ts +9 -0
  369. package/dist/plugins/__tests__/package-entry.test.d.ts.map +1 -0
  370. package/dist/plugins/__tests__/package-entry.test.js +117 -0
  371. package/dist/plugins/__tests__/package-entry.test.js.map +1 -0
  372. package/dist/plugins/__tests__/recipe-loader.test.d.ts +2 -0
  373. package/dist/plugins/__tests__/recipe-loader.test.d.ts.map +1 -0
  374. package/dist/plugins/__tests__/recipe-loader.test.js +130 -0
  375. package/dist/plugins/__tests__/recipe-loader.test.js.map +1 -0
  376. package/dist/plugins/__tests__/scope-validation.test.d.ts +2 -0
  377. package/dist/plugins/__tests__/scope-validation.test.d.ts.map +1 -0
  378. package/dist/plugins/__tests__/scope-validation.test.js +68 -0
  379. package/dist/plugins/__tests__/scope-validation.test.js.map +1 -0
  380. package/dist/plugins/__tests__/single-core-guard.test.d.ts +10 -0
  381. package/dist/plugins/__tests__/single-core-guard.test.d.ts.map +1 -0
  382. package/dist/plugins/__tests__/single-core-guard.test.js +89 -0
  383. package/dist/plugins/__tests__/single-core-guard.test.js.map +1 -0
  384. package/dist/plugins/__tests__/tool-package-discovery.test.d.ts +2 -0
  385. package/dist/plugins/__tests__/tool-package-discovery.test.d.ts.map +1 -0
  386. package/dist/plugins/__tests__/tool-package-discovery.test.js +215 -0
  387. package/dist/plugins/__tests__/tool-package-discovery.test.js.map +1 -0
  388. package/dist/plugins/authored-tool-discovery.d.ts +45 -0
  389. package/dist/plugins/authored-tool-discovery.d.ts.map +1 -0
  390. package/dist/plugins/authored-tool-discovery.js +61 -0
  391. package/dist/plugins/authored-tool-discovery.js.map +1 -0
  392. package/dist/plugins/capability-discovery.d.ts +80 -0
  393. package/dist/plugins/capability-discovery.d.ts.map +1 -0
  394. package/dist/plugins/capability-discovery.js +278 -0
  395. package/dist/plugins/capability-discovery.js.map +1 -0
  396. package/dist/plugins/capability-loader.d.ts +50 -0
  397. package/dist/plugins/capability-loader.d.ts.map +1 -0
  398. package/dist/plugins/capability-loader.js +85 -0
  399. package/dist/plugins/capability-loader.js.map +1 -0
  400. package/dist/plugins/capability-registry.d.ts +169 -0
  401. package/dist/plugins/capability-registry.d.ts.map +1 -0
  402. package/dist/plugins/capability-registry.js +319 -0
  403. package/dist/plugins/capability-registry.js.map +1 -0
  404. package/dist/plugins/discover.d.ts +64 -0
  405. package/dist/plugins/discover.d.ts.map +1 -0
  406. package/dist/plugins/discover.js +303 -0
  407. package/dist/plugins/discover.js.map +1 -0
  408. package/dist/plugins/index.d.ts +37 -0
  409. package/dist/plugins/index.d.ts.map +1 -0
  410. package/dist/plugins/index.js +40 -0
  411. package/dist/plugins/index.js.map +1 -0
  412. package/dist/plugins/json-guards.d.ts +11 -0
  413. package/dist/plugins/json-guards.d.ts.map +1 -0
  414. package/dist/plugins/json-guards.js +15 -0
  415. package/dist/plugins/json-guards.js.map +1 -0
  416. package/dist/plugins/loader.d.ts +67 -0
  417. package/dist/plugins/loader.d.ts.map +1 -0
  418. package/dist/plugins/loader.js +137 -0
  419. package/dist/plugins/loader.js.map +1 -0
  420. package/dist/plugins/manifest-discovery.d.ts +28 -0
  421. package/dist/plugins/manifest-discovery.d.ts.map +1 -0
  422. package/dist/plugins/manifest-discovery.js +103 -0
  423. package/dist/plugins/manifest-discovery.js.map +1 -0
  424. package/dist/plugins/manifest-loader.d.ts +120 -0
  425. package/dist/plugins/manifest-loader.d.ts.map +1 -0
  426. package/dist/plugins/manifest-loader.js +410 -0
  427. package/dist/plugins/manifest-loader.js.map +1 -0
  428. package/dist/plugins/marker-discovery.d.ts +115 -0
  429. package/dist/plugins/marker-discovery.d.ts.map +1 -0
  430. package/dist/plugins/marker-discovery.js +172 -0
  431. package/dist/plugins/marker-discovery.js.map +1 -0
  432. package/dist/plugins/node-modules-walk.d.ts +61 -0
  433. package/dist/plugins/node-modules-walk.d.ts.map +1 -0
  434. package/dist/plugins/node-modules-walk.js +99 -0
  435. package/dist/plugins/node-modules-walk.js.map +1 -0
  436. package/dist/plugins/package-entry.d.ts +38 -0
  437. package/dist/plugins/package-entry.d.ts.map +1 -0
  438. package/dist/plugins/package-entry.js +86 -0
  439. package/dist/plugins/package-entry.js.map +1 -0
  440. package/dist/plugins/recipe-loader.d.ts +63 -0
  441. package/dist/plugins/recipe-loader.d.ts.map +1 -0
  442. package/dist/plugins/recipe-loader.js +67 -0
  443. package/dist/plugins/recipe-loader.js.map +1 -0
  444. package/dist/plugins/scope-validation.d.ts +35 -0
  445. package/dist/plugins/scope-validation.d.ts.map +1 -0
  446. package/dist/plugins/scope-validation.js +55 -0
  447. package/dist/plugins/scope-validation.js.map +1 -0
  448. package/dist/plugins/single-core-guard.d.ts +28 -0
  449. package/dist/plugins/single-core-guard.d.ts.map +1 -0
  450. package/dist/plugins/single-core-guard.js +69 -0
  451. package/dist/plugins/single-core-guard.js.map +1 -0
  452. package/dist/plugins/tool-package-discovery.d.ts +93 -0
  453. package/dist/plugins/tool-package-discovery.d.ts.map +1 -0
  454. package/dist/plugins/tool-package-discovery.js +118 -0
  455. package/dist/plugins/tool-package-discovery.js.map +1 -0
  456. package/dist/plugins/types.d.ts +78 -0
  457. package/dist/plugins/types.d.ts.map +1 -0
  458. package/dist/plugins/types.js +15 -0
  459. package/dist/plugins/types.js.map +1 -0
  460. package/dist/recipes/__tests__/registry.test.d.ts +2 -0
  461. package/dist/recipes/__tests__/registry.test.d.ts.map +1 -0
  462. package/dist/recipes/__tests__/registry.test.js +170 -0
  463. package/dist/recipes/__tests__/registry.test.js.map +1 -0
  464. package/dist/recipes/__tests__/selector.test.d.ts +20 -0
  465. package/dist/recipes/__tests__/selector.test.d.ts.map +1 -0
  466. package/dist/recipes/__tests__/selector.test.js +173 -0
  467. package/dist/recipes/__tests__/selector.test.js.map +1 -0
  468. package/dist/recipes/__tests__/unit-config.test.d.ts +7 -0
  469. package/dist/recipes/__tests__/unit-config.test.d.ts.map +1 -0
  470. package/dist/recipes/__tests__/unit-config.test.js +52 -0
  471. package/dist/recipes/__tests__/unit-config.test.js.map +1 -0
  472. package/dist/recipes/registry.d.ts +105 -0
  473. package/dist/recipes/registry.d.ts.map +1 -0
  474. package/dist/recipes/registry.js +141 -0
  475. package/dist/recipes/registry.js.map +1 -0
  476. package/dist/recipes/selector.d.ts +112 -0
  477. package/dist/recipes/selector.d.ts.map +1 -0
  478. package/dist/recipes/selector.js +134 -0
  479. package/dist/recipes/selector.js.map +1 -0
  480. package/dist/recipes/unit-config.d.ts +63 -0
  481. package/dist/recipes/unit-config.d.ts.map +1 -0
  482. package/dist/recipes/unit-config.js +68 -0
  483. package/dist/recipes/unit-config.js.map +1 -0
  484. package/dist/runtime/__tests__/in-process-transport.test.d.ts +6 -0
  485. package/dist/runtime/__tests__/in-process-transport.test.d.ts.map +1 -0
  486. package/dist/runtime/__tests__/in-process-transport.test.js +73 -0
  487. package/dist/runtime/__tests__/in-process-transport.test.js.map +1 -0
  488. package/dist/runtime/__tests__/subprocess-transport.test.d.ts +11 -0
  489. package/dist/runtime/__tests__/subprocess-transport.test.d.ts.map +1 -0
  490. package/dist/runtime/__tests__/subprocess-transport.test.js +118 -0
  491. package/dist/runtime/__tests__/subprocess-transport.test.js.map +1 -0
  492. package/dist/runtime/in-process-transport.d.ts +20 -0
  493. package/dist/runtime/in-process-transport.d.ts.map +1 -0
  494. package/dist/runtime/in-process-transport.js +49 -0
  495. package/dist/runtime/in-process-transport.js.map +1 -0
  496. package/dist/runtime/progress-transport.d.ts +73 -0
  497. package/dist/runtime/progress-transport.d.ts.map +1 -0
  498. package/dist/runtime/progress-transport.js +17 -0
  499. package/dist/runtime/progress-transport.js.map +1 -0
  500. package/dist/runtime/subprocess-transport.d.ts +43 -0
  501. package/dist/runtime/subprocess-transport.d.ts.map +1 -0
  502. package/dist/runtime/subprocess-transport.js +134 -0
  503. package/dist/runtime/subprocess-transport.js.map +1 -0
  504. package/dist/signals/comment-openers.d.ts +29 -0
  505. package/dist/signals/comment-openers.d.ts.map +1 -0
  506. package/dist/signals/comment-openers.js +41 -0
  507. package/dist/signals/comment-openers.js.map +1 -0
  508. package/dist/signals/comment-openers.test.d.ts +7 -0
  509. package/dist/signals/comment-openers.test.d.ts.map +1 -0
  510. package/dist/signals/comment-openers.test.js +41 -0
  511. package/dist/signals/comment-openers.test.js.map +1 -0
  512. package/dist/signals/create-signal-from-violation.d.ts +29 -0
  513. package/dist/signals/create-signal-from-violation.d.ts.map +1 -0
  514. package/dist/signals/create-signal-from-violation.js +29 -0
  515. package/dist/signals/create-signal-from-violation.js.map +1 -0
  516. package/dist/signals/signal-sink.d.ts +49 -0
  517. package/dist/signals/signal-sink.d.ts.map +1 -0
  518. package/dist/signals/signal-sink.js +6 -0
  519. package/dist/signals/signal-sink.js.map +1 -0
  520. package/dist/signals/suppress.d.ts +102 -0
  521. package/dist/signals/suppress.d.ts.map +1 -0
  522. package/dist/signals/suppress.js +325 -0
  523. package/dist/signals/suppress.js.map +1 -0
  524. package/dist/signals/suppress.test.d.ts +2 -0
  525. package/dist/signals/suppress.test.d.ts.map +1 -0
  526. package/dist/signals/suppress.test.js +213 -0
  527. package/dist/signals/suppress.test.js.map +1 -0
  528. package/dist/tools/__tests__/command-spec.test.d.ts +2 -0
  529. package/dist/tools/__tests__/command-spec.test.d.ts.map +1 -0
  530. package/dist/tools/__tests__/command-spec.test.js +191 -0
  531. package/dist/tools/__tests__/command-spec.test.js.map +1 -0
  532. package/dist/tools/__tests__/compatibility.test.d.ts +5 -0
  533. package/dist/tools/__tests__/compatibility.test.d.ts.map +1 -0
  534. package/dist/tools/__tests__/compatibility.test.js +41 -0
  535. package/dist/tools/__tests__/compatibility.test.js.map +1 -0
  536. package/dist/tools/__tests__/ids.test.d.ts +5 -0
  537. package/dist/tools/__tests__/ids.test.d.ts.map +1 -0
  538. package/dist/tools/__tests__/ids.test.js +56 -0
  539. package/dist/tools/__tests__/ids.test.js.map +1 -0
  540. package/dist/tools/__tests__/manifest-assert.test.d.ts +5 -0
  541. package/dist/tools/__tests__/manifest-assert.test.d.ts.map +1 -0
  542. package/dist/tools/__tests__/manifest-assert.test.js +66 -0
  543. package/dist/tools/__tests__/manifest-assert.test.js.map +1 -0
  544. package/dist/tools/__tests__/registry.test.d.ts +2 -0
  545. package/dist/tools/__tests__/registry.test.d.ts.map +1 -0
  546. package/dist/tools/__tests__/registry.test.js +93 -0
  547. package/dist/tools/__tests__/registry.test.js.map +1 -0
  548. package/dist/tools/__tests__/types.test.d.ts +2 -0
  549. package/dist/tools/__tests__/types.test.d.ts.map +1 -0
  550. package/dist/tools/__tests__/types.test.js +51 -0
  551. package/dist/tools/__tests__/types.test.js.map +1 -0
  552. package/dist/tools/capability.d.ts +257 -0
  553. package/dist/tools/capability.d.ts.map +1 -0
  554. package/dist/tools/capability.js +46 -0
  555. package/dist/tools/capability.js.map +1 -0
  556. package/dist/tools/command-spec.d.ts +211 -0
  557. package/dist/tools/command-spec.d.ts.map +1 -0
  558. package/dist/tools/command-spec.js +110 -0
  559. package/dist/tools/command-spec.js.map +1 -0
  560. package/dist/tools/compatibility.d.ts +45 -0
  561. package/dist/tools/compatibility.d.ts.map +1 -0
  562. package/dist/tools/compatibility.js +49 -0
  563. package/dist/tools/compatibility.js.map +1 -0
  564. package/dist/tools/ids.d.ts +61 -0
  565. package/dist/tools/ids.d.ts.map +1 -0
  566. package/dist/tools/ids.js +61 -0
  567. package/dist/tools/ids.js.map +1 -0
  568. package/dist/tools/index.d.ts +22 -0
  569. package/dist/tools/index.d.ts.map +1 -0
  570. package/dist/tools/index.js +28 -0
  571. package/dist/tools/index.js.map +1 -0
  572. package/dist/tools/manifest-assert.d.ts +35 -0
  573. package/dist/tools/manifest-assert.d.ts.map +1 -0
  574. package/dist/tools/manifest-assert.js +67 -0
  575. package/dist/tools/manifest-assert.js.map +1 -0
  576. package/dist/tools/manifest.d.ts +178 -0
  577. package/dist/tools/manifest.d.ts.map +1 -0
  578. package/dist/tools/manifest.js +35 -0
  579. package/dist/tools/manifest.js.map +1 -0
  580. package/dist/tools/registry.d.ts +37 -0
  581. package/dist/tools/registry.d.ts.map +1 -0
  582. package/dist/tools/registry.js +49 -0
  583. package/dist/tools/registry.js.map +1 -0
  584. package/dist/tools/types.d.ts +1021 -0
  585. package/dist/tools/types.d.ts.map +1 -0
  586. package/dist/tools/types.js +77 -0
  587. package/dist/tools/types.js.map +1 -0
  588. package/dist/types/__tests__/signal.test.d.ts +2 -0
  589. package/dist/types/__tests__/signal.test.d.ts.map +1 -0
  590. package/dist/types/__tests__/signal.test.js +111 -0
  591. package/dist/types/__tests__/signal.test.js.map +1 -0
  592. package/dist/types/index.d.ts +5 -0
  593. package/dist/types/index.d.ts.map +1 -0
  594. package/dist/types/index.js +3 -0
  595. package/dist/types/index.js.map +1 -0
  596. package/dist/types/signal-batch.d.ts +56 -0
  597. package/dist/types/signal-batch.d.ts.map +1 -0
  598. package/dist/types/signal-batch.js +54 -0
  599. package/dist/types/signal-batch.js.map +1 -0
  600. package/dist/types/signal.d.ts +77 -0
  601. package/dist/types/signal.d.ts.map +1 -0
  602. package/dist/types/signal.js +42 -0
  603. package/dist/types/signal.js.map +1 -0
  604. package/package.json +57 -0
@@ -0,0 +1,211 @@
1
+ /**
2
+ * @fileoverview Command-plane types (launch, north-star §5.4).
3
+ *
4
+ * The declarative command surface a tool exports so the **host** can mount it
5
+ * — replacing each tool's raw-Commander access (`program.command(...).option(...).
6
+ * action(...)`). A tool returns typed {@link CommandSpec}s; the host's
7
+ * `mountCommandSpec` (cli, Phase 1) translates them into Commander commands,
8
+ * applies the common flags, declares the options/args, and owns the
9
+ * parse → handler → dispatch → error → exit pipeline.
10
+ *
11
+ * Why this lives in **core**: these are kernel-level contract types, declared
12
+ * beside the {@link Tool} contract. core stays Commander-free — there is no
13
+ * `commander` import here, only plain data shapes. The Commander-touching
14
+ * mounting runtime lives in cli; the Commander-touching `applyCommonFlags`
15
+ * runtime lives in contracts. Only the pure KEY TYPE ({@link CommonFlagKey})
16
+ * lives here.
17
+ *
18
+ * `OptionSpec` is grounded in the *real* first-party flag corpus (graph 26 +
19
+ * fit 10 + sim 1 + host commands), enumerated in the Phase 0 flag-corpus table.
20
+ * Every flag shape maps to a field below — there is no raw-Commander escape
21
+ * hatch by design (the the "one command surface" invariant). Any future flag
22
+ * that cannot be expressed is an OptionSpec EXTENSION, never an escape.
23
+ */
24
+ /**
25
+ * The canonical common-flag keys shared across tool run commands (ADR-0021).
26
+ *
27
+ * The KEY TYPE lives here in core so {@link CommandSpec.commonFlags} can be
28
+ * statically typed at the kernel layer without core importing contracts
29
+ * (a layering inversion forbidden by dependency-cruiser). The Commander-touching
30
+ * runtime that turns these keys into `.option(...)` calls — `applyCommonFlags`,
31
+ * the `commonFlags` registry, and `CommonFlagSpec` — stays in
32
+ * `@opensip-cli/contracts/cli-flags`, which re-exports this type so existing
33
+ * `import { CommonFlagKey } from '@opensip-cli/contracts'` sites keep working.
34
+ *
35
+ * Keep this union in lockstep with the `commonFlags` registry keys in
36
+ * contracts (the `cross-tool-flag-parity` check guards the run-command set).
37
+ */
38
+ export type CommonFlagKey = 'json' | 'cwd' | 'quiet' | 'verbose' | 'debug' | 'reportTo' | 'apiKey' | 'open';
39
+ /** The full set of {@link CommonFlagKey} values — the validation source for `defineCommand`. */
40
+ export declare const COMMON_FLAG_KEYS: readonly CommonFlagKey[];
41
+ /**
42
+ * A single tool-specific option declaration.
43
+ *
44
+ * Expresses every shape in the first-party corpus:
45
+ * - boolean (`--gate-save`, default `false`): `{ flag, default: false }`
46
+ * - negatable (`--no-cache`): `{ flag: '--no-cache', negatable: true }`
47
+ * - value (`--recipe <name>`, `--profile <path>`): `{ flag, value: '<name>' }`
48
+ * - value + default (`--resolution <mode>` default `exact`): add `default`
49
+ * - choices (`--resolution` ∈ `exact|fast`): add `choices`
50
+ * - custom coercion (`--concurrency <n>` → Number; `--exclude <slug>` repeatable;
51
+ * `--older-than <days>` validated): declared as a pure `parse`
52
+ * - short alias (`-y, --yes`, `-q, --quiet`): carried verbatim in `flag`
53
+ * - required value (`--out <path>` via `.requiredOption`): `{ value, required: true }`
54
+ */
55
+ export interface OptionSpec {
56
+ /**
57
+ * The Commander flag string, including any short alias — e.g. `'--no-cache'`,
58
+ * `'--resolution'`, `'-y, --yes'`. Does NOT include the value placeholder; put
59
+ * that in {@link value}.
60
+ */
61
+ readonly flag: string;
62
+ /**
63
+ * The value placeholder (`'<mode>'`, `'<path>'`, `'[path]'`). Presence marks
64
+ * this as a value-taking option; absence marks it boolean. Optional-value
65
+ * placeholders use square brackets (`'[path]'`), matching Commander.
66
+ */
67
+ readonly value?: string;
68
+ /** Help text (the single source of truth for this option's description). */
69
+ readonly description: string;
70
+ /**
71
+ * Literal default applied at mount. A boolean default models a boolean flag's
72
+ * resting state (`false`); a string default models a value flag's fallback
73
+ * (`'exact'`). Computed-per-invocation defaults (e.g. `process.cwd()`) belong
74
+ * to {@link CommonFlagKey} common flags, not here.
75
+ */
76
+ readonly default?: string | boolean;
77
+ /**
78
+ * Repeatable/array default (e.g. `--exclude`, `--changed-file` accumulate into
79
+ * `string[]`). Kept distinct from {@link default} so the mount layer can pass a
80
+ * fresh array as Commander's `defaultValue` alongside a {@link parse} reducer.
81
+ */
82
+ readonly arrayDefault?: readonly string[];
83
+ /** `--no-cache` style negatable boolean. The flag already carries the `--no-` prefix. */
84
+ readonly negatable?: boolean;
85
+ /** Variadic value option (rare for options; carried for completeness). */
86
+ readonly variadic?: boolean;
87
+ /** Whether the option is required (`.requiredOption`). Value options only. */
88
+ readonly required?: boolean;
89
+ /** Declared allowed values — the mount layer enforces membership (was handler-side, e.g. `--resolution`). */
90
+ readonly choices?: readonly string[];
91
+ /**
92
+ * Declared pure coercion/validation. Covers Commander's `(value, previous) =>
93
+ * next` reducer shape used by repeatable flags (`--exclude`, `--changed-file`)
94
+ * and scalar parsers (`--concurrency` → Number, `--older-than` → validated int).
95
+ * MUST be pure — no I/O, no scope reads. Runs at parse time in the mount layer.
96
+ */
97
+ readonly parse?: (raw: string, previous: unknown) => unknown;
98
+ }
99
+ /** A positional argument declaration (`.argument(...)`). */
100
+ export interface ArgSpec {
101
+ /** The argument name as it appears in help (`'paths'`, `'name'`, `'shell'`). */
102
+ readonly name: string;
103
+ /** Help text for the argument. */
104
+ readonly description: string;
105
+ /** Variadic positional (`[paths...]` / `<paths...>`). */
106
+ readonly variadic?: boolean;
107
+ /** Optional positional (`[name]` rather than `<name>`). */
108
+ readonly optional?: boolean;
109
+ }
110
+ /**
111
+ * What the handler returns and how the host renders it through the single
112
+ * dispatch seam (Phase 1). The launch `CommandOutcome` swap happens at this seam
113
+ * without changing the handler contract.
114
+ *
115
+ * - `signal-envelope` — handler yields a `SignalEnvelope` (fit/graph runs); the
116
+ * host renders it (`--json` → emitEnvelope, else render).
117
+ * - `command-result` — handler yields a `CommandResult` variant (list/export/host).
118
+ * - `raw-stream` — the host renders NOTHING; the handler owns its entire output
119
+ * surface. Covers two cases: (a) a handler that writes directly to stdout/a
120
+ * file (completion script, SARIF/baseline export, shard-worker); and (b) a
121
+ * handler that owns a runtime-conditional render+egress flow no single static
122
+ * mode captures — e.g. `sim`, which branches between an interactive Ink live
123
+ * view and a static render/JSON path depending on the TTY, then performs its
124
+ * own cloud egress, report auto-open, and exit-code decision. In both cases
125
+ * the handler returns `void` and the host does not touch the stream.
126
+ * - `live-view` — interactive Ink view path (graph/fit live default on a TTY)
127
+ * where the command is UNCONDITIONALLY a live view; the host dispatches to the
128
+ * tool's registered renderer via `renderLive(name, …)`.
129
+ */
130
+ export type CommandOutputMode = 'signal-envelope' | 'command-result' | 'raw-stream' | 'live-view';
131
+ /**
132
+ * Narrow categories for the `raw-stream` escape hatch. A raw-stream command must
133
+ * explain why the host-owned render seam cannot handle its output.
134
+ */
135
+ export type RawStreamReason = 'completion-script' | 'file-export' | 'worker-ipc' | 'runtime-render-dispatch' | 'session-replay' | 'diagnostic-gate' | 'lookup';
136
+ export declare const RAW_STREAM_REASONS: readonly RawStreamReason[];
137
+ /**
138
+ * Whether the command needs a resolved project scope (RunScope project context,
139
+ * datastore, recipe config) entered before the handler runs.
140
+ *
141
+ * - `project` — needs the entered RunScope (every run/list/export command).
142
+ * - `none` — scope-agnostic (e.g. `completion`, `configure`).
143
+ */
144
+ export type CommandScopeRequirement = 'project' | 'none';
145
+ /**
146
+ * The context the host passes to a handler when it invokes it. The concrete
147
+ * shape is finalized in Phase 1 (mounting) — it carries the per-invocation scope
148
+ * and the output emitters (`render` / `emitJson` / `renderLive` / `writeSarif` /
149
+ * `deliverSignals` / `setExitCode`), i.e. today's `ToolCliContext` surface minus
150
+ * raw `program` access.
151
+ *
152
+ * Declared here as an empty marker interface (NOT a bare `unknown` alias): core
153
+ * stays Commander-free and does not pin the cli/contracts-owned context shape, so
154
+ * the kernel cannot name the concrete emitters. Handlers parameterize `TCtx` with
155
+ * the real context type (`ToolCliContext`) at the cli/tool layer; this marker is
156
+ * the unconstrained default.
157
+ */
158
+ export type CommandContext = Readonly<Record<string, unknown>>;
159
+ /**
160
+ * A command handler: pure-ish business logic the host invokes after parsing.
161
+ * Receives the parsed, typed options and the host {@link CommandContext}; returns
162
+ * whatever the declared {@link CommandSpec.output} mode dispatches (sync or a
163
+ * promise), or void for `raw-stream` / `live-view`, which side-effect directly.
164
+ */
165
+ export type CommandHandler<TOpts = unknown, TCtx = CommandContext> = (opts: TOpts, ctx: TCtx) => unknown;
166
+ /**
167
+ * The declarative spec a tool exports for one command. The host mounts it; the
168
+ * tool never touches Commander.
169
+ */
170
+ export interface CommandSpec<TOpts = unknown, TCtx = CommandContext> {
171
+ /** The command name as typed on the CLI (`'graph'`, `'fit-list'`). */
172
+ readonly name: string;
173
+ /** One-line description shown in help. */
174
+ readonly description: string;
175
+ /** Alternate names (`'inspect'` for `'analyze'`). */
176
+ readonly aliases?: readonly string[];
177
+ /** The common flags this command exposes, applied via `applyCommonFlags` at mount. */
178
+ readonly commonFlags: readonly CommonFlagKey[];
179
+ /** Tool-specific options. */
180
+ readonly options?: readonly OptionSpec[];
181
+ /** Positional arguments (declaration order is mount order). */
182
+ readonly args?: readonly ArgSpec[];
183
+ /** Whether the host enters a project scope before the handler. */
184
+ readonly scope: CommandScopeRequirement;
185
+ /** How the host dispatches the handler's return value. */
186
+ readonly output: CommandOutputMode;
187
+ /** Required when `output` is `raw-stream`, forbidden otherwise. */
188
+ readonly rawStreamReason?: RawStreamReason;
189
+ /** The business-logic handler the host invokes after parse. */
190
+ readonly handler: CommandHandler<TOpts, TCtx>;
191
+ }
192
+ /**
193
+ * Identity helper that validates and returns a {@link CommandSpec}. Mirrors
194
+ * `defineCheck` / `defineTool`: returns the value so the caller registers it
195
+ * explicitly (no module-import side effects). Validation is structural and pure
196
+ * — it catches authoring mistakes at construction time:
197
+ *
198
+ * - `name` non-empty
199
+ * - `description` non-empty
200
+ * - every `commonFlags` key is a valid {@link CommonFlagKey}
201
+ * - no duplicate `commonFlags` keys
202
+ * - `handler` is a function
203
+ *
204
+ * Deeper, Commander-coupled validation (e.g. choices ⊆ enum, flag-string syntax)
205
+ * happens at mount in cli — core cannot import Commander.
206
+ *
207
+ * @throws {Error | TypeError} When `name`/`description` is empty, `handler` is not
208
+ * a function, or `commonFlags` contains an unknown or duplicate key.
209
+ */
210
+ export declare function defineCommand<TOpts = unknown, TCtx = CommandContext>(spec: CommandSpec<TOpts, TCtx>): CommandSpec<TOpts, TCtx>;
211
+ //# sourceMappingURL=command-spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-spec.d.ts","sourceRoot":"","sources":["../../src/tools/command-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,KAAK,GACL,OAAO,GACP,SAAS,GACT,OAAO,GACP,UAAU,GACV,QAAQ,GACR,MAAM,CAAC;AAEX,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAS3C,CAAC;AAEX;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,6GAA6G;IAC7G,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;CAC9D;AAED,4DAA4D;AAC5D,MAAM,WAAW,OAAO;IACtB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,YAAY,GAAG,WAAW,CAAC;AAElG;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,mBAAmB,GACnB,aAAa,GACb,YAAY,GACZ,yBAAyB,GACzB,gBAAgB,GAChB,iBAAiB,GACjB,QAAQ,CAAC;AAEb,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAQxD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,OAAO,EAAE,IAAI,GAAG,cAAc,IAAI,CACnE,IAAI,EAAE,KAAK,EACX,GAAG,EAAE,IAAI,KACN,OAAO,CAAC;AAEb;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,KAAK,GAAG,OAAO,EAAE,IAAI,GAAG,cAAc;IACjE,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,sFAAsF;IACtF,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,mEAAmE;IACnE,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;IAC3C,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAG,OAAO,EAAE,IAAI,GAAG,cAAc,EAClE,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,GAC7B,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CA2B1B"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * @fileoverview Command-plane types (launch, north-star §5.4).
3
+ *
4
+ * The declarative command surface a tool exports so the **host** can mount it
5
+ * — replacing each tool's raw-Commander access (`program.command(...).option(...).
6
+ * action(...)`). A tool returns typed {@link CommandSpec}s; the host's
7
+ * `mountCommandSpec` (cli, Phase 1) translates them into Commander commands,
8
+ * applies the common flags, declares the options/args, and owns the
9
+ * parse → handler → dispatch → error → exit pipeline.
10
+ *
11
+ * Why this lives in **core**: these are kernel-level contract types, declared
12
+ * beside the {@link Tool} contract. core stays Commander-free — there is no
13
+ * `commander` import here, only plain data shapes. The Commander-touching
14
+ * mounting runtime lives in cli; the Commander-touching `applyCommonFlags`
15
+ * runtime lives in contracts. Only the pure KEY TYPE ({@link CommonFlagKey})
16
+ * lives here.
17
+ *
18
+ * `OptionSpec` is grounded in the *real* first-party flag corpus (graph 26 +
19
+ * fit 10 + sim 1 + host commands), enumerated in the Phase 0 flag-corpus table.
20
+ * Every flag shape maps to a field below — there is no raw-Commander escape
21
+ * hatch by design (the the "one command surface" invariant). Any future flag
22
+ * that cannot be expressed is an OptionSpec EXTENSION, never an escape.
23
+ */
24
+ /** The full set of {@link CommonFlagKey} values — the validation source for `defineCommand`. */
25
+ export const COMMON_FLAG_KEYS = [
26
+ 'json',
27
+ 'cwd',
28
+ 'quiet',
29
+ 'verbose',
30
+ 'debug',
31
+ 'reportTo',
32
+ 'apiKey',
33
+ 'open',
34
+ ];
35
+ export const RAW_STREAM_REASONS = [
36
+ 'completion-script',
37
+ 'file-export',
38
+ 'worker-ipc',
39
+ 'runtime-render-dispatch',
40
+ 'session-replay',
41
+ 'diagnostic-gate',
42
+ 'lookup',
43
+ ];
44
+ /**
45
+ * Identity helper that validates and returns a {@link CommandSpec}. Mirrors
46
+ * `defineCheck` / `defineTool`: returns the value so the caller registers it
47
+ * explicitly (no module-import side effects). Validation is structural and pure
48
+ * — it catches authoring mistakes at construction time:
49
+ *
50
+ * - `name` non-empty
51
+ * - `description` non-empty
52
+ * - every `commonFlags` key is a valid {@link CommonFlagKey}
53
+ * - no duplicate `commonFlags` keys
54
+ * - `handler` is a function
55
+ *
56
+ * Deeper, Commander-coupled validation (e.g. choices ⊆ enum, flag-string syntax)
57
+ * happens at mount in cli — core cannot import Commander.
58
+ *
59
+ * @throws {Error | TypeError} When `name`/`description` is empty, `handler` is not
60
+ * a function, or `commonFlags` contains an unknown or duplicate key.
61
+ */
62
+ export function defineCommand(spec) {
63
+ if (spec.name.trim() === '') {
64
+ throw new Error('defineCommand: `name` must be a non-empty string.');
65
+ }
66
+ if (spec.description.trim() === '') {
67
+ throw new Error(`defineCommand: command '${spec.name}' must have a non-empty description.`);
68
+ }
69
+ if (typeof spec.handler !== 'function') {
70
+ throw new TypeError(`defineCommand: command '${spec.name}' must have a function handler.`);
71
+ }
72
+ validateRawStreamDeclaration(spec);
73
+ const seen = new Set();
74
+ for (const key of spec.commonFlags) {
75
+ if (!COMMON_FLAG_KEYS.includes(key)) {
76
+ throw new Error(`defineCommand: command '${spec.name}' declares unknown common flag '${String(key)}'. ` +
77
+ `Valid keys: ${COMMON_FLAG_KEYS.join(', ')}.`);
78
+ }
79
+ if (seen.has(key)) {
80
+ throw new Error(`defineCommand: command '${spec.name}' declares duplicate common flag '${key}'.`);
81
+ }
82
+ seen.add(key);
83
+ }
84
+ return spec;
85
+ }
86
+ /**
87
+ * Validate that a `raw-stream` command documents why it owns its own output.
88
+ *
89
+ * @throws {Error} when `output` is `'raw-stream'` but no `rawStreamReason` is
90
+ * declared (or the reason is not a recognized value).
91
+ */
92
+ function validateRawStreamDeclaration(spec) {
93
+ if (spec.output === 'raw-stream') {
94
+ if (spec.rawStreamReason === undefined) {
95
+ throw new Error(`defineCommand: command '${spec.name}' declares output 'raw-stream' without ` +
96
+ 'rawStreamReason. Raw-stream commands must document why the host render seam ' +
97
+ 'cannot own their output.');
98
+ }
99
+ if (!RAW_STREAM_REASONS.includes(spec.rawStreamReason)) {
100
+ throw new Error(`defineCommand: command '${spec.name}' declares unknown rawStreamReason ` +
101
+ `'${String(spec.rawStreamReason)}'. Valid reasons: ${RAW_STREAM_REASONS.join(', ')}.`);
102
+ }
103
+ return;
104
+ }
105
+ if (spec.rawStreamReason !== undefined) {
106
+ throw new Error(`defineCommand: command '${spec.name}' declares rawStreamReason but output is ` +
107
+ `'${spec.output}'. rawStreamReason is only valid for raw-stream commands.`);
108
+ }
109
+ }
110
+ //# sourceMappingURL=command-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-spec.js","sourceRoot":"","sources":["../../src/tools/command-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA0BH,gGAAgG;AAChG,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,MAAM;IACN,KAAK;IACL,OAAO;IACP,SAAS;IACT,OAAO;IACP,UAAU;IACV,QAAQ;IACR,MAAM;CACE,CAAC;AA4GX,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC5D,mBAAmB;IACnB,aAAa;IACb,YAAY;IACZ,yBAAyB;IACzB,gBAAgB;IAChB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAgEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAC3B,IAA8B;IAE9B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,IAAI,sCAAsC,CAAC,CAAC;IAC9F,CAAC;IACD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACvC,MAAM,IAAI,SAAS,CAAC,2BAA2B,IAAI,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAC7F,CAAC;IACD,4BAA4B,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAiB,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,IAAI,mCAAmC,MAAM,CAAC,GAAG,CAAC,KAAK;gBACrF,eAAe,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAChD,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,IAAI,qCAAqC,GAAG,IAAI,CACjF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAS,4BAA4B,CAAC,IAIrC;IACC,IAAI,IAAI,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,IAAI,yCAAyC;gBAC3E,8EAA8E;gBAC9E,0BAA0B,CAC7B,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,IAAI,qCAAqC;gBACvE,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,qBAAqB,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACxF,CAAC;QACJ,CAAC;QACD,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,IAAI,2CAA2C;YAC7E,IAAI,IAAI,CAAC,MAAM,2DAA2D,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @fileoverview The single pure compatibility gate.
3
+ *
4
+ * One decision function the bundled and external admission paths share
5
+ * (north-star §5.2): given the epoch a tool was compiled against
6
+ * (`apiVersion`) and the epoch the engine implements
7
+ * (`PLUGIN_API_VERSION`), return a `CompatibilityVerdict` — pure data.
8
+ * The loader (Phase 2) and CLI (Phase 3) act on the verdict; this module
9
+ * never logs, never exits, never touches the filesystem.
10
+ *
11
+ * Policy for the launch API:
12
+ * - `apiVersion` omitted ⇒ **incompatible**. A tool MUST declare the epoch
13
+ * it was compiled against; an unversioned plugin input is no longer admitted
14
+ * (north-star Principle 5 — version the inputs).
15
+ * - `apiVersion === engine` ⇒ compatible.
16
+ * - otherwise ⇒ incompatible, carrying both integers + a human reason
17
+ * (future vs. past epoch).
18
+ */
19
+ /**
20
+ * The outcome of the compatibility gate — pure data the caller acts on.
21
+ *
22
+ * - `compatible` — admit the tool.
23
+ * - `incompatible` — reject; carries the declared + engine epochs and a
24
+ * human-readable reason for diagnostics / logs.
25
+ */
26
+ export type CompatibilityVerdict = {
27
+ readonly kind: 'compatible';
28
+ } | {
29
+ readonly kind: 'incompatible';
30
+ readonly declared: number;
31
+ readonly engine: number;
32
+ readonly reason: string;
33
+ };
34
+ /**
35
+ * Decide whether a tool declaring `apiVersion` is compatible with the
36
+ * engine epoch.
37
+ *
38
+ * @param apiVersion The epoch the tool was compiled against, or `undefined`
39
+ * (a missing epoch is incompatible).
40
+ * @param engine The epoch the running engine implements. Defaults to
41
+ * `PLUGIN_API_VERSION`; overridable for tests / as-if-external probes.
42
+ * @returns A `CompatibilityVerdict` — never throws.
43
+ */
44
+ export declare function checkCompatibility(apiVersion: number | undefined, engine?: number): CompatibilityVerdict;
45
+ //# sourceMappingURL=compatibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../src/tools/compatibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC/B;IACE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,GAAE,MAA2B,GAClC,oBAAoB,CAsBtB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @fileoverview The single pure compatibility gate.
3
+ *
4
+ * One decision function the bundled and external admission paths share
5
+ * (north-star §5.2): given the epoch a tool was compiled against
6
+ * (`apiVersion`) and the epoch the engine implements
7
+ * (`PLUGIN_API_VERSION`), return a `CompatibilityVerdict` — pure data.
8
+ * The loader (Phase 2) and CLI (Phase 3) act on the verdict; this module
9
+ * never logs, never exits, never touches the filesystem.
10
+ *
11
+ * Policy for the launch API:
12
+ * - `apiVersion` omitted ⇒ **incompatible**. A tool MUST declare the epoch
13
+ * it was compiled against; an unversioned plugin input is no longer admitted
14
+ * (north-star Principle 5 — version the inputs).
15
+ * - `apiVersion === engine` ⇒ compatible.
16
+ * - otherwise ⇒ incompatible, carrying both integers + a human reason
17
+ * (future vs. past epoch).
18
+ */
19
+ import { PLUGIN_API_VERSION } from './manifest.js';
20
+ /**
21
+ * Decide whether a tool declaring `apiVersion` is compatible with the
22
+ * engine epoch.
23
+ *
24
+ * @param apiVersion The epoch the tool was compiled against, or `undefined`
25
+ * (a missing epoch is incompatible).
26
+ * @param engine The epoch the running engine implements. Defaults to
27
+ * `PLUGIN_API_VERSION`; overridable for tests / as-if-external probes.
28
+ * @returns A `CompatibilityVerdict` — never throws.
29
+ */
30
+ export function checkCompatibility(apiVersion, engine = PLUGIN_API_VERSION) {
31
+ // A tool that declares no `apiVersion` is incompatible: unversioned plugin
32
+ // input is not admitted off the marker alone.
33
+ if (apiVersion === undefined) {
34
+ return {
35
+ kind: 'incompatible',
36
+ declared: Number.NaN,
37
+ engine,
38
+ reason: `tool declares no plugin apiVersion; declare \`apiVersion: ${engine}\` in its manifest`,
39
+ };
40
+ }
41
+ if (apiVersion === engine) {
42
+ return { kind: 'compatible' };
43
+ }
44
+ const reason = apiVersion > engine
45
+ ? `tool targets plugin API v${apiVersion} but this engine implements v${engine}; upgrade OpenSIP CLI to load it`
46
+ : `tool targets plugin API v${apiVersion} which this engine (v${engine}) no longer supports; upgrade the tool`;
47
+ return { kind: 'incompatible', declared: apiVersion, engine, reason };
48
+ }
49
+ //# sourceMappingURL=compatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../../src/tools/compatibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAkBnD;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,SAAiB,kBAAkB;IAEnC,2EAA2E;IAC3E,8CAA8C;IAC9C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,MAAM,CAAC,GAAG;YACpB,MAAM;YACN,MAAM,EAAE,6DAA6D,MAAM,oBAAoB;SAChG,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QAC1B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,MAAM,GACV,UAAU,GAAG,MAAM;QACjB,CAAC,CAAC,4BAA4B,UAAU,gCAAgC,MAAM,kCAAkC;QAChH,CAAC,CAAC,4BAA4B,UAAU,wBAAwB,MAAM,wCAAwC,CAAC;IAEnH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Canonical first-party tool id registry.
3
+ *
4
+ * Two distinct forms exist for historical reasons:
5
+ *
6
+ * - **Long form** (`'fitness' | 'simulation' | 'graph'`) — used by
7
+ * `Tool.metadata.id` and most human-facing copy. Each tool
8
+ * self-identifies with this form.
9
+ *
10
+ * - **Short form** (`'fit' | 'sim' | 'graph'`) — used as the storage
11
+ * discriminator in `StoredSession.tool`, `SignalEnvelope.tool`,
12
+ * path-domain names (`<project>/opensip-cli/fit/`,
13
+ * `<project>/opensip-cli/sim/`), and CLI subcommand names. SQL
14
+ * rows, generated dashboards, and on-disk layout all use it.
15
+ *
16
+ * Prior to audit-round-3 Finding H, the same literal union appeared
17
+ * inline in 5+ places (`StoredSession.tool`, the JSON output `tool`,
18
+ * `PathDomain`, `VALID_TOOLS` set, etc.) with no shared source of
19
+ * truth. Adding a 4th first-party tool risked editing N − 1 sites and
20
+ * silently passing tests until a SQL row carried an unknown
21
+ * discriminator at runtime.
22
+ *
23
+ * Third-party tools (registered via `discoverToolPackages`) MAY use
24
+ * any short / long id. The unions below are first-party-only; the
25
+ * persistence + path layers do NOT today store rows for third-party
26
+ * tools (they'd need an extension).
27
+ */
28
+ /** First-party canonical short ids — storage/output discriminators. */
29
+ export declare const TOOL_SHORT_IDS: readonly ["fit", "sim", "graph"];
30
+ /** First-party short id type (storage discriminator). */
31
+ export type ToolShortId = (typeof TOOL_SHORT_IDS)[number];
32
+ /** First-party canonical long ids — `Tool.metadata.id` values. */
33
+ export declare const TOOL_LONG_IDS: readonly ["fitness", "simulation", "graph"];
34
+ /** First-party long id type (Tool metadata). */
35
+ export type ToolLongId = (typeof TOOL_LONG_IDS)[number];
36
+ /** Canonical long → short mapping for the first-party tools. */
37
+ export declare const TOOL_LONG_TO_SHORT: {
38
+ readonly fitness: "fit";
39
+ readonly simulation: "sim";
40
+ readonly graph: "graph";
41
+ };
42
+ /** Canonical short → long mapping (inverse of `TOOL_LONG_TO_SHORT`). */
43
+ export declare const TOOL_SHORT_TO_LONG: {
44
+ readonly fit: "fitness";
45
+ readonly sim: "simulation";
46
+ readonly graph: "graph";
47
+ };
48
+ /**
49
+ * Runtime predicate for short ids. Use at trust boundaries where a
50
+ * value crosses from `unknown` into the typed domain — most notably
51
+ * `SessionRepo.hydrateSession` validating the SQLite `tool` column,
52
+ * which has no CHECK constraint.
53
+ */
54
+ export declare function isToolShortId(value: unknown): value is ToolShortId;
55
+ /**
56
+ * Runtime predicate for long ids. Use where a value claims to be a
57
+ * `Tool.metadata.id` for a first-party tool (e.g. cross-checking the
58
+ * long form a tool reported against the canonical mapping).
59
+ */
60
+ export declare function isToolLongId(value: unknown): value is ToolLongId;
61
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/tools/ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,uEAAuE;AACvE,eAAO,MAAM,cAAc,kCAAmC,CAAC;AAE/D,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,kEAAkE;AAClE,eAAO,MAAM,aAAa,6CAA8C,CAAC;AAEzE,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,gEAAgE;AAChE,eAAO,MAAM,kBAAkB;;;;CAIqB,CAAC;AAErD,wEAAwE;AACxE,eAAO,MAAM,kBAAkB;;;;CAIqB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Canonical first-party tool id registry.
3
+ *
4
+ * Two distinct forms exist for historical reasons:
5
+ *
6
+ * - **Long form** (`'fitness' | 'simulation' | 'graph'`) — used by
7
+ * `Tool.metadata.id` and most human-facing copy. Each tool
8
+ * self-identifies with this form.
9
+ *
10
+ * - **Short form** (`'fit' | 'sim' | 'graph'`) — used as the storage
11
+ * discriminator in `StoredSession.tool`, `SignalEnvelope.tool`,
12
+ * path-domain names (`<project>/opensip-cli/fit/`,
13
+ * `<project>/opensip-cli/sim/`), and CLI subcommand names. SQL
14
+ * rows, generated dashboards, and on-disk layout all use it.
15
+ *
16
+ * Prior to audit-round-3 Finding H, the same literal union appeared
17
+ * inline in 5+ places (`StoredSession.tool`, the JSON output `tool`,
18
+ * `PathDomain`, `VALID_TOOLS` set, etc.) with no shared source of
19
+ * truth. Adding a 4th first-party tool risked editing N − 1 sites and
20
+ * silently passing tests until a SQL row carried an unknown
21
+ * discriminator at runtime.
22
+ *
23
+ * Third-party tools (registered via `discoverToolPackages`) MAY use
24
+ * any short / long id. The unions below are first-party-only; the
25
+ * persistence + path layers do NOT today store rows for third-party
26
+ * tools (they'd need an extension).
27
+ */
28
+ /** First-party canonical short ids — storage/output discriminators. */
29
+ export const TOOL_SHORT_IDS = ['fit', 'sim', 'graph'];
30
+ /** First-party canonical long ids — `Tool.metadata.id` values. */
31
+ export const TOOL_LONG_IDS = ['fitness', 'simulation', 'graph'];
32
+ /** Canonical long → short mapping for the first-party tools. */
33
+ export const TOOL_LONG_TO_SHORT = {
34
+ fitness: 'fit',
35
+ simulation: 'sim',
36
+ graph: 'graph',
37
+ };
38
+ /** Canonical short → long mapping (inverse of `TOOL_LONG_TO_SHORT`). */
39
+ export const TOOL_SHORT_TO_LONG = {
40
+ fit: 'fitness',
41
+ sim: 'simulation',
42
+ graph: 'graph',
43
+ };
44
+ /**
45
+ * Runtime predicate for short ids. Use at trust boundaries where a
46
+ * value crosses from `unknown` into the typed domain — most notably
47
+ * `SessionRepo.hydrateSession` validating the SQLite `tool` column,
48
+ * which has no CHECK constraint.
49
+ */
50
+ export function isToolShortId(value) {
51
+ return typeof value === 'string' && TOOL_SHORT_IDS.includes(value);
52
+ }
53
+ /**
54
+ * Runtime predicate for long ids. Use where a value claims to be a
55
+ * `Tool.metadata.id` for a first-party tool (e.g. cross-checking the
56
+ * long form a tool reported against the canonical mapping).
57
+ */
58
+ export function isToolLongId(value) {
59
+ return typeof value === 'string' && TOOL_LONG_IDS.includes(value);
60
+ }
61
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/tools/ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAK/D,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAU,CAAC;AAKzE,gEAAgE;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,OAAO;CACoC,CAAC;AAErD,wEAAwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,YAAY;IACjB,KAAK,EAAE,OAAO;CACoC,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @fileoverview Tool plugin barrel.
3
+ *
4
+ * Public API for the Tool contract — the kernel-level plugin shape
5
+ * that fitness, simulation, and future tools implement.
6
+ */
7
+ export type { Tool, ToolMetadata, ToolCommandDescriptor, ToolCliContext, GateCompareResult, SignalDeliveryResult, ScaffoldContext, ScaffoldFile, ToolPluginExports, ToolSessionRecord, ToolSessionReplayContribution, LiveViewRenderer, LiveViewContext, ToolRunSessionInput, ToolSessionContribution, ToolRunCompletion, RecordedToolRunSession, ToolRunSessions, ToolExtensionPoints, HostGovernance, HostAudit, HostEntitlements, } from './types.js';
8
+ export { UnknownLiveViewError } from './types.js';
9
+ export { TOOL_CONTRACT_VERSION } from './types.js';
10
+ export { ToolRegistry } from './registry.js';
11
+ export { PLUGIN_API_VERSION } from './manifest.js';
12
+ export { defineCommand, COMMON_FLAG_KEYS, RAW_STREAM_REASONS } from './command-spec.js';
13
+ export type { CommandSpec, OptionSpec, ArgSpec, CommandHandler, CommandContext, CommandOutputMode, CommandScopeRequirement, CommonFlagKey, RawStreamReason, } from './command-spec.js';
14
+ export type { RawToolPluginManifest, ToolPluginManifest, ToolCommandManifest, ToolProvenance, ToolSource, } from './manifest.js';
15
+ export { isCapabilityValidator, isStructuralContributionSchema } from './capability.js';
16
+ export type { CapabilityDomainSpec, CapabilityContributionKind, CapabilityDiscoveryDescriptor, CapabilityDiscoveryMode, CapabilityCoContribution, CapabilityValidator, StructuralContributionSchema, ToolCapabilityDeclaration, ToolConfigContribution, } from './capability.js';
17
+ export { checkCompatibility } from './compatibility.js';
18
+ export type { CompatibilityVerdict } from './compatibility.js';
19
+ export { assertManifestMatchesTool } from './manifest-assert.js';
20
+ export { TOOL_LONG_IDS, TOOL_LONG_TO_SHORT, TOOL_SHORT_IDS, TOOL_SHORT_TO_LONG, isToolLongId, isToolShortId, } from './ids.js';
21
+ export type { ToolLongId, ToolShortId } from './ids.js';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EAEnB,cAAc,EACd,SAAS,EACT,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAKnD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACxF,YAAY,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,UAAU,GACX,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACxF,YAAY,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @fileoverview Tool plugin barrel.
3
+ *
4
+ * Public API for the Tool contract — the kernel-level plugin shape
5
+ * that fitness, simulation, and future tools implement.
6
+ */
7
+ export { UnknownLiveViewError } from './types.js';
8
+ export { TOOL_CONTRACT_VERSION } from './types.js';
9
+ export { ToolRegistry } from './registry.js';
10
+ // Static tool-plugin manifest + the plugin-API epoch + provenance types
11
+ // (launch raw-vs-admitted contract).
12
+ export { PLUGIN_API_VERSION } from './manifest.js';
13
+ // Command-plane types (launch, §5.4): the declarative command surface a
14
+ // tool exports for the host to mount, plus the CommonFlagKey key type (the pure
15
+ // type lives in core; the Commander-touching applyCommonFlags runtime stays in
16
+ // contracts). Re-exported by @opensip-cli/contracts for the public surface.
17
+ export { defineCommand, COMMON_FLAG_KEYS, RAW_STREAM_REASONS } from './command-spec.js';
18
+ // Capability domain model (launch, §5.3): the data shape a tool
19
+ // uses to declare an extension point it owns. The runtime registry lives
20
+ // in `plugins/capability-registry.ts`.
21
+ export { isCapabilityValidator, isStructuralContributionSchema } from './capability.js';
22
+ // The single pure compatibility gate shared by the bundled + external
23
+ // admission paths.
24
+ export { checkCompatibility } from './compatibility.js';
25
+ // Load-time manifest⇔Tool drift guard.
26
+ export { assertManifestMatchesTool } from './manifest-assert.js';
27
+ export { TOOL_LONG_IDS, TOOL_LONG_TO_SHORT, TOOL_SHORT_IDS, TOOL_SHORT_TO_LONG, isToolLongId, isToolShortId, } from './ids.js';
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,wEAAwE;AACxE,qCAAqC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,wEAAwE;AACxE,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAmBxF,gEAAgE;AAChE,yEAAyE;AACzE,uCAAuC;AACvC,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAYxF,sEAAsE;AACtE,mBAAmB;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,uCAAuC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,GACd,MAAM,UAAU,CAAC"}