refactor: cleanup and comprehensive documentation

Major changes:
- Add comprehensive documentation to all modules with detailed docstrings
- Remove unused THINKING_MODEL config (use single GEMINI_MODEL with thinking_mode param)
- Remove list_models functionality (simplified to single model configuration)
- Rename DEFAULT_MODEL to GEMINI_MODEL for clarity
- Remove unused python-dotenv dependency
- Fix missing pydantic in setup.py dependencies

Documentation improvements:
- Document security measures in file_utils.py (path validation, sandboxing)
- Add detailed comments to critical logic sections
- Document tool creation process in BaseTool
- Explain configuration values and their impact
- Add comprehensive function-level documentation

Code quality:
- Apply black formatting to all files
- Fix all ruff linting issues
- Update tests to match refactored code
- All 63 tests passing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Fahad
2025-06-09 19:04:24 +04:00
parent fd6e2f9b64
commit 783ba73181
12 changed files with 639 additions and 260 deletions

View File

@@ -2,7 +2,6 @@
Tests for the main server functionality
"""
import json
from unittest.mock import Mock, patch
import pytest
@@ -26,11 +25,10 @@ class TestServerTools:
assert "analyze" in tool_names
assert "chat" in tool_names
assert "review_changes" in tool_names
assert "list_models" in tool_names
assert "get_version" in tool_names
# Should have exactly 8 tools
assert len(tools) == 8
# Should have exactly 7 tools
assert len(tools) == 7
# Check descriptions are verbose
for tool in tools:
@@ -69,22 +67,6 @@ class TestServerTools:
assert response_data["status"] == "success"
assert response_data["content"] == "Chat response"
@pytest.mark.asyncio
async def test_handle_list_models(self):
"""Test listing models"""
result = await handle_call_tool("list_models", {})
assert len(result) == 1
# Check if we got models or an error
text = result[0].text
if "Error" in text:
# API key not set in test environment
assert "GEMINI_API_KEY" in text
else:
# Should have models
models = json.loads(text)
assert len(models) >= 1
@pytest.mark.asyncio
async def test_handle_get_version(self):
"""Test getting version info"""