@opensip-tools/fitness 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/LICENSE +21 -0
- package/dist/__tests__/gate.test.d.ts +13 -0
- package/dist/__tests__/gate.test.d.ts.map +1 -0
- package/dist/__tests__/gate.test.js +422 -0
- package/dist/__tests__/gate.test.js.map +1 -0
- package/dist/__tests__/sarif.test.d.ts +2 -0
- package/dist/__tests__/sarif.test.d.ts.map +1 -0
- package/dist/__tests__/sarif.test.js +169 -0
- package/dist/__tests__/sarif.test.js.map +1 -0
- package/dist/cli/dashboard.d.ts +6 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +77 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/fit.d.ts +37 -0
- package/dist/cli/fit.d.ts.map +1 -0
- package/dist/cli/fit.js +539 -0
- package/dist/cli/fit.js.map +1 -0
- package/dist/cli/list-checks.d.ts +6 -0
- package/dist/cli/list-checks.d.ts.map +1 -0
- package/dist/cli/list-checks.js +23 -0
- package/dist/cli/list-checks.js.map +1 -0
- package/dist/cli/list-recipes.d.ts +6 -0
- package/dist/cli/list-recipes.d.ts.map +1 -0
- package/dist/cli/list-recipes.js +31 -0
- package/dist/cli/list-recipes.js.map +1 -0
- package/dist/framework/__tests__/ast-utilities.test.d.ts +2 -0
- package/dist/framework/__tests__/ast-utilities.test.d.ts.map +1 -0
- package/dist/framework/__tests__/ast-utilities.test.js +153 -0
- package/dist/framework/__tests__/ast-utilities.test.js.map +1 -0
- package/dist/framework/__tests__/check-config.test.d.ts +2 -0
- package/dist/framework/__tests__/check-config.test.d.ts.map +1 -0
- package/dist/framework/__tests__/check-config.test.js +56 -0
- package/dist/framework/__tests__/check-config.test.js.map +1 -0
- package/dist/framework/__tests__/command-executor.test.d.ts +2 -0
- package/dist/framework/__tests__/command-executor.test.d.ts.map +1 -0
- package/dist/framework/__tests__/command-executor.test.js +71 -0
- package/dist/framework/__tests__/command-executor.test.js.map +1 -0
- package/dist/framework/__tests__/content-filter-dispatch.test.d.ts +2 -0
- package/dist/framework/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
- package/dist/framework/__tests__/content-filter-dispatch.test.js +104 -0
- package/dist/framework/__tests__/content-filter-dispatch.test.js.map +1 -0
- package/dist/framework/__tests__/content-filter.test.d.ts +2 -0
- package/dist/framework/__tests__/content-filter.test.d.ts.map +1 -0
- package/dist/framework/__tests__/content-filter.test.js +126 -0
- package/dist/framework/__tests__/content-filter.test.js.map +1 -0
- package/dist/framework/__tests__/define-check.test.d.ts +2 -0
- package/dist/framework/__tests__/define-check.test.d.ts.map +1 -0
- package/dist/framework/__tests__/define-check.test.js +155 -0
- package/dist/framework/__tests__/define-check.test.js.map +1 -0
- package/dist/framework/__tests__/directive-inventory.test.d.ts +2 -0
- package/dist/framework/__tests__/directive-inventory.test.d.ts.map +1 -0
- package/dist/framework/__tests__/directive-inventory.test.js +44 -0
- package/dist/framework/__tests__/directive-inventory.test.js.map +1 -0
- package/dist/framework/__tests__/execution-context.test.d.ts +2 -0
- package/dist/framework/__tests__/execution-context.test.d.ts.map +1 -0
- package/dist/framework/__tests__/execution-context.test.js +62 -0
- package/dist/framework/__tests__/execution-context.test.js.map +1 -0
- package/dist/framework/__tests__/file-accessor.test.d.ts +2 -0
- package/dist/framework/__tests__/file-accessor.test.d.ts.map +1 -0
- package/dist/framework/__tests__/file-accessor.test.js +106 -0
- package/dist/framework/__tests__/file-accessor.test.js.map +1 -0
- package/dist/framework/__tests__/file-cache.test.d.ts +2 -0
- package/dist/framework/__tests__/file-cache.test.d.ts.map +1 -0
- package/dist/framework/__tests__/file-cache.test.js +122 -0
- package/dist/framework/__tests__/file-cache.test.js.map +1 -0
- package/dist/framework/__tests__/import-graph.test.d.ts +15 -0
- package/dist/framework/__tests__/import-graph.test.d.ts.map +1 -0
- package/dist/framework/__tests__/import-graph.test.js +164 -0
- package/dist/framework/__tests__/import-graph.test.js.map +1 -0
- package/dist/framework/__tests__/path-matcher.test.d.ts +2 -0
- package/dist/framework/__tests__/path-matcher.test.d.ts.map +1 -0
- package/dist/framework/__tests__/path-matcher.test.js +113 -0
- package/dist/framework/__tests__/path-matcher.test.js.map +1 -0
- package/dist/framework/__tests__/register-helpers.test.d.ts +2 -0
- package/dist/framework/__tests__/register-helpers.test.d.ts.map +1 -0
- package/dist/framework/__tests__/register-helpers.test.js +42 -0
- package/dist/framework/__tests__/register-helpers.test.js.map +1 -0
- package/dist/framework/__tests__/registry.test.d.ts +2 -0
- package/dist/framework/__tests__/registry.test.d.ts.map +1 -0
- package/dist/framework/__tests__/registry.test.js +208 -0
- package/dist/framework/__tests__/registry.test.js.map +1 -0
- package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
- package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
- package/dist/framework/__tests__/result-builder.test.js +153 -0
- package/dist/framework/__tests__/result-builder.test.js.map +1 -0
- package/dist/framework/__tests__/scope-resolver.test.d.ts +2 -0
- package/dist/framework/__tests__/scope-resolver.test.d.ts.map +1 -0
- package/dist/framework/__tests__/scope-resolver.test.js +140 -0
- package/dist/framework/__tests__/scope-resolver.test.js.map +1 -0
- package/dist/framework/__tests__/severity-mapping.test.d.ts +2 -0
- package/dist/framework/__tests__/severity-mapping.test.d.ts.map +1 -0
- package/dist/framework/__tests__/severity-mapping.test.js +42 -0
- package/dist/framework/__tests__/severity-mapping.test.js.map +1 -0
- package/dist/framework/__tests__/strip-literals.test.d.ts +2 -0
- package/dist/framework/__tests__/strip-literals.test.d.ts.map +1 -0
- package/dist/framework/__tests__/strip-literals.test.js +87 -0
- package/dist/framework/__tests__/strip-literals.test.js.map +1 -0
- package/dist/framework/abortable-exec.d.ts +34 -0
- package/dist/framework/abortable-exec.d.ts.map +1 -0
- package/dist/framework/abortable-exec.js +136 -0
- package/dist/framework/abortable-exec.js.map +1 -0
- package/dist/framework/ast-utilities.d.ts +41 -0
- package/dist/framework/ast-utilities.d.ts.map +1 -0
- package/dist/framework/ast-utilities.js +106 -0
- package/dist/framework/ast-utilities.js.map +1 -0
- package/dist/framework/check-config.d.ts +171 -0
- package/dist/framework/check-config.d.ts.map +1 -0
- package/dist/framework/check-config.js +114 -0
- package/dist/framework/check-config.js.map +1 -0
- package/dist/framework/check-types.d.ts +57 -0
- package/dist/framework/check-types.d.ts.map +1 -0
- package/dist/framework/check-types.js +35 -0
- package/dist/framework/check-types.js.map +1 -0
- package/dist/framework/command-executor.d.ts +25 -0
- package/dist/framework/command-executor.d.ts.map +1 -0
- package/dist/framework/command-executor.js +63 -0
- package/dist/framework/command-executor.js.map +1 -0
- package/dist/framework/constants.d.ts +9 -0
- package/dist/framework/constants.d.ts.map +1 -0
- package/dist/framework/constants.js +16 -0
- package/dist/framework/constants.js.map +1 -0
- package/dist/framework/content-filter.d.ts +33 -0
- package/dist/framework/content-filter.d.ts.map +1 -0
- package/dist/framework/content-filter.js +236 -0
- package/dist/framework/content-filter.js.map +1 -0
- package/dist/framework/define-check.d.ts +38 -0
- package/dist/framework/define-check.d.ts.map +1 -0
- package/dist/framework/define-check.js +252 -0
- package/dist/framework/define-check.js.map +1 -0
- package/dist/framework/directive-inventory.d.ts +34 -0
- package/dist/framework/directive-inventory.d.ts.map +1 -0
- package/dist/framework/directive-inventory.js +77 -0
- package/dist/framework/directive-inventory.js.map +1 -0
- package/dist/framework/directive-parsing.d.ts +20 -0
- package/dist/framework/directive-parsing.d.ts.map +1 -0
- package/dist/framework/directive-parsing.js +121 -0
- package/dist/framework/directive-parsing.js.map +1 -0
- package/dist/framework/execution-context.d.ts +95 -0
- package/dist/framework/execution-context.d.ts.map +1 -0
- package/dist/framework/execution-context.js +122 -0
- package/dist/framework/execution-context.js.map +1 -0
- package/dist/framework/file-accessor.d.ts +20 -0
- package/dist/framework/file-accessor.d.ts.map +1 -0
- package/dist/framework/file-accessor.js +122 -0
- package/dist/framework/file-accessor.js.map +1 -0
- package/dist/framework/file-cache.d.ts +70 -0
- package/dist/framework/file-cache.d.ts.map +1 -0
- package/dist/framework/file-cache.js +178 -0
- package/dist/framework/file-cache.js.map +1 -0
- package/dist/framework/file-type-filter.d.ts +11 -0
- package/dist/framework/file-type-filter.d.ts.map +1 -0
- package/dist/framework/file-type-filter.js +21 -0
- package/dist/framework/file-type-filter.js.map +1 -0
- package/dist/framework/ignore-processing.d.ts +22 -0
- package/dist/framework/ignore-processing.d.ts.map +1 -0
- package/dist/framework/ignore-processing.js +241 -0
- package/dist/framework/ignore-processing.js.map +1 -0
- package/dist/framework/import-graph.d.ts +51 -0
- package/dist/framework/import-graph.d.ts.map +1 -0
- package/dist/framework/import-graph.js +216 -0
- package/dist/framework/import-graph.js.map +1 -0
- package/dist/framework/memory-profiler.d.ts +53 -0
- package/dist/framework/memory-profiler.d.ts.map +1 -0
- package/dist/framework/memory-profiler.js +92 -0
- package/dist/framework/memory-profiler.js.map +1 -0
- package/dist/framework/parse-cache.d.ts +23 -0
- package/dist/framework/parse-cache.d.ts.map +1 -0
- package/dist/framework/parse-cache.js +37 -0
- package/dist/framework/parse-cache.js.map +1 -0
- package/dist/framework/path-matcher.d.ts +86 -0
- package/dist/framework/path-matcher.d.ts.map +1 -0
- package/dist/framework/path-matcher.js +138 -0
- package/dist/framework/path-matcher.js.map +1 -0
- package/dist/framework/register-helpers.d.ts +10 -0
- package/dist/framework/register-helpers.d.ts.map +1 -0
- package/dist/framework/register-helpers.js +17 -0
- package/dist/framework/register-helpers.js.map +1 -0
- package/dist/framework/registry.d.ts +41 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +103 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/result-builder.d.ts +74 -0
- package/dist/framework/result-builder.d.ts.map +1 -0
- package/dist/framework/result-builder.js +154 -0
- package/dist/framework/result-builder.js.map +1 -0
- package/dist/framework/scope-resolver.d.ts +23 -0
- package/dist/framework/scope-resolver.d.ts.map +1 -0
- package/dist/framework/scope-resolver.js +201 -0
- package/dist/framework/scope-resolver.js.map +1 -0
- package/dist/framework/severity-mapping.d.ts +13 -0
- package/dist/framework/severity-mapping.d.ts.map +1 -0
- package/dist/framework/severity-mapping.js +51 -0
- package/dist/framework/severity-mapping.js.map +1 -0
- package/dist/framework/strip-literals.d.ts +48 -0
- package/dist/framework/strip-literals.d.ts.map +1 -0
- package/dist/framework/strip-literals.js +188 -0
- package/dist/framework/strip-literals.js.map +1 -0
- package/dist/gate.d.ts +74 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +257 -0
- package/dist/gate.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/__tests__/check-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/check-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/check-package-discovery.test.js +170 -0
- package/dist/plugins/__tests__/check-package-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/lang-domain.test.d.ts +2 -0
- package/dist/plugins/__tests__/lang-domain.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/lang-domain.test.js +171 -0
- package/dist/plugins/__tests__/lang-domain.test.js.map +1 -0
- package/dist/plugins/__tests__/loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/loader.test.js +194 -0
- package/dist/plugins/__tests__/loader.test.js.map +1 -0
- package/dist/plugins/check-package-discovery.d.ts +73 -0
- package/dist/plugins/check-package-discovery.d.ts.map +1 -0
- package/dist/plugins/check-package-discovery.js +212 -0
- package/dist/plugins/check-package-discovery.js.map +1 -0
- package/dist/plugins/loader.d.ts +31 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +290 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/types.d.ts +23 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +9 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/recipes/__tests__/built-in-recipes.test.d.ts +2 -0
- package/dist/recipes/__tests__/built-in-recipes.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/built-in-recipes.test.js +93 -0
- package/dist/recipes/__tests__/built-in-recipes.test.js.map +1 -0
- package/dist/recipes/__tests__/check-config.test.d.ts +5 -0
- package/dist/recipes/__tests__/check-config.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/check-config.test.js +37 -0
- package/dist/recipes/__tests__/check-config.test.js.map +1 -0
- package/dist/recipes/__tests__/check-resolution.test.d.ts +2 -0
- package/dist/recipes/__tests__/check-resolution.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/check-resolution.test.js +135 -0
- package/dist/recipes/__tests__/check-resolution.test.js.map +1 -0
- package/dist/recipes/__tests__/registry.test.d.ts +2 -0
- package/dist/recipes/__tests__/registry.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/registry.test.js +97 -0
- package/dist/recipes/__tests__/registry.test.js.map +1 -0
- package/dist/recipes/__tests__/retry.test.d.ts +2 -0
- package/dist/recipes/__tests__/retry.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/retry.test.js +75 -0
- package/dist/recipes/__tests__/retry.test.js.map +1 -0
- package/dist/recipes/__tests__/service.test.d.ts +11 -0
- package/dist/recipes/__tests__/service.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/service.test.js +482 -0
- package/dist/recipes/__tests__/service.test.js.map +1 -0
- package/dist/recipes/built-in-recipes.d.ts +14 -0
- package/dist/recipes/built-in-recipes.d.ts.map +1 -0
- package/dist/recipes/built-in-recipes.js +247 -0
- package/dist/recipes/built-in-recipes.js.map +1 -0
- package/dist/recipes/check-config.d.ts +40 -0
- package/dist/recipes/check-config.d.ts.map +1 -0
- package/dist/recipes/check-config.js +61 -0
- package/dist/recipes/check-config.js.map +1 -0
- package/dist/recipes/check-resolution.d.ts +21 -0
- package/dist/recipes/check-resolution.d.ts.map +1 -0
- package/dist/recipes/check-resolution.js +121 -0
- package/dist/recipes/check-resolution.js.map +1 -0
- package/dist/recipes/check-result-processor.d.ts +51 -0
- package/dist/recipes/check-result-processor.d.ts.map +1 -0
- package/dist/recipes/check-result-processor.js +158 -0
- package/dist/recipes/check-result-processor.js.map +1 -0
- package/dist/recipes/parallel-execution.d.ts +33 -0
- package/dist/recipes/parallel-execution.d.ts.map +1 -0
- package/dist/recipes/parallel-execution.js +142 -0
- package/dist/recipes/parallel-execution.js.map +1 -0
- package/dist/recipes/registry.d.ts +81 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +131 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/retry.d.ts +25 -0
- package/dist/recipes/retry.d.ts.map +1 -0
- package/dist/recipes/retry.js +44 -0
- package/dist/recipes/retry.js.map +1 -0
- package/dist/recipes/sequential-execution.d.ts +10 -0
- package/dist/recipes/sequential-execution.d.ts.map +1 -0
- package/dist/recipes/sequential-execution.js +122 -0
- package/dist/recipes/sequential-execution.js.map +1 -0
- package/dist/recipes/service-types.d.ts +84 -0
- package/dist/recipes/service-types.d.ts.map +1 -0
- package/dist/recipes/service-types.js +8 -0
- package/dist/recipes/service-types.js.map +1 -0
- package/dist/recipes/service.d.ts +71 -0
- package/dist/recipes/service.d.ts.map +1 -0
- package/dist/recipes/service.js +331 -0
- package/dist/recipes/service.js.map +1 -0
- package/dist/recipes/types.d.ts +154 -0
- package/dist/recipes/types.d.ts.map +1 -0
- package/dist/recipes/types.js +54 -0
- package/dist/recipes/types.js.map +1 -0
- package/dist/sarif.d.ts +34 -0
- package/dist/sarif.d.ts.map +1 -0
- package/dist/sarif.js +192 -0
- package/dist/sarif.js.map +1 -0
- package/dist/signalers/__tests__/loader.test.d.ts +2 -0
- package/dist/signalers/__tests__/loader.test.d.ts.map +1 -0
- package/dist/signalers/__tests__/loader.test.js +74 -0
- package/dist/signalers/__tests__/loader.test.js.map +1 -0
- package/dist/signalers/index.d.ts +8 -0
- package/dist/signalers/index.d.ts.map +1 -0
- package/dist/signalers/index.js +9 -0
- package/dist/signalers/index.js.map +1 -0
- package/dist/signalers/loader.d.ts +24 -0
- package/dist/signalers/loader.d.ts.map +1 -0
- package/dist/signalers/loader.js +108 -0
- package/dist/signalers/loader.js.map +1 -0
- package/dist/signalers/schema.d.ts +288 -0
- package/dist/signalers/schema.d.ts.map +1 -0
- package/dist/signalers/schema.js +99 -0
- package/dist/signalers/schema.js.map +1 -0
- package/dist/signalers/types.d.ts +13 -0
- package/dist/signalers/types.d.ts.map +1 -0
- package/dist/signalers/types.js +5 -0
- package/dist/signalers/types.js.map +1 -0
- package/dist/targets/__tests__/loader.test.d.ts +2 -0
- package/dist/targets/__tests__/loader.test.d.ts.map +1 -0
- package/dist/targets/__tests__/loader.test.js +127 -0
- package/dist/targets/__tests__/loader.test.js.map +1 -0
- package/dist/targets/__tests__/resolver.test.d.ts +2 -0
- package/dist/targets/__tests__/resolver.test.d.ts.map +1 -0
- package/dist/targets/__tests__/resolver.test.js +54 -0
- package/dist/targets/__tests__/resolver.test.js.map +1 -0
- package/dist/targets/__tests__/target-registry.test.d.ts +2 -0
- package/dist/targets/__tests__/target-registry.test.d.ts.map +1 -0
- package/dist/targets/__tests__/target-registry.test.js +89 -0
- package/dist/targets/__tests__/target-registry.test.js.map +1 -0
- package/dist/targets/index.d.ts +10 -0
- package/dist/targets/index.d.ts.map +1 -0
- package/dist/targets/index.js +12 -0
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/loader.d.ts +19 -0
- package/dist/targets/loader.d.ts.map +1 -0
- package/dist/targets/loader.js +159 -0
- package/dist/targets/loader.js.map +1 -0
- package/dist/targets/resolver.d.ts +19 -0
- package/dist/targets/resolver.d.ts.map +1 -0
- package/dist/targets/resolver.js +37 -0
- package/dist/targets/resolver.js.map +1 -0
- package/dist/targets/target-registry.d.ts +61 -0
- package/dist/targets/target-registry.d.ts.map +1 -0
- package/dist/targets/target-registry.js +93 -0
- package/dist/targets/target-registry.js.map +1 -0
- package/dist/targets/types.d.ts +85 -0
- package/dist/targets/types.d.ts.map +1 -0
- package/dist/targets/types.js +5 -0
- package/dist/targets/types.js.map +1 -0
- package/dist/tool.d.ts +17 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +282 -0
- package/dist/tool.js.map +1 -0
- package/dist/types/findings.d.ts +117 -0
- package/dist/types/findings.d.ts.map +1 -0
- package/dist/types/findings.js +93 -0
- package/dist/types/findings.js.map +1 -0
- package/dist/types/severity.d.ts +15 -0
- package/dist/types/severity.d.ts.map +1 -0
- package/dist/types/severity.js +36 -0
- package/dist/types/severity.js.map +1 -0
- package/package.json +45 -0
- package/src/__tests__/gate.test.ts +537 -0
- package/src/__tests__/sarif.test.ts +201 -0
- package/src/cli/dashboard.ts +93 -0
- package/src/cli/fit.ts +612 -0
- package/src/cli/list-checks.ts +32 -0
- package/src/cli/list-recipes.ts +38 -0
- package/src/framework/__tests__/ast-utilities.test.ts +157 -0
- package/src/framework/__tests__/check-config.test.ts +65 -0
- package/src/framework/__tests__/command-executor.test.ts +79 -0
- package/src/framework/__tests__/content-filter-dispatch.test.ts +132 -0
- package/src/framework/__tests__/content-filter.test.ts +136 -0
- package/src/framework/__tests__/define-check.test.ts +180 -0
- package/src/framework/__tests__/directive-inventory.test.ts +53 -0
- package/src/framework/__tests__/execution-context.test.ts +80 -0
- package/src/framework/__tests__/file-accessor.test.ts +121 -0
- package/src/framework/__tests__/file-cache.test.ts +142 -0
- package/src/framework/__tests__/import-graph.test.ts +282 -0
- package/src/framework/__tests__/path-matcher.test.ts +130 -0
- package/src/framework/__tests__/register-helpers.test.ts +51 -0
- package/src/framework/__tests__/registry.test.ts +243 -0
- package/src/framework/__tests__/result-builder.test.ts +178 -0
- package/src/framework/__tests__/scope-resolver.test.ts +208 -0
- package/src/framework/__tests__/severity-mapping.test.ts +50 -0
- package/src/framework/__tests__/strip-literals.test.ts +109 -0
- package/src/framework/abortable-exec.ts +177 -0
- package/src/framework/ast-utilities.ts +112 -0
- package/src/framework/check-config.ts +339 -0
- package/src/framework/check-types.ts +77 -0
- package/src/framework/command-executor.ts +100 -0
- package/src/framework/constants.ts +16 -0
- package/src/framework/content-filter.ts +288 -0
- package/src/framework/define-check.ts +336 -0
- package/src/framework/directive-inventory.ts +110 -0
- package/src/framework/directive-parsing.ts +152 -0
- package/src/framework/execution-context.ts +247 -0
- package/src/framework/file-accessor.ts +171 -0
- package/src/framework/file-cache.ts +220 -0
- package/src/framework/file-type-filter.ts +25 -0
- package/src/framework/ignore-processing.ts +350 -0
- package/src/framework/import-graph.ts +280 -0
- package/src/framework/memory-profiler.ts +145 -0
- package/src/framework/parse-cache.ts +38 -0
- package/src/framework/path-matcher.ts +191 -0
- package/src/framework/register-helpers.ts +20 -0
- package/src/framework/registry.ts +125 -0
- package/src/framework/result-builder.ts +225 -0
- package/src/framework/scope-resolver.ts +262 -0
- package/src/framework/severity-mapping.ts +56 -0
- package/src/framework/strip-literals.ts +200 -0
- package/src/gate.ts +337 -0
- package/src/index.ts +110 -0
- package/src/plugins/__tests__/check-package-discovery.test.ts +204 -0
- package/src/plugins/__tests__/lang-domain.test.ts +198 -0
- package/src/plugins/__tests__/loader.test.ts +226 -0
- package/src/plugins/check-package-discovery.ts +242 -0
- package/src/plugins/loader.ts +327 -0
- package/src/plugins/types.ts +25 -0
- package/src/recipes/__tests__/built-in-recipes.test.ts +107 -0
- package/src/recipes/__tests__/check-config.test.ts +51 -0
- package/src/recipes/__tests__/check-resolution.test.ts +185 -0
- package/src/recipes/__tests__/registry.test.ts +115 -0
- package/src/recipes/__tests__/retry.test.ts +83 -0
- package/src/recipes/__tests__/service.test.ts +572 -0
- package/src/recipes/built-in-recipes.ts +273 -0
- package/src/recipes/check-config.ts +64 -0
- package/src/recipes/check-resolution.ts +169 -0
- package/src/recipes/check-result-processor.ts +258 -0
- package/src/recipes/parallel-execution.ts +220 -0
- package/src/recipes/registry.ts +192 -0
- package/src/recipes/retry.ts +69 -0
- package/src/recipes/sequential-execution.ts +139 -0
- package/src/recipes/service-types.ts +105 -0
- package/src/recipes/service.ts +400 -0
- package/src/recipes/types.ts +247 -0
- package/src/sarif.ts +232 -0
- package/src/signalers/__tests__/loader.test.ts +99 -0
- package/src/signalers/index.ts +9 -0
- package/src/signalers/loader.ts +141 -0
- package/src/signalers/schema.ts +117 -0
- package/src/signalers/types.ts +15 -0
- package/src/targets/__tests__/loader.test.ts +170 -0
- package/src/targets/__tests__/resolver.test.ts +74 -0
- package/src/targets/__tests__/target-registry.test.ts +103 -0
- package/src/targets/index.ts +13 -0
- package/src/targets/loader.ts +214 -0
- package/src/targets/resolver.ts +44 -0
- package/src/targets/target-registry.ts +111 -0
- package/src/targets/types.ts +89 -0
- package/src/tool.ts +302 -0
- package/src/types/findings.ts +239 -0
- package/src/types/severity.ts +39 -0
- package/tsconfig.json +8 -0
- package/vitest.config.ts +33 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { TargetRegistry } from '../target-registry.js';
|
|
3
|
+
const stub = (name, opts = {}) => ({
|
|
4
|
+
config: {
|
|
5
|
+
name,
|
|
6
|
+
description: name,
|
|
7
|
+
include: [`${name}/**`],
|
|
8
|
+
exclude: [],
|
|
9
|
+
...(opts.tags && { tags: opts.tags }),
|
|
10
|
+
...(opts.languages && { languages: opts.languages }),
|
|
11
|
+
...(opts.concerns && { concerns: opts.concerns }),
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
describe('TargetRegistry', () => {
|
|
15
|
+
it('register adds new targets and returns this for chaining', () => {
|
|
16
|
+
const reg = new TargetRegistry();
|
|
17
|
+
const result = reg.register(stub('a')).register(stub('b'));
|
|
18
|
+
expect(result).toBe(reg);
|
|
19
|
+
expect(reg.size).toBe(2);
|
|
20
|
+
});
|
|
21
|
+
it('register silently skips duplicate names', () => {
|
|
22
|
+
const reg = new TargetRegistry();
|
|
23
|
+
reg.register(stub('a'));
|
|
24
|
+
reg.register(stub('a'));
|
|
25
|
+
expect(reg.size).toBe(1);
|
|
26
|
+
});
|
|
27
|
+
it('getByName / has lookups', () => {
|
|
28
|
+
const reg = new TargetRegistry();
|
|
29
|
+
const a = stub('a');
|
|
30
|
+
reg.register(a);
|
|
31
|
+
expect(reg.getByName('a')).toBe(a);
|
|
32
|
+
expect(reg.getByName('nope')).toBeUndefined();
|
|
33
|
+
expect(reg.has('a')).toBe(true);
|
|
34
|
+
expect(reg.has('nope')).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
it('getAll returns the live set, but a fresh array each call', () => {
|
|
37
|
+
const reg = new TargetRegistry();
|
|
38
|
+
reg.register(stub('a'));
|
|
39
|
+
const snapshot = reg.getAll();
|
|
40
|
+
expect(snapshot).toHaveLength(1);
|
|
41
|
+
snapshot.pop();
|
|
42
|
+
expect(reg.getAll()).toHaveLength(1); // not affected
|
|
43
|
+
});
|
|
44
|
+
it('getByTag filters by config.tags', () => {
|
|
45
|
+
const reg = new TargetRegistry();
|
|
46
|
+
reg.register(stub('a', { tags: ['fast'] }));
|
|
47
|
+
reg.register(stub('b', { tags: ['slow'] }));
|
|
48
|
+
reg.register(stub('c'));
|
|
49
|
+
expect(reg.getByTag('fast').map((t) => t.config.name)).toEqual(['a']);
|
|
50
|
+
});
|
|
51
|
+
describe('findByScope', () => {
|
|
52
|
+
it('returns targets whose languages intersect when both sides specify', () => {
|
|
53
|
+
const reg = new TargetRegistry();
|
|
54
|
+
reg.register(stub('ts', { languages: ['typescript'], concerns: ['backend'] }));
|
|
55
|
+
reg.register(stub('rs', { languages: ['rust'], concerns: ['backend'] }));
|
|
56
|
+
const matched = reg.findByScope(['typescript'], ['backend']);
|
|
57
|
+
expect(matched.map((t) => t.config.name)).toEqual(['ts']);
|
|
58
|
+
});
|
|
59
|
+
it('treats empty check languages as "matches any"', () => {
|
|
60
|
+
const reg = new TargetRegistry();
|
|
61
|
+
reg.register(stub('ts', { languages: ['typescript'], concerns: ['backend'] }));
|
|
62
|
+
reg.register(stub('rs', { languages: ['rust'], concerns: ['backend'] }));
|
|
63
|
+
expect(reg.findByScope([], ['backend'])).toHaveLength(2);
|
|
64
|
+
});
|
|
65
|
+
it('treats targets with no languages as "matches any check language"', () => {
|
|
66
|
+
const reg = new TargetRegistry();
|
|
67
|
+
reg.register(stub('any-lang', { concerns: ['backend'] })); // no languages
|
|
68
|
+
expect(reg.findByScope(['typescript'], ['backend'])).toHaveLength(1);
|
|
69
|
+
});
|
|
70
|
+
it('treats empty check concerns as "matches any"', () => {
|
|
71
|
+
const reg = new TargetRegistry();
|
|
72
|
+
reg.register(stub('ts', { languages: ['typescript'], concerns: ['backend'] }));
|
|
73
|
+
expect(reg.findByScope(['typescript'], [])).toHaveLength(1);
|
|
74
|
+
});
|
|
75
|
+
it('requires both dimensions to match', () => {
|
|
76
|
+
const reg = new TargetRegistry();
|
|
77
|
+
reg.register(stub('ts-frontend', { languages: ['typescript'], concerns: ['frontend'] }));
|
|
78
|
+
expect(reg.findByScope(['typescript'], ['backend'])).toEqual([]);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
it('clear removes everything', () => {
|
|
82
|
+
const reg = new TargetRegistry();
|
|
83
|
+
reg.register(stub('a'));
|
|
84
|
+
reg.clear();
|
|
85
|
+
expect(reg.size).toBe(0);
|
|
86
|
+
expect(reg.getAll()).toEqual([]);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=target-registry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-registry.test.js","sourceRoot":"","sources":["../../../src/targets/__tests__/target-registry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,MAAM,IAAI,GAAG,CAAC,IA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CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;YACzF,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target system barrel export
|
|
3
|
+
*
|
|
4
|
+
* Public API for config-driven targets:
|
|
5
|
+
* - loadTargetsConfig() — Load from opensip-tools.config.yml
|
|
6
|
+
* - resolveTargetFiles() — Expand globs, deduplicate
|
|
7
|
+
*/
|
|
8
|
+
export { loadTargetsConfig } from './loader.js';
|
|
9
|
+
export { resolveTargetFiles } from './resolver.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target system barrel export
|
|
3
|
+
*
|
|
4
|
+
* Public API for config-driven targets:
|
|
5
|
+
* - loadTargetsConfig() — Load from opensip-tools.config.yml
|
|
6
|
+
* - resolveTargetFiles() — Expand globs, deduplicate
|
|
7
|
+
*/
|
|
8
|
+
// Loader
|
|
9
|
+
export { loadTargetsConfig } from './loader.js';
|
|
10
|
+
// Resolver
|
|
11
|
+
export { resolveTargetFiles } from './resolver.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,SAAS;AACT,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target config loader
|
|
3
|
+
*
|
|
4
|
+
* Loads target configuration from opensip-tools.config.yml in the project root.
|
|
5
|
+
* Validates with Zod and populates a TargetRegistry.
|
|
6
|
+
*/
|
|
7
|
+
import { TargetRegistry } from './target-registry.js';
|
|
8
|
+
import type { TargetsConfig } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Load full targets config including per-check target overrides.
|
|
11
|
+
* Resolves via the shared project-config resolver.
|
|
12
|
+
* @throws {ValidationError} When no targets config file is found or it cannot be loaded
|
|
13
|
+
* @throws {ValidationError} When the config file fails schema validation
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadTargetsConfig(rootDir: string, explicitPath?: string): {
|
|
16
|
+
registry: TargetRegistry;
|
|
17
|
+
config: TargetsConfig;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/targets/loader.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAA;AAwL7D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAGrD"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// @fitness-ignore-file batch-operation-limits -- iterates bounded collections (config entries, registry items, or small analysis results)
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Target config loader
|
|
4
|
+
*
|
|
5
|
+
* Loads target configuration from opensip-tools.config.yml in the project root.
|
|
6
|
+
* Validates with Zod and populates a TargetRegistry.
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync, statSync } from 'node:fs';
|
|
9
|
+
import { PROJECT_CONFIG_FILENAME, resolveProjectConfigPath, ValidationError, SystemError } from '@opensip-tools/core';
|
|
10
|
+
import yaml from 'js-yaml';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { TargetRegistry } from './target-registry.js';
|
|
13
|
+
const YAML_FILENAME = PROJECT_CONFIG_FILENAME;
|
|
14
|
+
const DEFAULT_EXCLUDES = ['**/node_modules/**', '**/dist/**'];
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// YAML schemas
|
|
17
|
+
// =============================================================================
|
|
18
|
+
const TargetEntrySchema = z.object({
|
|
19
|
+
description: z.string().min(1, 'description is required'),
|
|
20
|
+
include: z.array(z.string()).min(1, 'at least one include pattern is required'),
|
|
21
|
+
exclude: z.array(z.string()).optional(),
|
|
22
|
+
tags: z.array(z.string()).optional(),
|
|
23
|
+
languages: z.array(z.string()).optional(),
|
|
24
|
+
concerns: z.array(z.string()).optional(),
|
|
25
|
+
});
|
|
26
|
+
const CheckTargetValueSchema = z.union([
|
|
27
|
+
z.string(),
|
|
28
|
+
z.array(z.string()).min(1),
|
|
29
|
+
]);
|
|
30
|
+
const PluginsSchema = z.object({
|
|
31
|
+
fit: z.array(z.string()).optional(),
|
|
32
|
+
sim: z.array(z.string()).optional(),
|
|
33
|
+
asm: z.array(z.string()).optional(),
|
|
34
|
+
lang: z.array(z.string()).optional(),
|
|
35
|
+
checkPackages: z.array(z.string()).optional(),
|
|
36
|
+
autoDiscoverChecks: z.boolean().optional(),
|
|
37
|
+
}).optional();
|
|
38
|
+
const TargetsFileSchema = z.object({
|
|
39
|
+
targets: z.record(z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'target name must be kebab-case'), TargetEntrySchema),
|
|
40
|
+
globalExcludes: z.array(z.string()).optional(),
|
|
41
|
+
checkOverrides: z.record(z.string(), CheckTargetValueSchema).optional(),
|
|
42
|
+
plugins: PluginsSchema,
|
|
43
|
+
});
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// Build registry + config from parsed data
|
|
46
|
+
// =============================================================================
|
|
47
|
+
/** @throws {ValidationError} When checkOverrides references an unknown target */
|
|
48
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- inherent complexity: registry population + cross-validation
|
|
49
|
+
function buildFromParsed(targets, rawGlobalExcludes, rawCheckOverrides, sourceLabel, rawPlugins) {
|
|
50
|
+
const registry = new TargetRegistry();
|
|
51
|
+
for (const [name, entry] of Object.entries(targets)) {
|
|
52
|
+
const config = Object.freeze({
|
|
53
|
+
name,
|
|
54
|
+
description: entry.description,
|
|
55
|
+
include: Object.freeze([...entry.include]),
|
|
56
|
+
exclude: Object.freeze([...(entry.exclude ?? DEFAULT_EXCLUDES)]),
|
|
57
|
+
...(entry.tags && { tags: Object.freeze([...entry.tags]) }),
|
|
58
|
+
...(entry.languages && { languages: Object.freeze([...entry.languages]) }),
|
|
59
|
+
...(entry.concerns && { concerns: Object.freeze([...entry.concerns]) }),
|
|
60
|
+
});
|
|
61
|
+
registry.register(Object.freeze({ config }));
|
|
62
|
+
}
|
|
63
|
+
const checkOverrides = {};
|
|
64
|
+
if (rawCheckOverrides) {
|
|
65
|
+
for (const [checkSlug, targetRef] of Object.entries(rawCheckOverrides)) {
|
|
66
|
+
const targetNames = typeof targetRef === 'string' ? [targetRef] : targetRef;
|
|
67
|
+
for (const name of targetNames) {
|
|
68
|
+
if (!registry.has(name)) {
|
|
69
|
+
// @fitness-ignore-next-line result-pattern-consistency -- infrastructure boundary, throw is appropriate
|
|
70
|
+
throw new ValidationError(`${sourceLabel}: checkOverrides['${checkSlug}'] references unknown target '${name}'. ` +
|
|
71
|
+
`Available targets: ${registry.getAll().map((t) => t.config.name).join(', ')}`, { code: 'ERRORS.TARGETS.UNKNOWN_TARGET' });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
checkOverrides[checkSlug] = typeof targetRef === 'string' ? targetRef : Object.freeze([...targetRef]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const plugins = rawPlugins
|
|
78
|
+
? Object.freeze({
|
|
79
|
+
...(rawPlugins.fit && { fit: Object.freeze([...rawPlugins.fit]) }),
|
|
80
|
+
...(rawPlugins.sim && { sim: Object.freeze([...rawPlugins.sim]) }),
|
|
81
|
+
...(rawPlugins.asm && { asm: Object.freeze([...rawPlugins.asm]) }),
|
|
82
|
+
...(rawPlugins.lang && { lang: Object.freeze([...rawPlugins.lang]) }),
|
|
83
|
+
...(rawPlugins.checkPackages && { checkPackages: Object.freeze([...rawPlugins.checkPackages]) }),
|
|
84
|
+
...(rawPlugins.autoDiscoverChecks !== undefined && { autoDiscoverChecks: rawPlugins.autoDiscoverChecks }),
|
|
85
|
+
})
|
|
86
|
+
: undefined;
|
|
87
|
+
const config = Object.freeze({
|
|
88
|
+
globalExcludes: Object.freeze(rawGlobalExcludes ? [...rawGlobalExcludes] : []),
|
|
89
|
+
checkOverrides: Object.freeze(checkOverrides),
|
|
90
|
+
...(plugins && { plugins }),
|
|
91
|
+
});
|
|
92
|
+
return { registry, config };
|
|
93
|
+
}
|
|
94
|
+
// =============================================================================
|
|
95
|
+
// YAML config loader
|
|
96
|
+
// =============================================================================
|
|
97
|
+
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
|
|
98
|
+
/** @throws {ValidationError} When the file is too large, missing, or unreadable */
|
|
99
|
+
function readYamlFile(filePath) {
|
|
100
|
+
try {
|
|
101
|
+
const stats = statSync(filePath);
|
|
102
|
+
if (stats.size > MAX_FILE_SIZE) {
|
|
103
|
+
throw new SystemError(`File too large (${stats.size} bytes, max ${MAX_FILE_SIZE}): ${filePath}`, { code: 'SYSTEM.FILE.TOO_LARGE' });
|
|
104
|
+
}
|
|
105
|
+
return readFileSync(filePath, 'utf8');
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (error instanceof ValidationError || error instanceof SystemError)
|
|
109
|
+
throw error;
|
|
110
|
+
throw new ValidationError(`${YAML_FILENAME} not found at ${filePath}. Create one to define your targets.`, { operation: 'load', loader: 'targets' });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** @throws {ValidationError} When the YAML is malformed */
|
|
114
|
+
function parseYamlContent(raw) {
|
|
115
|
+
try {
|
|
116
|
+
return yaml.load(raw);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
120
|
+
throw new ValidationError(`${YAML_FILENAME} contains invalid YAML: ${message}`, {
|
|
121
|
+
operation: 'load',
|
|
122
|
+
loader: 'targets',
|
|
123
|
+
cause: error instanceof Error ? error : undefined,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @throws {ValidationError} When the file is missing or contains invalid YAML
|
|
129
|
+
* @throws {ValidationError} When the file fails schema validation
|
|
130
|
+
*/
|
|
131
|
+
function loadYamlConfig(filePath) {
|
|
132
|
+
const raw = readYamlFile(filePath);
|
|
133
|
+
const parsed = parseYamlContent(raw);
|
|
134
|
+
const result = TargetsFileSchema.safeParse(parsed);
|
|
135
|
+
if (!result.success) {
|
|
136
|
+
const issues = result.error.issues
|
|
137
|
+
.map((i) => ` ${i.path.join('.')}: ${i.message}`)
|
|
138
|
+
.join('\n');
|
|
139
|
+
// @fitness-ignore-next-line result-pattern-consistency -- infrastructure boundary, throw is appropriate
|
|
140
|
+
throw new ValidationError(`${YAML_FILENAME} validation failed:\n${issues}`, {
|
|
141
|
+
code: 'ERRORS.TARGETS.VALIDATION_FAILED',
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return buildFromParsed(result.data.targets, result.data.globalExcludes, result.data.checkOverrides, YAML_FILENAME, result.data.plugins);
|
|
145
|
+
}
|
|
146
|
+
// =============================================================================
|
|
147
|
+
// Public API
|
|
148
|
+
// =============================================================================
|
|
149
|
+
/**
|
|
150
|
+
* Load full targets config including per-check target overrides.
|
|
151
|
+
* Resolves via the shared project-config resolver.
|
|
152
|
+
* @throws {ValidationError} When no targets config file is found or it cannot be loaded
|
|
153
|
+
* @throws {ValidationError} When the config file fails schema validation
|
|
154
|
+
*/
|
|
155
|
+
export function loadTargetsConfig(rootDir, explicitPath) {
|
|
156
|
+
const yamlPath = resolveProjectConfigPath(rootDir, explicitPath);
|
|
157
|
+
return loadYamlConfig(yamlPath);
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/targets/loader.ts"],"names":[],"mappings":"AAAA,0IAA0I;AAC1I;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,QA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,CAAC;aACjD,IAAI,CAAC,IAAI,CAAC,CAAA;QACb,wGAAwG;QACxG,MAAM,IAAI,eAAe,CAAC,GAAG,aAAa,wBAAwB,MAAM,EAAE,EAAE;YAC1E,IAAI,EAAE,kCAAkC;SACzC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,eAAe,CACpB,MAAM,CAAC,IAAI,CAAC,OAAO,EACnB,MAAM,CAAC,IAAI,CAAC,cAAc,EAC1B,MAAM,CAAC,IAAI,CAAC,cAAc,EAC1B,aAAa,EACb,MAAM,CAAC,IAAI,CAAC,OAAO,CACpB,CAAA;AACH,CAAC;AAED,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAe,EACf,YAAqB;IAErB,MAAM,QAAQ,GAAG,wBAAwB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAChE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target file resolver
|
|
3
|
+
*
|
|
4
|
+
* Expands target glob patterns to concrete file paths,
|
|
5
|
+
* deduplicating across multiple targets.
|
|
6
|
+
*/
|
|
7
|
+
import type { Target } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Resolve multiple targets to a deduplicated list of file paths.
|
|
10
|
+
*
|
|
11
|
+
* Expands include globs, filters out exclude globs, and deduplicates
|
|
12
|
+
* across all targets so no file is processed twice.
|
|
13
|
+
*
|
|
14
|
+
* @param targets - Targets to resolve
|
|
15
|
+
* @param rootDir - Project root for glob resolution
|
|
16
|
+
* @returns Sorted, deduplicated array of absolute file paths
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveTargetFiles(targets: readonly Target[], rootDir: string): string[];
|
|
19
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/targets/resolver.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBxF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @fitness-ignore-file batch-operation-limits -- iterates bounded collections (config entries, registry items, or small analysis results)
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Target file resolver
|
|
4
|
+
*
|
|
5
|
+
* Expands target glob patterns to concrete file paths,
|
|
6
|
+
* deduplicating across multiple targets.
|
|
7
|
+
*/
|
|
8
|
+
import { resolve } from 'node:path';
|
|
9
|
+
import { globSync } from 'glob';
|
|
10
|
+
/**
|
|
11
|
+
* Resolve multiple targets to a deduplicated list of file paths.
|
|
12
|
+
*
|
|
13
|
+
* Expands include globs, filters out exclude globs, and deduplicates
|
|
14
|
+
* across all targets so no file is processed twice.
|
|
15
|
+
*
|
|
16
|
+
* @param targets - Targets to resolve
|
|
17
|
+
* @param rootDir - Project root for glob resolution
|
|
18
|
+
* @returns Sorted, deduplicated array of absolute file paths
|
|
19
|
+
*/
|
|
20
|
+
export function resolveTargetFiles(targets, rootDir) {
|
|
21
|
+
const files = new Set();
|
|
22
|
+
for (const target of targets) {
|
|
23
|
+
const { include, exclude } = target.config;
|
|
24
|
+
for (const pattern of include) {
|
|
25
|
+
const matches = globSync(pattern, {
|
|
26
|
+
cwd: rootDir,
|
|
27
|
+
ignore: [...exclude],
|
|
28
|
+
absolute: true,
|
|
29
|
+
});
|
|
30
|
+
for (const match of matches) {
|
|
31
|
+
files.add(resolve(match));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return [...files].sort();
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/targets/resolver.ts"],"names":[],"mappings":"AAAA,0IAA0I;AAC1I;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAI/B;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA0B,EAAE,OAAe;IAC5E,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAE/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,CAAA;QAE1C,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE;gBAChC,GAAG,EAAE,OAAO;gBACZ,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC;gBACpB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAA;YACF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target Registry
|
|
3
|
+
*
|
|
4
|
+
* Registry for target definitions. Provides lookup by name and tags.
|
|
5
|
+
* Standalone implementation without platform GenericRegistry dependency.
|
|
6
|
+
*
|
|
7
|
+
* The entire targets module uses a synchronous API because target definitions
|
|
8
|
+
* are loaded once at startup from a small YAML config file (via loader.ts) and
|
|
9
|
+
* then held in-memory for fast, repeated lookups throughout the process lifetime.
|
|
10
|
+
* The resolver (resolver.ts) similarly uses synchronous glob expansion. Since the
|
|
11
|
+
* data set is small and bounded by project configuration, async I/O offers no
|
|
12
|
+
* practical benefit and would complicate every call site that queries targets.
|
|
13
|
+
*/
|
|
14
|
+
import type { Target } from './types.js';
|
|
15
|
+
/** Registry for target definitions with lookup by name and tags. */
|
|
16
|
+
export declare class TargetRegistry {
|
|
17
|
+
private readonly targets;
|
|
18
|
+
/**
|
|
19
|
+
* Register a target. Silently skips if a target with the same name already exists.
|
|
20
|
+
* @param target - Target definition to register
|
|
21
|
+
* @returns This registry instance for chaining
|
|
22
|
+
*/
|
|
23
|
+
register(target: Target): this;
|
|
24
|
+
/**
|
|
25
|
+
* Look up a target by its config name.
|
|
26
|
+
* @param name - Target name to find
|
|
27
|
+
* @returns The matching target, or undefined if not found
|
|
28
|
+
*/
|
|
29
|
+
getByName(name: string): Target | undefined;
|
|
30
|
+
/** Return all registered targets. */
|
|
31
|
+
getAll(): readonly Target[];
|
|
32
|
+
/**
|
|
33
|
+
* Return all targets that include the given tag.
|
|
34
|
+
* @param tag - Tag string to filter by
|
|
35
|
+
* @returns Targets whose config.tags contain the tag
|
|
36
|
+
*/
|
|
37
|
+
getByTag(tag: string): readonly Target[];
|
|
38
|
+
/**
|
|
39
|
+
* Check whether a target with the given name is registered.
|
|
40
|
+
* @param name - Target name to check
|
|
41
|
+
* @returns True if the target exists in the registry
|
|
42
|
+
*/
|
|
43
|
+
has(name: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Find targets whose languages and concerns intersect with the given scope.
|
|
46
|
+
*
|
|
47
|
+
* Both dimensions must match (AND logic):
|
|
48
|
+
* - A target matches languages if the intersection is non-empty (or either side is empty/undefined)
|
|
49
|
+
* - A target matches concerns if the intersection is non-empty (or either side is empty/undefined)
|
|
50
|
+
*
|
|
51
|
+
* @param languages - Languages the check is designed for
|
|
52
|
+
* @param concerns - Semantic concerns the check targets
|
|
53
|
+
* @returns Targets that match both dimensions
|
|
54
|
+
*/
|
|
55
|
+
findByScope(languages: readonly string[], concerns: readonly string[]): readonly Target[];
|
|
56
|
+
/** Number of registered targets. */
|
|
57
|
+
get size(): number;
|
|
58
|
+
/** Remove all targets from the registry. */
|
|
59
|
+
clear(): void;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=target-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-registry.d.ts","sourceRoot":"","sources":["../../src/targets/target-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,oEAAoE;AACpE,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAW9B;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI3C,qCAAqC;IACrC,MAAM,IAAI,SAAS,MAAM,EAAE;IAI3B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAIxC;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAqBzF,oCAAoC;IACpC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,4CAA4C;IAC5C,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target Registry
|
|
3
|
+
*
|
|
4
|
+
* Registry for target definitions. Provides lookup by name and tags.
|
|
5
|
+
* Standalone implementation without platform GenericRegistry dependency.
|
|
6
|
+
*
|
|
7
|
+
* The entire targets module uses a synchronous API because target definitions
|
|
8
|
+
* are loaded once at startup from a small YAML config file (via loader.ts) and
|
|
9
|
+
* then held in-memory for fast, repeated lookups throughout the process lifetime.
|
|
10
|
+
* The resolver (resolver.ts) similarly uses synchronous glob expansion. Since the
|
|
11
|
+
* data set is small and bounded by project configuration, async I/O offers no
|
|
12
|
+
* practical benefit and would complicate every call site that queries targets.
|
|
13
|
+
*/
|
|
14
|
+
/** Registry for target definitions with lookup by name and tags. */
|
|
15
|
+
export class TargetRegistry {
|
|
16
|
+
targets = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* Register a target. Silently skips if a target with the same name already exists.
|
|
19
|
+
* @param target - Target definition to register
|
|
20
|
+
* @returns This registry instance for chaining
|
|
21
|
+
*/
|
|
22
|
+
register(target) {
|
|
23
|
+
const name = target.config.name;
|
|
24
|
+
if (this.targets.has(name)) {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
this.targets.set(name, target);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Look up a target by its config name.
|
|
32
|
+
* @param name - Target name to find
|
|
33
|
+
* @returns The matching target, or undefined if not found
|
|
34
|
+
*/
|
|
35
|
+
getByName(name) {
|
|
36
|
+
return this.targets.get(name);
|
|
37
|
+
}
|
|
38
|
+
/** Return all registered targets. */
|
|
39
|
+
getAll() {
|
|
40
|
+
return [...this.targets.values()];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Return all targets that include the given tag.
|
|
44
|
+
* @param tag - Tag string to filter by
|
|
45
|
+
* @returns Targets whose config.tags contain the tag
|
|
46
|
+
*/
|
|
47
|
+
getByTag(tag) {
|
|
48
|
+
return this.getAll().filter((t) => t.config.tags?.includes(tag));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check whether a target with the given name is registered.
|
|
52
|
+
* @param name - Target name to check
|
|
53
|
+
* @returns True if the target exists in the registry
|
|
54
|
+
*/
|
|
55
|
+
has(name) {
|
|
56
|
+
return this.targets.has(name);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Find targets whose languages and concerns intersect with the given scope.
|
|
60
|
+
*
|
|
61
|
+
* Both dimensions must match (AND logic):
|
|
62
|
+
* - A target matches languages if the intersection is non-empty (or either side is empty/undefined)
|
|
63
|
+
* - A target matches concerns if the intersection is non-empty (or either side is empty/undefined)
|
|
64
|
+
*
|
|
65
|
+
* @param languages - Languages the check is designed for
|
|
66
|
+
* @param concerns - Semantic concerns the check targets
|
|
67
|
+
* @returns Targets that match both dimensions
|
|
68
|
+
*/
|
|
69
|
+
findByScope(languages, concerns) {
|
|
70
|
+
return this.getAll().filter((target) => {
|
|
71
|
+
const targetLangs = target.config.languages;
|
|
72
|
+
const targetConcerns = target.config.concerns;
|
|
73
|
+
// Language matching: if either side has no languages, treat as "matches any"
|
|
74
|
+
const languageMatch = languages.length === 0 ||
|
|
75
|
+
!targetLangs || targetLangs.length === 0 ||
|
|
76
|
+
languages.some((lang) => targetLangs.includes(lang));
|
|
77
|
+
// Concern matching: if either side has no concerns, treat as "matches any"
|
|
78
|
+
const concernMatch = concerns.length === 0 ||
|
|
79
|
+
!targetConcerns || targetConcerns.length === 0 ||
|
|
80
|
+
concerns.some((concern) => targetConcerns.includes(concern));
|
|
81
|
+
return languageMatch && concernMatch;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** Number of registered targets. */
|
|
85
|
+
get size() {
|
|
86
|
+
return this.targets.size;
|
|
87
|
+
}
|
|
88
|
+
/** Remove all targets from the registry. */
|
|
89
|
+
clear() {
|
|
90
|
+
this.targets.clear();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=target-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-registry.js","sourceRoot":"","sources":["../../src/targets/target-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,oEAAoE;AACpE,MAAM,OAAO,cAA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AAK,CAAC;gBACtB,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;gBACxC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;YAEtD,2EAA2E;YAC3E,MAAM,YAAY,GAChB,QAAQ,CAAC,MAAM,KAAK,CAAC;gBACrB,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;gBAC9C,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;YAE9D,OAAO,aAAa,IAAI,YAAY,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,oCAAoC;IACpC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,4CAA4C;IAC5C,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Target type definitions for shared targeting
|
|
3
|
+
*/
|
|
4
|
+
/** Configuration for a named target (file set with include/exclude globs). */
|
|
5
|
+
export interface TargetConfig {
|
|
6
|
+
/** Kebab-case identifier, e.g. 'backend', 'module-foundation' */
|
|
7
|
+
readonly name: string;
|
|
8
|
+
/** Human-readable description */
|
|
9
|
+
readonly description: string;
|
|
10
|
+
/** Glob patterns to include */
|
|
11
|
+
readonly include: readonly string[];
|
|
12
|
+
/** Glob patterns to exclude */
|
|
13
|
+
readonly exclude: readonly string[];
|
|
14
|
+
/** Context doc paths for assessments */
|
|
15
|
+
readonly context?: readonly string[];
|
|
16
|
+
/** Tags for filtering/grouping */
|
|
17
|
+
readonly tags?: readonly string[];
|
|
18
|
+
/** Languages this target contains (e.g. 'typescript', 'tsx', 'json') */
|
|
19
|
+
readonly languages?: readonly string[];
|
|
20
|
+
/** Semantic concerns this target represents (e.g. 'backend', 'server', 'api') */
|
|
21
|
+
readonly concerns?: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
/** A resolved target wrapping its configuration. */
|
|
24
|
+
export interface Target {
|
|
25
|
+
readonly config: TargetConfig;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Per-check target overrides.
|
|
29
|
+
* Maps check slug → target name(s) to restrict which files a check runs against.
|
|
30
|
+
*/
|
|
31
|
+
type CheckTargetMap = Readonly<Record<string, string | readonly string[]>>;
|
|
32
|
+
/**
|
|
33
|
+
* Project-local plugin declarations — one list per plugin domain.
|
|
34
|
+
*
|
|
35
|
+
* When present in the config file, these override the default user-level
|
|
36
|
+
* plugin directory (`~/.opensip-tools/<domain>/`). Plugins get installed
|
|
37
|
+
* into `<project-root>/.opensip-tools/<domain>/` and are version-pinned
|
|
38
|
+
* by the project rather than by each developer's machine.
|
|
39
|
+
*
|
|
40
|
+
* Each entry is any npm install spec: `@scope/pkg`, `@scope/pkg@^1.2.3`,
|
|
41
|
+
* `./local-path`, `/abs/path/to/pkg.tgz`, `git+https://...`, etc.
|
|
42
|
+
*/
|
|
43
|
+
interface PluginsConfig {
|
|
44
|
+
readonly fit?: readonly string[];
|
|
45
|
+
readonly sim?: readonly string[];
|
|
46
|
+
readonly asm?: readonly string[];
|
|
47
|
+
readonly lang?: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* Explicit list of npm package names to load as check providers
|
|
50
|
+
* (e.g. ['@opensip-tools/checks-python', '@my-org/checks-internal']).
|
|
51
|
+
*
|
|
52
|
+
* When present, ONLY these packages are loaded. Auto-discovery is
|
|
53
|
+
* disabled for the run. No package is privileged: if you want the
|
|
54
|
+
* default check pack you must list `@opensip-tools/checks-builtin`
|
|
55
|
+
* (or its successors) here explicitly. An empty list disables all
|
|
56
|
+
* check loading and triggers a no-checks-loaded warning.
|
|
57
|
+
*/
|
|
58
|
+
readonly checkPackages?: readonly string[];
|
|
59
|
+
/**
|
|
60
|
+
* When false, the CLI does NOT scan node_modules for
|
|
61
|
+
* @opensip-tools/checks-* packages. Default: true.
|
|
62
|
+
* Ignored when `checkPackages` is set (explicit list always wins).
|
|
63
|
+
*/
|
|
64
|
+
readonly autoDiscoverChecks?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Result of loading targets config, including both the target registry
|
|
68
|
+
* and per-check target overrides.
|
|
69
|
+
*/
|
|
70
|
+
export interface TargetsConfig {
|
|
71
|
+
/** Global file exclusion patterns (replaces .fitnessignore). */
|
|
72
|
+
readonly globalExcludes: readonly string[];
|
|
73
|
+
/** Per-check target overrides for third-party/marketplace checks. */
|
|
74
|
+
readonly checkOverrides: CheckTargetMap;
|
|
75
|
+
/**
|
|
76
|
+
* Project-local plugin declarations, keyed by domain. When any domain
|
|
77
|
+
* has entries here, plugin discovery for that domain reads from
|
|
78
|
+
* `<project>/.opensip-tools/<domain>/` instead of `~/.opensip-tools/<domain>/`.
|
|
79
|
+
* Absent (or undefined per-domain) = fall back to the user-level dir
|
|
80
|
+
* for that domain.
|
|
81
|
+
*/
|
|
82
|
+
readonly plugins?: PluginsConfig;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=types.d.ts.map
|