Add pluggable parser system, perception loop, and project infrastructure

Phase 0 (housekeeping):
- Add .gitignore to protect credentials and runtime files
- Track all project source code, docs, and config

Phase 1 (perception loop):
- Implement pluggable parser architecture (BaseMudParser ABC + ParserFactory)
- Add DeadSoulsParser with regex for HP/MP/SP prompt, room descriptions,
  exits (multiple formats), NPC/item detection, and combat events
- Add OutputBuffer for accumulating text between prompts
- Update GameState with SP support and update_from_prompt/room/combat methods
- Rewire main loop to use parser + buffer for real-time game state updates
- Add reconnection logic to TelnetClient (retry with backoff)
- Remove old TextParser (replaced by pluggable system)
- Add mud_type config field for selecting parser at runtime
- Add comprehensive test suite (50 tests, all passing)
This commit is contained in:
truetype committed 2026-02-08 19:08:59 +01:00
1 parent 0f370ec089
commit f85c27a742
42 files changed
+3490 -134

No files matched your search

+160
View File
@@ -0,0 +1,160 @@
# Virtual Environment Setup
## ✅ Virtual Environment Creato
Il virtual environment è stato creato con successo in `venv/` e tutte le dipendenze sono state installate.
## Come Attivare il Virtual Environment
### Windows PowerShell
```powershell
.\venv\Scripts\Activate.ps1
```
### Windows CMD
```cmd
.\venv\Scripts\activate.bat
```
### Linux/Mac
```bash
source venv/bin/activate
```
## Verifica Installazione
Dopo aver attivato il venv, verifica che tutto sia installato:
```powershell
# Attiva venv
.\venv\Scripts\Activate.ps1
# Verifica pacchetti installati
pip list
# Verifica versione Python
python --version
```
## Pacchetti Installati
Tutti i pacchetti da `requirements.txt` sono stati installati:
- ✅ `telnetlib3` - Client Telnet asincrono
- ✅ `networkx` - Gestione grafi per auto-mapping
- ✅ `sqlalchemy` - ORM per database
- ✅ `pydantic` - Validazione configurazione
- ✅ `rich` - Output formattato console
- ✅ `memvid` - Encoding QR-in-MP4
- ✅ `faiss-cpu` - Vector similarity search
- ✅ `sentence-transformers` - Text embeddings
- ✅ `torch` - Deep learning framework (dipendenza)
- ✅ `pytest` - Testing framework
- ✅ `pytest-asyncio` - Async testing
- ✅ `pytest-cov` - Coverage reporting
## Eseguire l'Applicazione
```powershell
# Attiva venv
.\venv\Scripts\Activate.ps1
# Esegui l'applicazione
python -m src.main
# Oppure con config personalizzato
python -m src.main --config my_config.yaml
```
## Eseguire i Test
```powershell
# Attiva venv
.\venv\Scripts\Activate.ps1
# Esegui tutti i test
pytest tests/ -v
# Esegui con coverage
pytest --cov=src --cov-report=html
# Esegui test specifico
pytest tests/test_parser.py -v
```
## Disattivare il Virtual Environment
Quando hai finito di lavorare:
```powershell
deactivate
```
## Aggiungere Nuove Dipendenze
Se devi aggiungere nuove dipendenze:
```powershell
# Attiva venv
.\venv\Scripts\Activate.ps1
# Installa nuovo pacchetto
pip install nome-pacchetto
# Aggiorna requirements.txt
pip freeze > requirements.txt
```
## Ricreare il Virtual Environment
Se hai problemi, puoi ricreare il venv:
```powershell
# Rimuovi venv esistente
Remove-Item -Recurse -Force venv
# Crea nuovo venv
python -m venv venv
# Attiva
.\venv\Scripts\Activate.ps1
# Reinstalla dipendenze
pip install -r requirements.txt
```
## Note
- Il virtual environment è **gitignored** (vedi `.gitignore`)
- Ogni sviluppatore deve creare il proprio venv locale
- Non committare mai la cartella `venv/` su git
- Usa sempre il venv quando lavori sul progetto
## Troubleshooting
### Errore "Execution Policy"
Se ricevi un errore di execution policy in PowerShell:
```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
### Pacchetti Mancanti
Se mancano pacchetti:
```powershell
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
```
### Versione Python Sbagliata
Assicurati di usare Python 3.10+:
```powershell
python --version
```
Se hai una versione più vecchia, installa Python 3.10 o superiore.