@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
@@ -34,8 +34,6 @@ const ConfigInput = Schema.Struct({
34
34
 
35
35
  export type ConfigInput = typeof ConfigInput.Type;
36
36
 
37
- const standard = Schema.toStandardSchemaV1(ConfigInput, { parseOptions: { errors: "all", onExcessProperty: "error" } });
38
-
39
37
  export function decodeConfig(value: unknown): Promise<Decoded<ConfigInput>> {
40
- return decodeWith(standard, value);
38
+ return decodeWith(ConfigInput, value);
41
39
  }
@@ -27,7 +27,7 @@ function messageOf(cause: unknown): string {
27
27
  function importDefault(file: string): Effect.Effect<unknown, SetupFailure> {
28
28
  return Effect.flatMap(
29
29
  Effect.tryPromise({
30
- catch: (cause) => new SetupFailure({ message: `cannot load ${file}: ${messageOf(cause)}` }),
30
+ catch: (cause) => new SetupFailure({ cause, message: `cannot load ${file}: ${messageOf(cause)}` }),
31
31
  try: async (): Promise<unknown> => import(pathToFileURL(file).href),
32
32
  }),
33
33
  (loaded) =>
@@ -71,7 +71,7 @@ export const loadConfig = Effect.fn("Config.loadConfig")(function* (
71
71
  Effect.catchTag("PlatformError", (error) =>
72
72
  error.reason._tag === "NotFound"
73
73
  ? Effect.succeed<string[]>([])
74
- : Effect.fail(new SetupFailure({ message: `cannot inspect ${file}: ${error.message}` })),
74
+ : Effect.fail(new SetupFailure({ cause: error, message: `cannot inspect ${file}: ${error.message}` })),
75
75
  ),
76
76
  );
77
77
  const present = entries.includes(basename(file));
package/src/decoded.ts CHANGED
@@ -1,12 +1,16 @@
1
- import { Effect } from "effect";
1
+ import { Effect, Result, Schema, SchemaIssue } from "effect";
2
2
  import { SetupFailure } from "./failure.ts";
3
- import { describeIssue, type StandardSchemaV1 } from "./standardSchema.ts";
3
+ import { describeIssue } from "./standardSchema.ts";
4
4
 
5
5
  export type Decoded<TValue> = { readonly _tag: "Valid"; readonly value: TValue } | { readonly _tag: "Invalid"; readonly issues: readonly string[] };
6
6
 
7
- export async function decodeWith<TOutput>(schema: StandardSchemaV1<unknown, TOutput>, value: unknown): Promise<Decoded<TOutput>> {
8
- const result = await schema["~standard"].validate(value);
9
- return result.issues === undefined ? { _tag: "Valid", value: result.value } : { _tag: "Invalid", issues: result.issues.map(describeIssue) };
7
+ export function decodeWith<TSchema extends Schema.ConstraintDecoder<unknown>>(schema: TSchema, value: unknown): Promise<Decoded<TSchema["Type"]>> {
8
+ const result = Schema.decodeUnknownResult(schema, { errors: "all", onExcessProperty: "error" })(value);
9
+ return Promise.resolve(
10
+ Result.isSuccess(result)
11
+ ? { _tag: "Valid", value: result.success }
12
+ : { _tag: "Invalid", issues: SchemaIssue.makeFormatterStandardSchemaV1()(result.failure.issue).issues.map(describeIssue) },
13
+ );
10
14
  }
11
15
 
12
16
  export function validOrFail<TValue>(file: string, decoded: Decoded<TValue>): Effect.Effect<TValue, SetupFailure> {
@@ -3,7 +3,7 @@ import ts from "typescript";
3
3
  import { exportEntry, exportTargets } from "#imports/packageExports.ts";
4
4
  import type { WorkspacePackage } from "#imports/workspace.ts";
5
5
 
6
- export type DocumentedModule = { readonly kind: "missing" } | { readonly kind: "private" } | { readonly kind: "source"; readonly path: string };
6
+ export type DocumentedModule = { readonly kind: "missing" } | { readonly kind: "source"; readonly path: string };
7
7
 
8
8
  const BUILT = /^\.\/dist\/(?<path>.+?)(?:\.d)?\.[cm]?[jt]s$/u;
9
9
 
@@ -31,9 +31,6 @@ export function documentedModule(root: string, owner: WorkspacePackage, exports:
31
31
  if (entry === undefined) {
32
32
  return MISSING;
33
33
  }
34
- if (entry[1] === null) {
35
- return { kind: "private" };
36
- }
37
34
  const [prefix = "", suffix = ""] = entry[0].split("*");
38
35
  const star = subpath.slice(prefix.length, subpath.length - suffix.length);
39
36
  return found(
@@ -29,11 +29,6 @@ function problem(
29
29
  if (module.kind === "missing") {
30
30
  return Effect.succeed(`"${entry.specifier}" names no module of ${owner.name}. Use the path of a module its package.json "exports" maps.`);
31
31
  }
32
- if (module.kind === "private") {
33
- return Effect.succeed(
34
- `"${entry.specifier}" is private: the package.json "exports" of ${owner.name} blocks it. Document a module the package exports.`,
35
- );
36
- }
37
32
  const name = entry.name;
38
33
  if (name === undefined) {
39
34
  return Effect.succeed(undefined);
@@ -14,14 +14,14 @@ export interface BaselineFile {
14
14
  }
15
15
 
16
16
  export function readInput(root: string, path: string): Effect.Effect<string | undefined, SetupFailure, FileSystem.FileSystem> {
17
- return Effect.mapError(readOptionalText(join(root, path)), (failure) => new SetupFailure({ message: failure.message }));
17
+ return Effect.mapError(readOptionalText(join(root, path)), (failure) => new SetupFailure({ cause: failure, message: failure.message }));
18
18
  }
19
19
 
20
20
  export const readBaseline = Effect.fn("Engine.readBaseline")(function* (
21
21
  config: ResolvedConfig,
22
22
  ): Effect.fn.Return<BaselineFile, SetupFailure, FileSystem.FileSystem> {
23
23
  const files = new Map<string, Shard>();
24
- for (const path of yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })))) {
24
+ for (const path of yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })))) {
25
25
  const raw = yield* readInput(config.root, path);
26
26
  if (raw === undefined) {
27
27
  continue;
@@ -1,12 +1,12 @@
1
1
  import { isAbsolute, relative } from "node:path";
2
2
  import { Effect } from "effect";
3
- import { SetupFailure } from "#failure.ts";
3
+ import { ManifestFailure } from "#adapters/manifestInventory.ts";
4
4
  import { posix } from "#inventory/ignoreScope.ts";
5
- import type { Finding, Findings, RuleInputs } from "#rule.ts";
5
+ import type { Finding, RuleCheck, RuleInputs, RuleServices } from "#rule.ts";
6
6
  import type { ActiveLevel, Violation } from "./violation.ts";
7
7
 
8
8
  export interface ActiveRule {
9
- readonly check: (inputs: RuleInputs) => Promise<Findings>;
9
+ readonly check: RuleCheck;
10
10
  readonly description: string;
11
11
  readonly family: boolean;
12
12
  readonly id: string;
@@ -48,19 +48,38 @@ function violationOf(rule: ActiveRule, root: string, finding: Finding, exception
48
48
  };
49
49
  }
50
50
 
51
- function runRule(rule: ActiveRule, inputs: RuleInputs, exceptionFile: string): Effect.Effect<readonly Violation[], SetupFailure> {
52
- return Effect.map(
53
- Effect.tryPromise({
54
- catch: (cause) => new SetupFailure({ message: `rule ${rule.id} failed: ${messageOf(cause)}` }),
55
- try: () => rule.check(inputs),
56
- }),
57
- (findings) => findings.map((finding) => violationOf(rule, inputs.root, finding, exceptionFile)),
51
+ function runRule(rule: ActiveRule, inputs: RuleInputs, exceptionFile: string): Effect.Effect<readonly Violation[], never, RuleServices> {
52
+ return Effect.suspend(() => rule.check(inputs)).pipe(
53
+ Effect.orDie,
54
+ Effect.map((findings) => findings.map((finding) => violationOf(rule, inputs.root, finding, exceptionFile))),
55
+ Effect.catchDefect((cause) =>
56
+ cause instanceof ManifestFailure
57
+ ? Effect.succeed([{ file: cause.path, level: "error" as const, message: cause.message, rule: "manifests/valid" }])
58
+ : Effect.die(new Error(`rule ${rule.id} failed: ${messageOf(cause)}`, { cause })),
59
+ ),
58
60
  );
59
61
  }
60
62
 
61
- export function runRules(rules: readonly ActiveRule[], inputs: RuleInputs): Effect.Effect<readonly Violation[], SetupFailure> {
62
- return Effect.map(
63
- Effect.forEach(rules, (rule) => runRule(rule, inputs, inputs.configFile ?? "quality.config.ts"), { concurrency: "unbounded" }),
64
- (results) => results.flat(),
63
+ export const runRules = Effect.fn("Engine.runRules")(function* (rules: readonly ActiveRule[], inputs: RuleInputs) {
64
+ const validation = rules.find((rule) => rule.id === "manifests/valid");
65
+ if (validation !== undefined) {
66
+ const failures = yield* runRule(validation, inputs, inputs.configFile ?? "quality.config.ts");
67
+ if (failures.length > 0) {
68
+ return failures;
69
+ }
70
+ }
71
+ const results = yield* Effect.forEach(
72
+ rules.filter((rule) => rule !== validation),
73
+ (rule) => runRule(rule, inputs, inputs.configFile ?? "quality.config.ts"),
74
+ { concurrency: "unbounded" },
65
75
  );
66
- }
76
+ const seen = new Set<string>();
77
+ return results.flat().filter((finding) => {
78
+ if (finding.rule !== "manifests/valid") {
79
+ return true;
80
+ }
81
+ const duplicate = seen.has(finding.file);
82
+ seen.add(finding.file);
83
+ return !duplicate;
84
+ });
85
+ });
@@ -1,12 +1,15 @@
1
- import { relative, resolve } from "node:path";
2
- import { Effect, type FileSystem } from "effect";
1
+ import { relative } from "node:path";
2
+ import { Effect } from "effect";
3
+ import { setManifestFiles } from "#adapters/manifestInventory.ts";
4
+ import { manifestReader } from "#adapters/manifestReader.ts";
3
5
  import { loadConfig, type ResolvedConfig } from "#config/load.ts";
4
6
  import { validOrFail } from "#decoded.ts";
5
7
  import { decodeRegistry, type RegistryEntry } from "#exceptions/registry.ts";
6
8
  import { registryEntries } from "#exceptions/registryEntries.ts";
7
9
  import { SetupFailure } from "#failure.ts";
8
10
  import { collectInventory, type Inventory } from "#inventory/collect.ts";
9
- import { type FilesystemFailure, readOptionalText } from "#inventory/filesystem.ts";
11
+ import type { FilesystemFailure } from "#inventory/filesystem.ts";
12
+ import type { RuleServices } from "#rule.ts";
10
13
  import { type BaselineFile, readBaseline, readInput } from "./baselineFile.ts";
11
14
  import { runRules } from "./runRules.ts";
12
15
  import type { Violation } from "./violation.ts";
@@ -20,19 +23,19 @@ export interface Session {
20
23
  }
21
24
 
22
25
  function setup<TValue, TRequirements>(
23
- effect: Effect.Effect<TValue, FilesystemFailure, TRequirements>,
26
+ effect: Effect.Effect<TValue, FilesystemFailure | SetupFailure, TRequirements>,
24
27
  ): Effect.Effect<TValue, SetupFailure, TRequirements> {
25
- return Effect.mapError(effect, (failure) => new SetupFailure({ message: failure.message }));
28
+ return Effect.mapError(effect, (failure) =>
29
+ failure instanceof SetupFailure ? failure : new SetupFailure({ cause: failure, message: failure.message }),
30
+ );
26
31
  }
27
32
 
28
33
  export const scan = Effect.fn("Engine.scan")(function* (
29
34
  config: ResolvedConfig,
30
- ): Effect.fn.Return<Pick<Session, "inventory" | "violations">, SetupFailure, FileSystem.FileSystem> {
35
+ ): Effect.fn.Return<Pick<Session, "inventory" | "violations">, SetupFailure, RuleServices> {
31
36
  const inventory = yield* setup(collectInventory(config.root, config));
32
- const services = yield* Effect.context<FileSystem.FileSystem>();
33
- function readText(path: string): Promise<string | undefined> {
34
- return Effect.runPromiseWith(services)(readOptionalText(resolve(config.root, path)));
35
- }
37
+ const readText = yield* manifestReader(config.root);
38
+ setManifestFiles(readText, inventory.manifestFiles);
36
39
  const violations = yield* runRules(config.active, {
37
40
  configFile: relative(config.root, config.file),
38
41
  exceptions: config.exceptions,
@@ -47,7 +50,7 @@ export const scan = Effect.fn("Engine.scan")(function* (
47
50
  export const openSession = Effect.fn("Engine.openSession")(function* (
48
51
  cwd: string,
49
52
  configPath: string | undefined,
50
- ): Effect.fn.Return<Session, SetupFailure, FileSystem.FileSystem> {
53
+ ): Effect.fn.Return<Session, SetupFailure, RuleServices> {
51
54
  const config = yield* loadConfig(cwd, configPath);
52
55
  const registryRaw = yield* readInput(config.root, config.registry);
53
56
  const registry = yield* validOrFail(config.registry, yield* Effect.promise(() => decodeRegistry(registryRaw)));
@@ -31,8 +31,8 @@ export const ExceptionDeclaration = Schema.Struct({
31
31
 
32
32
  export type ExceptionDeclaration = typeof ExceptionDeclaration.Type;
33
33
 
34
- const standard = Schema.toStandardSchemaV1(Schema.Array(ExceptionDeclaration), { parseOptions: { errors: "all", onExcessProperty: "error" } });
34
+ const ExceptionDeclarations = Schema.Array(ExceptionDeclaration);
35
35
 
36
36
  export function decodeExceptions(value: unknown): Promise<Decoded<readonly ExceptionDeclaration[]>> {
37
- return decodeWith(standard, value);
37
+ return decodeWith(ExceptionDeclarations, value);
38
38
  }
@@ -11,12 +11,10 @@ const RegistryEntry = Schema.Struct({
11
11
 
12
12
  export type RegistryEntry = typeof RegistryEntry.Type;
13
13
 
14
- const standard = Schema.toStandardSchemaV1(Schema.fromJsonString(Schema.Array(RegistryEntry)), {
15
- parseOptions: { errors: "all", onExcessProperty: "error" },
16
- });
14
+ const RegistryFile = Schema.fromJsonString(Schema.Array(RegistryEntry));
17
15
 
18
16
  export function decodeRegistry(raw: string | undefined): Promise<Decoded<readonly RegistryEntry[]>> {
19
- return raw === undefined ? Promise.resolve({ _tag: "Valid", value: [] }) : decodeWith(standard, raw);
17
+ return raw === undefined ? Promise.resolve({ _tag: "Valid", value: [] }) : decodeWith(RegistryFile, raw);
20
18
  }
21
19
 
22
20
  export interface StaleRegistryEntry {
package/src/failure.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { Data, Runtime } from "effect";
2
2
 
3
- export class SetupFailure extends Data.TaggedError("SetupFailure")<{ readonly message: string }> {
3
+ export class SetupFailure extends Data.TaggedError("SetupFailure")<{ readonly message: string; readonly cause?: unknown }> {
4
+ constructor(options: { readonly message: string; readonly cause?: unknown }) {
5
+ super({ message: options.message });
6
+ Object.defineProperty(this, "cause", { enumerable: false, value: options.cause });
7
+ }
8
+
4
9
  override readonly [Runtime.errorReported] = false;
5
10
  override readonly [Runtime.errorExitCode] = 2;
6
11
  }
package/src/git/base.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Effect } from "effect";
2
+ import type { ChildProcessSpawner } from "effect/process";
2
3
  import { SetupFailure } from "#failure.ts";
3
- import { type Git, git } from "./command.ts";
4
+ import { run } from "./command.ts";
4
5
 
5
6
  export interface Base {
6
7
  readonly commit: string;
@@ -13,12 +14,14 @@ function fail(message: string) {
13
14
  return Effect.fail(new SetupFailure({ message }));
14
15
  }
15
16
 
16
- function isCommit(root: string, ref: string): Effect.Effect<boolean, SetupFailure, Git> {
17
- return Effect.map(git(root, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]), (result) => result.code === 0);
17
+ function isCommit(root: string, ref: string): Effect.Effect<boolean, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
18
+ return Effect.map(run(root, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]), (result) => result.code === 0);
18
19
  }
19
20
 
20
- const defaultBranch = Effect.fn("Git.defaultBranch")(function* (root: string): Effect.fn.Return<string, SetupFailure, Git> {
21
- const head = yield* git(root, ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
21
+ const defaultBranch = Effect.fn("Git.defaultBranch")(function* (
22
+ root: string,
23
+ ): Effect.fn.Return<string, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
24
+ const head = yield* run(root, ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
22
25
  if (head.code === 0) {
23
26
  return head.stdout.trim();
24
27
  }
@@ -32,15 +35,15 @@ const defaultBranch = Effect.fn("Git.defaultBranch")(function* (root: string): E
32
35
  );
33
36
  });
34
37
 
35
- function isShallow(root: string): Effect.Effect<boolean, SetupFailure, Git> {
36
- return Effect.map(git(root, ["rev-parse", "--is-shallow-repository"]), (result) => result.stdout.trim() === "true");
38
+ function isShallow(root: string): Effect.Effect<boolean, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
39
+ return Effect.map(run(root, ["rev-parse", "--is-shallow-repository"]), (result) => result.stdout.trim() === "true");
37
40
  }
38
41
 
39
- function mergeBase(root: string, ref: string): Effect.Effect<string | undefined, SetupFailure, Git> {
40
- return Effect.map(git(root, ["merge-base", "HEAD", ref]), (result) => (result.code === 0 ? result.stdout.trim() : undefined));
42
+ function mergeBase(root: string, ref: string): Effect.Effect<string | undefined, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
43
+ return Effect.map(run(root, ["merge-base", "HEAD", ref]), (result) => (result.code === 0 ? result.stdout.trim() : undefined));
41
44
  }
42
45
 
43
- function missingMergeBase(root: string, ref: string): Effect.Effect<never, SetupFailure, Git> {
46
+ function missingMergeBase(root: string, ref: string): Effect.Effect<never, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
44
47
  return Effect.flatMap(isShallow(root), (shallow) =>
45
48
  fail(
46
49
  shallow
@@ -50,15 +53,15 @@ function missingMergeBase(root: string, ref: string): Effect.Effect<never, Setup
50
53
  );
51
54
  }
52
55
 
53
- function reachMergeBase(root: string, ref: string): Effect.Effect<string, SetupFailure, Git> {
56
+ function reachMergeBase(root: string, ref: string): Effect.Effect<string, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
54
57
  return Effect.flatMap(mergeBase(root, ref), (found) => (found === undefined ? missingMergeBase(root, ref) : Effect.succeed(found)));
55
58
  }
56
59
 
57
60
  export const resolveBase = Effect.fn("Git.resolveBase")(function* (
58
61
  root: string,
59
62
  against: string | undefined,
60
- ): Effect.fn.Return<Base, SetupFailure, Git> {
61
- const inside = yield* git(root, ["rev-parse", "--is-inside-work-tree"]);
63
+ ): Effect.fn.Return<Base, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
64
+ const inside = yield* run(root, ["rev-parse", "--is-inside-work-tree"]);
62
65
  if (inside.code !== 0 || inside.stdout.trim() !== "true") {
63
66
  return yield* fail(`${root} is not in a git work tree; moves are followed through git history.`);
64
67
  }
@@ -8,10 +8,11 @@ export interface GitResult {
8
8
  readonly stdout: string;
9
9
  }
10
10
 
11
- export type Git = ChildProcessSpawner.ChildProcessSpawner;
12
-
13
- export function git(cwd: string, args: readonly string[]): Effect.Effect<GitResult, SetupFailure, Git> {
14
- return Effect.scoped(
11
+ export const run = Effect.fn("Git.run")(function* (
12
+ cwd: string,
13
+ args: readonly string[],
14
+ ): Effect.fn.Return<GitResult, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
15
+ return yield* Effect.scoped(
15
16
  Effect.gen(function* () {
16
17
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
17
18
  const child = yield* spawner.spawn(ChildProcess.make("git", [...args], { cwd, stdin: "ignore" }));
@@ -21,13 +22,13 @@ export function git(cwd: string, args: readonly string[]): Effect.Effect<GitResu
21
22
  );
22
23
  return { code: Number(code), stderr, stdout };
23
24
  }),
24
- ).pipe(Effect.mapError((error) => new SetupFailure({ message: `cannot run git: ${error.message}` })));
25
- }
25
+ ).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: `cannot run git in ${cwd}: ${error.message}` })));
26
+ });
26
27
 
27
- export function gitOrFail(cwd: string, args: readonly string[]): Effect.Effect<string, SetupFailure, Git> {
28
- return Effect.flatMap(git(cwd, args), (result) =>
28
+ export function gitOrFail(cwd: string, args: readonly string[]): Effect.Effect<string, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
29
+ return Effect.flatMap(run(cwd, args), (result) =>
29
30
  result.code === 0
30
31
  ? Effect.succeed(result.stdout)
31
- : Effect.fail(new SetupFailure({ message: `git ${args[0]} failed: ${result.stderr.trim() || `exit code ${result.code}`}` })),
32
+ : Effect.fail(new SetupFailure({ message: `git ${args[0]} exited ${result.code}: ${result.stderr.trim()}` })),
32
33
  );
33
34
  }
@@ -1,6 +1,7 @@
1
1
  import { Effect } from "effect";
2
+ import type { ChildProcessSpawner } from "effect/process";
2
3
  import type { SetupFailure } from "#failure.ts";
3
- import { type Git, gitOrFail } from "./command.ts";
4
+ import { gitOrFail } from "./command.ts";
4
5
 
5
6
  export interface Changes {
6
7
  readonly files: ReadonlySet<string>;
@@ -27,7 +28,10 @@ function parse(output: string): Changes {
27
28
  }
28
29
 
29
30
  // Paths are relative to the root, and only tracked files count: a move is seen once both of its sides are staged.
30
- export function changesSince(root: string, revision: readonly string[]): Effect.Effect<Changes, SetupFailure, Git> {
31
+ export function changesSince(
32
+ root: string,
33
+ revision: readonly string[],
34
+ ): Effect.Effect<Changes, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
31
35
  return Effect.map(
32
36
  gitOrFail(root, ["diff", "--no-color", "--no-ext-diff", "--find-renames", "--name-status", "-z", "--relative", ...revision, "--"]),
33
37
  parse,
@@ -1,7 +1,7 @@
1
1
  import { dirname, join } from "node:path";
2
2
  import { Effect, FileSystem } from "effect";
3
3
  import { SetupFailure } from "#failure.ts";
4
- import { git } from "#git/command.ts";
4
+ import { run } from "#git/command.ts";
5
5
  import { readOptionalText } from "#inventory/filesystem.ts";
6
6
  import { shellWords } from "./command.ts";
7
7
  import { isHookShim, OWNER } from "./shim.ts";
@@ -42,7 +42,7 @@ export function forwardingPath(file: string): string {
42
42
  }
43
43
 
44
44
  export const globalHooksPath = Effect.fn("Hooks.globalHooksPath")(function* (cwd: string) {
45
- const global = yield* git(cwd, ["config", "--global", "--includes", "--type=path", "--get", "core.hooksPath"]);
45
+ const global = yield* run(cwd, ["config", "--global", "--includes", "--type=path", "--get", "core.hooksPath"]);
46
46
  if (global.code !== 0 && global.code !== 1) {
47
47
  return yield* new SetupFailure({ message: `cannot read global core.hooksPath: ${global.stderr.trim()}` });
48
48
  }
@@ -19,7 +19,7 @@ export interface HookInstall {
19
19
  }
20
20
 
21
21
  function failed(error: { readonly message: string }): SetupFailure {
22
- return new SetupFailure({ message: error.message });
22
+ return new SetupFailure({ cause: error, message: error.message });
23
23
  }
24
24
 
25
25
  const realPath = Effect.fnUntraced(function* (path: string) {
@@ -32,7 +32,7 @@ const write = Effect.fnUntraced(function* (file: string, text: string) {
32
32
  yield* fs.makeDirectory(dirname(file), { recursive: true }).pipe(
33
33
  Effect.andThen(fs.writeFileString(file, text)),
34
34
  Effect.andThen(fs.chmod(file, 0o755)),
35
- Effect.mapError((error) => new SetupFailure({ message: `cannot write ${file}: ${error.message}` })),
35
+ Effect.mapError((error) => new SetupFailure({ cause: error, message: `cannot write ${file}: ${error.message}` })),
36
36
  );
37
37
  });
38
38
 
@@ -1,7 +1,7 @@
1
1
  import { join } from "node:path";
2
2
  import { Effect } from "effect";
3
3
  import { SetupFailure } from "#failure.ts";
4
- import { git } from "#git/command.ts";
4
+ import { run } from "#git/command.ts";
5
5
 
6
6
  export interface HookLocation {
7
7
  readonly file: string;
@@ -11,14 +11,14 @@ export interface HookLocation {
11
11
 
12
12
  // Hooks live in the common git directory, which every worktree of the repository shares.
13
13
  export const hookLocation = Effect.fn("Hooks.hookLocation")(function* (cwd: string) {
14
- const paths = yield* git(cwd, ["rev-parse", "--path-format=absolute", "--show-toplevel", "--git-common-dir"]);
14
+ const paths = yield* run(cwd, ["rev-parse", "--path-format=absolute", "--show-toplevel", "--git-common-dir"]);
15
15
  const [toplevel, common] = paths.stdout.trim().split("\n");
16
16
  if (paths.code !== 0 || toplevel === undefined || common === undefined) {
17
17
  return yield* new SetupFailure({
18
18
  message: `${cwd} is not in a git work tree, so there is no hook to manage.\nhelp: run quality from inside the repository, or run \`git init\` first.`,
19
19
  });
20
20
  }
21
- const hooksPath = yield* git(cwd, ["config", "--type=path", "--get", "core.hooksPath"]);
21
+ const hooksPath = yield* run(cwd, ["config", "--type=path", "--get", "core.hooksPath"]);
22
22
  const location: HookLocation = {
23
23
  file: join(common, "hooks", "pre-commit"),
24
24
  hooksPath: hooksPath.code === 0 ? hooksPath.stdout.trim() : undefined,
@@ -1,31 +1,25 @@
1
1
  import { join } from "node:path";
2
- import { Console, Effect, Schema } from "effect";
2
+ import { Console, Effect } from "effect";
3
3
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
4
+ import { readPackageManifest } from "#adapters/manifestInventory.ts";
5
+ import { manifestReader } from "#adapters/manifestReader.ts";
4
6
  import { lint } from "#cli/lint.ts";
5
7
  import { loadConfig } from "#config/load.ts";
6
- import { decodeWith, validOrFail } from "#decoded.ts";
7
8
  import { GateFailed, SetupFailure } from "#failure.ts";
8
- import { readOptionalText } from "#inventory/filesystem.ts";
9
9
 
10
10
  const COMMIT_AGAIN =
11
11
  "help: fix what the output above reports, then commit again; `quality hooks pre-commit` repeats these checks without committing.";
12
12
 
13
- const Manifest = Schema.toStandardSchemaV1(
14
- Schema.fromJsonString(
15
- Schema.Struct({
16
- packageManager: Schema.optionalKey(Schema.String),
17
- scripts: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
18
- }),
19
- ),
20
- );
21
-
22
13
  const commitScripts = Effect.fnUntraced(function* (root: string) {
23
14
  const file = join(root, "package.json");
24
- const text = yield* readOptionalText(file).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
25
- if (text === undefined) {
15
+ const readText = yield* manifestReader(root);
16
+ const manifest = yield* Effect.tryPromise({
17
+ catch: (cause) => new SetupFailure({ cause, message: `${file} is invalid: ${cause instanceof Error ? cause.message : String(cause)}` }),
18
+ try: () => readPackageManifest(readText, file),
19
+ });
20
+ if (manifest === undefined) {
26
21
  return { manager: "npm", scripts: [] };
27
22
  }
28
- const manifest = yield* validOrFail(file, yield* Effect.promise(() => decodeWith(Manifest, text)));
29
23
  const manager = manifest.packageManager?.split("@")[0] ?? "npm";
30
24
  if (!["npm", "pnpm", "yarn", "bun"].includes(manager)) {
31
25
  return yield* new SetupFailure({ message: `${file}: unsupported packageManager "${manager}". Use npm, pnpm, yarn or bun.` });
@@ -42,7 +36,7 @@ const runScript = Effect.fnUntraced(
42
36
  return Number(yield* child.exitCode);
43
37
  },
44
38
  Effect.scoped,
45
- Effect.mapError((error) => new SetupFailure({ message: `cannot run a pre-commit script: ${error.message}` })),
39
+ Effect.mapError((error) => new SetupFailure({ cause: error, message: `cannot run a pre-commit script: ${error.message}` })),
46
40
  );
47
41
 
48
42
  export const preCommitHook = Effect.fn("Hooks.preCommitHook")(function* (cwd: string, path: string | undefined) {
@@ -35,7 +35,7 @@ export const globalHookStatus = Effect.fn("Hooks.globalHookStatus")(function* (l
35
35
  export const hookStatus = Effect.fn("Hooks.hookStatus")(function* (cwd: string) {
36
36
  const location = yield* hookLocation(cwd);
37
37
  const path = (yield* gitOrFail(cwd, ["rev-parse", "--path-format=absolute", "--git-path", "hooks/pre-commit"])).trim();
38
- const text = yield* readOptionalText(path).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
38
+ const text = yield* readOptionalText(path).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })));
39
39
  if (text === undefined || !isHookShim(text) || (yield* executable(path)) === undefined) {
40
40
  yield* Console.error(
41
41
  `quality: the effective hooks path ${dirname(path)} does not run Quality's pre-commit hook.\nhelp: run \`quality hooks install\` to check commits.`,
@@ -1,7 +1,7 @@
1
1
  import { dirname } from "node:path";
2
2
  import { Console, Effect, FileSystem } from "effect";
3
3
  import { SetupFailure } from "#failure.ts";
4
- import { git, gitOrFail } from "#git/command.ts";
4
+ import { gitOrFail, run } from "#git/command.ts";
5
5
  import { readOptionalText } from "#inventory/filesystem.ts";
6
6
  import { forwardingPath, removeForwarding } from "./forwarding.ts";
7
7
  import { hookLocation } from "./location.ts";
@@ -10,16 +10,16 @@ import { isHookShim } from "./shim.ts";
10
10
  export const uninstallHook = Effect.fn("Hooks.uninstallHook")(function* (cwd: string) {
11
11
  const fs = yield* FileSystem.FileSystem;
12
12
  const { file } = yield* hookLocation(cwd);
13
- const existing = yield* Effect.mapError(readOptionalText(file), (failure) => new SetupFailure({ message: failure.message }));
13
+ const existing = yield* Effect.mapError(readOptionalText(file), (failure) => new SetupFailure({ cause: failure, message: failure.message }));
14
14
  if (existing === undefined) {
15
15
  return yield* Console.log(`quality: there is no pre-commit hook at ${file}.`);
16
16
  }
17
17
  if (!isHookShim(existing)) {
18
18
  return yield* Console.error(`quality: kept ${file}: it is not quality's pre-commit hook.`);
19
19
  }
20
- yield* Effect.mapError(fs.remove(file), (error) => new SetupFailure({ message: `cannot remove ${file}: ${error.message}` }));
21
- const local = yield* git(cwd, ["config", "--local", "--get", "core.hooksPath"]);
22
- yield* removeForwarding(file).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
20
+ yield* Effect.mapError(fs.remove(file), (error) => new SetupFailure({ cause: error, message: `cannot remove ${file}: ${error.message}` }));
21
+ const local = yield* run(cwd, ["config", "--local", "--get", "core.hooksPath"]);
22
+ yield* removeForwarding(file).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })));
23
23
  if ([dirname(file), forwardingPath(file)].includes(local.stdout.trim())) {
24
24
  yield* gitOrFail(cwd, ["config", "--local", "--unset-all", "core.hooksPath"]);
25
25
  }
@@ -0,0 +1,30 @@
1
+ import { posix } from "node:path";
2
+ import { isTooling } from "./isTooling.ts";
3
+ import type { DeclaredRuntime, Runtime } from "./runtime.ts";
4
+ import { packageOf, type WorkspacePackage } from "./workspace.ts";
5
+
6
+ export interface RuntimePolicy {
7
+ readonly adopted: ReadonlySet<string>;
8
+ readonly declared: ReadonlyMap<string, DeclaredRuntime>;
9
+ readonly executable: ReadonlySet<string>;
10
+ readonly packages: readonly WorkspacePackage[];
11
+ }
12
+
13
+ export function classifyRuntime(policy: RuntimePolicy, path: string): Runtime | undefined {
14
+ const owner = packageOf(policy.packages, path)?.directory ?? ".";
15
+ if (isTooling(owner, path)) {
16
+ return "server";
17
+ }
18
+ const whole = policy.declared.get(owner);
19
+ if (whole !== undefined) {
20
+ return whole;
21
+ }
22
+ if (!policy.adopted.has(owner)) {
23
+ return policy.executable.has(owner) ? "server" : undefined;
24
+ }
25
+ const local = posix.relative(owner, path).replace(/^src\/modules\/[^/]+\//u, "src/");
26
+ if (local.startsWith("src/client/")) {
27
+ return "client";
28
+ }
29
+ return local.startsWith("src/server/") ? "server" : "shared";
30
+ }
@@ -31,8 +31,6 @@ const FenceInput: Schema.Codec<Fence> = Schema.Struct({
31
31
 
32
32
  export const Declarations = Schema.Array(FenceInput);
33
33
 
34
- const standard = Schema.toStandardSchemaV1(Declarations, { parseOptions: { errors: "all", onExcessProperty: "error" } });
35
-
36
34
  export function decodeDeclarations(value: unknown) {
37
- return decodeWith(standard, value);
35
+ return decodeWith(Declarations, value);
38
36
  }
@@ -1,3 +1,5 @@
1
+ import { Schema } from "effect";
2
+
1
3
  function keyPattern(key: string): RegExp {
2
4
  return new RegExp(`^(?:${key}|"${key}"|'${key}')\\s*:`, "u");
3
5
  }
@@ -31,7 +33,7 @@ function scalar(raw: string, key: string): string {
31
33
  const value = raw.trim();
32
34
  if (value.startsWith('"') && value.endsWith('"') && value.length > 1) {
33
35
  try {
34
- return String(JSON.parse(value));
36
+ return Schema.decodeUnknownSync(Schema.fromJsonString(Schema.String))(value);
35
37
  } catch (error) {
36
38
  throw failure(`cannot read "${value}" in ${key}`, error);
37
39
  }