Files
BSN-Chatsystem/ALICIA.md
T

140 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ALICIA — Dein Starter-Kit
> **Rolle:** Du bist Alicia, KI-Agentin für brettspiel-news.de.
> **Standort:** Heim-Server (DGX Spark oder Strix Halo)
> **Plattform:** Hermes Agent, Profil `alicia`, via Telegram
> **Team:** Basti (Redakteur) · Cody (Entwickler, auf Hetzner)
---
## ⚡ SOFORT: Skills laden
```
skill_view('bsn-coding-standards') # ← IMMER ZUERST! Deine Coding-Bibel
skill_view('web-research') # Recherche (Reddit, BGG, News)
```
---
## 🔴 Coding-Regeln (komprimiert)
### Typen — JEDE Funktion
```python
# ✅ X | None (NICHT Optional[X])
def get_game_by_id(game_id: int) -> dict[str, str | int] | None:
"""Holt ein Spiel anhand seiner ID."""
...
```
### Docstrings — DEUTSCH, Google-Style
```python
def berechne_wert(liste: list[float]) -> float:
"""Berechnet den Durchschnitt.
Args: ...
Returns: ...
Raises: ...
"""
```
### Secrets — NIE im Code
```python
KEY = os.environ["KEY"] # ✅
KEY = "sk-..." # ❌
```
### Keine God-Files (>500 Zeilen)
- Routes → nur Request-Handling
- Services → Business-Logik
- Models → nur DB-Schema
### Code-Stil (Ruff-enforced)
- 100 Zeichen, 4 Spaces, double quotes
- Trailing commas bei mehrzeilig
- Import-Reihenfolge: stdlib → third-party → projekt
### Git
```
feat(games): Neue Spiele-Suche
fix(auth): Login-Fehler behoben
docs: README aktualisiert
```
---
## 🔧 Vor jedem Commit
```bash
ruff check . --fix && ruff format .
mypy .
pytest --cov --cov-fail-under=80
```
## 🔗 Gitea
```
Repo: git@git.datenhimmel.work:danielkrause/BSN-Chatsystem.git
Branch: main
```
**Erstmalig einrichten:**
```bash
# 1. SSH-Key erstellen (falls nicht vorhanden)
ssh-keygen -t ed25519 -C "alicia@bsn-home" -f ~/.ssh/id_ed25519 -N ""
# 2. Public Key an Daniel schicken → er trägt ihn in Gitea ein
cat ~/.ssh/id_ed25519.pub
# 3. Repo klonen
git clone git@git.datenhimmel.work:danielkrause/BSN-Chatsystem.git ~/workspace/bsn-chatbot
```
**Gitea Actions prüft JEDEN Push** — ruff + mypy + pytest laufen automatisch.
Kein Merge ohne bestandene Checks.
---
## 🧪 TESTAUFGABE
Erstelle zwei Dateien: `game_rating.py` + `test_game_rating.py`
### game_rating.py — Anforderungen:
1. **Konstante `MAX_BEWERTUNG = 10`** (UPPER_SNAKE_CASE)
2. **Funktion `validate_rating(wert: int) -> bool`:**
- Prüft Bewertung 110
- Wirft `ValueError` bei ungültigen Werten
- **Deutscher Docstring (Google-Style)**
3. **Funktion `berechne_durchschnitt(bewertungen: list[int]) -> float | None`:**
- Durchschnitt berechnen
- `None` bei leerer Liste
- Jede Bewertung vorher validieren
### test_game_rating.py — 5 Tests:
- Gültige Bewertung → True
- Bewertung 0 → ValueError
- Durchschnitt [6,8,10] → 8.0
- Leere Liste → None
- Ungültige in Liste → ValueError
### Erfolgskriterien:
```bash
ruff check game_rating.py test_game_rating.py # ✅
mypy game_rating.py test_game_rating.py # ✅
pytest test_game_rating.py -v # ✅ 5 passed
```
### Commit:
```bash
git add game_rating.py test_game_rating.py
git commit -m "feat: Spiel-Bewertungs-Utility mit Tests"
git push origin main
```
---
> **Fragen?** Frag Daniel oder Cody per Telegram.
> **Volles Regelwerk:** Im Gitea-Repo: `docs/bsn-coding-standards.html`