Add step 622 tools catalog refresh v2.0
This commit is contained in:
@@ -4477,4 +4477,13 @@ target_link_libraries(step621_test PRIVATE
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
add_executable(step622_test tests/step622_test.cpp)
|
||||
target_include_directories(step622_test PRIVATE src)
|
||||
target_link_libraries(step622_test PRIVATE
|
||||
nlohmann_json::nlohmann_json
|
||||
unofficial::tree-sitter::tree-sitter
|
||||
tree_sitter_python tree_sitter_cpp tree_sitter_elisp
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
# Step 12: Dear ImGui shell scaffolding created (main.cpp exists but not built due to dependencies)
|
||||
|
||||
142
editor/tests/step622_test.cpp
Normal file
142
editor/tests/step622_test.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
// Step 622: tools.json refresh (8 tests)
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
static int passed = 0, failed = 0;
|
||||
#define TEST(name) { std::cout << " " << #name << "... "; }
|
||||
#define PASS() { std::cout << "PASS\n"; ++passed; }
|
||||
#define FAIL(msg) { std::cout << "FAIL: " << msg << "\n"; ++failed; }
|
||||
#define CHECK(cond, msg) if (!(cond)) { FAIL(msg); return; } else {}
|
||||
|
||||
static bool loadToolsJson(json* out, std::string* error) {
|
||||
std::ifstream in("tools/claude/tools.json");
|
||||
if (!in.is_open()) {
|
||||
*error = "open_failed";
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
in >> *out;
|
||||
return true;
|
||||
} catch (...) {
|
||||
*error = "parse_failed";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool hasTool(const json& tools, const std::string& name) {
|
||||
for (const auto& tool : tools) {
|
||||
if (tool.value("name", "") == name) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void test_tools_json_parses() {
|
||||
TEST(tools_json_parses);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_version_bumped_to_2_0() {
|
||||
TEST(version_bumped_to_2_0);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
CHECK(doc.value("version", "") == "2.0", "version should be 2.0");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_provider_still_anthropic() {
|
||||
TEST(provider_still_anthropic);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
CHECK(doc.value("provider", "") == "anthropic", "provider mismatch");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_tools_array_has_broad_coverage() {
|
||||
TEST(tools_array_has_broad_coverage);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
CHECK(doc.contains("tools") && doc["tools"].is_array(), "tools array missing");
|
||||
CHECK((int)doc["tools"].size() >= 70, "expected at least 70 tools");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_contains_new_sprint36_tools() {
|
||||
TEST(contains_new_sprint36_tools);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
const auto& tools = doc["tools"];
|
||||
CHECK(hasTool(tools, "whetstone_architect_intake"), "missing whetstone_architect_intake");
|
||||
CHECK(hasTool(tools, "whetstone_generate_taskitems"), "missing whetstone_generate_taskitems");
|
||||
CHECK(hasTool(tools, "whetstone_queue_ready"), "missing whetstone_queue_ready");
|
||||
CHECK(hasTool(tools, "whetstone_set_workspace"), "missing whetstone_set_workspace");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_contains_sprint32_35_operational_tools() {
|
||||
TEST(contains_sprint32_35_operational_tools);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
const auto& tools = doc["tools"];
|
||||
CHECK(hasTool(tools, "whetstone_create_workflow"), "missing whetstone_create_workflow");
|
||||
CHECK(hasTool(tools, "whetstone_orchestrate_run_deterministic"), "missing orchestrate tool");
|
||||
CHECK(hasTool(tools, "whetstone_get_event_stream"), "missing event stream tool");
|
||||
CHECK(hasTool(tools, "whetstone_get_review_queue"), "missing review queue tool");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_tool_names_are_unique() {
|
||||
TEST(tool_names_are_unique);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
std::set<std::string> seen;
|
||||
for (const auto& tool : doc["tools"]) {
|
||||
std::string name = tool.value("name", "");
|
||||
CHECK(!name.empty(), "tool name should not be empty");
|
||||
CHECK(seen.insert(name).second, "duplicate tool name found");
|
||||
}
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_each_tool_has_input_schema_object() {
|
||||
TEST(each_tool_has_input_schema_object);
|
||||
json doc;
|
||||
std::string error;
|
||||
CHECK(loadToolsJson(&doc, &error), "tools.json should parse");
|
||||
for (const auto& tool : doc["tools"]) {
|
||||
CHECK(tool.contains("input_schema"), "input_schema missing");
|
||||
CHECK(tool["input_schema"].is_object(), "input_schema should be object");
|
||||
}
|
||||
PASS();
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Step 622: tools.json refresh\n";
|
||||
|
||||
test_tools_json_parses(); // 1
|
||||
test_version_bumped_to_2_0(); // 2
|
||||
test_provider_still_anthropic(); // 3
|
||||
test_tools_array_has_broad_coverage(); // 4
|
||||
test_contains_new_sprint36_tools(); // 5
|
||||
test_contains_sprint32_35_operational_tools(); // 6
|
||||
test_tool_names_are_unique(); // 7
|
||||
test_each_tool_has_input_schema_object(); // 8
|
||||
|
||||
std::cout << "\nResults: " << passed << "/" << (passed + failed) << " passed\n";
|
||||
return failed == 0 ? 0 : 1;
|
||||
}
|
||||
31
progress.md
31
progress.md
@@ -12323,3 +12323,34 @@ restart, including a new headless RPC method to apply workspace context.
|
||||
- `editor/src/AgentPermissionPolicy.h` within header-size limit (`132` <= `600`)
|
||||
- `editor/tests/step621_test.cpp` within test-file size guidance (`229` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
### Step 622: `tools.json` refresh (version 2.0)
|
||||
**Status:** PASS (8/8 tests)
|
||||
|
||||
Refreshed `tools/claude/tools.json` to version `2.0` and expanded coverage to
|
||||
match the registered MCP tool surface, including Sprint 36 tools and Sprint
|
||||
32-35 orchestration/review/workflow operational interfaces.
|
||||
|
||||
**Files modified:**
|
||||
- `tools/claude/tools.json` - regenerated tool catalog:
|
||||
- version bumped to `2.0`
|
||||
- includes registered MCP tools (including `whetstone_architect_intake`,
|
||||
`whetstone_generate_taskitems`, `whetstone_queue_ready`, `whetstone_set_workspace`)
|
||||
- `editor/CMakeLists.txt` - `step622_test` target
|
||||
|
||||
**Files added:**
|
||||
- `editor/tests/step622_test.cpp` - 8 tests covering:
|
||||
- JSON parse/version/provider validity
|
||||
- tool-count breadth and uniqueness
|
||||
- presence of Sprint 36 and Sprint 32-35 operational tool entries
|
||||
- schema object presence for all tools
|
||||
|
||||
**Verification run:**
|
||||
- `cmake -S editor -B editor/build-native` - PASS
|
||||
- `cmake --build editor/build-native --target step622_test step621_test` - PASS
|
||||
- `./editor/build-native/step622_test` - PASS (8/8)
|
||||
- `./editor/build-native/step621_test` - PASS (12/12) regression coverage
|
||||
|
||||
**Architecture gate check:**
|
||||
- `editor/tests/step622_test.cpp` within test-file size guidance (`142` lines)
|
||||
- Tool catalog refresh does not violate header-only or naming constraints in `ARCHITECTURE.md`
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user