Step 250: structured diagnostic format (error codes, nodeIds, fix suggestions)

Unified diagnostic stream merging parse errors (E01xx), annotation validation
(E02xx), and strategy violations (E03xx) with severity levels, AST node
references, and machine-applicable fix mutations. New getDiagnostics RPC
method with severity/source filtering. 18 MCP tools total.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bill
2026-02-11 15:36:24 +00:00
parent f858925911
commit 14c2fc218a
8 changed files with 795 additions and 1 deletions

View File

@@ -646,6 +646,30 @@ private:
};
}
// ---------------------------------------------------------------
// Step 250: Register diagnostic tools
// ---------------------------------------------------------------
void registerDiagnosticTools() {
tools_.push_back({"whetstone_get_diagnostics",
"Get structured diagnostics for the active buffer. Combines "
"parse errors, annotation validation, and strategy violations "
"into one stream with error codes, nodeIds, and fix suggestions. "
"Filter by severity (error/warning/info/hint) or source "
"(parser/annotation/strategy).",
{{"type", "object"}, {"properties", {
{"severity", {{"type", "string"},
{"enum", {"error", "warning", "info", "hint"}},
{"description", "Maximum severity level to include"}}},
{"source", {{"type", "string"},
{"enum", {"parser", "annotation", "strategy"}},
{"description", "Filter by diagnostic source"}}}
}}}
});
toolHandlers_["whetstone_get_diagnostics"] = [this](const json& args) {
return callWhetstone("getDiagnostics", args);
};
}
// ---------------------------------------------------------------
// Register all tools
// ---------------------------------------------------------------
@@ -653,5 +677,6 @@ private:
registerASTTools();
registerAnnotationTools();
registerFileTools();
registerDiagnosticTools();
}
};