@opensip-cli/fitness 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/baseline-plane.test.d.ts +12 -0
- package/dist/__tests__/baseline-plane.test.d.ts.map +1 -0
- package/dist/__tests__/baseline-plane.test.js +63 -0
- package/dist/__tests__/baseline-plane.test.js.map +1 -0
- package/dist/__tests__/check-utils.test.d.ts +10 -0
- package/dist/__tests__/check-utils.test.d.ts.map +1 -0
- package/dist/__tests__/check-utils.test.js +193 -0
- package/dist/__tests__/check-utils.test.js.map +1 -0
- package/dist/__tests__/fingerprint-parity.test.d.ts +14 -0
- package/dist/__tests__/fingerprint-parity.test.d.ts.map +1 -0
- package/dist/__tests__/fingerprint-parity.test.js +59 -0
- package/dist/__tests__/fingerprint-parity.test.js.map +1 -0
- package/dist/__tests__/fit-execute-opts.test.d.ts +15 -0
- package/dist/__tests__/fit-execute-opts.test.d.ts.map +1 -0
- package/dist/__tests__/fit-execute-opts.test.js +124 -0
- package/dist/__tests__/fit-execute-opts.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +19 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +85 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/tool.test.d.ts +10 -0
- package/dist/__tests__/tool.test.d.ts.map +1 -0
- package/dist/__tests__/tool.test.js +57 -0
- package/dist/__tests__/tool.test.js.map +1 -0
- package/dist/baseline-strategy.d.ts +21 -0
- package/dist/baseline-strategy.d.ts.map +1 -0
- package/dist/baseline-strategy.js +21 -0
- package/dist/baseline-strategy.js.map +1 -0
- package/dist/check-utils/display.d.ts +52 -0
- package/dist/check-utils/display.d.ts.map +1 -0
- package/dist/check-utils/display.js +66 -0
- package/dist/check-utils/display.js.map +1 -0
- package/dist/check-utils/index.d.ts +17 -0
- package/dist/check-utils/index.d.ts.map +1 -0
- package/dist/check-utils/index.js +13 -0
- package/dist/check-utils/index.js.map +1 -0
- package/dist/check-utils/path-matching.d.ts +40 -0
- package/dist/check-utils/path-matching.d.ts.map +1 -0
- package/dist/check-utils/path-matching.js +38 -0
- package/dist/check-utils/path-matching.js.map +1 -0
- package/dist/check-utils/source-analysis.d.ts +36 -0
- package/dist/check-utils/source-analysis.d.ts.map +1 -0
- package/dist/check-utils/source-analysis.js +44 -0
- package/dist/check-utils/source-analysis.js.map +1 -0
- package/dist/check-utils/test-helpers.d.ts +57 -0
- package/dist/check-utils/test-helpers.d.ts.map +1 -0
- package/dist/check-utils/test-helpers.js +71 -0
- package/dist/check-utils/test-helpers.js.map +1 -0
- package/dist/cli/__tests__/fit-gate-mode.test.d.ts +14 -0
- package/dist/cli/__tests__/fit-gate-mode.test.d.ts.map +1 -0
- package/dist/cli/__tests__/fit-gate-mode.test.js +110 -0
- package/dist/cli/__tests__/fit-gate-mode.test.js.map +1 -0
- package/dist/cli/__tests__/fit-modes-live.test.d.ts +13 -0
- package/dist/cli/__tests__/fit-modes-live.test.d.ts.map +1 -0
- package/dist/cli/__tests__/fit-modes-live.test.js +182 -0
- package/dist/cli/__tests__/fit-modes-live.test.js.map +1 -0
- package/dist/cli/__tests__/report-data.test.d.ts +12 -0
- package/dist/cli/__tests__/report-data.test.d.ts.map +1 -0
- package/dist/cli/__tests__/report-data.test.js +113 -0
- package/dist/cli/__tests__/report-data.test.js.map +1 -0
- package/dist/cli/fit/__tests__/display-fold.test.d.ts +8 -0
- package/dist/cli/fit/__tests__/display-fold.test.d.ts.map +1 -0
- package/dist/cli/fit/__tests__/display-fold.test.js +87 -0
- package/dist/cli/fit/__tests__/display-fold.test.js.map +1 -0
- package/dist/cli/fit/__tests__/gate-resolved-config.test.d.ts +16 -0
- package/dist/cli/fit/__tests__/gate-resolved-config.test.d.ts.map +1 -0
- package/dist/cli/fit/__tests__/gate-resolved-config.test.js +62 -0
- package/dist/cli/fit/__tests__/gate-resolved-config.test.js.map +1 -0
- package/dist/cli/fit/check-loader.d.ts +37 -0
- package/dist/cli/fit/check-loader.d.ts.map +1 -0
- package/dist/cli/fit/check-loader.js +154 -0
- package/dist/cli/fit/check-loader.js.map +1 -0
- package/dist/cli/fit/config-loader.d.ts +55 -0
- package/dist/cli/fit/config-loader.d.ts.map +1 -0
- package/dist/cli/fit/config-loader.js +107 -0
- package/dist/cli/fit/config-loader.js.map +1 -0
- package/dist/cli/fit/display-registry.d.ts +19 -0
- package/dist/cli/fit/display-registry.d.ts.map +1 -0
- package/dist/cli/fit/display-registry.js +33 -0
- package/dist/cli/fit/display-registry.js.map +1 -0
- package/dist/cli/fit/envelope-view.d.ts +49 -0
- package/dist/cli/fit/envelope-view.d.ts.map +1 -0
- package/dist/cli/fit/envelope-view.js +85 -0
- package/dist/cli/fit/envelope-view.js.map +1 -0
- package/dist/cli/fit/fit-aux-command-specs.d.ts +35 -0
- package/dist/cli/fit/fit-aux-command-specs.d.ts.map +1 -0
- package/dist/cli/fit/fit-aux-command-specs.js +110 -0
- package/dist/cli/fit/fit-aux-command-specs.js.map +1 -0
- package/dist/cli/fit/fit-command-spec.d.ts +24 -0
- package/dist/cli/fit/fit-command-spec.d.ts.map +1 -0
- package/dist/cli/fit/fit-command-spec.js +131 -0
- package/dist/cli/fit/fit-command-spec.js.map +1 -0
- package/dist/cli/fit/gate-compare-render.d.ts +13 -0
- package/dist/cli/fit/gate-compare-render.d.ts.map +1 -0
- package/dist/cli/fit/gate-compare-render.js +87 -0
- package/dist/cli/fit/gate-compare-render.js.map +1 -0
- package/dist/cli/fit/recipe-selector.d.ts +53 -0
- package/dist/cli/fit/recipe-selector.d.ts.map +1 -0
- package/dist/cli/fit/recipe-selector.js +106 -0
- package/dist/cli/fit/recipe-selector.js.map +1 -0
- package/dist/cli/fit/recipe-selector.test.d.ts +2 -0
- package/dist/cli/fit/recipe-selector.test.d.ts.map +1 -0
- package/dist/cli/fit/recipe-selector.test.js +69 -0
- package/dist/cli/fit/recipe-selector.test.js.map +1 -0
- package/dist/cli/fit/resolved-fitness-config.d.ts +48 -0
- package/dist/cli/fit/resolved-fitness-config.d.ts.map +1 -0
- package/dist/cli/fit/resolved-fitness-config.js +46 -0
- package/dist/cli/fit/resolved-fitness-config.js.map +1 -0
- package/dist/cli/fit/result-builders.d.ts +91 -0
- package/dist/cli/fit/result-builders.d.ts.map +1 -0
- package/dist/cli/fit/result-builders.js +206 -0
- package/dist/cli/fit/result-builders.js.map +1 -0
- package/dist/cli/fit-list.d.ts +7 -0
- package/dist/cli/fit-list.d.ts.map +1 -0
- package/dist/cli/fit-list.js +24 -0
- package/dist/cli/fit-list.js.map +1 -0
- package/dist/cli/fit-modes.d.ts +42 -0
- package/dist/cli/fit-modes.d.ts.map +1 -0
- package/dist/cli/fit-modes.js +322 -0
- package/dist/cli/fit-modes.js.map +1 -0
- package/dist/cli/fit-recipes.d.ts +7 -0
- package/dist/cli/fit-recipes.d.ts.map +1 -0
- package/dist/cli/fit-recipes.js +34 -0
- package/dist/cli/fit-recipes.js.map +1 -0
- package/dist/cli/fit-runner-views.d.ts +33 -0
- package/dist/cli/fit-runner-views.d.ts.map +1 -0
- package/dist/cli/fit-runner-views.js +92 -0
- package/dist/cli/fit-runner-views.js.map +1 -0
- package/dist/cli/fit-runner.d.ts +44 -0
- package/dist/cli/fit-runner.d.ts.map +1 -0
- package/dist/cli/fit-runner.js +250 -0
- package/dist/cli/fit-runner.js.map +1 -0
- package/dist/cli/fit-worker.d.ts +26 -0
- package/dist/cli/fit-worker.d.ts.map +1 -0
- package/dist/cli/fit-worker.js +67 -0
- package/dist/cli/fit-worker.js.map +1 -0
- package/dist/cli/fit.d.ts +74 -0
- package/dist/cli/fit.d.ts.map +1 -0
- package/dist/cli/fit.js +149 -0
- package/dist/cli/fit.js.map +1 -0
- package/dist/cli/report-data.d.ts +44 -0
- package/dist/cli/report-data.d.ts.map +1 -0
- package/dist/cli/report-data.js +89 -0
- package/dist/cli/report-data.js.map +1 -0
- package/dist/config/__tests__/fitness-config-schema.test.d.ts +6 -0
- package/dist/config/__tests__/fitness-config-schema.test.d.ts.map +1 -0
- package/dist/config/__tests__/fitness-config-schema.test.js +37 -0
- package/dist/config/__tests__/fitness-config-schema.test.js.map +1 -0
- package/dist/config/fitness-config-schema.d.ts +48 -0
- package/dist/config/fitness-config-schema.d.ts.map +1 -0
- package/dist/config/fitness-config-schema.js +62 -0
- package/dist/config/fitness-config-schema.js.map +1 -0
- package/dist/framework/__tests__/abortable-exec.test.d.ts +9 -0
- package/dist/framework/__tests__/abortable-exec.test.d.ts.map +1 -0
- package/dist/framework/__tests__/abortable-exec.test.js +102 -0
- package/dist/framework/__tests__/abortable-exec.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__/check-types.test.d.ts +2 -0
- package/dist/framework/__tests__/check-types.test.d.ts.map +1 -0
- package/dist/framework/__tests__/check-types.test.js +76 -0
- package/dist/framework/__tests__/check-types.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 +110 -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 +122 -0
- package/dist/framework/__tests__/content-filter-dispatch.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 +402 -0
- package/dist/framework/__tests__/define-check.test.js.map +1 -0
- package/dist/framework/__tests__/define-regex-list-check.test.d.ts +15 -0
- package/dist/framework/__tests__/define-regex-list-check.test.d.ts.map +1 -0
- package/dist/framework/__tests__/define-regex-list-check.test.js +299 -0
- package/dist/framework/__tests__/define-regex-list-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 +111 -0
- package/dist/framework/__tests__/directive-inventory.test.js.map +1 -0
- package/dist/framework/__tests__/directive-parsing.test.d.ts +13 -0
- package/dist/framework/__tests__/directive-parsing.test.d.ts.map +1 -0
- package/dist/framework/__tests__/directive-parsing.test.js +86 -0
- package/dist/framework/__tests__/directive-parsing.test.js.map +1 -0
- package/dist/framework/__tests__/execution-context.globalexcludes-parity.test.d.ts +2 -0
- package/dist/framework/__tests__/execution-context.globalexcludes-parity.test.d.ts.map +1 -0
- package/dist/framework/__tests__/execution-context.globalexcludes-parity.test.js +56 -0
- package/dist/framework/__tests__/execution-context.globalexcludes-parity.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 +140 -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__/file-type-filter.test.d.ts +9 -0
- package/dist/framework/__tests__/file-type-filter.test.d.ts.map +1 -0
- package/dist/framework/__tests__/file-type-filter.test.js +39 -0
- package/dist/framework/__tests__/file-type-filter.test.js.map +1 -0
- package/dist/framework/__tests__/ignore-processing.test.d.ts +11 -0
- package/dist/framework/__tests__/ignore-processing.test.d.ts.map +1 -0
- package/dist/framework/__tests__/ignore-processing.test.js +175 -0
- package/dist/framework/__tests__/ignore-processing.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__/memory-profiler.test.d.ts +9 -0
- package/dist/framework/__tests__/memory-profiler.test.d.ts.map +1 -0
- package/dist/framework/__tests__/memory-profiler.test.js +108 -0
- package/dist/framework/__tests__/memory-profiler.test.js.map +1 -0
- package/dist/framework/__tests__/parse-cache.test.d.ts +9 -0
- package/dist/framework/__tests__/parse-cache.test.d.ts.map +1 -0
- package/dist/framework/__tests__/parse-cache.test.js +51 -0
- package/dist/framework/__tests__/parse-cache.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 +51 -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 +211 -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-registry.test.d.ts +8 -0
- package/dist/framework/__tests__/scope-registry.test.d.ts.map +1 -0
- package/dist/framework/__tests__/scope-registry.test.js +156 -0
- package/dist/framework/__tests__/scope-registry.test.js.map +1 -0
- package/dist/framework/__tests__/scope-resolver.golden.test.d.ts +2 -0
- package/dist/framework/__tests__/scope-resolver.golden.test.d.ts.map +1 -0
- package/dist/framework/__tests__/scope-resolver.golden.test.js +105 -0
- package/dist/framework/__tests__/scope-resolver.golden.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 +150 -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 +74 -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 +143 -0
- package/dist/framework/abortable-exec.js.map +1 -0
- package/dist/framework/check-config.d.ts +175 -0
- package/dist/framework/check-config.d.ts.map +1 -0
- package/dist/framework/check-config.js +115 -0
- package/dist/framework/check-config.js.map +1 -0
- package/dist/framework/check-types.d.ts +82 -0
- package/dist/framework/check-types.d.ts.map +1 -0
- package/dist/framework/check-types.js +63 -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/comment-openers.d.ts +11 -0
- package/dist/framework/comment-openers.d.ts.map +1 -0
- package/dist/framework/comment-openers.js +11 -0
- package/dist/framework/comment-openers.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/define-check.d.ts +38 -0
- package/dist/framework/define-check.d.ts.map +1 -0
- package/dist/framework/define-check.js +296 -0
- package/dist/framework/define-check.js.map +1 -0
- package/dist/framework/define-regex-list-check.d.ts +160 -0
- package/dist/framework/define-regex-list-check.d.ts.map +1 -0
- package/dist/framework/define-regex-list-check.js +177 -0
- package/dist/framework/define-regex-list-check.js.map +1 -0
- package/dist/framework/directive-inventory.d.ts +37 -0
- package/dist/framework/directive-inventory.d.ts.map +1 -0
- package/dist/framework/directive-inventory.js +82 -0
- package/dist/framework/directive-inventory.js.map +1 -0
- package/dist/framework/directive-parsing.d.ts +23 -0
- package/dist/framework/directive-parsing.d.ts.map +1 -0
- package/dist/framework/directive-parsing.js +39 -0
- package/dist/framework/directive-parsing.js.map +1 -0
- package/dist/framework/execution-context.d.ts +98 -0
- package/dist/framework/execution-context.d.ts.map +1 -0
- package/dist/framework/execution-context.js +145 -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 +199 -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 +36 -0
- package/dist/framework/ignore-processing.d.ts.map +1 -0
- package/dist/framework/ignore-processing.js +172 -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 +217 -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 +24 -0
- package/dist/framework/parse-cache.d.ts.map +1 -0
- package/dist/framework/parse-cache.js +41 -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 +11 -0
- package/dist/framework/register-helpers.d.ts.map +1 -0
- package/dist/framework/register-helpers.js +19 -0
- package/dist/framework/register-helpers.js.map +1 -0
- package/dist/framework/registry.d.ts +51 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +131 -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-registry.d.ts +38 -0
- package/dist/framework/scope-registry.d.ts.map +1 -0
- package/dist/framework/scope-registry.js +77 -0
- package/dist/framework/scope-registry.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 +102 -0
- package/dist/framework/scope-resolver.js.map +1 -0
- package/dist/framework/severity-mapping.d.ts +17 -0
- package/dist/framework/severity-mapping.d.ts.map +1 -0
- package/dist/framework/severity-mapping.js +71 -0
- package/dist/framework/severity-mapping.js.map +1 -0
- package/dist/framework/strip-literals.d.ts +73 -0
- package/dist/framework/strip-literals.d.ts.map +1 -0
- package/dist/framework/strip-literals.js +213 -0
- package/dist/framework/strip-literals.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +17 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +17 -0
- package/dist/internal.js.map +1 -0
- package/dist/persistence/session-payload.d.ts +68 -0
- package/dist/persistence/session-payload.d.ts.map +1 -0
- package/dist/persistence/session-payload.js +78 -0
- package/dist/persistence/session-payload.js.map +1 -0
- package/dist/persistence/session-payload.test.d.ts +11 -0
- package/dist/persistence/session-payload.test.d.ts.map +1 -0
- package/dist/persistence/session-payload.test.js +80 -0
- package/dist/persistence/session-payload.test.js.map +1 -0
- package/dist/persistence/session-replay.d.ts +14 -0
- package/dist/persistence/session-replay.d.ts.map +1 -0
- package/dist/persistence/session-replay.js +85 -0
- package/dist/persistence/session-replay.js.map +1 -0
- package/dist/persistence/session-replay.test.d.ts +10 -0
- package/dist/persistence/session-replay.test.d.ts.map +1 -0
- package/dist/persistence/session-replay.test.js +171 -0
- package/dist/persistence/session-replay.test.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 +48 -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 +192 -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 +271 -0
- package/dist/plugins/__tests__/loader.test.js.map +1 -0
- package/dist/plugins/check-package-discovery.d.ts +19 -0
- package/dist/plugins/check-package-discovery.d.ts.map +1 -0
- package/dist/plugins/check-package-discovery.js +34 -0
- package/dist/plugins/check-package-discovery.js.map +1 -0
- package/dist/plugins/loader.d.ts +32 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +198 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/types.d.ts +29 -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 +12 -0
- package/dist/recipes/__tests__/check-config.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/check-config.test.js +90 -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 +160 -0
- package/dist/recipes/__tests__/check-resolution.test.js.map +1 -0
- package/dist/recipes/__tests__/execution-branches.test.d.ts +10 -0
- package/dist/recipes/__tests__/execution-branches.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/execution-branches.test.js +612 -0
- package/dist/recipes/__tests__/execution-branches.test.js.map +1 -0
- package/dist/recipes/__tests__/execution-paths.test.d.ts +10 -0
- package/dist/recipes/__tests__/execution-paths.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/execution-paths.test.js +280 -0
- package/dist/recipes/__tests__/execution-paths.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 +89 -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__/run-one-check.test.d.ts +14 -0
- package/dist/recipes/__tests__/run-one-check.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/run-one-check.test.js +182 -0
- package/dist/recipes/__tests__/run-one-check.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 +572 -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 +241 -0
- package/dist/recipes/built-in-recipes.js.map +1 -0
- package/dist/recipes/check-config.d.ts +56 -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 +36 -0
- package/dist/recipes/check-resolution.d.ts.map +1 -0
- package/dist/recipes/check-resolution.js +81 -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 +197 -0
- package/dist/recipes/check-result-processor.js.map +1 -0
- package/dist/recipes/parallel-execution.d.ts +38 -0
- package/dist/recipes/parallel-execution.d.ts.map +1 -0
- package/dist/recipes/parallel-execution.js +61 -0
- package/dist/recipes/parallel-execution.js.map +1 -0
- package/dist/recipes/registry.d.ts +47 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +70 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/retry.d.ts +29 -0
- package/dist/recipes/retry.d.ts.map +1 -0
- package/dist/recipes/retry.js +23 -0
- package/dist/recipes/retry.js.map +1 -0
- package/dist/recipes/run-one-check.d.ts +59 -0
- package/dist/recipes/run-one-check.d.ts.map +1 -0
- package/dist/recipes/run-one-check.js +174 -0
- package/dist/recipes/run-one-check.js.map +1 -0
- package/dist/recipes/sequential-execution.d.ts +12 -0
- package/dist/recipes/sequential-execution.d.ts.map +1 -0
- package/dist/recipes/sequential-execution.js +48 -0
- package/dist/recipes/sequential-execution.js.map +1 -0
- package/dist/recipes/service-types.d.ts +87 -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 +73 -0
- package/dist/recipes/service.d.ts.map +1 -0
- package/dist/recipes/service.js +438 -0
- package/dist/recipes/service.js.map +1 -0
- package/dist/recipes/types.d.ts +155 -0
- package/dist/recipes/types.d.ts.map +1 -0
- package/dist/recipes/types.js +56 -0
- package/dist/recipes/types.js.map +1 -0
- package/dist/scaffold/config-block.d.ts +17 -0
- package/dist/scaffold/config-block.d.ts.map +1 -0
- package/dist/scaffold/config-block.js +30 -0
- package/dist/scaffold/config-block.js.map +1 -0
- package/dist/scaffold/examples.d.ts +30 -0
- package/dist/scaffold/examples.d.ts.map +1 -0
- package/dist/scaffold/examples.js +129 -0
- package/dist/scaffold/examples.js.map +1 -0
- package/dist/scope-augmentation.d.ts +77 -0
- package/dist/scope-augmentation.d.ts.map +1 -0
- package/dist/scope-augmentation.js +31 -0
- package/dist/scope-augmentation.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 +141 -0
- package/dist/signalers/__tests__/loader.test.js.map +1 -0
- package/dist/signalers/__tests__/violation-to-signal.test.d.ts +2 -0
- package/dist/signalers/__tests__/violation-to-signal.test.d.ts.map +1 -0
- package/dist/signalers/__tests__/violation-to-signal.test.js +59 -0
- package/dist/signalers/__tests__/violation-to-signal.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 +30 -0
- package/dist/signalers/loader.d.ts.map +1 -0
- package/dist/signalers/loader.js +120 -0
- package/dist/signalers/loader.js.map +1 -0
- package/dist/signalers/schema.d.ts +60 -0
- package/dist/signalers/schema.d.ts.map +1 -0
- package/dist/signalers/schema.js +74 -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/signalers/violation-to-signal.d.ts +38 -0
- package/dist/signalers/violation-to-signal.d.ts.map +1 -0
- package/dist/signalers/violation-to-signal.js +43 -0
- package/dist/signalers/violation-to-signal.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 +190 -0
- package/dist/targets/__tests__/loader.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 +182 -0
- package/dist/targets/__tests__/target-registry.test.js.map +1 -0
- package/dist/targets/index.d.ts +18 -0
- package/dist/targets/index.d.ts.map +1 -0
- package/dist/targets/index.js +21 -0
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/loader.d.ts +27 -0
- package/dist/targets/loader.d.ts.map +1 -0
- package/dist/targets/loader.js +178 -0
- package/dist/targets/loader.js.map +1 -0
- package/dist/targets/target-registry.d.ts +41 -0
- package/dist/targets/target-registry.d.ts.map +1 -0
- package/dist/targets/target-registry.js +71 -0
- package/dist/targets/target-registry.js.map +1 -0
- package/dist/targets/types.d.ts +14 -0
- package/dist/targets/types.d.ts.map +1 -0
- package/dist/targets/types.js +14 -0
- package/dist/targets/types.js.map +1 -0
- package/dist/tool.d.ts +61 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +260 -0
- package/dist/tool.js.map +1 -0
- package/dist/types/findings.d.ts +113 -0
- package/dist/types/findings.d.ts.map +1 -0
- package/dist/types/findings.js +89 -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 +33 -0
- package/dist/types/severity.js.map +1 -0
- package/package.json +137 -0
package/dist/tool.js
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fitnessTool — fitness as a Tool plugin.
|
|
3
|
+
*
|
|
4
|
+
* Owns the `fit`, `fit-list`, `fit-recipes`, and `fit-baseline-export`
|
|
5
|
+
* subcommands. Since release 2.11.0 (Phase 4) the Commander wiring is no longer
|
|
6
|
+
* hand-rolled: the tool exports declarative {@link CommandSpec}s
|
|
7
|
+
* (`commandSpecs`) and the host's `mountCommandSpec` mounts them
|
|
8
|
+
* (name/description/aliases, the ADR-0021 common flags, each command's options)
|
|
9
|
+
* and owns the parse→handler→error→exit pipeline. This file owns only the
|
|
10
|
+
* fitness command-spec assembly + the live-view renderer wiring; the spec
|
|
11
|
+
* modules under `cli/fit/` own the option declarations and handler bodies. (The
|
|
12
|
+
* standalone `report` subcommand is owned by the CLI, which composes it from
|
|
13
|
+
* every tool's contributed data — see
|
|
14
|
+
* packages/cli/src/commands/host-command-specs.ts — and migrates with the host
|
|
15
|
+
* commands in Phase 6.)
|
|
16
|
+
*
|
|
17
|
+
* Two-key registration invariant
|
|
18
|
+
* ------------------------------
|
|
19
|
+
* Fitness contributes TWO distinct identifiers to the CLI's registries
|
|
20
|
+
* and the mismatch is intentional — do not collapse them:
|
|
21
|
+
*
|
|
22
|
+
* - `metadata.id = 'fitness'` is the package-wide tool identifier
|
|
23
|
+
* (conflict-detection key in the CLI-managed tool registry).
|
|
24
|
+
*
|
|
25
|
+
* - `FIT_LIVE_VIEW_KEY = 'fit'` is the live-view key. Used to call
|
|
26
|
+
* `cli.registerLiveView('fit', renderer)` and consumed by
|
|
27
|
+
* `cli.renderLive('fit', args)` in `runLiveMode`. The key matches
|
|
28
|
+
* the `fit` subcommand name so the dispatcher's `renderLive(key)`
|
|
29
|
+
* reads naturally next to the command that triggers it.
|
|
30
|
+
*
|
|
31
|
+
* Layer 5 Phase 3 (closes audit 2026-05-23 F3): fitness now ships its
|
|
32
|
+
* own Ink/React renderer (`renderFitLive` in `cli/fit-runner.tsx`)
|
|
33
|
+
* and registers it directly via `cli.registerLiveView`. The prior
|
|
34
|
+
* `cli.builtinLiveViews` self-lookup handshake is gone.
|
|
35
|
+
*
|
|
36
|
+
* In the spec-mounted world there is no `register()` mount hook, so the live-view
|
|
37
|
+
* renderer is registered lazily on the host context (via {@link setUpFitLiveView})
|
|
38
|
+
* the first time a live `fit` run needs it. `registerLiveView` is an idempotent
|
|
39
|
+
* map write, so doing this once per run — only on the interactive path that needs
|
|
40
|
+
* it — is equivalent to the old mount-time registration.
|
|
41
|
+
*
|
|
42
|
+
* Module layout
|
|
43
|
+
* -------------
|
|
44
|
+
* - This file owns the command-spec assembly + the tool descriptor.
|
|
45
|
+
* - `cli/fit/fit-command-spec.ts` owns the primary `fit` command spec + handler.
|
|
46
|
+
* - `cli/fit/fit-aux-command-specs.ts` owns the aux command specs.
|
|
47
|
+
* - `cli/fit-modes.ts` owns the dispatch branches (gate/list/recipes/json/live).
|
|
48
|
+
*/
|
|
49
|
+
import { readPackageVersion } from '@opensip-cli/core';
|
|
50
|
+
import { fitnessFingerprintStrategy } from './baseline-strategy.js';
|
|
51
|
+
import { fitBaselineExportCommandSpec, fitListCommandSpec, fitRecipesCommandSpec, } from './cli/fit/fit-aux-command-specs.js';
|
|
52
|
+
import { buildFitCommandSpec, FIT_LIVE_VIEW_KEY } from './cli/fit/fit-command-spec.js';
|
|
53
|
+
import { renderFitLive } from './cli/fit-runner.js';
|
|
54
|
+
import { fitRunWorkerCommandSpec } from './cli/fit-worker.js';
|
|
55
|
+
import { collectFitnessReportData } from './cli/report-data.js';
|
|
56
|
+
import { fitnessConfigDeclaration } from './config/fitness-config-schema.js';
|
|
57
|
+
import { createCheckRegistry, createFitnessLoadState, createRecipeRegistry, currentCheckRegistry, currentRecipeRegistry, } from './framework/scope-registry.js';
|
|
58
|
+
import { fitReplayFromSession } from './persistence/session-replay.js';
|
|
59
|
+
import { FIT_PLUGIN_LAYOUT } from './plugins/loader.js';
|
|
60
|
+
import { fitScaffoldConfigBlock } from './scaffold/config-block.js';
|
|
61
|
+
import { fitScaffoldExamples, fitStableExampleIds } from './scaffold/examples.js';
|
|
62
|
+
// Side-effect import: ensures the RunScope.fitness augmentation is loaded so
|
|
63
|
+
// `scope.fitness` is the correctly-typed slot here.
|
|
64
|
+
import './scope-augmentation.js';
|
|
65
|
+
// =============================================================================
|
|
66
|
+
// COMMAND DESCRIPTORS — used by --help listings and conflict detection.
|
|
67
|
+
// =============================================================================
|
|
68
|
+
const FIT = {
|
|
69
|
+
name: 'fit',
|
|
70
|
+
description: 'Run fitness checks',
|
|
71
|
+
};
|
|
72
|
+
const FIT_LIST = {
|
|
73
|
+
name: 'fit-list',
|
|
74
|
+
description: 'List available fitness checks',
|
|
75
|
+
};
|
|
76
|
+
const FIT_RECIPES = {
|
|
77
|
+
name: 'fit-recipes',
|
|
78
|
+
description: 'List available fitness recipes',
|
|
79
|
+
};
|
|
80
|
+
const FIT_BASELINE_EXPORT = {
|
|
81
|
+
name: 'fit-baseline-export',
|
|
82
|
+
description: 'Export the fit gate baseline (SARIF) from the datastore to a file',
|
|
83
|
+
};
|
|
84
|
+
const FIT_RUN_WORKER = {
|
|
85
|
+
name: 'fit-run-worker',
|
|
86
|
+
description: '[internal] Run fit headless and stream progress + result over IPC (forked by the live view)',
|
|
87
|
+
};
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// LIVE-VIEW SETUP + COMMAND-SPEC ASSEMBLY
|
|
90
|
+
// =============================================================================
|
|
91
|
+
/**
|
|
92
|
+
* Set fitness's live view (Layer 5 Phase 3) up on the host context — a
|
|
93
|
+
* synchronous, void-returning map write (named with the `setUp` prefix to signal
|
|
94
|
+
* that; `register*` would trip the `detached-promises` dogfood heuristic). Its
|
|
95
|
+
* effectful egress (cloud + `--report-to`) lives at the composition root:
|
|
96
|
+
* renderFitLive returns the run's envelope and this callback delivers it once
|
|
97
|
+
* the Ink app exits.
|
|
98
|
+
*
|
|
99
|
+
* In the spec-mounted world there is no `register()` mount hook, so the `fit`
|
|
100
|
+
* handler sets the renderer up lazily on the interactive path (before any
|
|
101
|
+
* `cli.renderLive` lookup). `registerLiveView` is an idempotent map write, so
|
|
102
|
+
* doing this once per run — only on the live path that needs it — is equivalent
|
|
103
|
+
* to the old mount-time registration.
|
|
104
|
+
*/
|
|
105
|
+
function setUpFitLiveView(cli) {
|
|
106
|
+
cli.registerLiveView(FIT_LIVE_VIEW_KEY, async (args, liveContext) => {
|
|
107
|
+
const fitArgs = args;
|
|
108
|
+
// The host always supplies the LiveViewContext (carrying the run timer for
|
|
109
|
+
// the summary provider). The renderer returns a ToolRunCompletion; the HOST
|
|
110
|
+
// persists its `session` after this resolves (host-owned-run-timing Phase 2).
|
|
111
|
+
const completion = await renderFitLive(fitArgs, liveContext, {
|
|
112
|
+
setExitCode: cli.setExitCode,
|
|
113
|
+
});
|
|
114
|
+
// Effectful egress lives at the composition root (ADR-0011 / ADR-0008):
|
|
115
|
+
// best-effort cloud sync + `--report-to` (which owns exit 4). Delivered
|
|
116
|
+
// ONCE, after the interactive Ink view exits. A content failure
|
|
117
|
+
// (critical/high signals) dominates a `--report-to` upload failure so a
|
|
118
|
+
// real failure is never masked by exit 4.
|
|
119
|
+
if (completion.envelope !== undefined) {
|
|
120
|
+
// ADR-0035: the host derives the findings exit from envelope.verdict.passed
|
|
121
|
+
// inside deliverSignals — no runFailed override on a normal run.
|
|
122
|
+
await cli.deliverSignals(completion.envelope, {
|
|
123
|
+
cwd: fitArgs.cwd,
|
|
124
|
+
reportTo: fitArgs.reportTo,
|
|
125
|
+
apiKey: fitArgs.apiKey,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// Return the completion so the host completes the lifecycle + persists the
|
|
129
|
+
// session contribution (the renderer no longer writes the session).
|
|
130
|
+
return completion;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Fitness's declarative command surface (release 2.11.0 Phase 4). The host
|
|
135
|
+
* mounts each spec via `mountCommandSpec`; fitness no longer touches Commander.
|
|
136
|
+
* The primary `fit` spec is built with `setUpFitLiveView` so the renderer wiring
|
|
137
|
+
* stays next to the `renderFitLive` import in this module.
|
|
138
|
+
*/
|
|
139
|
+
const fitCommandSpecs = [
|
|
140
|
+
buildFitCommandSpec(setUpFitLiveView),
|
|
141
|
+
fitListCommandSpec,
|
|
142
|
+
fitRecipesCommandSpec,
|
|
143
|
+
fitBaselineExportCommandSpec,
|
|
144
|
+
fitRunWorkerCommandSpec,
|
|
145
|
+
];
|
|
146
|
+
/**
|
|
147
|
+
* The fitness tool's REAL registrar for its `fit-pack` capability domain
|
|
148
|
+
* (§5.3 / Phase 4). The host registers the domain from fitness's manifest with
|
|
149
|
+
* a deferred placeholder, then swaps in this registrar once fitness's module
|
|
150
|
+
* loads. A routed contribution (already shape-checked against the domain's
|
|
151
|
+
* `requiredKeys: ['slug']` schema by the host) is registered into THIS run's
|
|
152
|
+
* scope-owned check registry — fitness owns the registration semantics.
|
|
153
|
+
*/
|
|
154
|
+
const registerFitCheck = (contribution) => {
|
|
155
|
+
currentCheckRegistry().register(contribution);
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* The fitness tool's registrar for its `fit-recipe` capability domain (§5.3
|
|
159
|
+
* separate-domains fold). A check pack's co-located `recipes` export is routed
|
|
160
|
+
* here by the SAME discovery walk that loads its checks. The host has already
|
|
161
|
+
* shape-checked each contribution against `requiredKeys: ['id', 'name']`; this
|
|
162
|
+
* silently skips a recipe whose id/name is already registered (mirroring the
|
|
163
|
+
* shared `registerRecipesFromMod` dedupe), so re-discovery is idempotent.
|
|
164
|
+
*/
|
|
165
|
+
const registerFitRecipe = (contribution) => {
|
|
166
|
+
const recipe = contribution;
|
|
167
|
+
const registry = currentRecipeRegistry();
|
|
168
|
+
if (registry.has(recipe.id) || registry.has(recipe.name))
|
|
169
|
+
return;
|
|
170
|
+
registry.register(recipe, { allowOverwrite: false });
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Per-run subscope contribution (D7). Called by the CLI's pre-action-hook
|
|
174
|
+
* after constructing the scope and before entering it; the kernel installs
|
|
175
|
+
* the returned `fitness` slot. Fresh check + recipe registries (and an empty
|
|
176
|
+
* `ensureChecksLoaded` lifecycle slot) per run so concurrent scopes carry
|
|
177
|
+
* independent fitness state.
|
|
178
|
+
*/
|
|
179
|
+
function contributeScope() {
|
|
180
|
+
return {
|
|
181
|
+
fitness: {
|
|
182
|
+
checks: createCheckRegistry(),
|
|
183
|
+
recipes: createRecipeRegistry(),
|
|
184
|
+
load: createFitnessLoadState(),
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
// =============================================================================
|
|
189
|
+
// Per-tool contract version (ADR-0047)
|
|
190
|
+
// =============================================================================
|
|
191
|
+
/**
|
|
192
|
+
* Per-tool contract version for the fitness-specific surface
|
|
193
|
+
* (defineCheck, analysis modes, check packs, recipes, etc.).
|
|
194
|
+
* Independent of the core TOOL_CONTRACT_VERSION (the generic Tool bus).
|
|
195
|
+
* Bumped only on actual changes to this surface; value = major.minor of the
|
|
196
|
+
* CLI release shipping the change (see ADR-0047).
|
|
197
|
+
*/
|
|
198
|
+
export const FITNESS_CONTRACT_VERSION = '1.0.0';
|
|
199
|
+
// =============================================================================
|
|
200
|
+
// EXPORT
|
|
201
|
+
// =============================================================================
|
|
202
|
+
export const FITNESS_STABLE_ID = 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224';
|
|
203
|
+
export const fitnessTool = {
|
|
204
|
+
metadata: {
|
|
205
|
+
id: FITNESS_STABLE_ID, // stable UUID (per ADR-0048; matches Checks `id` naming)
|
|
206
|
+
name: 'fitness', // human key (previously the value in `id`)
|
|
207
|
+
version: readPackageVersion(import.meta.url),
|
|
208
|
+
description: 'Run fitness checks against a codebase',
|
|
209
|
+
},
|
|
210
|
+
commands: [FIT, FIT_LIST, FIT_RECIPES, FIT_BASELINE_EXPORT, FIT_RUN_WORKER],
|
|
211
|
+
pluginLayout: FIT_PLUGIN_LAYOUT,
|
|
212
|
+
// Release 2.11.0 Phase 4: fitness declares its command surface; the host
|
|
213
|
+
// mounts each spec via mountCommandSpec. The deprecated `register()` fallback
|
|
214
|
+
// is gone — fitness no longer touches Commander.
|
|
215
|
+
commandSpecs: fitCommandSpecs,
|
|
216
|
+
contributeScope,
|
|
217
|
+
collectReportData: collectFitnessReportData,
|
|
218
|
+
sessionReplay: {
|
|
219
|
+
tool: 'fit',
|
|
220
|
+
replaySession: fitReplayFromSession,
|
|
221
|
+
},
|
|
222
|
+
// ADR-0023 Phase 4: fitness contributes its namespaced `fitness:` Zod schema
|
|
223
|
+
// (gate thresholds, disabledChecks, recipe) so the host composes +
|
|
224
|
+
// strict-validates the whole config document before dispatch. Shared
|
|
225
|
+
// targeting (targets/globalExcludes/checkOverrides) stays with
|
|
226
|
+
// SignalersConfigSchema because the fit hot path consumes target registries
|
|
227
|
+
// through that loader.
|
|
228
|
+
config: fitnessConfigDeclaration,
|
|
229
|
+
// §5.3 Phase 4: fitness owns the `fit-pack` capability domain (declared in
|
|
230
|
+
// its manifest). It supplies the REAL registrar so the host can replace the
|
|
231
|
+
// manifest-time deferred placeholder once fitness's module loads.
|
|
232
|
+
capabilityRegistrars: { 'fit-pack': registerFitCheck, 'fit-recipe': registerFitRecipe },
|
|
233
|
+
// ADR-0036: fitness's message-hash baseline identity (sha256(filePath\nruleId\n
|
|
234
|
+
// message)), read by the host baseline/ratchet seams when fit stamps its gate
|
|
235
|
+
// envelope. Excludes line/col so unrelated line-shifts don't flap the ratchet.
|
|
236
|
+
fingerprintStrategy: fitnessFingerprintStrategy,
|
|
237
|
+
// ADR-0038: fitness owns its `init` example bytes + the pinned check-id universe.
|
|
238
|
+
// The host writes each returned file under userPluginDir('fit', file.kind).
|
|
239
|
+
scaffoldExamples: fitScaffoldExamples,
|
|
240
|
+
stableExampleIds: fitStableExampleIds,
|
|
241
|
+
// ADR-0038 Decision 2: fitness owns its `fitness:` config block (inline guidance
|
|
242
|
+
// comments the bare ToolConfigDeclaration.defaults can't express → the hook route).
|
|
243
|
+
scaffoldConfigBlock: fitScaffoldConfigBlock,
|
|
244
|
+
initialize: async () => {
|
|
245
|
+
// ensureChecksLoaded() is called inside the executeFit / listChecks
|
|
246
|
+
// / listRecipes paths, so a separate initialize() pass is not
|
|
247
|
+
// strictly needed today. Left as a no-op so fitness has somewhere
|
|
248
|
+
// to hang future tool-startup work (eager check-pack discovery,
|
|
249
|
+
// catalog warming, etc.) without requiring a contract change.
|
|
250
|
+
},
|
|
251
|
+
// ADR-0047: per-tool contract version for the fitness-specific surface
|
|
252
|
+
// (defineCheck, analysis modes, check packs, recipes, etc.). This is
|
|
253
|
+
// independent of the core TOOL_CONTRACT_VERSION (the generic Tool bus).
|
|
254
|
+
// Declared here so agent-catalog, compatibility logic, and external
|
|
255
|
+
// fitness pack authors can see the exact surface this tool was written against.
|
|
256
|
+
extensionPoints: {
|
|
257
|
+
fitnessContractVersion: FITNESS_CONTRACT_VERSION,
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
//# sourceMappingURL=tool.js.map
|
package/dist/tool.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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B,yEAAyE;IACzE,8EAA8E;IAC9E,iDAAiD;IACjD,YAAY,EAAE,eAAe;IAC7B,eAAe;IACf,iBAAiB,EAAE,wBAAwB;IAC3C,aAAa,EAAE;QACb,IAAI,EAAE,KAAK;QACX,aAAa,EAAE,oBAAoB;KACpC;IACD,6EAA6E;IAC7E,mEAAmE;IACnE,qEAAqE;IACrE,+DAA+D;IAC/D,4EAA4E;IAC5E,uBAAuB;IACvB,MAAM,EAAE,wBAAwB;IAChC,2EAA2E;IAC3E,4EAA4E;IAC5E,kEAAkE;IAClE,oBAAoB,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE;IACvF,gFAAgF;IAChF,8EAA8E;IAC9E,+EAA+E;IAC/E,mBAAmB,EAAE,0BAA0B;IAC/C,kFAAkF;IAClF,4EAA4E;IAC5E,gBAAgB,EAAE,mBAAmB;IACrC,gBAAgB,EAAE,mBAAmB;IACrC,iFAAiF;IACjF,oFAAoF;IACpF,mBAAmB,EAAE,sBAAsB;IAC3C,UAAU,EAAE,KAAK,IAAmB,EAAE;QACpC,oEAAoE;QACpE,8DAA8D;QAC9D,kEAAkE;QAClE,gEAAgE;QAChE,8DAA8D;IAChE,CAAC;IACD,uEAAuE;IACvE,qEAAqE;IACrE,wEAAwE;IACxE,oEAAoE;IACpE,gFAAgF;IAChF,eAAe,EAAE;QACf,sBAAsB,EAAE,wBAAwB;KACjD;CACF,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Core finding and result types for fitness checks
|
|
3
|
+
*
|
|
4
|
+
* CheckResult carries Signal[]. Factory functions
|
|
5
|
+
* (createResultWithSignals, createErrorResult) provide
|
|
6
|
+
* the standard way to construct check results.
|
|
7
|
+
*/
|
|
8
|
+
import type { DirectiveEntry } from '../framework/directive-inventory.js';
|
|
9
|
+
import type { Signal } from '@opensip-cli/core';
|
|
10
|
+
/**
|
|
11
|
+
* Severity level for findings and violations.
|
|
12
|
+
*/
|
|
13
|
+
export type FindingSeverity = 'error' | 'warning';
|
|
14
|
+
/**
|
|
15
|
+
* Alias for FindingSeverity — used by simplified check.ts types.
|
|
16
|
+
*/
|
|
17
|
+
export type Severity = FindingSeverity;
|
|
18
|
+
/**
|
|
19
|
+
* A single finding from a fitness check (output format).
|
|
20
|
+
*/
|
|
21
|
+
export interface Finding {
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly severity: Severity;
|
|
24
|
+
readonly filePath?: string;
|
|
25
|
+
readonly line?: number;
|
|
26
|
+
readonly column?: number;
|
|
27
|
+
readonly suggestion?: string;
|
|
28
|
+
readonly metadata?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Output from a tool-based check.
|
|
32
|
+
*/
|
|
33
|
+
export interface ToolOutput {
|
|
34
|
+
readonly stdout: string;
|
|
35
|
+
readonly stderr: string;
|
|
36
|
+
readonly exitCode: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check info for display.
|
|
40
|
+
*/
|
|
41
|
+
export interface CheckInfo {
|
|
42
|
+
/** Summary label (e.g., "142/150 files compliant") */
|
|
43
|
+
readonly label: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Metadata about a check run.
|
|
47
|
+
*/
|
|
48
|
+
export interface CheckResultMetadata {
|
|
49
|
+
/** Total items scanned */
|
|
50
|
+
readonly totalItems: number;
|
|
51
|
+
/** Signals (same reference as top-level) */
|
|
52
|
+
readonly signals: readonly Signal[];
|
|
53
|
+
/** Duration in milliseconds */
|
|
54
|
+
readonly durationMs?: number;
|
|
55
|
+
/** Number of files scanned from filesystem */
|
|
56
|
+
readonly filesScanned?: number;
|
|
57
|
+
/** Item type (e.g., 'files', 'modules') */
|
|
58
|
+
readonly itemType?: string;
|
|
59
|
+
/** Extra metadata */
|
|
60
|
+
readonly extra?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Result of running a fitness check.
|
|
64
|
+
* Now carries universal Signal[] instead of domain-specific violations.
|
|
65
|
+
*/
|
|
66
|
+
export interface CheckResult {
|
|
67
|
+
/** Whether the check passed (no errors) */
|
|
68
|
+
readonly passed: boolean;
|
|
69
|
+
/** Number of error-level signals */
|
|
70
|
+
readonly errors: number;
|
|
71
|
+
/** Number of warning-level signals */
|
|
72
|
+
readonly warnings: number;
|
|
73
|
+
/** All signals */
|
|
74
|
+
readonly signals: readonly Signal[];
|
|
75
|
+
/** Display info */
|
|
76
|
+
readonly info: CheckInfo;
|
|
77
|
+
/** Run metadata */
|
|
78
|
+
readonly metadata: CheckResultMetadata;
|
|
79
|
+
/** Count of violations ignored via directives */
|
|
80
|
+
readonly ignoredCount?: number;
|
|
81
|
+
/** Directives that actually suppressed signals during this check's execution */
|
|
82
|
+
readonly appliedDirectives?: readonly DirectiveEntry[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Item types for check info display.
|
|
86
|
+
*/
|
|
87
|
+
export type ItemType = 'files' | 'modules' | 'packages' | 'functions' | 'classes' | 'components' | 'tests' | 'endpoints' | 'dependencies' | 'issues' | 'violations' | 'rules' | 'recipes' | 'checks';
|
|
88
|
+
/**
|
|
89
|
+
* Get a human-readable label for an item type.
|
|
90
|
+
*/
|
|
91
|
+
export declare function getItemTypeLabel(type: ItemType, count: number): string;
|
|
92
|
+
/**
|
|
93
|
+
* Factory for creating CheckInfo objects.
|
|
94
|
+
*/
|
|
95
|
+
export declare const CheckInfoFactory: Readonly<{
|
|
96
|
+
compliance(compliantItems: number, totalItems: number, unit: string): CheckInfo;
|
|
97
|
+
violations(count: number, unit: string): CheckInfo;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Create a result with signals.
|
|
101
|
+
*/
|
|
102
|
+
export declare function createResultWithSignals(info: CheckInfo, signals: readonly Signal[], totalItems: number, options?: {
|
|
103
|
+
ignoredCount?: number;
|
|
104
|
+
durationMs?: number;
|
|
105
|
+
filesScanned?: number;
|
|
106
|
+
itemType?: string;
|
|
107
|
+
extra?: Record<string, unknown>;
|
|
108
|
+
}): CheckResult;
|
|
109
|
+
/**
|
|
110
|
+
* Create an error result (for check failures).
|
|
111
|
+
*/
|
|
112
|
+
export declare function createErrorResult(message: string, error?: Error): CheckResult;
|
|
113
|
+
//# sourceMappingURL=findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["../../src/types/findings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;AAElD;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAMD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,sDAAs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,GACZ,OAAO,GACP,SAAS,GACT,QAAQ,CAAC;AAmBb;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtE;AAMD;;GAEG;AACH,eAAO,MAAM,gBAAgB;+BACA,MAAM,cAAc,MAAM,QAAQ,MAAM,GAAG,SAAS;sBAG7D,MAAM,QAAQ,MAAM,GAAG,SAAS;EAGlD,CAAC;AAEH;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,GACA,WAAW,CAsBb;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,WAAW,CAe7E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Core finding and result types for fitness checks
|
|
3
|
+
*
|
|
4
|
+
* CheckResult carries Signal[]. Factory functions
|
|
5
|
+
* (createResultWithSignals, createErrorResult) provide
|
|
6
|
+
* the standard way to construct check results.
|
|
7
|
+
*/
|
|
8
|
+
import { countErrors, countWarnings } from './severity.js';
|
|
9
|
+
const ITEM_TYPE_SINGULAR = {
|
|
10
|
+
files: 'file',
|
|
11
|
+
modules: 'module',
|
|
12
|
+
packages: 'package',
|
|
13
|
+
functions: 'function',
|
|
14
|
+
classes: 'class',
|
|
15
|
+
components: 'component',
|
|
16
|
+
tests: 'test',
|
|
17
|
+
endpoints: 'endpoint',
|
|
18
|
+
dependencies: 'dependency',
|
|
19
|
+
issues: 'issue',
|
|
20
|
+
violations: 'violation',
|
|
21
|
+
rules: 'rule',
|
|
22
|
+
recipes: 'recipe',
|
|
23
|
+
checks: 'check',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Get a human-readable label for an item type.
|
|
27
|
+
*/
|
|
28
|
+
export function getItemTypeLabel(type, count) {
|
|
29
|
+
return count === 1 ? ITEM_TYPE_SINGULAR[type] : type;
|
|
30
|
+
}
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// FACTORY FUNCTIONS
|
|
33
|
+
// =============================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Factory for creating CheckInfo objects.
|
|
36
|
+
*/
|
|
37
|
+
export const CheckInfoFactory = Object.freeze({
|
|
38
|
+
compliance(compliantItems, totalItems, unit) {
|
|
39
|
+
return { label: `${compliantItems}/${totalItems} ${unit} compliant` };
|
|
40
|
+
},
|
|
41
|
+
violations(count, unit) {
|
|
42
|
+
return { label: count === 0 ? `No ${unit}` : `${count} ${unit}` };
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Create a result with signals.
|
|
47
|
+
*/
|
|
48
|
+
export function createResultWithSignals(info, signals, totalItems, options) {
|
|
49
|
+
const errors = countErrors(signals);
|
|
50
|
+
const warnings = countWarnings(signals);
|
|
51
|
+
return {
|
|
52
|
+
passed: errors === 0,
|
|
53
|
+
errors,
|
|
54
|
+
warnings,
|
|
55
|
+
signals,
|
|
56
|
+
info,
|
|
57
|
+
metadata: {
|
|
58
|
+
totalItems,
|
|
59
|
+
signals,
|
|
60
|
+
durationMs: options?.durationMs,
|
|
61
|
+
filesScanned: options?.filesScanned,
|
|
62
|
+
itemType: options?.itemType,
|
|
63
|
+
extra: options?.extra,
|
|
64
|
+
},
|
|
65
|
+
...(options?.ignoredCount !== undefined && options.ignoredCount > 0
|
|
66
|
+
? { ignoredCount: options.ignoredCount }
|
|
67
|
+
: {}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create an error result (for check failures).
|
|
72
|
+
*/
|
|
73
|
+
export function createErrorResult(message, error) {
|
|
74
|
+
return {
|
|
75
|
+
passed: false,
|
|
76
|
+
errors: 1,
|
|
77
|
+
warnings: 0,
|
|
78
|
+
signals: [],
|
|
79
|
+
info: { label: `Error: ${message}` },
|
|
80
|
+
metadata: {
|
|
81
|
+
totalItems: 0,
|
|
82
|
+
signals: [],
|
|
83
|
+
extra: error
|
|
84
|
+
? { originalError: error.message, ...(error.stack ? { stack: error.stack } : {}) }
|
|
85
|
+
: undefined,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.js","sourceRoot":"","sources":["../../src/types/findings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAsH3D,MAAM,kBAAkB,GAA6B;IACnD,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,WAAW;IACvB,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,UAAU;IACrB,YAAY,EAAE,YAAY;IAC1B,MAAM,EAAE,OAAO;IACf,UAAU,EAAE,WAAW;IACvB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,OAAO;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAc,EAAE,KAAa;IAC5D,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC;AAED,gFAAgF;AAChF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K;QACb,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,OAAO,EAAE,EAAE;QACpC,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,KAAK;gBACV,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;gBAClF,CAAC,CAAC,SAAS;SACd;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared severity classification helpers
|
|
3
|
+
*
|
|
4
|
+
* Centralizes severity-based signal filtering and counting logic
|
|
5
|
+
* used across types, framework, and recipes modules.
|
|
6
|
+
*/
|
|
7
|
+
/** Count error-level signals in an array */
|
|
8
|
+
export declare function countErrors(signals: readonly {
|
|
9
|
+
severity: string;
|
|
10
|
+
}[]): number;
|
|
11
|
+
/** Count warning-level signals in an array */
|
|
12
|
+
export declare function countWarnings(signals: readonly {
|
|
13
|
+
severity: string;
|
|
14
|
+
}[]): number;
|
|
15
|
+
//# sourceMappingURL=severity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"severity.d.ts","sourceRoot":"","sources":["../../src/types/severity.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAWH,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAM5E;AAED,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAM9E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @fitness-ignore-file batch-operation-limits -- iterates bounded collections (config entries, registry items, or small analysis results)
|
|
2
|
+
// @fitness-ignore-file clean-code-naming-quality -- short names used in severity mapping utilities
|
|
3
|
+
// @fitness-ignore-file project-readme-existence -- internal module, not a package root
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Shared severity classification helpers
|
|
6
|
+
*
|
|
7
|
+
* Centralizes severity-based signal filtering and counting logic
|
|
8
|
+
* used across types, framework, and recipes modules.
|
|
9
|
+
*/
|
|
10
|
+
import { isErrorSeverity } from '@opensip-cli/core';
|
|
11
|
+
/** Returns true for 'medium' severity signals (warning-level) */
|
|
12
|
+
function isWarningSeverity(severity) {
|
|
13
|
+
return severity === 'medium';
|
|
14
|
+
}
|
|
15
|
+
/** Count error-level signals in an array */
|
|
16
|
+
export function countErrors(signals) {
|
|
17
|
+
let count = 0;
|
|
18
|
+
for (const s of signals) {
|
|
19
|
+
if (isErrorSeverity(s.severity))
|
|
20
|
+
count++;
|
|
21
|
+
}
|
|
22
|
+
return count;
|
|
23
|
+
}
|
|
24
|
+
/** Count warning-level signals in an array */
|
|
25
|
+
export function countWarnings(signals) {
|
|
26
|
+
let count = 0;
|
|
27
|
+
for (const s of signals) {
|
|
28
|
+
if (isWarningSeverity(s.severity))
|
|
29
|
+
count++;
|
|
30
|
+
}
|
|
31
|
+
return count;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=severity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"severity.js","sourceRoot":"","sources":["../../src/types/severity.ts"],"names":[],"mappings":"AAAA,0IAA0I;AAC1I,mGAAmG;AACnG,uFAAuF;AACvF;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,iEAAiE;AACjE,SAAS,iBAAiB,CAAC,QAAwB;IACjD,OAAO,QAAQ,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,WAAW,CAAC,OAAwC;IAClE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,eAAe,CAAC,CAAC,CAAC,QAA0B,CAAC;YAAE,KAAK,EAAE,CAAC;IAC7D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,aAAa,CAAC,OAAwC;IACpE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,iBAAiB,CAAC,CAAC,CAAC,QAA0B,CAAC;YAAE,KAAK,EAAE,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|