@opensip-tools/fitness 1.0.4

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 (461) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/LICENSE +21 -0
  4. package/dist/__tests__/gate.test.d.ts +13 -0
  5. package/dist/__tests__/gate.test.d.ts.map +1 -0
  6. package/dist/__tests__/gate.test.js +422 -0
  7. package/dist/__tests__/gate.test.js.map +1 -0
  8. package/dist/__tests__/sarif.test.d.ts +2 -0
  9. package/dist/__tests__/sarif.test.d.ts.map +1 -0
  10. package/dist/__tests__/sarif.test.js +169 -0
  11. package/dist/__tests__/sarif.test.js.map +1 -0
  12. package/dist/cli/dashboard.d.ts +6 -0
  13. package/dist/cli/dashboard.d.ts.map +1 -0
  14. package/dist/cli/dashboard.js +77 -0
  15. package/dist/cli/dashboard.js.map +1 -0
  16. package/dist/cli/fit.d.ts +37 -0
  17. package/dist/cli/fit.d.ts.map +1 -0
  18. package/dist/cli/fit.js +539 -0
  19. package/dist/cli/fit.js.map +1 -0
  20. package/dist/cli/list-checks.d.ts +6 -0
  21. package/dist/cli/list-checks.d.ts.map +1 -0
  22. package/dist/cli/list-checks.js +23 -0
  23. package/dist/cli/list-checks.js.map +1 -0
  24. package/dist/cli/list-recipes.d.ts +6 -0
  25. package/dist/cli/list-recipes.d.ts.map +1 -0
  26. package/dist/cli/list-recipes.js +31 -0
  27. package/dist/cli/list-recipes.js.map +1 -0
  28. package/dist/framework/__tests__/ast-utilities.test.d.ts +2 -0
  29. package/dist/framework/__tests__/ast-utilities.test.d.ts.map +1 -0
  30. package/dist/framework/__tests__/ast-utilities.test.js +153 -0
  31. package/dist/framework/__tests__/ast-utilities.test.js.map +1 -0
  32. package/dist/framework/__tests__/check-config.test.d.ts +2 -0
  33. package/dist/framework/__tests__/check-config.test.d.ts.map +1 -0
  34. package/dist/framework/__tests__/check-config.test.js +56 -0
  35. package/dist/framework/__tests__/check-config.test.js.map +1 -0
  36. package/dist/framework/__tests__/command-executor.test.d.ts +2 -0
  37. package/dist/framework/__tests__/command-executor.test.d.ts.map +1 -0
  38. package/dist/framework/__tests__/command-executor.test.js +71 -0
  39. package/dist/framework/__tests__/command-executor.test.js.map +1 -0
  40. package/dist/framework/__tests__/content-filter-dispatch.test.d.ts +2 -0
  41. package/dist/framework/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
  42. package/dist/framework/__tests__/content-filter-dispatch.test.js +104 -0
  43. package/dist/framework/__tests__/content-filter-dispatch.test.js.map +1 -0
  44. package/dist/framework/__tests__/content-filter.test.d.ts +2 -0
  45. package/dist/framework/__tests__/content-filter.test.d.ts.map +1 -0
  46. package/dist/framework/__tests__/content-filter.test.js +126 -0
  47. package/dist/framework/__tests__/content-filter.test.js.map +1 -0
  48. package/dist/framework/__tests__/define-check.test.d.ts +2 -0
  49. package/dist/framework/__tests__/define-check.test.d.ts.map +1 -0
  50. package/dist/framework/__tests__/define-check.test.js +155 -0
  51. package/dist/framework/__tests__/define-check.test.js.map +1 -0
  52. package/dist/framework/__tests__/directive-inventory.test.d.ts +2 -0
  53. package/dist/framework/__tests__/directive-inventory.test.d.ts.map +1 -0
  54. package/dist/framework/__tests__/directive-inventory.test.js +44 -0
  55. package/dist/framework/__tests__/directive-inventory.test.js.map +1 -0
  56. package/dist/framework/__tests__/execution-context.test.d.ts +2 -0
  57. package/dist/framework/__tests__/execution-context.test.d.ts.map +1 -0
  58. package/dist/framework/__tests__/execution-context.test.js +62 -0
  59. package/dist/framework/__tests__/execution-context.test.js.map +1 -0
  60. package/dist/framework/__tests__/file-accessor.test.d.ts +2 -0
  61. package/dist/framework/__tests__/file-accessor.test.d.ts.map +1 -0
  62. package/dist/framework/__tests__/file-accessor.test.js +106 -0
  63. package/dist/framework/__tests__/file-accessor.test.js.map +1 -0
  64. package/dist/framework/__tests__/file-cache.test.d.ts +2 -0
  65. package/dist/framework/__tests__/file-cache.test.d.ts.map +1 -0
  66. package/dist/framework/__tests__/file-cache.test.js +122 -0
  67. package/dist/framework/__tests__/file-cache.test.js.map +1 -0
  68. package/dist/framework/__tests__/import-graph.test.d.ts +15 -0
  69. package/dist/framework/__tests__/import-graph.test.d.ts.map +1 -0
  70. package/dist/framework/__tests__/import-graph.test.js +164 -0
  71. package/dist/framework/__tests__/import-graph.test.js.map +1 -0
  72. package/dist/framework/__tests__/path-matcher.test.d.ts +2 -0
  73. package/dist/framework/__tests__/path-matcher.test.d.ts.map +1 -0
  74. package/dist/framework/__tests__/path-matcher.test.js +113 -0
  75. package/dist/framework/__tests__/path-matcher.test.js.map +1 -0
  76. package/dist/framework/__tests__/register-helpers.test.d.ts +2 -0
  77. package/dist/framework/__tests__/register-helpers.test.d.ts.map +1 -0
  78. package/dist/framework/__tests__/register-helpers.test.js +42 -0
  79. package/dist/framework/__tests__/register-helpers.test.js.map +1 -0
  80. package/dist/framework/__tests__/registry.test.d.ts +2 -0
  81. package/dist/framework/__tests__/registry.test.d.ts.map +1 -0
  82. package/dist/framework/__tests__/registry.test.js +208 -0
  83. package/dist/framework/__tests__/registry.test.js.map +1 -0
  84. package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
  85. package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
  86. package/dist/framework/__tests__/result-builder.test.js +153 -0
  87. package/dist/framework/__tests__/result-builder.test.js.map +1 -0
  88. package/dist/framework/__tests__/scope-resolver.test.d.ts +2 -0
  89. package/dist/framework/__tests__/scope-resolver.test.d.ts.map +1 -0
  90. package/dist/framework/__tests__/scope-resolver.test.js +140 -0
  91. package/dist/framework/__tests__/scope-resolver.test.js.map +1 -0
  92. package/dist/framework/__tests__/severity-mapping.test.d.ts +2 -0
  93. package/dist/framework/__tests__/severity-mapping.test.d.ts.map +1 -0
  94. package/dist/framework/__tests__/severity-mapping.test.js +42 -0
  95. package/dist/framework/__tests__/severity-mapping.test.js.map +1 -0
  96. package/dist/framework/__tests__/strip-literals.test.d.ts +2 -0
  97. package/dist/framework/__tests__/strip-literals.test.d.ts.map +1 -0
  98. package/dist/framework/__tests__/strip-literals.test.js +87 -0
  99. package/dist/framework/__tests__/strip-literals.test.js.map +1 -0
  100. package/dist/framework/abortable-exec.d.ts +34 -0
  101. package/dist/framework/abortable-exec.d.ts.map +1 -0
  102. package/dist/framework/abortable-exec.js +136 -0
  103. package/dist/framework/abortable-exec.js.map +1 -0
  104. package/dist/framework/ast-utilities.d.ts +41 -0
  105. package/dist/framework/ast-utilities.d.ts.map +1 -0
  106. package/dist/framework/ast-utilities.js +106 -0
  107. package/dist/framework/ast-utilities.js.map +1 -0
  108. package/dist/framework/check-config.d.ts +171 -0
  109. package/dist/framework/check-config.d.ts.map +1 -0
  110. package/dist/framework/check-config.js +114 -0
  111. package/dist/framework/check-config.js.map +1 -0
  112. package/dist/framework/check-types.d.ts +57 -0
  113. package/dist/framework/check-types.d.ts.map +1 -0
  114. package/dist/framework/check-types.js +35 -0
  115. package/dist/framework/check-types.js.map +1 -0
  116. package/dist/framework/command-executor.d.ts +25 -0
  117. package/dist/framework/command-executor.d.ts.map +1 -0
  118. package/dist/framework/command-executor.js +63 -0
  119. package/dist/framework/command-executor.js.map +1 -0
  120. package/dist/framework/constants.d.ts +9 -0
  121. package/dist/framework/constants.d.ts.map +1 -0
  122. package/dist/framework/constants.js +16 -0
  123. package/dist/framework/constants.js.map +1 -0
  124. package/dist/framework/content-filter.d.ts +33 -0
  125. package/dist/framework/content-filter.d.ts.map +1 -0
  126. package/dist/framework/content-filter.js +236 -0
  127. package/dist/framework/content-filter.js.map +1 -0
  128. package/dist/framework/define-check.d.ts +38 -0
  129. package/dist/framework/define-check.d.ts.map +1 -0
  130. package/dist/framework/define-check.js +252 -0
  131. package/dist/framework/define-check.js.map +1 -0
  132. package/dist/framework/directive-inventory.d.ts +34 -0
  133. package/dist/framework/directive-inventory.d.ts.map +1 -0
  134. package/dist/framework/directive-inventory.js +77 -0
  135. package/dist/framework/directive-inventory.js.map +1 -0
  136. package/dist/framework/directive-parsing.d.ts +20 -0
  137. package/dist/framework/directive-parsing.d.ts.map +1 -0
  138. package/dist/framework/directive-parsing.js +121 -0
  139. package/dist/framework/directive-parsing.js.map +1 -0
  140. package/dist/framework/execution-context.d.ts +95 -0
  141. package/dist/framework/execution-context.d.ts.map +1 -0
  142. package/dist/framework/execution-context.js +122 -0
  143. package/dist/framework/execution-context.js.map +1 -0
  144. package/dist/framework/file-accessor.d.ts +20 -0
  145. package/dist/framework/file-accessor.d.ts.map +1 -0
  146. package/dist/framework/file-accessor.js +122 -0
  147. package/dist/framework/file-accessor.js.map +1 -0
  148. package/dist/framework/file-cache.d.ts +70 -0
  149. package/dist/framework/file-cache.d.ts.map +1 -0
  150. package/dist/framework/file-cache.js +178 -0
  151. package/dist/framework/file-cache.js.map +1 -0
  152. package/dist/framework/file-type-filter.d.ts +11 -0
  153. package/dist/framework/file-type-filter.d.ts.map +1 -0
  154. package/dist/framework/file-type-filter.js +21 -0
  155. package/dist/framework/file-type-filter.js.map +1 -0
  156. package/dist/framework/ignore-processing.d.ts +22 -0
  157. package/dist/framework/ignore-processing.d.ts.map +1 -0
  158. package/dist/framework/ignore-processing.js +241 -0
  159. package/dist/framework/ignore-processing.js.map +1 -0
  160. package/dist/framework/import-graph.d.ts +51 -0
  161. package/dist/framework/import-graph.d.ts.map +1 -0
  162. package/dist/framework/import-graph.js +216 -0
  163. package/dist/framework/import-graph.js.map +1 -0
  164. package/dist/framework/memory-profiler.d.ts +53 -0
  165. package/dist/framework/memory-profiler.d.ts.map +1 -0
  166. package/dist/framework/memory-profiler.js +92 -0
  167. package/dist/framework/memory-profiler.js.map +1 -0
  168. package/dist/framework/parse-cache.d.ts +23 -0
  169. package/dist/framework/parse-cache.d.ts.map +1 -0
  170. package/dist/framework/parse-cache.js +37 -0
  171. package/dist/framework/parse-cache.js.map +1 -0
  172. package/dist/framework/path-matcher.d.ts +86 -0
  173. package/dist/framework/path-matcher.d.ts.map +1 -0
  174. package/dist/framework/path-matcher.js +138 -0
  175. package/dist/framework/path-matcher.js.map +1 -0
  176. package/dist/framework/register-helpers.d.ts +10 -0
  177. package/dist/framework/register-helpers.d.ts.map +1 -0
  178. package/dist/framework/register-helpers.js +17 -0
  179. package/dist/framework/register-helpers.js.map +1 -0
  180. package/dist/framework/registry.d.ts +41 -0
  181. package/dist/framework/registry.d.ts.map +1 -0
  182. package/dist/framework/registry.js +103 -0
  183. package/dist/framework/registry.js.map +1 -0
  184. package/dist/framework/result-builder.d.ts +74 -0
  185. package/dist/framework/result-builder.d.ts.map +1 -0
  186. package/dist/framework/result-builder.js +154 -0
  187. package/dist/framework/result-builder.js.map +1 -0
  188. package/dist/framework/scope-resolver.d.ts +23 -0
  189. package/dist/framework/scope-resolver.d.ts.map +1 -0
  190. package/dist/framework/scope-resolver.js +201 -0
  191. package/dist/framework/scope-resolver.js.map +1 -0
  192. package/dist/framework/severity-mapping.d.ts +13 -0
  193. package/dist/framework/severity-mapping.d.ts.map +1 -0
  194. package/dist/framework/severity-mapping.js +51 -0
  195. package/dist/framework/severity-mapping.js.map +1 -0
  196. package/dist/framework/strip-literals.d.ts +48 -0
  197. package/dist/framework/strip-literals.d.ts.map +1 -0
  198. package/dist/framework/strip-literals.js +188 -0
  199. package/dist/framework/strip-literals.js.map +1 -0
  200. package/dist/gate.d.ts +74 -0
  201. package/dist/gate.d.ts.map +1 -0
  202. package/dist/gate.js +257 -0
  203. package/dist/gate.js.map +1 -0
  204. package/dist/index.d.ts +47 -0
  205. package/dist/index.d.ts.map +1 -0
  206. package/dist/index.js +51 -0
  207. package/dist/index.js.map +1 -0
  208. package/dist/plugins/__tests__/check-package-discovery.test.d.ts +2 -0
  209. package/dist/plugins/__tests__/check-package-discovery.test.d.ts.map +1 -0
  210. package/dist/plugins/__tests__/check-package-discovery.test.js +170 -0
  211. package/dist/plugins/__tests__/check-package-discovery.test.js.map +1 -0
  212. package/dist/plugins/__tests__/lang-domain.test.d.ts +2 -0
  213. package/dist/plugins/__tests__/lang-domain.test.d.ts.map +1 -0
  214. package/dist/plugins/__tests__/lang-domain.test.js +171 -0
  215. package/dist/plugins/__tests__/lang-domain.test.js.map +1 -0
  216. package/dist/plugins/__tests__/loader.test.d.ts +2 -0
  217. package/dist/plugins/__tests__/loader.test.d.ts.map +1 -0
  218. package/dist/plugins/__tests__/loader.test.js +194 -0
  219. package/dist/plugins/__tests__/loader.test.js.map +1 -0
  220. package/dist/plugins/check-package-discovery.d.ts +73 -0
  221. package/dist/plugins/check-package-discovery.d.ts.map +1 -0
  222. package/dist/plugins/check-package-discovery.js +212 -0
  223. package/dist/plugins/check-package-discovery.js.map +1 -0
  224. package/dist/plugins/loader.d.ts +31 -0
  225. package/dist/plugins/loader.d.ts.map +1 -0
  226. package/dist/plugins/loader.js +290 -0
  227. package/dist/plugins/loader.js.map +1 -0
  228. package/dist/plugins/types.d.ts +23 -0
  229. package/dist/plugins/types.d.ts.map +1 -0
  230. package/dist/plugins/types.js +9 -0
  231. package/dist/plugins/types.js.map +1 -0
  232. package/dist/recipes/__tests__/built-in-recipes.test.d.ts +2 -0
  233. package/dist/recipes/__tests__/built-in-recipes.test.d.ts.map +1 -0
  234. package/dist/recipes/__tests__/built-in-recipes.test.js +93 -0
  235. package/dist/recipes/__tests__/built-in-recipes.test.js.map +1 -0
  236. package/dist/recipes/__tests__/check-config.test.d.ts +5 -0
  237. package/dist/recipes/__tests__/check-config.test.d.ts.map +1 -0
  238. package/dist/recipes/__tests__/check-config.test.js +37 -0
  239. package/dist/recipes/__tests__/check-config.test.js.map +1 -0
  240. package/dist/recipes/__tests__/check-resolution.test.d.ts +2 -0
  241. package/dist/recipes/__tests__/check-resolution.test.d.ts.map +1 -0
  242. package/dist/recipes/__tests__/check-resolution.test.js +135 -0
  243. package/dist/recipes/__tests__/check-resolution.test.js.map +1 -0
  244. package/dist/recipes/__tests__/registry.test.d.ts +2 -0
  245. package/dist/recipes/__tests__/registry.test.d.ts.map +1 -0
  246. package/dist/recipes/__tests__/registry.test.js +97 -0
  247. package/dist/recipes/__tests__/registry.test.js.map +1 -0
  248. package/dist/recipes/__tests__/retry.test.d.ts +2 -0
  249. package/dist/recipes/__tests__/retry.test.d.ts.map +1 -0
  250. package/dist/recipes/__tests__/retry.test.js +75 -0
  251. package/dist/recipes/__tests__/retry.test.js.map +1 -0
  252. package/dist/recipes/__tests__/service.test.d.ts +11 -0
  253. package/dist/recipes/__tests__/service.test.d.ts.map +1 -0
  254. package/dist/recipes/__tests__/service.test.js +482 -0
  255. package/dist/recipes/__tests__/service.test.js.map +1 -0
  256. package/dist/recipes/built-in-recipes.d.ts +14 -0
  257. package/dist/recipes/built-in-recipes.d.ts.map +1 -0
  258. package/dist/recipes/built-in-recipes.js +247 -0
  259. package/dist/recipes/built-in-recipes.js.map +1 -0
  260. package/dist/recipes/check-config.d.ts +40 -0
  261. package/dist/recipes/check-config.d.ts.map +1 -0
  262. package/dist/recipes/check-config.js +61 -0
  263. package/dist/recipes/check-config.js.map +1 -0
  264. package/dist/recipes/check-resolution.d.ts +21 -0
  265. package/dist/recipes/check-resolution.d.ts.map +1 -0
  266. package/dist/recipes/check-resolution.js +121 -0
  267. package/dist/recipes/check-resolution.js.map +1 -0
  268. package/dist/recipes/check-result-processor.d.ts +51 -0
  269. package/dist/recipes/check-result-processor.d.ts.map +1 -0
  270. package/dist/recipes/check-result-processor.js +158 -0
  271. package/dist/recipes/check-result-processor.js.map +1 -0
  272. package/dist/recipes/parallel-execution.d.ts +33 -0
  273. package/dist/recipes/parallel-execution.d.ts.map +1 -0
  274. package/dist/recipes/parallel-execution.js +142 -0
  275. package/dist/recipes/parallel-execution.js.map +1 -0
  276. package/dist/recipes/registry.d.ts +81 -0
  277. package/dist/recipes/registry.d.ts.map +1 -0
  278. package/dist/recipes/registry.js +131 -0
  279. package/dist/recipes/registry.js.map +1 -0
  280. package/dist/recipes/retry.d.ts +25 -0
  281. package/dist/recipes/retry.d.ts.map +1 -0
  282. package/dist/recipes/retry.js +44 -0
  283. package/dist/recipes/retry.js.map +1 -0
  284. package/dist/recipes/sequential-execution.d.ts +10 -0
  285. package/dist/recipes/sequential-execution.d.ts.map +1 -0
  286. package/dist/recipes/sequential-execution.js +122 -0
  287. package/dist/recipes/sequential-execution.js.map +1 -0
  288. package/dist/recipes/service-types.d.ts +84 -0
  289. package/dist/recipes/service-types.d.ts.map +1 -0
  290. package/dist/recipes/service-types.js +8 -0
  291. package/dist/recipes/service-types.js.map +1 -0
  292. package/dist/recipes/service.d.ts +71 -0
  293. package/dist/recipes/service.d.ts.map +1 -0
  294. package/dist/recipes/service.js +331 -0
  295. package/dist/recipes/service.js.map +1 -0
  296. package/dist/recipes/types.d.ts +154 -0
  297. package/dist/recipes/types.d.ts.map +1 -0
  298. package/dist/recipes/types.js +54 -0
  299. package/dist/recipes/types.js.map +1 -0
  300. package/dist/sarif.d.ts +34 -0
  301. package/dist/sarif.d.ts.map +1 -0
  302. package/dist/sarif.js +192 -0
  303. package/dist/sarif.js.map +1 -0
  304. package/dist/signalers/__tests__/loader.test.d.ts +2 -0
  305. package/dist/signalers/__tests__/loader.test.d.ts.map +1 -0
  306. package/dist/signalers/__tests__/loader.test.js +74 -0
  307. package/dist/signalers/__tests__/loader.test.js.map +1 -0
  308. package/dist/signalers/index.d.ts +8 -0
  309. package/dist/signalers/index.d.ts.map +1 -0
  310. package/dist/signalers/index.js +9 -0
  311. package/dist/signalers/index.js.map +1 -0
  312. package/dist/signalers/loader.d.ts +24 -0
  313. package/dist/signalers/loader.d.ts.map +1 -0
  314. package/dist/signalers/loader.js +108 -0
  315. package/dist/signalers/loader.js.map +1 -0
  316. package/dist/signalers/schema.d.ts +288 -0
  317. package/dist/signalers/schema.d.ts.map +1 -0
  318. package/dist/signalers/schema.js +99 -0
  319. package/dist/signalers/schema.js.map +1 -0
  320. package/dist/signalers/types.d.ts +13 -0
  321. package/dist/signalers/types.d.ts.map +1 -0
  322. package/dist/signalers/types.js +5 -0
  323. package/dist/signalers/types.js.map +1 -0
  324. package/dist/targets/__tests__/loader.test.d.ts +2 -0
  325. package/dist/targets/__tests__/loader.test.d.ts.map +1 -0
  326. package/dist/targets/__tests__/loader.test.js +127 -0
  327. package/dist/targets/__tests__/loader.test.js.map +1 -0
  328. package/dist/targets/__tests__/resolver.test.d.ts +2 -0
  329. package/dist/targets/__tests__/resolver.test.d.ts.map +1 -0
  330. package/dist/targets/__tests__/resolver.test.js +54 -0
  331. package/dist/targets/__tests__/resolver.test.js.map +1 -0
  332. package/dist/targets/__tests__/target-registry.test.d.ts +2 -0
  333. package/dist/targets/__tests__/target-registry.test.d.ts.map +1 -0
  334. package/dist/targets/__tests__/target-registry.test.js +89 -0
  335. package/dist/targets/__tests__/target-registry.test.js.map +1 -0
  336. package/dist/targets/index.d.ts +10 -0
  337. package/dist/targets/index.d.ts.map +1 -0
  338. package/dist/targets/index.js +12 -0
  339. package/dist/targets/index.js.map +1 -0
  340. package/dist/targets/loader.d.ts +19 -0
  341. package/dist/targets/loader.d.ts.map +1 -0
  342. package/dist/targets/loader.js +159 -0
  343. package/dist/targets/loader.js.map +1 -0
  344. package/dist/targets/resolver.d.ts +19 -0
  345. package/dist/targets/resolver.d.ts.map +1 -0
  346. package/dist/targets/resolver.js +37 -0
  347. package/dist/targets/resolver.js.map +1 -0
  348. package/dist/targets/target-registry.d.ts +61 -0
  349. package/dist/targets/target-registry.d.ts.map +1 -0
  350. package/dist/targets/target-registry.js +93 -0
  351. package/dist/targets/target-registry.js.map +1 -0
  352. package/dist/targets/types.d.ts +85 -0
  353. package/dist/targets/types.d.ts.map +1 -0
  354. package/dist/targets/types.js +5 -0
  355. package/dist/targets/types.js.map +1 -0
  356. package/dist/tool.d.ts +17 -0
  357. package/dist/tool.d.ts.map +1 -0
  358. package/dist/tool.js +282 -0
  359. package/dist/tool.js.map +1 -0
  360. package/dist/types/findings.d.ts +117 -0
  361. package/dist/types/findings.d.ts.map +1 -0
  362. package/dist/types/findings.js +93 -0
  363. package/dist/types/findings.js.map +1 -0
  364. package/dist/types/severity.d.ts +15 -0
  365. package/dist/types/severity.d.ts.map +1 -0
  366. package/dist/types/severity.js +36 -0
  367. package/dist/types/severity.js.map +1 -0
  368. package/package.json +45 -0
  369. package/src/__tests__/gate.test.ts +537 -0
  370. package/src/__tests__/sarif.test.ts +201 -0
  371. package/src/cli/dashboard.ts +93 -0
  372. package/src/cli/fit.ts +612 -0
  373. package/src/cli/list-checks.ts +32 -0
  374. package/src/cli/list-recipes.ts +38 -0
  375. package/src/framework/__tests__/ast-utilities.test.ts +157 -0
  376. package/src/framework/__tests__/check-config.test.ts +65 -0
  377. package/src/framework/__tests__/command-executor.test.ts +79 -0
  378. package/src/framework/__tests__/content-filter-dispatch.test.ts +132 -0
  379. package/src/framework/__tests__/content-filter.test.ts +136 -0
  380. package/src/framework/__tests__/define-check.test.ts +180 -0
  381. package/src/framework/__tests__/directive-inventory.test.ts +53 -0
  382. package/src/framework/__tests__/execution-context.test.ts +80 -0
  383. package/src/framework/__tests__/file-accessor.test.ts +121 -0
  384. package/src/framework/__tests__/file-cache.test.ts +142 -0
  385. package/src/framework/__tests__/import-graph.test.ts +282 -0
  386. package/src/framework/__tests__/path-matcher.test.ts +130 -0
  387. package/src/framework/__tests__/register-helpers.test.ts +51 -0
  388. package/src/framework/__tests__/registry.test.ts +243 -0
  389. package/src/framework/__tests__/result-builder.test.ts +178 -0
  390. package/src/framework/__tests__/scope-resolver.test.ts +208 -0
  391. package/src/framework/__tests__/severity-mapping.test.ts +50 -0
  392. package/src/framework/__tests__/strip-literals.test.ts +109 -0
  393. package/src/framework/abortable-exec.ts +177 -0
  394. package/src/framework/ast-utilities.ts +112 -0
  395. package/src/framework/check-config.ts +339 -0
  396. package/src/framework/check-types.ts +77 -0
  397. package/src/framework/command-executor.ts +100 -0
  398. package/src/framework/constants.ts +16 -0
  399. package/src/framework/content-filter.ts +288 -0
  400. package/src/framework/define-check.ts +336 -0
  401. package/src/framework/directive-inventory.ts +110 -0
  402. package/src/framework/directive-parsing.ts +152 -0
  403. package/src/framework/execution-context.ts +247 -0
  404. package/src/framework/file-accessor.ts +171 -0
  405. package/src/framework/file-cache.ts +220 -0
  406. package/src/framework/file-type-filter.ts +25 -0
  407. package/src/framework/ignore-processing.ts +350 -0
  408. package/src/framework/import-graph.ts +280 -0
  409. package/src/framework/memory-profiler.ts +145 -0
  410. package/src/framework/parse-cache.ts +38 -0
  411. package/src/framework/path-matcher.ts +191 -0
  412. package/src/framework/register-helpers.ts +20 -0
  413. package/src/framework/registry.ts +125 -0
  414. package/src/framework/result-builder.ts +225 -0
  415. package/src/framework/scope-resolver.ts +262 -0
  416. package/src/framework/severity-mapping.ts +56 -0
  417. package/src/framework/strip-literals.ts +200 -0
  418. package/src/gate.ts +337 -0
  419. package/src/index.ts +110 -0
  420. package/src/plugins/__tests__/check-package-discovery.test.ts +204 -0
  421. package/src/plugins/__tests__/lang-domain.test.ts +198 -0
  422. package/src/plugins/__tests__/loader.test.ts +226 -0
  423. package/src/plugins/check-package-discovery.ts +242 -0
  424. package/src/plugins/loader.ts +327 -0
  425. package/src/plugins/types.ts +25 -0
  426. package/src/recipes/__tests__/built-in-recipes.test.ts +107 -0
  427. package/src/recipes/__tests__/check-config.test.ts +51 -0
  428. package/src/recipes/__tests__/check-resolution.test.ts +185 -0
  429. package/src/recipes/__tests__/registry.test.ts +115 -0
  430. package/src/recipes/__tests__/retry.test.ts +83 -0
  431. package/src/recipes/__tests__/service.test.ts +572 -0
  432. package/src/recipes/built-in-recipes.ts +273 -0
  433. package/src/recipes/check-config.ts +64 -0
  434. package/src/recipes/check-resolution.ts +169 -0
  435. package/src/recipes/check-result-processor.ts +258 -0
  436. package/src/recipes/parallel-execution.ts +220 -0
  437. package/src/recipes/registry.ts +192 -0
  438. package/src/recipes/retry.ts +69 -0
  439. package/src/recipes/sequential-execution.ts +139 -0
  440. package/src/recipes/service-types.ts +105 -0
  441. package/src/recipes/service.ts +400 -0
  442. package/src/recipes/types.ts +247 -0
  443. package/src/sarif.ts +232 -0
  444. package/src/signalers/__tests__/loader.test.ts +99 -0
  445. package/src/signalers/index.ts +9 -0
  446. package/src/signalers/loader.ts +141 -0
  447. package/src/signalers/schema.ts +117 -0
  448. package/src/signalers/types.ts +15 -0
  449. package/src/targets/__tests__/loader.test.ts +170 -0
  450. package/src/targets/__tests__/resolver.test.ts +74 -0
  451. package/src/targets/__tests__/target-registry.test.ts +103 -0
  452. package/src/targets/index.ts +13 -0
  453. package/src/targets/loader.ts +214 -0
  454. package/src/targets/resolver.ts +44 -0
  455. package/src/targets/target-registry.ts +111 -0
  456. package/src/targets/types.ts +89 -0
  457. package/src/tool.ts +302 -0
  458. package/src/types/findings.ts +239 -0
  459. package/src/types/severity.ts +39 -0
  460. package/tsconfig.json +8 -0
  461. package/vitest.config.ts +33 -0
