Skip to content

Commit 0ed8964

Browse files
committed
feat(preflight): add @cyclonedx/cdxgen to background downloads
Include cdxgen in preflight downloads alongside coana and cli-ai to ensure it's cached on first CLI run for faster manifest generation.
1 parent 7a7f67c commit 0ed8964

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

packages/cli/src/utils/preflight/downloads.mts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* Background preflight downloads for optional dependencies.
33
*
4-
* Silently downloads @coana-tech/cli and @socketbin/cli-ai in the background
5-
* on first CLI run to ensure they're cached for future use.
4+
* Silently downloads @coana-tech/cli, @cyclonedx/cdxgen, and @socketbin/cli-ai
5+
* in the background on first CLI run to ensure they're cached for future use.
66
*
77
* This runs asynchronously and never blocks the main CLI execution.
88
*/
@@ -47,20 +47,23 @@ export function runPreflightDownloads(): void {
4747

4848
// @coana-tech/cli preflight.
4949
const coanaVersion = ENV.INLINED_SOCKET_CLI_COANA_VERSION
50-
if (coanaVersion) {
51-
const coanaSpec = `@coana-tech/cli@~${coanaVersion}`
52-
if (!isPackageCached(coanaSpec)) {
53-
downloads.push({ packageSpec: coanaSpec, binaryName: 'coana' })
54-
}
50+
const coanaSpec = `@coana-tech/cli@~${coanaVersion}`
51+
if (!isPackageCached(coanaSpec)) {
52+
downloads.push({ packageSpec: coanaSpec, binaryName: 'coana' })
53+
}
54+
55+
// @cyclonedx/cdxgen preflight.
56+
const cdxgenVersion = ENV.INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION
57+
const cdxgenSpec = `@cyclonedx/cdxgen@~${cdxgenVersion}`
58+
if (!isPackageCached(cdxgenSpec)) {
59+
downloads.push({ packageSpec: cdxgenSpec, binaryName: 'cdxgen' })
5560
}
5661

5762
// @socketbin/cli-ai preflight.
5863
const cliAiVersion = ENV.INLINED_SOCKET_CLI_AI_VERSION
59-
if (cliAiVersion) {
60-
const cliAiSpec = `@socketbin/cli-ai@^${cliAiVersion}`
61-
if (!isPackageCached(cliAiSpec)) {
62-
downloads.push({ packageSpec: cliAiSpec, binaryName: 'cli-ai' })
63-
}
64+
const cliAiSpec = `@socketbin/cli-ai@^${cliAiVersion}`
65+
if (!isPackageCached(cliAiSpec)) {
66+
downloads.push({ packageSpec: cliAiSpec, binaryName: 'cli-ai' })
6467
}
6568

6669
try {

0 commit comments

Comments
 (0)