// SPDX-License-Identifier: AGPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® export module Crafter.Review:Schema; import std; import :Json; // The structured output a pass returns: FINDING, NOTE, COVERAGE and the // verdict. One block schema and one whole schema per run, the union of every // lens's vocabulary, so the tool block ahead of the user message is // byte-identical across lenses and the prompt cache is shared. The bytes are // fixed: SchemaJson() is the schema in DumpCompactSorted's form, and the // goldens hold the descriptions. The kernel modes have a schema of their // own: their note kinds, the persona vocabulary, and the whole pass's // predicted review and not-mine list. export namespace Crafter::Review::Schema { constexpr std::array NoteKinds = { "reserve-answer", "invariant", "pre-existing", "residual-risk", "hold", "info", "immaterial", "send-time-check", "refutation-verified", "unverified", }; constexpr std::array KernelNoteKinds = { "reserve-answer", "ledger-row", "pre-existing", "residual-risk", "hold", "info", "immaterial", "disposition-review", "send-time-check", "refutation-verified", }; // The vocabulary of a maintainer or recipient persona. constexpr std::array PersonaVerdicts = {"would-require", "no-comment", "would-object", "incomplete", "not-mine", "can-act", "ambiguous", "would-push-back", "already-known"}; constexpr std::array GenericVerdicts = {"clear", "defect", "immaterial", "n/a"}; constexpr std::array CoverageVerdicts = GenericVerdicts; // The union, for the kernel modes' schema. constexpr std::array KernelCoverageVerdicts = {"would-require", "no-comment", "would-object", "incomplete", "not-mine", "can-act", "ambiguous", "would-push-back", "already-known", "clear", "defect", "immaterial", "n/a"}; // Blocking and unowned, across both vocabularies: a lens that speaks the // generic one never emits a persona verdict, so the union judges either. constexpr std::array CoverageBlocking = {"would-object", "incomplete", "ambiguous", "would-push-back", "defect"}; constexpr std::array CoverageUnowned = {"not-mine", "n/a", "MISSING"}; constexpr std::array VerdictEnum = {"FIX FIRST", "SEND-READY"}; // kernel: the kernel modes' texts and vocabulary. Json Finding(bool kernel = false); Json Note(bool kernel = false); Json Coverage(bool kernel = false); Json BlockSchema(bool kernel = false); Json WholeSchema(bool kernel = false); // The schema of `kind` ("block", anything else the whole one) as it goes // to claude, for a mode (reply, series: the kernel schema). std::string SchemaJson(std::string_view kind, std::string_view mode = "commits"); }