docs: update coverage, READMEs, and add security tests

- Update COVERAGE.md to reflect completed features (now ~60%)
- Update main README with features and tools list
- Update CLI README with streaming options
- Expand API tests from 5 to 11 (add stream endpoint tests)
- Add 14 security tests for path traversal, command injection
- Total tests: 109 (up from 88)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 18:53:36 +01:00
co-authored by Claude Opus 4.5
parent 82a816a5b5
commit ef69d9c945
5 changed files with 478 additions and 52 deletions
+87
View File
@@ -21,6 +21,18 @@ class TestAgentListEndpoint:
agent_names = [a["name"] for a in data["agents"]]
assert "explore" in agent_names
@pytest.mark.anyio
async def test_list_agents_returns_descriptions(self, auth_client):
"""Test that agent list includes descriptions."""
response = await auth_client.get("/agents/")
assert response.status_code == 200
data = response.json()
for agent in data["agents"]:
assert "name" in agent
assert "description" in agent
assert len(agent["description"]) > 0
class TestAgentInfoEndpoint:
"""Tests for GET /agents/{agent_type} endpoint."""
@@ -42,6 +54,13 @@ class TestAgentInfoEndpoint:
assert response.status_code == 404
@pytest.mark.anyio
async def test_get_agent_empty_name(self, auth_client):
"""Test getting agent with empty name."""
response = await auth_client.get("/agents/")
# This is the list endpoint, should return 200
assert response.status_code == 200
class TestAgentRunEndpoint:
"""Tests for POST /agents/run endpoint."""
@@ -73,3 +92,71 @@ class TestAgentRunEndpoint:
)
assert response.status_code == 422 # Validation error
@pytest.mark.anyio
async def test_run_missing_prompt(self, auth_client):
"""Test running with missing prompt."""
response = await auth_client.post(
"/agents/run",
json={
"agent_type": "explore",
"working_dir": "."
}
)
assert response.status_code == 422
@pytest.mark.anyio
async def test_run_empty_body(self, auth_client):
"""Test running with empty request body."""
response = await auth_client.post("/agents/run", json={})
assert response.status_code == 422
class TestAgentStreamEndpoint:
"""Tests for POST /agents/stream endpoint."""
@pytest.mark.anyio
async def test_stream_with_unknown_agent(self, auth_client):
"""Test streaming unknown agent type."""
response = await auth_client.post(
"/agents/stream",
json={
"prompt": "test",
"agent_type": "nonexistent",
"working_dir": "."
}
)
assert response.status_code == 400
assert "Unknown agent" in response.json()["detail"]
@pytest.mark.anyio
async def test_stream_request_validation(self, auth_client):
"""Test stream request validation."""
response = await auth_client.post(
"/agents/stream",
json={
"agent_type": "explore"
# Missing prompt
}
)
assert response.status_code == 422
@pytest.mark.anyio
async def test_stream_content_type(self, auth_client):
"""Test that stream endpoint returns correct content type."""
# Note: This test would require mocking the agent to avoid LLM calls
# For now, we just verify validation works
response = await auth_client.post(
"/agents/stream",
json={
"prompt": "test",
"agent_type": "nonexistent",
"working_dir": "."
}
)
# Unknown agent returns 400, not streaming
assert response.status_code == 400