From b0a73ae77384248ad1166242eb1270e31cbf0580 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 1 Mar 2026 12:19:23 -0800 Subject: [PATCH] Status command: parallelize JSON security audit --- src/commands/status.command.ts | 48 ++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/commands/status.command.ts b/src/commands/status.command.ts index e78faa4cc38..1fdb1ab8b4b 100644 --- a/src/commands/status.command.ts +++ b/src/commands/status.command.ts @@ -1,6 +1,6 @@ import { formatCliCommand } from "../cli/command-format.js"; import { withProgress } from "../cli/progress.js"; -import { resolveGatewayPort } from "../config/config.js"; +import { loadConfig, resolveGatewayPort } from "../config/config.js"; import { buildGatewayConnectionDetails, callGateway } from "../gateway/call.js"; import { info } from "../globals.js"; import { formatTimeAgo } from "../infra/format-time/format-relative.ts"; @@ -80,10 +80,33 @@ export async function statusCommand( return; } - const scan = await scanStatus( - { json: opts.json, timeoutMs: opts.timeoutMs, all: opts.all }, - runtime, - ); + const [scan, securityAudit] = opts.json + ? await Promise.all([ + scanStatus({ json: opts.json, timeoutMs: opts.timeoutMs, all: opts.all }, runtime), + runSecurityAudit({ + config: loadConfig(), + deep: false, + includeFilesystem: true, + includeChannelSecurity: true, + }), + ]) + : [ + await scanStatus({ json: opts.json, timeoutMs: opts.timeoutMs, all: opts.all }, runtime), + await withProgress( + { + label: "Running security audit…", + indeterminate: true, + enabled: true, + }, + async () => + await runSecurityAudit({ + config: loadConfig(), + deep: false, + includeFilesystem: true, + includeChannelSecurity: true, + }), + ), + ]; const { cfg, osSummary, @@ -105,21 +128,6 @@ export async function statusCommand( memoryPlugin, } = scan; - const securityAudit = await withProgress( - { - label: "Running security audit…", - indeterminate: true, - enabled: opts.json !== true, - }, - async () => - await runSecurityAudit({ - config: cfg, - deep: false, - includeFilesystem: true, - includeChannelSecurity: true, - }), - ); - const usage = opts.usage ? await withProgress( {