feat(#158): Implement issue parser agent
Add AI-powered issue metadata parser using Anthropic Sonnet model. - Parse issue markdown to extract: estimated_context, difficulty, assigned_agent, blocks, blocked_by - Implement in-memory caching to avoid duplicate API calls - Graceful fallback to defaults on parse failures - Add comprehensive test suite (9 test cases) - 95% test coverage (exceeds 85% requirement) - Add ANTHROPIC_API_KEY to config - Update documentation and add .env.example Fixes #158 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,10 +10,13 @@ The coordinator receives webhook events from Gitea when issues are assigned, una
|
||||
|
||||
- HMAC SHA256 signature verification
|
||||
- Event routing (assigned, unassigned, closed)
|
||||
- AI-powered issue metadata parsing (using Anthropic Sonnet)
|
||||
- Context estimation and agent assignment
|
||||
- Dependency tracking (blocks/blocked_by)
|
||||
- Comprehensive logging
|
||||
- Health check endpoint
|
||||
- Docker containerized
|
||||
- 85%+ test coverage
|
||||
- 95%+ test coverage
|
||||
|
||||
## Development
|
||||
|
||||
@@ -44,9 +47,11 @@ ruff check src/
|
||||
### Running locally
|
||||
|
||||
```bash
|
||||
# Set environment variables
|
||||
export GITEA_WEBHOOK_SECRET="your-secret-here"
|
||||
export LOG_LEVEL="info"
|
||||
# Copy environment template
|
||||
cp .env.example .env
|
||||
|
||||
# Edit .env with your values
|
||||
# GITEA_WEBHOOK_SECRET, GITEA_URL, ANTHROPIC_API_KEY
|
||||
|
||||
# Run server
|
||||
uvicorn src.main:app --reload --port 8000
|
||||
@@ -82,6 +87,7 @@ Health check endpoint.
|
||||
| ---------------------- | ------------------------------------------- | -------- | ------- |
|
||||
| `GITEA_WEBHOOK_SECRET` | Secret for HMAC signature verification | Yes | - |
|
||||
| `GITEA_URL` | Gitea instance URL | Yes | - |
|
||||
| `ANTHROPIC_API_KEY` | Anthropic API key for issue parsing | Yes | - |
|
||||
| `LOG_LEVEL` | Logging level (debug, info, warning, error) | No | info |
|
||||
| `HOST` | Server host | No | 0.0.0.0 |
|
||||
| `PORT` | Server port | No | 8000 |
|
||||
@@ -96,6 +102,7 @@ docker build -t mosaic-coordinator .
|
||||
docker run -p 8000:8000 \
|
||||
-e GITEA_WEBHOOK_SECRET="your-secret" \
|
||||
-e GITEA_URL="https://git.mosaicstack.dev" \
|
||||
-e ANTHROPIC_API_KEY="your-anthropic-key" \
|
||||
mosaic-coordinator
|
||||
```
|
||||
|
||||
@@ -120,15 +127,21 @@ pytest -v
|
||||
```
|
||||
apps/coordinator/
|
||||
├── src/
|
||||
│ ├── main.py # FastAPI application
|
||||
│ ├── webhook.py # Webhook endpoint handlers
|
||||
│ ├── security.py # HMAC signature verification
|
||||
│ └── config.py # Configuration management
|
||||
│ ├── main.py # FastAPI application
|
||||
│ ├── webhook.py # Webhook endpoint handlers
|
||||
│ ├── parser.py # Issue metadata parser (Anthropic)
|
||||
│ ├── models.py # Data models
|
||||
│ ├── security.py # HMAC signature verification
|
||||
│ ├── config.py # Configuration management
|
||||
│ └── context_monitor.py # Context usage monitoring
|
||||
├── tests/
|
||||
│ ├── test_security.py
|
||||
│ ├── test_webhook.py
|
||||
│ └── conftest.py # Pytest fixtures
|
||||
├── pyproject.toml # Project metadata & dependencies
|
||||
│ ├── test_parser.py
|
||||
│ ├── test_context_monitor.py
|
||||
│ └── conftest.py # Pytest fixtures
|
||||
├── pyproject.toml # Project metadata & dependencies
|
||||
├── .env.example # Environment variable template
|
||||
├── Dockerfile
|
||||
└── README.md
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user