import { expect } from "vitest"; import { artifactInventoryResultSchema } from "../../../src/domain/artifactGraph.js"; import { artifactInspectionResultSchema } from "../../../src/domain/artifactInspection.js"; import { parseEvidence } from "../../../src/domain/evidence.js"; import type { CliResult } from "./cliResult.js"; /** Read the inspection and first inventory substep from a successful CLI response. */ export const readArtifactInspection = (response: CliResult) => { expect(response.exitCode, response.stdout + response.stderr).toBe(0); const inspection = artifactInspectionResultSchema.parse( parseEvidence(response.json).normalized_result, ); const graph = artifactInventoryResultSchema.parse( inspection.substeps[0]?.evidence.normalized_result, ); return { inspection, graph }; };