| 1349 | } |
| 1350 | |
| 1351 | static bool ha_tool_event_supported(ha_lifecycle_dialect_t dialect, const char *event, |
| 1352 | const char *tool, bool *coverage) { |
| 1353 | if (coverage) { |
| 1354 | *coverage = false; |
| 1355 | } |
| 1356 | if (!event || !tool) { |
| 1357 | return false; |
| 1358 | } |
| 1359 | if (dialect == HA_DIALECT_EVENT) { |
| 1360 | if (strcmp(event, "PreToolUse") == 0 && |
| 1361 | (strcmp(tool, "Grep") == 0 || strcmp(tool, "Glob") == 0 || strcmp(tool, "Bash") == 0)) { |
| 1362 | return true; |
| 1363 | } |
| 1364 | if (strcmp(event, "PostToolUse") == 0 && strcmp(tool, "Read") == 0) { |
| 1365 | if (coverage) { |
| 1366 | *coverage = true; |
| 1367 | } |
| 1368 | return true; |
| 1369 | } |
| 1370 | return false; |
| 1371 | } |
| 1372 | bool matches = (dialect == HA_DIALECT_GEMINI && strcmp(event, "AfterTool") == 0 && |
| 1373 | strcmp(tool, "read_file") == 0) || |
| 1374 | (dialect == HA_DIALECT_QWEN && strcmp(event, "PostToolUse") == 0 && |
| 1375 | strcmp(tool, "ReadFile") == 0) || |
| 1376 | (dialect == HA_DIALECT_QODER && strcmp(event, "PostToolUse") == 0 && |
| 1377 | strcmp(tool, "Read") == 0) || |
| 1378 | (dialect == HA_DIALECT_FACTORY && strcmp(event, "PostToolUse") == 0 && |
| 1379 | strcmp(tool, "Read") == 0) || |
| 1380 | (dialect == HA_DIALECT_AUGMENT && strcmp(event, "PostToolUse") == 0 && |
| 1381 | strcmp(tool, "view") == 0); |
| 1382 | if (matches && coverage) { |
| 1383 | *coverage = true; |
| 1384 | } |
| 1385 | return matches; |
| 1386 | } |
| 1387 | |
| 1388 | static bool ha_normalized_tool_path(yyjson_val *root, yyjson_val *tool_input, char *path, |
| 1389 | size_t path_size) { |
no outgoing calls
no test coverage detected