@opensip-cli/core 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__/config-resolution.test.d.ts +2 -0
- package/dist/__tests__/config-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/config-resolution.test.js +94 -0
- package/dist/__tests__/config-resolution.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +16 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +209 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/signal-batch.test.d.ts +2 -0
- package/dist/__tests__/signal-batch.test.d.ts.map +1 -0
- package/dist/__tests__/signal-batch.test.js +39 -0
- package/dist/__tests__/signal-batch.test.js.map +1 -0
- package/dist/__tests__/signal-sink.test.d.ts +2 -0
- package/dist/__tests__/signal-sink.test.d.ts.map +1 -0
- package/dist/__tests__/signal-sink.test.js +25 -0
- package/dist/__tests__/signal-sink.test.js.map +1 -0
- package/dist/__tests__/strip-utils.test.d.ts +2 -0
- package/dist/__tests__/strip-utils.test.d.ts.map +1 -0
- package/dist/__tests__/strip-utils.test.js +397 -0
- package/dist/__tests__/strip-utils.test.js.map +1 -0
- package/dist/__tests__/text-tree.test.d.ts +2 -0
- package/dist/__tests__/text-tree.test.d.ts.map +1 -0
- package/dist/__tests__/text-tree.test.js +31 -0
- package/dist/__tests__/text-tree.test.js.map +1 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts +2 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts.map +1 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.js +69 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.js.map +1 -0
- package/dist/baseline/fingerprint-strategy.d.ts +70 -0
- package/dist/baseline/fingerprint-strategy.d.ts.map +1 -0
- package/dist/baseline/fingerprint-strategy.js +90 -0
- package/dist/baseline/fingerprint-strategy.js.map +1 -0
- package/dist/config-resolution.d.ts +27 -0
- package/dist/config-resolution.d.ts.map +1 -0
- package/dist/config-resolution.js +92 -0
- package/dist/config-resolution.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.d.ts +2 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.js +87 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.js.map +1 -0
- package/dist/languages/__tests__/non-code-formats.test.d.ts +2 -0
- package/dist/languages/__tests__/non-code-formats.test.d.ts.map +1 -0
- package/dist/languages/__tests__/non-code-formats.test.js +31 -0
- package/dist/languages/__tests__/non-code-formats.test.js.map +1 -0
- package/dist/languages/__tests__/parse-cache.test.d.ts +2 -0
- package/dist/languages/__tests__/parse-cache.test.d.ts.map +1 -0
- package/dist/languages/__tests__/parse-cache.test.js +228 -0
- package/dist/languages/__tests__/parse-cache.test.js.map +1 -0
- package/dist/languages/__tests__/registry.test.d.ts +2 -0
- package/dist/languages/__tests__/registry.test.d.ts.map +1 -0
- package/dist/languages/__tests__/registry.test.js +193 -0
- package/dist/languages/__tests__/registry.test.js.map +1 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.d.ts +2 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.d.ts.map +1 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.js +66 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.js.map +1 -0
- package/dist/languages/adapter.d.ts +66 -0
- package/dist/languages/adapter.d.ts.map +1 -0
- package/dist/languages/adapter.js +2 -0
- package/dist/languages/adapter.js.map +1 -0
- package/dist/languages/content-filter-dispatch.d.ts +36 -0
- package/dist/languages/content-filter-dispatch.d.ts.map +1 -0
- package/dist/languages/content-filter-dispatch.js +75 -0
- package/dist/languages/content-filter-dispatch.js.map +1 -0
- package/dist/languages/generic-types.d.ts +22 -0
- package/dist/languages/generic-types.d.ts.map +1 -0
- package/dist/languages/generic-types.js +3 -0
- package/dist/languages/generic-types.js.map +1 -0
- package/dist/languages/index.d.ts +12 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +7 -0
- package/dist/languages/index.js.map +1 -0
- package/dist/languages/non-code-formats.d.ts +37 -0
- package/dist/languages/non-code-formats.d.ts.map +1 -0
- package/dist/languages/non-code-formats.js +45 -0
- package/dist/languages/non-code-formats.js.map +1 -0
- package/dist/languages/parse-cache-class.d.ts +69 -0
- package/dist/languages/parse-cache-class.d.ts.map +1 -0
- package/dist/languages/parse-cache-class.js +135 -0
- package/dist/languages/parse-cache-class.js.map +1 -0
- package/dist/languages/parse-cache.d.ts +54 -0
- package/dist/languages/parse-cache.d.ts.map +1 -0
- package/dist/languages/parse-cache.js +88 -0
- package/dist/languages/parse-cache.js.map +1 -0
- package/dist/languages/registry.d.ts +35 -0
- package/dist/languages/registry.d.ts.map +1 -0
- package/dist/languages/registry.js +123 -0
- package/dist/languages/registry.js.map +1 -0
- package/dist/languages/strip-scanners.d.ts +170 -0
- package/dist/languages/strip-scanners.d.ts.map +1 -0
- package/dist/languages/strip-scanners.js +233 -0
- package/dist/languages/strip-scanners.js.map +1 -0
- package/dist/languages/strip-utils.d.ts +66 -0
- package/dist/languages/strip-utils.d.ts.map +1 -0
- package/dist/languages/strip-utils.js +88 -0
- package/dist/languages/strip-utils.js.map +1 -0
- package/dist/languages/text-tree.d.ts +44 -0
- package/dist/languages/text-tree.d.ts.map +1 -0
- package/dist/languages/text-tree.js +34 -0
- package/dist/languages/text-tree.js.map +1 -0
- package/dist/languages/workspace-unit.d.ts +18 -0
- package/dist/languages/workspace-unit.d.ts.map +1 -0
- package/dist/languages/workspace-unit.js +2 -0
- package/dist/languages/workspace-unit.js.map +1 -0
- package/dist/lib/__tests__/config-version.test.d.ts +12 -0
- package/dist/lib/__tests__/config-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/config-version.test.js +92 -0
- package/dist/lib/__tests__/config-version.test.js.map +1 -0
- package/dist/lib/__tests__/diagnostics-bus.test.d.ts +7 -0
- package/dist/lib/__tests__/diagnostics-bus.test.d.ts.map +1 -0
- package/dist/lib/__tests__/diagnostics-bus.test.js +44 -0
- package/dist/lib/__tests__/diagnostics-bus.test.js.map +1 -0
- package/dist/lib/__tests__/env-registry.test.d.ts +7 -0
- package/dist/lib/__tests__/env-registry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/env-registry.test.js +82 -0
- package/dist/lib/__tests__/env-registry.test.js.map +1 -0
- package/dist/lib/__tests__/errors.test.d.ts +2 -0
- package/dist/lib/__tests__/errors.test.d.ts.map +1 -0
- package/dist/lib/__tests__/errors.test.js +218 -0
- package/dist/lib/__tests__/errors.test.js.map +1 -0
- package/dist/lib/__tests__/format.test.d.ts +2 -0
- package/dist/lib/__tests__/format.test.d.ts.map +1 -0
- package/dist/lib/__tests__/format.test.js +23 -0
- package/dist/lib/__tests__/format.test.js.map +1 -0
- package/dist/lib/__tests__/ids.test.d.ts +2 -0
- package/dist/lib/__tests__/ids.test.d.ts.map +1 -0
- package/dist/lib/__tests__/ids.test.js +80 -0
- package/dist/lib/__tests__/ids.test.js.map +1 -0
- package/dist/lib/__tests__/logger.test.d.ts +2 -0
- package/dist/lib/__tests__/logger.test.d.ts.map +1 -0
- package/dist/lib/__tests__/logger.test.js +284 -0
- package/dist/lib/__tests__/logger.test.js.map +1 -0
- package/dist/lib/__tests__/package-version.test.d.ts +2 -0
- package/dist/lib/__tests__/package-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/package-version.test.js +47 -0
- package/dist/lib/__tests__/package-version.test.js.map +1 -0
- package/dist/lib/__tests__/paths.test.d.ts +5 -0
- package/dist/lib/__tests__/paths.test.d.ts.map +1 -0
- package/dist/lib/__tests__/paths.test.js +59 -0
- package/dist/lib/__tests__/paths.test.js.map +1 -0
- package/dist/lib/__tests__/payload-version.test.d.ts +2 -0
- package/dist/lib/__tests__/payload-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/payload-version.test.js +35 -0
- package/dist/lib/__tests__/payload-version.test.js.map +1 -0
- package/dist/lib/__tests__/phantom-detect.test.d.ts +10 -0
- package/dist/lib/__tests__/phantom-detect.test.d.ts.map +1 -0
- package/dist/lib/__tests__/phantom-detect.test.js +84 -0
- package/dist/lib/__tests__/phantom-detect.test.js.map +1 -0
- package/dist/lib/__tests__/project-context.test.d.ts +10 -0
- package/dist/lib/__tests__/project-context.test.d.ts.map +1 -0
- package/dist/lib/__tests__/project-context.test.js +240 -0
- package/dist/lib/__tests__/project-context.test.js.map +1 -0
- package/dist/lib/__tests__/registry.test.d.ts +2 -0
- package/dist/lib/__tests__/registry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/registry.test.js +333 -0
- package/dist/lib/__tests__/registry.test.js.map +1 -0
- package/dist/lib/__tests__/retry.test.d.ts +2 -0
- package/dist/lib/__tests__/retry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/retry.test.js +71 -0
- package/dist/lib/__tests__/retry.test.js.map +1 -0
- package/dist/lib/__tests__/run-diagnostics.test.d.ts +9 -0
- package/dist/lib/__tests__/run-diagnostics.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-diagnostics.test.js +61 -0
- package/dist/lib/__tests__/run-diagnostics.test.js.map +1 -0
- package/dist/lib/__tests__/run-scope.test.d.ts +2 -0
- package/dist/lib/__tests__/run-scope.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-scope.test.js +202 -0
- package/dist/lib/__tests__/run-scope.test.js.map +1 -0
- package/dist/lib/__tests__/run-timer.test.d.ts +2 -0
- package/dist/lib/__tests__/run-timer.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-timer.test.js +152 -0
- package/dist/lib/__tests__/run-timer.test.js.map +1 -0
- package/dist/lib/__tests__/severity-policy.test.d.ts +6 -0
- package/dist/lib/__tests__/severity-policy.test.d.ts.map +1 -0
- package/dist/lib/__tests__/severity-policy.test.js +47 -0
- package/dist/lib/__tests__/severity-policy.test.js.map +1 -0
- package/dist/lib/__tests__/telemetry.test.d.ts +2 -0
- package/dist/lib/__tests__/telemetry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/telemetry.test.js +212 -0
- package/dist/lib/__tests__/telemetry.test.js.map +1 -0
- package/dist/lib/__tests__/verdict-policy.test.d.ts +7 -0
- package/dist/lib/__tests__/verdict-policy.test.d.ts.map +1 -0
- package/dist/lib/__tests__/verdict-policy.test.js +91 -0
- package/dist/lib/__tests__/verdict-policy.test.js.map +1 -0
- package/dist/lib/__tests__/yaml.test.d.ts +6 -0
- package/dist/lib/__tests__/yaml.test.d.ts.map +1 -0
- package/dist/lib/__tests__/yaml.test.js +79 -0
- package/dist/lib/__tests__/yaml.test.js.map +1 -0
- package/dist/lib/config-version.d.ts +49 -0
- package/dist/lib/config-version.d.ts.map +1 -0
- package/dist/lib/config-version.js +56 -0
- package/dist/lib/config-version.js.map +1 -0
- package/dist/lib/diagnostics-bus.d.ts +48 -0
- package/dist/lib/diagnostics-bus.d.ts.map +1 -0
- package/dist/lib/diagnostics-bus.js +74 -0
- package/dist/lib/diagnostics-bus.js.map +1 -0
- package/dist/lib/env-registry.d.ts +108 -0
- package/dist/lib/env-registry.d.ts.map +1 -0
- package/dist/lib/env-registry.js +92 -0
- package/dist/lib/env-registry.js.map +1 -0
- package/dist/lib/errors.d.ts +132 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +160 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/execution/__tests__/execution.test.d.ts +7 -0
- package/dist/lib/execution/__tests__/execution.test.d.ts.map +1 -0
- package/dist/lib/execution/__tests__/execution.test.js +254 -0
- package/dist/lib/execution/__tests__/execution.test.js.map +1 -0
- package/dist/lib/execution/index.d.ts +15 -0
- package/dist/lib/execution/index.d.ts.map +1 -0
- package/dist/lib/execution/index.js +10 -0
- package/dist/lib/execution/index.js.map +1 -0
- package/dist/lib/execution/options.d.ts +32 -0
- package/dist/lib/execution/options.d.ts.map +1 -0
- package/dist/lib/execution/options.js +15 -0
- package/dist/lib/execution/options.js.map +1 -0
- package/dist/lib/execution/pipeline.d.ts +36 -0
- package/dist/lib/execution/pipeline.d.ts.map +1 -0
- package/dist/lib/execution/pipeline.js +38 -0
- package/dist/lib/execution/pipeline.js.map +1 -0
- package/dist/lib/execution/retry.d.ts +38 -0
- package/dist/lib/execution/retry.d.ts.map +1 -0
- package/dist/lib/execution/retry.js +56 -0
- package/dist/lib/execution/retry.js.map +1 -0
- package/dist/lib/execution/run-with-timeout.d.ts +46 -0
- package/dist/lib/execution/run-with-timeout.d.ts.map +1 -0
- package/dist/lib/execution/run-with-timeout.js +86 -0
- package/dist/lib/execution/run-with-timeout.js.map +1 -0
- package/dist/lib/execution/schedule.d.ts +62 -0
- package/dist/lib/execution/schedule.d.ts.map +1 -0
- package/dist/lib/execution/schedule.js +130 -0
- package/dist/lib/execution/schedule.js.map +1 -0
- package/dist/lib/format.d.ts +17 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +26 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/ids.d.ts +13 -0
- package/dist/lib/ids.d.ts.map +1 -0
- package/dist/lib/ids.js +48 -0
- package/dist/lib/ids.js.map +1 -0
- package/dist/lib/logger.d.ts +166 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +283 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/package-version.d.ts +17 -0
- package/dist/lib/package-version.d.ts.map +1 -0
- package/dist/lib/package-version.js +52 -0
- package/dist/lib/package-version.js.map +1 -0
- package/dist/lib/paths.d.ts +139 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +105 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/payload-version.d.ts +15 -0
- package/dist/lib/payload-version.d.ts.map +1 -0
- package/dist/lib/payload-version.js +24 -0
- package/dist/lib/payload-version.js.map +1 -0
- package/dist/lib/phantom-detect.d.ts +21 -0
- package/dist/lib/phantom-detect.d.ts.map +1 -0
- package/dist/lib/phantom-detect.js +76 -0
- package/dist/lib/phantom-detect.js.map +1 -0
- package/dist/lib/project-context.d.ts +66 -0
- package/dist/lib/project-context.d.ts.map +1 -0
- package/dist/lib/project-context.js +112 -0
- package/dist/lib/project-context.js.map +1 -0
- package/dist/lib/recipe-id.d.ts +13 -0
- package/dist/lib/recipe-id.d.ts.map +1 -0
- package/dist/lib/recipe-id.js +15 -0
- package/dist/lib/recipe-id.js.map +1 -0
- package/dist/lib/registry.d.ts +98 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +152 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/retry.d.ts +26 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/lib/retry.js +48 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/run-diagnostics.d.ts +64 -0
- package/dist/lib/run-diagnostics.d.ts.map +1 -0
- package/dist/lib/run-diagnostics.js +25 -0
- package/dist/lib/run-diagnostics.js.map +1 -0
- package/dist/lib/run-scope.d.ts +167 -0
- package/dist/lib/run-scope.d.ts.map +1 -0
- package/dist/lib/run-scope.js +176 -0
- package/dist/lib/run-scope.js.map +1 -0
- package/dist/lib/run-timer.d.ts +82 -0
- package/dist/lib/run-timer.d.ts.map +1 -0
- package/dist/lib/run-timer.js +79 -0
- package/dist/lib/run-timer.js.map +1 -0
- package/dist/lib/scope-types.d.ts +172 -0
- package/dist/lib/scope-types.d.ts.map +1 -0
- package/dist/lib/scope-types.js +27 -0
- package/dist/lib/scope-types.js.map +1 -0
- package/dist/lib/severity-policy.d.ts +38 -0
- package/dist/lib/severity-policy.d.ts.map +1 -0
- package/dist/lib/severity-policy.js +44 -0
- package/dist/lib/severity-policy.js.map +1 -0
- package/dist/lib/telemetry.d.ts +93 -0
- package/dist/lib/telemetry.d.ts.map +1 -0
- package/dist/lib/telemetry.js +144 -0
- package/dist/lib/telemetry.js.map +1 -0
- package/dist/lib/ui-context.d.ts +34 -0
- package/dist/lib/ui-context.d.ts.map +1 -0
- package/dist/lib/ui-context.js +16 -0
- package/dist/lib/ui-context.js.map +1 -0
- package/dist/lib/verdict-policy.d.ts +71 -0
- package/dist/lib/verdict-policy.d.ts.map +1 -0
- package/dist/lib/verdict-policy.js +82 -0
- package/dist/lib/verdict-policy.js.map +1 -0
- package/dist/lib/yaml.d.ts +74 -0
- package/dist/lib/yaml.d.ts.map +1 -0
- package/dist/lib/yaml.js +118 -0
- package/dist/lib/yaml.js.map +1 -0
- package/dist/plugins/__tests__/as-if-external.test.d.ts +18 -0
- package/dist/plugins/__tests__/as-if-external.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/as-if-external.test.js +159 -0
- package/dist/plugins/__tests__/as-if-external.test.js.map +1 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts +8 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.js +97 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-discovery.test.js +349 -0
- package/dist/plugins/__tests__/capability-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.js +172 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-loader.test.js +122 -0
- package/dist/plugins/__tests__/capability-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-registry.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-registry.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-registry.test.js +185 -0
- package/dist/plugins/__tests__/capability-registry.test.js.map +1 -0
- package/dist/plugins/__tests__/discover.test.d.ts +2 -0
- package/dist/plugins/__tests__/discover.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/discover.test.js +311 -0
- package/dist/plugins/__tests__/discover.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 +191 -0
- package/dist/plugins/__tests__/loader.test.js.map +1 -0
- package/dist/plugins/__tests__/manifest-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/manifest-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/manifest-discovery.test.js +132 -0
- package/dist/plugins/__tests__/manifest-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/manifest-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/manifest-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/manifest-loader.test.js +434 -0
- package/dist/plugins/__tests__/manifest-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/marker-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/marker-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/marker-discovery.test.js +164 -0
- package/dist/plugins/__tests__/marker-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/node-modules-walk.test.d.ts +2 -0
- package/dist/plugins/__tests__/node-modules-walk.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/node-modules-walk.test.js +76 -0
- package/dist/plugins/__tests__/node-modules-walk.test.js.map +1 -0
- package/dist/plugins/__tests__/package-entry.test.d.ts +9 -0
- package/dist/plugins/__tests__/package-entry.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/package-entry.test.js +117 -0
- package/dist/plugins/__tests__/package-entry.test.js.map +1 -0
- package/dist/plugins/__tests__/recipe-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/recipe-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/recipe-loader.test.js +130 -0
- package/dist/plugins/__tests__/recipe-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/scope-validation.test.d.ts +2 -0
- package/dist/plugins/__tests__/scope-validation.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/scope-validation.test.js +68 -0
- package/dist/plugins/__tests__/scope-validation.test.js.map +1 -0
- package/dist/plugins/__tests__/single-core-guard.test.d.ts +10 -0
- package/dist/plugins/__tests__/single-core-guard.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/single-core-guard.test.js +89 -0
- package/dist/plugins/__tests__/single-core-guard.test.js.map +1 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.js +215 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.js.map +1 -0
- package/dist/plugins/authored-tool-discovery.d.ts +45 -0
- package/dist/plugins/authored-tool-discovery.d.ts.map +1 -0
- package/dist/plugins/authored-tool-discovery.js +61 -0
- package/dist/plugins/authored-tool-discovery.js.map +1 -0
- package/dist/plugins/capability-discovery.d.ts +80 -0
- package/dist/plugins/capability-discovery.d.ts.map +1 -0
- package/dist/plugins/capability-discovery.js +278 -0
- package/dist/plugins/capability-discovery.js.map +1 -0
- package/dist/plugins/capability-loader.d.ts +50 -0
- package/dist/plugins/capability-loader.d.ts.map +1 -0
- package/dist/plugins/capability-loader.js +85 -0
- package/dist/plugins/capability-loader.js.map +1 -0
- package/dist/plugins/capability-registry.d.ts +169 -0
- package/dist/plugins/capability-registry.d.ts.map +1 -0
- package/dist/plugins/capability-registry.js +319 -0
- package/dist/plugins/capability-registry.js.map +1 -0
- package/dist/plugins/discover.d.ts +64 -0
- package/dist/plugins/discover.d.ts.map +1 -0
- package/dist/plugins/discover.js +303 -0
- package/dist/plugins/discover.js.map +1 -0
- package/dist/plugins/index.d.ts +37 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +40 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/json-guards.d.ts +11 -0
- package/dist/plugins/json-guards.d.ts.map +1 -0
- package/dist/plugins/json-guards.js +15 -0
- package/dist/plugins/json-guards.js.map +1 -0
- package/dist/plugins/loader.d.ts +67 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +137 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manifest-discovery.d.ts +28 -0
- package/dist/plugins/manifest-discovery.d.ts.map +1 -0
- package/dist/plugins/manifest-discovery.js +103 -0
- package/dist/plugins/manifest-discovery.js.map +1 -0
- package/dist/plugins/manifest-loader.d.ts +120 -0
- package/dist/plugins/manifest-loader.d.ts.map +1 -0
- package/dist/plugins/manifest-loader.js +410 -0
- package/dist/plugins/manifest-loader.js.map +1 -0
- package/dist/plugins/marker-discovery.d.ts +115 -0
- package/dist/plugins/marker-discovery.d.ts.map +1 -0
- package/dist/plugins/marker-discovery.js +172 -0
- package/dist/plugins/marker-discovery.js.map +1 -0
- package/dist/plugins/node-modules-walk.d.ts +61 -0
- package/dist/plugins/node-modules-walk.d.ts.map +1 -0
- package/dist/plugins/node-modules-walk.js +99 -0
- package/dist/plugins/node-modules-walk.js.map +1 -0
- package/dist/plugins/package-entry.d.ts +38 -0
- package/dist/plugins/package-entry.d.ts.map +1 -0
- package/dist/plugins/package-entry.js +86 -0
- package/dist/plugins/package-entry.js.map +1 -0
- package/dist/plugins/recipe-loader.d.ts +63 -0
- package/dist/plugins/recipe-loader.d.ts.map +1 -0
- package/dist/plugins/recipe-loader.js +67 -0
- package/dist/plugins/recipe-loader.js.map +1 -0
- package/dist/plugins/scope-validation.d.ts +35 -0
- package/dist/plugins/scope-validation.d.ts.map +1 -0
- package/dist/plugins/scope-validation.js +55 -0
- package/dist/plugins/scope-validation.js.map +1 -0
- package/dist/plugins/single-core-guard.d.ts +28 -0
- package/dist/plugins/single-core-guard.d.ts.map +1 -0
- package/dist/plugins/single-core-guard.js +69 -0
- package/dist/plugins/single-core-guard.js.map +1 -0
- package/dist/plugins/tool-package-discovery.d.ts +93 -0
- package/dist/plugins/tool-package-discovery.d.ts.map +1 -0
- package/dist/plugins/tool-package-discovery.js +118 -0
- package/dist/plugins/tool-package-discovery.js.map +1 -0
- package/dist/plugins/types.d.ts +78 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +15 -0
- package/dist/plugins/types.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 +170 -0
- package/dist/recipes/__tests__/registry.test.js.map +1 -0
- package/dist/recipes/__tests__/selector.test.d.ts +20 -0
- package/dist/recipes/__tests__/selector.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/selector.test.js +173 -0
- package/dist/recipes/__tests__/selector.test.js.map +1 -0
- package/dist/recipes/__tests__/unit-config.test.d.ts +7 -0
- package/dist/recipes/__tests__/unit-config.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/unit-config.test.js +52 -0
- package/dist/recipes/__tests__/unit-config.test.js.map +1 -0
- package/dist/recipes/registry.d.ts +105 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +141 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/selector.d.ts +112 -0
- package/dist/recipes/selector.d.ts.map +1 -0
- package/dist/recipes/selector.js +134 -0
- package/dist/recipes/selector.js.map +1 -0
- package/dist/recipes/unit-config.d.ts +63 -0
- package/dist/recipes/unit-config.d.ts.map +1 -0
- package/dist/recipes/unit-config.js +68 -0
- package/dist/recipes/unit-config.js.map +1 -0
- package/dist/runtime/__tests__/in-process-transport.test.d.ts +6 -0
- package/dist/runtime/__tests__/in-process-transport.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/in-process-transport.test.js +73 -0
- package/dist/runtime/__tests__/in-process-transport.test.js.map +1 -0
- package/dist/runtime/__tests__/subprocess-transport.test.d.ts +11 -0
- package/dist/runtime/__tests__/subprocess-transport.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/subprocess-transport.test.js +118 -0
- package/dist/runtime/__tests__/subprocess-transport.test.js.map +1 -0
- package/dist/runtime/in-process-transport.d.ts +20 -0
- package/dist/runtime/in-process-transport.d.ts.map +1 -0
- package/dist/runtime/in-process-transport.js +49 -0
- package/dist/runtime/in-process-transport.js.map +1 -0
- package/dist/runtime/progress-transport.d.ts +73 -0
- package/dist/runtime/progress-transport.d.ts.map +1 -0
- package/dist/runtime/progress-transport.js +17 -0
- package/dist/runtime/progress-transport.js.map +1 -0
- package/dist/runtime/subprocess-transport.d.ts +43 -0
- package/dist/runtime/subprocess-transport.d.ts.map +1 -0
- package/dist/runtime/subprocess-transport.js +134 -0
- package/dist/runtime/subprocess-transport.js.map +1 -0
- package/dist/signals/comment-openers.d.ts +29 -0
- package/dist/signals/comment-openers.d.ts.map +1 -0
- package/dist/signals/comment-openers.js +41 -0
- package/dist/signals/comment-openers.js.map +1 -0
- package/dist/signals/comment-openers.test.d.ts +7 -0
- package/dist/signals/comment-openers.test.d.ts.map +1 -0
- package/dist/signals/comment-openers.test.js +41 -0
- package/dist/signals/comment-openers.test.js.map +1 -0
- package/dist/signals/create-signal-from-violation.d.ts +29 -0
- package/dist/signals/create-signal-from-violation.d.ts.map +1 -0
- package/dist/signals/create-signal-from-violation.js +29 -0
- package/dist/signals/create-signal-from-violation.js.map +1 -0
- package/dist/signals/signal-sink.d.ts +49 -0
- package/dist/signals/signal-sink.d.ts.map +1 -0
- package/dist/signals/signal-sink.js +6 -0
- package/dist/signals/signal-sink.js.map +1 -0
- package/dist/signals/suppress.d.ts +102 -0
- package/dist/signals/suppress.d.ts.map +1 -0
- package/dist/signals/suppress.js +325 -0
- package/dist/signals/suppress.js.map +1 -0
- package/dist/signals/suppress.test.d.ts +2 -0
- package/dist/signals/suppress.test.d.ts.map +1 -0
- package/dist/signals/suppress.test.js +213 -0
- package/dist/signals/suppress.test.js.map +1 -0
- package/dist/tools/__tests__/command-spec.test.d.ts +2 -0
- package/dist/tools/__tests__/command-spec.test.d.ts.map +1 -0
- package/dist/tools/__tests__/command-spec.test.js +191 -0
- package/dist/tools/__tests__/command-spec.test.js.map +1 -0
- package/dist/tools/__tests__/compatibility.test.d.ts +5 -0
- package/dist/tools/__tests__/compatibility.test.d.ts.map +1 -0
- package/dist/tools/__tests__/compatibility.test.js +41 -0
- package/dist/tools/__tests__/compatibility.test.js.map +1 -0
- package/dist/tools/__tests__/ids.test.d.ts +5 -0
- package/dist/tools/__tests__/ids.test.d.ts.map +1 -0
- package/dist/tools/__tests__/ids.test.js +56 -0
- package/dist/tools/__tests__/ids.test.js.map +1 -0
- package/dist/tools/__tests__/manifest-assert.test.d.ts +5 -0
- package/dist/tools/__tests__/manifest-assert.test.d.ts.map +1 -0
- package/dist/tools/__tests__/manifest-assert.test.js +66 -0
- package/dist/tools/__tests__/manifest-assert.test.js.map +1 -0
- package/dist/tools/__tests__/registry.test.d.ts +2 -0
- package/dist/tools/__tests__/registry.test.d.ts.map +1 -0
- package/dist/tools/__tests__/registry.test.js +93 -0
- package/dist/tools/__tests__/registry.test.js.map +1 -0
- package/dist/tools/__tests__/types.test.d.ts +2 -0
- package/dist/tools/__tests__/types.test.d.ts.map +1 -0
- package/dist/tools/__tests__/types.test.js +51 -0
- package/dist/tools/__tests__/types.test.js.map +1 -0
- package/dist/tools/capability.d.ts +257 -0
- package/dist/tools/capability.d.ts.map +1 -0
- package/dist/tools/capability.js +46 -0
- package/dist/tools/capability.js.map +1 -0
- package/dist/tools/command-spec.d.ts +211 -0
- package/dist/tools/command-spec.d.ts.map +1 -0
- package/dist/tools/command-spec.js +110 -0
- package/dist/tools/command-spec.js.map +1 -0
- package/dist/tools/compatibility.d.ts +45 -0
- package/dist/tools/compatibility.d.ts.map +1 -0
- package/dist/tools/compatibility.js +49 -0
- package/dist/tools/compatibility.js.map +1 -0
- package/dist/tools/ids.d.ts +61 -0
- package/dist/tools/ids.d.ts.map +1 -0
- package/dist/tools/ids.js +61 -0
- package/dist/tools/ids.js.map +1 -0
- package/dist/tools/index.d.ts +22 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manifest-assert.d.ts +35 -0
- package/dist/tools/manifest-assert.d.ts.map +1 -0
- package/dist/tools/manifest-assert.js +67 -0
- package/dist/tools/manifest-assert.js.map +1 -0
- package/dist/tools/manifest.d.ts +178 -0
- package/dist/tools/manifest.d.ts.map +1 -0
- package/dist/tools/manifest.js +35 -0
- package/dist/tools/manifest.js.map +1 -0
- package/dist/tools/registry.d.ts +37 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +49 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +1021 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +77 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/__tests__/signal.test.d.ts +2 -0
- package/dist/types/__tests__/signal.test.d.ts.map +1 -0
- package/dist/types/__tests__/signal.test.js +111 -0
- package/dist/types/__tests__/signal.test.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/signal-batch.d.ts +56 -0
- package/dist/types/signal-batch.d.ts.map +1 -0
- package/dist/types/signal-batch.js +54 -0
- package/dist/types/signal-batch.js.map +1 -0
- package/dist/types/signal.d.ts +77 -0
- package/dist/types/signal.d.ts.map +1 -0
- package/dist/types/signal.js +42 -0
- package/dist/types/signal.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generic recipe registry — shared plumbing for fitness
|
|
3
|
+
* and simulation recipe registries.
|
|
4
|
+
*
|
|
5
|
+
* Both fitness and simulation expose a "recipe" concept (a named bundle
|
|
6
|
+
* of selectors + execution options). The registry data structure they
|
|
7
|
+
* need is identical: a Map by id, a Map by name, register/lookup
|
|
8
|
+
* helpers, and a guarded duplicate-id policy. Only the recipe service —
|
|
9
|
+
* how a recipe's selector is resolved against the corresponding tool's
|
|
10
|
+
* registry of checks/scenarios — legitimately differs between the two
|
|
11
|
+
* tools, so the service stays per-package.
|
|
12
|
+
*
|
|
13
|
+
* Implemented on top of the kernel's unified `Registry<T>` base.
|
|
14
|
+
* `RecipeRegistry<T>` exposes the historical `allowOverwrite +
|
|
15
|
+
* throwOnDuplicate` flag-pair surface and routes per-call to the
|
|
16
|
+
* appropriate `inner.register(...)` invocation.
|
|
17
|
+
*
|
|
18
|
+
* The temp `protected byId`/`byName` shim that Phase 2 introduced is
|
|
19
|
+
* gone — both subclasses (`FitnessRecipeRegistry`,
|
|
20
|
+
* `SimulationRecipeRegistry`) now seed built-ins via
|
|
21
|
+
* `registerAll(builtIns, { internal: true })` (LSP-clean).
|
|
22
|
+
*/
|
|
23
|
+
import { ValidationError } from '../lib/errors.js';
|
|
24
|
+
import { Registry } from '../lib/registry.js';
|
|
25
|
+
/**
|
|
26
|
+
* Process-wide policy: duplicate id/name with `allowOverwrite: false`
|
|
27
|
+
* keeps the first entry and emits a warning. Use `register(.., {
|
|
28
|
+
* throwOnDuplicate: true })` to opt into the historical fitness/sim
|
|
29
|
+
* "throw on duplicate" contract.
|
|
30
|
+
*/
|
|
31
|
+
export class RecipeRegistry {
|
|
32
|
+
inner;
|
|
33
|
+
module;
|
|
34
|
+
validationCode;
|
|
35
|
+
constructor(options = {}) {
|
|
36
|
+
this.module = options.module ?? 'core:recipes';
|
|
37
|
+
this.validationCode = options.validationCode ?? 'VALIDATION.RECIPE.DUPLICATE';
|
|
38
|
+
this.inner = new Registry({
|
|
39
|
+
module: this.module,
|
|
40
|
+
duplicatePolicy: 'warn-first-wins',
|
|
41
|
+
evtPrefix: 'recipe.registry',
|
|
42
|
+
validationCode: this.validationCode,
|
|
43
|
+
logger: options.logger,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Register a recipe.
|
|
48
|
+
*
|
|
49
|
+
* - Default: refuses on duplicate id/name; logs a `recipe.registry.duplicate` warning.
|
|
50
|
+
* - `{ allowOverwrite: true }`: replaces the existing entry.
|
|
51
|
+
* - `{ throwOnDuplicate: true }`: throws a `ValidationError` instead of warning.
|
|
52
|
+
* Mutually exclusive with `allowOverwrite`.
|
|
53
|
+
* - `{ internal: true }`: bypasses the duplicate guard. Used for
|
|
54
|
+
* built-in seeding in subclasses.
|
|
55
|
+
*/
|
|
56
|
+
register(recipe, options = {}) {
|
|
57
|
+
const { allowOverwrite = false, throwOnDuplicate = false, internal = false } = options;
|
|
58
|
+
if (allowOverwrite && throwOnDuplicate) {
|
|
59
|
+
// The two flags advertise contradictory behaviours; honour the
|
|
60
|
+
// JSDoc claim of mutual exclusion at runtime so a defensive
|
|
61
|
+
// caller that sets both doesn't silently get the overwrite
|
|
62
|
+
// path with no diagnostic.
|
|
63
|
+
// @fitness-ignore-next-line result-pattern-consistency -- registration guard, throw is appropriate
|
|
64
|
+
throw new ValidationError(`RecipeRegistry.register: 'allowOverwrite' and 'throwOnDuplicate' are mutually exclusive`, { code: options.validationCode ?? this.validationCode });
|
|
65
|
+
}
|
|
66
|
+
if (internal) {
|
|
67
|
+
this.inner.register(recipe, { internal: true });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (allowOverwrite) {
|
|
71
|
+
// Overwrite path: clean up stale name/id mappings and re-insert.
|
|
72
|
+
const incumbentById = this.inner.getById(recipe.id);
|
|
73
|
+
const incumbentByName = this.inner.getByName(recipe.name);
|
|
74
|
+
if (incumbentById && incumbentById.name !== recipe.name) {
|
|
75
|
+
this.inner.remove(incumbentById.id);
|
|
76
|
+
}
|
|
77
|
+
if (incumbentByName && incumbentByName.id !== recipe.id) {
|
|
78
|
+
this.inner.remove(incumbentByName.id);
|
|
79
|
+
}
|
|
80
|
+
this.inner.register(recipe, { internal: true });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (throwOnDuplicate) {
|
|
84
|
+
const dup = this.inner.has(recipe.id) ||
|
|
85
|
+
(this.inner.has(recipe.name) && this.inner.getByName(recipe.name)?.id !== recipe.id);
|
|
86
|
+
if (dup) {
|
|
87
|
+
// @fitness-ignore-next-line result-pattern-consistency -- registration guard, throw is appropriate
|
|
88
|
+
throw new ValidationError(`Recipe '${recipe.name}' (${recipe.id}) already registered`, {
|
|
89
|
+
code: options.validationCode ?? this.validationCode,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
this.inner.register(recipe, { internal: true });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Default warn-first-wins via the inner base.
|
|
96
|
+
this.inner.register(recipe);
|
|
97
|
+
}
|
|
98
|
+
/** Register many recipes with shared options. */
|
|
99
|
+
registerAll(recipes, options = {}) {
|
|
100
|
+
for (const recipe of recipes) {
|
|
101
|
+
this.register(recipe, options);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Look up a recipe by name first, falling back to id. */
|
|
105
|
+
loadRecipe(nameOrId) {
|
|
106
|
+
return this.inner.getByName(nameOrId) ?? this.inner.getById(nameOrId);
|
|
107
|
+
}
|
|
108
|
+
getByName(name) {
|
|
109
|
+
return this.inner.getByName(name);
|
|
110
|
+
}
|
|
111
|
+
getById(id) {
|
|
112
|
+
return this.inner.getById(id);
|
|
113
|
+
}
|
|
114
|
+
has(nameOrId) {
|
|
115
|
+
return this.inner.has(nameOrId);
|
|
116
|
+
}
|
|
117
|
+
/** All registered recipes, in registration order. */
|
|
118
|
+
getAllRecipes() {
|
|
119
|
+
return this.inner.getAll();
|
|
120
|
+
}
|
|
121
|
+
/** All registered recipe names, in registration order. */
|
|
122
|
+
getNames() {
|
|
123
|
+
return this.inner.getAll().map((r) => r.name);
|
|
124
|
+
}
|
|
125
|
+
/** Recipes with a given tag. */
|
|
126
|
+
getByTag(tag) {
|
|
127
|
+
return this.inner.getByTag(tag);
|
|
128
|
+
}
|
|
129
|
+
get size() {
|
|
130
|
+
return this.inner.size;
|
|
131
|
+
}
|
|
132
|
+
/** Remove a recipe by id. Returns true if it existed. */
|
|
133
|
+
remove(id) {
|
|
134
|
+
return this.inner.remove(id);
|
|
135
|
+
}
|
|
136
|
+
/** Drop every entry. */
|
|
137
|
+
clear() {
|
|
138
|
+
this.inner.clear();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/recipes/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAqB,MAAM,oBAAoB,CAAC;AA8CjE;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACN,KAAK,CAAc;IACrB,MAAM,CAAS;IACf,cAAc,CAAS;IAExC,YAAY,UAAiC,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC;QAC/C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,6BAA6B,CAAC;QAC9E,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAI;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,eAAe,EAAE,iBAAiB;YAClC,SAAS,EAAE,iBAAiB;YAC5B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IAED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AO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,QAAgB;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,qDAAqD;IACrD,aAAa;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC;IAED,0DAA0D;IAC1D,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,gCAAgC;IAChC,QAAQ,CAAC,GAAW;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,yDAAyD;IACzD,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,wBAAwB;IACxB,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generic recipe selector union + resolver — the selection
|
|
3
|
+
* half of the recipe substrate (the registry half lives in `./registry.ts`).
|
|
4
|
+
*
|
|
5
|
+
* A recipe selects a named subset of registered units (checks today,
|
|
6
|
+
* scenarios, rules later). The four common selection shapes —
|
|
7
|
+
* `explicit` / `all` / `tags` / `pattern` — are structurally identical
|
|
8
|
+
* across tools; only unit-specific fields (e.g. fitness `config`, sim
|
|
9
|
+
* `kind`) diverge. This module owns the shared union and a resolver
|
|
10
|
+
* generic over the kernel `Registerable` surface (`id` / `name` / `tags`).
|
|
11
|
+
*
|
|
12
|
+
* **Layer-safe by construction.** Core never names a tool type or pulls a
|
|
13
|
+
* tool dependency. Everything tool-specific arrives injected:
|
|
14
|
+
* - `keysOf(item)` — the match keys an item exposes (fitness: namespaced
|
|
15
|
+
* slug + bare slug + tag/slug targets; sim: `[id, name]`).
|
|
16
|
+
* - `match(target, pattern)` — the glob matcher for the `pattern` arm
|
|
17
|
+
* (fitness injects `minimatch`; `minimatch` stays out of core).
|
|
18
|
+
* - `resolveExplicit(id, items)` — a tool's fallback lookup for an
|
|
19
|
+
* explicit id that is not itself a primary key (fitness's
|
|
20
|
+
* bare-slug → namespaced-key resolution).
|
|
21
|
+
* - `predicates` — a per-arm predicate map for arms core cannot name
|
|
22
|
+
* (sim's `kind`) **or** arms whose semantics differ from core's
|
|
23
|
+
* built-in (sim's `tags`, which excludes on id/name rather than tags).
|
|
24
|
+
*
|
|
25
|
+
* **Selection only, never execution.** The resolver returns the selected
|
|
26
|
+
* items; each tool's service consumes them with its own scheduler. This
|
|
27
|
+
* is the load-bearing seam the symmetric-tool architecture (ADR-0005)
|
|
28
|
+
* draws — execution stays tool-owned.
|
|
29
|
+
*
|
|
30
|
+
* **`tags` semantics.** Core's built-in `tags` arm intersects an item's
|
|
31
|
+
* tags with `include` and rejects on `exclude` (matching fitness's
|
|
32
|
+
* `resolveTagsSelector`). A tool whose `tags` arm means something else
|
|
33
|
+
* (sim excludes on id/name) supplies a `tags` predicate instead, which
|
|
34
|
+
* overrides the built-in arm — see `predicates` below.
|
|
35
|
+
*/
|
|
36
|
+
import type { RecipeUnitConfigMap } from './unit-config.js';
|
|
37
|
+
import type { Registerable } from '../lib/registry.js';
|
|
38
|
+
/** Select an explicit, ordered list of units by id. */
|
|
39
|
+
export interface ExplicitSelector {
|
|
40
|
+
readonly type: 'explicit';
|
|
41
|
+
readonly ids: readonly string[];
|
|
42
|
+
readonly config?: RecipeUnitConfigMap;
|
|
43
|
+
}
|
|
44
|
+
/** Select every unit, with optional pattern-based exclusions. */
|
|
45
|
+
export interface AllSelector {
|
|
46
|
+
readonly type: 'all';
|
|
47
|
+
readonly exclude?: readonly string[];
|
|
48
|
+
readonly config?: RecipeUnitConfigMap;
|
|
49
|
+
}
|
|
50
|
+
/** Select units whose tags intersect `include` and avoid `exclude`. */
|
|
51
|
+
export interface TagsSelector {
|
|
52
|
+
readonly type: 'tags';
|
|
53
|
+
readonly include: readonly string[];
|
|
54
|
+
readonly exclude?: readonly string[];
|
|
55
|
+
readonly config?: RecipeUnitConfigMap;
|
|
56
|
+
}
|
|
57
|
+
/** Select units whose match keys glob-match `include` and avoid `exclude`. */
|
|
58
|
+
export interface PatternSelector {
|
|
59
|
+
readonly type: 'pattern';
|
|
60
|
+
readonly include: readonly string[];
|
|
61
|
+
readonly exclude?: readonly string[];
|
|
62
|
+
readonly config?: RecipeUnitConfigMap;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The generic selector union. Tools alias the `explicit` arm's `ids` to
|
|
66
|
+
* their historical field name (fitness `checkIds`, sim `scenarioIds`) in
|
|
67
|
+
* their own `types.ts` so existing recipe literals are unchanged, and may
|
|
68
|
+
* extend the union with tool-only arms (sim `kind`).
|
|
69
|
+
*/
|
|
70
|
+
export type RecipeSelector = ExplicitSelector | AllSelector | TagsSelector | PatternSelector;
|
|
71
|
+
/** Glob matcher injected by the tool for the `pattern` / `all` arms. */
|
|
72
|
+
type Matcher = (target: string, pattern: string) => boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Injected, tool-supplied resolution hooks. Keeping these external is what
|
|
75
|
+
* lets core resolve selectors without naming any tool type.
|
|
76
|
+
*/
|
|
77
|
+
export interface ResolveSelectorOptions<T extends Registerable, S extends {
|
|
78
|
+
readonly type: string;
|
|
79
|
+
}> {
|
|
80
|
+
/** Match keys for an item — used by the `all` and `pattern` arms. */
|
|
81
|
+
readonly keysOf: (item: T) => readonly string[];
|
|
82
|
+
/** Tags an item carries — used by the built-in `tags` arm. Defaults to `item.tags ?? []`. */
|
|
83
|
+
readonly tagsOf?: (item: T) => readonly string[];
|
|
84
|
+
/** Glob matcher for `pattern` / `all` exclude matching. Required only if such an arm reaches the resolver. */
|
|
85
|
+
readonly match?: Matcher;
|
|
86
|
+
/**
|
|
87
|
+
* Fallback lookup for an `explicit` id that is not itself a primary key
|
|
88
|
+
* — e.g. fitness's bare-slug → namespaced-key resolution. Returns the
|
|
89
|
+
* canonical primary key, or `undefined`. When omitted, explicit ids are
|
|
90
|
+
* matched as literal primary keys only.
|
|
91
|
+
*/
|
|
92
|
+
readonly resolveExplicit?: (id: string, items: readonly T[]) => string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Per-arm predicates for arms core cannot name (sim `kind`) or whose
|
|
95
|
+
* semantics differ from the built-in arm (sim `tags`). Keyed by arm
|
|
96
|
+
* `type`; when present for the active arm it overrides the built-in.
|
|
97
|
+
*/
|
|
98
|
+
readonly predicates?: Readonly<Record<string, (item: T, selector: S) => boolean>>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolve a selector against a caller-supplied item list, returning the
|
|
102
|
+
* selected items in the appropriate order. Pure — no logging, no I/O.
|
|
103
|
+
*
|
|
104
|
+
* A tool-supplied predicate for the active arm overrides the built-in
|
|
105
|
+
* resolution, so a tool whose arm semantics differ (or whose arm core
|
|
106
|
+
* cannot name) stays byte-exact without core knowing about it.
|
|
107
|
+
*/
|
|
108
|
+
export declare function resolveSelector<T extends Registerable, S extends {
|
|
109
|
+
readonly type: string;
|
|
110
|
+
}>(selector: S, items: readonly T[], opts: ResolveSelectorOptions<T, S>): readonly T[];
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/recipes/selector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAI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E5D;;;GAGG;AACH,MAAM,WAAW,sBAAsB,CACrC,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;IAEnC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,MAAM,EAAE,CAAC;IAChD,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,MAAM,EAAE,CAAC;IACjD,8GAA8G;IAC9G,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,MAAM,GAAG,SAAS,CAAC;IACnF;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;CACnF;AAqFD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACzF,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,IAAI,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,GACjC,SAAS,CAAC,EAAE,CAqCd"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generic recipe selector union + resolver — the selection
|
|
3
|
+
* half of the recipe substrate (the registry half lives in `./registry.ts`).
|
|
4
|
+
*
|
|
5
|
+
* A recipe selects a named subset of registered units (checks today,
|
|
6
|
+
* scenarios, rules later). The four common selection shapes —
|
|
7
|
+
* `explicit` / `all` / `tags` / `pattern` — are structurally identical
|
|
8
|
+
* across tools; only unit-specific fields (e.g. fitness `config`, sim
|
|
9
|
+
* `kind`) diverge. This module owns the shared union and a resolver
|
|
10
|
+
* generic over the kernel `Registerable` surface (`id` / `name` / `tags`).
|
|
11
|
+
*
|
|
12
|
+
* **Layer-safe by construction.** Core never names a tool type or pulls a
|
|
13
|
+
* tool dependency. Everything tool-specific arrives injected:
|
|
14
|
+
* - `keysOf(item)` — the match keys an item exposes (fitness: namespaced
|
|
15
|
+
* slug + bare slug + tag/slug targets; sim: `[id, name]`).
|
|
16
|
+
* - `match(target, pattern)` — the glob matcher for the `pattern` arm
|
|
17
|
+
* (fitness injects `minimatch`; `minimatch` stays out of core).
|
|
18
|
+
* - `resolveExplicit(id, items)` — a tool's fallback lookup for an
|
|
19
|
+
* explicit id that is not itself a primary key (fitness's
|
|
20
|
+
* bare-slug → namespaced-key resolution).
|
|
21
|
+
* - `predicates` — a per-arm predicate map for arms core cannot name
|
|
22
|
+
* (sim's `kind`) **or** arms whose semantics differ from core's
|
|
23
|
+
* built-in (sim's `tags`, which excludes on id/name rather than tags).
|
|
24
|
+
*
|
|
25
|
+
* **Selection only, never execution.** The resolver returns the selected
|
|
26
|
+
* items; each tool's service consumes them with its own scheduler. This
|
|
27
|
+
* is the load-bearing seam the symmetric-tool architecture (ADR-0005)
|
|
28
|
+
* draws — execution stays tool-owned.
|
|
29
|
+
*
|
|
30
|
+
* **`tags` semantics.** Core's built-in `tags` arm intersects an item's
|
|
31
|
+
* tags with `include` and rejects on `exclude` (matching fitness's
|
|
32
|
+
* `resolveTagsSelector`). A tool whose `tags` arm means something else
|
|
33
|
+
* (sim excludes on id/name) supplies a `tags` predicate instead, which
|
|
34
|
+
* overrides the built-in arm — see `predicates` below.
|
|
35
|
+
*/
|
|
36
|
+
import { SystemError } from '../lib/errors.js';
|
|
37
|
+
const NO_MATCHER_CODE = 'SYSTEM.CORE.SELECTOR_NO_MATCHER';
|
|
38
|
+
const UNKNOWN_SELECTOR_CODE = 'SYSTEM.CORE.UNKNOWN_SELECTOR';
|
|
39
|
+
function requireMatcher(match, arm) {
|
|
40
|
+
if (match === undefined) {
|
|
41
|
+
// @fitness-ignore-next-line result-pattern-consistency -- programmer error: a pattern/all-exclude arm reached the resolver without an injected matcher
|
|
42
|
+
throw new SystemError(`resolveSelector: '${arm}' selector needs a 'match' matcher but none was supplied`, {
|
|
43
|
+
code: NO_MATCHER_CODE,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return match;
|
|
47
|
+
}
|
|
48
|
+
/** `explicit`: exact primary-key match then injected fallback; request order; no de-dup. */
|
|
49
|
+
function resolveExplicitArm(ids, items, resolveExplicit) {
|
|
50
|
+
const byId = new Map();
|
|
51
|
+
for (const item of items)
|
|
52
|
+
byId.set(item.id, item);
|
|
53
|
+
const result = [];
|
|
54
|
+
for (const id of ids) {
|
|
55
|
+
let item = byId.get(id);
|
|
56
|
+
if (item === undefined && resolveExplicit !== undefined) {
|
|
57
|
+
const key = resolveExplicit(id, items);
|
|
58
|
+
if (key !== undefined)
|
|
59
|
+
item = byId.get(key);
|
|
60
|
+
}
|
|
61
|
+
if (item !== undefined)
|
|
62
|
+
result.push(item);
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/** `all`: every item, minus any whose match keys glob-match an exclude pattern. */
|
|
67
|
+
function resolveAllArm(exclude, items, keysOf, match) {
|
|
68
|
+
if (exclude.length === 0)
|
|
69
|
+
return items;
|
|
70
|
+
const matcher = requireMatcher(match, 'all');
|
|
71
|
+
return items.filter((item) => {
|
|
72
|
+
const targets = keysOf(item);
|
|
73
|
+
return !exclude.some((pattern) => targets.some((target) => matcher(target, pattern)));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/** `tags`: items whose tags intersect `include` and avoid `exclude` (tag-based). */
|
|
77
|
+
function resolveTagsArm(include, exclude, items, tagsOf) {
|
|
78
|
+
const includeSet = new Set(include);
|
|
79
|
+
const excludeSet = new Set(exclude);
|
|
80
|
+
return items.filter((item) => {
|
|
81
|
+
const tags = tagsOf(item);
|
|
82
|
+
return tags.some((tag) => includeSet.has(tag)) && !tags.some((tag) => excludeSet.has(tag));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/** `pattern`: items whose match keys glob-match some `include` and no `exclude`. */
|
|
86
|
+
function resolvePatternArm(include, exclude, items, keysOf, match) {
|
|
87
|
+
const matcher = requireMatcher(match, 'pattern');
|
|
88
|
+
return items.filter((item) => {
|
|
89
|
+
const targets = keysOf(item);
|
|
90
|
+
const included = include.some((pattern) => targets.some((target) => matcher(target, pattern)));
|
|
91
|
+
if (!included)
|
|
92
|
+
return false;
|
|
93
|
+
return !exclude.some((pattern) => targets.some((target) => matcher(target, pattern)));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resolve a selector against a caller-supplied item list, returning the
|
|
98
|
+
* selected items in the appropriate order. Pure — no logging, no I/O.
|
|
99
|
+
*
|
|
100
|
+
* A tool-supplied predicate for the active arm overrides the built-in
|
|
101
|
+
* resolution, so a tool whose arm semantics differ (or whose arm core
|
|
102
|
+
* cannot name) stays byte-exact without core knowing about it.
|
|
103
|
+
*/
|
|
104
|
+
export function resolveSelector(selector, items, opts) {
|
|
105
|
+
// Tool-supplied predicates override any arm (built-in or tool-only).
|
|
106
|
+
const predicate = opts.predicates?.[selector.type];
|
|
107
|
+
if (predicate)
|
|
108
|
+
return items.filter((item) => predicate(item, selector));
|
|
109
|
+
const arm = selector;
|
|
110
|
+
switch (arm.type) {
|
|
111
|
+
case 'explicit': {
|
|
112
|
+
return resolveExplicitArm(arm.ids, items, opts.resolveExplicit);
|
|
113
|
+
}
|
|
114
|
+
case 'all': {
|
|
115
|
+
return resolveAllArm(arm.exclude ?? [], items, opts.keysOf, opts.match);
|
|
116
|
+
}
|
|
117
|
+
case 'tags': {
|
|
118
|
+
return resolveTagsArm(arm.include, arm.exclude ?? [], items, opts.tagsOf ?? ((item) => item.tags ?? []));
|
|
119
|
+
}
|
|
120
|
+
case 'pattern': {
|
|
121
|
+
return resolvePatternArm(arm.include, arm.exclude ?? [], items, opts.keysOf, opts.match);
|
|
122
|
+
}
|
|
123
|
+
/* v8 ignore start -- exhaustive guard: a tool-only arm with no matching predicate lands here */
|
|
124
|
+
default: {
|
|
125
|
+
const _exhaustive = arm;
|
|
126
|
+
// @fitness-ignore-next-line result-pattern-consistency -- programmer error: unknown selector arm with no predicate
|
|
127
|
+
throw new SystemError(`resolveSelector: unknown selector type: ${JSON.stringify(_exhaustive)}`, {
|
|
128
|
+
code: UNKNOWN_SELECTOR_CODE,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/* v8 ignore stop */
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.js","sourceRoot":"","sources":["../../src/recipes/selector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA2E/C,MAAM,eAAe,GAAG,iCAAiC,CAAC;AAC1D,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AAE7D,SAAS,cAAc,CAAC,KAA0B,EAAE,GAAW;IAC7D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,uJAAuJ;QACvJ,MAAM,IAAI,WAAW,CACnB,qBAAqB,GAAG,0DAA0D,EAClF;YACE,IAAI,EAAE,eAAe;SACtB,CACF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4FAA4F;AAC5F,SAAS,kBAAkB,CACzB,GAAsB,EACtB,KAAmB,EACnB,eAAsF;IAEtF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAa,CAAC;IAClC,KAAK,MAAM,IAAI,IAA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AAG,CAAC;YAC/B,mHAAmH;YACnH,MAAM,IAAI,WAAW,CACnB,2CAA2C,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,EACxE;gBACE,IAAI,EAAE,qBAAqB;aAC5B,CACF,CAAC;QACJ,CAAC;QACD,oBAAoB;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-unit recipe configuration accessors — the generic
|
|
3
|
+
* half of the recipe substrate's config-override surface.
|
|
4
|
+
*
|
|
5
|
+
* A recipe can carry a `config` map keyed by unit slug. Tool-specific recipe
|
|
6
|
+
* services project this map into the current `RunScope`'s `recipeUnitConfig`
|
|
7
|
+
* slot before any unit runs and clear it once the run completes. Each unit
|
|
8
|
+
* reads its slice via `getUnitConfig<T>(slug)` and merges it with its built-in
|
|
9
|
+
* defaults.
|
|
10
|
+
*
|
|
11
|
+
* Scope-bound (not module-bound) lookup is load-bearing — the runtime
|
|
12
|
+
* frequently has TWO copies of a tool package loaded:
|
|
13
|
+
*
|
|
14
|
+
* 1. The CLI's bundled copy (running the recipe service).
|
|
15
|
+
* 2. A plugin pack's resolved copy (running the unit, calling
|
|
16
|
+
* `getUnitConfig(slug)`).
|
|
17
|
+
*
|
|
18
|
+
* Each copy has its own module-scope state. Routing through
|
|
19
|
+
* `currentScope()` binds the slot identity to core (a single resolved
|
|
20
|
+
* copy in every npm graph) rather than to whichever tool copy loaded
|
|
21
|
+
* first. (See `packages/fitness/engine/src/recipes/check-config.ts` for
|
|
22
|
+
* the original, fitness-named accessors that now re-export these.)
|
|
23
|
+
*
|
|
24
|
+
* Calling `getUnitConfig(...)` outside any `runWithScope` (e.g. unit
|
|
25
|
+
* tests that don't set up a scope) returns an empty object — the unit's
|
|
26
|
+
* own defaults handle the empty case.
|
|
27
|
+
*
|
|
28
|
+
* The slot name (`recipeUnitConfig`) and its `RecipeUnitConfigSlot`
|
|
29
|
+
* type are now unit-neutral, matching the generalized accessors and map type.
|
|
30
|
+
*/
|
|
31
|
+
import type { RunScope } from '../lib/run-scope.js';
|
|
32
|
+
/**
|
|
33
|
+
* Per-unit configuration map. Keys are unit slugs; values are
|
|
34
|
+
* unit-specific config objects whose shape the consuming unit declares.
|
|
35
|
+
*/
|
|
36
|
+
export type RecipeUnitConfigMap = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
37
|
+
/**
|
|
38
|
+
* Read the per-unit config slice for the given slug.
|
|
39
|
+
*
|
|
40
|
+
* Returns an empty object when no recipe-config has been set or no entry
|
|
41
|
+
* exists for the slug — treat the result as "augmentation only" and merge
|
|
42
|
+
* with the unit's own defaults. The stored entry is returned cast to `T`
|
|
43
|
+
* without runtime validation; each unit owns its defaults and tolerates
|
|
44
|
+
* the empty case.
|
|
45
|
+
*
|
|
46
|
+
* @typeParam T - The shape the calling unit expects.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getUnitConfig<T extends Record<string, unknown>>(slug: string): T;
|
|
49
|
+
/**
|
|
50
|
+
* Replace the current scope's recipe config. Called by a recipe service at
|
|
51
|
+
* the start of a recipe run, before any unit executes.
|
|
52
|
+
*
|
|
53
|
+
* Takes a scope explicitly rather than reading `currentScope()` so callers
|
|
54
|
+
* make the scope boundary explicit and lifecycle errors surface as type
|
|
55
|
+
* errors rather than silently no-op'ing outside a scope.
|
|
56
|
+
*/
|
|
57
|
+
export declare function setCurrentRecipeUnitConfig(scope: RunScope, config: RecipeUnitConfigMap | undefined): void;
|
|
58
|
+
/**
|
|
59
|
+
* Clear the current scope's recipe config. Called by a recipe service at
|
|
60
|
+
* the end of a recipe run (success or failure).
|
|
61
|
+
*/
|
|
62
|
+
export declare function clearCurrentRecipeUnitConfig(scope: RunScope): void;
|
|
63
|
+
//# sourceMappingURL=unit-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-config.d.ts","sourceRoot":"","sources":["../../src/recipes/unit-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9F;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAKhF;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,mBAAmB,GAAG,SAAS,GACtC,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAElE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-unit recipe configuration accessors — the generic
|
|
3
|
+
* half of the recipe substrate's config-override surface.
|
|
4
|
+
*
|
|
5
|
+
* A recipe can carry a `config` map keyed by unit slug. Tool-specific recipe
|
|
6
|
+
* services project this map into the current `RunScope`'s `recipeUnitConfig`
|
|
7
|
+
* slot before any unit runs and clear it once the run completes. Each unit
|
|
8
|
+
* reads its slice via `getUnitConfig<T>(slug)` and merges it with its built-in
|
|
9
|
+
* defaults.
|
|
10
|
+
*
|
|
11
|
+
* Scope-bound (not module-bound) lookup is load-bearing — the runtime
|
|
12
|
+
* frequently has TWO copies of a tool package loaded:
|
|
13
|
+
*
|
|
14
|
+
* 1. The CLI's bundled copy (running the recipe service).
|
|
15
|
+
* 2. A plugin pack's resolved copy (running the unit, calling
|
|
16
|
+
* `getUnitConfig(slug)`).
|
|
17
|
+
*
|
|
18
|
+
* Each copy has its own module-scope state. Routing through
|
|
19
|
+
* `currentScope()` binds the slot identity to core (a single resolved
|
|
20
|
+
* copy in every npm graph) rather than to whichever tool copy loaded
|
|
21
|
+
* first. (See `packages/fitness/engine/src/recipes/check-config.ts` for
|
|
22
|
+
* the original, fitness-named accessors that now re-export these.)
|
|
23
|
+
*
|
|
24
|
+
* Calling `getUnitConfig(...)` outside any `runWithScope` (e.g. unit
|
|
25
|
+
* tests that don't set up a scope) returns an empty object — the unit's
|
|
26
|
+
* own defaults handle the empty case.
|
|
27
|
+
*
|
|
28
|
+
* The slot name (`recipeUnitConfig`) and its `RecipeUnitConfigSlot`
|
|
29
|
+
* type are now unit-neutral, matching the generalized accessors and map type.
|
|
30
|
+
*/
|
|
31
|
+
import { currentScope } from '../lib/run-scope.js';
|
|
32
|
+
/**
|
|
33
|
+
* Read the per-unit config slice for the given slug.
|
|
34
|
+
*
|
|
35
|
+
* Returns an empty object when no recipe-config has been set or no entry
|
|
36
|
+
* exists for the slug — treat the result as "augmentation only" and merge
|
|
37
|
+
* with the unit's own defaults. The stored entry is returned cast to `T`
|
|
38
|
+
* without runtime validation; each unit owns its defaults and tolerates
|
|
39
|
+
* the empty case.
|
|
40
|
+
*
|
|
41
|
+
* @typeParam T - The shape the calling unit expects.
|
|
42
|
+
*/
|
|
43
|
+
export function getUnitConfig(slug) {
|
|
44
|
+
const scope = currentScope();
|
|
45
|
+
const entry = scope?.recipeUnitConfig.get(slug);
|
|
46
|
+
if (!entry)
|
|
47
|
+
return {};
|
|
48
|
+
return entry;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Replace the current scope's recipe config. Called by a recipe service at
|
|
52
|
+
* the start of a recipe run, before any unit executes.
|
|
53
|
+
*
|
|
54
|
+
* Takes a scope explicitly rather than reading `currentScope()` so callers
|
|
55
|
+
* make the scope boundary explicit and lifecycle errors surface as type
|
|
56
|
+
* errors rather than silently no-op'ing outside a scope.
|
|
57
|
+
*/
|
|
58
|
+
export function setCurrentRecipeUnitConfig(scope, config) {
|
|
59
|
+
scope.recipeUnitConfig.setAll(config ?? {});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Clear the current scope's recipe config. Called by a recipe service at
|
|
63
|
+
* the end of a recipe run (success or failure).
|
|
64
|
+
*/
|
|
65
|
+
export function clearCurrentRecipeUnitConfig(scope) {
|
|
66
|
+
scope.recipeUnitConfig.clear();
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=unit-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-config.js","sourceRoot":"","sources":["../../src/recipes/unit-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAUnD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAoC,IAAY;IAC3E,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAI,IAAI,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAO,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAe,EACf,MAAuC;IAEvC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAe;IAC1D,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-process-transport.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/__tests__/in-process-transport.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process ProgressTransport (ADR-0016): event fan-out, pre-subscribe
|
|
3
|
+
* buffering, and result resolution/rejection.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { createInProcessTransport } from '../in-process-transport.js';
|
|
7
|
+
describe('createInProcessTransport', () => {
|
|
8
|
+
it('resolves the job result and delivers its events', async () => {
|
|
9
|
+
const transport = createInProcessTransport();
|
|
10
|
+
const events = [];
|
|
11
|
+
const run = transport.run((emit) => {
|
|
12
|
+
emit(1);
|
|
13
|
+
emit(2);
|
|
14
|
+
return Promise.resolve('done');
|
|
15
|
+
});
|
|
16
|
+
run.onProgress((e) => events.push(e));
|
|
17
|
+
const result = await run.result;
|
|
18
|
+
expect(result).toBe('done');
|
|
19
|
+
expect(events).toEqual([1, 2]);
|
|
20
|
+
});
|
|
21
|
+
it('buffers events emitted before subscription and flushes them in order', async () => {
|
|
22
|
+
const transport = createInProcessTransport();
|
|
23
|
+
const events = [];
|
|
24
|
+
// The job emits synchronously inside run(), BEFORE onProgress is called —
|
|
25
|
+
// these must be buffered and replayed on subscription, not dropped.
|
|
26
|
+
const run = transport.run((emit) => {
|
|
27
|
+
emit('a');
|
|
28
|
+
emit('b');
|
|
29
|
+
return Promise.resolve();
|
|
30
|
+
});
|
|
31
|
+
run.onProgress((e) => events.push(e));
|
|
32
|
+
await run.result;
|
|
33
|
+
expect(events).toEqual(['a', 'b']);
|
|
34
|
+
});
|
|
35
|
+
it('delivers events emitted after subscription live, in order', async () => {
|
|
36
|
+
const transport = createInProcessTransport();
|
|
37
|
+
const events = [];
|
|
38
|
+
let emitFn;
|
|
39
|
+
const run = transport.run((emit) => {
|
|
40
|
+
emitFn = emit;
|
|
41
|
+
return new Promise((resolve) => {
|
|
42
|
+
setTimeout(resolve, 5);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
run.onProgress((e) => events.push(e));
|
|
46
|
+
emitFn?.('live1');
|
|
47
|
+
emitFn?.('live2');
|
|
48
|
+
await run.result;
|
|
49
|
+
expect(events).toEqual(['live1', 'live2']);
|
|
50
|
+
});
|
|
51
|
+
it('combines buffered + live events in one ordered stream', async () => {
|
|
52
|
+
const transport = createInProcessTransport();
|
|
53
|
+
const events = [];
|
|
54
|
+
let emitFn;
|
|
55
|
+
const run = transport.run((emit) => {
|
|
56
|
+
emit('buffered');
|
|
57
|
+
emitFn = emit;
|
|
58
|
+
return new Promise((resolve) => {
|
|
59
|
+
setTimeout(resolve, 5);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
run.onProgress((e) => events.push(e));
|
|
63
|
+
emitFn?.('live');
|
|
64
|
+
await run.result;
|
|
65
|
+
expect(events).toEqual(['buffered', 'live']);
|
|
66
|
+
});
|
|
67
|
+
it('rejects result when the job rejects', async () => {
|
|
68
|
+
const transport = createInProcessTransport();
|
|
69
|
+
const run = transport.run(() => Promise.reject(new Error('boom')));
|
|
70
|
+
await expect(run.result).rejects.toThrow('boom');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=in-process-transport.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-process-transport.test.js","sourceRoot":"","sources":["../../../src/runtime/__tests__/in-process-transport.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,SAAS,GAAG,wBAAwB,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAiB,CAAC,IAAI,EAAE,EAAE;YACjD,IAAI,CAAC,CAAC,CAAC,CAAC;YACR,IAAI,CAAC,CAAC,CAA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AC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,SAAS,GAAG,wBAAwB,EAAE,CAAC;QAC7C,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAc,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAChF,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subprocess ProgressTransport (ADR-0028): forks the fixture worker over real
|
|
3
|
+
* IPC and asserts the relay contract — event fan-out, pre-subscribe buffering,
|
|
4
|
+
* result resolution, error propagation (message / throw / premature exit),
|
|
5
|
+
* advanced-serialization payloads, and the in-process fallback selector.
|
|
6
|
+
*
|
|
7
|
+
* These spawn a real child process, so the suite is slower than the in-process
|
|
8
|
+
* sibling; the fixture is a tiny `.mjs` run directly by node (no transform).
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=subprocess-transport.test.d.ts.map
|