@shivaedev/quality 0.45.0 → 0.47.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 (467) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +13 -7
  3. package/dist/PackageManifest.d.ts +25 -0
  4. package/dist/PackageManifest.d.ts.map +1 -0
  5. package/dist/PackageManifest.js +21 -0
  6. package/dist/PackageManifest.js.map +1 -0
  7. package/dist/adapters/TestOutput.d.ts +8 -0
  8. package/dist/adapters/TestOutput.d.ts.map +1 -0
  9. package/dist/adapters/TestOutput.js +5 -0
  10. package/dist/adapters/TestOutput.js.map +1 -0
  11. package/dist/adapters/biome/run.d.ts +17 -0
  12. package/dist/adapters/biome/run.d.ts.map +1 -0
  13. package/dist/adapters/biome/run.js +24 -0
  14. package/dist/adapters/biome/run.js.map +1 -0
  15. package/dist/adapters/knip/configuration.d.ts.map +1 -1
  16. package/dist/adapters/knip/configuration.js +2 -9
  17. package/dist/adapters/knip/configuration.js.map +1 -1
  18. package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
  19. package/dist/adapters/knip/entryPointFindings.js +2 -1
  20. package/dist/adapters/knip/entryPointFindings.js.map +1 -1
  21. package/dist/adapters/knip/run.d.ts +3 -1
  22. package/dist/adapters/knip/run.d.ts.map +1 -1
  23. package/dist/adapters/knip/run.js +8 -8
  24. package/dist/adapters/knip/run.js.map +1 -1
  25. package/dist/adapters/manifestInventory.d.ts +23 -0
  26. package/dist/adapters/manifestInventory.d.ts.map +1 -0
  27. package/dist/adapters/manifestInventory.js +63 -0
  28. package/dist/adapters/manifestInventory.js.map +1 -0
  29. package/dist/adapters/manifestReader.d.ts +3 -0
  30. package/dist/adapters/manifestReader.d.ts.map +1 -0
  31. package/dist/adapters/manifestReader.js +8 -0
  32. package/dist/adapters/manifestReader.js.map +1 -0
  33. package/dist/adapters/testProjects.d.ts.map +1 -0
  34. package/dist/{testProjects.js → adapters/testProjects.js} +4 -3
  35. package/dist/adapters/testProjects.js.map +1 -0
  36. package/dist/appTestConfig.d.ts +1 -1
  37. package/dist/appTestConfig.d.ts.map +1 -1
  38. package/dist/appTestConfig.js +1 -1
  39. package/dist/appTestConfig.js.map +1 -1
  40. package/dist/baseline/format.js +2 -2
  41. package/dist/baseline/format.js.map +1 -1
  42. package/dist/baseline/installDriver.d.ts +2 -1
  43. package/dist/baseline/installDriver.d.ts.map +1 -1
  44. package/dist/baseline/installDriver.js.map +1 -1
  45. package/dist/baseline/legacy.js +2 -2
  46. package/dist/baseline/legacy.js.map +1 -1
  47. package/dist/baseline/merge.js +1 -1
  48. package/dist/baseline/merge.js.map +1 -1
  49. package/dist/baseline/shards.js +1 -1
  50. package/dist/baseline/shards.js.map +1 -1
  51. package/dist/biome/exceptionConfig.d.ts +7 -1
  52. package/dist/biome/exceptionConfig.d.ts.map +1 -1
  53. package/dist/biome/exceptionConfig.js +11 -25
  54. package/dist/biome/exceptionConfig.js.map +1 -1
  55. package/dist/biome/recommendedRules.d.ts +2 -1
  56. package/dist/biome/recommendedRules.d.ts.map +1 -1
  57. package/dist/biome/recommendedRules.js +11 -14
  58. package/dist/biome/recommendedRules.js.map +1 -1
  59. package/dist/biome/relocateConfig.d.ts +6 -0
  60. package/dist/biome/relocateConfig.d.ts.map +1 -0
  61. package/dist/biome/relocateConfig.js +49 -0
  62. package/dist/biome/relocateConfig.js.map +1 -0
  63. package/dist/biome/report.d.ts +28 -3
  64. package/dist/biome/report.d.ts.map +1 -1
  65. package/dist/biome/report.js +15 -12
  66. package/dist/biome/report.js.map +1 -1
  67. package/dist/biome/withoutEntryPointImports.d.ts.map +1 -1
  68. package/dist/biome/withoutEntryPointImports.js +2 -12
  69. package/dist/biome/withoutEntryPointImports.js.map +1 -1
  70. package/dist/cli/baseline.d.ts +4 -3
  71. package/dist/cli/baseline.d.ts.map +1 -1
  72. package/dist/cli/baseline.js.map +1 -1
  73. package/dist/cli/fix.d.ts +4 -3
  74. package/dist/cli/fix.d.ts.map +1 -1
  75. package/dist/cli/fix.js +3 -9
  76. package/dist/cli/fix.js.map +1 -1
  77. package/dist/cli/lint.d.ts +3 -2
  78. package/dist/cli/lint.d.ts.map +1 -1
  79. package/dist/cli/lint.js.map +1 -1
  80. package/dist/cli/migrateBaseline.d.ts +3 -2
  81. package/dist/cli/migrateBaseline.d.ts.map +1 -1
  82. package/dist/cli/migrateBaseline.js +2 -2
  83. package/dist/cli/migrateBaseline.js.map +1 -1
  84. package/dist/cli/migrateExceptions.d.ts.map +1 -1
  85. package/dist/cli/migrateExceptions.js +6 -4
  86. package/dist/cli/migrateExceptions.js.map +1 -1
  87. package/dist/cli/program.d.ts +1 -1
  88. package/dist/cli/program.d.ts.map +1 -1
  89. package/dist/cli/runMain.d.ts +3 -3
  90. package/dist/cli/runMain.d.ts.map +1 -1
  91. package/dist/cli/runMain.js.map +1 -1
  92. package/dist/cli/shrink.d.ts +3 -3
  93. package/dist/cli/shrink.d.ts.map +1 -1
  94. package/dist/cli/shrink.js.map +1 -1
  95. package/dist/config/decode.d.ts +1 -1
  96. package/dist/config/decode.d.ts.map +1 -1
  97. package/dist/config/decode.js +1 -2
  98. package/dist/config/decode.js.map +1 -1
  99. package/dist/config/load.js +2 -2
  100. package/dist/config/load.js.map +1 -1
  101. package/dist/config/resolve.d.ts +1 -1
  102. package/dist/decoded.d.ts +2 -3
  103. package/dist/decoded.d.ts.map +1 -1
  104. package/dist/decoded.js +6 -4
  105. package/dist/decoded.js.map +1 -1
  106. package/dist/docs/documentedModule.d.ts +0 -2
  107. package/dist/docs/documentedModule.d.ts.map +1 -1
  108. package/dist/docs/documentedModule.js +0 -3
  109. package/dist/docs/documentedModule.js.map +1 -1
  110. package/dist/docs/importFindings.d.ts.map +1 -1
  111. package/dist/docs/importFindings.js +0 -3
  112. package/dist/docs/importFindings.js.map +1 -1
  113. package/dist/engine/baselineFile.js +2 -2
  114. package/dist/engine/baselineFile.js.map +1 -1
  115. package/dist/engine/runRules.d.ts +3 -4
  116. package/dist/engine/runRules.d.ts.map +1 -1
  117. package/dist/engine/runRules.js +23 -8
  118. package/dist/engine/runRules.js.map +1 -1
  119. package/dist/engine/session.d.ts +4 -3
  120. package/dist/engine/session.d.ts.map +1 -1
  121. package/dist/engine/session.js +6 -7
  122. package/dist/engine/session.js.map +1 -1
  123. package/dist/exceptions/declaration.js +2 -2
  124. package/dist/exceptions/declaration.js.map +1 -1
  125. package/dist/exceptions/registry.d.ts.map +1 -1
  126. package/dist/exceptions/registry.js +2 -4
  127. package/dist/exceptions/registry.js.map +1 -1
  128. package/dist/failure.d.ts +5 -0
  129. package/dist/failure.d.ts.map +1 -1
  130. package/dist/failure.js +4 -0
  131. package/dist/failure.js.map +1 -1
  132. package/dist/git/base.d.ts +2 -1
  133. package/dist/git/base.d.ts.map +1 -1
  134. package/dist/git/base.js +6 -6
  135. package/dist/git/base.js.map +1 -1
  136. package/dist/git/command.d.ts +2 -3
  137. package/dist/git/command.d.ts.map +1 -1
  138. package/dist/git/command.js +6 -6
  139. package/dist/git/command.js.map +1 -1
  140. package/dist/git/history.d.ts +2 -2
  141. package/dist/git/history.d.ts.map +1 -1
  142. package/dist/git/history.js.map +1 -1
  143. package/dist/hooks/forwarding.js +2 -2
  144. package/dist/hooks/install.js +2 -2
  145. package/dist/hooks/install.js.map +1 -1
  146. package/dist/hooks/location.js +3 -3
  147. package/dist/hooks/preCommit.d.ts +1 -2
  148. package/dist/hooks/preCommit.d.ts.map +1 -1
  149. package/dist/hooks/preCommit.js +10 -11
  150. package/dist/hooks/preCommit.js.map +1 -1
  151. package/dist/hooks/status.js +1 -1
  152. package/dist/hooks/status.js.map +1 -1
  153. package/dist/hooks/uninstall.js +5 -5
  154. package/dist/hooks/uninstall.js.map +1 -1
  155. package/dist/imports/classifyRuntime.d.ts +10 -0
  156. package/dist/imports/classifyRuntime.d.ts.map +1 -0
  157. package/dist/imports/classifyRuntime.js +22 -0
  158. package/dist/imports/classifyRuntime.js.map +1 -0
  159. package/dist/imports/fences/declarations.d.ts.map +1 -1
  160. package/dist/imports/fences/declarations.js +1 -2
  161. package/dist/imports/fences/declarations.js.map +1 -1
  162. package/dist/imports/pnpmWorkspacePatterns.d.ts.map +1 -1
  163. package/dist/imports/pnpmWorkspacePatterns.js +2 -1
  164. package/dist/imports/pnpmWorkspacePatterns.js.map +1 -1
  165. package/dist/imports/runtime.d.ts +4 -3
  166. package/dist/imports/runtime.d.ts.map +1 -1
  167. package/dist/imports/runtime.js +35 -64
  168. package/dist/imports/runtime.js.map +1 -1
  169. package/dist/imports/withoutGenerated.d.ts +4 -2
  170. package/dist/imports/withoutGenerated.d.ts.map +1 -1
  171. package/dist/imports/withoutGenerated.js +22 -35
  172. package/dist/imports/withoutGenerated.js.map +1 -1
  173. package/dist/imports/workspace.d.ts.map +1 -1
  174. package/dist/imports/workspace.js +9 -19
  175. package/dist/imports/workspace.js.map +1 -1
  176. package/dist/inventory/collect.d.ts +5 -3
  177. package/dist/inventory/collect.d.ts.map +1 -1
  178. package/dist/inventory/collect.js +2 -1
  179. package/dist/inventory/collect.js.map +1 -1
  180. package/dist/inventory/filesystem.d.ts.map +1 -1
  181. package/dist/inventory/filesystem.js +2 -8
  182. package/dist/inventory/filesystem.js.map +1 -1
  183. package/dist/inventory/shadcnFolders.d.ts +4 -2
  184. package/dist/inventory/shadcnFolders.d.ts.map +1 -1
  185. package/dist/inventory/shadcnFolders.js.map +1 -1
  186. package/dist/inventory/trackedPaths.d.ts +5 -3
  187. package/dist/inventory/trackedPaths.d.ts.map +1 -1
  188. package/dist/inventory/trackedPaths.js +22 -24
  189. package/dist/inventory/trackedPaths.js.map +1 -1
  190. package/dist/inventory/walk.d.ts +5 -3
  191. package/dist/inventory/walk.d.ts.map +1 -1
  192. package/dist/inventory/walk.js +3 -9
  193. package/dist/inventory/walk.js.map +1 -1
  194. package/dist/manifests/entryPoints.d.ts.map +1 -1
  195. package/dist/manifests/entryPoints.js +2 -12
  196. package/dist/manifests/entryPoints.js.map +1 -1
  197. package/dist/manifests/sorted.d.ts +6 -5
  198. package/dist/manifests/sorted.d.ts.map +1 -1
  199. package/dist/manifests/sorted.js +14 -8
  200. package/dist/manifests/sorted.js.map +1 -1
  201. package/dist/naming/packageLayout.d.ts.map +1 -1
  202. package/dist/naming/packageLayout.js +2 -12
  203. package/dist/naming/packageLayout.js.map +1 -1
  204. package/dist/rule.d.ts +15 -10
  205. package/dist/rule.d.ts.map +1 -1
  206. package/dist/rule.js +9 -1
  207. package/dist/rule.js.map +1 -1
  208. package/dist/rules/biome.d.ts.map +1 -1
  209. package/dist/rules/biome.js +7 -4
  210. package/dist/rules/biome.js.map +1 -1
  211. package/dist/rules/builtIn.d.ts +14 -14
  212. package/dist/rules/builtIn.d.ts.map +1 -1
  213. package/dist/rules/builtIn.js +2 -0
  214. package/dist/rules/builtIn.js.map +1 -1
  215. package/dist/rules/comments/maxPerFile.d.ts +1 -1
  216. package/dist/rules/comments/maxPerFile.d.ts.map +1 -1
  217. package/dist/rules/comments/noBanner.d.ts +1 -1
  218. package/dist/rules/comments/noBanner.d.ts.map +1 -1
  219. package/dist/rules/comments/noEnvironmentPragma.d.ts +1 -1
  220. package/dist/rules/comments/noEnvironmentPragma.d.ts.map +1 -1
  221. package/dist/rules/comments/noEnvironmentPragma.js +1 -1
  222. package/dist/rules/comments/noEnvironmentPragma.js.map +1 -1
  223. package/dist/rules/comments/noJsdoc.d.ts +1 -1
  224. package/dist/rules/comments/noJsdoc.d.ts.map +1 -1
  225. package/dist/rules/comments/noLineReference.d.ts +1 -1
  226. package/dist/rules/comments/noLineReference.d.ts.map +1 -1
  227. package/dist/rules/comments/noPrReference.d.ts +1 -1
  228. package/dist/rules/comments/noPrReference.d.ts.map +1 -1
  229. package/dist/rules/comments/noTodo.d.ts +1 -1
  230. package/dist/rules/comments/noTodo.d.ts.map +1 -1
  231. package/dist/rules/docs/references.d.ts +1 -1
  232. package/dist/rules/docs/references.d.ts.map +1 -1
  233. package/dist/rules/docs/references.js +5 -8
  234. package/dist/rules/docs/references.js.map +1 -1
  235. package/dist/rules/docs/unversionedInstalls.d.ts +1 -1
  236. package/dist/rules/docs/unversionedInstalls.d.ts.map +1 -1
  237. package/dist/rules/docs/unversionedInstalls.js +1 -1
  238. package/dist/rules/docs/unversionedInstalls.js.map +1 -1
  239. package/dist/rules/effect/boundary.d.ts +1 -1
  240. package/dist/rules/effect/boundary.d.ts.map +1 -1
  241. package/dist/rules/effect/serviceParameters.d.ts +1 -1
  242. package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
  243. package/dist/rules/effect/serviceTypes.d.ts.map +1 -1
  244. package/dist/rules/effect/serviceTypes.js +10 -0
  245. package/dist/rules/effect/serviceTypes.js.map +1 -1
  246. package/dist/rules/files/distinctCase.d.ts +1 -1
  247. package/dist/rules/files/distinctCase.d.ts.map +1 -1
  248. package/dist/rules/files/folderNames.d.ts +1 -1
  249. package/dist/rules/files/folderNames.d.ts.map +1 -1
  250. package/dist/rules/files/namedAfterExport.d.ts +1 -1
  251. package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
  252. package/dist/rules/files/otherNames.d.ts +1 -1
  253. package/dist/rules/files/otherNames.d.ts.map +1 -1
  254. package/dist/rules/files/packageImports.d.ts.map +1 -1
  255. package/dist/rules/files/packageImports.js +2 -13
  256. package/dist/rules/files/packageImports.js.map +1 -1
  257. package/dist/rules/imports/aliased.d.ts +1 -1
  258. package/dist/rules/imports/aliased.d.ts.map +1 -1
  259. package/dist/rules/imports/cycles.d.ts +1 -1
  260. package/dist/rules/imports/cycles.d.ts.map +1 -1
  261. package/dist/rules/imports/fences.d.ts +1 -1
  262. package/dist/rules/imports/fences.d.ts.map +1 -1
  263. package/dist/rules/imports/manifest.d.ts +1 -1
  264. package/dist/rules/imports/manifest.d.ts.map +1 -1
  265. package/dist/rules/imports/manifest.js +14 -32
  266. package/dist/rules/imports/manifest.js.map +1 -1
  267. package/dist/rules/imports/noTestCode.d.ts +1 -1
  268. package/dist/rules/imports/noTestCode.d.ts.map +1 -1
  269. package/dist/rules/imports/resolvable.d.ts +1 -1
  270. package/dist/rules/imports/resolvable.d.ts.map +1 -1
  271. package/dist/rules/imports/resolvable.js +4 -3
  272. package/dist/rules/imports/resolvable.js.map +1 -1
  273. package/dist/rules/imports/runtime.d.ts +1 -1
  274. package/dist/rules/imports/runtime.d.ts.map +1 -1
  275. package/dist/rules/imports/runtime.js +29 -25
  276. package/dist/rules/imports/runtime.js.map +1 -1
  277. package/dist/rules/manifestsApplication.d.ts +1 -1
  278. package/dist/rules/manifestsApplication.d.ts.map +1 -1
  279. package/dist/rules/manifestsApplication.js +2 -12
  280. package/dist/rules/manifestsApplication.js.map +1 -1
  281. package/dist/rules/manifestsExportsShape.d.ts +1 -1
  282. package/dist/rules/manifestsExportsShape.d.ts.map +1 -1
  283. package/dist/rules/manifestsExportsShape.js +12 -7
  284. package/dist/rules/manifestsExportsShape.js.map +1 -1
  285. package/dist/rules/manifestsSorted.d.ts +1 -1
  286. package/dist/rules/manifestsSorted.d.ts.map +1 -1
  287. package/dist/rules/manifestsSorted.js +10 -14
  288. package/dist/rules/manifestsSorted.js.map +1 -1
  289. package/dist/rules/manifestsSourceFirst.d.ts +1 -1
  290. package/dist/rules/manifestsSourceFirst.d.ts.map +1 -1
  291. package/dist/rules/manifestsSourceFirst.js +20 -23
  292. package/dist/rules/manifestsSourceFirst.js.map +1 -1
  293. package/dist/rules/manifestsValid.d.ts +2 -0
  294. package/dist/rules/manifestsValid.d.ts.map +1 -0
  295. package/dist/rules/manifestsValid.js +10 -0
  296. package/dist/rules/manifestsValid.js.map +1 -0
  297. package/dist/rules/maxDepth.d.ts +1 -1
  298. package/dist/rules/maxDepth.d.ts.map +1 -1
  299. package/dist/rules/maxLines.d.ts +1 -1
  300. package/dist/rules/maxLines.d.ts.map +1 -1
  301. package/dist/rules/noBarrel.d.ts +1 -1
  302. package/dist/rules/noBarrel.d.ts.map +1 -1
  303. package/dist/rules/react/jsxConditionals.d.ts +1 -1
  304. package/dist/rules/react/jsxConditionals.d.ts.map +1 -1
  305. package/dist/rules/stories/authSql.d.ts +1 -1
  306. package/dist/rules/stories/authSql.d.ts.map +1 -1
  307. package/dist/rules/stories/domainOutcomes.d.ts +1 -1
  308. package/dist/rules/stories/domainOutcomes.d.ts.map +1 -1
  309. package/dist/rules/stories/domainOutcomes.js +3 -3
  310. package/dist/rules/stories/domainOutcomes.js.map +1 -1
  311. package/dist/rules/stories/engine.d.ts +1 -1
  312. package/dist/rules/stories/engine.d.ts.map +1 -1
  313. package/dist/rules/stories/groupedOutcomes.d.ts +1 -1
  314. package/dist/rules/stories/groupedOutcomes.d.ts.map +1 -1
  315. package/dist/rules/stories/groupedOutcomes.js +2 -2
  316. package/dist/rules/stories/groupedOutcomes.js.map +1 -1
  317. package/dist/rules/stories/httpStatus.d.ts +1 -1
  318. package/dist/rules/stories/httpStatus.d.ts.map +1 -1
  319. package/dist/rules/stories/namedValues.d.ts +1 -1
  320. package/dist/rules/stories/namedValues.d.ts.map +1 -1
  321. package/dist/rules/stories/noExpect.d.ts +1 -1
  322. package/dist/rules/stories/noExpect.d.ts.map +1 -1
  323. package/dist/rules/stories/noLimitImports.d.ts +1 -1
  324. package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
  325. package/dist/rules/stories/prerequisites.d.ts.map +1 -1
  326. package/dist/rules/stories/prerequisites.js +3 -6
  327. package/dist/rules/stories/prerequisites.js.map +1 -1
  328. package/dist/rules/stories/queueSql.d.ts +1 -1
  329. package/dist/rules/stories/queueSql.d.ts.map +1 -1
  330. package/dist/rules/stories/setup.d.ts +1 -1
  331. package/dist/rules/stories/setup.d.ts.map +1 -1
  332. package/dist/rules/stories/sources.d.ts +4 -0
  333. package/dist/rules/stories/sources.d.ts.map +1 -0
  334. package/dist/rules/stories/{specSources.js → sources.js} +6 -6
  335. package/dist/rules/stories/sources.js.map +1 -0
  336. package/dist/rules/stories/specHelpers.d.ts +1 -1
  337. package/dist/rules/stories/specHelpers.d.ts.map +1 -1
  338. package/dist/rules/stories/specs.d.ts +1 -1
  339. package/dist/rules/stories/specs.d.ts.map +1 -1
  340. package/dist/rules/stories/waitOnEvents.d.ts +1 -1
  341. package/dist/rules/stories/waitOnEvents.d.ts.map +1 -1
  342. package/dist/rules/stories/waitOnEvents.js +4 -4
  343. package/dist/rules/stories/waitOnEvents.js.map +1 -1
  344. package/dist/rules/suppressions/biome/declarations.d.ts.map +1 -1
  345. package/dist/rules/suppressions/biome/declarations.js +2 -4
  346. package/dist/rules/suppressions/biome/declarations.js.map +1 -1
  347. package/dist/rules/suppressions/biome/resolvePackage.d.ts.map +1 -1
  348. package/dist/rules/suppressions/biome/resolvePackage.js +3 -15
  349. package/dist/rules/suppressions/biome/resolvePackage.js.map +1 -1
  350. package/dist/rules/suppressions/biomeOverrides.d.ts +1 -1
  351. package/dist/rules/suppressions/biomeOverrides.d.ts.map +1 -1
  352. package/dist/rules/suppressions/biomeRecommended.d.ts +6 -3
  353. package/dist/rules/suppressions/biomeRecommended.d.ts.map +1 -1
  354. package/dist/rules/suppressions/biomeRecommended.js +10 -7
  355. package/dist/rules/suppressions/biomeRecommended.js.map +1 -1
  356. package/dist/rules/suppressions/noDoubleCast.d.ts +1 -1
  357. package/dist/rules/suppressions/noDoubleCast.d.ts.map +1 -1
  358. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts +1 -1
  359. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts.map +1 -1
  360. package/dist/rules/suppressions/noIgnoreDeprecations.js +7 -7
  361. package/dist/rules/suppressions/noIgnoreDeprecations.js.map +1 -1
  362. package/dist/rules/suppressions/noInline.d.ts +1 -1
  363. package/dist/rules/suppressions/noInline.d.ts.map +1 -1
  364. package/dist/rules/test-names/colocated.d.ts +1 -1
  365. package/dist/rules/test-names/colocated.d.ts.map +1 -1
  366. package/dist/rules/test-names/follow.d.ts +1 -1
  367. package/dist/rules/test-names/follow.d.ts.map +1 -1
  368. package/dist/rules/unusedCode.d.ts +1 -1
  369. package/dist/rules/unusedCode.d.ts.map +1 -1
  370. package/package.json +2 -9
  371. package/src/PackageManifest.ts +24 -0
  372. package/src/adapters/TestOutput.ts +9 -0
  373. package/src/adapters/biome/run.ts +45 -0
  374. package/src/adapters/knip/configuration.ts +2 -10
  375. package/src/adapters/knip/entryPointFindings.ts +2 -1
  376. package/src/adapters/knip/run.ts +42 -44
  377. package/src/adapters/manifestInventory.ts +87 -0
  378. package/src/adapters/manifestReader.ts +11 -0
  379. package/src/{testProjects.ts → adapters/testProjects.ts} +4 -3
  380. package/src/appTestConfig.ts +1 -1
  381. package/src/baseline/format.ts +2 -2
  382. package/src/baseline/installDriver.ts +6 -2
  383. package/src/baseline/legacy.ts +2 -2
  384. package/src/baseline/merge.ts +1 -1
  385. package/src/baseline/shards.ts +1 -1
  386. package/src/biome/exceptionConfig.ts +19 -34
  387. package/src/biome/recommendedRules.ts +19 -17
  388. package/src/biome/relocateConfig.ts +59 -0
  389. package/src/biome/report.ts +21 -14
  390. package/src/biome/withoutEntryPointImports.ts +2 -12
  391. package/src/cli/baseline.ts +3 -2
  392. package/src/cli/fix.ts +16 -18
  393. package/src/cli/lint.ts +3 -2
  394. package/src/cli/migrateBaseline.ts +4 -3
  395. package/src/cli/migrateExceptions.ts +6 -4
  396. package/src/cli/runMain.ts +4 -2
  397. package/src/cli/shrink.ts +4 -4
  398. package/src/config/decode.ts +1 -3
  399. package/src/config/load.ts +2 -2
  400. package/src/decoded.ts +9 -5
  401. package/src/docs/documentedModule.ts +1 -4
  402. package/src/docs/importFindings.ts +0 -5
  403. package/src/engine/baselineFile.ts +2 -2
  404. package/src/engine/runRules.ts +34 -15
  405. package/src/engine/session.ts +14 -11
  406. package/src/exceptions/declaration.ts +2 -2
  407. package/src/exceptions/registry.ts +2 -4
  408. package/src/failure.ts +6 -1
  409. package/src/git/base.ts +16 -13
  410. package/src/git/command.ts +10 -9
  411. package/src/git/history.ts +6 -2
  412. package/src/hooks/forwarding.ts +2 -2
  413. package/src/hooks/install.ts +2 -2
  414. package/src/hooks/location.ts +3 -3
  415. package/src/hooks/preCommit.ts +10 -16
  416. package/src/hooks/status.ts +1 -1
  417. package/src/hooks/uninstall.ts +5 -5
  418. package/src/imports/classifyRuntime.ts +30 -0
  419. package/src/imports/fences/declarations.ts +1 -3
  420. package/src/imports/pnpmWorkspacePatterns.ts +3 -1
  421. package/src/imports/runtime.ts +48 -60
  422. package/src/imports/withoutGenerated.ts +25 -38
  423. package/src/imports/workspace.ts +9 -20
  424. package/src/inventory/collect.ts +7 -4
  425. package/src/inventory/filesystem.ts +2 -10
  426. package/src/inventory/shadcnFolders.ts +4 -2
  427. package/src/inventory/trackedPaths.ts +22 -24
  428. package/src/inventory/walk.ts +7 -11
  429. package/src/manifests/entryPoints.ts +2 -12
  430. package/src/manifests/sorted.ts +24 -10
  431. package/src/naming/packageLayout.ts +2 -12
  432. package/src/rule.ts +38 -19
  433. package/src/rules/biome.ts +9 -5
  434. package/src/rules/builtIn.ts +2 -0
  435. package/src/rules/comments/noEnvironmentPragma.ts +1 -1
  436. package/src/rules/docs/references.ts +8 -10
  437. package/src/rules/docs/unversionedInstalls.ts +1 -1
  438. package/src/rules/effect/serviceTypes.ts +13 -0
  439. package/src/rules/files/packageImports.ts +2 -13
  440. package/src/rules/imports/manifest.ts +15 -32
  441. package/src/rules/imports/resolvable.ts +4 -3
  442. package/src/rules/imports/runtime.ts +41 -35
  443. package/src/rules/manifestsApplication.ts +2 -12
  444. package/src/rules/manifestsExportsShape.ts +11 -8
  445. package/src/rules/manifestsSorted.ts +13 -16
  446. package/src/rules/manifestsSourceFirst.ts +24 -24
  447. package/src/rules/manifestsValid.ts +14 -0
  448. package/src/rules/stories/domainOutcomes.ts +3 -4
  449. package/src/rules/stories/groupedOutcomes.ts +2 -3
  450. package/src/rules/stories/prerequisites.ts +4 -8
  451. package/src/rules/stories/{specSources.ts → sources.ts} +5 -5
  452. package/src/rules/stories/waitOnEvents.ts +4 -5
  453. package/src/rules/suppressions/biome/declarations.ts +2 -4
  454. package/src/rules/suppressions/biome/resolvePackage.ts +5 -21
  455. package/src/rules/suppressions/biomeRecommended.ts +14 -9
  456. package/src/rules/suppressions/noIgnoreDeprecations.ts +11 -8
  457. package/dist/biome/run.d.ts +0 -8
  458. package/dist/biome/run.d.ts.map +0 -1
  459. package/dist/biome/run.js +0 -28
  460. package/dist/biome/run.js.map +0 -1
  461. package/dist/rules/stories/specSources.d.ts +0 -4
  462. package/dist/rules/stories/specSources.d.ts.map +0 -1
  463. package/dist/rules/stories/specSources.js.map +0 -1
  464. package/dist/testProjects.d.ts.map +0 -1
  465. package/dist/testProjects.js.map +0 -1
  466. package/src/biome/run.ts +0 -41
  467. /package/dist/{testProjects.d.ts → adapters/testProjects.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
1
  import { fileURLToPath } from "node:url";
2
- import { Config, ConfigProvider, Effect } from "effect";
2
+ import { Effect } from "effect";
3
3
  import { coverageConfigDefaults, defaultExclude, type TestUserConfig } from "vitest/config";
4
4
  import type { Environment } from "#naming/testName.ts";
5
+ import { TestOutput } from "./TestOutput.ts";
5
6
 
6
7
  const EXTENSION = "?(c|m)[jt]s?(x)";
7
8
 
@@ -41,7 +42,7 @@ function workerCount({ connectionBudget = 80, connectionsPerWorker = 14, maxWork
41
42
 
42
43
  export function testProjects(options: TestProjectsOptions = {}): TestUserConfig {
43
44
  const { coverage = false } = options;
44
- const ci = Effect.runSync(Config.String("CI").pipe(Config.withDefault("")).parse(ConfigProvider.fromEnv()));
45
+ const output = Effect.runSync(TestOutput.pipe(Effect.provide(TestOutput.layer)));
45
46
  return {
46
47
  maxWorkers: workerCount(options),
47
48
  ...(coverage === false
@@ -82,7 +83,7 @@ export function testProjects(options: TestProjectsOptions = {}): TestUserConfig
82
83
  },
83
84
  { extends: true, test: { environment: "node", exclude: excluding(), include: [named("slow")], name: "slow" } },
84
85
  ],
85
- silent: ci ? false : "passed-only",
86
+ ...output,
86
87
  // Tests that start real servers, browsers or CLIs need seconds on a busy CI runner, and Vitest's 5s default fails them for load, not behavior.
87
88
  testTimeout: 30_000,
88
89
  };
@@ -1,5 +1,5 @@
1
1
  import { defineConfig } from "vitest/config";
2
- import { type TestProjectsOptions, testProjects } from "#testProjects.ts";
2
+ import { type TestProjectsOptions, testProjects } from "#adapters/testProjects.ts";
3
3
 
4
4
  export function appTestConfig(conditions: string[] = [], options: Pick<TestProjectsOptions, "coverage"> = {}) {
5
5
  return defineConfig({
@@ -8,7 +8,7 @@ const Line = Schema.Struct({
8
8
  rule: Schema.NonEmptyString,
9
9
  });
10
10
 
11
- const standard = Schema.toStandardSchemaV1(Schema.fromJsonString(Line), { parseOptions: { errors: "all", onExcessProperty: "error" } });
11
+ const BaselineLine = Schema.fromJsonString(Line);
12
12
 
13
13
  export interface BaselineEntry {
14
14
  readonly count: number;
@@ -36,7 +36,7 @@ export async function decodeBaseline(raw: string | undefined): Promise<Decoded<r
36
36
  const entries: BaselineEntry[] = [];
37
37
  const seen = new Set<string>();
38
38
  for (const { line, text } of linesOf(raw)) {
39
- const decoded = await decodeWith(standard, text);
39
+ const decoded = await decodeWith(BaselineLine, text);
40
40
  if (decoded._tag === "Invalid") {
41
41
  issues.push(...decoded.issues.map((issue) => `line ${line}: ${issue}`));
42
42
  continue;
@@ -1,9 +1,13 @@
1
1
  import { Console, Effect } from "effect";
2
+ import type { ChildProcessSpawner } from "effect/process";
2
3
  import type { SetupFailure } from "#failure.ts";
3
- import { type Git, gitOrFail } from "#git/command.ts";
4
+ import { gitOrFail } from "#git/command.ts";
4
5
  import { hookCommand, type Launch, shellWords } from "#hooks/command.ts";
5
6
 
6
- export const installDriver = Effect.fn("Baseline.installDriver")(function* (cwd: string, launch: Launch): Effect.fn.Return<void, SetupFailure, Git> {
7
+ export const installDriver = Effect.fn("Baseline.installDriver")(function* (
8
+ cwd: string,
9
+ launch: Launch,
10
+ ): Effect.fn.Return<void, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
7
11
  const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
8
12
  const command = hookCommand(root, launch, undefined);
9
13
  const driver = `${shellWords([...command.runner, command.launcher, "baseline", "merge"])} "%O" "%A" "%B"`;
@@ -13,14 +13,14 @@ const Entry = Schema.Struct({
13
13
 
14
14
  const LegacyFile = Schema.Record(Schema.String, Schema.Record(Schema.String, Entry));
15
15
 
16
- const standard = Schema.toStandardSchemaV1(Schema.fromJsonString(LegacyFile), { parseOptions: { errors: "all", onExcessProperty: "error" } });
16
+ const LegacySchema = Schema.fromJsonString(LegacyFile);
17
17
 
18
18
  export interface LegacyEntry extends BaselineEntry {
19
19
  readonly measure?: number | undefined;
20
20
  }
21
21
 
22
22
  export async function decodeLegacyBaseline(raw: string): Promise<Decoded<readonly LegacyEntry[]>> {
23
- const decoded = await decodeWith(standard, raw);
23
+ const decoded = await decodeWith(LegacySchema, raw);
24
24
  if (decoded._tag === "Invalid") {
25
25
  return decoded;
26
26
  }
@@ -30,5 +30,5 @@ export const mergeBaseline = Effect.fn("Baseline.mergeBaseline")(
30
30
  );
31
31
  yield* fs.writeFileString(ours, encodeBaseline(mergeEntries(entries[0] ?? [], entries[1] ?? [], entries[2] ?? [])));
32
32
  },
33
- Effect.mapError((failure) => new SetupFailure({ message: failure.message })),
33
+ Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })),
34
34
  );
@@ -56,5 +56,5 @@ export const saveShards = Effect.fn("Baseline.saveShards")(
56
56
  }
57
57
  }
58
58
  },
59
- Effect.mapError((failure) => new SetupFailure({ message: failure.message })),
59
+ Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })),
60
60
  );
@@ -1,11 +1,8 @@
1
- import { randomUUID } from "node:crypto";
2
- import { rm, writeFile } from "node:fs/promises";
3
1
  import { join } from "node:path";
4
- import { NodeFileSystem } from "@effect/platform-node";
5
2
  import { Effect, Schema } from "effect";
6
- import ts from "typescript";
7
3
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
8
4
  import { readOptionalText } from "#inventory/filesystem.ts";
5
+ import { parseConfig, relocateConfig } from "./relocateConfig.ts";
9
6
 
10
7
  function nativeOverride(files: readonly string[], rule: string): unknown {
11
8
  const [, tool, group = "", name = ""] = rule.split("/");
@@ -27,53 +24,41 @@ export function exceptionConfig(declarations: readonly ExceptionDeclaration[]):
27
24
  };
28
25
  }
29
26
 
30
- export async function withExceptionConfig<TValue>(
27
+ export const withExceptionConfig = Effect.fn("Biome.withExceptionConfig")(function* <TValue, TError, TRequirements>(
31
28
  root: string,
32
29
  declarations: readonly ExceptionDeclaration[],
33
- run: (args: readonly string[]) => Promise<TValue>,
34
- ): Promise<TValue> {
30
+ run: (args: readonly string[]) => Effect.Effect<TValue, TError, TRequirements>,
31
+ ) {
35
32
  const { includes, overrides } = exceptionConfig(declarations);
36
33
  if (includes.length === 0 && overrides.length === 0) {
37
- return run([]);
34
+ return yield* run([]);
38
35
  }
39
- const name = `.quality-biome-${randomUUID()}.json`;
40
- const path = join(root, name);
41
- const { config, text } = await Effect.runPromise(
42
- Effect.gen(function* () {
43
- for (const candidate of ["biome.json", "biome.jsonc"]) {
44
- const content = yield* readOptionalText(join(root, candidate));
45
- if (content !== undefined) {
46
- return { config: candidate, text: content };
47
- }
36
+ const { config, text } = yield* Effect.gen(function* () {
37
+ for (const candidate of ["biome.json", "biome.jsonc"]) {
38
+ const content = yield* readOptionalText(join(root, candidate));
39
+ if (content !== undefined) {
40
+ return { config: candidate, text: content };
48
41
  }
49
- return { config: "biome.json", text: "{}" };
50
- }).pipe(Effect.provide(NodeFileSystem.layer)),
51
- );
52
- const parsed = ts.parseConfigFileTextToJson(config, text);
53
- if (parsed.error !== undefined) {
54
- throw new Error(`Cannot load ${config}: ${ts.flattenDiagnosticMessageText(parsed.error.messageText, " ")}`);
55
- }
56
- const own = Schema.decodeUnknownSync(Schema.Record(Schema.String, Schema.Unknown))(parsed.config);
42
+ }
43
+ return { config: "biome.json", text: "{}" };
44
+ });
45
+ const own = yield* parseConfig(config, text);
57
46
  const files = Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files) ? own.files : {};
58
47
  if (
59
48
  (own.files !== undefined && !Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files))
60
49
  || (files.includes !== undefined && !Array.isArray(files.includes))
61
50
  || (own.overrides !== undefined && !Array.isArray(own.overrides))
62
51
  ) {
63
- throw new Error(`Cannot merge exceptions into invalid ${config}: files, includes or overrides has the wrong shape.`);
52
+ return yield* Effect.die(new Error(`Cannot merge exceptions into invalid ${config}: files, includes or overrides has the wrong shape.`));
64
53
  }
65
54
  const previousIncludes = Array.isArray(files.includes) ? files.includes : ["**"];
66
55
  const previousOverrides = Array.isArray(own.overrides) ? own.overrides : [];
67
56
  // Biome also matches a wildcard-led glob such as `!**/.worktrees` against the folders above the root, which ignores a whole linked worktree.
68
57
  const generated = {
69
58
  ...own,
70
- files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", `!${name}`] },
59
+ files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", "!.quality-biome-*"] },
71
60
  overrides: [...previousOverrides, ...overrides],
72
61
  };
73
- try {
74
- await writeFile(path, JSON.stringify(generated), { flag: "wx" });
75
- return await run([`--config-path=${path}`]);
76
- } finally {
77
- await rm(path, { force: true });
78
- }
79
- }
62
+ const path = yield* relocateConfig(root, join(root, config), generated);
63
+ return yield* run([`--config-path=${path}`]);
64
+ });
@@ -1,23 +1,25 @@
1
- import { mkdtemp, rm, writeFile } from "node:fs/promises";
2
- import { tmpdir } from "node:os";
3
1
  import { join } from "node:path";
4
- import { runBiome } from "./run.ts";
2
+ import { Effect, FileSystem } from "effect";
3
+ import { runBiome } from "#adapters/biome/run.ts";
5
4
 
6
5
  const RECOMMENDED_ONLY = '{ "linter": { "rules": { "preset": "recommended" } } }\n';
7
6
 
8
7
  const ENABLED_RULE = /^ {4}(?<rule>[a-z0-9]+\/\w+)$/gimu;
9
8
 
10
- export async function recommendedRules(): Promise<readonly string[]> {
11
- const directory = await mkdtemp(join(tmpdir(), "quality-biome-recommended-"));
12
- try {
13
- await writeFile(join(directory, "biome.json"), RECOMMENDED_ONLY);
14
- const rage = await runBiome(directory, ["rage", "--linter"]);
15
- const rules = [...rage.stdout.matchAll(ENABLED_RULE)].flatMap((match) => match.groups?.rule ?? []);
16
- if (rules.length === 0) {
17
- throw new Error(`biome rage --linter listed no enabled rules under the recommended preset:\n${[rage.stdout, rage.stderr].join("\n").trim()}`);
18
- }
19
- return rules;
20
- } finally {
21
- await rm(directory, { force: true, recursive: true });
22
- }
23
- }
9
+ export const recommendedRules = Effect.fn("Biome.recommendedRules")(function* () {
10
+ return yield* Effect.scoped(
11
+ Effect.gen(function* () {
12
+ const fs = yield* FileSystem.FileSystem;
13
+ const directory = yield* fs.makeTempDirectoryScoped({ prefix: "quality-biome-recommended-" });
14
+ yield* fs.writeFileString(join(directory, "biome.json"), RECOMMENDED_ONLY);
15
+ const rage = yield* runBiome(directory, ["rage", "--linter"]);
16
+ const rules = [...rage.stdout.matchAll(ENABLED_RULE)].flatMap((match) => match.groups?.rule ?? []);
17
+ if (rules.length === 0) {
18
+ return yield* Effect.die(
19
+ new Error(`biome rage --linter listed no enabled rules under the recommended preset:\n${[rage.stdout, rage.stderr].join("\n").trim()}`),
20
+ );
21
+ }
22
+ return rules;
23
+ }),
24
+ );
25
+ });
@@ -0,0 +1,59 @@
1
+ import { createRequire } from "node:module";
2
+ import { dirname, resolve } from "node:path";
3
+ import { Effect, FileSystem, type PlatformError, Schema, type Scope } from "effect";
4
+ import ts from "typescript";
5
+
6
+ const ObjectConfig = Schema.Record(Schema.String, Schema.Unknown);
7
+
8
+ export function parseConfig(path: string, text: string) {
9
+ const parsed = ts.parseConfigFileTextToJson(path, text);
10
+ return parsed.error === undefined
11
+ ? Schema.decodeUnknownEffect(ObjectConfig)(parsed.config)
12
+ : Effect.die(new Error(`Cannot load ${path}: ${ts.flattenDiagnosticMessageText(parsed.error.messageText, " ")}`));
13
+ }
14
+
15
+ const writeConfig = Effect.fn("Biome.writeConfig")(function* (
16
+ root: string,
17
+ original: string,
18
+ config: Readonly<Record<string, unknown>>,
19
+ paths: Map<string, string>,
20
+ ): Effect.fn.Return<string, PlatformError.PlatformError | Schema.SchemaError, FileSystem.FileSystem | Scope.Scope> {
21
+ const existing = paths.get(original);
22
+ if (existing !== undefined) {
23
+ return existing;
24
+ }
25
+ const fs = yield* FileSystem.FileSystem;
26
+ const path = yield* fs.makeTempFileScoped({ directory: root, prefix: ".quality-biome-", suffix: ".json" });
27
+ paths.set(original, path);
28
+ const require = createRequire(original);
29
+ const extended: string[] = [];
30
+ for (const specifier of Array.isArray(config.extends) ? config.extends : []) {
31
+ const source = specifier.startsWith(".") ? resolve(dirname(original), specifier) : require.resolve(specifier);
32
+ const inherited = yield* parseConfig(source, yield* fs.readFileString(source));
33
+ extended.push(yield* writeConfig(root, source, inherited, paths));
34
+ }
35
+ const vcs = config.vcs ?? {};
36
+ const generated = {
37
+ ...config,
38
+ ...(Array.isArray(config.extends) ? { extends: extended } : {}),
39
+ ...(Array.isArray(config.plugins)
40
+ ? {
41
+ plugins: config.plugins.map((plugin) =>
42
+ typeof plugin === "string" ? resolve(root, plugin) : { ...plugin, path: resolve(root, plugin.path) },
43
+ ),
44
+ }
45
+ : {}),
46
+ vcs: Schema.is(ObjectConfig)(vcs)
47
+ ? {
48
+ ...vcs,
49
+ root: typeof vcs.root === "string" ? resolve(root, vcs.root) : (vcs.root ?? root),
50
+ }
51
+ : vcs,
52
+ };
53
+ yield* fs.writeFileString(path, JSON.stringify(generated));
54
+ return path;
55
+ });
56
+
57
+ export function relocateConfig(root: string, original: string, config: Readonly<Record<string, unknown>>) {
58
+ return writeConfig(root, original, config, new Map());
59
+ }
@@ -1,9 +1,10 @@
1
1
  import { relative, sep } from "node:path";
2
- import { Schema } from "effect";
2
+ import { Effect, Schema } from "effect";
3
+ import { type BiomeRun, runBiome } from "#adapters/biome/run.ts";
3
4
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
5
+ import { SetupFailure } from "#failure.ts";
4
6
  import { ignoredTrackedPaths } from "#inventory/trackedPaths.ts";
5
7
  import { recognizeDiagnostics } from "./recognizeDiagnostics.ts";
6
- import { type BiomeRun, runBiome } from "./run.ts";
7
8
 
8
9
  const Position = Schema.Struct({ column: Schema.optionalKey(Schema.Int), line: Schema.Int });
9
10
 
@@ -27,8 +28,8 @@ const decodeReport = Schema.decodeUnknownOption(Schema.fromJsonString(Report));
27
28
 
28
29
  export const FAILING: ReadonlySet<string> = new Set(["error", "fatal"]);
29
30
 
30
- function failure(args: readonly string[], run: BiomeRun, missing: string, output: string): Error {
31
- return new Error(`biome ${args.join(" ")} exited ${run.code} without ${missing}:\n${output.trim()}`);
31
+ function failure(args: readonly string[], run: BiomeRun, missing: string, output: string): SetupFailure {
32
+ return new SetupFailure({ message: `biome ${args.join(" ")} exited ${run.code} without ${missing}:\n${output.trim()}` });
32
33
  }
33
34
 
34
35
  // Biome exits with an error but prints an empty report when no file was processed, so only a failing diagnostic explains a failed run.
@@ -36,35 +37,41 @@ function unexplained(run: BiomeRun, report: Report): boolean {
36
37
  return run.code !== 0 && !report.diagnostics.some((diagnostic) => FAILING.has(diagnostic.severity));
37
38
  }
38
39
 
39
- async function reportFor(
40
+ const reportFor = Effect.fn("Biome.reportFor")(function* (
40
41
  root: string,
41
42
  args: readonly string[],
42
43
  paths: readonly string[],
43
44
  exceptions: readonly ExceptionDeclaration[],
44
- ): Promise<Report> {
45
+ ) {
45
46
  const command = [...args, "--reporter=json", "--max-diagnostics=none", ...paths];
46
- const run = await runBiome(root, command, exceptions);
47
+ const run = yield* runBiome(root, command, exceptions);
47
48
  const report = decodeReport(run.stdout.trim());
48
49
  if (report._tag === "None") {
49
- throw failure(command, run, "a report", [run.stdout, run.stderr].join("\n"));
50
+ return yield* Effect.fail(failure(command, run, "a report", [run.stdout, run.stderr].join("\n")));
50
51
  }
51
52
  if (unexplained(run, report.value)) {
52
- throw failure(command, run, "a failing diagnostic", run.stderr);
53
+ return yield* Effect.fail(failure(command, run, "a failing diagnostic", run.stderr));
53
54
  }
54
55
  return report.value;
55
- }
56
+ });
56
57
 
57
- export async function biomeReport(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[] = []): Promise<Report> {
58
- const [report, tracked] = await Promise.all([reportFor(root, args, ["."], exceptions), ignoredTrackedPaths(root)]);
58
+ export const biomeReport = Effect.fn("Biome.biomeReport")(function* (
59
+ root: string,
60
+ args: readonly string[],
61
+ exceptions: readonly ExceptionDeclaration[] = [],
62
+ ) {
63
+ const [report, tracked] = yield* Effect.all([reportFor(root, args, ["."], exceptions), ignoredTrackedPaths(root)], {
64
+ concurrency: "unbounded",
65
+ });
59
66
  const paths = tracked
60
67
  .map((path) => relative(root, path))
61
68
  .filter((path) => !path.split(sep).some((part) => part === ".git" || part === ".worktrees" || part === "node_modules"));
62
69
  const extra =
63
- paths.length === 0 ? undefined : await reportFor(root, [...args, "--vcs-enabled=false", "--no-errors-on-unmatched"], paths, exceptions);
70
+ paths.length === 0 ? undefined : yield* reportFor(root, [...args, "--vcs-enabled=false", "--no-errors-on-unmatched"], paths, exceptions);
64
71
  const diagnostics = [...report.diagnostics, ...(extra?.diagnostics ?? [])];
65
72
  const unique = [...new Map(diagnostics.map((diagnostic) => [JSON.stringify(diagnostic), diagnostic])).values()];
66
73
  return {
67
74
  diagnostics: recognizeDiagnostics(root, unique),
68
75
  summary: { changed: report.summary.changed + (extra?.summary.changed ?? 0) },
69
76
  };
70
- }
77
+ });
@@ -1,4 +1,5 @@
1
1
  import { posix } from "node:path";
2
+ import { readPackageManifest } from "#adapters/manifestInventory.ts";
2
3
  import { isTooling } from "#imports/isTooling.ts";
3
4
  import { entryPointsOf, isApplication, provider } from "#manifests/entryPoints.ts";
4
5
  import { isTestCode } from "#naming/testName.ts";
@@ -9,21 +10,10 @@ const UNDECLARED = "lint/correctness/noUndeclaredDependencies";
9
10
 
10
11
  const DEPENDENCY = /^Dependency (?<name>\S+) isn't specified in /u;
11
12
 
12
- function parsed(text: string | undefined): unknown {
13
- if (text === undefined) {
14
- return undefined;
15
- }
16
- try {
17
- return JSON.parse(text);
18
- } catch {
19
- return undefined;
20
- }
21
- }
22
-
23
13
  async function ownerOf(readText: RuleInputs["readText"], path: string) {
24
14
  let directory = posix.dirname(path);
25
15
  for (;;) {
26
- const manifest = parsed(await readText(posix.join(directory, "package.json")));
16
+ const manifest = await readPackageManifest(readText, posix.join(directory, "package.json"));
27
17
  if (manifest !== undefined || directory === ".") {
28
18
  return { directory, manifest };
29
19
  }
@@ -6,6 +6,7 @@ import { openSession, type Session } from "#engine/session.ts";
6
6
  import { applyRegistry } from "#exceptions/registry.ts";
7
7
  import { SetupFailure } from "#failure.ts";
8
8
  import { plural } from "#report/plural.ts";
9
+ import type { RuleServices } from "#rule.ts";
9
10
 
10
11
  function save(session: Session, entries: readonly BaselineEntry[]): Effect.Effect<void, SetupFailure, FileSystem.FileSystem> {
11
12
  return saveShards(session.config, session.baseline.files, entries);
@@ -19,7 +20,7 @@ export const writeBaseline = Effect.fn("Cli.writeBaseline")(function* (
19
20
  cwd: string,
20
21
  config: string | undefined,
21
22
  rules: readonly string[],
22
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
23
+ ): Effect.fn.Return<void, SetupFailure, RuleServices> {
23
24
  const session = yield* openSession(cwd, config);
24
25
  const existing = session.baseline.files.size === 0 ? undefined : session.baseline.entries;
25
26
  const adoption = adopt(existing, rules, unregistered(session), session.config);
@@ -47,7 +48,7 @@ export const shrinkBaseline = Effect.fn("Cli.shrinkBaseline")(function* <TRequir
47
48
  cwd: string,
48
49
  config: string | undefined,
49
50
  scopeOf: (session: Session) => Effect.Effect<Scope, SetupFailure, TRequirements>,
50
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem | TRequirements> {
51
+ ): Effect.fn.Return<void, SetupFailure, RuleServices | TRequirements> {
51
52
  const session = yield* openSession(cwd, config);
52
53
  if (session.baseline.files.size === 0) {
53
54
  return yield* Console.log(`quality: no baseline at ${session.config.baseline}; nothing to lower.`);
package/src/cli/fix.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { relative } from "node:path";
2
2
  import { Console, Effect, FileSystem } from "effect";
3
- import { biomeReport, type Report } from "#biome/report.ts";
3
+ import { biomeReport } from "#biome/report.ts";
4
4
  import { loadConfig } from "#config/load.ts";
5
5
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
6
6
  import { SetupFailure } from "#failure.ts";
@@ -8,21 +8,15 @@ import { posix } from "#inventory/ignoreScope.ts";
8
8
  import { walk } from "#inventory/walk.ts";
9
9
  import { sortManifests } from "#manifests/sorted.ts";
10
10
  import { plural } from "#report/plural.ts";
11
+ import type { RuleServices } from "#rule.ts";
11
12
 
12
13
  export const MAX_FIX_ROUNDS = 5;
13
14
 
14
- function biome(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[]): Effect.Effect<Report, SetupFailure> {
15
- return Effect.tryPromise({
16
- catch: (cause) => new SetupFailure({ message: cause instanceof Error ? cause.message : String(cause) }),
17
- try: () => biomeReport(root, args, exceptions),
18
- });
19
- }
20
-
21
15
  function isBinary(bytes: Uint8Array): boolean {
22
16
  return bytes.includes(0);
23
17
  }
24
18
 
25
- export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, FileSystem.FileSystem> {
19
+ export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, RuleServices> {
26
20
  return Effect.gen(function* () {
27
21
  const fs = yield* FileSystem.FileSystem;
28
22
  const decoder = new TextDecoder();
@@ -31,7 +25,7 @@ export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, stri
31
25
  Effect.map(fs.readFile(path), (bytes) => (isBinary(bytes) ? [] : [[posix(relative(root, path)), decoder.decode(bytes)] as const])),
32
26
  );
33
27
  return new Map(texts.flat());
34
- }).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
28
+ }).pipe(Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
35
29
  }
36
30
 
37
31
  export interface Pass<TFailure, TRequirements> {
@@ -44,11 +38,18 @@ export interface Settling<TFailure, TRequirements> {
44
38
  readonly snapshot: Effect.Effect<ReadonlyMap<string, string>, TFailure, TRequirements>;
45
39
  }
46
40
 
47
- function changedBy(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[]): Effect.Effect<number, SetupFailure> {
48
- return Effect.map(biome(root, args, exceptions), (report) => report.summary.changed);
41
+ function changedBy(
42
+ root: string,
43
+ args: readonly string[],
44
+ exceptions: readonly ExceptionDeclaration[],
45
+ ): Effect.Effect<number, SetupFailure, RuleServices> {
46
+ return Effect.map(
47
+ biomeReport(root, args, exceptions).pipe(Effect.mapError((cause) => new SetupFailure({ cause, message: cause.message }))),
48
+ (report) => report.summary.changed,
49
+ );
49
50
  }
50
51
 
51
- function biomePasses(root: string, exceptions: readonly ExceptionDeclaration[]): readonly Pass<SetupFailure, never>[] {
52
+ function biomePasses(root: string, exceptions: readonly ExceptionDeclaration[]): readonly Pass<SetupFailure, RuleServices>[] {
52
53
  return [
53
54
  {
54
55
  label: "with fixes",
@@ -121,12 +122,9 @@ export const settle = Effect.fn("Cli.settle")(function* <TFailure, TRequirements
121
122
  return yield* unsettled(changed);
122
123
  });
123
124
 
124
- export const fix = Effect.fn("Cli.fix")(function* (
125
- cwd: string,
126
- config: string | undefined,
127
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
125
+ export const fix = Effect.fn("Cli.fix")(function* (cwd: string, config: string | undefined): Effect.fn.Return<void, SetupFailure, RuleServices> {
128
126
  const { root, exceptions } = yield* loadConfig(cwd, config);
129
- const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ message: failure.message }));
127
+ const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ cause: failure, message: failure.message }));
130
128
  yield* Console.log(`quality: sort-package-json rewrote ${plural(sorted, "manifest")}.`);
131
129
  yield* settle({ passes: biomePasses(root, exceptions), snapshot: snapshotOf(root) });
132
130
  });
package/src/cli/lint.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { relative } from "node:path";
2
- import { Console, Effect, type FileSystem } from "effect";
2
+ import { Console, Effect } from "effect";
3
3
  import { evaluate, passes } from "#engine/evaluate.ts";
4
4
  import { openSession } from "#engine/session.ts";
5
5
  import { GateFailed, type SetupFailure } from "#failure.ts";
6
6
  import { render } from "#report/render.ts";
7
+ import type { RuleServices } from "#rule.ts";
7
8
 
8
9
  export const lint = Effect.fn("Cli.lint")(function* (
9
10
  cwd: string,
10
11
  config: string | undefined,
11
- ): Effect.fn.Return<void, SetupFailure | GateFailed, FileSystem.FileSystem> {
12
+ ): Effect.fn.Return<void, SetupFailure | GateFailed, RuleServices> {
12
13
  const session = yield* openSession(cwd, config);
13
14
  const outcome = evaluate(session.violations, session.registry, session.baseline.entries, session.config);
14
15
  yield* Console.log(
@@ -9,15 +9,16 @@ import { readInput } from "#engine/baselineFile.ts";
9
9
  import { scan } from "#engine/session.ts";
10
10
  import { SetupFailure } from "#failure.ts";
11
11
  import { plural } from "#report/plural.ts";
12
+ import type { RuleServices } from "#rule.ts";
12
13
 
13
14
  export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
14
15
  cwd: string,
15
16
  configPath: string | undefined,
16
17
  from: string | undefined,
17
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
18
+ ): Effect.fn.Return<void, SetupFailure, RuleServices> {
18
19
  const config = yield* loadConfig(cwd, configPath);
19
20
  const source = from ?? LEGACY_BASELINE;
20
- const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
21
+ const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })));
21
22
  const existing = yield* Effect.forEach(paths, (path) => readInput(config.root, path));
22
23
  if (source === config.baseline || existing.some((text) => text !== undefined)) {
23
24
  return yield* new SetupFailure({ message: `${config.baseline} already exists. Migrate into a baseline file that does not exist yet.` });
@@ -32,7 +33,7 @@ export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
32
33
  const entries = source.endsWith(".jsonl") ? legacy : convertLegacy(legacy, (yield* scan(config)).violations);
33
34
  const fs = yield* FileSystem.FileSystem;
34
35
  const written = Effect.andThen(saveShards(config, new Map(), entries), fs.remove(join(config.root, source)));
35
- yield* Effect.mapError(written, (failure) => new SetupFailure({ message: failure.message }));
36
+ yield* Effect.mapError(written, (failure) => new SetupFailure({ cause: failure, message: failure.message }));
36
37
  const fixed = legacy.length - entries.length;
37
38
  const dropped = fixed > 0 ? `, dropping ${plural(fixed, "fixed entry", "fixed entries")}` : "";
38
39
  yield* Console.log(`quality: moved ${plural(entries.length, "entry", "entries")} from ${source} to ${config.baseline}${dropped}.`);
@@ -60,7 +60,7 @@ export const migrateExceptions = Effect.fnUntraced(function* (
60
60
  yield* validOrFail(config.file, yield* Effect.promise(() => decodeExceptions(entries)));
61
61
  const text = yield* readInput("", config.file);
62
62
  const next = yield* Effect.try({
63
- catch: (cause) => new SetupFailure({ message: String(cause) }),
63
+ catch: (cause) => new SetupFailure({ cause, message: String(cause) }),
64
64
  try: () => migrateConfig(text, config.file, entries, config.biomeDeclarations.length > 0),
65
65
  });
66
66
  const updates: Array<{ readonly path: string; readonly text: string }> = [{ path: config.file, text: next }];
@@ -69,7 +69,7 @@ export const migrateExceptions = Effect.fnUntraced(function* (
69
69
  const biome = yield* readInput(config.root, file);
70
70
  if (biome !== undefined) {
71
71
  const updated = yield* Effect.try({
72
- catch: (cause) => new SetupFailure({ message: String(cause) }),
72
+ catch: (cause) => new SetupFailure({ cause, message: String(cause) }),
73
73
  try: () => migrateBiome(biome, file, config.biomeDeclarations),
74
74
  });
75
75
  updates.push({ path: join(config.root, file), text: updated });
@@ -77,11 +77,13 @@ export const migrateExceptions = Effect.fnUntraced(function* (
77
77
  }
78
78
  }
79
79
  for (const update of updates) {
80
- yield* writeText(update.path, update.text).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
80
+ yield* writeText(update.path, update.text).pipe(Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
81
81
  }
82
82
  if (raw !== undefined) {
83
83
  const fs = yield* FileSystem.FileSystem;
84
- yield* fs.remove(join(config.root, registryPath)).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
84
+ yield* fs
85
+ .remove(join(config.root, registryPath))
86
+ .pipe(Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
85
87
  }
86
88
  yield* Console.log(`quality: moved exceptions to ${config.file}. Run quality fix and review the changes; remove unused declaration imports.`);
87
89
  });
@@ -5,8 +5,8 @@ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
5
5
  import * as NodePath from "@effect/platform-node/NodePath";
6
6
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
7
7
  import { Cause, Console, Effect, Exit, type FileSystem, Layer, Runtime } from "effect";
8
+ import type { ChildProcessSpawner } from "effect/process";
8
9
  import { SetupFailure } from "#failure.ts";
9
- import type { Git } from "#git/command.ts";
10
10
 
11
11
  const INTERRUPTED = 130;
12
12
  const COULD_NOT_RUN = 2;
@@ -54,7 +54,9 @@ export function explained<TValue, TError, TRequirements>(
54
54
  return Effect.tapCause(program, (cause) => (Cause.hasInterruptsOnly(cause) ? Effect.void : explain(cause)));
55
55
  }
56
56
 
57
- export function runMain<TValue, TError>(program: Effect.Effect<TValue, TError, FileSystem.FileSystem | Git>): void {
57
+ export function runMain<TValue, TError>(
58
+ program: Effect.Effect<TValue, TError, FileSystem.FileSystem | ChildProcessSpawner.ChildProcessSpawner>,
59
+ ): void {
58
60
  quietOnClosedPipe(process.stdout);
59
61
  quietOnClosedPipe(process.stderr);
60
62
  NodeRuntime.runMain(Effect.provide(explained(program), services), { disableErrorReporting: true, teardown });
package/src/cli/shrink.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Console, Effect, type FileSystem } from "effect";
2
+ import type { ChildProcessSpawner } from "effect/process";
2
3
  import type { Scope } from "#baseline/update.ts";
3
4
  import type { SetupFailure } from "#failure.ts";
4
5
  import { resolveBase } from "#git/base.ts";
5
- import type { Git } from "#git/command.ts";
6
6
  import { changesSince } from "#git/history.ts";
7
7
  import { shrinkBaseline } from "./baseline.ts";
8
8
 
9
- function followedMoves(root: string, against: string | undefined): Effect.Effect<Scope, SetupFailure, Git> {
9
+ function followedMoves(root: string, against: string | undefined): Effect.Effect<Scope, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
10
10
  return resolveBase(root, against).pipe(
11
11
  Effect.flatMap((base) => changesSince(root, [base.commit])),
12
12
  Effect.map((changes): Scope => ({ moves: changes.moves })),
@@ -21,7 +21,7 @@ export function pruneBaseline(
21
21
  cwd: string,
22
22
  config: string | undefined,
23
23
  against: string | undefined,
24
- ): Effect.Effect<void, SetupFailure, FileSystem.FileSystem | Git> {
24
+ ): Effect.Effect<void, SetupFailure, FileSystem.FileSystem | ChildProcessSpawner.ChildProcessSpawner> {
25
25
  return shrinkBaseline(cwd, config, (session) => followedMoves(session.config.root, against));
26
26
  }
27
27
 
@@ -29,6 +29,6 @@ export function tightenBaseline(
29
29
  cwd: string,
30
30
  config: string | undefined,
31
31
  staged: boolean,
32
- ): Effect.Effect<void, SetupFailure, FileSystem.FileSystem | Git> {
32
+ ): Effect.Effect<void, SetupFailure, FileSystem.FileSystem | ChildProcessSpawner.ChildProcessSpawner> {
33
33
  return shrinkBaseline(cwd, config, (session) => changesSince(session.config.root, staged ? ["--cached"] : ["HEAD"]));
34
34
  }