@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,109 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
isInsideStringLiteral,
|
|
5
|
+
stripStringLiterals,
|
|
6
|
+
stripStringsAndComments,
|
|
7
|
+
stripStringsAndCommentsPreservingPositions,
|
|
8
|
+
} from '../strip-literals.js';
|
|
9
|
+
|
|
10
|
+
describe('stripStringLiterals', () => {
|
|
11
|
+
it('empties single-quoted strings', () => {
|
|
12
|
+
expect(stripStringLiterals(`const a = 'hi'`)).toBe(`const a = ''`);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('empties double-quoted strings', () => {
|
|
16
|
+
expect(stripStringLiterals(`const a = "hi"`)).toBe(`const a = ""`);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('empties template literals', () => {
|
|
20
|
+
expect(stripStringLiterals('const a = `hi`')).toBe('const a = ``');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('preserves escaped quotes', () => {
|
|
24
|
+
expect(stripStringLiterals(String.raw`const a = 'it\'s'`)).toBe(`const a = ''`);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('stripStringsAndComments', () => {
|
|
29
|
+
it('strips strings AND single-line comments', () => {
|
|
30
|
+
const out = stripStringsAndComments(`const a = "hi"; // comment\nconst b = 1;`);
|
|
31
|
+
expect(out).not.toContain('hi');
|
|
32
|
+
expect(out).not.toContain('comment');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('keeps code outside strings/comments intact', () => {
|
|
36
|
+
const out = stripStringsAndComments(`const x = 1;`);
|
|
37
|
+
expect(out).toBe(`const x = 1;`);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('isInsideStringLiteral', () => {
|
|
42
|
+
it('returns true for a position inside a single-quoted string', () => {
|
|
43
|
+
expect(isInsideStringLiteral(`const x = 'hello'`, 12)).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('returns true for a position inside a double-quoted string', () => {
|
|
47
|
+
expect(isInsideStringLiteral(`const x = "hello"`, 12)).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('returns true for a position inside a template literal', () => {
|
|
51
|
+
expect(isInsideStringLiteral('const x = `hello`', 12)).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('returns false for a position outside any string', () => {
|
|
55
|
+
expect(isInsideStringLiteral(`const x = "h"; foo()`, 18)).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('handles escaped quotes correctly', () => {
|
|
59
|
+
// Position 14 is inside the closed string, so still inside the next
|
|
60
|
+
// unescaped quote? Actually after the closing quote, so outside.
|
|
61
|
+
expect(isInsideStringLiteral(String.raw`const x = 'it\'s'`, 14)).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('stripStringsAndCommentsPreservingPositions', () => {
|
|
66
|
+
it('replaces string content with spaces while preserving newlines', () => {
|
|
67
|
+
const input = `const a = "hi"\nconst b = 1`;
|
|
68
|
+
const output = stripStringsAndCommentsPreservingPositions(input);
|
|
69
|
+
expect(output.length).toBe(input.length);
|
|
70
|
+
expect(output).toContain('\n');
|
|
71
|
+
expect(output).not.toContain('hi');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('blanks out single-line comments to end of line', () => {
|
|
75
|
+
const input = `const x = 1; // comment\nconst y = 2;`;
|
|
76
|
+
const output = stripStringsAndCommentsPreservingPositions(input);
|
|
77
|
+
expect(output.length).toBe(input.length);
|
|
78
|
+
expect(output).not.toContain('comment');
|
|
79
|
+
expect(output).toContain('const x = 1;');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('blanks out block comments preserving line breaks', () => {
|
|
83
|
+
const input = `const a = 1;\n/* multi\n line\n*/\nconst b = 2;`;
|
|
84
|
+
const output = stripStringsAndCommentsPreservingPositions(input);
|
|
85
|
+
expect(output.length).toBe(input.length);
|
|
86
|
+
expect(output).not.toContain('multi');
|
|
87
|
+
expect(output).not.toContain('line');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('handles escaped characters inside strings', () => {
|
|
91
|
+
const input = String.raw`const a = "it\"s";`;
|
|
92
|
+
const output = stripStringsAndCommentsPreservingPositions(input);
|
|
93
|
+
expect(output.length).toBe(input.length);
|
|
94
|
+
expect(output).not.toContain('it');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('preserves character positions outside strings/comments', () => {
|
|
98
|
+
const input = `const x = "y"; foo();`;
|
|
99
|
+
const output = stripStringsAndCommentsPreservingPositions(input);
|
|
100
|
+
expect(output.length).toBe(input.length);
|
|
101
|
+
expect(output).toContain('foo()');
|
|
102
|
+
// The "x" identifier should be at the same position
|
|
103
|
+
expect(output[6]).toBe('x');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('handles empty content', () => {
|
|
107
|
+
expect(stripStringsAndCommentsPreservingPositions('')).toBe('');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// @fitness-ignore-file semgrep-scan -- reviewed: pattern justified for this module
|
|
2
|
+
// @fitness-ignore-file error-handling-suite -- catch blocks delegate errors through established patterns
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Abortable command execution for fitness checks
|
|
5
|
+
*
|
|
6
|
+
* Provides shell command execution with abort signal and timeout support.
|
|
7
|
+
* Child processes are properly cleaned up on abort.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { spawn, type ChildProcess } from 'node:child_process'
|
|
11
|
+
|
|
12
|
+
import { SystemError } from '@opensip-tools/core'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Options for abortable command execution
|
|
16
|
+
*/
|
|
17
|
+
export interface AbortableExecOptions {
|
|
18
|
+
cwd?: string | undefined
|
|
19
|
+
signal?: AbortSignal | undefined
|
|
20
|
+
maxBuffer?: number | undefined
|
|
21
|
+
env?: NodeJS.ProcessEnv | undefined
|
|
22
|
+
timeout?: number | undefined
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Result of command execution
|
|
27
|
+
*/
|
|
28
|
+
export interface ExecResult {
|
|
29
|
+
stdout: string
|
|
30
|
+
stderr: string
|
|
31
|
+
exitCode: number | null
|
|
32
|
+
aborted: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown when command execution fails
|
|
37
|
+
*/
|
|
38
|
+
class ExecError extends SystemError {
|
|
39
|
+
constructor(
|
|
40
|
+
message: string,
|
|
41
|
+
public readonly stdout: string,
|
|
42
|
+
public readonly stderr: string,
|
|
43
|
+
public readonly exitCode: number | null,
|
|
44
|
+
public readonly aborted: boolean,
|
|
45
|
+
) {
|
|
46
|
+
super(message, { code: 'SYSTEM.FITNESS.EXEC_FAILED' })
|
|
47
|
+
this.name = 'ExecError'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const DEFAULT_MAX_BUFFER_BYTES = 10 * 1024 * 1024 // 10 MB
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Execute a command with abort support.
|
|
55
|
+
*
|
|
56
|
+
* @param command - Either a shell command string or an array of [bin, ...args] (no shell).
|
|
57
|
+
* @throws {SystemError} When the command array is empty
|
|
58
|
+
* @throws {ExecError} When the child process fails to spawn
|
|
59
|
+
*/
|
|
60
|
+
export function execAbortable(
|
|
61
|
+
command: string | readonly string[],
|
|
62
|
+
options: AbortableExecOptions = {},
|
|
63
|
+
): Promise<ExecResult> {
|
|
64
|
+
const {
|
|
65
|
+
cwd = process.cwd(),
|
|
66
|
+
signal,
|
|
67
|
+
maxBuffer = DEFAULT_MAX_BUFFER_BYTES,
|
|
68
|
+
env = process.env,
|
|
69
|
+
timeout,
|
|
70
|
+
} = options
|
|
71
|
+
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
if (signal?.aborted) {
|
|
74
|
+
resolve({ stdout: '', stderr: '', exitCode: null, aborted: true })
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let child: ChildProcess
|
|
79
|
+
if (typeof command === 'string') {
|
|
80
|
+
// Shell mode (string command) — callers pass hardcoded commands (e.g., lint/test runners).
|
|
81
|
+
// Array overload is preferred for untrusted input (no shell, no injection risk).
|
|
82
|
+
// nosemgrep: javascript.lang.security.audit.spawn-shell-true.spawn-shell-true -- shell=true required for string commands; input is developer-defined check commands, not user input
|
|
83
|
+
// eslint-disable-next-line sonarjs/os-command -- developer-supplied check command; not user-controllable
|
|
84
|
+
child = spawn(command, [], {
|
|
85
|
+
cwd,
|
|
86
|
+
env,
|
|
87
|
+
shell: true,
|
|
88
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
89
|
+
detached: true,
|
|
90
|
+
})
|
|
91
|
+
} else {
|
|
92
|
+
// Array mode (no shell, safer)
|
|
93
|
+
if (command.length === 0) {
|
|
94
|
+
reject(new SystemError('Command array must not be empty', { code: 'SYSTEM.FITNESS.EXEC_EMPTY_COMMAND' }))
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
const [bin, ...args] = command
|
|
98
|
+
// @fitness-ignore-next-line no-non-null-assertions -- command length validated above
|
|
99
|
+
child = spawn(bin ?? '', args, {
|
|
100
|
+
cwd,
|
|
101
|
+
env,
|
|
102
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
103
|
+
detached: true,
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let stdout = ''
|
|
108
|
+
let stderr = ''
|
|
109
|
+
let aborted = false
|
|
110
|
+
let timeoutId: NodeJS.Timeout | undefined
|
|
111
|
+
|
|
112
|
+
child.stdout?.on('data', (data: Buffer) => {
|
|
113
|
+
const chunk = data.toString()
|
|
114
|
+
if (stdout.length + chunk.length <= maxBuffer) {
|
|
115
|
+
stdout += chunk
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
child.stderr?.on('data', (data: Buffer) => {
|
|
120
|
+
const chunk = data.toString()
|
|
121
|
+
if (stderr.length + chunk.length <= maxBuffer) {
|
|
122
|
+
stderr += chunk
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const abortHandler = (): void => {
|
|
127
|
+
if (!aborted) {
|
|
128
|
+
aborted = true
|
|
129
|
+
killProcess(child)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
signal?.addEventListener('abort', abortHandler)
|
|
134
|
+
|
|
135
|
+
if (timeout && timeout > 0) {
|
|
136
|
+
timeoutId = setTimeout(() => {
|
|
137
|
+
if (!aborted) {
|
|
138
|
+
aborted = true
|
|
139
|
+
killProcess(child)
|
|
140
|
+
}
|
|
141
|
+
}, timeout)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
child.on('close', (code: number | null) => {
|
|
145
|
+
signal?.removeEventListener('abort', abortHandler)
|
|
146
|
+
if (timeoutId) clearTimeout(timeoutId)
|
|
147
|
+
resolve({ stdout, stderr, exitCode: code, aborted })
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
child.on('error', (err: Error) => {
|
|
151
|
+
signal?.removeEventListener('abort', abortHandler)
|
|
152
|
+
if (timeoutId) clearTimeout(timeoutId)
|
|
153
|
+
reject(
|
|
154
|
+
new ExecError(`Failed to spawn process: ${err.message}`, stdout, stderr, null, aborted),
|
|
155
|
+
)
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Kill a child process and all its descendants.
|
|
162
|
+
*/
|
|
163
|
+
function killProcess(child: ChildProcess): void {
|
|
164
|
+
if (child.pid) {
|
|
165
|
+
try {
|
|
166
|
+
process.kill(-child.pid, 'SIGKILL')
|
|
167
|
+
} catch {
|
|
168
|
+
// @swallow-ok Process group kill failed, try direct kill
|
|
169
|
+
try {
|
|
170
|
+
child.kill('SIGKILL')
|
|
171
|
+
} catch {
|
|
172
|
+
// @swallow-ok Process already exited
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// @fitness-ignore-file batch-operation-limits -- iterates bounded collections (config entries, registry items, or small analysis results)
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Shared AST utilities for fitness checks
|
|
4
|
+
*
|
|
5
|
+
* Common TypeScript AST operations for source parsing, tree walking,
|
|
6
|
+
* and node inspection. Used by AST-based fitness checks.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as ts from 'typescript'
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// SOURCE PARSING
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Parse TypeScript/JavaScript source into an AST SourceFile.
|
|
17
|
+
* Returns null on parse failure.
|
|
18
|
+
*/
|
|
19
|
+
export function parseSource(content: string, filePath: string): ts.SourceFile | null {
|
|
20
|
+
try {
|
|
21
|
+
return ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true)
|
|
22
|
+
} catch {
|
|
23
|
+
// @swallow-ok Parse failure returns null for graceful degradation
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// =============================================================================
|
|
29
|
+
// TREE WALKING
|
|
30
|
+
// =============================================================================
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Depth-first walk of all nodes in a SourceFile or subtree.
|
|
34
|
+
*/
|
|
35
|
+
export function walkNodes(root: ts.Node, visitor: (node: ts.Node) => void): void {
|
|
36
|
+
function visit(node: ts.Node): void {
|
|
37
|
+
visitor(node)
|
|
38
|
+
ts.forEachChild(node, visit)
|
|
39
|
+
}
|
|
40
|
+
ts.forEachChild(root, visit)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// =============================================================================
|
|
44
|
+
// NODE INSPECTION
|
|
45
|
+
// =============================================================================
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the leaf identifier text from an expression node.
|
|
49
|
+
*/
|
|
50
|
+
export function getIdentifierName(node: ts.Node): string {
|
|
51
|
+
if (ts.isIdentifier(node)) return node.text
|
|
52
|
+
if (ts.isPropertyAccessExpression(node)) return node.name.text
|
|
53
|
+
return ''
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the full dotted path of a property access chain.
|
|
58
|
+
*/
|
|
59
|
+
export function getPropertyChain(node: ts.Node): string {
|
|
60
|
+
if (ts.isIdentifier(node)) return node.text
|
|
61
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
62
|
+
return `${getPropertyChain(node.expression)}.${node.name.text}`
|
|
63
|
+
}
|
|
64
|
+
return ''
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get the 1-indexed line number for a node.
|
|
69
|
+
*/
|
|
70
|
+
export function getLineNumber(node: ts.Node, sourceFile: ts.SourceFile): number {
|
|
71
|
+
const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart())
|
|
72
|
+
return line + 1
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Check if a node is a property access matching a specific property name.
|
|
77
|
+
*/
|
|
78
|
+
export function isPropertyAccess(node: ts.Node, propertyName: string): boolean {
|
|
79
|
+
return ts.isPropertyAccessExpression(node) && node.name.text === propertyName
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Check if a node is a literal value.
|
|
84
|
+
*/
|
|
85
|
+
export function isLiteral(node: ts.Node): boolean {
|
|
86
|
+
if (ts.isStringLiteral(node) || ts.isNumericLiteral(node)) return true
|
|
87
|
+
if (ts.isNoSubstitutionTemplateLiteral(node)) return true
|
|
88
|
+
if (node.kind === ts.SyntaxKind.TrueKeyword || node.kind === ts.SyntaxKind.FalseKeyword)
|
|
89
|
+
return true
|
|
90
|
+
if (node.kind === ts.SyntaxKind.NullKeyword) return true
|
|
91
|
+
if (ts.isIdentifier(node) && node.text === 'undefined') return true
|
|
92
|
+
return false
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Check if a node is inside a string literal or template literal.
|
|
97
|
+
*/
|
|
98
|
+
export function isInStringLiteral(node: ts.Node): boolean {
|
|
99
|
+
let current = node.parent
|
|
100
|
+
while (!ts.isSourceFile(current)) {
|
|
101
|
+
if (
|
|
102
|
+
ts.isStringLiteral(current) ||
|
|
103
|
+
ts.isNoSubstitutionTemplateLiteral(current) ||
|
|
104
|
+
ts.isTemplateExpression(current)
|
|
105
|
+
) {
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
current = current.parent
|
|
109
|
+
}
|
|
110
|
+
return false
|
|
111
|
+
}
|
|
112
|
+
|