@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,66 @@
1
+ import { describe, it, expect, expectTypeOf, vi } from 'vitest';
2
+ const FAKE_ROOT = '/var/fixture-root';
3
+ const FAKE_PKG_DIR = '/var/fixture-root/packages/a';
4
+ const FAKE_PKG_TSCONFIG = '/var/fixture-root/packages/a/tsconfig.json';
5
+ const FAKE_SUB_DIR = '/var/fixture-root/sub';
6
+ describe('discoverWorkspaceUnits contract', () => {
7
+ it('compiles for an adapter that omits discoverWorkspaceUnits', () => {
8
+ const adapter = {
9
+ id: 'no-workspace',
10
+ fileExtensions: ['.x'],
11
+ parse: () => null,
12
+ stripStrings: (s) => s,
13
+ stripComments: (s) => s,
14
+ };
15
+ // eslint-disable-next-line @typescript-eslint/unbound-method
16
+ expect(adapter.discoverWorkspaceUnits).toBeUndefined();
17
+ });
18
+ it('compiles for an adapter that returns an empty unit list', async () => {
19
+ const adapter = {
20
+ id: 'empty-workspace',
21
+ fileExtensions: ['.x'],
22
+ parse: () => null,
23
+ stripStrings: (s) => s,
24
+ stripComments: (s) => s,
25
+ discoverWorkspaceUnits: vi.fn().mockResolvedValue([]),
26
+ };
27
+ // eslint-disable-next-line @typescript-eslint/unbound-method
28
+ expect(adapter.discoverWorkspaceUnits).toBeTypeOf('function');
29
+ const units = await adapter.discoverWorkspaceUnits?.(FAKE_ROOT);
30
+ expect(units).toEqual([]);
31
+ });
32
+ it('compiles for an adapter that returns one WorkspaceUnit', async () => {
33
+ const unit = {
34
+ id: 'pkg-a',
35
+ rootDir: FAKE_PKG_DIR,
36
+ configPath: FAKE_PKG_TSCONFIG,
37
+ };
38
+ const adapter = {
39
+ id: 'has-workspace',
40
+ fileExtensions: ['.x'],
41
+ parse: () => null,
42
+ stripStrings: (s) => s,
43
+ stripComments: (s) => s,
44
+ // eslint-disable-next-line @typescript-eslint/require-await
45
+ discoverWorkspaceUnits: async () => [unit],
46
+ };
47
+ const units = await adapter.discoverWorkspaceUnits?.(FAKE_ROOT);
48
+ expect(units).toHaveLength(1);
49
+ expect(units?.[0]?.id).toBe('pkg-a');
50
+ expect(units?.[0]?.rootDir).toBe(FAKE_PKG_DIR);
51
+ expect(units?.[0]?.configPath).toBe(FAKE_PKG_TSCONFIG);
52
+ });
53
+ it('makes configPath optional on WorkspaceUnit', () => {
54
+ const unit = {
55
+ id: 'no-config',
56
+ rootDir: FAKE_SUB_DIR,
57
+ };
58
+ expect(unit.configPath).toBeUndefined();
59
+ expectTypeOf().toHaveProperty('id').toEqualTypeOf();
60
+ expectTypeOf().toHaveProperty('rootDir').toEqualTypeOf();
61
+ });
62
+ it('typechecks the discoverWorkspaceUnits signature', () => {
63
+ expectTypeOf().toEqualTypeOf();
64
+ });
65
+ });
66
+ //# sourceMappingURL=workspace-unit-contract.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-unit-contract.test.js","sourceRoot":"","sources":["../../../src/languages/__tests__/workspace-unit-contract.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAKhE,MAAM,SAAS,GAAG,mBAAmB,CAAC;AACtC,MAAM,YAAY,GAAG,8BAA8B,CAAC;AACpD,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AACvE,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAE7C,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,OAAO,GAAoB;YAC/B,EAAE,EAAE,cAAc;YAClB,cAAc,EAAE,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;YACjB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACxB,CAAC;QACF,6DAA6D;QAC7D,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,aAAa,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACvE,MAAM,OAAO,GAAoB;YAC/B,EAAE,EAAE,iBAAiB;YACrB,cAAc,EAAE,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;YACjB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvB,sBAAsB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC;SACtD,CAAC;QACF,6DAA6D;QAC7D,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,sBAAsB,EAAE,CAAC,SAAS,CAAC,CAAC;QAChE,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,MAAM,IAAI,GAAkB;YAC1B,EAAE,EAAE,OAAO;YACX,OAAO,EAAE,YAAY;YACrB,UAAU,EAAE,iBAAiB;SAC9B,CAAC;QACF,MAAM,OAAO,GAAoB;YAC/B,EAAE,EAAE,eAAe;YACnB,cAAc,EAAE,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;YACjB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvB,4DAA4D;YAC5D,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;SAC3C,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,sBAAsB,EAAE,CAAC,SAAS,CAAC,CAAC;QAChE,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,IAAI,GAAkB;YAC1B,EAAE,EAAE,WAAW;YACf,OAAO,EAAE,YAAY;SACtB,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;QACxC,YAAY,EAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,aAAa,EAAU,CAAC;QAC3E,YAAY,EAAiB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,aAAa,EAAU,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,YAAY,EAA0D,CAAC,aAAa,EAEjF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { GenericFunction, Import, Location } from './generic-types.js';
2
+ import type { WorkspaceUnit } from './workspace-unit.js';
3
+ /**
4
+ * Minimal cross-language query primitives. Each adapter implements
5
+ * whichever of these it can support efficiently.
6
+ */
7
+ export interface LanguageQueryAPI<TTree, TNode> {
8
+ findFunctions(tree: TTree): readonly GenericFunction<TNode>[];
9
+ findImports(tree: TTree): readonly Import[];
10
+ findCallsTo(tree: TTree, name: string): readonly TNode[];
11
+ findStringLiterals(tree: TTree): readonly {
12
+ readonly value: string;
13
+ readonly location: Location;
14
+ }[];
15
+ getLocation(tree: TTree, node: TNode): Location;
16
+ getText(tree: TTree, node: TNode): string;
17
+ }
18
+ /**
19
+ * A LanguageAdapter is the contract that every language pack implements.
20
+ * TTree/TNode are opaque to core — passed through to checks.
21
+ */
22
+ export interface LanguageAdapter<TTree = unknown, TNode = unknown> {
23
+ /** Stable identifier matched against scope.languages in checks and languages: in targets. */
24
+ readonly id: string;
25
+ /** Lowercase extensions including the leading dot, e.g. ['.rs'] or ['.ts', '.tsx']. */
26
+ readonly fileExtensions: readonly string[];
27
+ /**
28
+ * Optional aliases — e.g. `['rs']` for Rust, `['c']` for the cpp
29
+ * adapter. The registry indexes these alongside `id` and consults
30
+ * them through {@link LanguageRegistry.canonicalize}, so a target
31
+ * declared with `languages: ['c']` matches a check scoped to `cpp`.
32
+ */
33
+ readonly aliases?: readonly string[];
34
+ /** Parse a file's text into the adapter's native tree. Returns null on parse failure. */
35
+ parse(content: string, filePath: string): TTree | null;
36
+ /** Replace string literal content with whitespace of equal length. */
37
+ stripStrings(content: string): string;
38
+ /** Replace both string literals AND comments with whitespace of equal length. */
39
+ stripComments(content: string): string;
40
+ /** Optional generic query layer for cross-language checks. */
41
+ readonly query?: LanguageQueryAPI<TTree, TNode>;
42
+ /**
43
+ * Optional async warmup (e.g. for tree-sitter WASM init). Reserved on the
44
+ * contract for adapters that need a one-time async init pass. No bundled
45
+ * adapter declares it today and the CLI bootstrap does NOT invoke it yet —
46
+ * treat it as forward-compatible: a future adapter can opt in without a
47
+ * contract change.
48
+ */
49
+ warmup?(): Promise<void>;
50
+ /**
51
+ * Optional workspace discovery. When implemented, returns the units
52
+ * the `graph --workspace` fan-out should target — one TS package per
53
+ * tsconfig.json, one Cargo member per `[workspace.members]` entry, etc.
54
+ *
55
+ * Adapters that have no workspace concept (or haven't implemented this
56
+ * yet) omit the method; the CLI treats absence as an empty list. If
57
+ * every detected adapter omits it AND the user passes `--workspace`,
58
+ * the CLI errors with a message naming the language(s).
59
+ *
60
+ * `rootDir` is the absolute project root (the CLI's `--cwd` or
61
+ * detection root). Implementations MUST return absolute paths in
62
+ * `rootDir`; relative paths break the spawn step downstream.
63
+ */
64
+ discoverWorkspaceUnits?(rootDir: string): Promise<readonly WorkspaceUnit[]>;
65
+ }
66
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/languages/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAC5C,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IAC9D,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,MAAM,EAAE,CAAC;IAC5C,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,EAAE,CAAC;IACzD,kBAAkB,CAChB,IAAI,EAAE,KAAK,GACV,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,EAAE,CAAC;IACtE,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;IAChD,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IAC/D,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,yFAAyF;IACzF,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAEvD,sEAAsE;IACtE,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtC,iFAAiF;IACjF,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvC,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,sBAAsB,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC;CAC7E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/languages/adapter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @fileoverview Adapter-driven content filter dispatch.
3
+ *
4
+ * Resolves the LanguageAdapter for a file's extension and applies its
5
+ * stripStrings or stripComments method. Falls back to returning content
6
+ * unchanged when no adapter is registered for the extension.
7
+ *
8
+ * This is the boundary that lets cross-language checks (in
9
+ * @opensip-cli/checks-universal and similar) consume "code only,
10
+ * strings stripped" or "code only, strings + comments stripped" without
11
+ * knowing which language a file is in.
12
+ */
13
+ /**
14
+ * Test-only reset of the one-shot degradation-warning guard. Production never
15
+ * calls this; tests use it to assert the warn-once behavior deterministically
16
+ * regardless of cross-test ordering.
17
+ */
18
+ export declare function resetContentFilterWarningForTests(): void;
19
+ /**
20
+ * Content filter modes a check can request:
21
+ * - 'raw' / 'none': pass content through unchanged
22
+ * - 'strip-strings': string literal content replaced with whitespace
23
+ * - 'strip-strings-and-comments': both string literals and comments replaced
24
+ */
25
+ export type ContentFilterMode = 'strip-strings' | 'strip-strings-and-comments' | 'none' | 'raw';
26
+ /**
27
+ * Apply a content filter to file content, dispatching to the
28
+ * LanguageAdapter that owns the file extension.
29
+ *
30
+ * When no adapter is registered for the file's extension, returns
31
+ * the raw content unchanged. This preserves backward compatibility:
32
+ * callers that previously processed unknown-language files (JSON,
33
+ * YAML, plain text) keep getting raw content rather than crashing.
34
+ */
35
+ export declare function applyContentFilter(filePath: string, content: string, mode: ContentFilterMode): string;
36
+ //# sourceMappingURL=content-filter-dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-filter-dispatch.d.ts","sourceRoot":"","sources":["../../src/languages/content-filter-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH;;;;GAIG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,4BAA4B,GAAG,MAAM,GAAG,KAAK,CAAC;AAEhG;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,iBAAiB,GACtB,MAAM,CAqCR"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @fileoverview Adapter-driven content filter dispatch.
3
+ *
4
+ * Resolves the LanguageAdapter for a file's extension and applies its
5
+ * stripStrings or stripComments method. Falls back to returning content
6
+ * unchanged when no adapter is registered for the extension.
7
+ *
8
+ * This is the boundary that lets cross-language checks (in
9
+ * @opensip-cli/checks-universal and similar) consume "code only,
10
+ * strings stripped" or "code only, strings + comments stripped" without
11
+ * knowing which language a file is in.
12
+ */
13
+ import { logger } from '../lib/logger.js';
14
+ import { currentScope } from '../lib/run-scope.js';
15
+ /**
16
+ * One-shot guard so the degradation warning fires at most once per process.
17
+ * The condition is process-global (a missing scope or duplicate core affects
18
+ * every subsequent call identically), so repeating the warning adds only noise.
19
+ */
20
+ let warnedFilterDegraded = false;
21
+ /**
22
+ * Test-only reset of the one-shot degradation-warning guard. Production never
23
+ * calls this; tests use it to assert the warn-once behavior deterministically
24
+ * regardless of cross-test ordering.
25
+ */
26
+ export function resetContentFilterWarningForTests() {
27
+ warnedFilterDegraded = false;
28
+ }
29
+ /**
30
+ * Apply a content filter to file content, dispatching to the
31
+ * LanguageAdapter that owns the file extension.
32
+ *
33
+ * When no adapter is registered for the file's extension, returns
34
+ * the raw content unchanged. This preserves backward compatibility:
35
+ * callers that previously processed unknown-language files (JSON,
36
+ * YAML, plain text) keep getting raw content rather than crashing.
37
+ */
38
+ export function applyContentFilter(filePath, content, mode) {
39
+ if (mode === 'none' || mode === 'raw')
40
+ return content;
41
+ const scope = currentScope();
42
+ if (!scope) {
43
+ // No active RunScope at all. Two cases land here:
44
+ // 1. A unit test calling `check.run` directly (documented, benign).
45
+ // 2. A DUPLICATE @opensip-cli/core instance — the engine DID call
46
+ // runWithScope, but on a different core copy than the one running
47
+ // this code, so its AsyncLocalStorage store is invisible here. This
48
+ // happens when a globally-installed CLI loads check packs from a
49
+ // project that also vendors @opensip-cli packages.
50
+ // Either way we can't strip safely, so we degrade to raw — but a check
51
+ // that asked for stripping and silently gets raw will match patterns
52
+ // inside string literals/comments (false positives). Warn once so the
53
+ // degradation is observable instead of mysterious. (Case 2 is also
54
+ // refused outright at pack-load time; see discovery's single-core guard.)
55
+ if (!warnedFilterDegraded) {
56
+ warnedFilterDegraded = true;
57
+ logger.warn('content filter degraded to raw — no active run scope', {
58
+ evt: 'core.content_filter.degraded',
59
+ module: 'core:content-filter',
60
+ mode,
61
+ hint: 'A check requested string/comment stripping but no RunScope is active. If you are running a globally-installed opensip-cli inside a project that also installs @opensip-cli packages, duplicate core instances split the scope — prefer the project-local CLI (e.g. `pnpm fit`). Results may contain false positives.',
62
+ });
63
+ }
64
+ return content;
65
+ }
66
+ const adapter = scope.languages.forFile(filePath);
67
+ if (!adapter) {
68
+ // Scope is present but no adapter owns this extension — a genuinely
69
+ // unknown language (JSON/YAML/plain text). Returning raw is correct and
70
+ // expected here, so this path stays silent.
71
+ return content;
72
+ }
73
+ return mode === 'strip-strings' ? adapter.stripStrings(content) : adapter.stripComments(content);
74
+ }
75
+ //# sourceMappingURL=content-filter-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-filter-dispatch.js","sourceRoot":"","sources":["../../src/languages/content-filter-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;GAIG;AACH,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,iCAAiC;IAC/C,oBAAoB,GAAG,KAAK,CAAC;AAC/B,CAAC;AAUD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,OAAe,EACf,IAAuB;IAEvB,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,OAAO,CAAC;IAEtD,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,kDAAkD;QAClD,sEAAsE;QACtE,oEAAoE;QACpE,uEAAuE;QACvE,yEAAyE;QACzE,sEAAsE;QACtE,wDAAwD;QACxD,uEAAuE;QACvE,qEAAqE;QACrE,sEAAsE;QACtE,mEAAmE;QACnE,0EAA0E;QAC1E,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,oBAAoB,GAAG,IAAI,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,sDAAsD,EAAE;gBAClE,GAAG,EAAE,8BAA8B;gBACnC,MAAM,EAAE,qBAAqB;gBAC7B,IAAI;gBACJ,IAAI,EAAE,sTAAsT;aAC7T,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,oEAAoE;QACpE,wEAAwE;QACxE,4CAA4C;QAC5C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACnG,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** Shared types used by the cross-language query API. */
2
+ export interface Location {
3
+ readonly file: string;
4
+ readonly line: number;
5
+ readonly column: number;
6
+ }
7
+ /** Cross-language import descriptor: specifier, imported names, and source location. */
8
+ export interface Import {
9
+ /** The import specifier as written in source (e.g. './foo', 'std::fs', '"fmt"') */
10
+ readonly specifier: string;
11
+ /** Imported names where the language supports named imports; empty otherwise */
12
+ readonly names: readonly string[];
13
+ readonly location: Location;
14
+ }
15
+ /** Cross-language function descriptor parameterised by the adapter's native AST node type. */
16
+ export interface GenericFunction<TNode> {
17
+ readonly name: string | null;
18
+ readonly location: Location;
19
+ /** The native AST node, opaque to core */
20
+ readonly node: TNode;
21
+ }
22
+ //# sourceMappingURL=generic-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-types.d.ts","sourceRoot":"","sources":["../../src/languages/generic-types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wFAAwF;AACxF,MAAM,WAAW,MAAM;IACrB,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,8FAA8F;AAC9F,MAAM,WAAW,eAAe,CAAC,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ /** Shared types used by the cross-language query API. */
2
+ export {};
3
+ //# sourceMappingURL=generic-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-types.js","sourceRoot":"","sources":["../../src/languages/generic-types.ts"],"names":[],"mappings":"AAAA,yDAAyD"}
@@ -0,0 +1,12 @@
1
+ export type { LanguageAdapter, LanguageQueryAPI } from './adapter.js';
2
+ export type { GenericFunction, Import, Location } from './generic-types.js';
3
+ export type { WorkspaceUnit } from './workspace-unit.js';
4
+ export { LanguageRegistry } from './registry.js';
5
+ export { LanguageParseCache, initParseCache, clearParseCache, getParseTree, getParseTreeForFile, } from './parse-cache.js';
6
+ export { applyContentFilter, type ContentFilterMode } from './content-filter-dispatch.js';
7
+ export { RECOGNIZED_NON_CODE_FORMATS, isRecognizedNonCodeFormat } from './non-code-formats.js';
8
+ export { applyRegions, buildLineStarts, isIdentChar, makeStripper, scanBlockCommentNesting, scanBlockCommentNonNesting, scanCharLiteral, scanLineComment, scanRegularString, } from './strip-utils.js';
9
+ export type { Region, RegStrResult, ScanResult, Stripper, ScanCharLiteralOptions, ScanCharLiteralResult, ScanCommentResult, ScanLineCommentOptions, ScanNestingBlockCommentResult, ScanRegularStringOptions, } from './strip-utils.js';
10
+ export { buildMinimalTextTree } from './text-tree.js';
11
+ export type { MinimalTextTree } from './text-tree.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/languages/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC5E,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { LanguageRegistry } from './registry.js';
2
+ export { LanguageParseCache, initParseCache, clearParseCache, getParseTree, getParseTreeForFile, } from './parse-cache.js';
3
+ export { applyContentFilter } from './content-filter-dispatch.js';
4
+ export { RECOGNIZED_NON_CODE_FORMATS, isRecognizedNonCodeFormat } from './non-code-formats.js';
5
+ export { applyRegions, buildLineStarts, isIdentChar, makeStripper, scanBlockCommentNesting, scanBlockCommentNonNesting, scanCharLiteral, scanLineComment, scanRegularString, } from './strip-utils.js';
6
+ export { buildMinimalTextTree } from './text-tree.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/languages/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAA0B,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @fileoverview Recognized non-code format tags.
3
+ *
4
+ * The `languages:` field on a target (and the matching `scope.languages`
5
+ * on a check) is a *matching dimension* — it routes files to checks via
6
+ * `findByScope`. A SUBSET of those tags also have a registered
7
+ * {@link LanguageAdapter} that can parse the file and strip its
8
+ * strings/comments for content-aware checks.
9
+ *
10
+ * Structured-data and markup formats (JSON, YAML, Markdown, …) are
11
+ * legitimate matching tags but have NO adapter by design: there is no
12
+ * meaningful "strip strings/comments" pass for them (stripping JSON
13
+ * "strings" would blank out object keys that checks like
14
+ * `cluster-coupling` and `table-access-ownership` match on), so the
15
+ * content filter correctly returns them raw.
16
+ *
17
+ * This set names those intentional adapter-less tags so config
18
+ * validation can tell them apart from a genuine typo. A target declaring
19
+ * `languages: ['json']` is fine; `languages: ['pythonn']` is a mistake.
20
+ */
21
+ /**
22
+ * Format tags that are valid `languages:` matching tags but intentionally
23
+ * have no content-filter adapter. Files in these formats scan as raw
24
+ * content — there is nothing to strip.
25
+ *
26
+ * Lowercase, canonical. Extend this set when a new adapter-less format
27
+ * tag becomes a legitimate scope dimension (the alternative is to ship a
28
+ * real {@link LanguageAdapter} for it).
29
+ */
30
+ export declare const RECOGNIZED_NON_CODE_FORMATS: ReadonlySet<string>;
31
+ /**
32
+ * True when `tag` is a recognized non-code format — a valid scope tag
33
+ * that has no content-filter adapter by design. Comparison is
34
+ * case-insensitive.
35
+ */
36
+ export declare function isRecognizedNonCodeFormat(tag: string): boolean;
37
+ //# sourceMappingURL=non-code-formats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-code-formats.d.ts","sourceRoot":"","sources":["../../src/languages/non-code-formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAM1D,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9D"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @fileoverview Recognized non-code format tags.
3
+ *
4
+ * The `languages:` field on a target (and the matching `scope.languages`
5
+ * on a check) is a *matching dimension* — it routes files to checks via
6
+ * `findByScope`. A SUBSET of those tags also have a registered
7
+ * {@link LanguageAdapter} that can parse the file and strip its
8
+ * strings/comments for content-aware checks.
9
+ *
10
+ * Structured-data and markup formats (JSON, YAML, Markdown, …) are
11
+ * legitimate matching tags but have NO adapter by design: there is no
12
+ * meaningful "strip strings/comments" pass for them (stripping JSON
13
+ * "strings" would blank out object keys that checks like
14
+ * `cluster-coupling` and `table-access-ownership` match on), so the
15
+ * content filter correctly returns them raw.
16
+ *
17
+ * This set names those intentional adapter-less tags so config
18
+ * validation can tell them apart from a genuine typo. A target declaring
19
+ * `languages: ['json']` is fine; `languages: ['pythonn']` is a mistake.
20
+ */
21
+ /**
22
+ * Format tags that are valid `languages:` matching tags but intentionally
23
+ * have no content-filter adapter. Files in these formats scan as raw
24
+ * content — there is nothing to strip.
25
+ *
26
+ * Lowercase, canonical. Extend this set when a new adapter-less format
27
+ * tag becomes a legitimate scope dimension (the alternative is to ship a
28
+ * real {@link LanguageAdapter} for it).
29
+ */
30
+ export const RECOGNIZED_NON_CODE_FORMATS = new Set([
31
+ 'json',
32
+ 'yaml',
33
+ 'markdown',
34
+ 'toml',
35
+ 'plaintext',
36
+ ]);
37
+ /**
38
+ * True when `tag` is a recognized non-code format — a valid scope tag
39
+ * that has no content-filter adapter by design. Comparison is
40
+ * case-insensitive.
41
+ */
42
+ export function isRecognizedNonCodeFormat(tag) {
43
+ return RECOGNIZED_NON_CODE_FORMATS.has(tag.toLowerCase());
44
+ }
45
+ //# sourceMappingURL=non-code-formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-code-formats.js","sourceRoot":"","sources":["../../src/languages/non-code-formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC;IACtE,MAAM;IACN,MAAM;IACN,UAAU;IACV,MAAM;IACN,WAAW;CACZ,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,OAAO,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @fileoverview `LanguageParseCache` class definition.
3
+ *
4
+ * Lives in its own module so `RunScope` (which holds a default
5
+ * `LanguageParseCache` instance) and the module-level helpers in
6
+ * `parse-cache.ts` (which read `currentScope()`) don't form an
7
+ * import cycle. The class has zero deps on `run-scope.ts`; the helpers
8
+ * import the class from here, and `run-scope.ts` also imports the
9
+ * class from here.
10
+ */
11
+ import type { LanguageAdapter } from './adapter.js';
12
+ /**
13
+ * Fast content fingerprint for the parse-cache key (FNV-1a 64-bit over the FULL
14
+ * content + length). Distinguishes raw source from same-length filtered variants
15
+ * (`filterContent` blanks string/comment regions to spaces, preserving length),
16
+ * so an AST check that needs raw source never receives a strings-stripped tree.
17
+ *
18
+ * 64-bit (vs prior 32-bit) materially reduces the chance of a silent collision
19
+ * between two *different* files of the same length under the same language
20
+ * adapter (the path component helps, but same-length generated/index/etc files
21
+ * are common in real trees). The hash is still cheap O(n) relative to parsing.
22
+ * The trailing length suffix provides an extra guard.
23
+ */
24
+ export declare function fingerprintContent(content: string): string;
25
+ /**
26
+ * Per-instance parse cache. Each instance owns its own parse-tree
27
+ * `Map`, a sibling `filteredContent` `Map` (for language-specific
28
+ * filtered-content caching keyed by raw content), and (optionally) an
29
+ * auto-clear timer that fires `AUTO_CLEAR_MS` after the cache is
30
+ * started.
31
+ *
32
+ * The two maps live together because they share the same lifecycle —
33
+ * a fresh run starts both at empty, a `dispose()` clears both, and the
34
+ * auto-clear timer drops both. The maps use different keys (parse-tree
35
+ * map is keyed by adapter+filePath+fingerprint; filtered-content map
36
+ * is keyed by raw content) because the two upstream call paths use
37
+ * different identities.
38
+ */
39
+ export declare class LanguageParseCache {
40
+ private readonly cache;
41
+ /**
42
+ * Language-specific filtered-content cache. Keyed by raw content
43
+ * string (no adapter or file path prefix) because the
44
+ * `filterContent(content)` API in `@opensip-cli/lang-typescript`
45
+ * is content-only. Phase 6 Task 6.4 moved this off a separate
46
+ * module-level Map; the merge is by lifecycle, not by key shape.
47
+ */
48
+ readonly filteredContent: Map<string, unknown>;
49
+ private autoClearTimer;
50
+ /**
51
+ * Start the auto-clear timer. Calling this twice resets the timer.
52
+ * Production code goes through `initParseCache()` (which targets the
53
+ * module-level instance); tests call this directly on a fresh
54
+ * instance. The timer is `unref`'d so it doesn't keep the process
55
+ * alive; `dispose()` clears it deterministically.
56
+ */
57
+ startAutoClear(): void;
58
+ getOrParse<TTree>(adapter: LanguageAdapter<TTree>, filePath: string, content: string): TTree | null;
59
+ clear(): void;
60
+ /**
61
+ * Clear the cache and any pending auto-clear timer. Tests that
62
+ * construct a fresh `LanguageParseCache()` should call `dispose()`
63
+ * before the test exits so the runner doesn't see a lingering
64
+ * timer handle.
65
+ */
66
+ dispose(): void;
67
+ get size(): number;
68
+ }
69
+ //# sourceMappingURL=parse-cache-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-cache-class.d.ts","sourceRoot":"","sources":["../../src/languages/parse-cache-class.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AASpD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsB1D;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,uBAA8B;IACtD,OAAO,CAAC,cAAc,CAA8C;IAEpE;;;;;;OAMG;IACH,cAAc,IAAI,IAAI;IAUtB,UAAU,CAAC,KAAK,EACd,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,KAAK,GAAG,IAAI;IAmBf,KAAK,IAAI,IAAI;IAKb;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IASf,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,135 @@
1
+ // @fitness-ignore-file toctou-race-condition -- synchronous Map.get/set in single-threaded Node.js runtime; no async gap between read and write
2
+ /**
3
+ * @fileoverview `LanguageParseCache` class definition.
4
+ *
5
+ * Lives in its own module so `RunScope` (which holds a default
6
+ * `LanguageParseCache` instance) and the module-level helpers in
7
+ * `parse-cache.ts` (which read `currentScope()`) don't form an
8
+ * import cycle. The class has zero deps on `run-scope.ts`; the helpers
9
+ * import the class from here, and `run-scope.ts` also imports the
10
+ * class from here.
11
+ */
12
+ // 10 minutes — the cache is regenerated on every fitness run, so 10
13
+ // minutes of staleness is the worst case for a check author who edits
14
+ // a source file between runs in a long-lived process. Short enough to
15
+ // avoid serving a tree that no longer matches the file on disk; long
16
+ // enough that consecutive runs in a watch loop hit the cache.
17
+ const AUTO_CLEAR_MS = 10 * 60 * 1000;
18
+ /**
19
+ * Fast content fingerprint for the parse-cache key (FNV-1a 64-bit over the FULL
20
+ * content + length). Distinguishes raw source from same-length filtered variants
21
+ * (`filterContent` blanks string/comment regions to spaces, preserving length),
22
+ * so an AST check that needs raw source never receives a strings-stripped tree.
23
+ *
24
+ * 64-bit (vs prior 32-bit) materially reduces the chance of a silent collision
25
+ * between two *different* files of the same length under the same language
26
+ * adapter (the path component helps, but same-length generated/index/etc files
27
+ * are common in real trees). The hash is still cheap O(n) relative to parsing.
28
+ * The trailing length suffix provides an extra guard.
29
+ */
30
+ export function fingerprintContent(content) {
31
+ // FNV-1a 64-bit constants (big-endian words not needed; BigInt keeps it simple
32
+ // and portable, and this is only used for cache keys).
33
+ const FNV_OFFSET = 0xcbf29ce484222325n;
34
+ const FNV_PRIME = 0x100000001b3n;
35
+ let hash = FNV_OFFSET;
36
+ // Iterate over Unicode code points (not UTF-16 code units). String iteration
37
+ // (`for...of`) yields full code points, correctly handling surrogate pairs
38
+ // (astral-plane characters such as emoji, certain CJK, mathematical symbols, etc.).
39
+ // Using codePointAt on individual code units previously produced incorrect
40
+ // fingerprints (and thus wrong/missed cache hits) for any content containing
41
+ // characters outside the BMP.
42
+ for (const char of content) {
43
+ const cp = char.codePointAt(0) ?? 0;
44
+ hash ^= BigInt(cp);
45
+ hash = (hash * FNV_PRIME) & 0xffffffffffffffffn; // keep to 64 bits
46
+ }
47
+ // toString(36) is compact; prefix with 'f64:' so readers know the scheme.
48
+ // The length suffix is intentionally UTF-16 code-unit length (content.length)
49
+ // for compatibility with filterContent (same-length string/comment blanks).
50
+ return `f64:${hash.toString(36)}:${String(content.length)}`;
51
+ }
52
+ /**
53
+ * Per-instance parse cache. Each instance owns its own parse-tree
54
+ * `Map`, a sibling `filteredContent` `Map` (for language-specific
55
+ * filtered-content caching keyed by raw content), and (optionally) an
56
+ * auto-clear timer that fires `AUTO_CLEAR_MS` after the cache is
57
+ * started.
58
+ *
59
+ * The two maps live together because they share the same lifecycle —
60
+ * a fresh run starts both at empty, a `dispose()` clears both, and the
61
+ * auto-clear timer drops both. The maps use different keys (parse-tree
62
+ * map is keyed by adapter+filePath+fingerprint; filtered-content map
63
+ * is keyed by raw content) because the two upstream call paths use
64
+ * different identities.
65
+ */
66
+ export class LanguageParseCache {
67
+ cache = new Map();
68
+ /**
69
+ * Language-specific filtered-content cache. Keyed by raw content
70
+ * string (no adapter or file path prefix) because the
71
+ * `filterContent(content)` API in `@opensip-cli/lang-typescript`
72
+ * is content-only. Phase 6 Task 6.4 moved this off a separate
73
+ * module-level Map; the merge is by lifecycle, not by key shape.
74
+ */
75
+ filteredContent = new Map();
76
+ autoClearTimer = null;
77
+ /**
78
+ * Start the auto-clear timer. Calling this twice resets the timer.
79
+ * Production code goes through `initParseCache()` (which targets the
80
+ * module-level instance); tests call this directly on a fresh
81
+ * instance. The timer is `unref`'d so it doesn't keep the process
82
+ * alive; `dispose()` clears it deterministically.
83
+ */
84
+ startAutoClear() {
85
+ if (this.autoClearTimer)
86
+ clearTimeout(this.autoClearTimer);
87
+ this.autoClearTimer = setTimeout(() => {
88
+ this.cache.clear();
89
+ this.filteredContent.clear();
90
+ this.autoClearTimer = null;
91
+ }, AUTO_CLEAR_MS);
92
+ this.autoClearTimer.unref();
93
+ }
94
+ getOrParse(adapter, filePath, content) {
95
+ // Cache key fingerprints the FULL content so raw and code-only-filtered
96
+ // variants of the same file never collide. `filterContent` replaces stripped
97
+ // regions (string/comment text) with same-length spaces, so neither
98
+ // `content.length` nor a first-N-chars sample distinguishes them when the
99
+ // divergence is later in the file — a sampled key let an AST check that
100
+ // needs raw source receive a strings-stripped tree (blanked module
101
+ // specifiers), nondeterministically by check order. A full-content hash is
102
+ // cheap relative to parsing and removes that cross-contamination.
103
+ const key = `${adapter.id}:${filePath}:${fingerprintContent(content)}`;
104
+ const cached = this.cache.get(key);
105
+ if (cached !== undefined)
106
+ return cached;
107
+ const tree = adapter.parse(content, filePath);
108
+ if (tree === null)
109
+ return null;
110
+ this.cache.set(key, tree);
111
+ return tree;
112
+ }
113
+ clear() {
114
+ this.cache.clear();
115
+ this.filteredContent.clear();
116
+ }
117
+ /**
118
+ * Clear the cache and any pending auto-clear timer. Tests that
119
+ * construct a fresh `LanguageParseCache()` should call `dispose()`
120
+ * before the test exits so the runner doesn't see a lingering
121
+ * timer handle.
122
+ */
123
+ dispose() {
124
+ this.cache.clear();
125
+ this.filteredContent.clear();
126
+ if (this.autoClearTimer) {
127
+ clearTimeout(this.autoClearTimer);
128
+ this.autoClearTimer = null;
129
+ }
130
+ }
131
+ get size() {
132
+ return this.cache.size;
133
+ }
134
+ }
135
+ //# sourceMappingURL=parse-cache-class.js.map