Add opt-in Go build summaries and selected retained metadata pages while preserving complete Evidence and source identity. Validated with 258 focused tests, full static/docs checks, real CLI/SDK workflows and native metadata oracles. CI baseline remediation assertions reproduce on unmodified main; fail-fast cancels two other shards. Owner authorized bypass with those coverage limits recorded in PR #5524. Fixes #5499.
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { z } from "incur";
|
|
import { createGoBinaryService } from "../composition/go.js";
|
|
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
|
import { logCliCommand } from "../cliLogging.js";
|
|
import type { Logger } from "pino";
|
|
import type { CliInstance } from "./types.js";
|
|
import { withCommandCancellation } from "./commandCancellation.js";
|
|
import {
|
|
analysisEvidenceDeliveryOptions,
|
|
deliverCliAnalysisEvidence,
|
|
} from "./analysisEvidenceDelivery.js";
|
|
import { absoluteCallerPath } from "../filesystem/callerPath.js";
|
|
|
|
/** Resolve caller paths and inspect static build metadata through the shared workflow. */
|
|
export const registerGoCommands = (cli: CliInstance, logger: Logger): void => {
|
|
cli.command(CLI_COMMANDS.inspectGoBinary, {
|
|
description:
|
|
"Inspect embedded Go compiler, modules and build settings without target execution",
|
|
args: z.object({
|
|
path: z.string().describe("Local ELF, PE or thin Mach-O image"),
|
|
}),
|
|
options: z.object(analysisEvidenceDeliveryOptions),
|
|
run: ({ args, options }) =>
|
|
withCommandCancellation(async (signal) => {
|
|
const service = createGoBinaryService();
|
|
return await logCliCommand(
|
|
logger,
|
|
CLI_COMMANDS.inspectGoBinary,
|
|
async () =>
|
|
deliverCliAnalysisEvidence({
|
|
run: () =>
|
|
service.inspect(
|
|
{ path: absoluteCallerPath(args.path) },
|
|
{ signal },
|
|
),
|
|
service,
|
|
providerId: "go-build-info",
|
|
operation: "inspect_go_binary",
|
|
signal,
|
|
detail: options.detail,
|
|
evidenceOutput: options.evidence_output,
|
|
}),
|
|
);
|
|
}),
|
|
});
|
|
};
|