Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
88 lines
3.2 KiB
Markdown
88 lines
3.2 KiB
Markdown
# Règle Claude : Time Tracking automatique via Lesstime
|
|
|
|
> Ajouter ce contenu dans le CLAUDE.md de chaque projet ou dans `~/.claude/CLAUDE.md` pour l'appliquer globalement.
|
|
|
|
---
|
|
|
|
## Time Tracking obligatoire
|
|
|
|
Claude DOIT créer une time entry dans Lesstime au démarrage de chaque tâche de développement, ou sur demande explicite de l'utilisateur ("lance le chrono", "start timer", "track le temps").
|
|
|
|
### Déclencheurs
|
|
|
|
1. **Début d'une tâche de dev** : feature, bugfix, refactoring, infra, review
|
|
2. **Demande explicite** : "lance le chrono", "start timer", "track le temps"
|
|
3. **Depuis un ticket Lesstime** : lier directement au taskId du ticket référencé
|
|
|
|
### Méthode
|
|
|
|
Créer la time entry via **curl** sur l'API REST Lesstime :
|
|
|
|
1. **Login** : `POST http://project.malio-dev.fr/api/login_check`
|
|
- Body : `{"username":"admin","password":"admin"}`
|
|
- Réponse : 204 avec cookie `Set-Cookie: BEARER=<jwt>`
|
|
|
|
2. **Créer le timer** : `POST http://project.malio-dev.fr/api/time_entries`
|
|
- Headers : `Cookie: BEARER=<jwt>`, `Content-Type: application/ld+json`, `Accept: application/ld+json`
|
|
- Body :
|
|
```json
|
|
{
|
|
"user": "/api/users/5",
|
|
"startedAt": "<ISO8601 avec timezone>",
|
|
"title": "<description courte de la tâche>",
|
|
"project": "/api/projects/<projectId>",
|
|
"tags": ["/api/task_tags/<tagId>"],
|
|
"task": "/api/tasks/<taskId>"
|
|
}
|
|
```
|
|
|
|
3. **Stopper le timer** : `PATCH http://project.malio-dev.fr/api/time_entries/<id>`
|
|
- Headers : `Cookie: BEARER=<jwt>`, `Content-Type: application/merge-patch+json`, `Accept: application/ld+json`
|
|
- Body : `{"stoppedAt": "<ISO8601>"}`
|
|
|
|
### Paramètres obligatoires
|
|
|
|
- **user** : TOUJOURS `/api/users/5` (Matthieu)
|
|
- **startedAt** : ISO 8601 avec timezone (ex: `2026-04-01T14:30:00+02:00`)
|
|
- **title** : description courte de la tâche en cours
|
|
- **project** : selon le projet (voir mapping ci-dessous)
|
|
|
|
### Tags (choisir selon le type de travail)
|
|
|
|
| Tag | ID | IRI |
|
|
|-----|----|-----|
|
|
| Backend | 3 | `/api/task_tags/3` |
|
|
| Frontend | 2 | `/api/task_tags/2` |
|
|
| IA | 7 | `/api/task_tags/7` |
|
|
| Infra | 5 | `/api/task_tags/5` |
|
|
| UI/UX | 4 | `/api/task_tags/4` |
|
|
| Maintenance | 6 | `/api/task_tags/6` |
|
|
| RDV | 1 | `/api/task_tags/1` |
|
|
| Réunion | 8 | `/api/task_tags/8` |
|
|
| Formation | 10 | `/api/task_tags/10` |
|
|
| Gestion projet | 9 | `/api/task_tags/9` |
|
|
|
|
### Mapping projets
|
|
|
|
| Projet | ID | IRI |
|
|
|--------|----|-----|
|
|
| Lesstime | 5 | `/api/projects/5` |
|
|
| Inventory | 7 | `/api/projects/7` |
|
|
| SIRH | 12 | `/api/projects/12` |
|
|
| Infrastructure | 13 | `/api/projects/13` |
|
|
| Malio UI | 11 | `/api/projects/11` |
|
|
| ERP Liot | 6 | `/api/projects/6` |
|
|
| Ferme | 8 | `/api/projects/8` |
|
|
| ADMIN | 16 | `/api/projects/16` |
|
|
| Maintenance-LIOT | 17 | `/api/projects/17` |
|
|
| Qualiopi | 14 | `/api/projects/14` |
|
|
| Vaultwarden | 18 | `/api/projects/18` |
|
|
|
|
### Règles
|
|
|
|
- **Un seul timer actif à la fois** (contrainte DB) — stopper l'actif avant d'en créer un nouveau
|
|
- **Toujours stopper le timer** en fin de tâche ou sur demande
|
|
- **Informer l'utilisateur** quand un timer est lancé/stoppé (numéro, titre, projet, tags)
|
|
- **Lier au ticket Lesstime** si un ticket est référencé (champ `task`)
|
|
- **Choisir les tags intelligemment** selon le type de travail effectué
|