#pragma once // Step 1959: LibraryCapabilityRecord // Struct representing a library's capability for one operation domain. // Score 0.0 = not applicable, 1.0 = reference implementation. #include #include namespace whetstone { struct LibraryCapabilityRecord { std::string libraryId; // e.g. "nlohmann_json" std::string operationDomain; // e.g. "serialization.json" float score = 0.0f; // [0.0, 1.0] std::vector preferredAPIs; std::vector knownWeaknesses; bool notApplicable = false; std::string annotatedAt; // ISO date string, e.g. "2026-03-02" std::string source; // annotation source description }; class LibraryCapabilityRecordValidator { public: struct ValidationResult { bool valid = true; std::string error; }; ValidationResult validate(const LibraryCapabilityRecord& r) const { if (r.libraryId.empty()) return {false, "libraryId must not be empty"}; if (r.operationDomain.empty()) return {false, "operationDomain must not be empty"}; if (r.score < 0.0f || r.score > 1.0f) return {false, "score must be in [0.0, 1.0], got " + std::to_string(r.score)}; if (r.notApplicable && r.score > 0.0f) return {false, "notApplicable=true is inconsistent with score > 0.0"}; return {true, ""}; } }; } // namespace whetstone