@shivaedev/quality 0.76.0 → 0.77.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.
- package/CHANGELOG.md +54 -0
- package/README.md +65 -59
- package/dist/adapters/biome/pluginContract.d.ts +1 -1
- package/dist/adapters/biome/pluginContract.d.ts.map +1 -1
- package/dist/adapters/biome/pluginContract.js +2 -5
- package/dist/adapters/biome/pluginContract.js.map +1 -1
- package/dist/adapters/biome/run.d.ts.map +1 -1
- package/dist/adapters/biome/run.js +2 -0
- package/dist/adapters/biome/run.js.map +1 -1
- package/dist/adapters/biome/withExceptionConfig.d.ts.map +1 -1
- package/dist/adapters/biome/withExceptionConfig.js +21 -4
- package/dist/adapters/biome/withExceptionConfig.js.map +1 -1
- package/dist/adapters/changeKeyCheck.d.ts +10 -0
- package/dist/adapters/changeKeyCheck.d.ts.map +1 -0
- package/dist/adapters/{changeKeyFindings.js → changeKeyCheck.js} +8 -22
- package/dist/adapters/changeKeyCheck.js.map +1 -0
- package/dist/adapters/commandLine.d.ts +2 -0
- package/dist/adapters/commandLine.d.ts.map +1 -1
- package/dist/adapters/contextCaptureCheck.d.ts +9 -0
- package/dist/adapters/contextCaptureCheck.d.ts.map +1 -0
- package/dist/adapters/contextCaptureCheck.js +91 -0
- package/dist/adapters/contextCaptureCheck.js.map +1 -0
- package/dist/adapters/databaseUrlFindings.d.ts +1 -1
- package/dist/adapters/databaseUrlFindings.d.ts.map +1 -1
- package/dist/adapters/declaration-files/initialize.d.ts +6 -0
- package/dist/adapters/declaration-files/initialize.d.ts.map +1 -0
- package/dist/adapters/declaration-files/initialize.js +4 -0
- package/dist/adapters/declaration-files/initialize.js.map +1 -0
- package/dist/adapters/declaration-files/parse.d.ts +5 -0
- package/dist/adapters/declaration-files/parse.d.ts.map +1 -0
- package/dist/adapters/declaration-files/parse.js +6 -0
- package/dist/adapters/declaration-files/parse.js.map +1 -0
- package/dist/adapters/declaration-files/reader.d.ts +5 -0
- package/dist/adapters/declaration-files/reader.d.ts.map +1 -0
- package/dist/adapters/declaration-files/reader.js +23 -0
- package/dist/adapters/declaration-files/reader.js.map +1 -0
- package/dist/adapters/declaration-files/service.d.ts +9 -0
- package/dist/adapters/declaration-files/service.d.ts.map +1 -0
- package/dist/adapters/declaration-files/service.js +14 -0
- package/dist/adapters/declaration-files/service.js.map +1 -0
- package/dist/adapters/foreignResources.d.ts.map +1 -1
- package/dist/adapters/foreignResources.js +0 -4
- package/dist/adapters/foreignResources.js.map +1 -1
- package/dist/adapters/import-compiler/graph.d.ts +8 -2
- package/dist/adapters/import-compiler/graph.d.ts.map +1 -1
- package/dist/adapters/import-compiler/graph.js +4 -1
- package/dist/adapters/import-compiler/graph.js.map +1 -1
- package/dist/adapters/import-compiler/service.d.ts +7 -1
- package/dist/adapters/import-compiler/service.d.ts.map +1 -1
- package/dist/adapters/imports/graph.d.ts +6 -3
- package/dist/adapters/imports/graph.d.ts.map +1 -1
- package/dist/adapters/imports/graph.js +31 -18
- package/dist/adapters/imports/graph.js.map +1 -1
- package/dist/adapters/knip/configuration.d.ts +1 -1
- package/dist/adapters/knip/configuration.d.ts.map +1 -1
- package/dist/adapters/knip/configuration.js +6 -4
- package/dist/adapters/knip/configuration.js.map +1 -1
- package/dist/adapters/knip/entryPointFindings.d.ts +1 -1
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/knip/run.d.ts.map +1 -1
- package/dist/adapters/knip/run.js +4 -1
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/outsideImportFindings.d.ts +4 -2
- package/dist/adapters/outsideImportFindings.d.ts.map +1 -1
- package/dist/adapters/outsideImportFindings.js +12 -52
- package/dist/adapters/outsideImportFindings.js.map +1 -1
- package/dist/adapters/queueReadoutFindings.d.ts +1 -1
- package/dist/adapters/queueReadoutFindings.d.ts.map +1 -1
- package/dist/adapters/rule.d.ts +9 -1
- package/dist/adapters/rule.d.ts.map +1 -1
- package/dist/adapters/rule.js +21 -6
- package/dist/adapters/rule.js.map +1 -1
- package/dist/adapters/runMain.d.ts +3 -4
- package/dist/adapters/runMain.d.ts.map +1 -1
- package/dist/adapters/runMain.js +2 -1
- package/dist/adapters/runMain.js.map +1 -1
- package/dist/adapters/serviceModelCheck.d.ts +9 -0
- package/dist/adapters/serviceModelCheck.d.ts.map +1 -0
- package/dist/adapters/{serviceModelFindings.js → serviceModelCheck.js} +9 -23
- package/dist/adapters/serviceModelCheck.js.map +1 -0
- package/dist/adapters/sharedErrorCatalog.d.ts +13 -0
- package/dist/adapters/sharedErrorCatalog.d.ts.map +1 -0
- package/dist/adapters/sharedErrorCatalog.js +28 -0
- package/dist/adapters/sharedErrorCatalog.js.map +1 -0
- package/dist/adapters/sharedErrorModules.d.ts +1 -1
- package/dist/adapters/sharedErrorModules.d.ts.map +1 -1
- package/dist/adapters/sharedErrorModules.js.map +1 -1
- package/dist/adapters/specReaderSources.d.ts +3 -2
- package/dist/adapters/specReaderSources.d.ts.map +1 -1
- package/dist/adapters/specReaderSources.js +6 -3
- package/dist/adapters/specReaderSources.js.map +1 -1
- package/dist/adapters/storyProgram.d.ts +2 -0
- package/dist/adapters/storyProgram.d.ts.map +1 -1
- package/dist/adapters/storyProgram.js +13 -3
- package/dist/adapters/storyProgram.js.map +1 -1
- package/dist/adapters/typeScriptProgram.d.ts +5 -0
- package/dist/adapters/typeScriptProgram.d.ts.map +1 -0
- package/dist/adapters/typeScriptProgram.js +43 -0
- package/dist/adapters/typeScriptProgram.js.map +1 -0
- package/dist/baseline/compare.d.ts +2 -0
- package/dist/baseline/compare.d.ts.map +1 -1
- package/dist/baseline/compare.js +43 -17
- package/dist/baseline/compare.js.map +1 -1
- package/dist/baseline/format.d.ts +1 -0
- package/dist/baseline/format.d.ts.map +1 -1
- package/dist/baseline/format.js +6 -2
- package/dist/baseline/format.js.map +1 -1
- package/dist/baseline/merge.d.ts.map +1 -1
- package/dist/baseline/merge.js +14 -1
- package/dist/baseline/merge.js.map +1 -1
- package/dist/baseline/rewrite.d.ts.map +1 -1
- package/dist/baseline/rewrite.js +3 -1
- package/dist/baseline/rewrite.js.map +1 -1
- package/dist/baseline/update.d.ts +7 -0
- package/dist/baseline/update.d.ts.map +1 -1
- package/dist/baseline/update.js +29 -8
- package/dist/baseline/update.js.map +1 -1
- package/dist/biome/exceptionConfig.d.ts +3 -0
- package/dist/biome/exceptionConfig.d.ts.map +1 -1
- package/dist/biome/exceptionConfig.js +15 -1
- package/dist/biome/exceptionConfig.js.map +1 -1
- package/dist/biome/scannerRules.d.ts +3 -0
- package/dist/biome/scannerRules.d.ts.map +1 -0
- package/dist/biome/scannerRules.js +42 -0
- package/dist/biome/scannerRules.js.map +1 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +10 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +5 -1
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/lint.d.ts +3 -2
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +13 -5
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/misplaced.d.ts +6 -0
- package/dist/cli/misplaced.d.ts.map +1 -1
- package/dist/cli/misplaced.js +4 -2
- package/dist/cli/misplaced.js.map +1 -1
- package/dist/cli/program.js +1 -1
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/runSet.d.ts +5 -0
- package/dist/cli/runSet.d.ts.map +1 -0
- package/dist/cli/runSet.js +15 -0
- package/dist/cli/runSet.js.map +1 -0
- package/dist/cli/shrink.d.ts +4 -4
- package/dist/cli/shrink.d.ts.map +1 -1
- package/dist/cli/shrink.js.map +1 -1
- package/dist/cli/usage.d.ts +1 -1
- package/dist/cli/usage.d.ts.map +1 -1
- package/dist/cli/usage.js +7 -2
- package/dist/cli/usage.js.map +1 -1
- package/dist/config/decode.d.ts +1 -0
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +1 -0
- package/dist/config/decode.js.map +1 -1
- package/dist/config/load.d.ts +2 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +1 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts +2 -1
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +9 -4
- package/dist/config/resolve.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/engine/childStarted.d.ts +4 -0
- package/dist/engine/childStarted.d.ts.map +1 -0
- package/dist/engine/childStarted.js +7 -0
- package/dist/engine/childStarted.js.map +1 -0
- package/dist/engine/evaluate.d.ts +1 -0
- package/dist/engine/evaluate.d.ts.map +1 -1
- package/dist/engine/evaluate.js +2 -1
- package/dist/engine/evaluate.js.map +1 -1
- package/dist/engine/runRule.d.ts +21 -0
- package/dist/engine/runRule.d.ts.map +1 -0
- package/dist/engine/runRule.js +70 -0
- package/dist/engine/runRule.js.map +1 -0
- package/dist/engine/runRules.d.ts +5 -12
- package/dist/engine/runRules.d.ts.map +1 -1
- package/dist/engine/runRules.js +49 -65
- package/dist/engine/runRules.js.map +1 -1
- package/dist/engine/session.d.ts +2 -1
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +20 -6
- package/dist/engine/session.js.map +1 -1
- package/dist/engine/violation.d.ts +7 -0
- package/dist/engine/violation.d.ts.map +1 -1
- package/dist/engine/violation.js +9 -0
- package/dist/engine/violation.js.map +1 -1
- package/dist/exceptions/biomeFindings.d.ts +5 -1
- package/dist/exceptions/biomeFindings.d.ts.map +1 -1
- package/dist/exceptions/biomeFindings.js +17 -18
- package/dist/exceptions/biomeFindings.js.map +1 -1
- package/dist/exceptions/registry.d.ts.map +1 -1
- package/dist/exceptions/registry.js +2 -2
- package/dist/exceptions/registry.js.map +1 -1
- package/dist/hooks/preCommit.d.ts +1 -2
- package/dist/hooks/preCommit.d.ts.map +1 -1
- package/dist/hooks/preCommit.js +11 -1
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/hooks/stagedCheck.d.ts +5 -0
- package/dist/hooks/stagedCheck.d.ts.map +1 -0
- package/dist/hooks/stagedCheck.js +43 -0
- package/dist/hooks/stagedCheck.js.map +1 -0
- package/dist/hooks/withStagedContent.d.ts +5 -0
- package/dist/hooks/withStagedContent.d.ts.map +1 -0
- package/dist/hooks/withStagedContent.js +84 -0
- package/dist/hooks/withStagedContent.js.map +1 -0
- package/dist/imports/browserGlobals.d.ts +1 -1
- package/dist/imports/browserGlobals.d.ts.map +1 -1
- package/dist/imports/browserNames.d.ts +1 -1
- package/dist/imports/browserNames.d.ts.map +1 -1
- package/dist/imports/browserNames.js +5 -3
- package/dist/imports/browserNames.js.map +1 -1
- package/dist/imports/fences/check.d.ts +1 -1
- package/dist/imports/fences/check.d.ts.map +1 -1
- package/dist/imports/fences/compilePolicy.js +1 -1
- package/dist/imports/fences/compilePolicy.js.map +1 -1
- package/dist/imports/fences/evaluate.d.ts +1 -1
- package/dist/imports/fences/evaluate.d.ts.map +1 -1
- package/dist/imports/fences/evaluate.js +1 -1
- package/dist/imports/fences/evaluate.js.map +1 -1
- package/dist/imports/graph.d.ts +6 -1
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/imports/graph.js +30 -2
- package/dist/imports/graph.js.map +1 -1
- package/dist/imports/withoutGenerated.js +1 -1
- package/dist/imports/withoutGenerated.js.map +1 -1
- package/dist/inventory/programmaticBuilds.d.ts +1 -1
- package/dist/inventory/programmaticBuilds.d.ts.map +1 -1
- package/dist/inventory/trackedPaths.d.ts +1 -0
- package/dist/inventory/trackedPaths.d.ts.map +1 -1
- package/dist/inventory/trackedPaths.js +9 -3
- package/dist/inventory/trackedPaths.js.map +1 -1
- package/dist/naming/testCode.d.ts +1 -1
- package/dist/naming/testCode.d.ts.map +1 -1
- package/dist/report/render.d.ts +1 -0
- package/dist/report/render.d.ts.map +1 -1
- package/dist/report/render.js +10 -3
- package/dist/report/render.js.map +1 -1
- package/dist/report/runSetLine.d.ts +3 -0
- package/dist/report/runSetLine.d.ts.map +1 -0
- package/dist/report/runSetLine.js +13 -0
- package/dist/report/runSetLine.js.map +1 -0
- package/dist/report/staleSections.d.ts.map +1 -1
- package/dist/report/staleSections.js +13 -0
- package/dist/report/staleSections.js.map +1 -1
- package/dist/rule.d.ts +30 -4
- package/dist/rule.d.ts.map +1 -1
- package/dist/rule.js +4 -2
- package/dist/rule.js.map +1 -1
- package/dist/rules/biome.d.ts +18 -1
- package/dist/rules/biome.d.ts.map +1 -1
- package/dist/rules/biome.js +32 -7
- package/dist/rules/biome.js.map +1 -1
- package/dist/rules/builtIn.d.ts +8 -8
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +0 -2
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/effect/adapterImports.d.ts +1 -1
- package/dist/rules/effect/adapterImports.d.ts.map +1 -1
- package/dist/rules/effect/adapterImports.js +1 -1
- package/dist/rules/effect/adapterImports.js.map +1 -1
- package/dist/rules/effect/boundary.d.ts +1 -1
- package/dist/rules/effect/boundary.d.ts.map +1 -1
- package/dist/rules/effect/boundary.js +60 -75
- package/dist/rules/effect/boundary.js.map +1 -1
- package/dist/rules/effect/boundaryFindings.d.ts +4 -0
- package/dist/rules/effect/boundaryFindings.d.ts.map +1 -0
- package/dist/rules/effect/boundaryFindings.js +63 -0
- package/dist/rules/effect/boundaryFindings.js.map +1 -0
- package/dist/rules/effect/boundaryReference.d.ts +4 -0
- package/dist/rules/effect/boundaryReference.d.ts.map +1 -1
- package/dist/rules/effect/boundaryReference.js +6 -3
- package/dist/rules/effect/boundaryReference.js.map +1 -1
- package/dist/rules/effect/contextCapture.d.ts.map +1 -1
- package/dist/rules/effect/contextCapture.js +3 -2
- package/dist/rules/effect/contextCapture.js.map +1 -1
- package/dist/rules/effect/errorTags.d.ts +10 -0
- package/dist/rules/effect/errorTags.d.ts.map +1 -0
- package/dist/rules/effect/errorTags.js +57 -0
- package/dist/rules/effect/errorTags.js.map +1 -0
- package/dist/rules/effect/failureHonesty.d.ts +1 -1
- package/dist/rules/effect/failureHonesty.d.ts.map +1 -1
- package/dist/rules/effect/failureHonesty.js +6 -5
- package/dist/rules/effect/failureHonesty.js.map +1 -1
- package/dist/rules/effect/policy.d.ts +1 -1
- package/dist/rules/effect/policy.d.ts.map +1 -1
- package/dist/rules/effect/policy.js +0 -2
- package/dist/rules/effect/policy.js.map +1 -1
- package/dist/rules/effect/promiseBridge.d.ts +3 -0
- package/dist/rules/effect/promiseBridge.d.ts.map +1 -0
- package/dist/rules/effect/promiseBridge.js +60 -0
- package/dist/rules/effect/promiseBridge.js.map +1 -0
- package/dist/rules/effect/rpcBoundary.d.ts.map +1 -1
- package/dist/rules/effect/rpcBoundary.js +92 -3
- package/dist/rules/effect/rpcBoundary.js.map +1 -1
- package/dist/rules/effect/serviceModel.d.ts.map +1 -1
- package/dist/rules/effect/serviceModel.js +3 -2
- package/dist/rules/effect/serviceModel.js.map +1 -1
- package/dist/rules/effect/serviceParameterCheck.d.ts +7 -0
- package/dist/rules/effect/serviceParameterCheck.d.ts.map +1 -0
- package/dist/rules/effect/serviceParameterCheck.js +15 -0
- package/dist/rules/effect/serviceParameterCheck.js.map +1 -0
- package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
- package/dist/rules/effect/serviceParameters.js +4 -36
- package/dist/rules/effect/serviceParameters.js.map +1 -1
- package/dist/rules/effect/sharedErrorClasses.d.ts.map +1 -1
- package/dist/rules/effect/sharedErrorClasses.js +31 -2
- package/dist/rules/effect/sharedErrorClasses.js.map +1 -1
- package/dist/rules/effect/workspaceProgram.d.ts +5 -0
- package/dist/rules/effect/workspaceProgram.d.ts.map +1 -0
- package/dist/rules/effect/workspaceProgram.js +32 -0
- package/dist/rules/effect/workspaceProgram.js.map +1 -0
- package/dist/rules/imports/adminPaths.d.ts +1 -1
- package/dist/rules/imports/adminPaths.d.ts.map +1 -1
- package/dist/rules/imports/cycles.d.ts +1 -1
- package/dist/rules/imports/cycles.d.ts.map +1 -1
- package/dist/rules/imports/fences.d.ts +1 -1
- package/dist/rules/imports/fences.d.ts.map +1 -1
- package/dist/rules/imports/manifest.d.ts +1 -1
- package/dist/rules/imports/manifest.d.ts.map +1 -1
- package/dist/rules/imports/noTestCode.d.ts +1 -1
- package/dist/rules/imports/noTestCode.d.ts.map +1 -1
- package/dist/rules/imports/runtime.d.ts +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +32 -5
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/manifestsNoTestKits.js +1 -1
- package/dist/rules/manifestsNoTestKits.js.map +1 -1
- package/dist/rules/maxLines.d.ts +1 -1
- package/dist/rules/maxLines.d.ts.map +1 -1
- package/dist/rules/packageFindings.d.ts +31 -0
- package/dist/rules/packageFindings.d.ts.map +1 -0
- package/dist/rules/packageFindings.js +65 -0
- package/dist/rules/packageFindings.js.map +1 -0
- package/dist/rules/parse.d.ts +4 -1
- package/dist/rules/parse.d.ts.map +1 -1
- package/dist/rules/parse.js +35 -2
- package/dist/rules/parse.js.map +1 -1
- package/dist/rules/rootedFindings.d.ts +5 -0
- package/dist/rules/rootedFindings.d.ts.map +1 -0
- package/dist/rules/rootedFindings.js +16 -0
- package/dist/rules/rootedFindings.js.map +1 -0
- package/dist/rules/stories/adapterOnlyFakes.d.ts +1 -1
- package/dist/rules/stories/adapterOnlyFakes.d.ts.map +1 -1
- package/dist/rules/stories/adapterOnlyFakes.js +1 -0
- package/dist/rules/stories/adapterOnlyFakes.js.map +1 -1
- package/dist/rules/stories/databaseUrl.d.ts +1 -1
- package/dist/rules/stories/databaseUrl.d.ts.map +1 -1
- package/dist/rules/stories/databaseUrl.js +1 -0
- package/dist/rules/stories/databaseUrl.js.map +1 -1
- package/dist/rules/stories/domainOutcomes.d.ts +1 -1
- package/dist/rules/stories/domainOutcomes.d.ts.map +1 -1
- package/dist/rules/stories/domainOutcomes.js +1 -0
- package/dist/rules/stories/domainOutcomes.js.map +1 -1
- package/dist/rules/stories/engine.d.ts +1 -1
- package/dist/rules/stories/engine.d.ts.map +1 -1
- package/dist/rules/stories/engine.js +1 -0
- package/dist/rules/stories/engine.js.map +1 -1
- package/dist/rules/stories/globalRetries.d.ts +1 -1
- package/dist/rules/stories/globalRetries.d.ts.map +1 -1
- package/dist/rules/stories/globalRetries.js +1 -0
- package/dist/rules/stories/globalRetries.js.map +1 -1
- package/dist/rules/stories/groupedOutcomes.d.ts +1 -1
- package/dist/rules/stories/groupedOutcomes.d.ts.map +1 -1
- package/dist/rules/stories/groupedOutcomes.js +1 -0
- package/dist/rules/stories/groupedOutcomes.js.map +1 -1
- package/dist/rules/stories/importedChangeKeys.js +2 -2
- package/dist/rules/stories/importedChangeKeys.js.map +1 -1
- package/dist/rules/stories/namedValues.d.ts +1 -1
- package/dist/rules/stories/namedValues.d.ts.map +1 -1
- package/dist/rules/stories/namedValues.js +1 -0
- package/dist/rules/stories/namedValues.js.map +1 -1
- package/dist/rules/stories/noExpect.d.ts +1 -1
- package/dist/rules/stories/noExpect.d.ts.map +1 -1
- package/dist/rules/stories/noLimitImports.d.ts +1 -1
- package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
- package/dist/rules/stories/noLimitImports.js +1 -0
- package/dist/rules/stories/noLimitImports.js.map +1 -1
- package/dist/rules/stories/positiveRefusals.d.ts +1 -1
- package/dist/rules/stories/positiveRefusals.d.ts.map +1 -1
- package/dist/rules/stories/positiveRefusals.js +1 -0
- package/dist/rules/stories/positiveRefusals.js.map +1 -1
- package/dist/rules/stories/queueReadouts.d.ts +1 -1
- package/dist/rules/stories/queueReadouts.d.ts.map +1 -1
- package/dist/rules/stories/queueReadouts.js +1 -0
- package/dist/rules/stories/queueReadouts.js.map +1 -1
- package/dist/rules/stories/sources.d.ts +2 -2
- package/dist/rules/stories/sources.d.ts.map +1 -1
- package/dist/rules/stories/specHelpers.d.ts +1 -1
- package/dist/rules/stories/specHelpers.d.ts.map +1 -1
- package/dist/rules/stories/specHelpers.js +3 -2
- package/dist/rules/stories/specHelpers.js.map +1 -1
- package/dist/rules/stories/specs.d.ts +1 -1
- package/dist/rules/stories/specs.d.ts.map +1 -1
- package/dist/rules/stories/specs.js +1 -0
- package/dist/rules/stories/specs.js.map +1 -1
- package/dist/rules/stories/waitOnEvents.d.ts +1 -1
- package/dist/rules/stories/waitOnEvents.d.ts.map +1 -1
- package/dist/rules/stories/waitOnEvents.js +3 -3
- package/dist/rules/stories/waitOnEvents.js.map +1 -1
- package/dist/rules/suppressions/noDoubleCast.d.ts.map +1 -1
- package/dist/rules/suppressions/noDoubleCast.js +4 -49
- package/dist/rules/suppressions/noDoubleCast.js.map +1 -1
- package/dist/rules/suppressions/typedCastCheck.d.ts +10 -0
- package/dist/rules/suppressions/typedCastCheck.d.ts.map +1 -0
- package/dist/rules/suppressions/typedCastCheck.js +48 -0
- package/dist/rules/suppressions/typedCastCheck.js.map +1 -0
- package/dist/rules/unusedCode.d.ts.map +1 -1
- package/dist/rules/unusedCode.js +1 -0
- package/dist/rules/unusedCode.js.map +1 -1
- package/dist/testing/adapters/cli.d.ts +1 -0
- package/dist/testing/adapters/cli.d.ts.map +1 -1
- package/dist/testing/adapters/cli.js +10 -8
- package/dist/testing/adapters/cli.js.map +1 -1
- package/dist/testing/adapters/git.d.ts +1 -16
- package/dist/testing/adapters/git.d.ts.map +1 -1
- package/dist/testing/adapters/git.js +5 -10
- package/dist/testing/adapters/git.js.map +1 -1
- package/dist/testing/adapters/hookRepository.d.ts +3 -2
- package/dist/testing/adapters/hookRepository.d.ts.map +1 -1
- package/dist/testing/adapters/hookRepository.js +11 -8
- package/dist/testing/adapters/hookRepository.js.map +1 -1
- package/dist/testing/adapters/imports.d.ts.map +1 -1
- package/dist/testing/adapters/imports.js +4 -1
- package/dist/testing/adapters/imports.js.map +1 -1
- package/dist/testing/ruleStory.d.ts +1 -1
- package/dist/testing/ruleStory.js +2 -2
- package/dist/testing/ruleStory.js.map +1 -1
- package/docs/debt-and-hooks.md +5 -3
- package/package.json +19 -19
- package/src/adapters/biome/pluginContract.ts +2 -5
- package/src/adapters/biome/run.ts +2 -0
- package/src/adapters/biome/withExceptionConfig.ts +26 -5
- package/src/adapters/{changeKeyFindings.ts → changeKeyCheck.ts} +8 -24
- package/src/adapters/contextCaptureCheck.ts +106 -0
- package/src/adapters/declaration-files/initialize.ts +4 -0
- package/src/adapters/declaration-files/parse.ts +9 -0
- package/src/adapters/declaration-files/reader.ts +28 -0
- package/src/adapters/declaration-files/service.ts +16 -0
- package/src/adapters/foreignResources.ts +0 -4
- package/src/adapters/import-compiler/graph.ts +7 -2
- package/src/adapters/imports/graph.ts +43 -18
- package/src/adapters/knip/configuration.ts +6 -4
- package/src/adapters/knip/run.ts +4 -1
- package/src/adapters/outsideImportFindings.ts +21 -65
- package/src/adapters/rule.ts +29 -6
- package/src/adapters/runMain.ts +7 -6
- package/src/adapters/{serviceModelFindings.ts → serviceModelCheck.ts} +10 -25
- package/src/adapters/sharedErrorCatalog.ts +43 -0
- package/src/adapters/sharedErrorModules.ts +1 -1
- package/src/adapters/specReaderSources.ts +6 -3
- package/src/adapters/storyProgram.ts +20 -3
- package/src/adapters/typeScriptProgram.ts +57 -0
- package/src/baseline/compare.ts +59 -19
- package/src/baseline/format.ts +7 -2
- package/src/baseline/merge.ts +15 -1
- package/src/baseline/rewrite.ts +3 -1
- package/src/baseline/update.ts +38 -8
- package/src/biome/exceptionConfig.ts +24 -3
- package/src/biome/scannerRules.ts +42 -0
- package/src/cli/args.ts +13 -2
- package/src/cli/baseline.ts +7 -1
- package/src/cli/lint.ts +14 -6
- package/src/cli/misplaced.ts +4 -2
- package/src/cli/program.ts +1 -1
- package/src/cli/runSet.ts +17 -0
- package/src/cli/shrink.ts +4 -11
- package/src/cli/usage.ts +7 -2
- package/src/config/decode.ts +1 -0
- package/src/config/load.ts +3 -0
- package/src/config/resolve.ts +11 -6
- package/src/config.ts +3 -0
- package/src/engine/childStarted.ts +8 -0
- package/src/engine/evaluate.ts +3 -1
- package/src/engine/runRule.ts +103 -0
- package/src/engine/runRules.ts +64 -86
- package/src/engine/session.ts +23 -5
- package/src/engine/violation.ts +16 -0
- package/src/exceptions/biomeFindings.ts +24 -21
- package/src/exceptions/registry.ts +2 -2
- package/src/hooks/preCommit.ts +15 -1
- package/src/hooks/stagedCheck.ts +54 -0
- package/src/hooks/withStagedContent.ts +111 -0
- package/src/imports/browserNames.ts +7 -5
- package/src/imports/fences/compilePolicy.ts +1 -1
- package/src/imports/fences/evaluate.ts +2 -2
- package/src/imports/graph.ts +47 -3
- package/src/imports/withoutGenerated.ts +1 -1
- package/src/inventory/trackedPaths.ts +10 -3
- package/src/report/render.ts +12 -3
- package/src/report/runSetLine.ts +14 -0
- package/src/report/staleSections.ts +14 -0
- package/src/rule.ts +38 -7
- package/src/rules/biome.ts +53 -7
- package/src/rules/builtIn.ts +0 -2
- package/src/rules/effect/adapterImports.ts +1 -1
- package/src/rules/effect/boundary.ts +82 -83
- package/src/rules/effect/boundaryFindings.ts +71 -0
- package/src/rules/effect/boundaryReference.ts +7 -3
- package/src/rules/effect/contextCapture.ts +3 -2
- package/src/rules/effect/errorTags.ts +72 -0
- package/src/rules/effect/failureHonesty.ts +9 -5
- package/src/rules/effect/policy.ts +0 -2
- package/src/rules/effect/promiseBridge.ts +65 -0
- package/src/rules/effect/rpcBoundary.ts +111 -4
- package/src/rules/effect/serviceModel.ts +3 -2
- package/src/rules/effect/serviceParameterCheck.ts +22 -0
- package/src/rules/effect/serviceParameters.ts +5 -37
- package/src/rules/effect/sharedErrorClasses.ts +41 -3
- package/src/rules/effect/workspaceProgram.ts +34 -0
- package/src/rules/imports/runtime.ts +43 -6
- package/src/rules/manifestsNoTestKits.ts +1 -1
- package/src/rules/packageFindings.ts +103 -0
- package/src/rules/parse.ts +54 -3
- package/src/rules/rootedFindings.ts +19 -0
- package/src/rules/stories/adapterOnlyFakes.ts +1 -0
- package/src/rules/stories/databaseUrl.ts +1 -0
- package/src/rules/stories/domainOutcomes.ts +1 -0
- package/src/rules/stories/engine.ts +1 -0
- package/src/rules/stories/globalRetries.ts +1 -0
- package/src/rules/stories/groupedOutcomes.ts +1 -0
- package/src/rules/stories/importedChangeKeys.ts +2 -2
- package/src/rules/stories/namedValues.ts +1 -0
- package/src/rules/stories/noLimitImports.ts +1 -0
- package/src/rules/stories/positiveRefusals.ts +1 -0
- package/src/rules/stories/queueReadouts.ts +1 -0
- package/src/rules/stories/specHelpers.ts +8 -5
- package/src/rules/stories/specs.ts +1 -0
- package/src/rules/stories/waitOnEvents.ts +6 -3
- package/src/rules/suppressions/noDoubleCast.ts +5 -55
- package/src/rules/suppressions/typedCastCheck.ts +55 -0
- package/src/rules/unusedCode.ts +1 -0
- package/src/testing/adapters/cli.ts +13 -9
- package/src/testing/adapters/git.ts +6 -11
- package/src/testing/adapters/hookRepository.ts +12 -7
- package/src/testing/adapters/imports.ts +4 -1
- package/src/testing/ruleStory.ts +2 -2
- package/dist/adapters/biome/presetConfig.d.ts +0 -21
- package/dist/adapters/biome/presetConfig.d.ts.map +0 -1
- package/dist/adapters/biome/presetConfig.js +0 -32
- package/dist/adapters/biome/presetConfig.js.map +0 -1
- package/dist/adapters/changeKeyFindings.d.ts +0 -4
- package/dist/adapters/changeKeyFindings.d.ts.map +0 -1
- package/dist/adapters/changeKeyFindings.js.map +0 -1
- package/dist/adapters/contextCaptureFindings.d.ts +0 -4
- package/dist/adapters/contextCaptureFindings.d.ts.map +0 -1
- package/dist/adapters/contextCaptureFindings.js +0 -51
- package/dist/adapters/contextCaptureFindings.js.map +0 -1
- package/dist/adapters/nativeTransactionFindings.d.ts +0 -4
- package/dist/adapters/nativeTransactionFindings.d.ts.map +0 -1
- package/dist/adapters/nativeTransactionFindings.js +0 -98
- package/dist/adapters/nativeTransactionFindings.js.map +0 -1
- package/dist/adapters/rpcBoundaryFindings.d.ts +0 -4
- package/dist/adapters/rpcBoundaryFindings.d.ts.map +0 -1
- package/dist/adapters/rpcBoundaryFindings.js +0 -90
- package/dist/adapters/rpcBoundaryFindings.js.map +0 -1
- package/dist/adapters/serviceModelFindings.d.ts +0 -4
- package/dist/adapters/serviceModelFindings.d.ts.map +0 -1
- package/dist/adapters/serviceModelFindings.js.map +0 -1
- package/dist/adapters/sharedErrorFindings.d.ts +0 -4
- package/dist/adapters/sharedErrorFindings.d.ts.map +0 -1
- package/dist/adapters/sharedErrorFindings.js +0 -71
- package/dist/adapters/sharedErrorFindings.js.map +0 -1
- package/dist/adapters/transactionChanges.d.ts +0 -3
- package/dist/adapters/transactionChanges.d.ts.map +0 -1
- package/dist/adapters/transactionChanges.js +0 -81
- package/dist/adapters/transactionChanges.js.map +0 -1
- package/dist/adapters/vitePort.d.ts +0 -2
- package/dist/adapters/vitePort.d.ts.map +0 -1
- package/dist/adapters/vitePort.js +0 -5
- package/dist/adapters/vitePort.js.map +0 -1
- package/dist/appTestConfig.d.ts +0 -4
- package/dist/appTestConfig.d.ts.map +0 -1
- package/dist/appTestConfig.js +0 -9
- package/dist/appTestConfig.js.map +0 -1
- package/dist/appViteConfig.d.ts +0 -23
- package/dist/appViteConfig.d.ts.map +0 -1
- package/dist/appViteConfig.js +0 -17
- package/dist/appViteConfig.js.map +0 -1
- package/dist/biome/recommendedRules.d.ts +0 -3
- package/dist/biome/recommendedRules.d.ts.map +0 -1
- package/dist/biome/recommendedRules.js +0 -20
- package/dist/biome/recommendedRules.js.map +0 -1
- package/dist/rules/effect/program.d.ts +0 -8
- package/dist/rules/effect/program.d.ts.map +0 -1
- package/dist/rules/effect/program.js +0 -53
- package/dist/rules/effect/program.js.map +0 -1
- package/dist/rules/effect/sqlTransact.d.ts +0 -2
- package/dist/rules/effect/sqlTransact.d.ts.map +0 -1
- package/dist/rules/effect/sqlTransact.js +0 -9
- package/dist/rules/effect/sqlTransact.js.map +0 -1
- package/dist/rules/suppressions/biomeRecommended.d.ts +0 -7
- package/dist/rules/suppressions/biomeRecommended.d.ts.map +0 -1
- package/dist/rules/suppressions/biomeRecommended.js +0 -47
- package/dist/rules/suppressions/biomeRecommended.js.map +0 -1
- package/src/adapters/biome/presetConfig.ts +0 -34
- package/src/adapters/contextCaptureFindings.ts +0 -60
- package/src/adapters/nativeTransactionFindings.ts +0 -108
- package/src/adapters/rpcBoundaryFindings.ts +0 -98
- package/src/adapters/sharedErrorFindings.ts +0 -84
- package/src/adapters/transactionChanges.ts +0 -85
- package/src/adapters/vitePort.ts +0 -5
- package/src/appTestConfig.ts +0 -10
- package/src/appViteConfig.ts +0 -24
- package/src/biome/recommendedRules.ts +0 -27
- package/src/rules/effect/program.ts +0 -57
- package/src/rules/effect/sqlTransact.ts +0 -10
- package/src/rules/suppressions/biomeRecommended.ts +0 -60
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { builtinName } from "#adapters/builtinName.ts";
|
|
3
|
-
import
|
|
3
|
+
import type { Endpoint } from "#imports/Endpoint.ts";
|
|
4
|
+
import { outgoing, walkFrom } from "#imports/fences/reach.ts";
|
|
5
|
+
import { type ImportEdge, type ImportGraph, importGraph } from "#imports/graph.ts";
|
|
4
6
|
import { nodePlatformBarrels } from "#imports/nodePlatformBarrels.ts";
|
|
5
7
|
import { type Runtime, runtimeDeclarationProblems, runtimeOf } from "#imports/runtime.ts";
|
|
6
8
|
import { isTestCode } from "#naming/testName.ts";
|
|
@@ -13,22 +15,57 @@ function forbiddenImport(from: Runtime, to: Runtime | undefined, builtin: boolea
|
|
|
13
15
|
return from === "client" && (to === "server" || builtin);
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
const REPAIR = "Move runtime-dependent code into src/client/ or src/server/ and keep shared code independent of both runtimes.";
|
|
19
|
+
|
|
20
|
+
function forbiddenTarget(from: Runtime, runtime: (path: string) => Runtime | undefined) {
|
|
21
|
+
return (endpoint: Endpoint): string | undefined => {
|
|
22
|
+
const to = endpoint.kind === "file" ? runtime(endpoint.path) : undefined;
|
|
23
|
+
const builtin = endpoint.kind === "external" && builtinName(endpoint.specifier) !== undefined;
|
|
24
|
+
if (!forbiddenImport(from, to, builtin)) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return builtin ? "Node built-in" : `${to} code`;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function importer(from: Runtime): string {
|
|
32
|
+
return from === "client" ? "Client" : "Shared";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface IgnoredReach {
|
|
36
|
+
readonly edgesFrom: ReadonlyMap<string, readonly ImportEdge[]>;
|
|
37
|
+
readonly modules: ReadonlySet<string>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// An ignored module, such as generated output, is never reported itself, so its forbidden imports land on the checked file that reaches them.
|
|
41
|
+
function ignoredFindings(ignored: IgnoredReach, edge: ImportEdge, from: Runtime, runtime: (path: string) => Runtime | undefined) {
|
|
42
|
+
if (edge.to.kind !== "file" || !ignored.modules.has(edge.to.path)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
return walkFrom(edge.to.path, ignored.edgesFrom, forbiddenTarget(from, runtime)).reached.map((reached) => ({
|
|
46
|
+
file: edge.from,
|
|
47
|
+
line: edge.line,
|
|
48
|
+
message: `${importer(from)} code reaches ${reached.match} through "${edge.specifier}", which git ignores: ${reached.path.join(" -> ")}. ${REPAIR}`,
|
|
49
|
+
subject: edge.specifier,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
16
53
|
function runtimeFindings(graph: ImportGraph, runtime: (path: string) => Runtime | undefined) {
|
|
54
|
+
const ignored = { edgesFrom: outgoing(graph.ignoredEdges), modules: new Set(graph.ignoredModules) };
|
|
17
55
|
return graph.edges.flatMap((edge) => {
|
|
18
56
|
const from = runtime(edge.from);
|
|
19
57
|
if (from === undefined || isTestCode(edge.from)) {
|
|
20
58
|
return [];
|
|
21
59
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return [];
|
|
60
|
+
const forbidden = forbiddenTarget(from, runtime)(edge.to);
|
|
61
|
+
if (forbidden === undefined) {
|
|
62
|
+
return ignoredFindings(ignored, edge, from, runtime);
|
|
26
63
|
}
|
|
27
64
|
return [
|
|
28
65
|
{
|
|
29
66
|
file: edge.from,
|
|
30
67
|
line: edge.line,
|
|
31
|
-
message: `${from
|
|
68
|
+
message: `${importer(from)} code imports ${forbidden} through "${edge.specifier}". ${REPAIR}`,
|
|
32
69
|
subject: edge.specifier,
|
|
33
70
|
},
|
|
34
71
|
];
|
|
@@ -8,7 +8,7 @@ import { defineRule, type Finding, type RuleInputs } from "#rule.ts";
|
|
|
8
8
|
|
|
9
9
|
const TEST_PACKAGES = new Set(["@shivaedev/test", "@shivaedev/test-story", "@shivaedev/test-sql", "@shivaedev/test-kits", "vitest"]);
|
|
10
10
|
|
|
11
|
-
const TEST_TOOLING = new Set([...TEST_PACKAGES, "@shivaedev/quality", "@shivaedev/vitest-rerun"]);
|
|
11
|
+
const TEST_TOOLING = new Set([...TEST_PACKAGES, "@shivaedev/build", "@shivaedev/quality", "@shivaedev/vitest-rerun"]);
|
|
12
12
|
|
|
13
13
|
function testingModule(path: string): boolean {
|
|
14
14
|
return isTestCode(path) || /(?:^|\/)(?:testing|test-support)(?:\/|\.|$)/u.test(path);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Deferred, Effect, Layer, Result } from "effect";
|
|
2
|
+
import { changeKeyCheck } from "#adapters/changeKeyCheck.ts";
|
|
3
|
+
import { DeclarationFiles } from "#adapters/declaration-files/service.ts";
|
|
4
|
+
import { projectsFor } from "#adapters/imports/projects.ts";
|
|
5
|
+
import { sourcesProgram } from "#adapters/typeScriptProgram.ts";
|
|
6
|
+
import { packageOf, workspacePackages } from "#imports/workspace.ts";
|
|
7
|
+
import type { Finding, RuleInputs, SourceFile, TypeScriptProgram } from "#rule.ts";
|
|
8
|
+
import { serviceParameterCheck } from "#rules/effect/serviceParameterCheck.ts";
|
|
9
|
+
import { typedCastCheck } from "#rules/suppressions/typedCastCheck.ts";
|
|
10
|
+
|
|
11
|
+
export interface PackageCheck {
|
|
12
|
+
readonly checks: (file: SourceFile) => boolean;
|
|
13
|
+
readonly findings: (files: readonly SourceFile[], typeScript: TypeScriptProgram) => readonly Finding[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CHECKS = [
|
|
17
|
+
{ id: "boundaries/imported-change-keys", prepare: changeKeyCheck },
|
|
18
|
+
{ id: "effect/service-parameters", prepare: serviceParameterCheck },
|
|
19
|
+
{ id: "suppressions/no-double-cast", prepare: typedCastCheck },
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
type CheckId = (typeof CHECKS)[number]["id"];
|
|
23
|
+
|
|
24
|
+
export const PACKAGE_CHECKS: ReadonlySet<string> = new Set(CHECKS.map(({ id }) => id));
|
|
25
|
+
type Prepared = ReturnType<(typeof CHECKS)[number]["prepare"]>;
|
|
26
|
+
type Checked = ReadonlyMap<CheckId, Result.Result<readonly Finding[], Effect.Error<Prepared>>>;
|
|
27
|
+
|
|
28
|
+
function messageOf(cause: unknown): string {
|
|
29
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// One program per package serves every check and is dropped before the next package, so memory stays bounded by the largest package.
|
|
33
|
+
// The walk parses installed declarations into its own registry, not the run's memoized one, so they are released with it; later rules parse again the few they read.
|
|
34
|
+
const walk = Effect.fn("PackageChecks.walk")(function* (inputs: RuleInputs, ids: ReadonlySet<string>) {
|
|
35
|
+
const prepared = yield* Effect.forEach(
|
|
36
|
+
CHECKS.filter(({ id }) => ids.has(id)),
|
|
37
|
+
({ id, prepare }) =>
|
|
38
|
+
Effect.map(Effect.result<PackageCheck, Effect.Error<Prepared>, Effect.Services<Prepared>>(prepare(inputs)), (result) => [id, result] as const),
|
|
39
|
+
);
|
|
40
|
+
const ready = prepared.flatMap(([id, result]) => (Result.isSuccess(result) ? [[id, result.success] as const] : []));
|
|
41
|
+
const packages = yield* workspacePackages(inputs);
|
|
42
|
+
const groups = new Map<string, SourceFile[]>();
|
|
43
|
+
for (const source of inputs.sources) {
|
|
44
|
+
const directory = packageOf(packages, source.path)?.directory ?? ".";
|
|
45
|
+
const files = groups.get(directory) ?? [];
|
|
46
|
+
files.push(source);
|
|
47
|
+
groups.set(directory, files);
|
|
48
|
+
}
|
|
49
|
+
const projectOf = projectsFor(inputs.root);
|
|
50
|
+
const found = new Map<CheckId, Finding[]>(ready.map(([id]) => [id, []]));
|
|
51
|
+
for (const [directory, files] of groups) {
|
|
52
|
+
const selected = ready.map(([id, check]) => ({ check, files: files.filter(check.checks), id })).filter((entry) => entry.files.length > 0);
|
|
53
|
+
if (selected.length === 0) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const typeScript = yield* sourcesProgram(
|
|
57
|
+
inputs.root,
|
|
58
|
+
files.filter((file) => selected.some((entry) => entry.files.includes(file))),
|
|
59
|
+
projectOf,
|
|
60
|
+
);
|
|
61
|
+
for (const { check, files: chosen, id } of selected) {
|
|
62
|
+
const findings = yield* Effect.sync(() => check.findings(chosen, typeScript)).pipe(
|
|
63
|
+
Effect.catchDefect((cause) => Effect.die(new Error(`${id} failed in ${directory}: ${messageOf(cause)}`, { cause }))),
|
|
64
|
+
);
|
|
65
|
+
found.get(id)?.push(...findings);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const checked: Checked = new Map(
|
|
69
|
+
prepared.map(([id, result]) => [id, Result.isSuccess(result) ? Result.succeed(found.get(id) ?? []) : Result.fail(result.failure)]),
|
|
70
|
+
);
|
|
71
|
+
return checked;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function walkPackages(inputs: RuleInputs, ids: ReadonlySet<string>) {
|
|
75
|
+
return walk(inputs, ids).pipe(Effect.provide(Layer.fresh(DeclarationFiles.layer)));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type Walk = ReturnType<typeof walkPackages>;
|
|
79
|
+
const walks = new WeakMap<readonly SourceFile[], Deferred.Deferred<Checked, Effect.Error<Walk>>>();
|
|
80
|
+
|
|
81
|
+
// A run walks the packages once for the checks of its active rules. Those rules wait for the walk outside the rule pool, and the run decides when the walk itself runs.
|
|
82
|
+
export function withPackageWalk<TValue, TError, TServices>(
|
|
83
|
+
inputs: RuleInputs,
|
|
84
|
+
ids: ReadonlySet<string>,
|
|
85
|
+
use: (walked: Effect.Effect<void, never, Effect.Services<Walk>>) => Effect.Effect<TValue, TError, TServices>,
|
|
86
|
+
): Effect.Effect<TValue, TError, TServices> {
|
|
87
|
+
return Effect.acquireUseRelease(
|
|
88
|
+
Effect.sync(() => {
|
|
89
|
+
const walked = Deferred.makeUnsafe<Checked, Effect.Error<Walk>>();
|
|
90
|
+
walks.set(inputs.sources, walked);
|
|
91
|
+
return walked;
|
|
92
|
+
}),
|
|
93
|
+
(walked) => use(Effect.asVoid(Deferred.into(walkPackages(inputs, ids), walked))),
|
|
94
|
+
() => Effect.sync(() => walks.delete(inputs.sources)),
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function packageFindings(inputs: RuleInputs, id: CheckId): Effect.Effect<readonly Finding[], unknown, Effect.Services<Walk>> {
|
|
99
|
+
return Effect.suspend(() => {
|
|
100
|
+
const walked = walks.get(inputs.sources);
|
|
101
|
+
return walked === undefined ? walkPackages(inputs, new Set([id])) : Deferred.await(walked);
|
|
102
|
+
}).pipe(Effect.flatMap((checked) => Effect.fromResult(checked.get(id) ?? Result.succeed([]))));
|
|
103
|
+
}
|
package/src/rules/parse.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
1
3
|
import ts from "typescript";
|
|
2
|
-
import type { SourceFile } from "#rule.ts";
|
|
4
|
+
import type { RuleInputs, SourceFile } from "#rule.ts";
|
|
3
5
|
|
|
4
6
|
const SCRIPT_KINDS: ReadonlyArray<readonly [RegExp, ts.ScriptKind]> = [
|
|
5
7
|
[/\.[cm]?ts$/u, ts.ScriptKind.TS],
|
|
@@ -8,7 +10,56 @@ const SCRIPT_KINDS: ReadonlyArray<readonly [RegExp, ts.ScriptKind]> = [
|
|
|
8
10
|
[/\.jsx$/u, ts.ScriptKind.JSX],
|
|
9
11
|
];
|
|
10
12
|
|
|
13
|
+
interface SharedTree {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
tree?: ts.SourceFile | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const shared = new WeakMap<SourceFile, SharedTree>();
|
|
19
|
+
|
|
20
|
+
function kindOf(file: SourceFile): ts.ScriptKind | undefined {
|
|
21
|
+
return SCRIPT_KINDS.find(([pattern]) => pattern.test(file.path))?.[1];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function created(file: SourceFile, name: string): ts.SourceFile | undefined {
|
|
25
|
+
const kind = kindOf(file);
|
|
26
|
+
return kind === undefined ? undefined : ts.createSourceFile(name, file.text, ts.ScriptTarget.Latest, true, kind);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function parses(file: SourceFile): boolean {
|
|
30
|
+
return kindOf(file) !== undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
11
33
|
export function parse(file: SourceFile): ts.SourceFile | undefined {
|
|
12
|
-
const
|
|
13
|
-
|
|
34
|
+
const slot = shared.get(file);
|
|
35
|
+
if (slot === undefined) {
|
|
36
|
+
return created(file, file.path);
|
|
37
|
+
}
|
|
38
|
+
if (!("tree" in slot)) {
|
|
39
|
+
slot.tree = created(file, slot.name);
|
|
40
|
+
}
|
|
41
|
+
return slot.tree;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// A shared tree carries its absolute path because the story program, which binds the same trees, renames every file it loads to the path it asked for.
|
|
45
|
+
export function withSharedTrees<TValue, TError, TServices>(
|
|
46
|
+
inputs: Pick<RuleInputs, "root" | "sources">,
|
|
47
|
+
rules: Effect.Effect<TValue, TError, TServices>,
|
|
48
|
+
): Effect.Effect<TValue, TError, TServices> {
|
|
49
|
+
return Effect.acquireUseRelease(
|
|
50
|
+
Effect.sync(() => {
|
|
51
|
+
const registered = inputs.sources.filter((file) => !shared.has(file));
|
|
52
|
+
for (const file of registered) {
|
|
53
|
+
shared.set(file, { name: join(inputs.root, file.path) });
|
|
54
|
+
}
|
|
55
|
+
return registered;
|
|
56
|
+
}),
|
|
57
|
+
() => rules,
|
|
58
|
+
(registered) =>
|
|
59
|
+
Effect.sync(() => {
|
|
60
|
+
for (const file of registered) {
|
|
61
|
+
shared.delete(file);
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
14
65
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import { DeclarationFiles } from "#adapters/declaration-files/service.ts";
|
|
3
|
+
import { sourcesProgram } from "#adapters/typeScriptProgram.ts";
|
|
4
|
+
import type { RuleInputs } from "#rule.ts";
|
|
5
|
+
import type { PackageCheck } from "#rules/packageFindings.ts";
|
|
6
|
+
|
|
7
|
+
// The program is rooted at only the files the check reads, and TypeScript loads what they import. Its declarations are parsed into a registry of its own, released with the program when the rule is done.
|
|
8
|
+
const findings = Effect.fn("RootedFindings.findings")(function* (inputs: RuleInputs, check: PackageCheck) {
|
|
9
|
+
const roots = inputs.sources.filter(check.checks);
|
|
10
|
+
if (roots.length === 0) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const typeScript = yield* sourcesProgram(inputs.root, roots);
|
|
14
|
+
return check.findings(roots, typeScript);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export function rootedFindings(inputs: RuleInputs, check: PackageCheck) {
|
|
18
|
+
return findings(inputs, check).pipe(Effect.provide(Layer.fresh(DeclarationFiles.layer)));
|
|
19
|
+
}
|
|
@@ -62,5 +62,6 @@ export const adapterOnlyFakes = defineRule({
|
|
|
62
62
|
}),
|
|
63
63
|
description: "Tests fake only adapters, outside libraries and platform globals; owned modules and services run for real.",
|
|
64
64
|
id: "tests/adapter-only-fakes",
|
|
65
|
+
needs: "story-program",
|
|
65
66
|
registrable: false,
|
|
66
67
|
});
|
|
@@ -70,4 +70,5 @@ export const storyEngine = defineRule({
|
|
|
70
70
|
description:
|
|
71
71
|
"Story bodies use their kit instead of raw services, story.engine or production wiring; constructor subjects and native transaction blocks remain explicit.",
|
|
72
72
|
id: "tests/story-engine",
|
|
73
|
+
needs: "story-program",
|
|
73
74
|
});
|
|
@@ -63,4 +63,5 @@ export const groupedOutcomes = defineRule({
|
|
|
63
63
|
check: (inputs) => Effect.map(storySources(inputs), (stories) => stories.flatMap((file) => syntaxFindings(file, consecutiveChecks, MESSAGE))),
|
|
64
64
|
description: "Several outcomes after one action are rows of one outcomes call, so the story's words lead each line.",
|
|
65
65
|
id: "tests/grouped-outcomes",
|
|
66
|
+
needs: "story-program",
|
|
66
67
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { changeKeyFindings } from "#adapters/changeKeyFindings.ts";
|
|
2
1
|
import { defineRule } from "#rule.ts";
|
|
2
|
+
import { packageFindings } from "#rules/packageFindings.ts";
|
|
3
3
|
|
|
4
4
|
export const importedChangeKeys = defineRule({
|
|
5
|
-
check:
|
|
5
|
+
check: (inputs) => packageFindings(inputs, "boundaries/imported-change-keys"),
|
|
6
6
|
description:
|
|
7
7
|
"Change collection and bucket names in Reactivity invalidation and mutation, SQL invalidateOnCommit and changes key encoders come from their owner's imported declaration. Replace literal array keys, record keys and typed key collection/field names; IDs and bucket values remain application data.",
|
|
8
8
|
id: "boundaries/imported-change-keys",
|
|
@@ -79,4 +79,5 @@ export const noLimitImports = defineRule({
|
|
|
79
79
|
check: (inputs) => Effect.map(storySources(inputs), (stories) => stories.flatMap((file) => syntaxFindings(file, capImports, MESSAGE))),
|
|
80
80
|
description: "Stories prove behavior instead of importing implementation caps from limits modules.",
|
|
81
81
|
id: "tests/no-limit-imports",
|
|
82
|
+
needs: "story-program",
|
|
82
83
|
});
|
|
@@ -5,5 +5,6 @@ export const queueReadouts = defineRule({
|
|
|
5
5
|
check: queueReadoutFindings,
|
|
6
6
|
description: "Application tests assert job results, never jobs-testing queue storage; jobs and the test-kits controller test their own readouts.",
|
|
7
7
|
id: "tests/queue-readouts",
|
|
8
|
+
needs: "story-program",
|
|
8
9
|
registrable: false,
|
|
9
10
|
});
|
|
@@ -10,13 +10,16 @@ const MESSAGE =
|
|
|
10
10
|
|
|
11
11
|
export const specHelpers = defineRule({
|
|
12
12
|
check: (inputs) =>
|
|
13
|
-
Effect.
|
|
14
|
-
specReaderSources(stories)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
Effect.flatMap(storySources(inputs), (stories) =>
|
|
14
|
+
Effect.map(specReaderSources(stories), (readers) =>
|
|
15
|
+
readers.flatMap(({ source, readCall }) =>
|
|
16
|
+
topLevelHelpers(source)
|
|
17
|
+
.filter((node) => !pureReader(node, readCall))
|
|
18
|
+
.map((node) => findingAt(source, node, MESSAGE)),
|
|
19
|
+
),
|
|
18
20
|
),
|
|
19
21
|
),
|
|
20
22
|
description: "Specs state expectations and may keep pure matchers and readers; story-kit traits and verbs in test-support own setup and actions.",
|
|
21
23
|
id: "tests/spec-helpers",
|
|
24
|
+
needs: "story-program",
|
|
22
25
|
});
|
|
@@ -99,4 +99,5 @@ export const storySpecs = defineRule({
|
|
|
99
99
|
description:
|
|
100
100
|
"Every package tests its real engine through its own test-story kit, and a plain test lives only in a .unit file that reaches no engine and mocks nothing. Typecheck tests and the test-story, test and types packages need no kit.",
|
|
101
101
|
id: "tests/story-specs",
|
|
102
|
+
needs: "story-program",
|
|
102
103
|
});
|
|
@@ -63,9 +63,8 @@ function readsInCondition(node: ts.Node): boolean {
|
|
|
63
63
|
return ts.isYieldExpression(node) || ts.forEachChild(node, readsInCondition) === true;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
function timedWaits(source: ts.SourceFile): readonly ts.Node[] {
|
|
66
|
+
function timedWaits(source: ts.SourceFile, support: boolean): readonly ts.Node[] {
|
|
67
67
|
const bindings = importBindings(source);
|
|
68
|
-
const support = isTestSupport(source.fileName);
|
|
69
68
|
const found: ts.Node[] = [];
|
|
70
69
|
function visit(node: ts.Node): void {
|
|
71
70
|
if (
|
|
@@ -85,8 +84,12 @@ function timedWaits(source: ts.SourceFile): readonly ts.Node[] {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
export const waitOnEvents = defineRule({
|
|
88
|
-
check: (inputs) =>
|
|
87
|
+
check: (inputs) =>
|
|
88
|
+
Effect.map(storyWaitSources(inputs), (sources) =>
|
|
89
|
+
sources.flatMap((file) => syntaxFindings(file, (source) => timedWaits(source, isTestSupport(file.path)), MESSAGE)),
|
|
90
|
+
),
|
|
89
91
|
description: "Stories and reachable test-support settle on the engine's own signals; controlled clock advances belong in kit verbs.",
|
|
90
92
|
id: "tests/wait-on-events",
|
|
93
|
+
needs: "story-program",
|
|
91
94
|
registrable: false,
|
|
92
95
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
1
|
import ts from "typescript";
|
|
3
|
-
import { defineRule, type Finding, type
|
|
4
|
-
import {
|
|
2
|
+
import { defineRule, type Finding, type SourceFile } from "#rule.ts";
|
|
3
|
+
import { packageFindings } from "#rules/packageFindings.ts";
|
|
5
4
|
import { parse } from "#rules/parse.ts";
|
|
6
|
-
import { hiddenCast
|
|
7
|
-
import { readonlyWrite, writeCandidate } from "#rules/suppressions/readonlyWrite.ts";
|
|
5
|
+
import { hiddenCast } from "#rules/suppressions/hiddenCast.ts";
|
|
8
6
|
|
|
9
7
|
const BRIDGES: ReadonlyMap<ts.SyntaxKind, string> = new Map([
|
|
10
8
|
[ts.SyntaxKind.UnknownKeyword, "unknown"],
|
|
@@ -49,57 +47,9 @@ function doubleCasts(file: SourceFile): readonly Finding[] {
|
|
|
49
47
|
return source === undefined ? [] : castsIn(file.path, source);
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
function typedNodes(source: ts.SourceFile): readonly ts.Node[] {
|
|
53
|
-
const nodes: ts.Node[] = [];
|
|
54
|
-
function visit(node: ts.Node): void {
|
|
55
|
-
if (writeCandidate(node) || (ts.isTaggedTemplateExpression(node) && node.typeArguments?.length && node.tag.getText() !== "sql")) {
|
|
56
|
-
nodes.push(node);
|
|
57
|
-
}
|
|
58
|
-
ts.forEachChild(node, visit);
|
|
59
|
-
}
|
|
60
|
-
visit(source);
|
|
61
|
-
return nodes;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function typedCast(node: ts.Node, checker: ts.TypeChecker): string | undefined {
|
|
65
|
-
if (ts.isTaggedTemplateExpression(node)) {
|
|
66
|
-
const nativeSql = checker
|
|
67
|
-
.getTypeAtLocation(node.tag)
|
|
68
|
-
.getSymbol()
|
|
69
|
-
?.getDeclarations()
|
|
70
|
-
?.some((declaration) =>
|
|
71
|
-
/(?:^|\/)effect\/(?:src|dist(?:\/[^/]+)?)\/sql\/(?:SqlClient|Statement)\.(?:d\.)?ts$/u.test(declaration.getSourceFile().fileName),
|
|
72
|
-
);
|
|
73
|
-
return nativeSql ? SQL_ROW_CAST : undefined;
|
|
74
|
-
}
|
|
75
|
-
return readonlyWrite(node, checker);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function typedCasts(inputs: RuleInputs): readonly Finding[] {
|
|
79
|
-
const sources = inputs.sources.filter((file) => {
|
|
80
|
-
const source = parse(file);
|
|
81
|
-
return !/(?:^|\/)(?:adapters|test-support)\//u.test(file.path) && source !== undefined && typedNodes(source).length > 0;
|
|
82
|
-
});
|
|
83
|
-
if (sources.length === 0) {
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
const program = effectProgram({ ...inputs, sources });
|
|
87
|
-
const checker = program.getTypeChecker();
|
|
88
|
-
return sources.flatMap((file) => {
|
|
89
|
-
const source = program.getSourceFile(join(inputs.root, file.path));
|
|
90
|
-
return source === undefined
|
|
91
|
-
? []
|
|
92
|
-
: typedNodes(source).flatMap((node) => {
|
|
93
|
-
const message = typedCast(node, checker);
|
|
94
|
-
return message === undefined
|
|
95
|
-
? []
|
|
96
|
-
: [{ file: file.path, line: source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1, message }];
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
50
|
export const noDoubleCast = defineRule({
|
|
102
|
-
check: (inputs) =>
|
|
51
|
+
check: (inputs) => inputs.sources.flatMap(doubleCasts),
|
|
52
|
+
deepHalf: { check: (inputs) => packageFindings(inputs, "suppressions/no-double-cast"), name: "typed half" },
|
|
103
53
|
description:
|
|
104
54
|
"Decode unknown values with Schema.decodeUnknownEffect and SQL rows with SqlSchema. Check declared overload returns and preserve Context service types and readonly native fields; writes on an object just built with new, before anything else can see it, are construction. Reports double casts everywhere and hidden casts outside adapters/ and test-support/.",
|
|
105
55
|
id: "suppressions/no-double-cast",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import type { Finding, SourceFile, TypeScriptProgram } from "#rule.ts";
|
|
4
|
+
import { parse } from "#rules/parse.ts";
|
|
5
|
+
import { SQL_ROW_CAST } from "#rules/suppressions/hiddenCast.ts";
|
|
6
|
+
import { readonlyWrite, writeCandidate } from "#rules/suppressions/readonlyWrite.ts";
|
|
7
|
+
|
|
8
|
+
function typedNodes(source: ts.SourceFile): readonly ts.Node[] {
|
|
9
|
+
const nodes: ts.Node[] = [];
|
|
10
|
+
function visit(node: ts.Node): void {
|
|
11
|
+
if (writeCandidate(node) || (ts.isTaggedTemplateExpression(node) && node.typeArguments?.length && node.tag.getText() !== "sql")) {
|
|
12
|
+
nodes.push(node);
|
|
13
|
+
}
|
|
14
|
+
ts.forEachChild(node, visit);
|
|
15
|
+
}
|
|
16
|
+
visit(source);
|
|
17
|
+
return nodes;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function typedCast(node: ts.Node, checker: ts.TypeChecker): string | undefined {
|
|
21
|
+
if (ts.isTaggedTemplateExpression(node)) {
|
|
22
|
+
const nativeSql = checker
|
|
23
|
+
.getTypeAtLocation(node.tag)
|
|
24
|
+
.getSymbol()
|
|
25
|
+
?.getDeclarations()
|
|
26
|
+
?.some((declaration) =>
|
|
27
|
+
/(?:^|\/)effect\/(?:src|dist(?:\/[^/]+)?)\/sql\/(?:SqlClient|Statement)\.(?:d\.)?ts$/u.test(declaration.getSourceFile().fileName),
|
|
28
|
+
);
|
|
29
|
+
return nativeSql ? SQL_ROW_CAST : undefined;
|
|
30
|
+
}
|
|
31
|
+
return readonlyWrite(node, checker);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function candidate(file: SourceFile): boolean {
|
|
35
|
+
const source = parse(file);
|
|
36
|
+
return !/(?:^|\/)(?:adapters|test-support)\//u.test(file.path) && source !== undefined && typedNodes(source).length > 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function typedCasts(sources: readonly SourceFile[], { checker, sourceFile }: TypeScriptProgram): readonly Finding[] {
|
|
40
|
+
return sources.flatMap((file) => {
|
|
41
|
+
const source = sourceFile(file.path);
|
|
42
|
+
return source === undefined
|
|
43
|
+
? []
|
|
44
|
+
: typedNodes(source).flatMap((node) => {
|
|
45
|
+
const message = typedCast(node, checker);
|
|
46
|
+
return message === undefined
|
|
47
|
+
? []
|
|
48
|
+
: [{ file: file.path, line: source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1, message }];
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function typedCastCheck() {
|
|
54
|
+
return Effect.withSpan(Effect.succeed({ checks: candidate, findings: typedCasts }), "Suppressions.typedCastCheck");
|
|
55
|
+
}
|
package/src/rules/unusedCode.ts
CHANGED
|
@@ -6,5 +6,6 @@ export const unusedCode = defineRule({
|
|
|
6
6
|
description:
|
|
7
7
|
"Reports unused files, exports and package dependencies, and missing dependencies, through knip. Reach code from declared entry points or remove it; record existing debt in the baseline.",
|
|
8
8
|
id: "code/unused",
|
|
9
|
+
needs: "child-process",
|
|
9
10
|
registrable: false,
|
|
10
11
|
});
|
|
@@ -5,7 +5,7 @@ import { format } from "node:util";
|
|
|
5
5
|
import { Config, ConfigProvider, Console, Effect, Option } from "effect";
|
|
6
6
|
import { exitCode, explained, services } from "#adapters/runMain.ts";
|
|
7
7
|
import { program } from "#cli/program.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { isolatedEnvironment, qualityGitEnvironment } from "#testing/adapters/git.ts";
|
|
9
9
|
|
|
10
10
|
export interface Run {
|
|
11
11
|
readonly status: number | null;
|
|
@@ -24,10 +24,9 @@ export function qualityArgs(args: readonly string[]): string[] {
|
|
|
24
24
|
return [...OPTIONS, CLI, ...args];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const ISOLATED: readonly (readonly [string, string | undefined])[] = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
];
|
|
27
|
+
const ISOLATED: readonly (readonly [string, string | undefined])[] = [["CLAUDE_CODE_REMOTE", undefined], ...Object.entries(qualityGitEnvironment)];
|
|
28
|
+
|
|
29
|
+
const RUN_SET_VARIABLES: ReadonlySet<string> = new Set(["CI", "CLAUDE_CODE_REMOTE"]);
|
|
31
30
|
|
|
32
31
|
async function isolateGit(): Promise<() => void> {
|
|
33
32
|
const { vi } = await import("vitest");
|
|
@@ -83,15 +82,16 @@ export function capturing(output: Output): Console.Console {
|
|
|
83
82
|
};
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
// Runs the executable's program in this process, which imports each config path once: after a command rewrites the config, spawn `quality`.
|
|
87
|
-
export function
|
|
85
|
+
// Runs the executable's program in this process, which imports each config path once: after a command rewrites the config, spawn `quality`. The host's CI and cloud session variables would choose the rule set, so only the given variables do.
|
|
86
|
+
export function runQualityWith(root: string, variables: Readonly<Record<string, string>>, ...args: readonly string[]): Effect.Effect<Run> {
|
|
88
87
|
return Effect.scoped(
|
|
89
88
|
Effect.gen(function* () {
|
|
90
89
|
const output: Output = { stderr: "", stdout: "" };
|
|
91
90
|
const command = program(args, { cwd: realpathSync(root), launch: { options: OPTIONS, script: CLI } });
|
|
91
|
+
const host = yield* ConfigProvider.ConfigProvider;
|
|
92
92
|
const environment = ConfigProvider.orElse(
|
|
93
|
-
ConfigProvider.fromEnv({ env: { "HEAVY_PROCESS_LOCK": isolatedEnvironment(root).HEAVY_PROCESS_LOCK } }),
|
|
94
|
-
|
|
93
|
+
ConfigProvider.fromEnv({ env: { ...variables, "HEAVY_PROCESS_LOCK": isolatedEnvironment(root).HEAVY_PROCESS_LOCK } }),
|
|
94
|
+
ConfigProvider.make((path) => (RUN_SET_VARIABLES.has(path.join("_")) ? Effect.succeed(undefined) : host.load(path))),
|
|
95
95
|
);
|
|
96
96
|
yield* Effect.acquireRelease(Effect.promise(isolateGit), (restore) => Effect.sync(restore));
|
|
97
97
|
const exit = yield* explained(command).pipe(
|
|
@@ -105,6 +105,10 @@ export function runQuality(root: string, ...args: readonly string[]): Effect.Eff
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
export function runQuality(root: string, ...args: readonly string[]): Effect.Effect<Run> {
|
|
109
|
+
return runQualityWith(root, {}, ...args);
|
|
110
|
+
}
|
|
111
|
+
|
|
108
112
|
export function quality(root: string, ...args: readonly string[]): Run {
|
|
109
113
|
const result = spawnSync("node", qualityArgs(args), { cwd: root, encoding: "utf8", env: isolatedEnvironment(root) });
|
|
110
114
|
return { status: result.status, stderr: result.stderr, stdout: result.stdout };
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { Config, Effect, Option } from "effect";
|
|
4
|
+
import { isolatedGitEnvironment } from "@shivaedev/test-story/server/adapters/isolatedGit.ts";
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
["
|
|
6
|
+
const INHERITED = Object.fromEntries(
|
|
7
|
+
["HOME", "HEAVY_PROCESS_LOCK", "HEAVY_PROCESS_LOCK_ID", "PATH"].flatMap((name) =>
|
|
7
8
|
Option.toArray(Effect.runSync(Config.option(Config.String(name)))).map((value) => [name, value]),
|
|
8
9
|
),
|
|
9
10
|
);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
// GIT_INDEX_FILE from a hook that runs the tests points git at the outer repository.
|
|
13
|
-
export const ISOLATED_ENV = {
|
|
14
|
-
...HEAVY_ENV,
|
|
12
|
+
export const qualityGitEnvironment = isolatedGitEnvironment({
|
|
15
13
|
"GIT_AUTHOR_EMAIL": "quality@example.invalid",
|
|
16
14
|
"GIT_AUTHOR_NAME": "Quality",
|
|
17
15
|
"GIT_COMMITTER_EMAIL": "quality@example.invalid",
|
|
18
16
|
"GIT_COMMITTER_NAME": "Quality",
|
|
19
|
-
|
|
20
|
-
"GIT_CONFIG_NOSYSTEM": "1",
|
|
21
|
-
"PATH": Effect.runSync(Config.String("PATH")),
|
|
22
|
-
};
|
|
17
|
+
});
|
|
23
18
|
|
|
24
19
|
export function isolatedEnvironment(root: string) {
|
|
25
|
-
return { ...
|
|
20
|
+
return { ...INHERITED, ...qualityGitEnvironment, "HEAVY_PROCESS_LOCK": resolve(root, "heavy.lock") };
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
const SETTINGS = [
|