@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,410 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- one cohesive manifest pipeline: the static reader (loadToolManifest), the single admission gate (admitTool), and their private validate/normalize/hash/diagnose helpers form one read→validate→admit subsystem over the raw-vs-admitted compatibility contract. The helpers are admission-internal (not reused elsewhere); hoisting them out would scatter one contract across files. Grew past the 400-line soft limit with the per-field normalization helpers.
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Static manifest reader + the single admission gate
|
|
4
|
+
* (launch, raw-vs-admitted compatibility contract).
|
|
5
|
+
*
|
|
6
|
+
* `loadToolManifest` reads a tool's static front matter **before**
|
|
7
|
+
* importing its runtime `Tool` module:
|
|
8
|
+
*
|
|
9
|
+
* - **bundled** / **installed** — `package.json#opensipTools` in the tool's
|
|
10
|
+
* own package dir (one read for both; the discovery walker already
|
|
11
|
+
* touches these package.json files).
|
|
12
|
+
* - **project-local** / **user-global** — a JSON sidecar
|
|
13
|
+
* (`opensip-tool.manifest.json`) in the tool's directory, since an
|
|
14
|
+
* authored tool is authored content, not an installed npm package with a
|
|
15
|
+
* package.json marker. Both authored sources read the SAME sidecar; only
|
|
16
|
+
* their trust posture differs (deny-by-default vs trusted-by-default),
|
|
17
|
+
* which is the admission caller's concern, not the loader's.
|
|
18
|
+
*
|
|
19
|
+
* It validates the raw identity subset (`kind: 'tool'`, `id`, `commands`),
|
|
20
|
+
* derives `name`/`version` from the package.json's own top-level fields
|
|
21
|
+
* (the manifest block does NOT redeclare them — single source of truth),
|
|
22
|
+
* validates concrete additive descriptors such as `capabilities`, and returns
|
|
23
|
+
* `undefined` (with a structured logger diagnostic) on a malformed or missing
|
|
24
|
+
* manifest. A missing `apiVersion` is still representable as a
|
|
25
|
+
* `RawToolPluginManifest` so `admitTool` can reject it with a compatibility
|
|
26
|
+
* diagnostic. It NEVER imports the tool module.
|
|
27
|
+
*
|
|
28
|
+
* `admitTool` is the single gate the bundled and external paths share: it
|
|
29
|
+
* records `ToolProvenance` (incl. a `manifestHash` over the canonical
|
|
30
|
+
* manifest JSON) and runs `checkCompatibility(manifest.apiVersion)`:
|
|
31
|
+
* - compatible → `admit`
|
|
32
|
+
* - incompatible + not requested → `skip` (with diagnostic)
|
|
33
|
+
* - incompatible + explicitly asked → `fail-closed` (with diagnostic)
|
|
34
|
+
* It emits exactly one structured logger evt per decision.
|
|
35
|
+
*
|
|
36
|
+
* Both functions are pure over real filesystem reads of package.json /
|
|
37
|
+
* the sidecar — no tool-module import, no module singletons. They stay in
|
|
38
|
+
* core (the kernel) and import nothing from contracts/cli/tools-runtime.
|
|
39
|
+
*/
|
|
40
|
+
import { createHash } from 'node:crypto';
|
|
41
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
42
|
+
import { join } from 'node:path';
|
|
43
|
+
import { logger } from '../lib/logger.js';
|
|
44
|
+
import { checkCompatibility } from '../tools/compatibility.js';
|
|
45
|
+
import { PLUGIN_API_VERSION } from '../tools/manifest.js';
|
|
46
|
+
import { isRecord, isStringArray } from './json-guards.js';
|
|
47
|
+
import { normalizeDiscovery } from './manifest-discovery.js';
|
|
48
|
+
/**
|
|
49
|
+
* Filename of the project-local manifest sidecar. A project-local tool is
|
|
50
|
+
* authored content under `<project>/opensip-cli/…`, not an installed npm
|
|
51
|
+
* package, so it has no `package.json#opensipTools` marker — it declares
|
|
52
|
+
* its identity via this JSON sidecar (deliberately NOT an executable
|
|
53
|
+
* `.mjs`, so the host reads identity without running tool code).
|
|
54
|
+
*/
|
|
55
|
+
export const PROJECT_LOCAL_MANIFEST_FILE = 'opensip-tool.manifest.json';
|
|
56
|
+
/** `module` field stamped on every structured log event from this file. */
|
|
57
|
+
const LOADER_MODULE = 'core:plugins';
|
|
58
|
+
/**
|
|
59
|
+
* Read + validate a tool's static `ToolPluginManifest` for the given
|
|
60
|
+
* source, WITHOUT importing the tool's runtime module.
|
|
61
|
+
*
|
|
62
|
+
* - `bundled` / `installed` — reads `<dir>/package.json`, taking identity
|
|
63
|
+
* from the `opensipTools` block and `name`/`version` from the
|
|
64
|
+
* package.json's own top-level fields.
|
|
65
|
+
* - `project-local` / `user-global` — reads
|
|
66
|
+
* `<dir>/opensip-tool.manifest.json` (the JSON sidecar), which carries the
|
|
67
|
+
* full identity inline. Both authored sources share the sidecar branch.
|
|
68
|
+
*
|
|
69
|
+
* @param source Where the tool came from — selects the manifest location.
|
|
70
|
+
* @param dir The tool's package/authoring directory.
|
|
71
|
+
* @returns The validated manifest, or `undefined` (with a structured
|
|
72
|
+
* `plugin.manifest.read_failed` diagnostic) when the file is missing,
|
|
73
|
+
* unparseable, or fails identity validation.
|
|
74
|
+
*/
|
|
75
|
+
export function loadToolManifest(source, dir) {
|
|
76
|
+
// Both authored sources (project-local + user-global) declare identity via
|
|
77
|
+
// the JSON sidecar; bundled/installed read package.json#opensipTools.
|
|
78
|
+
const authored = source === 'project-local' || source === 'user-global';
|
|
79
|
+
const raw = authored ? readSidecar(dir) : readPackageManifest(dir);
|
|
80
|
+
if (raw === undefined) {
|
|
81
|
+
diagnose(dir, source, 'manifest file missing or unreadable');
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const manifest = validateManifest(raw.block, raw.name, raw.version);
|
|
85
|
+
if (manifest === undefined) {
|
|
86
|
+
diagnose(dir, source, raw.reason ?? 'manifest failed identity validation');
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
return manifest;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Run the single compatibility gate over a manifest and produce an
|
|
93
|
+
* {@link AdmissionResult}. Records `ToolProvenance` (source + identity +
|
|
94
|
+
* `manifestHash`) regardless of verdict, then maps the
|
|
95
|
+
* `checkCompatibility` outcome to a decision:
|
|
96
|
+
*
|
|
97
|
+
* - compatible → `admit`
|
|
98
|
+
* - incompatible + `!explicitlyRequested` → `skip`
|
|
99
|
+
* - incompatible + `explicitlyRequested` → `fail-closed`
|
|
100
|
+
*
|
|
101
|
+
* Emits exactly one structured logger evt per decision
|
|
102
|
+
* (`plugin.manifest.loaded` / `plugin.incompatible.skipped` /
|
|
103
|
+
* `plugin.incompatible.failed`). Never throws, never imports the tool.
|
|
104
|
+
*
|
|
105
|
+
* @param args.manifest The validated manifest (from {@link loadToolManifest}).
|
|
106
|
+
* @param args.source Where the tool came from.
|
|
107
|
+
* @param args.dir The tool's resolved directory (recorded as `resolvedPath`).
|
|
108
|
+
* @param args.packageName npm package name, when known (bundled/installed).
|
|
109
|
+
* @param args.explicitlyRequested Whether the user named this tool directly
|
|
110
|
+
* (e.g. via a plugin pin) — promotes an incompatible `skip` to `fail-closed`.
|
|
111
|
+
*/
|
|
112
|
+
export function admitTool(args) {
|
|
113
|
+
const { manifest, source, dir, packageName, explicitlyRequested } = args;
|
|
114
|
+
const manifestHash = hashManifest(manifest);
|
|
115
|
+
const provenance = {
|
|
116
|
+
source,
|
|
117
|
+
id: manifest.id,
|
|
118
|
+
...(manifest.stableId ? { stableId: manifest.stableId } : {}),
|
|
119
|
+
version: manifest.version,
|
|
120
|
+
...(packageName === undefined ? {} : { packageName }),
|
|
121
|
+
resolvedPath: dir,
|
|
122
|
+
manifestHash,
|
|
123
|
+
};
|
|
124
|
+
const verdict = checkCompatibility(manifest.apiVersion);
|
|
125
|
+
if (verdict.kind === 'compatible') {
|
|
126
|
+
const admittedManifest = {
|
|
127
|
+
...manifest,
|
|
128
|
+
// `verdict.kind === 'compatible'` ⇒ apiVersion equals the engine epoch (a
|
|
129
|
+
// defined number); the `?? PLUGIN_API_VERSION` fallback is never reached
|
|
130
|
+
// when compatible — it only narrows the type to `number` without a
|
|
131
|
+
// non-null assertion.
|
|
132
|
+
apiVersion: manifest.apiVersion ?? PLUGIN_API_VERSION,
|
|
133
|
+
};
|
|
134
|
+
logger.info({
|
|
135
|
+
evt: 'plugin.manifest.loaded',
|
|
136
|
+
module: LOADER_MODULE,
|
|
137
|
+
id: manifest.id,
|
|
138
|
+
source,
|
|
139
|
+
apiVersion: admittedManifest.apiVersion,
|
|
140
|
+
engine: undefined,
|
|
141
|
+
manifestHash,
|
|
142
|
+
decision: 'admit',
|
|
143
|
+
});
|
|
144
|
+
return { decision: 'admit', provenance, verdict, manifest: admittedManifest };
|
|
145
|
+
}
|
|
146
|
+
// incompatible
|
|
147
|
+
const diagnostic = verdict.reason;
|
|
148
|
+
if (explicitlyRequested) {
|
|
149
|
+
logger.error({
|
|
150
|
+
evt: 'plugin.incompatible.failed',
|
|
151
|
+
module: LOADER_MODULE,
|
|
152
|
+
id: manifest.id,
|
|
153
|
+
source,
|
|
154
|
+
apiVersion: verdict.declared,
|
|
155
|
+
engine: verdict.engine,
|
|
156
|
+
manifestHash,
|
|
157
|
+
decision: 'fail-closed',
|
|
158
|
+
diagnostic,
|
|
159
|
+
});
|
|
160
|
+
return { decision: 'fail-closed', provenance, verdict, diagnostic };
|
|
161
|
+
}
|
|
162
|
+
logger.warn({
|
|
163
|
+
evt: 'plugin.incompatible.skipped',
|
|
164
|
+
module: LOADER_MODULE,
|
|
165
|
+
id: manifest.id,
|
|
166
|
+
source,
|
|
167
|
+
apiVersion: verdict.declared,
|
|
168
|
+
engine: verdict.engine,
|
|
169
|
+
manifestHash,
|
|
170
|
+
decision: 'skip',
|
|
171
|
+
diagnostic,
|
|
172
|
+
});
|
|
173
|
+
return { decision: 'skip', provenance, verdict, diagnostic };
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Read `<dir>/package.json` and extract the `opensipTools` block plus the
|
|
177
|
+
* top-level `name`/`version`. Returns `undefined` when the file is missing
|
|
178
|
+
* or unparseable, or when there is no object-shaped `opensipTools` block.
|
|
179
|
+
*/
|
|
180
|
+
function readPackageManifest(dir) {
|
|
181
|
+
const json = readJson(join(dir, 'package.json'));
|
|
182
|
+
if (json === undefined)
|
|
183
|
+
return undefined;
|
|
184
|
+
const block = json.opensipTools;
|
|
185
|
+
if (!isRecord(block))
|
|
186
|
+
return undefined;
|
|
187
|
+
return { block, name: json.name, version: json.version };
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Read the project-local JSON sidecar. The sidecar IS the manifest block
|
|
191
|
+
* and carries `name`/`version` inline (there is no package.json alongside
|
|
192
|
+
* an authored project-local tool).
|
|
193
|
+
*/
|
|
194
|
+
function readSidecar(dir) {
|
|
195
|
+
const json = readJson(join(dir, PROJECT_LOCAL_MANIFEST_FILE));
|
|
196
|
+
if (json === undefined)
|
|
197
|
+
return undefined;
|
|
198
|
+
return { block: json, name: json.name, version: json.version };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Validate the identity subset of a manifest block and assemble a typed
|
|
202
|
+
* `RawToolPluginManifest`. `name`/`version` come from the package.json's own
|
|
203
|
+
* fields (bundled/installed) or inline (sidecar). Returns `undefined` (with
|
|
204
|
+
* a `reason` is reported by the caller) on any identity violation.
|
|
205
|
+
*/
|
|
206
|
+
/** Narrow an unknown value to a non-empty string (the manifest identity-field guard). */
|
|
207
|
+
function isNonEmptyString(value) {
|
|
208
|
+
return typeof value === 'string' && value !== '';
|
|
209
|
+
}
|
|
210
|
+
/** Narrow to an optional non-empty string: absent, or a non-empty string. */
|
|
211
|
+
function isAbsentOrNonEmptyString(value) {
|
|
212
|
+
return value === undefined || isNonEmptyString(value);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Validate the optional `capabilities` slot. Returns `undefined` when absent
|
|
216
|
+
* (additive — no declared domains), the normalized array when valid, or the
|
|
217
|
+
* `'invalid'` sentinel when present-but-malformed (the caller then rejects the
|
|
218
|
+
* whole manifest). Keeps the absent/invalid distinction out of the main
|
|
219
|
+
* validator's control flow.
|
|
220
|
+
*/
|
|
221
|
+
function validateOptionalCapabilities(raw) {
|
|
222
|
+
if (raw === undefined)
|
|
223
|
+
return undefined;
|
|
224
|
+
return normalizeCapabilities(raw) ?? 'invalid';
|
|
225
|
+
}
|
|
226
|
+
function validateManifest(block, name, version) {
|
|
227
|
+
if (block.kind !== 'tool')
|
|
228
|
+
return undefined;
|
|
229
|
+
if (!isNonEmptyString(block.id))
|
|
230
|
+
return undefined;
|
|
231
|
+
if (!isNonEmptyString(name))
|
|
232
|
+
return undefined;
|
|
233
|
+
if (!isNonEmptyString(version))
|
|
234
|
+
return undefined;
|
|
235
|
+
const commands = normalizeCommands(block.commands);
|
|
236
|
+
if (commands === undefined)
|
|
237
|
+
return undefined;
|
|
238
|
+
const apiVersion = block.apiVersion;
|
|
239
|
+
if (apiVersion !== undefined && typeof apiVersion !== 'number')
|
|
240
|
+
return undefined;
|
|
241
|
+
// ADR-0048: the tool's stable machine identity (UUID). Additive + optional —
|
|
242
|
+
// present-but-non-string fails validation, mirroring the `id` guard above.
|
|
243
|
+
// MUST be carried onto the manifest: the drift guard (assertManifestMatchesTool)
|
|
244
|
+
// matches it against the runtime `metadata.id`, and capability-domain ownership
|
|
245
|
+
// (registerCapabilityDomainsFromManifest) stamps `ownerToolId = stableId ?? id`.
|
|
246
|
+
// Dropping it here silently breaks graph-adapter discovery (owner never matches
|
|
247
|
+
// the tool's UUID `metadata.id`).
|
|
248
|
+
if (!isAbsentOrNonEmptyString(block.stableId))
|
|
249
|
+
return undefined;
|
|
250
|
+
const stableId = block.stableId;
|
|
251
|
+
// §5.3 (launch): the `capabilities` slot. Absent ⇒ no declared domains;
|
|
252
|
+
// present-but-malformed ⇒ the whole manifest is invalid (the `'invalid'`
|
|
253
|
+
// sentinel), mirroring the strict `commands` parse above.
|
|
254
|
+
const capabilities = validateOptionalCapabilities(block.capabilities);
|
|
255
|
+
if (capabilities === 'invalid')
|
|
256
|
+
return undefined;
|
|
257
|
+
// Reserved for future community/catalog (see ToolPluginManifestBase).
|
|
258
|
+
// We explicitly copy them through as `unknown` (additive) so they survive
|
|
259
|
+
// load → admit without loss. This is the lightweight consumer hygiene
|
|
260
|
+
// (roadmap item 3) — authors get structural round-tripping now; future
|
|
261
|
+
// releases can add non-fatal warnings or concrete schemas without
|
|
262
|
+
// breaking GA-era manifests. The admission gate already treats extra
|
|
263
|
+
// fields permissively; this just makes the intent explicit.
|
|
264
|
+
const compatibility = block.compatibility;
|
|
265
|
+
const distribution = block.distribution;
|
|
266
|
+
const extensionMetadata = block.extensionMetadata;
|
|
267
|
+
return {
|
|
268
|
+
kind: 'tool',
|
|
269
|
+
id: block.id,
|
|
270
|
+
...(stableId === undefined ? {} : { stableId }),
|
|
271
|
+
name,
|
|
272
|
+
version,
|
|
273
|
+
...(apiVersion === undefined ? {} : { apiVersion }),
|
|
274
|
+
commands,
|
|
275
|
+
...(capabilities === undefined ? {} : { capabilities }),
|
|
276
|
+
...(compatibility === undefined ? {} : { compatibility }),
|
|
277
|
+
...(distribution === undefined ? {} : { distribution }),
|
|
278
|
+
...(extensionMetadata === undefined ? {} : { extensionMetadata }),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/** Closed set of valid `contributionKind` values for a capability declaration. */
|
|
282
|
+
const CONTRIBUTION_KINDS = [
|
|
283
|
+
'module-export',
|
|
284
|
+
'manifest-entry',
|
|
285
|
+
'file',
|
|
286
|
+
];
|
|
287
|
+
/**
|
|
288
|
+
* Validate + normalize a PRESENT `capabilities` array to
|
|
289
|
+
* `ToolCapabilityDeclaration[]`. Each entry needs a non-empty string `id`,
|
|
290
|
+
* a numeric `apiVersion`, and a `contributionKind` in the closed set;
|
|
291
|
+
* `contributionSchema` is `unknown` (the kernel carries no Zod) and is
|
|
292
|
+
* passed through verbatim. Returns the declarations on success, or
|
|
293
|
+
* `undefined` when the slot is malformed (the caller fails the manifest,
|
|
294
|
+
* mirroring `normalizeCommands`). The absent case is handled by the caller.
|
|
295
|
+
*/
|
|
296
|
+
function normalizeCapabilities(value) {
|
|
297
|
+
if (!Array.isArray(value))
|
|
298
|
+
return undefined;
|
|
299
|
+
const out = [];
|
|
300
|
+
for (const entry of value) {
|
|
301
|
+
if (!isRecord(entry))
|
|
302
|
+
return undefined;
|
|
303
|
+
if (typeof entry.id !== 'string' || entry.id === '')
|
|
304
|
+
return undefined;
|
|
305
|
+
if (typeof entry.apiVersion !== 'number')
|
|
306
|
+
return undefined;
|
|
307
|
+
const kind = entry.contributionKind;
|
|
308
|
+
if (!isContributionKind(kind))
|
|
309
|
+
return undefined;
|
|
310
|
+
// `discovery` is optional, but a PRESENT-but-malformed descriptor fails the
|
|
311
|
+
// manifest (mirroring the strict `contributionKind` check above).
|
|
312
|
+
const discovery = normalizeDiscovery(entry.discovery);
|
|
313
|
+
if (discovery.status === 'invalid')
|
|
314
|
+
return undefined;
|
|
315
|
+
out.push({
|
|
316
|
+
id: entry.id,
|
|
317
|
+
apiVersion: entry.apiVersion,
|
|
318
|
+
// `contributionSchema` is unknown by contract — pass through as-is
|
|
319
|
+
// (may legitimately be absent for a domain that validates inside its
|
|
320
|
+
// own registrar).
|
|
321
|
+
contributionSchema: entry.contributionSchema,
|
|
322
|
+
contributionKind: kind,
|
|
323
|
+
...(discovery.status === 'ok' ? { discovery: discovery.descriptor } : {}),
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
return out;
|
|
327
|
+
}
|
|
328
|
+
/** Type guard for the closed `CapabilityContributionKind` union. */
|
|
329
|
+
function isContributionKind(value) {
|
|
330
|
+
return typeof value === 'string' && CONTRIBUTION_KINDS.includes(value);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Validate + normalize the `commands` array to `ToolCommandManifest[]`.
|
|
334
|
+
* Each entry must carry a string `name` + `description`; optional
|
|
335
|
+
* `aliases` must be a string array. Returns `undefined` on any violation.
|
|
336
|
+
*/
|
|
337
|
+
function normalizeCommands(value) {
|
|
338
|
+
if (!Array.isArray(value))
|
|
339
|
+
return undefined;
|
|
340
|
+
const out = [];
|
|
341
|
+
for (const entry of value) {
|
|
342
|
+
if (!isRecord(entry))
|
|
343
|
+
return undefined;
|
|
344
|
+
if (typeof entry.name !== 'string' || entry.name === '')
|
|
345
|
+
return undefined;
|
|
346
|
+
if (typeof entry.description !== 'string')
|
|
347
|
+
return undefined;
|
|
348
|
+
const { aliases } = entry;
|
|
349
|
+
if (aliases !== undefined && !isStringArray(aliases))
|
|
350
|
+
return undefined;
|
|
351
|
+
out.push({
|
|
352
|
+
name: entry.name,
|
|
353
|
+
description: entry.description,
|
|
354
|
+
...(aliases === undefined ? {} : { aliases }),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
return out;
|
|
358
|
+
}
|
|
359
|
+
function hashManifest(manifest) {
|
|
360
|
+
const canonical = JSON.stringify({
|
|
361
|
+
kind: manifest.kind,
|
|
362
|
+
id: manifest.id,
|
|
363
|
+
name: manifest.name,
|
|
364
|
+
version: manifest.version,
|
|
365
|
+
apiVersion: manifest.apiVersion ?? null,
|
|
366
|
+
commands: manifest.commands.map((c) => ({
|
|
367
|
+
name: c.name,
|
|
368
|
+
description: c.description,
|
|
369
|
+
aliases: c.aliases ?? null,
|
|
370
|
+
})),
|
|
371
|
+
});
|
|
372
|
+
return createHash('sha256').update(canonical, 'utf8').digest('hex');
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Read + JSON-parse a file, returning the parsed object or `undefined`
|
|
376
|
+
* when the file is missing, unreadable, unparseable, or not an object.
|
|
377
|
+
* Mirrors the JSON-read pattern in `marker-discovery.ts` (best-effort,
|
|
378
|
+
* never throws) so the discovery surfaces share one read style.
|
|
379
|
+
*/
|
|
380
|
+
function readJson(path) {
|
|
381
|
+
if (!existsSync(path))
|
|
382
|
+
return undefined;
|
|
383
|
+
try {
|
|
384
|
+
const parsed = JSON.parse(readFileSync(path, 'utf8'));
|
|
385
|
+
return isRecord(parsed) ? parsed : undefined;
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
// Best-effort read (mirrors marker-discovery.ts): a malformed/unreadable
|
|
389
|
+
// manifest file is a skip, not a crash — but we surface WHY at debug so a
|
|
390
|
+
// genuinely broken file is diagnosable rather than silently invisible.
|
|
391
|
+
logger.debug({
|
|
392
|
+
evt: 'plugin.manifest.read_failed',
|
|
393
|
+
module: LOADER_MODULE,
|
|
394
|
+
path,
|
|
395
|
+
error: error instanceof Error ? error.message : String(error),
|
|
396
|
+
});
|
|
397
|
+
return undefined;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/** Emit the structured read-failure diagnostic (debug — a missing/malformed manifest is a skip, not a crash). */
|
|
401
|
+
function diagnose(dir, source, reason) {
|
|
402
|
+
logger.debug({
|
|
403
|
+
evt: 'plugin.manifest.read_failed',
|
|
404
|
+
module: LOADER_MODULE,
|
|
405
|
+
dir,
|
|
406
|
+
source,
|
|
407
|
+
reason,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
//# sourceMappingURL=manifest-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-loader.js","sourceRoot":"","sources":["../../src/plugins/manifest-loader.ts"],"names":[],"mappings":"AAAA,8eAA8e;AAC9e;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAA6B,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAW7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,4BAA4B,CAAC;AAExE,2EAA2E;AAC3E,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAkB,EAClB,GAAW;IAEX,2EAA2E;IAC3E,sEAAsE;IACtE,MAAM,QAAQ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+
*
|
|
4
|
+
* Walks ancestor `node_modules/` directories from a project root, looking
|
|
5
|
+
* for packages whose `package.json` declares an `opensipTools.kind` value
|
|
6
|
+
* matching the requested kind. Returns the deduplicated list (first
|
|
7
|
+
* occurrence walking outward wins, matching Node's nearest-ancestor
|
|
8
|
+
* module resolution).
|
|
9
|
+
*
|
|
10
|
+
* `MarkerKind` is the closed union of HOST marker kinds — just `'tool'` now
|
|
11
|
+
* (whole-subcommand Tool plugins, a host concern). The former DOMAIN markers
|
|
12
|
+
* (`'fit-pack'`, `'sim-pack'`, `'graph-adapter'`) were RETIRED from this union
|
|
13
|
+
* once discovery became descriptor-driven (§5.3): a tool's manifest declares its
|
|
14
|
+
* own marker kind, the generic substrate discovers it via the string-typed
|
|
15
|
+
* {@link discoverPackagesByDeclaredKind}, and nothing in the host compiles in the
|
|
16
|
+
* domain vocabulary. Use {@link readDeclaredKind} for any kind that is not the
|
|
17
|
+
* host `'tool'` marker.
|
|
18
|
+
*
|
|
19
|
+
* Why a marker rather than a name pattern (for `'tool'`): a name-prefix rule
|
|
20
|
+
* breaks down once organisations publish their own scoped tool packages. The
|
|
21
|
+
* marker decouples publication scope from plugin shape.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The closed vocabulary of HOST `opensipTools.kind` markers — `'tool'` only.
|
|
25
|
+
* Domain markers (fit-pack/sim-pack/graph-adapter) are NOT here anymore: they are
|
|
26
|
+
* declared per-tool in manifests and discovered via {@link discoverPackagesByDeclaredKind}
|
|
27
|
+
* (§5.3). The workspace-invariant test validates a package.json marker against
|
|
28
|
+
* `'tool'` PLUS the marker kinds the bundled manifests declare — descriptor-driven,
|
|
29
|
+
* not a compiled-in domain list.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MARKER_KINDS: readonly ["tool"];
|
|
32
|
+
/** The closed union of HOST `opensipTools.kind` marker values — currently just `'tool'`. */
|
|
33
|
+
export type MarkerKind = (typeof MARKER_KINDS)[number];
|
|
34
|
+
/** Inputs for {@link discoverPackagesByMarker}: the project root to walk from and the marker kind to discover. */
|
|
35
|
+
export interface MarkerDiscoveryOptions {
|
|
36
|
+
/** Absolute path to the project root. */
|
|
37
|
+
readonly projectDir: string;
|
|
38
|
+
/** Which marker kind to discover. */
|
|
39
|
+
readonly kind: MarkerKind;
|
|
40
|
+
}
|
|
41
|
+
/** A package discovered by its closed-union marker kind, with name, on-disk directory, and the echoed kind. */
|
|
42
|
+
export interface DiscoveredMarkerPackage {
|
|
43
|
+
/** npm package name, e.g. '@opensip-cli/fitness' or '@my-co/fit'. */
|
|
44
|
+
readonly name: string;
|
|
45
|
+
/** Absolute path to the package's directory inside node_modules. */
|
|
46
|
+
readonly packageDir: string;
|
|
47
|
+
/** Echoed back so callers consuming multiple kinds can multiplex. */
|
|
48
|
+
readonly kind: MarkerKind;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Narrow an unknown string to MarkerKind. Used by readMarkerKind below
|
|
52
|
+
* and re-exported for callers that need to validate dynamic input.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isMarkerKind(value: unknown): value is MarkerKind;
|
|
55
|
+
/**
|
|
56
|
+
* Walk up from `projectDir` looking for `node_modules/` directories.
|
|
57
|
+
* For each one, scan top-level entries (and one level into scoped
|
|
58
|
+
* directories like `@opensip-cli/`) for packages declaring
|
|
59
|
+
* `opensipTools.kind === options.kind`. Return the deduplicated list.
|
|
60
|
+
*
|
|
61
|
+
* Same-named packages are returned once — the first occurrence walking
|
|
62
|
+
* from `projectDir` outward wins, matching Node's nearest-ancestor
|
|
63
|
+
* resolution behavior.
|
|
64
|
+
*/
|
|
65
|
+
export declare function discoverPackagesByMarker(options: MarkerDiscoveryOptions): DiscoveredMarkerPackage[];
|
|
66
|
+
/**
|
|
67
|
+
* Scan EXACTLY ONE `node_modules` directory for packages declaring
|
|
68
|
+
* `opensipTools.kind === kind` — no ancestor walk. Used for fixed plugin
|
|
69
|
+
* host dirs (`~/.opensip-cli/plugins/tool/node_modules`,
|
|
70
|
+
* `<project>/.runtime/plugins/tool/node_modules`) where walking up would
|
|
71
|
+
* wrongly pull in `$HOME/node_modules` or unrelated ancestor trees.
|
|
72
|
+
*/
|
|
73
|
+
export declare function discoverPackagesInNodeModules(nodeModulesDir: string, kind: MarkerKind): DiscoveredMarkerPackage[];
|
|
74
|
+
/**
|
|
75
|
+
* A package discovered by its declared `opensipTools.kind`, with the kind as a
|
|
76
|
+
* raw string (NOT narrowed to the closed `MarkerKind` union). This is the shape
|
|
77
|
+
* the generic capability-discovery substrate consumes — a domain's marker kind
|
|
78
|
+
* comes from its manifest descriptor, so it cannot be a compile-time union member.
|
|
79
|
+
*/
|
|
80
|
+
export interface DiscoveredDeclaredPackage {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly packageDir: string;
|
|
83
|
+
readonly kind: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Walk ancestor `node_modules/` directories from `projectDir`, returning every
|
|
87
|
+
* package whose `package.json` declares `opensipTools.kind === kind` for the
|
|
88
|
+
* given raw-string kind. The string-typed generalization of
|
|
89
|
+
* {@link discoverPackagesByMarker}: the closed-union version is a thin wrapper
|
|
90
|
+
* over this. Deduplicated; first occurrence walking outward wins.
|
|
91
|
+
*/
|
|
92
|
+
export declare function discoverPackagesByDeclaredKind(projectDir: string, kind: string): DiscoveredDeclaredPackage[];
|
|
93
|
+
/**
|
|
94
|
+
* Read the declared `opensipTools.kind` from a package's package.json.
|
|
95
|
+
* Returns the kind if it parses, is a string, and matches the closed
|
|
96
|
+
* MarkerKind union; otherwise undefined. Parse failures are logged at
|
|
97
|
+
* debug — a malformed package.json under node_modules is not a discovery
|
|
98
|
+
* concern, just an entry to skip.
|
|
99
|
+
*
|
|
100
|
+
* Exported as the canonical host-tool marker reader. Domain markers such as
|
|
101
|
+
* fit-pack and graph-adapter are descriptor-driven and use the string-typed
|
|
102
|
+
* `readDeclaredKind` / `discoverPackagesByDeclaredKind` path.
|
|
103
|
+
*/
|
|
104
|
+
export declare function readMarkerKind(packageDir: string): MarkerKind | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Read the RAW `opensipTools.kind` string from a package's package.json — the
|
|
107
|
+
* string-typed sibling of {@link readMarkerKind}, with no closed-union narrowing.
|
|
108
|
+
* Returns the string if it parses and is a string; otherwise undefined. Parse
|
|
109
|
+
* failures are logged at debug (a malformed node_modules package.json is an
|
|
110
|
+
* entry to skip, not a discovery error). The generic discovery substrate reads
|
|
111
|
+
* declared kinds through this one function so there is no second implementation
|
|
112
|
+
* to drift.
|
|
113
|
+
*/
|
|
114
|
+
export declare function readDeclaredKind(packageDir: string): string | undefined;
|
|
115
|
+
//# sourceMappingURL=marker-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-discovery.d.ts","sourceRoot":"","sources":["../../src/plugins/marker-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,mBAAoB,CAAC;AAE9C,4FAA4F;AAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,kHAAkH;AAClH,MAAM,WAAW,sBAAsB;IACrC,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,+GAA+G;AAC/G,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;;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