feat: Add intelligent auto-router and enhanced integrations
- Add intelligent-router.sh hook for automatic agent routing - Add AUTO-TRIGGER-SUMMARY.md documentation - Add FINAL-INTEGRATION-SUMMARY.md documentation - Complete Prometheus integration (6 commands + 4 tools) - Complete Dexto integration (12 commands + 5 tools) - Enhanced Ralph with access to all agents - Fix /clawd command (removed disable-model-invocation) - Update hooks.json to v5 with intelligent routing - 291 total skills now available - All 21 commands with automatic routing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
0
prometheus/tests/parser/__init__.py
Normal file
0
prometheus/tests/parser/__init__.py
Normal file
34
prometheus/tests/parser/test_file_types.py
Normal file
34
prometheus/tests/parser/test_file_types.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from prometheus.parser.file_types import FileType
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"file_path,expected_type",
|
||||
[
|
||||
("script.sh", FileType.BASH),
|
||||
("program.c", FileType.C),
|
||||
("app.cs", FileType.CSHARP),
|
||||
("class.cpp", FileType.CPP),
|
||||
("header.cc", FileType.CPP),
|
||||
("file.cxx", FileType.CPP),
|
||||
("main.go", FileType.GO),
|
||||
("Class.java", FileType.JAVA),
|
||||
("app.js", FileType.JAVASCRIPT),
|
||||
("Service.kt", FileType.KOTLIN),
|
||||
("index.php", FileType.PHP),
|
||||
("script.py", FileType.PYTHON),
|
||||
("query.sql", FileType.SQL),
|
||||
("config.yaml", FileType.YAML),
|
||||
("docker-compose.yml", FileType.YAML),
|
||||
("readme.md", FileType.UNKNOWN),
|
||||
("Makefile", FileType.UNKNOWN),
|
||||
("", FileType.UNKNOWN),
|
||||
],
|
||||
)
|
||||
def test_file_type_from_path(file_path: str, expected_type: FileType):
|
||||
"""Test that file extensions are correctly mapped to FileTypes"""
|
||||
path = Path(file_path)
|
||||
assert FileType.from_path(path) == expected_type
|
||||
68
prometheus/tests/parser/test_tree_sitter_parser.py
Normal file
68
prometheus/tests/parser/test_tree_sitter_parser.py
Normal file
@@ -0,0 +1,68 @@
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, create_autospec, mock_open, patch
|
||||
|
||||
import pytest
|
||||
from tree_sitter._binding import Tree
|
||||
|
||||
from prometheus.parser.file_types import FileType
|
||||
from prometheus.parser.tree_sitter_parser import (
|
||||
FILE_TYPE_TO_LANG,
|
||||
parse,
|
||||
supports_file,
|
||||
)
|
||||
|
||||
|
||||
# Test fixtures
|
||||
@pytest.fixture
|
||||
def mock_python_file():
|
||||
return Path("test.py")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_tree():
|
||||
tree = create_autospec(Tree, instance=True)
|
||||
return tree
|
||||
|
||||
|
||||
# Test supports_file function
|
||||
def test_supports_file_with_supported_type(mock_python_file):
|
||||
with patch("prometheus.parser.file_types.FileType.from_path") as mock_from_path:
|
||||
mock_from_path.return_value = FileType.PYTHON
|
||||
assert supports_file(mock_python_file) is True
|
||||
mock_from_path.assert_called_once_with(mock_python_file)
|
||||
|
||||
|
||||
def test_parse_python_file_successfully(mock_python_file, mock_tree):
|
||||
mock_content = b'print("hello")'
|
||||
m = mock_open(read_data=mock_content)
|
||||
|
||||
with (
|
||||
patch("prometheus.parser.file_types.FileType.from_path") as mock_from_path,
|
||||
patch("prometheus.parser.tree_sitter_parser.get_parser") as mock_get_parser,
|
||||
patch.object(Path, "open", m),
|
||||
):
|
||||
# Setup mocks
|
||||
mock_from_path.return_value = FileType.PYTHON
|
||||
mock_parser = mock_get_parser.return_value
|
||||
mock_parser.parse.return_value = mock_tree
|
||||
|
||||
# Test parse function
|
||||
result = parse(mock_python_file)
|
||||
|
||||
# Verify results and interactions
|
||||
assert result == mock_tree
|
||||
mock_from_path.assert_called_once_with(mock_python_file)
|
||||
mock_get_parser.assert_called_once_with("python")
|
||||
mock_parser.parse.assert_called_once_with(mock_content)
|
||||
|
||||
|
||||
def test_parse_all_supported_languages():
|
||||
"""Test that we can get parsers for all supported languages."""
|
||||
with patch("tree_sitter_language_pack.get_parser") as mock_get_parser:
|
||||
mock_parser = MagicMock()
|
||||
mock_get_parser.return_value = mock_parser
|
||||
|
||||
for lang in FILE_TYPE_TO_LANG.values():
|
||||
mock_get_parser(lang)
|
||||
mock_get_parser.assert_called_with(lang)
|
||||
mock_get_parser.reset_mock()
|
||||
Reference in New Issue
Block a user