@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,252 @@
|
|
|
1
|
+
// @fitness-ignore-file module-coupling-metrics -- central orchestration module with necessary coupling
|
|
2
|
+
// @fitness-ignore-file null-safety -- ResultBuilder.create() returns a fluent builder; .totalItems().filesScanned() chain is always safe
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview defineCheck - Unified check definition API
|
|
5
|
+
*
|
|
6
|
+
* The main API for creating fitness checks. Supports three modes:
|
|
7
|
+
* - analyze: Per-file analysis with content and path
|
|
8
|
+
* - analyzeAll: Multi-file analysis with lazy loading FileAccessor
|
|
9
|
+
* - command: External tool execution with output parsing
|
|
10
|
+
*
|
|
11
|
+
* Check authors return CheckViolation[]. The framework converts each
|
|
12
|
+
* CheckViolation into a universal Signal via createSignal().
|
|
13
|
+
*/
|
|
14
|
+
import { logger, SystemError, createSignal, applyContentFilter } from '@opensip-tools/core';
|
|
15
|
+
import { getAnalysisMode, isAnalyzeConfig, isAnalyzeAllConfig, isCommandConfig, validateCheckConfig, } from './check-config.js';
|
|
16
|
+
import { executeCommand } from './command-executor.js';
|
|
17
|
+
import { CheckAbortedError, createExecutionContext } from './execution-context.js';
|
|
18
|
+
import { createFileAccessor } from './file-accessor.js';
|
|
19
|
+
import { filterFilesByType } from './file-type-filter.js';
|
|
20
|
+
import { filterSignalsByDirectives, buildFilteredResult } from './ignore-processing.js';
|
|
21
|
+
import { PathMatcher } from './path-matcher.js';
|
|
22
|
+
import { ResultBuilder } from './result-builder.js';
|
|
23
|
+
import { mapFindingSeverity, mapTagsToSignalCategory } from './severity-mapping.js';
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// VIOLATION → SIGNAL CONVERSION
|
|
26
|
+
// =============================================================================
|
|
27
|
+
function toSignal(violation, checkSlug, checkTags, defaultFilePath, provider = 'opensip') {
|
|
28
|
+
const filePath = violation.filePath ?? defaultFilePath ?? '';
|
|
29
|
+
return createSignal({
|
|
30
|
+
source: 'fitness',
|
|
31
|
+
provider,
|
|
32
|
+
severity: mapFindingSeverity(violation.severity),
|
|
33
|
+
category: mapTagsToSignalCategory(checkTags),
|
|
34
|
+
ruleId: `fit:${checkSlug}`,
|
|
35
|
+
message: violation.message,
|
|
36
|
+
suggestion: violation.suggestion,
|
|
37
|
+
code: { file: filePath, line: violation.line, column: violation.column },
|
|
38
|
+
fix: violation.fix
|
|
39
|
+
?? (violation.suggestion ? { action: 'refactor', confidence: 0.5 } : undefined),
|
|
40
|
+
metadata: Object.fromEntries(Object.entries({
|
|
41
|
+
match: violation.match,
|
|
42
|
+
type: violation.type,
|
|
43
|
+
checkSlug,
|
|
44
|
+
checkTags: checkTags.length > 0 ? checkTags.join(',') : undefined,
|
|
45
|
+
}).filter(([, v]) => v != null && v !== '')),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// =============================================================================
|
|
49
|
+
// ANALYSIS MODE EXECUTORS
|
|
50
|
+
// =============================================================================
|
|
51
|
+
/** @throws {CheckAbortedError} When the check is aborted via AbortSignal */
|
|
52
|
+
async function executeAnalyzeMode(config, files, ctx) {
|
|
53
|
+
const builder = ResultBuilder.create({
|
|
54
|
+
checkId: config.id,
|
|
55
|
+
itemType: config.itemType ?? 'files',
|
|
56
|
+
})
|
|
57
|
+
.totalItems(files.length)
|
|
58
|
+
.filesScanned(files.length);
|
|
59
|
+
for (const filePath of files) {
|
|
60
|
+
if (ctx.signal?.aborted) {
|
|
61
|
+
throw new CheckAbortedError(config.slug);
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const rawContent = await ctx.readFile(filePath);
|
|
65
|
+
// Dispatch the content filter through the LanguageAdapter for the
|
|
66
|
+
// file's extension. Falls back to raw content when no adapter is
|
|
67
|
+
// registered. See languages/content-filter-dispatch.ts.
|
|
68
|
+
const content = applyContentFilter(filePath, rawContent, config.contentFilter ?? 'none');
|
|
69
|
+
const violations = config.analyze(content, filePath);
|
|
70
|
+
for (const violation of violations) {
|
|
71
|
+
void builder.addSignal(toSignal(violation, config.slug, config.tags ?? [], filePath, config.provider));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error instanceof CheckAbortedError)
|
|
76
|
+
throw error;
|
|
77
|
+
logger.debug('Skipping unreadable file', { evt: 'fitness.check.file.skip', module: 'fitness:framework', filePath, checkSlug: config.slug });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return builder.build();
|
|
81
|
+
}
|
|
82
|
+
/** @throws {CheckAbortedError} When the check is aborted via AbortSignal */
|
|
83
|
+
async function executeAnalyzeAllMode(config, files, ctx) {
|
|
84
|
+
if (ctx.signal?.aborted) {
|
|
85
|
+
throw new CheckAbortedError(config.slug);
|
|
86
|
+
}
|
|
87
|
+
const fileAccessor = createFileAccessor(files, { signal: ctx.signal, contentFilter: config.contentFilter });
|
|
88
|
+
const violations = await config.analyzeAll(fileAccessor);
|
|
89
|
+
if (ctx.signal?.aborted) {
|
|
90
|
+
throw new CheckAbortedError(config.slug);
|
|
91
|
+
}
|
|
92
|
+
const builder = ResultBuilder.create({
|
|
93
|
+
checkId: config.id,
|
|
94
|
+
itemType: config.itemType ?? 'files',
|
|
95
|
+
})
|
|
96
|
+
.totalItems(files.length)
|
|
97
|
+
.filesScanned(files.length);
|
|
98
|
+
for (const violation of violations) {
|
|
99
|
+
if (!violation.filePath) {
|
|
100
|
+
ctx.log(`Warning: violation missing filePath in analyzeAll mode`);
|
|
101
|
+
}
|
|
102
|
+
void builder.addSignal(toSignal(violation, config.slug, config.tags ?? [], undefined, config.provider));
|
|
103
|
+
}
|
|
104
|
+
return builder.build();
|
|
105
|
+
}
|
|
106
|
+
/** @throws {CheckAbortedError} When the check is aborted via AbortSignal */
|
|
107
|
+
async function executeCommandMode(config, files, ctx) {
|
|
108
|
+
const result = await executeCommand(config.command, files, {
|
|
109
|
+
cwd: ctx.cwd,
|
|
110
|
+
signal: ctx.signal,
|
|
111
|
+
timeout: config.timeout,
|
|
112
|
+
});
|
|
113
|
+
if (result.aborted) {
|
|
114
|
+
throw new CheckAbortedError(config.slug);
|
|
115
|
+
}
|
|
116
|
+
const builder = ResultBuilder.create({
|
|
117
|
+
checkId: config.id,
|
|
118
|
+
itemType: config.itemType ?? 'files',
|
|
119
|
+
})
|
|
120
|
+
.totalItems(files.length)
|
|
121
|
+
.filesScanned(0);
|
|
122
|
+
if (result.error) {
|
|
123
|
+
return builder.buildError(result.error);
|
|
124
|
+
}
|
|
125
|
+
for (const violation of result.violations) {
|
|
126
|
+
void builder.addSignal(toSignal(violation, config.slug, config.tags ?? [], undefined, config.provider));
|
|
127
|
+
}
|
|
128
|
+
return builder.build();
|
|
129
|
+
}
|
|
130
|
+
// =============================================================================
|
|
131
|
+
// MAIN EXPORT
|
|
132
|
+
// =============================================================================
|
|
133
|
+
/**
|
|
134
|
+
* Define a fitness check using the unified API.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* export const noConsoleLog = defineCheck({
|
|
139
|
+
* id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
|
|
140
|
+
* slug: 'no-console-log',
|
|
141
|
+
* category: 'quality',
|
|
142
|
+
* description: 'Disallow console.log in production code',
|
|
143
|
+
* analyze: (content, filePath) => {
|
|
144
|
+
* const violations: CheckViolation[] = [];
|
|
145
|
+
* content.split('\n').forEach((line, idx) => {
|
|
146
|
+
* if (line.includes('console.log')) {
|
|
147
|
+
* violations.push({ line: idx + 1, message: 'No console.log', severity: 'error' });
|
|
148
|
+
* }
|
|
149
|
+
* });
|
|
150
|
+
* return violations;
|
|
151
|
+
* },
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
154
|
+
* @throws {ValidationError} When the check config is invalid
|
|
155
|
+
*/
|
|
156
|
+
export function defineCheck(config) {
|
|
157
|
+
validateCheckConfig(config);
|
|
158
|
+
const check = {
|
|
159
|
+
config: {
|
|
160
|
+
id: config.id,
|
|
161
|
+
slug: config.slug,
|
|
162
|
+
tags: config.tags ? [...config.tags] : [],
|
|
163
|
+
description: config.description,
|
|
164
|
+
longDescription: config.longDescription,
|
|
165
|
+
analysisMode: getAnalysisMode(config),
|
|
166
|
+
scope: { include: [], exclude: [], description: '' },
|
|
167
|
+
itemType: config.itemType ?? 'files',
|
|
168
|
+
docs: config.docs,
|
|
169
|
+
disabled: config.disabled,
|
|
170
|
+
confidence: config.confidence,
|
|
171
|
+
timeout: config.timeout,
|
|
172
|
+
scansFiles: !isCommandConfig(config),
|
|
173
|
+
fileTypes: config.fileTypes ? [...config.fileTypes] : undefined,
|
|
174
|
+
checkScope: config.scope ? { languages: [...config.scope.languages], concerns: [...config.scope.concerns] } : undefined,
|
|
175
|
+
// @fitness-ignore-next-line concurrency-safety -- async arrow delegates to executeUnifiedCheck which is async; needed for type compatibility
|
|
176
|
+
execute: async (ctx) => executeUnifiedCheck(config, ctx),
|
|
177
|
+
},
|
|
178
|
+
getScope() {
|
|
179
|
+
return { include: [], exclude: [], description: 'target-based scope' };
|
|
180
|
+
},
|
|
181
|
+
getMatcher(cwd) {
|
|
182
|
+
return PathMatcher.create({
|
|
183
|
+
include: [],
|
|
184
|
+
exclude: [],
|
|
185
|
+
cwd,
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
async run(cwd, options) {
|
|
189
|
+
const start = Date.now();
|
|
190
|
+
const matcher = PathMatcher.create({
|
|
191
|
+
include: [],
|
|
192
|
+
exclude: [],
|
|
193
|
+
cwd,
|
|
194
|
+
});
|
|
195
|
+
const legacyConfig = {
|
|
196
|
+
id: config.id,
|
|
197
|
+
slug: config.slug,
|
|
198
|
+
tags: config.tags ? [...config.tags] : [],
|
|
199
|
+
description: config.description,
|
|
200
|
+
scope: { include: [], exclude: [], description: '' },
|
|
201
|
+
itemType: (config.itemType ?? 'files'),
|
|
202
|
+
docs: config.docs,
|
|
203
|
+
disabled: config.disabled,
|
|
204
|
+
timeout: config.timeout,
|
|
205
|
+
scansFiles: !isCommandConfig(config),
|
|
206
|
+
// @fitness-ignore-next-line concurrency-safety -- async arrow delegates to executeUnifiedCheck which is async; needed for type compatibility
|
|
207
|
+
execute: async (ctx) => executeUnifiedCheck(config, ctx),
|
|
208
|
+
};
|
|
209
|
+
const ctx = createExecutionContext(legacyConfig, cwd, matcher, options);
|
|
210
|
+
try {
|
|
211
|
+
const result = await executeUnifiedCheck(config, ctx);
|
|
212
|
+
const { filteredSignals, ignoredCount, appliedDirectives } = await filterSignalsByDirectives(result.signals, config.slug, result.ignoredCount ?? 0);
|
|
213
|
+
const filtered = buildFilteredResult(result, filteredSignals, ignoredCount, start);
|
|
214
|
+
return appliedDirectives.length > 0 ? { ...filtered, appliedDirectives } : filtered;
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
if (error instanceof CheckAbortedError)
|
|
218
|
+
throw error;
|
|
219
|
+
const builder = ResultBuilder.create({
|
|
220
|
+
checkId: config.id,
|
|
221
|
+
itemType: config.itemType ?? 'files',
|
|
222
|
+
});
|
|
223
|
+
return builder.buildError(`Check ${config.slug} threw an error: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
return check;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Internal: Execute a check based on its analysis mode (analyze /
|
|
231
|
+
* analyzeAll / command).
|
|
232
|
+
* @throws {CheckAbortedError} When the check is aborted via AbortSignal
|
|
233
|
+
* @throws {SystemError} When an unknown analysis mode is encountered
|
|
234
|
+
*/
|
|
235
|
+
async function executeUnifiedCheck(config, ctx) {
|
|
236
|
+
const matchedFiles = await ctx.matchFiles();
|
|
237
|
+
// Filter by check's declared file types
|
|
238
|
+
const files = filterFilesByType(matchedFiles, config.fileTypes);
|
|
239
|
+
ctx.log(`Matched ${files.length} files`);
|
|
240
|
+
if (isAnalyzeConfig(config)) {
|
|
241
|
+
return executeAnalyzeMode(config, files, ctx);
|
|
242
|
+
}
|
|
243
|
+
else if (isAnalyzeAllConfig(config)) {
|
|
244
|
+
return executeAnalyzeAllMode(config, files, ctx);
|
|
245
|
+
}
|
|
246
|
+
else if (isCommandConfig(config)) {
|
|
247
|
+
return executeCommandMode(config, files, ctx);
|
|
248
|
+
}
|
|
249
|
+
const _exhaustiveCheck = config;
|
|
250
|
+
throw new SystemError(`Unknown analysis mode: ${JSON.stringify(_exhaustiveCheck)}`, { code: 'SYSTEM.FITNESS.UNKNOWN_MODE' });
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=define-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-check.js","sourceRoot":"","sources":["../../src/framework/define-check.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,yIAAyI;AACzI;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAG,WAAW,EAAG,YAAY,EAAG,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAI9F,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,mBAAmB,GACpB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AAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAC,CAAA;AAC9H,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Directive Inventory - shared parsing logic for
|
|
3
|
+
* fitness-ignore directives.
|
|
4
|
+
*/
|
|
5
|
+
/** A single fitness-ignore directive found in a source file. */
|
|
6
|
+
export interface DirectiveEntry {
|
|
7
|
+
filePath: string;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
type: 'file' | 'next-line';
|
|
10
|
+
checkId: string;
|
|
11
|
+
group: string;
|
|
12
|
+
reason: string | null;
|
|
13
|
+
weakReason: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse a file-level or next-line directive from a comment line.
|
|
17
|
+
* Accepts both `//` and `/*`-style comments for consistency with the
|
|
18
|
+
* suppression parser in directive-parsing.ts — otherwise block-comment
|
|
19
|
+
* directives suppress findings but vanish from inventory counts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseDirectiveLine(line: string): {
|
|
22
|
+
type: 'file' | 'next-line';
|
|
23
|
+
checkId: string;
|
|
24
|
+
reason: string | null;
|
|
25
|
+
} | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a reason is weak/generic. Missing reason (null) is considered weak.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isWeakReason(reason: string | null): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Extract the group prefix from a check ID (the directory name).
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractGroup(checkId: string): string;
|
|
34
|
+
//# sourceMappingURL=directive-inventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive-inventory.d.ts","sourceRoot":"","sources":["../../src/framework/directive-inventory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;CACpB;AAwBD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAChD,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB,GAAG,IAAI,CAiBP;AAyBD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAG3D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGpD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Directive Inventory - shared parsing logic for
|
|
3
|
+
* fitness-ignore directives.
|
|
4
|
+
*/
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Shared Constants
|
|
7
|
+
// =============================================================================
|
|
8
|
+
/** Patterns that indicate a weak or generic ignore reason. */
|
|
9
|
+
const WEAK_REASON_PATTERNS = Object.freeze([
|
|
10
|
+
/^ignore$/i,
|
|
11
|
+
/^skip$/i,
|
|
12
|
+
/^todo$/i,
|
|
13
|
+
/^fixme$/i,
|
|
14
|
+
/^temporary$/i,
|
|
15
|
+
/^temp$/i,
|
|
16
|
+
/^wip$/i,
|
|
17
|
+
/^disable$/i,
|
|
18
|
+
/^suppress$/i,
|
|
19
|
+
/^\s*$/,
|
|
20
|
+
]);
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// Shared Parsing
|
|
23
|
+
// =============================================================================
|
|
24
|
+
/**
|
|
25
|
+
* Parse a file-level or next-line directive from a comment line.
|
|
26
|
+
* Accepts both `//` and `/*`-style comments for consistency with the
|
|
27
|
+
* suppression parser in directive-parsing.ts — otherwise block-comment
|
|
28
|
+
* directives suppress findings but vanish from inventory counts.
|
|
29
|
+
*/
|
|
30
|
+
export function parseDirectiveLine(line) {
|
|
31
|
+
const trimmed = line.trimStart();
|
|
32
|
+
if (!trimmed.startsWith('// ') && !trimmed.startsWith('/* '))
|
|
33
|
+
return null;
|
|
34
|
+
const afterComment = trimmed.slice(3).trimStart();
|
|
35
|
+
if (afterComment.startsWith('@fitness-ignore-file ')) {
|
|
36
|
+
const rest = afterComment.slice('@fitness-ignore-file '.length);
|
|
37
|
+
return parseDirectiveRest(rest, 'file');
|
|
38
|
+
}
|
|
39
|
+
if (afterComment.startsWith('@fitness-ignore-next-line ')) {
|
|
40
|
+
const rest = afterComment.slice('@fitness-ignore-next-line '.length);
|
|
41
|
+
return parseDirectiveRest(rest, 'next-line');
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function parseDirectiveRest(rest, type) {
|
|
46
|
+
// Strip trailing `*/` from block-comment directives (e.g. `foo */` → `foo`).
|
|
47
|
+
// eslint-disable-next-line sonarjs/slow-regex -- anchored at end-of-string, bounded \s* runs; no ReDoS exposure
|
|
48
|
+
const normalized = rest.replace(/\s*\*\/\s*$/, '').trimEnd();
|
|
49
|
+
const separatorIndex = normalized.indexOf(' -- ');
|
|
50
|
+
if (separatorIndex === -1) {
|
|
51
|
+
const checkId = normalized.trim();
|
|
52
|
+
if (!checkId || checkId.includes(' '))
|
|
53
|
+
return null;
|
|
54
|
+
return { type, checkId, reason: null };
|
|
55
|
+
}
|
|
56
|
+
const checkId = normalized.slice(0, separatorIndex).trim();
|
|
57
|
+
const reason = normalized.slice(separatorIndex + 4).trim();
|
|
58
|
+
if (!checkId || checkId.includes(' '))
|
|
59
|
+
return null;
|
|
60
|
+
return { type, checkId, reason: reason || null };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if a reason is weak/generic. Missing reason (null) is considered weak.
|
|
64
|
+
*/
|
|
65
|
+
export function isWeakReason(reason) {
|
|
66
|
+
if (reason === null)
|
|
67
|
+
return true;
|
|
68
|
+
return WEAK_REASON_PATTERNS.some((pattern) => pattern.test(reason.trim()));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Extract the group prefix from a check ID (the directory name).
|
|
72
|
+
*/
|
|
73
|
+
export function extractGroup(checkId) {
|
|
74
|
+
const slashIndex = checkId.indexOf('/');
|
|
75
|
+
return slashIndex > 0 ? checkId.slice(0, slashIndex) : 'other';
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=directive-inventory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive-inventory.js","sourceRoot":"","sources":["../../src/framework/directive-inventory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,8DAA8D;AAC9D,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAoB;IAC5D,WAAW;IACX,SAAS;IACT,SAAS;IACT,UAAU;IACV,cAAc;IACd,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,OAAO;CACR,CAAC,CAAA;AAEF,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAK7C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;IAChC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAEzE,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;IAEjD,IAAI,YAAY,CAAC,UAAU,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,YAAY,CAAC,KAA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I,EAAE,CAAA;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB;IAChD,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAChC,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAC5E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACvC,OAAO,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AAChE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ignore directive parsing utilities for fitness checks
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for parsing suppression directives:
|
|
5
|
+
* - @fitness-ignore-file, @fitness-ignore-next-line
|
|
6
|
+
* - eslint-disable-next-line, eslint-disable-line
|
|
7
|
+
* - @ts-expect-error, @ts-ignore
|
|
8
|
+
* - nosemgrep
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Parse file-level ignore directive from file content.
|
|
12
|
+
* Returns true if the file should be entirely ignored for that check.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseFileIgnoreDirective(content: string, checkId: string | readonly string[]): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Parse next-line ignore directives from file content.
|
|
17
|
+
* Returns a set of line numbers that should be ignored.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseIgnoreDirectives(content: string, checkId: string | readonly string[]): Set<number>;
|
|
20
|
+
//# sourceMappingURL=directive-parsing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive-parsing.d.ts","sourceRoot":"","sources":["../../src/framework/directive-parsing.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAsFH;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAClC,OAAO,CAYT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAClC,GAAG,CAAC,MAAM,CAAC,CAyBb"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// @fitness-ignore-file semgrep-justifications -- References nosemgrep patterns for directive parsing
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Ignore directive parsing utilities for fitness checks
|
|
4
|
+
*
|
|
5
|
+
* Provides utilities for parsing suppression directives:
|
|
6
|
+
* - @fitness-ignore-file, @fitness-ignore-next-line
|
|
7
|
+
* - eslint-disable-next-line, eslint-disable-line
|
|
8
|
+
* - @ts-expect-error, @ts-ignore
|
|
9
|
+
* - nosemgrep
|
|
10
|
+
*/
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// CONSTANTS
|
|
13
|
+
// =============================================================================
|
|
14
|
+
const KNOWN_DIRECTIVE_KEYWORDS = [
|
|
15
|
+
'eslint-disable-next-line',
|
|
16
|
+
'eslint-disable-line',
|
|
17
|
+
'@ts-expect-error',
|
|
18
|
+
'@ts-ignore',
|
|
19
|
+
'@ts-nocheck',
|
|
20
|
+
'prettier-ignore',
|
|
21
|
+
'biome-ignore',
|
|
22
|
+
'@fitness-ignore-next-line',
|
|
23
|
+
'@fitness-ignore-file',
|
|
24
|
+
];
|
|
25
|
+
const MAX_DIRECTIVE_SKIP = 3;
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// INTERNAL HELPERS
|
|
28
|
+
// =============================================================================
|
|
29
|
+
function isKnownDirectiveLine(line) {
|
|
30
|
+
const trimmed = line.trimStart();
|
|
31
|
+
if (!trimmed.startsWith('//') && !trimmed.startsWith('/*')) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const commentContent = trimmed.slice(2).trimStart();
|
|
35
|
+
return KNOWN_DIRECTIVE_KEYWORDS.some((keyword) => {
|
|
36
|
+
if (!commentContent.startsWith(keyword))
|
|
37
|
+
return false;
|
|
38
|
+
const nextChar = commentContent[keyword.length];
|
|
39
|
+
return nextChar === undefined || nextChar === ' ' || nextChar === '\t' || nextChar === ':';
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function isCheckIdChar(char) {
|
|
43
|
+
const code = char.codePointAt(0) ?? 0;
|
|
44
|
+
const isLowerCase = code >= 97 && code <= 122;
|
|
45
|
+
const isUpperCase = code >= 65 && code <= 90;
|
|
46
|
+
const isDigit = code >= 48 && code <= 57;
|
|
47
|
+
const isSpecialChar = code === 95 || code === 45 || code === 47;
|
|
48
|
+
return isLowerCase || isUpperCase || isDigit || isSpecialChar;
|
|
49
|
+
}
|
|
50
|
+
function extractCheckIdFromDirective(line, directiveKeyword) {
|
|
51
|
+
// Both `//` and `/*` are 2-char prefixes; sliceLen is fixed.
|
|
52
|
+
const sliceLen = 2;
|
|
53
|
+
let commentIndex = line.indexOf('//');
|
|
54
|
+
if (commentIndex === -1) {
|
|
55
|
+
commentIndex = line.indexOf('/*');
|
|
56
|
+
if (commentIndex === -1)
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const afterComment = line.slice(commentIndex + sliceLen).trimStart();
|
|
60
|
+
if (!afterComment.startsWith(directiveKeyword))
|
|
61
|
+
return null;
|
|
62
|
+
const afterDirective = afterComment.slice(directiveKeyword.length);
|
|
63
|
+
if (afterDirective.length === 0 ||
|
|
64
|
+
(!afterDirective.startsWith(' ') && !afterDirective.startsWith('\t'))) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const checkIdStart = afterDirective.trimStart();
|
|
68
|
+
let checkId = '';
|
|
69
|
+
for (const char of checkIdStart) {
|
|
70
|
+
if (isCheckIdChar(char)) {
|
|
71
|
+
checkId += char;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return checkId.length > 0 ? checkId : null;
|
|
78
|
+
}
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// PUBLIC API
|
|
81
|
+
// =============================================================================
|
|
82
|
+
/**
|
|
83
|
+
* Parse file-level ignore directive from file content.
|
|
84
|
+
* Returns true if the file should be entirely ignored for that check.
|
|
85
|
+
*/
|
|
86
|
+
export function parseFileIgnoreDirective(content, checkId) {
|
|
87
|
+
const lines = content.split('\n').slice(0, 50);
|
|
88
|
+
const checkIds = Array.isArray(checkId) ? checkId : [checkId];
|
|
89
|
+
for (const line of lines) {
|
|
90
|
+
const extractedId = extractCheckIdFromDirective(line, '@fitness-ignore-file');
|
|
91
|
+
if (extractedId !== null && checkIds.includes(extractedId)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Parse next-line ignore directives from file content.
|
|
99
|
+
* Returns a set of line numbers that should be ignored.
|
|
100
|
+
*/
|
|
101
|
+
export function parseIgnoreDirectives(content, checkId) {
|
|
102
|
+
const ignoredLines = new Set();
|
|
103
|
+
const lines = content.split('\n');
|
|
104
|
+
const checkIds = Array.isArray(checkId) ? checkId : [checkId];
|
|
105
|
+
for (let i = 0; i < lines.length; i++) {
|
|
106
|
+
const extractedId = extractCheckIdFromDirective(lines[i] ?? '', '@fitness-ignore-next-line');
|
|
107
|
+
if (extractedId !== null && checkIds.includes(extractedId)) {
|
|
108
|
+
let targetLine = i + 1;
|
|
109
|
+
let skipped = 0;
|
|
110
|
+
while (targetLine < lines.length &&
|
|
111
|
+
skipped < MAX_DIRECTIVE_SKIP &&
|
|
112
|
+
isKnownDirectiveLine(lines[targetLine] ?? '')) {
|
|
113
|
+
targetLine++;
|
|
114
|
+
skipped++;
|
|
115
|
+
}
|
|
116
|
+
ignoredLines.add(targetLine + 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return ignoredLines;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=directive-parsing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive-parsing.js","sourceRoot":"","sources":["../../src/framework/directive-parsing.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG;;;;;;;;GAQG;AAEH,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,wBAAwB,GAAG;IAC/B,0BAA0B;IAC1B,qBAAqB;IACrB,kBAAkB;IAClB,YAAY;IACZ,aAAa;IACb,iBAAiB;IACjB,cAAc;IACd,2BAA2B;IAC3B,sBAAsB;CACd,CAAA;AAEV,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAE5B,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;IAEhC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;IAEnD,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAC/C,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAA;QACrD,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/C,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,IAAI,I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IAAI,GAAG,EAAU,CAAA;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAE7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,WAAW,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,2BAA2B,CAAC,CAAA;QAC5F,IAAI,WAAW,KAAK,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3D,IAAI,UAAU,GAAG,CAAC,GAAG,CAAC,CAAA;YACtB,IAAI,OAAO,GAAG,CAAC,CAAA;YAEf,OACE,UAAU,GAAG,KAAK,CAAC,MAAM;gBACzB,OAAO,GAAG,kBAAkB;gBAC5B,oBAAoB,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAC7C,CAAC;gBACD,UAAU,EAAE,CAAA;gBACZ,OAAO,EAAE,CAAA;YACX,CAAC;YAED,YAAY,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Execution context creation for fitness checks
|
|
3
|
+
*
|
|
4
|
+
* Provides the runtime context available to check execute functions,
|
|
5
|
+
* including file access, pattern matching, and abort support.
|
|
6
|
+
*/
|
|
7
|
+
import { SystemError } from '@opensip-tools/core';
|
|
8
|
+
import { PathMatcher } from './path-matcher.js';
|
|
9
|
+
import type { ResolvedScope } from './check-config.js';
|
|
10
|
+
/**
|
|
11
|
+
* Check identifier (UUID format).
|
|
12
|
+
*/
|
|
13
|
+
type CheckId = string;
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when a check is aborted via AbortSignal.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CheckAbortedError extends SystemError {
|
|
18
|
+
readonly name: "CheckAbortedError";
|
|
19
|
+
readonly checkId: string;
|
|
20
|
+
constructor(checkId: string, message?: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result of extracting a code snippet.
|
|
24
|
+
*/
|
|
25
|
+
interface ExtractSnippetResult {
|
|
26
|
+
readonly snippet: string;
|
|
27
|
+
readonly contextLines: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Execution context provided to check execute function.
|
|
31
|
+
*/
|
|
32
|
+
export interface ExecutionContext {
|
|
33
|
+
/** Repository root directory */
|
|
34
|
+
readonly cwd: string;
|
|
35
|
+
/** Read a file's contents */
|
|
36
|
+
readonly readFile: (path: string) => Promise<string>;
|
|
37
|
+
/** Check if file exists */
|
|
38
|
+
readonly fileExists: (path: string) => Promise<boolean>;
|
|
39
|
+
/** The check's stable ID (UUID) */
|
|
40
|
+
readonly checkId: CheckId;
|
|
41
|
+
/** The check's human-readable slug (kebab-case) */
|
|
42
|
+
readonly checkSlug: string;
|
|
43
|
+
/** Match files using the check's scope or custom patterns */
|
|
44
|
+
readonly matchFiles: (patterns?: readonly string[], options?: {
|
|
45
|
+
ignore?: readonly string[];
|
|
46
|
+
}) => Promise<readonly string[]>;
|
|
47
|
+
/** Get a PathMatcher for the check's scope */
|
|
48
|
+
readonly getMatcher: () => PathMatcher;
|
|
49
|
+
/** Verbose logging enabled */
|
|
50
|
+
readonly verbose: boolean;
|
|
51
|
+
/** Log a message (only in verbose mode) */
|
|
52
|
+
readonly log: (message: string) => void;
|
|
53
|
+
/** Extract a code snippet with context lines */
|
|
54
|
+
readonly extractSnippet: (content: string, line: number, contextLines?: number) => ExtractSnippetResult;
|
|
55
|
+
/** AbortSignal for cancellation support */
|
|
56
|
+
readonly signal?: AbortSignal;
|
|
57
|
+
/** Throws if the check has been aborted */
|
|
58
|
+
readonly checkAborted: () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Options for running a check.
|
|
62
|
+
*/
|
|
63
|
+
export interface RunOptions {
|
|
64
|
+
readonly verbose?: boolean;
|
|
65
|
+
readonly scopeOverride?: string | ResolvedScope;
|
|
66
|
+
readonly additionalExcludes?: readonly string[];
|
|
67
|
+
readonly signal?: AbortSignal;
|
|
68
|
+
/** Pre-resolved file paths from per-check target overrides. When set, matchFiles() returns these instead of cache paths. */
|
|
69
|
+
readonly targetFiles?: readonly string[];
|
|
70
|
+
/**
|
|
71
|
+
* Run-wide file exclusion patterns from the project config's
|
|
72
|
+
* `globalExcludes`. Applied to the fileCache fallback path used by
|
|
73
|
+
* scope-empty checks (e.g. `file-length-limit`). Without this filter,
|
|
74
|
+
* a check that declares `scope: { languages: [], concerns: [] }`
|
|
75
|
+
* would scan every prewarmed file regardless of whether the project
|
|
76
|
+
* told us to exclude it — surfacing findings inside `docs/`,
|
|
77
|
+
* `tests/fixtures/`, etc., contrary to user intent.
|
|
78
|
+
*/
|
|
79
|
+
readonly globalExcludes?: readonly string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Configuration needed to create execution context.
|
|
83
|
+
*/
|
|
84
|
+
export interface ExecutionContextConfig {
|
|
85
|
+
readonly id: CheckId;
|
|
86
|
+
readonly slug: string;
|
|
87
|
+
readonly itemType: string;
|
|
88
|
+
readonly unit?: string | undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Creates the execution context for a check.
|
|
92
|
+
*/
|
|
93
|
+
export declare function createExecutionContext(config: ExecutionContextConfig, cwd: string, matcher: PathMatcher, options?: RunOptions): ExecutionContext;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=execution-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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