@@ -0,0 +1,155 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { defineCheck } from '../define-check.js';
3
+ describe('defineCheck', () => {
4
+ describe('analyze mode', () => {
5
+ const noFooCheck = defineCheck({
6
+ id: '11111111-1111-4111-8111-111111111111',
7
+ slug: 'no-foo',
8
+ description: 'flag any line containing FOO',
9
+ tags: ['quality'],
10
+ analyze: (content, filePath) => {
11
+ const out = [];
12
+ const lines = content.split('\n');
13
+ for (const [i, line] of lines.entries()) {
14
+ if (line?.includes('FOO')) {
15
+ out.push({ line: i + 1, message: 'FOO not allowed', severity: 'error', filePath });
16
+ }
17
+ }
18
+ return out;
19
+ },
20
+ });
21
+ it('returns a Check with the configured slug and id', () => {
22
+ expect(noFooCheck.config.slug).toBe('no-foo');
23
+ expect(noFooCheck.config.id).toBe('11111111-1111-4111-8111-111111111111');
24
+ });
25
+ it('defaults itemType to "files"', () => {
26
+ expect(noFooCheck.config.itemType).toBe('files');
27
+ });
28
+ it('marks scansFiles=true for analyze mode', () => {
29
+ expect(noFooCheck.config.scansFiles).toBe(true);
30
+ });
31
+ it('records analysisMode "analyze"', () => {
32
+ expect(noFooCheck.config.analysisMode).toBe('analyze');
33
+ });
34
+ it('preserves user-supplied tags', () => {
35
+ expect(noFooCheck.config.tags).toEqual(['quality']);
36
+ });
37
+ it('exposes a getScope() and getMatcher() pair', () => {
38
+ const scope = noFooCheck.getScope();
39
+ expect(scope.include).toEqual([]);
40
+ expect(noFooCheck.getMatcher('/tmp')).toBeDefined();
41
+ });
42
+ });
43
+ describe('analyzeAll mode', () => {
44
+ const allCheck = defineCheck({
45
+ id: '22222222-2222-4222-8222-222222222222',
46
+ slug: 'all-mode-check',
47
+ description: 'returns no violations',
48
+ tags: ['demo'],
49
+ // eslint-disable-next-line @typescript-eslint/require-await -- stub for shape verification
50
+ analyzeAll: async () => [],
51
+ });
52
+ it('records analysisMode "analyzeAll"', () => {
53
+ expect(allCheck.config.analysisMode).toBe('analyzeAll');
54
+ });
55
+ it('marks scansFiles=true for analyzeAll mode', () => {
56
+ expect(allCheck.config.scansFiles).toBe(true);
57
+ });
58
+ });
59
+ describe('command mode', () => {
60
+ const cmd = defineCheck({
61
+ id: '33333333-3333-4333-8333-333333333333',
62
+ slug: 'cmd-check',
63
+ description: 'shells out',
64
+ tags: ['demo'],
65
+ command: { bin: 'echo', args: ['hello'], parseOutput: () => [] },
66
+ });
67
+ it('records analysisMode "command"', () => {
68
+ expect(cmd.config.analysisMode).toBe('command');
69
+ });
70
+ it('marks scansFiles=false for command mode', () => {
71
+ expect(cmd.config.scansFiles).toBe(false);
72
+ });
73
+ });
74
+ describe('scope handling', () => {
75
+ it('passes through scope.languages and scope.concerns', () => {
76
+ const c = defineCheck({
77
+ id: '44444444-4444-4444-8444-444444444444',
78
+ slug: 'scoped',
79
+ description: 's',
80
+ tags: ['demo'],
81
+ scope: { languages: ['typescript', 'rust'], concerns: ['backend'] },
82
+ analyze: () => [],
83
+ });
84
+ expect(c.config.checkScope?.languages).toEqual(['typescript', 'rust']);
85
+ expect(c.config.checkScope?.concerns).toEqual(['backend']);
86
+ });
87
+ it('leaves checkScope undefined when scope is omitted', () => {
88
+ const c = defineCheck({
89
+ id: '55555555-5555-4555-8555-555555555555',
90
+ slug: 'unscoped',
91
+ description: 's',
92
+ tags: ['demo'],
93
+ analyze: () => [],
94
+ });
95
+ expect(c.config.checkScope).toBeUndefined();
96
+ });
97
+ });
98
+ describe('runtime metadata passthrough', () => {
99
+ it('preserves docs, disabled, confidence, and timeout', () => {
100
+ const c = defineCheck({
101
+ id: '66666666-6666-4666-8666-666666666666',
102
+ slug: 'with-meta',
103
+ description: 'meta',
104
+ tags: ['demo'],
105
+ docs: 'https://example.com/x',
106
+ disabled: true,
107
+ confidence: 'high',
108
+ timeout: 1234,
109
+ analyze: () => [],
110
+ });
111
+ expect(c.config.docs).toBe('https://example.com/x');
112
+ expect(c.config.disabled).toBe(true);
113
+ expect(c.config.confidence).toBe('high');
114
+ expect(c.config.timeout).toBe(1234);
115
+ });
116
+ it('copies fileTypes when provided', () => {
117
+ const c = defineCheck({
118
+ id: '77777777-7777-4777-8777-777777777777',
119
+ slug: 'typed',
120
+ description: 'd',
121
+ tags: ['demo'],
122
+ fileTypes: ['ts', 'tsx'],
123
+ analyze: () => [],
124
+ });
125
+ expect(c.config.fileTypes).toEqual(['ts', 'tsx']);
126
+ });
127
+ });
128
+ describe('validation', () => {
129
+ it('throws when id is missing', () => {
130
+ expect(() =>
131
+ // @ts-expect-error — testing the runtime guard
132
+ defineCheck({ slug: 'no-id', description: 'd', tags: [], analyze: () => [] })).toThrow();
133
+ });
134
+ it('throws when id is not a UUID', () => {
135
+ expect(() => defineCheck({
136
+ id: 'not-a-uuid',
137
+ slug: 'bad-id',
138
+ description: 'd',
139
+ tags: ['demo'],
140
+ analyze: () => [],
141
+ })).toThrow();
142
+ });
143
+ it('throws when slug is missing', () => {
144
+ expect(() => defineCheck({
145
+ id: '88888888-8888-4888-8888-888888888888',
146
+ // @ts-expect-error — testing the runtime guard
147
+ slug: undefined,
148
+ description: 'd',
149
+ tags: ['demo'],
150
+ analyze: () => [],
151
+ })).toThrow();
152
+ });
153
+ });
154
+ });
155
+ //# sourceMappingURL=define-check.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-check.test.js","sourceRoot":"","sources":["../../../src/framework/__tests__/define-check.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC5B,MAAM,UAAU,GAAG,WAAW,CAAC;YAC7B,EAAE,EAAE,sCAAsC;YAC1C,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,8BAA8B;YAC3C,IAAI,EAAE,CAAC,SAAS,CAAC;YACjB,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;gBAC7B,MAAM,GAAG,GAAyF,EAAE,CAAC;gBACrG,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAClC,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;oBACxC,IAAI,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC1B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;oBACrF,CAAC;gBACH,CAAC;gBACD,OAAO,GAAG,CAAC;YACb,CAAC;SACF,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,C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AAC,CAC9E,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,CAAC,GAAG,EAAE,CACV,WAAW,CAAC;gBACV,EAAE,EAAE,YAAY;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,GAAG;gBAChB,IAAI,EAAE,CAAC,MAAM,CAAC;gBACd,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;aAClB,CAAC,CACH,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,MAAM,CAAC,GAAG,EAAE,CACV,WAAW,CAAC;gBACV,EAAE,EAAE,sCAAsC;gBAC1C,+CAA+C;gBAC/C,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,GAAG;gBAChB,IAAI,EAAE,CAAC,MAAM,CAAC;gBACd,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;aAClB,CAAC,CACH,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=directive-inventory.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive-inventory.test.d.ts","sourceRoot":"","sources":["../../../src/framework/__tests__/directive-inventory.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { parseDirectiveLine } from '../directive-inventory.js';
3
+ describe('parseDirectiveLine', () => {
4
+ describe('line comments (// form)', () => {
5
+ it('parses @fitness-ignore-file with reason', () => {
6
+ const result = parseDirectiveLine('// @fitness-ignore-file no-console-log -- debug scaffold for this module');
7
+ expect(result).toEqual({ type: 'file', checkId: 'no-console-log', reason: 'debug scaffold for this module' });
8
+ });
9
+ it('parses @fitness-ignore-next-line without reason', () => {
10
+ const result = parseDirectiveLine('// @fitness-ignore-next-line no-any-types');
11
+ expect(result).toEqual({ type: 'next-line', checkId: 'no-any-types', reason: null });
12
+ });
13
+ it('rejects lines without the directive prefix', () => {
14
+ expect(parseDirectiveLine('// just a comment')).toBeNull();
15
+ expect(parseDirectiveLine('const x = 1;')).toBeNull();
16
+ });
17
+ });
18
+ describe('block comments (/* form) — parity with suppression parser', () => {
19
+ it('parses single-line block directive with reason', () => {
20
+ const result = parseDirectiveLine('/* @fitness-ignore-file no-console-log -- legacy file */');
21
+ expect(result).toEqual({ type: 'file', checkId: 'no-console-log', reason: 'legacy file' });
22
+ });
23
+ it('parses single-line block directive without reason', () => {
24
+ const result = parseDirectiveLine('/* @fitness-ignore-next-line no-any-types */');
25
+ expect(result).toEqual({ type: 'next-line', checkId: 'no-any-types', reason: null });
26
+ });
27
+ it('strips trailing whitespace before */', () => {
28
+ const result = parseDirectiveLine('/* @fitness-ignore-file some-check */');
29
+ expect(result).toEqual({ type: 'file', checkId: 'some-check', reason: null });
30
+ });
31
+ });
32
+ describe('rejection cases', () => {
33
+ it('rejects directive without comment marker', () => {
34
+ expect(parseDirectiveLine('@fitness-ignore-file foo')).toBeNull();
35
+ });
36
+ it('rejects checkId with spaces', () => {
37
+ expect(parseDirectiveLine('// @fitness-ignore-file foo bar baz')).toBeNull();
38
+ });
39
+ it('rejects empty checkId', () => {
40
+ expect(parseDirectiveLine('// @fitness-ignore-file ')).toBeNull();
41
+ });
42
+ });
43
+ });
44
+ //# sourceMappingURL=directive-inventory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive-inventory.test.js","sourceRoot":"","sources":["../../../src/framework/__tests__/directive-inventory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,QAAQ,CAAC,oBAAoB,E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AAG,kBAAkB,CAAC,8CAA8C,CAAC,CAAA;YACjF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACtF,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,MAAM,GAAG,kBAAkB,CAAC,yCAAyC,CAAC,CAAA;YAC5E,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QAC/E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QACnE,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC9E,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QACnE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=execution-context.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context.test.d.ts","sourceRoot":"","sources":["../../../src/framework/__tests__/execution-context.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
5
+ import { createExecutionContext } from '../execution-context.js';
6
+ import { fileCache } from '../file-cache.js';
7
+ import { PathMatcher } from '../path-matcher.js';
8
+ let testDir;
9
+ beforeEach(() => {
10
+ testDir = mkdtempSync(join(tmpdir(), 'opensip-exec-ctx-'));
11
+ });
12
+ afterEach(() => {
13
+ fileCache.clear();
14
+ rmSync(testDir, { recursive: true, force: true });
15
+ });
16
+ describe('createExecutionContext > matchFiles fileCache fallback', () => {
17
+ // Regression test for the scope-resolver bug surfaced during the
18
+ // checks-builtin split: scope-empty checks (e.g. file-length-limit)
19
+ // were scanning every prewarmed file, including paths the user had
20
+ // explicitly listed in `globalExcludes`. The fix threads the run's
21
+ // globalExcludes through RunOptions into the matchFiles fallback.
22
+ // eslint-disable-next-line unicorn/consistent-function-scoping -- closes over describe-scoped `testDir`
23
+ function setupCachedFiles() {
24
+ mkdirSync(join(testDir, 'src'), { recursive: true });
25
+ mkdirSync(join(testDir, 'docs'), { recursive: true });
26
+ mkdirSync(join(testDir, 'tests', 'fixtures'), { recursive: true });
27
+ writeFileSync(join(testDir, 'src', 'a.ts'), 'export const a = 1');
28
+ writeFileSync(join(testDir, 'docs', 'design.md'), '# Design');
29
+ writeFileSync(join(testDir, 'tests', 'fixtures', 'sample.json'), '{}');
30
+ }
31
+ async function runMatchFiles(globalExcludes) {
32
+ setupCachedFiles();
33
+ await fileCache.prewarm(testDir, ['**/*.ts', '**/*.md', '**/*.json']);
34
+ const matcher = PathMatcher.create({ cwd: testDir, include: [], exclude: [] });
35
+ const ctx = createExecutionContext({ id: 'test-id', slug: 'test-slug', itemType: 'files' }, testDir, matcher, globalExcludes ? { globalExcludes } : undefined);
36
+ return ctx.matchFiles();
37
+ }
38
+ it('returns every cached path when no globalExcludes are provided', async () => {
39
+ const files = await runMatchFiles();
40
+ expect(files.length).toBe(3);
41
+ // Sanity: includes the docs and fixtures files that we'll exclude below
42
+ expect(files.some((f) => f.endsWith('docs/design.md'))).toBe(true);
43
+ expect(files.some((f) => f.endsWith('tests/fixtures/sample.json'))).toBe(true);
44
+ });
45
+ it('filters paths matching globalExcludes patterns out of the fallback', async () => {
46
+ const files = await runMatchFiles(['docs/**', 'tests/fixtures/**']);
47
+ expect(files.length).toBe(1);
48
+ expect(files[0]).toMatch(/src\/a\.ts$/);
49
+ });
50
+ it('honors extension-style globalExcludes (*.md, *.json)', async () => {
51
+ const files = await runMatchFiles(['**/*.md', '**/*.json']);
52
+ expect(files.length).toBe(1);
53
+ expect(files[0]).toMatch(/src\/a\.ts$/);
54
+ });
55
+ it('returns the unfiltered list when globalExcludes is an empty array', async () => {
56
+ // Empty array must not engage the matcher at all — otherwise we
57
+ // pay relative-path computation per file for no reason.
58
+ const files = await runMatchFiles([]);
59
+ expect(files.length).toBe(3);
60
+ });
61
+ });
62
+ //# sourceMappingURL=execution-context.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context.test.js","sourceRoot":"","sources":["../../../src/framework/__tests__/execution-context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,IAAI,OAAe,CAAA;AAEnB,UAAU,CAAC,GAAG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AAO,CAAC,aAAa,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;QAC3D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC5B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;QACjF,gEAAgE;QAChE,wDAAwD;QACxD,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,EAAE,CAAC,CAAA;QACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file-accessor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-accessor.test.d.ts","sourceRoot":"","sources":["../../../src/framework/__tests__/file-accessor.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,106 @@
1
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { ValidationError } from '@opensip-tools/core';
5
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
6
+ import { createFileAccessor } from '../file-accessor.js';
7
+ import { fileCache } from '../file-cache.js';
8
+ let testDir;
9
+ beforeEach(() => {
10
+ testDir = mkdtempSync(join(tmpdir(), 'opensip-fa-'));
11
+ fileCache.clear();
12
+ });
13
+ afterEach(() => {
14
+ rmSync(testDir, { recursive: true, force: true });
15
+ fileCache.clear();
16
+ });
17
+ describe('createFileAccessor', () => {
18
+ it('exposes the configured paths via the readonly paths property', () => {
19
+ const acc = createFileAccessor(['/a.ts', '/b.ts']);
20
+ expect(acc.paths).toEqual(['/a.ts', '/b.ts']);
21
+ });
22
+ it('reads file content from disk via fileCache when not preloaded', async () => {
23
+ const path = join(testDir, 'x.ts');
24
+ writeFileSync(path, 'hi');
25
+ const acc = createFileAccessor([path]);
26
+ expect(await acc.read(path)).toBe('hi');
27
+ });
28
+ it('rejects reads of paths not in the configured set', async () => {
29
+ const acc = createFileAccessor(['/allowed.ts']);
30
+ await expect(acc.read('/disallowed.ts')).rejects.toThrow(ValidationError);
31
+ });
32
+ it('caches reads — second call returns the same content even if disk changed', async () => {
33
+ const path = join(testDir, 'cache.ts');
34
+ writeFileSync(path, 'first');
35
+ const acc = createFileAccessor([path]);
36
+ expect(await acc.read(path)).toBe('first');
37
+ writeFileSync(path, 'second');
38
+ // Cached
39
+ expect(await acc.read(path)).toBe('first');
40
+ });
41
+ it('throws ValidationError when a file exceeds 10 MB', async () => {
42
+ const path = join(testDir, 'big.txt');
43
+ // Use Buffer-write to avoid loading 11 MB of string into memory unnecessarily
44
+ writeFileSync(path, Buffer.alloc(11 * 1024 * 1024, 'a'));
45
+ const acc = createFileAccessor([path]);
46
+ await expect(acc.read(path)).rejects.toThrow(/File too large/);
47
+ });
48
+ it('readMany reads multiple files and returns a Map', async () => {
49
+ const a = join(testDir, 'a.ts');
50
+ const b = join(testDir, 'b.ts');
51
+ writeFileSync(a, 'A');
52
+ writeFileSync(b, 'B');
53
+ const acc = createFileAccessor([a, b]);
54
+ const map = await acc.readMany([a, b]);
55
+ expect(map.get(a)).toBe('A');
56
+ expect(map.get(b)).toBe('B');
57
+ });
58
+ it('readAll returns every configured path', async () => {
59
+ const a = join(testDir, 'a.ts');
60
+ writeFileSync(a, 'AA');
61
+ const acc = createFileAccessor([a]);
62
+ const map = await acc.readAll();
63
+ expect(map.size).toBe(1);
64
+ expect(map.get(a)).toBe('AA');
65
+ });
66
+ it('throws when an aborted signal is passed', async () => {
67
+ const ac = new AbortController();
68
+ ac.abort();
69
+ const path = join(testDir, 'z.ts');
70
+ writeFileSync(path, 'z');
71
+ const acc = createFileAccessor([path], { signal: ac.signal });
72
+ await expect(acc.read(path)).rejects.toThrow();
73
+ });
74
+ it('cachedCount reflects internal LRU size', async () => {
75
+ const path = join(testDir, 'cnt.ts');
76
+ writeFileSync(path, 'cnt');
77
+ const acc = createFileAccessor([path]);
78
+ expect(acc.cachedCount).toBe(0);
79
+ await acc.read(path);
80
+ expect(acc.cachedCount).toBe(1);
81
+ acc.clearCache();
82
+ expect(acc.cachedCount).toBe(0);
83
+ });
84
+ it('preferentially returns content from the global fileCache when prewarmed', async () => {
85
+ const path = join(testDir, 'p.ts');
86
+ writeFileSync(path, 'on-disk');
87
+ await fileCache.prewarm(testDir, ['p.ts']);
88
+ // Mutate disk; accessor should still return prewarmed content
89
+ writeFileSync(path, 'changed');
90
+ const acc = createFileAccessor([path]);
91
+ expect(await acc.read(path)).toBe('on-disk');
92
+ });
93
+ it('LRU eviction kicks in beyond the configured capacity', async () => {
94
+ const paths = [];
95
+ for (let i = 0; i < 5; i++) {
96
+ const p = join(testDir, `${i}.ts`);
97
+ writeFileSync(p, String(i));
98
+ paths.push(p);
99
+ }
100
+ const acc = createFileAccessor(paths, { cacheCapacity: 2 });
101
+ for (const p of paths)
102
+ await acc.read(p);
103
+ expect(acc.cachedCount).toBe(2);
104
+ });
105
+ });
106
+ //# sourceMappingURL=file-accessor.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-accessor.test.js","sourceRoot":"","sources":["../../../src/framework/__tests__/file-accessor.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAA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,CAAC;QAC/B,MAAM,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,8DAA8D;QAC9D,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACnC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;QACD,MAAM,GAAG,GAAG,kBAAkB,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,CAA6E,CAAC;QACxI,KAAK,MAAM,CAAC,IAAI,KAAK;YAAE,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file-cache.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-cache.test.d.ts","sourceRoot":"","sources":["../../../src/framework/__tests__/file-cache.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,122 @@
1
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { ValidationError } from '@opensip-tools/core';
5
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
6
+ import { DEFAULT_PREWARM_PATTERNS, fileCache } from '../file-cache.js';
7
+ let testDir;
8
+ beforeEach(() => {
9
+ testDir = mkdtempSync(join(tmpdir(), 'opensip-fc-'));
10
+ fileCache.clear();
11
+ });
12
+ afterEach(() => {
13
+ fileCache.clear();
14
+ rmSync(testDir, { recursive: true, force: true });
15
+ });
16
+ describe('fileCache.prewarm', () => {
17
+ it('loads matching files into the cache', async () => {
18
+ writeFileSync(join(testDir, 'a.ts'), 'export const a = 1;');
19
+ writeFileSync(join(testDir, 'b.ts'), 'export const b = 2;');
20
+ const stats = await fileCache.prewarm(testDir, ['*.ts']);
21
+ expect(stats.filesLoaded).toBe(2);
22
+ expect(stats.totalBytes).toBeGreaterThan(0);
23
+ expect(stats.durationMs).toBeGreaterThanOrEqual(0);
24
+ expect(fileCache.stats.prewarmed).toBe(true);
25
+ });
26
+ it('respects default ignore patterns (skips node_modules)', async () => {
27
+ mkdirSync(join(testDir, 'node_modules', 'foo'), { recursive: true });
28
+ writeFileSync(join(testDir, 'node_modules', 'foo', 'x.ts'), 'export {};');
29
+ writeFileSync(join(testDir, 'app.ts'), 'export const app = 1;');
30
+ await fileCache.prewarm(testDir, ['**/*.ts']);
31
+ expect(fileCache.paths().some((p) => p.includes('node_modules'))).toBe(false);
32
+ expect(fileCache.paths().some((p) => p.endsWith('app.ts'))).toBe(true);
33
+ });
34
+ it('handles multiple patterns and deduplicates', async () => {
35
+ writeFileSync(join(testDir, 'x.ts'), '1');
36
+ const stats = await fileCache.prewarm(testDir, ['*.ts', '**/*.ts']);
37
+ expect(stats.filesLoaded).toBe(1);
38
+ });
39
+ });
40
+ describe('fileCache.get', () => {
41
+ it('returns content from disk on cache miss and caches it', async () => {
42
+ const path = join(testDir, 'fresh.ts');
43
+ writeFileSync(path, 'fresh content');
44
+ const content = await fileCache.get(path);
45
+ expect(content).toBe('fresh content');
46
+ expect(fileCache.getCached(path)).toBe('fresh content');
47
+ });
48
+ it('returns cached content on hit', async () => {
49
+ const path = join(testDir, 'a.ts');
50
+ writeFileSync(path, 'first');
51
+ await fileCache.prewarm(testDir, ['*.ts']);
52
+ // Mutate the file on disk; cached read still returns first
53
+ writeFileSync(path, 'second');
54
+ expect(await fileCache.get(path)).toBe('first');
55
+ });
56
+ it('throws ValidationError when path is a directory', async () => {
57
+ const dirPath = join(testDir, 'dir');
58
+ mkdirSync(dirPath);
59
+ await expect(fileCache.get(dirPath)).rejects.toThrow(ValidationError);
60
+ });
61
+ it('resolves relative paths against cwd', async () => {
62
+ const abs = join(testDir, 'foo.ts');
63
+ writeFileSync(abs, 'rel');
64
+ process.chdir(testDir);
65
+ const content = await fileCache.get('foo.ts');
66
+ expect(content).toBe('rel');
67
+ });
68
+ });
69
+ describe('fileCache.getCached', () => {
70
+ it('returns undefined when file is not in cache', () => {
71
+ expect(fileCache.getCached('/nope/nope.ts')).toBeUndefined();
72
+ });
73
+ it('returns cached content after prewarm', async () => {
74
+ writeFileSync(join(testDir, 'q.ts'), 'q');
75
+ await fileCache.prewarm(testDir, ['*.ts']);
76
+ expect(fileCache.getCached(join(testDir, 'q.ts'))).toBe('q');
77
+ });
78
+ });
79
+ describe('fileCache.exists', () => {
80
+ it('returns true for cached files', async () => {
81
+ writeFileSync(join(testDir, 'e.ts'), 'e');
82
+ await fileCache.prewarm(testDir, ['*.ts']);
83
+ expect(await fileCache.exists(join(testDir, 'e.ts'))).toBe(true);
84
+ });
85
+ it('returns true for files on disk but not yet cached', async () => {
86
+ writeFileSync(join(testDir, 'd.ts'), 'd');
87
+ expect(await fileCache.exists(join(testDir, 'd.ts'))).toBe(true);
88
+ });
89
+ it('returns false when file does not exist', async () => {
90
+ expect(await fileCache.exists(join(testDir, 'missing.ts'))).toBe(false);
91
+ });
92
+ });
93
+ describe('fileCache.clear', () => {
94
+ it('empties the cache and resets prewarmed flag', async () => {
95
+ writeFileSync(join(testDir, 'x.ts'), 'x');
96
+ await fileCache.prewarm(testDir, ['*.ts']);
97
+ expect(fileCache.stats.size).toBeGreaterThan(0);
98
+ fileCache.clear();
99
+ expect(fileCache.stats.size).toBe(0);
100
+ expect(fileCache.stats.prewarmed).toBe(false);
101
+ expect(fileCache.stats.cleared).toBe(true);
102
+ });
103
+ });
104
+ describe('fileCache.paths', () => {
105
+ it('returns sorted absolute paths', async () => {
106
+ writeFileSync(join(testDir, 'b.ts'), '');
107
+ writeFileSync(join(testDir, 'a.ts'), '');
108
+ await fileCache.prewarm(testDir, ['*.ts']);
109
+ const paths = fileCache.paths();
110
+ expect(paths.length).toBe(2);
111
+ expect([...paths].sort()).toEqual(paths);
112
+ });
113
+ });
114
+ describe('DEFAULT_PREWARM_PATTERNS', () => {
115
+ it('includes the major source extensions', () => {
116
+ expect(DEFAULT_PREWARM_PATTERNS).toContain('**/*.ts');
117
+ expect(DEFAULT_PREWARM_PATTERNS).toContain('**/*.tsx');
118
+ expect(DEFAULT_PREWARM_PATTERNS).toContain('**/*.js');
119
+ expect(DEFAULT_PREWARM_PATTERNS).toContain('**/*.json');
120
+ });
121
+ });
122
+ //# sourceMappingURL=file-cache.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-cache.test.js","sourceRoot":"","sources":["../../../src/framework/__tests__/file-cache.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EA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C,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACtD,MAAM,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACtD,MAAM,CAAC,wBAAwB,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Unit tests for the import-graph builder + Tarjan's SCC.
3
+ *
4
+ * Covers:
5
+ * - Basic relative-import resolution (./foo, ../bar, with/without ext)
6
+ * - Index resolution (./foo/index.ts)
7
+ * - ESM extension swap (.js → .ts)
8
+ * - Bare specifiers dropped (npm packages don't appear as edges)
9
+ * - export-from declarations contribute edges
10
+ * - Files that fail to parse still appear as nodes
11
+ * - SCC detection: simple 2-cycle, larger cycle, multiple disjoint cycles,
12
+ * no-cycle case, self-loop
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=import-graph.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-graph.test.d.ts","sourceRoot":"","sources":["../../../src/framework/__tests__/import-graph.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}