@cdxgen/cdxgen 13.5.0 → 13.7.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/README.md +17 -10
- package/bin/audit.js +7 -4
- package/bin/cdxgen.js +260 -37
- package/bin/convert.js +146 -22
- package/bin/evinse.js +28 -3
- package/bin/repl.js +47 -3
- package/bin/sign.js +211 -34
- package/bin/tracebom.js +18 -6
- package/bin/validate.js +24 -3
- package/bin/verify.js +113 -5
- package/data/behavior-taxonomy.schema.json +1491 -0
- package/data/cyclonedx-2.0-bundled.schema.json +18606 -5528
- package/data/cyclonedx-2.0-cryptography-defs.schema.json +857 -0
- package/data/license-aliases.json +24 -2
- package/data/pqc-migration.json +239 -0
- package/data/remediations.json +176 -0
- package/data/rules/ai-bom.yaml +1 -1
- package/data/rules/brotli-decoder.yaml +107 -0
- package/data/rules/cbom-security.yaml +4 -3
- package/data/rules/package-integrity.yaml +28 -0
- package/data/rules/vscode-extensions.yaml +75 -0
- package/data/spdx-license-list.json +121 -7
- package/data/spdx-licenses.json +69 -0
- package/data/spdx.schema.json +845 -2
- package/lib/audit/index.js +25 -3
- package/lib/cli/bomAssembly.js +172 -4
- package/lib/cli/cliOptions.js +121 -17
- package/lib/cli/index.js +720 -902
- package/lib/cli/jsBom.js +156 -64
- package/lib/cli/jvmBom.js +602 -86
- package/lib/cli/managedBom.js +161 -19
- package/lib/cli/nativeBom.js +52 -5
- package/lib/core/boundedFile.js +344 -0
- package/lib/core/brotliProbe.js +182 -0
- package/lib/core/env.js +34 -0
- package/lib/core/fs.js +138 -3
- package/lib/core/globPatterns.js +218 -0
- package/lib/core/httpClient.js +98 -1
- package/lib/core/lockPaths.js +38 -0
- package/lib/core/paths.js +24 -1
- package/lib/core/processTree.js +100 -8
- package/lib/core/projectConfig.js +332 -25
- package/lib/core/toolRegistry.js +184 -0
- package/lib/ecosystems/cppEvidence.js +263 -106
- package/lib/ecosystems/cppIncludeResolver.js +16 -5
- package/lib/ecosystems/denoutils.js +2 -2
- package/lib/ecosystems/ecosystems.js +25 -10
- package/lib/ecosystems/gemHostProbe.js +301 -0
- package/lib/ecosystems/golem.js +3 -8
- package/lib/ecosystems/gradleutils.js +1909 -229
- package/lib/ecosystems/jsEvidence.js +90 -38
- package/lib/ecosystems/kosi.js +3 -5
- package/lib/ecosystems/npmVersionResolution.js +376 -0
- package/lib/ecosystems/parsers-bazel.js +107 -6
- package/lib/ecosystems/parsers-js.js +505 -22
- package/lib/ecosystems/parsers-misc.js +209 -20
- package/lib/ecosystems/parsers-python.js +178 -30
- package/lib/ecosystems/parsers-rust.js +117 -15
- package/lib/ecosystems/pythonutils.js +128 -2
- package/lib/ecosystems/remote/huggingface.js +22 -0
- package/lib/ecosystems/rubyutils.js +538 -31
- package/lib/ecosystems/rusi.js +2 -4
- package/lib/ecosystems/scalacliutils.js +2 -0
- package/lib/ecosystems/scalasem.js +798 -152
- package/lib/ecosystems/vendoredCode.js +237 -3
- package/lib/ecosystems/venvProbe.js +360 -0
- package/lib/evinser/evinser.js +536 -71
- package/lib/evinser/scalasem.js +5 -1
- package/lib/helpers/agenticToolutils.js +525 -94
- package/lib/helpers/bomSigner.js +43 -9
- package/lib/helpers/jssSigner.js +1276 -0
- package/lib/helpers/vsixutils.js +1574 -315
- package/lib/inventory/agentBlueprint.js +193 -0
- package/lib/inventory/agentToolNames.js +145 -0
- package/lib/inventory/aiCollector.js +153 -7
- package/lib/inventory/aiInventory.js +44 -8
- package/lib/inventory/aiProviders.js +324 -0
- package/lib/inventory/atomUtils.js +77 -0
- package/lib/inventory/bomUtils.js +8 -1
- package/lib/inventory/brotliDecoder.js +142 -0
- package/lib/inventory/buildToolRateLimit.js +1 -1
- package/lib/inventory/cbomutils.js +56 -7
- package/lib/inventory/ciParsers/githubActionsLock.js +821 -0
- package/lib/inventory/citations.js +31 -2
- package/lib/inventory/communityAiConfigParser.js +978 -80
- package/lib/inventory/cyclonedx20.js +152 -0
- package/lib/inventory/cyclonedx20Common.js +286 -0
- package/lib/inventory/cyclonedx20Derived.js +159 -0
- package/lib/inventory/cyclonedx20Parties.js +552 -0
- package/lib/inventory/cyclonedx20Read.js +768 -0
- package/lib/inventory/cyclonedx20ReadCommon.js +374 -0
- package/lib/inventory/cyclonedx20ReadComponents.js +692 -0
- package/lib/inventory/cyclonedx20ReadContext.js +380 -0
- package/lib/inventory/cyclonedx20ReadEvidence.js +466 -0
- package/lib/inventory/cyclonedx20ReadSections.js +599 -0
- package/lib/inventory/cyclonedx20Render.js +766 -0
- package/lib/inventory/cyclonedx20RenderComponents.js +716 -0
- package/lib/inventory/cyclonedx20RenderDefinitions.js +405 -0
- package/lib/inventory/cyclonedx20RenderEvidence.js +726 -0
- package/lib/inventory/cyclonedx20RenderHardware.js +203 -0
- package/lib/inventory/cyclonedx20RenderPatents.js +174 -0
- package/lib/inventory/cyclonedx20RenderRefIds.js +314 -0
- package/lib/inventory/cyclonedx20RenderSections.js +499 -0
- package/lib/inventory/cyclonedx20Tables.js +594 -0
- package/lib/inventory/deps.js +141 -13
- package/lib/inventory/dosai.js +375 -6
- package/lib/inventory/dosaiParsers.js +3 -6
- package/lib/inventory/dotnetRuntime.js +367 -0
- package/lib/inventory/ecosystemFormulationParsers.js +979 -0
- package/lib/inventory/envcontext.js +436 -48
- package/lib/inventory/evidenceUtils.js +13 -1
- package/lib/inventory/fetchBatch.js +1 -1
- package/lib/inventory/formulationParsers.js +124 -14
- package/lib/inventory/gtfobins.js +13 -0
- package/lib/inventory/hbom.js +45 -6
- package/lib/inventory/hbomLoader.js +166 -0
- package/lib/inventory/hostRuntimeProbe.js +686 -0
- package/lib/inventory/jvmLocalRepos.js +9 -2
- package/lib/inventory/jvmToolEnv.js +29 -0
- package/lib/inventory/licenseEnhancer.js +12 -0
- package/lib/inventory/mavenCentralMirror.js +534 -0
- package/lib/inventory/mcpConfigParser.js +5 -0
- package/lib/inventory/nodeBuildInfo.js +218 -0
- package/lib/inventory/nodeHostProbe.js +202 -0
- package/lib/inventory/occurrenceKey.js +90 -0
- package/lib/inventory/osPackageResolver.js +182 -0
- package/lib/inventory/phpBuildInfo.js +10 -59
- package/lib/inventory/phpHostProbe.js +32 -488
- package/lib/inventory/pqcMigration.js +426 -0
- package/lib/inventory/rubyBuildInfo.js +972 -0
- package/lib/inventory/rubyHostProbe.js +218 -0
- package/lib/inventory/rustFormulationParser.js +21 -10
- package/lib/inventory/scalaCoords.js +4 -3
- package/lib/inventory/scalaDedupe.js +440 -0
- package/lib/inventory/source.js +114 -8
- package/lib/managers/binary.js +337 -3
- package/lib/managers/docker.js +79 -0
- package/lib/parsers/huggingfaceManifest.js +9 -1
- package/lib/parsers/huggingfaceUtils.js +18 -0
- package/lib/parsers/kiroPermissions.js +166 -0
- package/lib/parsers/largeJson.js +28 -11
- package/lib/parsers/vscodeExtensionId.js +183 -0
- package/lib/server/server.js +48 -35
- package/lib/stages/postgen/postgen.js +41 -1
- package/lib/stages/postgen/ruleEngine.js +13 -5
- package/lib/stages/postgen/specVersionCompat.js +76 -0
- package/lib/stages/pregen/envAudit.js +1 -0
- package/lib/stages/pregen/pregen.js +114 -57
- package/lib/validator/bomValidator.js +14 -2
- package/lib/validator/complianceEngine.js +30 -3
- package/lib/validator/complianceRules.js +1416 -4
- package/lib/validator/generated/validate-1.6.mjs +1 -1
- package/lib/validator/generated/validate-1.7.mjs +1 -1
- package/lib/validator/generated/validate-2.0.mjs +57554 -13851
- package/lib/validator/index.js +49 -8
- package/lib/validator/reporters/json.js +6 -0
- package/package.json +11 -10
- package/types/bin/repl.d.ts.map +1 -1
- package/types/lib/audit/index.d.ts +6 -2
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +29 -1
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +6 -0
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts +3 -18
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts +15 -0
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/boundedFile.d.ts +100 -0
- package/types/lib/core/boundedFile.d.ts.map +1 -0
- package/types/lib/core/brotliProbe.d.ts +37 -0
- package/types/lib/core/brotliProbe.d.ts.map +1 -0
- package/types/lib/core/env.d.ts +14 -0
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts +4 -0
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/globPatterns.d.ts +70 -0
- package/types/lib/core/globPatterns.d.ts.map +1 -0
- package/types/lib/core/httpClient.d.ts +24 -0
- package/types/lib/core/httpClient.d.ts.map +1 -1
- package/types/lib/core/lockPaths.d.ts +19 -0
- package/types/lib/core/lockPaths.d.ts.map +1 -0
- package/types/lib/core/paths.d.ts +9 -0
- package/types/lib/core/paths.d.ts.map +1 -1
- package/types/lib/core/processTree.d.ts +17 -4
- package/types/lib/core/processTree.d.ts.map +1 -1
- package/types/lib/core/projectConfig.d.ts +47 -8
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/core/toolRegistry.d.ts +36 -0
- package/types/lib/core/toolRegistry.d.ts.map +1 -0
- package/types/lib/ecosystems/cppEvidence.d.ts +40 -13
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts +2 -1
- package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/gemHostProbe.d.ts +28 -0
- package/types/lib/ecosystems/gemHostProbe.d.ts.map +1 -0
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +294 -20
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/jsEvidence.d.ts +14 -1
- package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/kosi.d.ts.map +1 -1
- package/types/lib/ecosystems/npmVersionResolution.d.ts +119 -0
- package/types/lib/ecosystems/npmVersionResolution.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-bazel.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts +17 -20
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +19 -0
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts +10 -0
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +19 -1
- package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
- package/types/lib/ecosystems/remote/huggingface.d.ts.map +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts +144 -12
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -1
- package/types/lib/ecosystems/scalasem.d.ts +58 -16
- package/types/lib/ecosystems/scalasem.d.ts.map +1 -1
- package/types/lib/ecosystems/vendoredCode.d.ts +26 -0
- package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -1
- package/types/lib/ecosystems/venvProbe.d.ts +40 -0
- package/types/lib/ecosystems/venvProbe.d.ts.map +1 -0
- package/types/lib/evinser/evinser.d.ts +120 -13
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/scalasem.d.ts.map +1 -1
- package/types/lib/helpers/agenticToolutils.d.ts +53 -19
- package/types/lib/helpers/agenticToolutils.d.ts.map +1 -1
- package/types/lib/helpers/bomSigner.d.ts +20 -3
- package/types/lib/helpers/bomSigner.d.ts.map +1 -1
- package/types/lib/helpers/jssSigner.d.ts +288 -0
- package/types/lib/helpers/jssSigner.d.ts.map +1 -0
- package/types/lib/helpers/vsixutils.d.ts +303 -19
- package/types/lib/helpers/vsixutils.d.ts.map +1 -1
- package/types/lib/inventory/agentBlueprint.d.ts +70 -0
- package/types/lib/inventory/agentBlueprint.d.ts.map +1 -0
- package/types/lib/inventory/agentToolNames.d.ts +51 -0
- package/types/lib/inventory/agentToolNames.d.ts.map +1 -0
- package/types/lib/inventory/aiCollector.d.ts.map +1 -1
- package/types/lib/inventory/aiInventory.d.ts.map +1 -1
- package/types/lib/inventory/aiProviders.d.ts +85 -0
- package/types/lib/inventory/aiProviders.d.ts.map +1 -0
- package/types/lib/inventory/atomUtils.d.ts +19 -0
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/bomUtils.d.ts.map +1 -1
- package/types/lib/inventory/brotliDecoder.d.ts +58 -0
- package/types/lib/inventory/brotliDecoder.d.ts.map +1 -0
- package/types/lib/inventory/cbomutils.d.ts +17 -0
- package/types/lib/inventory/cbomutils.d.ts.map +1 -1
- package/types/lib/inventory/ciParsers/githubActionsLock.d.ts +101 -0
- package/types/lib/inventory/ciParsers/githubActionsLock.d.ts.map +1 -0
- package/types/lib/inventory/citations.d.ts +5 -0
- package/types/lib/inventory/citations.d.ts.map +1 -1
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/cyclonedx20.d.ts +99 -0
- package/types/lib/inventory/cyclonedx20.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Common.d.ts +102 -0
- package/types/lib/inventory/cyclonedx20Common.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Derived.d.ts +74 -0
- package/types/lib/inventory/cyclonedx20Derived.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Parties.d.ts +91 -0
- package/types/lib/inventory/cyclonedx20Parties.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Read.d.ts +51 -0
- package/types/lib/inventory/cyclonedx20Read.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadCommon.d.ts +69 -0
- package/types/lib/inventory/cyclonedx20ReadCommon.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadComponents.d.ts +77 -0
- package/types/lib/inventory/cyclonedx20ReadComponents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadContext.d.ts +118 -0
- package/types/lib/inventory/cyclonedx20ReadContext.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts +40 -0
- package/types/lib/inventory/cyclonedx20ReadEvidence.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20ReadSections.d.ts +45 -0
- package/types/lib/inventory/cyclonedx20ReadSections.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Render.d.ts +53 -0
- package/types/lib/inventory/cyclonedx20Render.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderComponents.d.ts +73 -0
- package/types/lib/inventory/cyclonedx20RenderComponents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts +29 -0
- package/types/lib/inventory/cyclonedx20RenderDefinitions.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts +110 -0
- package/types/lib/inventory/cyclonedx20RenderEvidence.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderHardware.d.ts +42 -0
- package/types/lib/inventory/cyclonedx20RenderHardware.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderPatents.d.ts +26 -0
- package/types/lib/inventory/cyclonedx20RenderPatents.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts +55 -0
- package/types/lib/inventory/cyclonedx20RenderRefIds.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20RenderSections.d.ts +45 -0
- package/types/lib/inventory/cyclonedx20RenderSections.d.ts.map +1 -0
- package/types/lib/inventory/cyclonedx20Tables.d.ts +134 -0
- package/types/lib/inventory/cyclonedx20Tables.d.ts.map +1 -0
- package/types/lib/inventory/deps.d.ts +35 -2
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +36 -1
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
- package/types/lib/inventory/dotnetRuntime.d.ts +91 -0
- package/types/lib/inventory/dotnetRuntime.d.ts.map +1 -0
- package/types/lib/inventory/ecosystemFormulationParsers.d.ts +73 -0
- package/types/lib/inventory/ecosystemFormulationParsers.d.ts.map +1 -0
- package/types/lib/inventory/envcontext.d.ts +74 -12
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/gtfobins.d.ts.map +1 -1
- package/types/lib/inventory/hbom.d.ts +11 -0
- package/types/lib/inventory/hbom.d.ts.map +1 -1
- package/types/lib/inventory/hbomLoader.d.ts +54 -0
- package/types/lib/inventory/hbomLoader.d.ts.map +1 -1
- package/types/lib/inventory/hostRuntimeProbe.d.ts +44 -0
- package/types/lib/inventory/hostRuntimeProbe.d.ts.map +1 -0
- package/types/lib/inventory/jvmLocalRepos.d.ts +5 -1
- package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -1
- package/types/lib/inventory/jvmToolEnv.d.ts +12 -0
- package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -1
- package/types/lib/inventory/licenseEnhancer.d.ts.map +1 -1
- package/types/lib/inventory/mavenCentralMirror.d.ts +170 -0
- package/types/lib/inventory/mavenCentralMirror.d.ts.map +1 -0
- package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/nodeBuildInfo.d.ts +95 -0
- package/types/lib/inventory/nodeBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/nodeHostProbe.d.ts +15 -0
- package/types/lib/inventory/nodeHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/occurrenceKey.d.ts +52 -0
- package/types/lib/inventory/occurrenceKey.d.ts.map +1 -0
- package/types/lib/inventory/osPackageResolver.d.ts +38 -0
- package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
- package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -1
- package/types/lib/inventory/phpHostProbe.d.ts.map +1 -1
- package/types/lib/inventory/pqcMigration.d.ts +84 -0
- package/types/lib/inventory/pqcMigration.d.ts.map +1 -0
- package/types/lib/inventory/rubyBuildInfo.d.ts +271 -0
- package/types/lib/inventory/rubyBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/rubyHostProbe.d.ts +47 -0
- package/types/lib/inventory/rubyHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/rustFormulationParser.d.ts +7 -2
- package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
- package/types/lib/inventory/scalaCoords.d.ts.map +1 -1
- package/types/lib/inventory/scalaDedupe.d.ts +43 -0
- package/types/lib/inventory/scalaDedupe.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +25 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +12 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/parsers/huggingfaceManifest.d.ts +10 -1
- package/types/lib/parsers/huggingfaceManifest.d.ts.map +1 -1
- package/types/lib/parsers/huggingfaceUtils.d.ts +12 -0
- package/types/lib/parsers/huggingfaceUtils.d.ts.map +1 -1
- package/types/lib/parsers/kiroPermissions.d.ts +62 -0
- package/types/lib/parsers/kiroPermissions.d.ts.map +1 -0
- package/types/lib/parsers/largeJson.d.ts +4 -3
- package/types/lib/parsers/largeJson.d.ts.map +1 -1
- package/types/lib/parsers/vscodeExtensionId.d.ts +48 -0
- package/types/lib/parsers/vscodeExtensionId.d.ts.map +1 -0
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts +7 -0
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/postgen/specVersionCompat.d.ts +25 -0
- package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
- package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +12 -8
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts +5 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
- package/types/lib/validator/complianceEngine.d.ts +4 -4
- package/types/lib/validator/complianceEngine.d.ts.map +1 -1
- package/types/lib/validator/complianceRules.d.ts +14 -2
- package/types/lib/validator/complianceRules.d.ts.map +1 -1
- package/types/lib/validator/index.d.ts +10 -0
- package/types/lib/validator/index.d.ts.map +1 -1
- package/types/lib/validator/reporters/json.d.ts.map +1 -1
|
@@ -349,6 +349,7 @@ export const GRADLE_JAVA_CAPS = {
|
|
|
349
349
|
23: "8.10",
|
|
350
350
|
25: "9.1.0",
|
|
351
351
|
26: "9.4.0",
|
|
352
|
+
27: "9.8.0",
|
|
352
353
|
};
|
|
353
354
|
|
|
354
355
|
/** JDK major that satisfies every current build tool minimum. */
|
|
@@ -404,6 +405,34 @@ export function minimumGradleVersionForJava(javaMajor) {
|
|
|
404
405
|
return GRADLE_JAVA_CAPS[javaMajor];
|
|
405
406
|
}
|
|
406
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Pick the newest stable Gradle version from `sdk list` output that can run on
|
|
410
|
+
* the given JDK major. Without a known cap this is the newest stable version,
|
|
411
|
+
* matching the plain default install; with a cap, versions below it are
|
|
412
|
+
* skipped so a project that declared a new JDK never gets a Gradle that
|
|
413
|
+
* refuses to run on it, even when the sdkman list is stale.
|
|
414
|
+
*
|
|
415
|
+
* @param {string} stdout Raw `sdk list gradle` output
|
|
416
|
+
* @param {number|undefined} javaMajor JDK major the Gradle daemon must run on
|
|
417
|
+
* @returns {string|undefined} Best matching version identifier.
|
|
418
|
+
*/
|
|
419
|
+
export function resolveGradleVersionForJava(stdout, javaMajor) {
|
|
420
|
+
const minimum = minimumGradleVersionForJava(javaMajor);
|
|
421
|
+
if (!minimum) {
|
|
422
|
+
return resolvePartialVersion(stdout, "");
|
|
423
|
+
}
|
|
424
|
+
let best;
|
|
425
|
+
for (const version of extractSdkListVersions(stdout)) {
|
|
426
|
+
if (isPrereleaseVersion(version) || compareVersions(version, minimum) < 0) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
if (best === undefined || compareVersions(version, best) > 0) {
|
|
430
|
+
best = version;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return best;
|
|
434
|
+
}
|
|
435
|
+
|
|
407
436
|
/**
|
|
408
437
|
* Collect the version tokens printed by `sdk list <candidate>`. The output is
|
|
409
438
|
* a fixed-width table whose cells may carry `+`, `*`, or `>` status markers;
|
|
@@ -128,6 +128,18 @@ export function resolveLicenseId(raw, opts = {}) {
|
|
|
128
128
|
const trimmed = raw.trim();
|
|
129
129
|
if (!trimmed) return null;
|
|
130
130
|
|
|
131
|
+
// A single LicenseRef-* identifier is already a document reference. Keep it
|
|
132
|
+
// as written, since the idstring is case-sensitive, rather than slugging it.
|
|
133
|
+
if (
|
|
134
|
+
opts.licenseRef &&
|
|
135
|
+
isLicenseRef(trimmed) &&
|
|
136
|
+
!trimmed.includes(" ") &&
|
|
137
|
+
!trimmed.includes("(") &&
|
|
138
|
+
!trimmed.includes(")")
|
|
139
|
+
) {
|
|
140
|
+
return { expression: trimmed };
|
|
141
|
+
}
|
|
142
|
+
|
|
131
143
|
// 1. URL check
|
|
132
144
|
if (trimmed.startsWith("http")) {
|
|
133
145
|
const spdxList = loadSpdxLicenseList();
|
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { isSecureMode, readEnvironmentVariable } from "../core/activity.js";
|
|
6
|
+
import { parseMavenArgs } from "../core/env.js";
|
|
7
|
+
import {
|
|
8
|
+
getTmpDir,
|
|
9
|
+
safeExistsSync,
|
|
10
|
+
safeMkdtempSync,
|
|
11
|
+
safeRmSync,
|
|
12
|
+
safeWriteSync,
|
|
13
|
+
} from "../core/fs.js";
|
|
14
|
+
import { registerRunReset } from "../core/runState.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Opt-in switch that points every Maven Central consumer at Google's public
|
|
18
|
+
* mirror: cdxgen's own POM, licence and metadata lookups, and every JVM build
|
|
19
|
+
* tool cdxgen runs (Maven and its wrapper, Gradle, sbt, Mill, Bazel and the
|
|
20
|
+
* Clojure tools). The value selects the mirror:
|
|
21
|
+
*
|
|
22
|
+
* `true`/`google` the global mirror bucket
|
|
23
|
+
* `eu` the Europe bucket
|
|
24
|
+
* `asia` the Asia bucket
|
|
25
|
+
* `http(s)://...` any other mirror or repository manager of Maven Central
|
|
26
|
+
*
|
|
27
|
+
* An explicit `MAVEN_CENTRAL_URL` still wins for cdxgen's own lookups, and a
|
|
28
|
+
* repository the user or the project already configures is never replaced:
|
|
29
|
+
* only the default Maven Central URLs are moved. Nothing is written to the
|
|
30
|
+
* scanned project or the user's home directory; the injection goes through
|
|
31
|
+
* command-line arguments and environment variables, and any settings or init
|
|
32
|
+
* script it needs is written under cdxgen's temp directory and removed again.
|
|
33
|
+
*/
|
|
34
|
+
export const MAVEN_CENTRAL_MIRROR_VAR = "MAVEN_CENTRAL_MIRROR";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Google's public Maven Central mirror buckets, named by region.
|
|
38
|
+
*
|
|
39
|
+
* @type {Object<string, string>}
|
|
40
|
+
*/
|
|
41
|
+
export const MAVEN_CENTRAL_MIRROR_URLS = {
|
|
42
|
+
google: "https://maven-central.storage-download.googleapis.com/maven2/",
|
|
43
|
+
eu: "https://maven-central-eu.storage-download.googleapis.com/maven2/",
|
|
44
|
+
asia: "https://maven-central-asia.storage-download.googleapis.com/maven2/",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The default Maven Central repository URLs that the mirror replaces, for
|
|
49
|
+
* tools that name repositories by URL.
|
|
50
|
+
*
|
|
51
|
+
* @type {string[]}
|
|
52
|
+
*/
|
|
53
|
+
export const MAVEN_CENTRAL_DEFAULT_URLS = [
|
|
54
|
+
"https://repo1.maven.org/maven2/",
|
|
55
|
+
"https://repo.maven.apache.org/maven2/",
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Read the mirror switch. Undefined when cdxgen should use Maven Central
|
|
60
|
+
* itself, the mirror URL otherwise.
|
|
61
|
+
*
|
|
62
|
+
* @returns {string|undefined} Mirror base URL with a trailing slash
|
|
63
|
+
*/
|
|
64
|
+
export function mavenCentralMirrorUrl() {
|
|
65
|
+
const value = readEnvironmentVariable(MAVEN_CENTRAL_MIRROR_VAR);
|
|
66
|
+
if (!value || ["false", "0", "off", "no"].includes(value.toLowerCase())) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const key = value.toLowerCase();
|
|
70
|
+
// A bare boolean turns the global bucket on.
|
|
71
|
+
const named =
|
|
72
|
+
MAVEN_CENTRAL_MIRROR_URLS[key] ||
|
|
73
|
+
(["true", "1", "yes", "on"].includes(key)
|
|
74
|
+
? MAVEN_CENTRAL_MIRROR_URLS.google
|
|
75
|
+
: undefined);
|
|
76
|
+
if (named) {
|
|
77
|
+
return named;
|
|
78
|
+
}
|
|
79
|
+
// Anything else must name a repository itself. A mirror URL is fetched and
|
|
80
|
+
// downloaded from by JVM tools, so only http(s) is accepted.
|
|
81
|
+
const trimmed = value.trim().endsWith("/")
|
|
82
|
+
? value.trim()
|
|
83
|
+
: `${value.trim()}/`;
|
|
84
|
+
return /^https?:\/\//.test(trimmed) ? trimmed : undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Whether the mirror switch is on. Names and URLs that do not resolve to a
|
|
89
|
+
* mirror leave it off, so a typo never silently redirects builds.
|
|
90
|
+
*
|
|
91
|
+
* @returns {boolean}
|
|
92
|
+
*/
|
|
93
|
+
export function isMavenCentralMirrorEnabled() {
|
|
94
|
+
return mavenCentralMirrorUrl() !== undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The repository cdxgen's own POM, licence and metadata lookups should fetch
|
|
99
|
+
* from. An explicit `MAVEN_CENTRAL_URL` is a deliberate choice, often a
|
|
100
|
+
* repository manager holding private artefacts, so it keeps winning over the
|
|
101
|
+
* mirror.
|
|
102
|
+
*
|
|
103
|
+
* @returns {string|undefined} Mirror URL, or undefined to keep the existing
|
|
104
|
+
* `MAVEN_CENTRAL_URL` behaviour
|
|
105
|
+
*/
|
|
106
|
+
export function mavenCentralFetchUrl() {
|
|
107
|
+
if (!isMavenCentralMirrorEnabled()) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
if (readEnvironmentVariable("MAVEN_CENTRAL_URL")) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
return mavenCentralMirrorUrl();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
// Temp artifacts: one settings.xml / init.gradle / repositories file per
|
|
118
|
+
// process, written under cdxgen's temp directory and removed when the run
|
|
119
|
+
// ends. They only have to exist while the tool starts; the removal keeps a
|
|
120
|
+
// long-lived server from collecting them.
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
/** @type {Map<string, string>} Content key to the written file's path. */
|
|
124
|
+
const mirrorArtifacts = new Map();
|
|
125
|
+
|
|
126
|
+
registerRunReset("inventory.mavenCentralMirror", () => {
|
|
127
|
+
for (const path of mirrorArtifacts.values()) {
|
|
128
|
+
safeRmSync(path, { recursive: true, force: true });
|
|
129
|
+
}
|
|
130
|
+
mirrorArtifacts.clear();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
function writeMirrorArtifact(key, prefix, content) {
|
|
134
|
+
const existing = mirrorArtifacts.get(key);
|
|
135
|
+
if (existing) {
|
|
136
|
+
return existing;
|
|
137
|
+
}
|
|
138
|
+
const dir = safeMkdtempSync(join(getTmpDir(), prefix));
|
|
139
|
+
const path = join(dir, "artifact");
|
|
140
|
+
safeWriteSync(path, content);
|
|
141
|
+
mirrorArtifacts.set(key, path);
|
|
142
|
+
return path;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Remove every mirror artifact this process wrote. Registered as a process
|
|
147
|
+
* exit hook, so short CLI runs clean up even when they never reach a run reset.
|
|
148
|
+
*/
|
|
149
|
+
function cleanupMirrorArtifactsOnExit() {
|
|
150
|
+
for (const path of mirrorArtifacts.values()) {
|
|
151
|
+
try {
|
|
152
|
+
safeRmSync(path, { recursive: true, force: true });
|
|
153
|
+
} catch (_e) {
|
|
154
|
+
// The temp directory is cleaned by the OS eventually.
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
mirrorArtifacts.clear();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Maven and the Maven wrapper
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The `<mirror>` element that remaps Maven Central, as a settings.xml
|
|
166
|
+
* fragment. Declared last, so a mirror of Central that the user's own
|
|
167
|
+
* settings.xml or the project's settings.xml already defines keeps winning.
|
|
168
|
+
*
|
|
169
|
+
* @param {string} mirrorUrl Mirror base URL
|
|
170
|
+
* @returns {string}
|
|
171
|
+
*/
|
|
172
|
+
function mavenMirrorElement(mirrorUrl) {
|
|
173
|
+
return (
|
|
174
|
+
"<mirror><id>cdxgen-maven-central-mirror</id>" +
|
|
175
|
+
"<name>cdxgen Maven Central mirror</name>" +
|
|
176
|
+
`<url>${mirrorUrl}</url><mirrorOf>central</mirrorOf></mirror>`
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Minimal settings.xml holding only the mirror. Maven still reads the user's
|
|
182
|
+
* own settings.xml on top of a global settings file, so mirrors, profiles and
|
|
183
|
+
* credentials defined there keep applying, and theirs win for Central.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} mirrorUrl Mirror base URL
|
|
186
|
+
* @returns {string}
|
|
187
|
+
*/
|
|
188
|
+
function standaloneMavenSettings(mirrorUrl) {
|
|
189
|
+
return (
|
|
190
|
+
'<?xml version="1.0" encoding="UTF-8"?>\n<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">\n<mirrors>\n' +
|
|
191
|
+
mavenMirrorElement(mirrorUrl) +
|
|
192
|
+
"\n</mirrors>\n</settings>\n"
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Insert the mirror into the content of a settings file that is passed to
|
|
198
|
+
* Maven anyway, keeping every other element as it is. The mirror is appended
|
|
199
|
+
* to the existing ones, so the file's own mirror of Central still wins.
|
|
200
|
+
*
|
|
201
|
+
* @param {string} content Existing settings.xml content
|
|
202
|
+
* @param {string} mirrorUrl Mirror base URL
|
|
203
|
+
* @returns {string|undefined} Merged content, or undefined when the file
|
|
204
|
+
* holds no recognisable settings element to merge into
|
|
205
|
+
*/
|
|
206
|
+
export function mergeMavenMirrorSettings(content, mirrorUrl) {
|
|
207
|
+
const mirror = mavenMirrorElement(mirrorUrl);
|
|
208
|
+
if (content.includes("</mirrors>")) {
|
|
209
|
+
return content.replace("</mirrors>", `${mirror}</mirrors>`);
|
|
210
|
+
}
|
|
211
|
+
if (content.includes("<mirrors/>")) {
|
|
212
|
+
return content.replace("<mirrors/>", `<mirrors>${mirror}</mirrors>`);
|
|
213
|
+
}
|
|
214
|
+
if (content.includes("<mirrors>")) {
|
|
215
|
+
// A mirrors element that never closes: leave the file alone rather than
|
|
216
|
+
// produce a malformed one.
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
if (content.includes("</settings>")) {
|
|
220
|
+
return content.replace(
|
|
221
|
+
"</settings>",
|
|
222
|
+
`<mirrors>${mirror}</mirrors></settings>`,
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Whether the user's own Maven arguments name a settings file, which must
|
|
230
|
+
* keep winning over anything cdxgen generates.
|
|
231
|
+
*
|
|
232
|
+
* @returns {boolean}
|
|
233
|
+
*/
|
|
234
|
+
function userMavenArgsNameSettings() {
|
|
235
|
+
const userArgs = ["MVN_ARGS", "MAVEN_ARGS"].flatMap((name) =>
|
|
236
|
+
parseMavenArgs(readEnvironmentVariable(name)),
|
|
237
|
+
);
|
|
238
|
+
return userArgs.some(
|
|
239
|
+
(arg) =>
|
|
240
|
+
["-s", "--settings", "-gs", "--global-settings"].includes(arg) ||
|
|
241
|
+
arg.startsWith("--settings=") ||
|
|
242
|
+
arg.startsWith("--global-settings="),
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Extra Maven arguments that send Central to the mirror, written as a global
|
|
248
|
+
* settings file under cdxgen's temp directory. An existing `-gs` settings
|
|
249
|
+
* file named by the caller is merged with the mirror instead, so a project
|
|
250
|
+
* that ships its own settings.xml keeps its repositories and its own mirror.
|
|
251
|
+
* A settings file the user named themselves (in `MVN_ARGS`/`MAVEN_ARGS`) is
|
|
252
|
+
* never touched, and neither is secure mode.
|
|
253
|
+
*
|
|
254
|
+
* @param {string} [existingSettingsFile] Settings file the caller already
|
|
255
|
+
* passes to Maven
|
|
256
|
+
* @returns {string[]} Arguments to append to the Maven command line
|
|
257
|
+
*/
|
|
258
|
+
export function mavenMirrorSettingsArgs(existingSettingsFile) {
|
|
259
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
260
|
+
if (!mirrorUrl || isSecureMode || userMavenArgsNameSettings()) {
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
263
|
+
let content = standaloneMavenSettings(mirrorUrl);
|
|
264
|
+
let key = `maven|${mirrorUrl}`;
|
|
265
|
+
if (existingSettingsFile && safeExistsSync(existingSettingsFile)) {
|
|
266
|
+
let existing;
|
|
267
|
+
try {
|
|
268
|
+
existing = readFileSync(existingSettingsFile, "utf-8");
|
|
269
|
+
} catch (_e) {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
const merged = mergeMavenMirrorSettings(existing, mirrorUrl);
|
|
273
|
+
if (!merged) {
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
content = merged;
|
|
277
|
+
key = `maven|${mirrorUrl}|${existingSettingsFile}`;
|
|
278
|
+
}
|
|
279
|
+
const path = writeMirrorArtifact(key, "cdxgen-maven-mirror-", content);
|
|
280
|
+
return ["-gs", path];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Environment for a Maven or Maven wrapper invocation that moves the
|
|
285
|
+
* wrapper's own distribution download off Maven Central. Plain `mvn`
|
|
286
|
+
* invocations ignore it.
|
|
287
|
+
*
|
|
288
|
+
* @returns {Object} Environment variables to add to the child process
|
|
289
|
+
*/
|
|
290
|
+
export function mavenWrapperMirrorEnv() {
|
|
291
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
292
|
+
if (!mirrorUrl || isSecureMode) {
|
|
293
|
+
return {};
|
|
294
|
+
}
|
|
295
|
+
// The wrapper appends org/apache/maven/... to this base, which the mirror
|
|
296
|
+
// serves with the same layout. MVNW_REPOURL carries no trailing slash.
|
|
297
|
+
return { MVNW_REPOURL: mirrorUrl.replace(/\/$/, "") };
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// ---------------------------------------------------------------------------
|
|
301
|
+
// Gradle
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* A Gradle init script that rewrites Maven Central repository URLs to the
|
|
306
|
+
* mirror as the settings and every project declare them. Repositories that are
|
|
307
|
+
* not Maven Central keep their URL, so private repositories and declared
|
|
308
|
+
* mirrors are untouched.
|
|
309
|
+
*
|
|
310
|
+
* @param {string} mirrorUrl Mirror base URL
|
|
311
|
+
* @returns {string}
|
|
312
|
+
*/
|
|
313
|
+
export function gradleMirrorInitScript(mirrorUrl) {
|
|
314
|
+
const prefixes = JSON.stringify(MAVEN_CENTRAL_DEFAULT_URLS);
|
|
315
|
+
return `// Generated by cdxgen: send Maven Central to a mirror.
|
|
316
|
+
def cdxgenMirrorUrl = '${mirrorUrl}'
|
|
317
|
+
def cdxgenCentralPrefixes = ${prefixes}
|
|
318
|
+
def cdxgenSwapRepository = { repo ->
|
|
319
|
+
if (repo instanceof MavenArtifactRepository) {
|
|
320
|
+
def repoUrl = repo.url?.toString()
|
|
321
|
+
if (repoUrl && cdxgenCentralPrefixes.any { repoUrl.startsWith(it) }) {
|
|
322
|
+
repo.url = cdxgenMirrorUrl
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
// \`all\` also reaches repositories declared after this point, which is how
|
|
327
|
+
// the build script classpath of a project is covered before it resolves.
|
|
328
|
+
def cdxgenSwapCentral = { repositoryContainer ->
|
|
329
|
+
try {
|
|
330
|
+
repositoryContainer?.all(cdxgenSwapRepository)
|
|
331
|
+
} catch (Throwable ignored) {
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
gradle.settingsEvaluated { settings ->
|
|
335
|
+
cdxgenSwapCentral(settings.pluginManagement.repositories)
|
|
336
|
+
try {
|
|
337
|
+
cdxgenSwapCentral(settings.dependencyResolutionManagement.repositories)
|
|
338
|
+
} catch (Throwable ignored) {
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
gradle.beforeProject { project ->
|
|
342
|
+
cdxgenSwapCentral(project.buildscript.repositories)
|
|
343
|
+
cdxgenSwapCentral(project.repositories)
|
|
344
|
+
}
|
|
345
|
+
`;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Extra Gradle arguments that install the mirror init script. Gradle applies
|
|
350
|
+
* every init script it is given, so cdxgen's own helper script keeps working.
|
|
351
|
+
*
|
|
352
|
+
* @returns {string[]} Arguments to append to the Gradle command line
|
|
353
|
+
*/
|
|
354
|
+
export function gradleMirrorInitScriptArgs() {
|
|
355
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
356
|
+
if (!mirrorUrl || isSecureMode) {
|
|
357
|
+
return [];
|
|
358
|
+
}
|
|
359
|
+
const path = writeMirrorArtifact(
|
|
360
|
+
`gradle|${mirrorUrl}`,
|
|
361
|
+
"cdxgen-gradle-mirror-",
|
|
362
|
+
gradleMirrorInitScript(mirrorUrl),
|
|
363
|
+
);
|
|
364
|
+
return ["--init-script", path];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// ---------------------------------------------------------------------------
|
|
368
|
+
// sbt
|
|
369
|
+
// ---------------------------------------------------------------------------
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* An sbt launcher repositories file that resolves Maven Central from the
|
|
373
|
+
* mirror. The launcher replaces its default list with this file, so the
|
|
374
|
+
* plugin and Typesafe repositories it must still reach are named here, and
|
|
375
|
+
* only the Central entry points at the mirror.
|
|
376
|
+
*
|
|
377
|
+
* @param {string} mirrorUrl Mirror base URL
|
|
378
|
+
* @returns {string}
|
|
379
|
+
*/
|
|
380
|
+
export function sbtRepositoriesFile(mirrorUrl) {
|
|
381
|
+
return `[repositories]
|
|
382
|
+
local
|
|
383
|
+
maven-central: ${mirrorUrl}
|
|
384
|
+
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
|
|
385
|
+
sbt-plugin-releases: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/[revision]/[artifact]/[type]s/[artifact](-[classifier]).[ext]
|
|
386
|
+
`;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Environment for an sbt invocation that resolves Maven Central from the
|
|
391
|
+
* mirror: a repositories file under cdxgen's temp directory, named through
|
|
392
|
+
* `SBT_OPTS`. A user who already configures repositories (`~/.sbt/repositories`
|
|
393
|
+
* or their own `sbt.repository.config`) keeps their configuration, and the
|
|
394
|
+
* mirror stays out of the way.
|
|
395
|
+
*
|
|
396
|
+
* @returns {Object} Environment variables to add to the child process
|
|
397
|
+
*/
|
|
398
|
+
export function sbtMirrorEnv() {
|
|
399
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
400
|
+
if (!mirrorUrl || isSecureMode) {
|
|
401
|
+
return {};
|
|
402
|
+
}
|
|
403
|
+
const existingSbtOpts = readEnvironmentVariable("SBT_OPTS");
|
|
404
|
+
if (existingSbtOpts?.includes("sbt.repository.config")) {
|
|
405
|
+
return {};
|
|
406
|
+
}
|
|
407
|
+
if (
|
|
408
|
+
safeExistsSync(join(homedir(), ".sbt", "repositories")) ||
|
|
409
|
+
safeExistsSync(join(homedir(), ".config", "sbt", "repositories"))
|
|
410
|
+
) {
|
|
411
|
+
return {};
|
|
412
|
+
}
|
|
413
|
+
const path = writeMirrorArtifact(
|
|
414
|
+
`sbt|${mirrorUrl}`,
|
|
415
|
+
"cdxgen-sbt-mirror-",
|
|
416
|
+
sbtRepositoriesFile(mirrorUrl),
|
|
417
|
+
);
|
|
418
|
+
const properties = `-Dsbt.repository.config=${path} -Dsbt.override.build.repos=true`;
|
|
419
|
+
return {
|
|
420
|
+
SBT_OPTS: existingSbtOpts ? `${existingSbtOpts} ${properties}` : properties,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// ---------------------------------------------------------------------------
|
|
425
|
+
// Coursier-family tools: Mill, scala-cli and any build that shells out to the
|
|
426
|
+
// coursier CLI. Mill's own resolution has no project-free override, so this
|
|
427
|
+
// covers the coursier launcher downloads and is best effort there.
|
|
428
|
+
// ---------------------------------------------------------------------------
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Environment for tools that resolve through the Coursier CLI.
|
|
432
|
+
*
|
|
433
|
+
* @returns {Object} Environment variables to add to the child process
|
|
434
|
+
*/
|
|
435
|
+
export function coursierMirrorEnv() {
|
|
436
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
437
|
+
if (!mirrorUrl || isSecureMode) {
|
|
438
|
+
return {};
|
|
439
|
+
}
|
|
440
|
+
const existing = readEnvironmentVariable("COURSIER_REPOSITORIES");
|
|
441
|
+
if (existing) {
|
|
442
|
+
return {};
|
|
443
|
+
}
|
|
444
|
+
return { COURSIER_REPOSITORIES: `ivy2local|${mirrorUrl}` };
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// ---------------------------------------------------------------------------
|
|
448
|
+
// Bazel
|
|
449
|
+
// ---------------------------------------------------------------------------
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Extra Bazel build arguments that hand the mirror to repository rules, whose
|
|
453
|
+
* environment Bazel otherwise keeps isolated from the client's. Repositories
|
|
454
|
+
* whose URLs the project pins, as rules_jvm_external projects do, are not
|
|
455
|
+
* changed by this; it covers the ones that resolve through Coursier defaults.
|
|
456
|
+
*
|
|
457
|
+
* @returns {string[]} Arguments to append to the Bazel build command line
|
|
458
|
+
*/
|
|
459
|
+
export function bazelMirrorArgs() {
|
|
460
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
461
|
+
if (!mirrorUrl || isSecureMode) {
|
|
462
|
+
return [];
|
|
463
|
+
}
|
|
464
|
+
if (readEnvironmentVariable("COURSIER_REPOSITORIES")) {
|
|
465
|
+
return [];
|
|
466
|
+
}
|
|
467
|
+
return [`--repo_env=COURSIER_REPOSITORIES=ivy2local|${mirrorUrl}`];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// ---------------------------------------------------------------------------
|
|
471
|
+
// Clojure tools
|
|
472
|
+
// ---------------------------------------------------------------------------
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* The `-Sdeps` data that repoints the default `central` repository of the
|
|
476
|
+
* Clojure CLI at the mirror. Repositories merge by name, so a project's other
|
|
477
|
+
* repositories, including Clojars, keep resolving as declared.
|
|
478
|
+
*
|
|
479
|
+
* @param {string} mirrorUrl Mirror base URL
|
|
480
|
+
* @returns {string}
|
|
481
|
+
*/
|
|
482
|
+
export function clojureMirrorSdeps(mirrorUrl) {
|
|
483
|
+
return `{:mvn/repos {"central" {:url "${mirrorUrl}"}}}`;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Extra arguments for a Clojure CLI invocation. Skipped when the user already
|
|
488
|
+
* passes `-Sdeps`, whose data would otherwise be replaced.
|
|
489
|
+
*
|
|
490
|
+
* @param {string[]} baseArgs Arguments the caller already assembled
|
|
491
|
+
* @returns {string[]} Arguments to append
|
|
492
|
+
*/
|
|
493
|
+
export function clojureMirrorArgs(baseArgs = []) {
|
|
494
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
495
|
+
if (!mirrorUrl || isSecureMode) {
|
|
496
|
+
return [...baseArgs];
|
|
497
|
+
}
|
|
498
|
+
if (baseArgs.includes("-Sdeps")) {
|
|
499
|
+
return [...baseArgs];
|
|
500
|
+
}
|
|
501
|
+
return [...baseArgs, "-Sdeps", clojureMirrorSdeps(mirrorUrl)];
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Arguments for a Leiningen invocation that repoint its `central` repository
|
|
506
|
+
* at the mirror, through `lein update-in`, which changes the project map in
|
|
507
|
+
* memory and never the project.clj file. Skipped when the project declares
|
|
508
|
+
* its own `:mirrors`, which must keep winning.
|
|
509
|
+
*
|
|
510
|
+
* @param {string[]} baseArgs Arguments the caller already assembled
|
|
511
|
+
* @param {string} [projectFileContent] The project's project.clj, when the
|
|
512
|
+
* caller has it at hand
|
|
513
|
+
* @returns {string[]} Full argument list to invoke Leiningen with
|
|
514
|
+
*/
|
|
515
|
+
export function leiningenMirrorArgs(baseArgs, projectFileContent) {
|
|
516
|
+
const mirrorUrl = mavenCentralMirrorUrl();
|
|
517
|
+
if (!mirrorUrl || isSecureMode || projectFileContent?.includes(":mirrors")) {
|
|
518
|
+
return baseArgs;
|
|
519
|
+
}
|
|
520
|
+
return [
|
|
521
|
+
"update-in",
|
|
522
|
+
":mirrors",
|
|
523
|
+
"assoc",
|
|
524
|
+
'"central"',
|
|
525
|
+
`{:url "${mirrorUrl}"}`,
|
|
526
|
+
"--",
|
|
527
|
+
...baseArgs,
|
|
528
|
+
];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Exit backstop: a run reset already removes the artifacts between scans;
|
|
532
|
+
// this one covers a CLI process that exits without one. It is a no-op while
|
|
533
|
+
// no artifact was written.
|
|
534
|
+
process.once("exit", cleanupMirrorArtifactsOnExit);
|
|
@@ -39,6 +39,8 @@ const MCP_CONFIG_PATTERNS = [
|
|
|
39
39
|
"**/.zed/settings.json",
|
|
40
40
|
".roo/mcp.json",
|
|
41
41
|
"**/.roo/mcp.json",
|
|
42
|
+
".kiro/settings/mcp.json",
|
|
43
|
+
"**/.kiro/settings/mcp.json",
|
|
42
44
|
".codex/config.toml",
|
|
43
45
|
"**/.codex/config.toml",
|
|
44
46
|
];
|
|
@@ -115,6 +117,9 @@ function configFormat(filePath) {
|
|
|
115
117
|
if (lowerPath.includes("/.roo/")) {
|
|
116
118
|
return "roo";
|
|
117
119
|
}
|
|
120
|
+
if (lowerPath.includes("/.kiro/settings/")) {
|
|
121
|
+
return "kiro";
|
|
122
|
+
}
|
|
118
123
|
if (
|
|
119
124
|
lowerPath.includes("/.codex/") ||
|
|
120
125
|
lowerPath.endsWith(".codex/config.toml")
|