Status command: parallelize JSON security audit

This commit is contained in:
Vincent Koc
2026-03-01 12:19:23 -08:00
parent 07da843378
commit b0a73ae773

View File

@@ -1,6 +1,6 @@
import { formatCliCommand } from "../cli/command-format.js"; import { formatCliCommand } from "../cli/command-format.js";
import { withProgress } from "../cli/progress.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 { buildGatewayConnectionDetails, callGateway } from "../gateway/call.js";
import { info } from "../globals.js"; import { info } from "../globals.js";
import { formatTimeAgo } from "../infra/format-time/format-relative.ts"; import { formatTimeAgo } from "../infra/format-time/format-relative.ts";
@@ -80,10 +80,33 @@ export async function statusCommand(
return; return;
} }
const scan = await scanStatus( const [scan, securityAudit] = opts.json
{ json: opts.json, timeoutMs: opts.timeoutMs, all: opts.all }, ? await Promise.all([
runtime, 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 { const {
cfg, cfg,
osSummary, osSummary,
@@ -105,21 +128,6 @@ export async function statusCommand(
memoryPlugin, memoryPlugin,
} = scan; } = 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 const usage = opts.usage
? await withProgress( ? await withProgress(
{ {