@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,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry with exponential backoff for opensip-cli.
|
|
3
|
+
* Designed for network calls (e.g., --report-to SARIF POST).
|
|
4
|
+
*/
|
|
5
|
+
export interface RetryOptions {
|
|
6
|
+
/** Maximum number of attempts (including the first). Default: 3 */
|
|
7
|
+
maxAttempts?: number;
|
|
8
|
+
/** Initial delay in ms before first retry. Default: 500 */
|
|
9
|
+
initialDelayMs?: number;
|
|
10
|
+
/** Maximum delay in ms. Default: 10000 */
|
|
11
|
+
maxDelayMs?: number;
|
|
12
|
+
/** Multiplier for exponential backoff. Default: 2 */
|
|
13
|
+
backoffMultiplier?: number;
|
|
14
|
+
/** Called before each retry with attempt number, error, and delay. */
|
|
15
|
+
onRetry?: (attempt: number, error: Error, delayMs: number) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Execute an async function with exponential backoff retry.
|
|
19
|
+
* Throws the last error if all attempts fail.
|
|
20
|
+
*
|
|
21
|
+
* @throws {Error} The last error thrown by `fn` after exhausting
|
|
22
|
+
* `effectiveMaxAttempts` attempts. Non-Error throws are wrapped in
|
|
23
|
+
* an `Error` whose message is `String(value)`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
26
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/lib/retry.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CA2C/F"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @fitness-ignore-file performance-anti-patterns -- sequential await is the entire point of a retry/backoff loop; running attempts in parallel would defeat retry semantics
|
|
2
|
+
/**
|
|
3
|
+
* Retry with exponential backoff for opensip-cli.
|
|
4
|
+
* Designed for network calls (e.g., --report-to SARIF POST).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Execute an async function with exponential backoff retry.
|
|
8
|
+
* Throws the last error if all attempts fail.
|
|
9
|
+
*
|
|
10
|
+
* @throws {Error} The last error thrown by `fn` after exhausting
|
|
11
|
+
* `effectiveMaxAttempts` attempts. Non-Error throws are wrapped in
|
|
12
|
+
* an `Error` whose message is `String(value)`.
|
|
13
|
+
*/
|
|
14
|
+
export async function withRetry(fn, options = {}) {
|
|
15
|
+
const { maxAttempts = 3, initialDelayMs = 500, maxDelayMs = 10_000, backoffMultiplier = 2, onRetry, } = options;
|
|
16
|
+
// Floor defensively against zero/negative/NaN/non-integer values. Math.max(1, NaN)
|
|
17
|
+
// returns NaN per spec, so an unguarded `Math.max(1, maxAttempts)` would let
|
|
18
|
+
// NaN reach the loop condition (attempt <= NaN is false) and throw
|
|
19
|
+
// `undefined` for `lastError!`. Compare against effectiveMaxAttempts everywhere
|
|
20
|
+
// so the original maxAttempts can never re-enter the comparison.
|
|
21
|
+
const effectiveMaxAttempts = Number.isFinite(maxAttempts)
|
|
22
|
+
? Math.max(1, Math.floor(maxAttempts))
|
|
23
|
+
: 1;
|
|
24
|
+
let lastError;
|
|
25
|
+
for (let attempt = 1; attempt <= effectiveMaxAttempts; attempt++) {
|
|
26
|
+
try {
|
|
27
|
+
return await fn();
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
31
|
+
if (attempt >= effectiveMaxAttempts)
|
|
32
|
+
break;
|
|
33
|
+
// Exponential backoff with jitter
|
|
34
|
+
const baseDelay = initialDelayMs * Math.pow(backoffMultiplier, attempt - 1);
|
|
35
|
+
const jitter = Math.random() * baseDelay * 0.5;
|
|
36
|
+
const delay = Math.min(baseDelay + jitter, maxDelayMs);
|
|
37
|
+
onRetry?.(attempt, lastError, delay);
|
|
38
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// `lastError` is always assigned before reaching here: the loop runs
|
|
42
|
+
// `effectiveMaxAttempts >= 1` times and assigns `lastError` on every catch
|
|
43
|
+
// path before the loop terminates. Guard explicitly for type-safety.
|
|
44
|
+
if (!lastError)
|
|
45
|
+
throw new Error('withRetry: unreachable — no attempts ran');
|
|
46
|
+
throw lastError;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/lib/retry.ts"],"names":[],"mappings":"AAAA,4KAA4K;AAC5K;;;GAGG;AAeH;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,EAAoB,EAAE,UAAwB,EAAE;IACjF,MAAM,EACJ,WAAW,GAAG,CAAC,EACf,cAAc,GAAG,GAAG,EACpB,UAAU,GAAG,MAAM,EACnB,iBAAiB,GAAG,CAAC,EACrB,OAAO,GACR,GAAG,OAAO,CAAC;IAEZ,mFAAmF;IACnF,6EAA6E;IAC7E,mEAAmE;IACnE,gFAAgF;IAChF,iEAAiE;IACjE,MAAM,oBAAoB,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;QACvD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC,CAAC;IACN,IAAI,SAA4B,CAAC;IAEjC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,oBAAoB,EAAE,OAAO,EAAE,EAAE,CAAC;QACjE,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAEtE,IAAI,OAAO,IAAI,oBAAoB;gBAAE,MAAM;YAE3C,kCAAkC;YAClC,MAAM,SAAS,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;YAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,GAAG,GAAG,CAAC;YAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,MAAM,EAAE,UAAU,CAAC,CAAC;YAEvD,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAErC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,qEAAqE;IACrE,2EAA2E;IAC3E,qEAAqE;IACrE,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5E,MAAM,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunDiagnostics — the shared, JSON-emittable diagnostics shape carried on a
|
|
3
|
+
* {@link CommandOutcome} (north-star §5.10, launch).
|
|
4
|
+
*
|
|
5
|
+
* Today observability is per-subsystem: graph has OTEL spans, fitness has rich
|
|
6
|
+
* callbacks, sim has simple progress, and the bootstrap writes loose log lines.
|
|
7
|
+
* There is no common vocabulary a machine consumer can read. `RunDiagnostics` is
|
|
8
|
+
* that vocabulary: one structured event stream spanning the uniform tool
|
|
9
|
+
* lifecycle (discover → load → validate → execute → render → deliver → persist),
|
|
10
|
+
* a flat metrics-counter map, and a thin bridge to the existing OTEL trace
|
|
11
|
+
* context.
|
|
12
|
+
*
|
|
13
|
+
* The currency is deliberately **minimal-but-extensible** for launch (spec
|
|
14
|
+
* decision): one `DiagnosticEvent` per lifecycle boundary that already exists,
|
|
15
|
+
* not a metrics/timer rebuild. The `metrics`/`trace` slots are reserved so later
|
|
16
|
+
* releases can enrich them without another outer-shape break.
|
|
17
|
+
*
|
|
18
|
+
* Serialization-safe by construction: every field is a primitive, a readonly
|
|
19
|
+
* array of primitives/records, or a plain record — no functions, no class
|
|
20
|
+
* instances, no clock captured here. The producer (the scope-owned diagnostics
|
|
21
|
+
* bus, `@opensip-cli/core`) stamps `at` at the emit site; this layer stays
|
|
22
|
+
* pure (the formatter-purity contract that `SignalEnvelope` also honours).
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The seven phases of the uniform tool lifecycle (north-star §5.6 / Figure 5),
|
|
26
|
+
* used to tag every {@link DiagnosticEvent}. A consumer can filter the stream by
|
|
27
|
+
* phase to answer "what happened during config load?" or "did delivery run?".
|
|
28
|
+
*/
|
|
29
|
+
export type DiagnosticPhase = 'discover' | 'load' | 'validate' | 'execute' | 'render' | 'deliver' | 'persist';
|
|
30
|
+
/** Severity of a single diagnostic event. Independent of signal severity. */
|
|
31
|
+
export type DiagnosticLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
32
|
+
/**
|
|
33
|
+
* One structured diagnostics event. `at` is an ISO-8601 timestamp supplied by
|
|
34
|
+
* the emitter (core stays `Date.now()`-free in its pure paths; the bus owns the
|
|
35
|
+
* clock). `data` is an optional bag of JSON-safe extras (e.g. which plugin
|
|
36
|
+
* loaded, how many checks matched) — never functions or class instances.
|
|
37
|
+
*/
|
|
38
|
+
export interface DiagnosticEvent {
|
|
39
|
+
readonly phase: DiagnosticPhase;
|
|
40
|
+
readonly level: DiagnosticLevel;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
readonly at: string;
|
|
43
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The diagnostics snapshot carried on every {@link CommandOutcome}.
|
|
47
|
+
*
|
|
48
|
+
* - `runId` correlates the snapshot with the invocation's logger/runId.
|
|
49
|
+
* - `events` is the ordered lifecycle stream.
|
|
50
|
+
* - `metrics` is a flat counter map (e.g. `{ 'plugins.loaded': 3 }`); reserved
|
|
51
|
+
* and populated emit-site-by-emit-site as counters are needed.
|
|
52
|
+
* - `trace` bridges to the existing OTEL span context when telemetry is on
|
|
53
|
+
* (`OTEL_EXPORTER_OTLP_ENDPOINT` set); absent otherwise.
|
|
54
|
+
*/
|
|
55
|
+
export interface RunDiagnostics {
|
|
56
|
+
readonly runId: string;
|
|
57
|
+
readonly events: readonly DiagnosticEvent[];
|
|
58
|
+
readonly metrics?: Readonly<Record<string, number>>;
|
|
59
|
+
readonly trace?: {
|
|
60
|
+
readonly traceId?: string;
|
|
61
|
+
readonly spanId?: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=run-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-diagnostics.d.ts","sourceRoot":"","sources":["../../src/lib/run-diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,MAAM,GACN,UAAU,GACV,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;AAEd,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElE;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunDiagnostics — the shared, JSON-emittable diagnostics shape carried on a
|
|
3
|
+
* {@link CommandOutcome} (north-star §5.10, launch).
|
|
4
|
+
*
|
|
5
|
+
* Today observability is per-subsystem: graph has OTEL spans, fitness has rich
|
|
6
|
+
* callbacks, sim has simple progress, and the bootstrap writes loose log lines.
|
|
7
|
+
* There is no common vocabulary a machine consumer can read. `RunDiagnostics` is
|
|
8
|
+
* that vocabulary: one structured event stream spanning the uniform tool
|
|
9
|
+
* lifecycle (discover → load → validate → execute → render → deliver → persist),
|
|
10
|
+
* a flat metrics-counter map, and a thin bridge to the existing OTEL trace
|
|
11
|
+
* context.
|
|
12
|
+
*
|
|
13
|
+
* The currency is deliberately **minimal-but-extensible** for launch (spec
|
|
14
|
+
* decision): one `DiagnosticEvent` per lifecycle boundary that already exists,
|
|
15
|
+
* not a metrics/timer rebuild. The `metrics`/`trace` slots are reserved so later
|
|
16
|
+
* releases can enrich them without another outer-shape break.
|
|
17
|
+
*
|
|
18
|
+
* Serialization-safe by construction: every field is a primitive, a readonly
|
|
19
|
+
* array of primitives/records, or a plain record — no functions, no class
|
|
20
|
+
* instances, no clock captured here. The producer (the scope-owned diagnostics
|
|
21
|
+
* bus, `@opensip-cli/core`) stamps `at` at the emit site; this layer stays
|
|
22
|
+
* pure (the formatter-purity contract that `SignalEnvelope` also honours).
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=run-diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-diagnostics.js","sourceRoot":"","sources":["../../src/lib/run-diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview RunScope — per-invocation execution scope.
|
|
3
|
+
*
|
|
4
|
+
* Owns the lifecycle of every singleton the codebase previously hung on
|
|
5
|
+
* module-level state (logger, caches, registries, recipe-config slot,
|
|
6
|
+
* project context, datastore thunk). Constructed exactly once per CLI
|
|
7
|
+
* invocation; SaaS hosts construct one per concurrent run.
|
|
8
|
+
*
|
|
9
|
+
* Threading happens at the `ToolCliContext` boundary (Phase 5). Tools
|
|
10
|
+
* read `cli.scope.foo` instead of reaching into module globals.
|
|
11
|
+
*
|
|
12
|
+
* AsyncLocalStorage seam: `runWithScope(scope, fn)` binds `scope` as
|
|
13
|
+
* the current scope for the dynamic extent of `fn`. Library functions
|
|
14
|
+
* deep inside the call tree (e.g. fitness's `getCheckConfig(slug)`)
|
|
15
|
+
* read from `currentScope()` instead of `globalThis`. The two-copies-of-
|
|
16
|
+
* fitness hazard documented at the prior `Symbol.for(globalThis)` site
|
|
17
|
+
* is solved by ALS — both fitness copies share the same
|
|
18
|
+
* `AsyncLocalStorage` instance exported from `@opensip-cli/core`.
|
|
19
|
+
*/
|
|
20
|
+
import { LanguageParseCache } from '../languages/parse-cache-class.js';
|
|
21
|
+
import { LanguageRegistry } from '../languages/registry.js';
|
|
22
|
+
import { ToolRegistry } from '../tools/registry.js';
|
|
23
|
+
import { DiagnosticsBus } from './diagnostics-bus.js';
|
|
24
|
+
import type { Logger } from './logger.js';
|
|
25
|
+
import type { ProjectContext } from './project-context.js';
|
|
26
|
+
import type { DataStoreThunk, RecipeUnitConfigSlot, ToolScope } from './scope-types.js';
|
|
27
|
+
import type { UiContext } from './ui-context.js';
|
|
28
|
+
import type { SignalSink } from '../signals/signal-sink.js';
|
|
29
|
+
import type { ToolPluginManifest, ToolProvenance } from '../tools/manifest.js';
|
|
30
|
+
/** Constructor input for {@link RunScope}: registries, services, and per-run identifiers. */
|
|
31
|
+
export interface RunScopeOptions {
|
|
32
|
+
readonly logger?: Logger;
|
|
33
|
+
readonly parseCache?: LanguageParseCache;
|
|
34
|
+
readonly projectContext?: ProjectContext;
|
|
35
|
+
readonly datastore?: DataStoreThunk;
|
|
36
|
+
readonly tools?: ToolRegistry;
|
|
37
|
+
readonly languages?: LanguageRegistry;
|
|
38
|
+
/**
|
|
39
|
+
* Per-invocation presentation settings (banner size, CLI version) read
|
|
40
|
+
* by the render paths. Optional: tests and non-rendering callers omit it,
|
|
41
|
+
* in which case `RunScope.ui` is `undefined` and render sites apply their
|
|
42
|
+
* own defaults (banner → `lg`, version → empty).
|
|
43
|
+
*/
|
|
44
|
+
readonly ui?: UiContext;
|
|
45
|
+
/**
|
|
46
|
+
* Correlation id for the current CLI invocation. D7 designates this a
|
|
47
|
+
* KERNEL concern (every invocation has one) — it stays flat on the
|
|
48
|
+
* scope rather than under a tool subnamespace. The CLI bootstrap
|
|
49
|
+
* generates it via `generatePrefixedId('run')` and passes it here;
|
|
50
|
+
* the logger reads it back via `currentScope()?.runId` for
|
|
51
|
+
* event-stamping. Optional in `RunScopeOptions` (tests can construct
|
|
52
|
+
* a bare scope) but if omitted, `RunScope.runId` is the empty string
|
|
53
|
+
* — matching the prior logger-singleton reset value used in
|
|
54
|
+
* `configureLogger({ runId: '' })`. Production paths always supply
|
|
55
|
+
* a non-empty id via the pre-action-hook.
|
|
56
|
+
*/
|
|
57
|
+
readonly runId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Cloud signal sink for this invocation (ADR-0008). Defaults to
|
|
60
|
+
* `noopSignalSink` — the CLI bootstrap sets the OpenSIP Cloud sink only
|
|
61
|
+
* when an API key resolves and entitlement is positive. No module-level
|
|
62
|
+
* state: selection is always explicit at the composition root.
|
|
63
|
+
*/
|
|
64
|
+
readonly signalSink?: SignalSink;
|
|
65
|
+
/**
|
|
66
|
+
* The manifests of the tools admitted through the compatibility gate this
|
|
67
|
+
* run, in registration order. Recorded by the CLI bootstrap and stamped on
|
|
68
|
+
* the scope so host commands (`tools list`) read them via `currentScope()`
|
|
69
|
+
* instead of a module global. Defaults to `[]` (no tools admitted — e.g. an
|
|
70
|
+
* isolated test scope). HOST-only: tools never read these, so they live on
|
|
71
|
+
* `RunScope`, not the tool-facing `ToolScope`.
|
|
72
|
+
*/
|
|
73
|
+
readonly toolManifests?: readonly ToolPluginManifest[];
|
|
74
|
+
/**
|
|
75
|
+
* The provenance records of the tools admitted this run (source, identity,
|
|
76
|
+
* manifest hash), paired index-wise with {@link toolManifests}. Recorded by
|
|
77
|
+
* the CLI bootstrap and stamped on the scope so host commands (`plugin list`,
|
|
78
|
+
* `tools list`, `tools uninstall`) read them via `currentScope()` rather than
|
|
79
|
+
* a module global. Defaults to `[]`.
|
|
80
|
+
*/
|
|
81
|
+
readonly toolProvenance?: readonly ToolProvenance[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Per-invocation execution scope.
|
|
85
|
+
*
|
|
86
|
+
* Construct exactly once per CLI invocation. Pass via
|
|
87
|
+
* `ToolCliContext.scope` (Phase 5). Tools read `cli.scope.foo`
|
|
88
|
+
* instead of reaching into module globals (the T1 invariant).
|
|
89
|
+
*
|
|
90
|
+
* Defaults: when no overrides are provided, the scope wires up the
|
|
91
|
+
* default `Logger`, a fresh `LanguageParseCache`, and FRESH empty
|
|
92
|
+
* `ToolRegistry` / `LanguageRegistry` instances. The CLI bootstrap
|
|
93
|
+
* constructs and populates one pair per run and passes them in via
|
|
94
|
+
* `RunScopeOptions` so language adapters and tool plugins land where
|
|
95
|
+
* `currentScope()?.languages` / `.tools` will find them. Tests that
|
|
96
|
+
* exercise registry-aware code paths must either construct a populated
|
|
97
|
+
* registry and pass it in, or register fixtures into `scope.languages`
|
|
98
|
+
* inside the test body's `runWithScope` block.
|
|
99
|
+
*/
|
|
100
|
+
export declare class RunScope {
|
|
101
|
+
readonly logger: Logger;
|
|
102
|
+
readonly parseCache: LanguageParseCache;
|
|
103
|
+
readonly recipeUnitConfig: RecipeUnitConfigSlot;
|
|
104
|
+
readonly projectContext: ProjectContext | undefined;
|
|
105
|
+
readonly datastore: DataStoreThunk;
|
|
106
|
+
readonly tools: ToolRegistry;
|
|
107
|
+
readonly languages: LanguageRegistry;
|
|
108
|
+
/** Per-invocation presentation settings; `undefined` outside the CLI render path. */
|
|
109
|
+
readonly ui: UiContext | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Correlation id for the current invocation. Read by the logger via
|
|
112
|
+
* `currentScope()?.runId` for event-stamping. Empty string when no
|
|
113
|
+
* caller supplied one (matches the prior singleton reset semantics —
|
|
114
|
+
* the logger's `formatEntry` only emits a `runId` field when truthy).
|
|
115
|
+
*/
|
|
116
|
+
readonly runId: string;
|
|
117
|
+
/** Cloud signal sink for this invocation; `noopSignalSink` unless cloud sync is on. */
|
|
118
|
+
readonly signalSink: SignalSink;
|
|
119
|
+
/**
|
|
120
|
+
* Per-invocation diagnostics collector (north-star §5.10, launch).
|
|
121
|
+
* Library code emits lifecycle events via `currentScope()?.diagnostics`; the
|
|
122
|
+
* host assembler snapshots it onto every `CommandOutcome`. Scope-owned so
|
|
123
|
+
* concurrent runs share no diagnostics state (the no-module-singleton rule).
|
|
124
|
+
*/
|
|
125
|
+
readonly diagnostics: DiagnosticsBus;
|
|
126
|
+
/**
|
|
127
|
+
* Manifests of the tools admitted this run (registration order). Empty unless
|
|
128
|
+
* the CLI bootstrap recorded them. Read by host commands via `currentScope()`.
|
|
129
|
+
*/
|
|
130
|
+
readonly toolManifests: readonly ToolPluginManifest[];
|
|
131
|
+
/**
|
|
132
|
+
* Provenance of the tools admitted this run, paired index-wise with
|
|
133
|
+
* {@link toolManifests}. Empty unless the CLI bootstrap recorded them.
|
|
134
|
+
*/
|
|
135
|
+
readonly toolProvenance: readonly ToolProvenance[];
|
|
136
|
+
constructor(opts?: RunScopeOptions);
|
|
137
|
+
/** Release per-run resources (caches, recipe-config slot). */
|
|
138
|
+
dispose(): void;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Declaration-merge: `RunScope` IS-A `ToolScope` (the Tool-facing view)
|
|
142
|
+
* plus the `tools` registry it adds. Extending `ToolScope` here also
|
|
143
|
+
* brings in the augmentable `ScopeContribution` slots, so
|
|
144
|
+
* `currentScope()?.simulation` / `?.graph` stay readable on a RunScope.
|
|
145
|
+
* Tools augment `ScopeContribution` (not `RunScope`) from their own
|
|
146
|
+
* packages; the slots flow in through `ToolScope extends ScopeContribution`.
|
|
147
|
+
*/
|
|
148
|
+
export interface RunScope extends ToolScope {
|
|
149
|
+
}
|
|
150
|
+
/** Run `fn` with `scope` bound as the current scope for everything in its dynamic extent. */
|
|
151
|
+
export declare function runWithScope<T>(scope: RunScope, fn: () => Promise<T>): Promise<T>;
|
|
152
|
+
/** Synchronous variant of `runWithScope`. */
|
|
153
|
+
export declare function runWithScopeSync<T>(scope: RunScope, fn: () => T): T;
|
|
154
|
+
/**
|
|
155
|
+
* Set `scope` as the current scope for the rest of the calling async
|
|
156
|
+
* context — without needing a callback wrapper. Backed by
|
|
157
|
+
* `AsyncLocalStorage.enterWith`. Use this in Commander's `preAction`
|
|
158
|
+
* hook where the action body runs after the hook returns but in the
|
|
159
|
+
* same async chain: `enterWith` propagates the scope forward without
|
|
160
|
+
* needing to wrap the action invocation, which Commander does not let
|
|
161
|
+
* us do directly. Throws on misuse: an existing scope must NOT be
|
|
162
|
+
* replaced silently (call `runWithScope` for nested scopes).
|
|
163
|
+
*/
|
|
164
|
+
export declare function enterScope(scope: RunScope): void;
|
|
165
|
+
/** Read the current scope. Returns undefined when called outside a runWithScope. */
|
|
166
|
+
export declare function currentScope(): RunScope | undefined;
|
|
167
|
+
//# sourceMappingURL=run-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-scope.d.ts","sourceRoot":"","sources":["../../src/lib/run-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA4B/E,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;IACxB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvD;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;GAgBG;AAEH,qBAAa,QAAQ;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;IAChD,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtD;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,SAAS,cAAc,EAAE,CAAC;gBAEvC,IAAI,GAAE,eAAoB;IAiBtC,8DAA8D;IAC9D,OAAO,IAAI,IAAI;CAOhB;AAED;;;;;;;GAOG;AAEH,MAAM,WAAW,QAAS,SAAQ,SAAS;CAAG;AAgB9C,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEjF;AAED,6CAA6C;AAC7C,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAEhD;AAED,oFAAoF;AACpF,wBAAgB,YAAY,IAAI,QAAQ,GAAG,SAAS,CAEnD"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview RunScope — per-invocation execution scope.
|
|
3
|
+
*
|
|
4
|
+
* Owns the lifecycle of every singleton the codebase previously hung on
|
|
5
|
+
* module-level state (logger, caches, registries, recipe-config slot,
|
|
6
|
+
* project context, datastore thunk). Constructed exactly once per CLI
|
|
7
|
+
* invocation; SaaS hosts construct one per concurrent run.
|
|
8
|
+
*
|
|
9
|
+
* Threading happens at the `ToolCliContext` boundary (Phase 5). Tools
|
|
10
|
+
* read `cli.scope.foo` instead of reaching into module globals.
|
|
11
|
+
*
|
|
12
|
+
* AsyncLocalStorage seam: `runWithScope(scope, fn)` binds `scope` as
|
|
13
|
+
* the current scope for the dynamic extent of `fn`. Library functions
|
|
14
|
+
* deep inside the call tree (e.g. fitness's `getCheckConfig(slug)`)
|
|
15
|
+
* read from `currentScope()` instead of `globalThis`. The two-copies-of-
|
|
16
|
+
* fitness hazard documented at the prior `Symbol.for(globalThis)` site
|
|
17
|
+
* is solved by ALS — both fitness copies share the same
|
|
18
|
+
* `AsyncLocalStorage` instance exported from `@opensip-cli/core`.
|
|
19
|
+
*/
|
|
20
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
21
|
+
import { LanguageParseCache } from '../languages/parse-cache-class.js';
|
|
22
|
+
import { LanguageRegistry } from '../languages/registry.js';
|
|
23
|
+
import { noopSignalSink } from '../signals/signal-sink.js';
|
|
24
|
+
import { ToolRegistry } from '../tools/registry.js';
|
|
25
|
+
import { DiagnosticsBus } from './diagnostics-bus.js';
|
|
26
|
+
import { logger as defaultLogger } from './logger.js';
|
|
27
|
+
// RecipeUnitConfigSlot, DataStoreThunk, ToolScope, and ScopeContribution
|
|
28
|
+
// live in the leaf `scope-types.ts` (audit 2026-05-29, M4) so the `Tool`
|
|
29
|
+
// contract can depend on them without naming the concrete `RunScope` —
|
|
30
|
+
// breaking the RunScope⟷Tool type cycle. The core barrel sources them
|
|
31
|
+
// directly from `scope-types.ts`; `run-scope.ts` imports what it needs below.
|
|
32
|
+
class DefaultRecipeUnitConfigSlot {
|
|
33
|
+
store = {};
|
|
34
|
+
get(slug) {
|
|
35
|
+
return this.store[slug];
|
|
36
|
+
}
|
|
37
|
+
set(slug, config) {
|
|
38
|
+
this.store[slug] = config;
|
|
39
|
+
}
|
|
40
|
+
setAll(config) {
|
|
41
|
+
this.store = { ...config };
|
|
42
|
+
}
|
|
43
|
+
clear() {
|
|
44
|
+
this.store = {};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Per-invocation execution scope.
|
|
49
|
+
*
|
|
50
|
+
* Construct exactly once per CLI invocation. Pass via
|
|
51
|
+
* `ToolCliContext.scope` (Phase 5). Tools read `cli.scope.foo`
|
|
52
|
+
* instead of reaching into module globals (the T1 invariant).
|
|
53
|
+
*
|
|
54
|
+
* Defaults: when no overrides are provided, the scope wires up the
|
|
55
|
+
* default `Logger`, a fresh `LanguageParseCache`, and FRESH empty
|
|
56
|
+
* `ToolRegistry` / `LanguageRegistry` instances. The CLI bootstrap
|
|
57
|
+
* constructs and populates one pair per run and passes them in via
|
|
58
|
+
* `RunScopeOptions` so language adapters and tool plugins land where
|
|
59
|
+
* `currentScope()?.languages` / `.tools` will find them. Tests that
|
|
60
|
+
* exercise registry-aware code paths must either construct a populated
|
|
61
|
+
* registry and pass it in, or register fixtures into `scope.languages`
|
|
62
|
+
* inside the test body's `runWithScope` block.
|
|
63
|
+
*/
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging -- intentional: the class merges with the `interface RunScope extends ToolScope` below to gain the augmentable ScopeContribution slots for reading. The slots are optional and runtime-installed via Object.assign (the kernel's contributeScope loop), so the "interface declares members the class lacks" warning is the desired, safe behavior here.
|
|
65
|
+
export class RunScope {
|
|
66
|
+
logger;
|
|
67
|
+
parseCache;
|
|
68
|
+
recipeUnitConfig;
|
|
69
|
+
projectContext;
|
|
70
|
+
datastore;
|
|
71
|
+
tools;
|
|
72
|
+
languages;
|
|
73
|
+
/** Per-invocation presentation settings; `undefined` outside the CLI render path. */
|
|
74
|
+
ui;
|
|
75
|
+
/**
|
|
76
|
+
* Correlation id for the current invocation. Read by the logger via
|
|
77
|
+
* `currentScope()?.runId` for event-stamping. Empty string when no
|
|
78
|
+
* caller supplied one (matches the prior singleton reset semantics —
|
|
79
|
+
* the logger's `formatEntry` only emits a `runId` field when truthy).
|
|
80
|
+
*/
|
|
81
|
+
runId;
|
|
82
|
+
/** Cloud signal sink for this invocation; `noopSignalSink` unless cloud sync is on. */
|
|
83
|
+
signalSink;
|
|
84
|
+
/**
|
|
85
|
+
* Per-invocation diagnostics collector (north-star §5.10, launch).
|
|
86
|
+
* Library code emits lifecycle events via `currentScope()?.diagnostics`; the
|
|
87
|
+
* host assembler snapshots it onto every `CommandOutcome`. Scope-owned so
|
|
88
|
+
* concurrent runs share no diagnostics state (the no-module-singleton rule).
|
|
89
|
+
*/
|
|
90
|
+
diagnostics;
|
|
91
|
+
/**
|
|
92
|
+
* Manifests of the tools admitted this run (registration order). Empty unless
|
|
93
|
+
* the CLI bootstrap recorded them. Read by host commands via `currentScope()`.
|
|
94
|
+
*/
|
|
95
|
+
toolManifests;
|
|
96
|
+
/**
|
|
97
|
+
* Provenance of the tools admitted this run, paired index-wise with
|
|
98
|
+
* {@link toolManifests}. Empty unless the CLI bootstrap recorded them.
|
|
99
|
+
*/
|
|
100
|
+
toolProvenance;
|
|
101
|
+
constructor(opts = {}) {
|
|
102
|
+
this.logger = opts.logger ?? defaultLogger;
|
|
103
|
+
this.parseCache = opts.parseCache ?? new LanguageParseCache();
|
|
104
|
+
this.recipeUnitConfig = new DefaultRecipeUnitConfigSlot();
|
|
105
|
+
this.projectContext = opts.projectContext;
|
|
106
|
+
// eslint-disable-next-line unicorn/no-useless-undefined -- explicit no-store sentinel matches the prior `cli.datastore` contract (tools cast to `DataStore | undefined`).
|
|
107
|
+
this.datastore = opts.datastore ?? (() => undefined);
|
|
108
|
+
this.tools = opts.tools ?? new ToolRegistry();
|
|
109
|
+
this.languages = opts.languages ?? new LanguageRegistry();
|
|
110
|
+
this.ui = opts.ui;
|
|
111
|
+
this.runId = opts.runId ?? '';
|
|
112
|
+
this.signalSink = opts.signalSink ?? noopSignalSink;
|
|
113
|
+
this.diagnostics = new DiagnosticsBus(this.runId);
|
|
114
|
+
this.toolManifests = opts.toolManifests ?? [];
|
|
115
|
+
this.toolProvenance = opts.toolProvenance ?? [];
|
|
116
|
+
}
|
|
117
|
+
/** Release per-run resources (caches, recipe-config slot). */
|
|
118
|
+
dispose() {
|
|
119
|
+
this.parseCache.dispose();
|
|
120
|
+
this.recipeUnitConfig.clear();
|
|
121
|
+
// FileCache lifecycle is owned by fitness; not on RunScope.
|
|
122
|
+
// datastore close is the consumer's responsibility — RunScope
|
|
123
|
+
// doesn't open it eagerly.
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ─── AsyncLocalStorage seam ──────────────────────────────────────────
|
|
127
|
+
//
|
|
128
|
+
// `runWithScope(scope, fn)` binds `scope` for the dynamic extent of
|
|
129
|
+
// `fn`. Library functions read `currentScope()` instead of any
|
|
130
|
+
// module global.
|
|
131
|
+
//
|
|
132
|
+
// Both copies of a package import the same `AsyncLocalStorage`
|
|
133
|
+
// instance from this module — so the slot identity is bound to core,
|
|
134
|
+
// not to whichever package is reading from it. This solves the
|
|
135
|
+
// two-copies-of-fitness hazard documented at the prior
|
|
136
|
+
// `Symbol.for(globalThis)` site.
|
|
137
|
+
const scopeStorage = new AsyncLocalStorage();
|
|
138
|
+
/** Run `fn` with `scope` bound as the current scope for everything in its dynamic extent. */
|
|
139
|
+
export function runWithScope(scope, fn) {
|
|
140
|
+
return scopeStorage.run(scope, fn);
|
|
141
|
+
}
|
|
142
|
+
/** Synchronous variant of `runWithScope`. */
|
|
143
|
+
export function runWithScopeSync(scope, fn) {
|
|
144
|
+
return scopeStorage.run(scope, fn);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Set `scope` as the current scope for the rest of the calling async
|
|
148
|
+
* context — without needing a callback wrapper. Backed by
|
|
149
|
+
* `AsyncLocalStorage.enterWith`. Use this in Commander's `preAction`
|
|
150
|
+
* hook where the action body runs after the hook returns but in the
|
|
151
|
+
* same async chain: `enterWith` propagates the scope forward without
|
|
152
|
+
* needing to wrap the action invocation, which Commander does not let
|
|
153
|
+
* us do directly. Throws on misuse: an existing scope must NOT be
|
|
154
|
+
* replaced silently (call `runWithScope` for nested scopes).
|
|
155
|
+
*/
|
|
156
|
+
export function enterScope(scope) {
|
|
157
|
+
scopeStorage.enterWith(scope);
|
|
158
|
+
}
|
|
159
|
+
/** Read the current scope. Returns undefined when called outside a runWithScope. */
|
|
160
|
+
export function currentScope() {
|
|
161
|
+
return scopeStorage.getStore();
|
|
162
|
+
}
|
|
163
|
+
// ─── Logger ↔ RunScope wiring ────────────────────────────────────────
|
|
164
|
+
//
|
|
165
|
+
// Inject `currentScope()?.runId` as the logger singleton's runId source
|
|
166
|
+
// at module init. The logger module itself cannot import from this file
|
|
167
|
+
// (run-scope already imports logger, so the reverse direction would
|
|
168
|
+
// produce a cycle that depcruise rejects). The wiring lives here, where
|
|
169
|
+
// both symbols are already in scope.
|
|
170
|
+
//
|
|
171
|
+
// `defaultLogger` is typed as `Logger` (a narrow interface) so we
|
|
172
|
+
// type-assert to `LoggerImpl` to reach the `setRunIdProvider` setter —
|
|
173
|
+
// the singleton is always a `LoggerImpl` (see logger.ts), so this is
|
|
174
|
+
// a structural narrowing, not a behavioural cast.
|
|
175
|
+
defaultLogger.setRunIdProvider(() => currentScope()?.runId);
|
|
176
|
+
//# sourceMappingURL=run-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-scope.js","sourceRoot":"","sources":["../../src/lib/run-scope.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Host-owned RunTimer / RunLifecycle primitive
|
|
3
|
+
* (host-owned-run-timing plan).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for wall-clock start + monotonic elapsed for one
|
|
6
|
+
* user-visible CLI tool run. The host run-lifecycle plane creates one lifecycle
|
|
7
|
+
* inside the selected command action (after `RunScope` entry, before any
|
|
8
|
+
* tool-owned work) and `complete()`s it once the tool handler / live renderer
|
|
9
|
+
* returns its completion data — that frozen snapshot feeds the generic
|
|
10
|
+
* `StoredSession.startedAt` / `completedAt` / `durationMs`.
|
|
11
|
+
*
|
|
12
|
+
* Tools and engines must never capture their own `Date.now` / `new Date` for
|
|
13
|
+
* the generic session timing fields; only the host lifecycle feeds those.
|
|
14
|
+
* Internal tool timers (per-unit, per-stage, etc.) remain tool-owned for
|
|
15
|
+
* diagnostics.
|
|
16
|
+
*
|
|
17
|
+
* `startedAt` is ISO wall time captured at construction. `complete()` is
|
|
18
|
+
* idempotent: the first call freezes `completedAt` + `durationMs`; later calls
|
|
19
|
+
* return the same frozen snapshot. `snapshot()` reads live before completion
|
|
20
|
+
* (for the ticking live display) and the frozen values after. Elapsed uses a
|
|
21
|
+
* monotonic clock (`performance.now` when available) to avoid skew on long runs
|
|
22
|
+
* or system clock adjustments.
|
|
23
|
+
*/
|
|
24
|
+
export interface RunTimingSnapshot {
|
|
25
|
+
/** ISO-8601 timestamp of run start (wall time, captured early by host). */
|
|
26
|
+
readonly startedAt: string;
|
|
27
|
+
/** ISO-8601 timestamp captured at the moment of this snapshot. */
|
|
28
|
+
readonly completedAt: string;
|
|
29
|
+
/** Wall duration in milliseconds (>= 0). */
|
|
30
|
+
readonly durationMs: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Host-owned run timer: the single source of run start time and wall duration
|
|
34
|
+
* for a tool invocation. Tools read timing through `ToolCliContext.runSession`
|
|
35
|
+
* rather than capturing their own `Date.now()` (see the
|
|
36
|
+
* `no-tool-owned-session-timing` check).
|
|
37
|
+
*/
|
|
38
|
+
export interface RunTimer {
|
|
39
|
+
/** ISO-8601 timestamp of run start (fixed for the lifetime of this timer). */
|
|
40
|
+
readonly startedAt: string;
|
|
41
|
+
/** Epoch ms at start (for fallback elapsed calculations). */
|
|
42
|
+
readonly startedAtEpochMs: number;
|
|
43
|
+
/**
|
|
44
|
+
* Current elapsed wall time since start, in ms.
|
|
45
|
+
* Uses monotonic source when available; clamped to >= 0.
|
|
46
|
+
*/
|
|
47
|
+
elapsedMs(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Capture a point-in-time snapshot. `startedAt` is stable; `completedAt`
|
|
50
|
+
* and `durationMs` reflect now — unless the lifecycle has already been
|
|
51
|
+
* `complete()`d, in which case the frozen completion snapshot is returned.
|
|
52
|
+
*/
|
|
53
|
+
snapshot(): RunTimingSnapshot;
|
|
54
|
+
/**
|
|
55
|
+
* Freeze the run lifecycle. Idempotent: the first call captures
|
|
56
|
+
* `completedAt` + `durationMs`; subsequent calls return the same frozen
|
|
57
|
+
* snapshot. The host run-lifecycle plane calls this once the tool handler /
|
|
58
|
+
* live renderer has returned, before host persistence / render / egress.
|
|
59
|
+
*/
|
|
60
|
+
complete(): RunTimingSnapshot;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The run lifecycle object the host owns for a single tool invocation
|
|
64
|
+
* (host-owned-run-timing §6.1). Structurally identical to {@link RunTimer};
|
|
65
|
+
* the alias gives the spec-named type and creator without churning the many
|
|
66
|
+
* existing `RunTimer` references.
|
|
67
|
+
*/
|
|
68
|
+
export type RunLifecycle = RunTimer;
|
|
69
|
+
/**
|
|
70
|
+
* Create a fresh host-owned run timer.
|
|
71
|
+
*
|
|
72
|
+
* Must be called by the CLI host after `RunScope` is entered (so `runId` etc.
|
|
73
|
+
* are available for logging in Phase 1 wiring) but before any tool work that
|
|
74
|
+
* will be timed.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createRunTimer(): RunTimer;
|
|
77
|
+
/**
|
|
78
|
+
* Create a fresh host-owned run lifecycle. Alias of {@link createRunTimer}
|
|
79
|
+
* under the spec-named factory (host-owned-run-timing §6.1).
|
|
80
|
+
*/
|
|
81
|
+
export declare const createRunLifecycle: () => RunLifecycle;
|
|
82
|
+
//# sourceMappingURL=run-timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-timer.d.ts","sourceRoot":"","sources":["../../src/lib/run-timer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC;;;OAGG;IACH,SAAS,IAAI,MAAM,CAAC;IAEpB;;;;OAIG;IACH,QAAQ,IAAI,iBAAiB,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,IAAI,iBAAiB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAkDzC;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,YAA6B,CAAC"}
|