Phase 6 Library Dispatch foundation. Five new headers: - OperationDomain: dot-key hierarchy with parent traversal - LibraryCapabilityRecord: score/APIs/weaknesses + validator - LibraryCapabilityLedger: (library, domain) -> record registry - OperationTaxonomy: 40+ domain tree, keyword-based classify() - Sprint286IntegrationSummary: 8-library seed ledger + verified lookups 25/25 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
#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 <string>
|
|
#include <vector>
|
|
|
|
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<std::string> preferredAPIs;
|
|
std::vector<std::string> 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
|