@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,283 @@
|
|
|
1
|
+
// @fitness-ignore-file error-handling-quality -- this module IS the logger; its own write/prune failures cannot be reported via itself without infinite recursion. Best-effort swallow is the documented contract on lines 273/281/297/302.
|
|
2
|
+
// @fitness-ignore-file interface-implementation-consistency -- LoggerImpl deliberately exposes configuration methods (applyOptions/setSilent/setDebugMode/setRunId/getRunId/setRunIdProvider/initLogFile) that are not on the public `Logger` interface. The interface is the narrow log-emission seam used by call sites; the impl's wider surface is the bootstrap/test configuration surface (see JSDoc on LoggerImpl).
|
|
3
|
+
/**
|
|
4
|
+
* Structured logger for opensip-cli.
|
|
5
|
+
*
|
|
6
|
+
* Outputs JSON log lines with:
|
|
7
|
+
* - ts: ISO timestamp
|
|
8
|
+
* - level: debug | info | warn | error
|
|
9
|
+
* - evt: event name (e.g., 'cli.start', 'cli.check.complete')
|
|
10
|
+
* - runId: correlation ID for the current CLI invocation
|
|
11
|
+
* - msg: human-readable message
|
|
12
|
+
* - ...data: additional structured fields
|
|
13
|
+
*
|
|
14
|
+
* Destinations:
|
|
15
|
+
* - File: <project>/opensip-cli/.runtime/logs/{YYYY-MM-DD}.jsonl
|
|
16
|
+
* The CLI bootstrap supplies this path via configureLogger({ logDir }).
|
|
17
|
+
* Without that, file output is disabled — user-global state
|
|
18
|
+
* (`~/.opensip-cli/`) is reserved for config.yml only.
|
|
19
|
+
* - stderr: when debug mode is enabled (Ink renders to stdout, logs to stderr)
|
|
20
|
+
*
|
|
21
|
+
* The `silent: true` option only suppresses stderr output, NOT file output.
|
|
22
|
+
*
|
|
23
|
+
* Two access patterns:
|
|
24
|
+
*
|
|
25
|
+
* 1. The exported `logger` singleton + `configureLogger(opts)`. Used
|
|
26
|
+
* by the CLI bootstrap and any production caller that wants the
|
|
27
|
+
* process-wide configuration. The four prior free mutators
|
|
28
|
+
* (`setSilent`, `setDebugMode`, `setRunId`, `initLogFile`) were
|
|
29
|
+
* collapsed into `configureLogger` in T1 deferred Item C.
|
|
30
|
+
*
|
|
31
|
+
* 2. The exported `LoggerImpl` class. Used by tests (or tools that
|
|
32
|
+
* need an isolated logger) to construct a fresh instance whose
|
|
33
|
+
* state is independent of the singleton.
|
|
34
|
+
*/
|
|
35
|
+
import { appendFileSync, mkdirSync, readdirSync, unlinkSync } from 'node:fs';
|
|
36
|
+
import { join } from 'node:path';
|
|
37
|
+
const LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
38
|
+
const MAX_LOG_AGE_DAYS = 7;
|
|
39
|
+
/** Concrete logger writing JSONL to stderr and an optional daily file. */
|
|
40
|
+
export class LoggerImpl {
|
|
41
|
+
currentLevel;
|
|
42
|
+
silent = false;
|
|
43
|
+
debugMode = false;
|
|
44
|
+
runId;
|
|
45
|
+
logFilePath;
|
|
46
|
+
runIdProvider;
|
|
47
|
+
constructor(opts = {}) {
|
|
48
|
+
this.currentLevel = opts.level ?? 'warn';
|
|
49
|
+
this.applyOptions(opts);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Apply a `LoggerOptions` bag to this instance. Used by the singleton
|
|
53
|
+
* via `configureLogger(opts)` — the bootstrap-time configuration seam
|
|
54
|
+
* that collapsed the four prior free mutators into one shot. Each
|
|
55
|
+
* field is independent: an `applyOptions({ silent: true })` leaves
|
|
56
|
+
* `debugMode` and `runId` alone.
|
|
57
|
+
*/
|
|
58
|
+
applyOptions(opts) {
|
|
59
|
+
if (opts.level !== undefined)
|
|
60
|
+
this.currentLevel = opts.level;
|
|
61
|
+
if (opts.silent !== undefined)
|
|
62
|
+
this.silent = opts.silent;
|
|
63
|
+
if (opts.debugMode !== undefined) {
|
|
64
|
+
this.debugMode = opts.debugMode;
|
|
65
|
+
if (opts.debugMode)
|
|
66
|
+
this.currentLevel = 'debug';
|
|
67
|
+
}
|
|
68
|
+
if (opts.runId !== undefined)
|
|
69
|
+
this.runId = opts.runId;
|
|
70
|
+
if (opts.logDir !== undefined)
|
|
71
|
+
this.initLogFile(opts.logDir);
|
|
72
|
+
}
|
|
73
|
+
debug(msgOrObj, data) {
|
|
74
|
+
this.log('debug', msgOrObj, data);
|
|
75
|
+
}
|
|
76
|
+
info(msgOrObj, data) {
|
|
77
|
+
this.log('info', msgOrObj, data);
|
|
78
|
+
}
|
|
79
|
+
warn(msgOrObj, data) {
|
|
80
|
+
this.log('warn', msgOrObj, data);
|
|
81
|
+
}
|
|
82
|
+
error(msgOrObj, data) {
|
|
83
|
+
this.log('error', msgOrObj, data);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Suppress stderr output. File output still occurs. Used by the CLI
|
|
87
|
+
* to silence the logger during Ink renders (Ink owns stdout; stderr
|
|
88
|
+
* is reserved for `--debug` traces). Tests use this on fresh
|
|
89
|
+
* `new LoggerImpl()` instances to verify the silent-mode contract.
|
|
90
|
+
*/
|
|
91
|
+
setSilent(value) {
|
|
92
|
+
this.silent = value;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Enable debug-level output to stderr. Sets the current level to
|
|
96
|
+
* `'debug'` when enabled. Disabling does NOT restore a prior level.
|
|
97
|
+
*/
|
|
98
|
+
setDebugMode(value) {
|
|
99
|
+
this.debugMode = value;
|
|
100
|
+
if (value)
|
|
101
|
+
this.currentLevel = 'debug';
|
|
102
|
+
}
|
|
103
|
+
/** Set the correlation id stamped on each log entry. */
|
|
104
|
+
setRunId(id) {
|
|
105
|
+
this.runId = id;
|
|
106
|
+
}
|
|
107
|
+
getRunId() {
|
|
108
|
+
return this.runId;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Inject a runId source consulted on every `log()`. Lets the kernel
|
|
112
|
+
* route the singleton through the RunScope-bound runId without the
|
|
113
|
+
* logger module having to import run-scope.ts (which would create a
|
|
114
|
+
* cycle, since run-scope already imports the logger).
|
|
115
|
+
*/
|
|
116
|
+
setRunIdProvider(provider) {
|
|
117
|
+
this.runIdProvider = provider;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Initialize the log file for this instance.
|
|
121
|
+
*
|
|
122
|
+
* Writes to `<dir>/<YYYY-MM-DD>.jsonl`; the CLI bootstrap supplies
|
|
123
|
+
* the path from `resolveProjectPaths(cwd).logsDir`. Without a call
|
|
124
|
+
* to this function, file output is disabled (logs still hit stderr
|
|
125
|
+
* in debug mode).
|
|
126
|
+
*
|
|
127
|
+
* Prunes log files older than 7 days inside the chosen directory.
|
|
128
|
+
*
|
|
129
|
+
* @internal — production callers route through `configureLogger`'s
|
|
130
|
+
* `logDir` option. The method is `private` from a domain-design
|
|
131
|
+
* standpoint but TypeScript can't mark it `private` because the
|
|
132
|
+
* constructor calls it via `applyOptions`.
|
|
133
|
+
*/
|
|
134
|
+
initLogFile(dir) {
|
|
135
|
+
try {
|
|
136
|
+
mkdirSync(dir, { recursive: true });
|
|
137
|
+
// Partition by the UTC calendar date (toISOString is always UTC).
|
|
138
|
+
// This makes log file names stable and sortable across timezones.
|
|
139
|
+
// pruneOldLogs respects the same UTC-bucket convention for retention.
|
|
140
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
141
|
+
this.logFilePath = join(dir, `${today}.jsonl`);
|
|
142
|
+
pruneOldLogs(dir);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// Best effort — don't crash if we can't create the log directory
|
|
146
|
+
this.logFilePath = undefined;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
shouldLog(level) {
|
|
150
|
+
return LEVELS[level] >= LEVELS[this.currentLevel];
|
|
151
|
+
}
|
|
152
|
+
shouldWriteToFile(level) {
|
|
153
|
+
// Always write info+ to the log file regardless of silent mode.
|
|
154
|
+
// Silent mode suppresses stderr output (for Ink rendering), not file output.
|
|
155
|
+
// In debug mode, write everything (including debug) to file.
|
|
156
|
+
if (this.debugMode)
|
|
157
|
+
return true;
|
|
158
|
+
return LEVELS[level] >= LEVELS.info;
|
|
159
|
+
}
|
|
160
|
+
log(level, msgOrObj, data) {
|
|
161
|
+
if (!this.shouldLog(level) && !this.logFilePath)
|
|
162
|
+
return;
|
|
163
|
+
// RunScope-bound runId wins over the instance-level field.
|
|
164
|
+
// Production callers always go through the singleton inside a
|
|
165
|
+
// `runWithScope`/`enterScope` block; the kernel binds a
|
|
166
|
+
// `runIdProvider` at module init that reads `currentScope()?.runId`
|
|
167
|
+
// (Item 2 — runId moved off the singleton onto RunScope as a flat
|
|
168
|
+
// kernel field). Tests that construct an isolated `new LoggerImpl()`
|
|
169
|
+
// outside any scope still get instance-level runId via the fallback.
|
|
170
|
+
const scopedRunId = this.runIdProvider?.();
|
|
171
|
+
const effectiveRunId = scopedRunId !== undefined && scopedRunId !== '' ? scopedRunId : this.runId;
|
|
172
|
+
const entry = formatEntry(level, msgOrObj, data, effectiveRunId);
|
|
173
|
+
if (this.shouldWriteToFile(level)) {
|
|
174
|
+
writeToFile(this.logFilePath, entry);
|
|
175
|
+
}
|
|
176
|
+
// Write to stderr only when debugMode is on. setSilent(true) is called
|
|
177
|
+
// during preAction so Ink owns stdout; stderr is reserved for --debug.
|
|
178
|
+
if (this.shouldLog(level) && this.debugMode && !this.silent) {
|
|
179
|
+
writeToStderr(entry);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function formatEntry(level, msgOrObj, data, runId) {
|
|
184
|
+
const entry = {
|
|
185
|
+
ts: new Date().toISOString(),
|
|
186
|
+
level,
|
|
187
|
+
};
|
|
188
|
+
if (runId)
|
|
189
|
+
entry.runId = runId;
|
|
190
|
+
if (typeof msgOrObj === 'string') {
|
|
191
|
+
entry.msg = msgOrObj;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
Object.assign(entry, msgOrObj);
|
|
195
|
+
}
|
|
196
|
+
if (data)
|
|
197
|
+
Object.assign(entry, data);
|
|
198
|
+
return entry;
|
|
199
|
+
}
|
|
200
|
+
function writeToFile(logFilePath, entry) {
|
|
201
|
+
if (!logFilePath)
|
|
202
|
+
return;
|
|
203
|
+
try {
|
|
204
|
+
appendFileSync(logFilePath, JSON.stringify(entry) + '\n');
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Best effort — don't crash the CLI if logging fails
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function writeToStderr(entry) {
|
|
211
|
+
try {
|
|
212
|
+
process.stderr.write(JSON.stringify(entry) + '\n');
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// Best effort
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function pruneOldLogs(dir) {
|
|
219
|
+
try {
|
|
220
|
+
// Retention is based on the UTC calendar date embedded in the filename
|
|
221
|
+
// (which is produced by toISOString().slice(0,10) at creation time).
|
|
222
|
+
// Compute a cutoff as "N full UTC days before now" to avoid engine-
|
|
223
|
+
// dependent interpretation of bare "YYYY-MM-DD" strings and TZ skew.
|
|
224
|
+
const cutoff = Date.now() - MAX_LOG_AGE_DAYS * 24 * 60 * 60 * 1000;
|
|
225
|
+
const files = readdirSync(dir);
|
|
226
|
+
for (const file of files) {
|
|
227
|
+
if (!file.endsWith('.jsonl'))
|
|
228
|
+
continue;
|
|
229
|
+
const dateStr = file.replace('.jsonl', '');
|
|
230
|
+
// Parse the bucket date as UTC midnight so comparisons are independent
|
|
231
|
+
// of local TZ and of how the JS engine treats new Date('YYYY-MM-DD').
|
|
232
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateStr);
|
|
233
|
+
if (!m)
|
|
234
|
+
continue;
|
|
235
|
+
const [, y, mo, d] = m;
|
|
236
|
+
const fileUtcMs = Date.UTC(Number(y), Number(mo) - 1, Number(d));
|
|
237
|
+
if (fileUtcMs < cutoff) {
|
|
238
|
+
try {
|
|
239
|
+
unlinkSync(join(dir, file));
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
// Skip files we can't delete
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
// Best effort
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// =============================================================================
|
|
252
|
+
// SINGLETON + COMPATIBILITY HELPERS
|
|
253
|
+
// =============================================================================
|
|
254
|
+
/**
|
|
255
|
+
* Process-wide logger singleton. CLI bootstrap configures it via
|
|
256
|
+
* `configureLogger(opts)` once at startup; production callers import
|
|
257
|
+
* this constant directly. Tests should construct a fresh
|
|
258
|
+
* `new LoggerImpl({...})` instead of mutating the singleton's state.
|
|
259
|
+
*
|
|
260
|
+
* Typed as the `Logger` interface (not the concrete class) so generic
|
|
261
|
+
* call sites see only the four log-level methods. Configuration
|
|
262
|
+
* reaches the underlying instance through `configureLogger`, which is
|
|
263
|
+
* the only seam — the four free mutators (`setSilent`, `setDebugMode`,
|
|
264
|
+
* `setRunId`, `initLogFile`) that previously existed are gone
|
|
265
|
+
* (T1 deferred Item C).
|
|
266
|
+
*/
|
|
267
|
+
const _logger = new LoggerImpl();
|
|
268
|
+
export const logger = _logger;
|
|
269
|
+
/**
|
|
270
|
+
* One-shot configuration for the process-wide `logger` singleton.
|
|
271
|
+
* Replaces the four free mutators that previously each mutated one
|
|
272
|
+
* field. The CLI's pre-action-hook calls this once with all relevant
|
|
273
|
+
* options after flags are parsed and the project context is resolved.
|
|
274
|
+
*
|
|
275
|
+
* SaaS hosts that run multiple invocations concurrently should NOT use
|
|
276
|
+
* this — they construct per-invocation `new LoggerImpl({...})` and
|
|
277
|
+
* wire it into the `RunScope.logger` field so each run has its own
|
|
278
|
+
* file path and runId.
|
|
279
|
+
*/
|
|
280
|
+
export function configureLogger(opts) {
|
|
281
|
+
_logger.applyOptions(opts);
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,4OAA4O;AAC5O,2ZAA2Z;AAC3Z;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAA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GAAG,IAAI,UAAU,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,MAAM,GAAW,OAAO,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,IAAmB;IACjD,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the nearest enclosing package.json's `version` field.
|
|
3
|
+
*
|
|
4
|
+
* Pass `import.meta.url` from the calling module. The function walks
|
|
5
|
+
* up from that module's directory until it finds a package.json, then
|
|
6
|
+
* returns its `version`. This is the standard way for a Tool to set
|
|
7
|
+
* its `metadata.version` without duplicating the literal in source.
|
|
8
|
+
*
|
|
9
|
+
* Result is cached per `metaUrl` so subsequent calls from the same
|
|
10
|
+
* module are O(1).
|
|
11
|
+
*
|
|
12
|
+
* Returns `'0.0.0'` if no package.json is found or if it lacks a
|
|
13
|
+
* version field — Tools should treat that as "version unknown" rather
|
|
14
|
+
* than crash. In practice this only happens in malformed installs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readPackageVersion(metaUrl: string): string;
|
|
17
|
+
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/lib/package-version.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA0B1D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @fitness-ignore-file error-handling-quality -- upward package.json walk: a missing/unreadable package.json at any non-root level is the expected non-terminal signal to keep walking; logging would be noisy and load-bearing-incorrect.
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join, parse } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
/**
|
|
6
|
+
* Per-`metaUrl` cache. Each call site (typically a Tool's metadata
|
|
7
|
+
* factory) hands in a stable `import.meta.url`, so the resolved
|
|
8
|
+
* version is constant for the process lifetime. Memoizing avoids the
|
|
9
|
+
* O(depth) `package.json` walk on every call as the helper sees more
|
|
10
|
+
* adoption from third-party tools.
|
|
11
|
+
*/
|
|
12
|
+
const versionCache = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* Read the nearest enclosing package.json's `version` field.
|
|
15
|
+
*
|
|
16
|
+
* Pass `import.meta.url` from the calling module. The function walks
|
|
17
|
+
* up from that module's directory until it finds a package.json, then
|
|
18
|
+
* returns its `version`. This is the standard way for a Tool to set
|
|
19
|
+
* its `metadata.version` without duplicating the literal in source.
|
|
20
|
+
*
|
|
21
|
+
* Result is cached per `metaUrl` so subsequent calls from the same
|
|
22
|
+
* module are O(1).
|
|
23
|
+
*
|
|
24
|
+
* Returns `'0.0.0'` if no package.json is found or if it lacks a
|
|
25
|
+
* version field — Tools should treat that as "version unknown" rather
|
|
26
|
+
* than crash. In practice this only happens in malformed installs.
|
|
27
|
+
*/
|
|
28
|
+
export function readPackageVersion(metaUrl) {
|
|
29
|
+
const cached = versionCache.get(metaUrl);
|
|
30
|
+
if (cached !== undefined)
|
|
31
|
+
return cached;
|
|
32
|
+
let dir = dirname(fileURLToPath(metaUrl));
|
|
33
|
+
const { root } = parse(dir);
|
|
34
|
+
while (true) {
|
|
35
|
+
try {
|
|
36
|
+
const pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
|
|
37
|
+
if (typeof pkg.version === 'string' && pkg.version.length > 0) {
|
|
38
|
+
versionCache.set(metaUrl, pkg.version);
|
|
39
|
+
return pkg.version;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// No package.json at this level — keep walking up.
|
|
44
|
+
}
|
|
45
|
+
if (dir === root) {
|
|
46
|
+
versionCache.set(metaUrl, '0.0.0');
|
|
47
|
+
return '0.0.0';
|
|
48
|
+
}
|
|
49
|
+
dir = dirname(dir);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=package-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/lib/package-version.ts"],"names":[],"mappings":"AAAA,2OAA2O;AAC3O,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAExC,IAAI,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5B,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAErE,CAAC;YACF,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9D,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,OAAO,GAAG,CAAC,OAAO,CAAC;YACrB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,mDAAmD;QACrD,CAAC;QAED,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACnC,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Path resolution for opensip-cli project + user state.
|
|
3
|
+
*
|
|
4
|
+
* Per-project state lives at:
|
|
5
|
+
*
|
|
6
|
+
* <project>/opensip-cli.config.yml ← TRACKED — project config
|
|
7
|
+
* <project>/opensip-cli/ ← TRACKED — user-authored
|
|
8
|
+
* fit/checks/<*.mjs> ← custom fitness checks
|
|
9
|
+
* fit/recipes/<*.mjs> ← custom fitness recipes
|
|
10
|
+
* sim/scenarios/<*.mjs> ← custom sim scenarios
|
|
11
|
+
* sim/recipes/<*.mjs> ← custom sim recipes
|
|
12
|
+
* tools/<name>/opensip-tool.manifest.json ← TRACKED authored Tool
|
|
13
|
+
* (whole subcommand; the
|
|
14
|
+
* project-local analogue of
|
|
15
|
+
* fit/checks + sim/scenarios —
|
|
16
|
+
* lives BESIDE fit/sim, NOT
|
|
17
|
+
* under .runtime/;
|
|
18
|
+
* deny-by-default)
|
|
19
|
+
* .runtime/ ← GITIGNORED — runtime state
|
|
20
|
+
* sessions/ ← run history
|
|
21
|
+
* reports/ ← dashboard HTML
|
|
22
|
+
* logs/ ← structured JSONL logs
|
|
23
|
+
* datastore.sqlite ← sessions, baselines, catalog
|
|
24
|
+
* cache/ ← AST + prewarm caches
|
|
25
|
+
* plugins/<fit|sim>/node_modules/ ← npm-installed plugins
|
|
26
|
+
*
|
|
27
|
+
* ~/.opensip-cli/ ← USER-LEVEL (cross-project)
|
|
28
|
+
* config.yml ← cloud API key, defaults
|
|
29
|
+
* plugins/tool/node_modules/ ← user-global Tool plugins
|
|
30
|
+
* (whole subcommands;
|
|
31
|
+
* available in every project)
|
|
32
|
+
* tools/<name>/opensip-tool.manifest.json ← user-global authored Tool
|
|
33
|
+
* (trusted-by-default authored
|
|
34
|
+
* sidecar; the `npm i -g`
|
|
35
|
+
* analogue for authored code)
|
|
36
|
+
*
|
|
37
|
+
* Every consumer (logger, persistence/store, gate, plugin loader,
|
|
38
|
+
* configure command, uninstall command) constructs paths through this
|
|
39
|
+
* resolver instead of using inline string concatenation, so a future
|
|
40
|
+
* change to the layout is a single-file edit.
|
|
41
|
+
*/
|
|
42
|
+
import type { ToolShortId } from '../tools/ids.js';
|
|
43
|
+
/** Per-project paths produced by `resolveProjectPaths(projectDir)`. */
|
|
44
|
+
export interface ProjectPaths {
|
|
45
|
+
/** Absolute path to the project root (== input). */
|
|
46
|
+
readonly projectDir: string;
|
|
47
|
+
/** <project>/opensip-cli.config.yml */
|
|
48
|
+
readonly configFile: string;
|
|
49
|
+
/** <project>/opensip-cli — user-authored content root. */
|
|
50
|
+
readonly userSourceDir: string;
|
|
51
|
+
/**
|
|
52
|
+
* `<project>/opensip-cli/tools` — TRACKED authored Tool sidecars (the
|
|
53
|
+
* whole-subcommand analogue of fit/checks + sim/scenarios). Each child is
|
|
54
|
+
* a `<name>/opensip-tool.manifest.json` sidecar. Lives BESIDE `fit/` and
|
|
55
|
+
* `sim/`, NOT under `.runtime/`; deny-by-default at admission.
|
|
56
|
+
*/
|
|
57
|
+
readonly authoredToolsDir: string;
|
|
58
|
+
/**
|
|
59
|
+
* `<project>/opensip-cli/<domain>/<kind>` — a tool's user-authored
|
|
60
|
+
* plugin source dir (e.g. `userPluginDir('fit', 'checks')`). Generic
|
|
61
|
+
* over (domain, kind) so the kernel carries no fit/sim vocabulary
|
|
62
|
+
* (ADR-0009 corollary 1); the layout's `userSubdirs` supply the kinds.
|
|
63
|
+
*/
|
|
64
|
+
readonly userPluginDir: (domain: string, kind: string) => string;
|
|
65
|
+
/** <project>/opensip-cli/.runtime — gitignored runtime state. */
|
|
66
|
+
readonly runtimeDir: string;
|
|
67
|
+
/** <project>/opensip-cli/.runtime/sessions */
|
|
68
|
+
readonly sessionsDir: string;
|
|
69
|
+
/** <project>/opensip-cli/.runtime/reports */
|
|
70
|
+
readonly reportsDir: string;
|
|
71
|
+
/** <project>/opensip-cli/.runtime/logs */
|
|
72
|
+
readonly logsDir: string;
|
|
73
|
+
/** <project>/opensip-cli/.runtime/cache */
|
|
74
|
+
readonly cacheDir: string;
|
|
75
|
+
/** <project>/opensip-cli/.runtime/cache/graph — graph-tool catalog cache root. */
|
|
76
|
+
readonly graphCacheDir: string;
|
|
77
|
+
/** <project>/opensip-cli/.runtime/plugins/<domain> — npm-installed plugins. */
|
|
78
|
+
readonly pluginsDir: (domain: string) => string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Path-resolver domain set for FIRST-PARTY tools — the storage/path
|
|
82
|
+
* discriminator (`'fit' | 'sim' | 'graph'`). Aliased to `ToolShortId`
|
|
83
|
+
* from the central registry (audit-round-3 Finding H) so first-party
|
|
84
|
+
* path/storage sites stay in sync.
|
|
85
|
+
*
|
|
86
|
+
* Note this is tool *identity*, a separate concern from plugin
|
|
87
|
+
* *discovery*: `pluginsDir` / `userPluginDir` take a plain `string` so
|
|
88
|
+
* third-party tools can host project-local plugins without being listed
|
|
89
|
+
* here (ADR-0009 corollary 1).
|
|
90
|
+
*/
|
|
91
|
+
export type PathDomain = ToolShortId;
|
|
92
|
+
/** Resolve the project path layout for a given project directory. */
|
|
93
|
+
export declare function resolveProjectPaths(projectDir: string): ProjectPaths;
|
|
94
|
+
/** User-level paths in `~/.opensip-cli/`. */
|
|
95
|
+
export interface UserPaths {
|
|
96
|
+
/** ~/.opensip-cli — root for all user-level state. */
|
|
97
|
+
readonly userHomeDir: string;
|
|
98
|
+
/** ~/.opensip-cli/config.yml — cloud API key + per-user defaults. */
|
|
99
|
+
readonly configFile: string;
|
|
100
|
+
/**
|
|
101
|
+
* `~/.opensip-cli/plugins/<domain>` — user-global (cross-project)
|
|
102
|
+
* npm-installed plugins. Used today by the `tool` domain: a Tool plugin
|
|
103
|
+
* is a whole subcommand, so a user-global install makes it available in
|
|
104
|
+
* every project (like `npm i -g`), unlike fit/sim packs which are
|
|
105
|
+
* project-committed. Generic over domain for symmetry with
|
|
106
|
+
* `ProjectPaths.pluginsDir`.
|
|
107
|
+
*/
|
|
108
|
+
readonly pluginsDir: (domain: string) => string;
|
|
109
|
+
/**
|
|
110
|
+
* `~/.opensip-cli/tools` — global authored Tool sidecars
|
|
111
|
+
* (trusted-by-default). Each child is a
|
|
112
|
+
* `<name>/opensip-tool.manifest.json` sidecar. The user placed it in
|
|
113
|
+
* their own home dir → admitted without an allowlist (the `npm i -g`
|
|
114
|
+
* analogue for authored code).
|
|
115
|
+
*/
|
|
116
|
+
readonly authoredToolsDir: string;
|
|
117
|
+
/**
|
|
118
|
+
* ~/.opensip-cli/update-state.json — tool-generated cache of the
|
|
119
|
+
* last-known newer published version, so the "update available" notice can
|
|
120
|
+
* persist across runs instead of showing once. NOT user-authored: written
|
|
121
|
+
* by the update notifier, cleared automatically once the running version
|
|
122
|
+
* catches up. Distinct from `configFile`, which holds user-authored config.
|
|
123
|
+
*/
|
|
124
|
+
readonly updateStateFile: string;
|
|
125
|
+
}
|
|
126
|
+
/** Resolve the user-level path layout. */
|
|
127
|
+
export declare function resolveUserPaths(): UserPaths;
|
|
128
|
+
/**
|
|
129
|
+
* Returns true iff `child`, after resolving symlinks via realpath, is the same
|
|
130
|
+
* path as `parent` or located inside it (native-separator prefix match after
|
|
131
|
+
* realpath). Returns false on any error (missing, unresolvable, permission, etc).
|
|
132
|
+
*
|
|
133
|
+
* Canonical helper for preventing path escape / symlink traversal in glob
|
|
134
|
+
* results, plugin discovery, targeting, etc. See also the cli-realpath-validation
|
|
135
|
+
* fitness check that enforces use of realpath-based containment over naive
|
|
136
|
+
* `.startsWith`.
|
|
137
|
+
*/
|
|
138
|
+
export declare function isPathInside(child: string, parent: string): boolean;
|
|
139
|
+
//# sourceMappingURL=paths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6C;AAC7C,MAAM,WAAW,SAAS;IACxB,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,0CAA0C;AAC1C,wBAAgB,gBAAgB,IAAI,SAAS,CAS5C;AAMD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAYnE"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Path resolution for opensip-cli project + user state.
|
|
3
|
+
*
|
|
4
|
+
* Per-project state lives at:
|
|
5
|
+
*
|
|
6
|
+
* <project>/opensip-cli.config.yml ← TRACKED — project config
|
|
7
|
+
* <project>/opensip-cli/ ← TRACKED — user-authored
|
|
8
|
+
* fit/checks/<*.mjs> ← custom fitness checks
|
|
9
|
+
* fit/recipes/<*.mjs> ← custom fitness recipes
|
|
10
|
+
* sim/scenarios/<*.mjs> ← custom sim scenarios
|
|
11
|
+
* sim/recipes/<*.mjs> ← custom sim recipes
|
|
12
|
+
* tools/<name>/opensip-tool.manifest.json ← TRACKED authored Tool
|
|
13
|
+
* (whole subcommand; the
|
|
14
|
+
* project-local analogue of
|
|
15
|
+
* fit/checks + sim/scenarios —
|
|
16
|
+
* lives BESIDE fit/sim, NOT
|
|
17
|
+
* under .runtime/;
|
|
18
|
+
* deny-by-default)
|
|
19
|
+
* .runtime/ ← GITIGNORED — runtime state
|
|
20
|
+
* sessions/ ← run history
|
|
21
|
+
* reports/ ← dashboard HTML
|
|
22
|
+
* logs/ ← structured JSONL logs
|
|
23
|
+
* datastore.sqlite ← sessions, baselines, catalog
|
|
24
|
+
* cache/ ← AST + prewarm caches
|
|
25
|
+
* plugins/<fit|sim>/node_modules/ ← npm-installed plugins
|
|
26
|
+
*
|
|
27
|
+
* ~/.opensip-cli/ ← USER-LEVEL (cross-project)
|
|
28
|
+
* config.yml ← cloud API key, defaults
|
|
29
|
+
* plugins/tool/node_modules/ ← user-global Tool plugins
|
|
30
|
+
* (whole subcommands;
|
|
31
|
+
* available in every project)
|
|
32
|
+
* tools/<name>/opensip-tool.manifest.json ← user-global authored Tool
|
|
33
|
+
* (trusted-by-default authored
|
|
34
|
+
* sidecar; the `npm i -g`
|
|
35
|
+
* analogue for authored code)
|
|
36
|
+
*
|
|
37
|
+
* Every consumer (logger, persistence/store, gate, plugin loader,
|
|
38
|
+
* configure command, uninstall command) constructs paths through this
|
|
39
|
+
* resolver instead of using inline string concatenation, so a future
|
|
40
|
+
* change to the layout is a single-file edit.
|
|
41
|
+
*/
|
|
42
|
+
import { realpathSync } from 'node:fs';
|
|
43
|
+
import { homedir } from 'node:os';
|
|
44
|
+
import { join, sep } from 'node:path';
|
|
45
|
+
/** Resolve the project path layout for a given project directory. */
|
|
46
|
+
export function resolveProjectPaths(projectDir) {
|
|
47
|
+
const userSourceDir = join(projectDir, 'opensip-cli');
|
|
48
|
+
const runtimeDir = join(userSourceDir, '.runtime');
|
|
49
|
+
const cacheDir = join(runtimeDir, 'cache');
|
|
50
|
+
const graphCacheDir = join(cacheDir, 'graph');
|
|
51
|
+
return {
|
|
52
|
+
projectDir,
|
|
53
|
+
configFile: join(projectDir, 'opensip-cli.config.yml'),
|
|
54
|
+
userSourceDir,
|
|
55
|
+
authoredToolsDir: join(userSourceDir, 'tools'),
|
|
56
|
+
userPluginDir: (domain, kind) => join(userSourceDir, domain, kind),
|
|
57
|
+
runtimeDir,
|
|
58
|
+
sessionsDir: join(runtimeDir, 'sessions'),
|
|
59
|
+
reportsDir: join(runtimeDir, 'reports'),
|
|
60
|
+
logsDir: join(runtimeDir, 'logs'),
|
|
61
|
+
cacheDir,
|
|
62
|
+
graphCacheDir,
|
|
63
|
+
pluginsDir: (domain) => join(runtimeDir, 'plugins', domain),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Resolve the user-level path layout. */
|
|
67
|
+
export function resolveUserPaths() {
|
|
68
|
+
const userHomeDir = join(homedir(), '.opensip-cli');
|
|
69
|
+
return {
|
|
70
|
+
userHomeDir,
|
|
71
|
+
configFile: join(userHomeDir, 'config.yml'),
|
|
72
|
+
updateStateFile: join(userHomeDir, 'update-state.json'),
|
|
73
|
+
authoredToolsDir: join(userHomeDir, 'tools'),
|
|
74
|
+
pluginsDir: (domain) => join(userHomeDir, 'plugins', domain),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// =============================================================================
|
|
78
|
+
// SAFE PATH CONTAINMENT
|
|
79
|
+
// =============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Returns true iff `child`, after resolving symlinks via realpath, is the same
|
|
82
|
+
* path as `parent` or located inside it (native-separator prefix match after
|
|
83
|
+
* realpath). Returns false on any error (missing, unresolvable, permission, etc).
|
|
84
|
+
*
|
|
85
|
+
* Canonical helper for preventing path escape / symlink traversal in glob
|
|
86
|
+
* results, plugin discovery, targeting, etc. See also the cli-realpath-validation
|
|
87
|
+
* fitness check that enforces use of realpath-based containment over naive
|
|
88
|
+
* `.startsWith`.
|
|
89
|
+
*/
|
|
90
|
+
export function isPathInside(child, parent) {
|
|
91
|
+
let realChild;
|
|
92
|
+
let realParent;
|
|
93
|
+
try {
|
|
94
|
+
realChild = realpathSync(child);
|
|
95
|
+
realParent = realpathSync(parent);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// @swallow-ok realpathSync throws when a path does not exist; fail closed (treat as "not inside")
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (realChild === realParent)
|
|
102
|
+
return true;
|
|
103
|
+
return realChild.startsWith(realParent + sep);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AA2DtC,qEAAqE;AACrE,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO;QACL,UAAU;QACV,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,wBAAwB,CAAC;QACtD,aAAa;QACb,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC;QAC9C,aAAa,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC;QAClE,UAAU;QACV,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;QACzC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC;QACvC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;QACjC,QAAQ;QACR,aAAa;QACb,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC;KAC5D,CAAC;AACJ,CAAC;AAuCD,0CAA0C;AAC1C,MAAM,UAAU,gBAAgB;IAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;IACpD,OAAO;QACL,WAAW;QACX,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC;QAC3C,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC;QACvD,gBAAgB,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;QAC5C,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAEhF;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,MAAc;IACxD,IAAI,SAAiB,CAAC;IACtB,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAChC,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,kGAAkG;QAClG,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,SAAS,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,SAAS,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract the inner `__version` (if present and valid) from an opaque tool-owned payload.
|
|
3
|
+
*
|
|
4
|
+
* This is the single canonical helper for the payload schema evolution convention.
|
|
5
|
+
* It is intentionally pure, tiny, and has zero knowledge of any tool's payload shape
|
|
6
|
+
* (FitnessSessionPayload, GraphSessionPayload, etc.). Callers in session-store and
|
|
7
|
+
* the individual tools use it to decide legacy projection vs. current shape.
|
|
8
|
+
*
|
|
9
|
+
* Rules (defensive, per plan hardening):
|
|
10
|
+
* - Only plain objects are inspected.
|
|
11
|
+
* - `__version` must be a positive finite number.
|
|
12
|
+
* - Missing, non-numeric, <=0, Infinity, NaN → undefined (treated as legacy v1 by callers).
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractPayloadVersion(payload: unknown): number | undefined;
|
|
15
|
+
//# sourceMappingURL=payload-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-version.d.ts","sourceRoot":"","sources":["../../src/lib/payload-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAS1E"}
|