feat: init Scalper — pipeline légal scrape+traduction (SCAL-1..SCAL-12)

- legal-source-check (liste de blocage scanlation, robots.txt, rate limiting)
- sources: demo (fixture) + mangadex (API officielle)
- cleaner, translator (LLM Mistral + glossaire), QA, exporter (md/json/html)
- CLI + pipeline resumable (state.json), 22 tests unitaires
- sous-agents Mistral Agents SDK: orchestrator + scraper/translator/qa
- skills/ (6 SKILL.md), docs légales, CI GitHub Actions

Refs: Jira SCAL-1 (Epic CDC), SCAL-2..SCAL-12 (backlog Scrum)
This commit is contained in:
Vibe committed 2026-11-16 10:07:28 +00:00
commit f38a1d630b
38 files changed
+1733

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
---
name: chapter-cleaner
description: Nettoie un chapitre brut (HTML/JSON) : retire boilerplate, watermarks, liens prev/next ; segmente en blocs typés (dialogue/narration/caption/onomatopée/image [IMG:n]) ; produit chapter.json.
---
# chapter-cleaner
Étapes : supprimer nav/pub/watermarks/liens prev-next ; extraire le contenu principal ; segmenter en blocs ordonnés typés ; normaliser UTF-8 ; détecter la langue source.
Sortie : `chapter.json` = `{meta, blocks: [{index, type, text, image}]}`.
Implémentation : `src/scalper/cleaner.py`.
+18
View File
@@ -0,0 +1,18 @@
---
name: legal-source-check
description: Valide qu'une source manga/webtoon est légale (robots.txt, CGU, licence, liste de blocage) avant tout scraping. Bloqué si un critère échoue.
---
# legal-source-check
Checklist (toutes doivent passer) :
1. robots.txt : chemins ciblés non interdits.
2. CGU : pas d'interdiction de scraping/réutilisation.
3. Licence : API officielle, Creative Commons, domaine public ou contenu propre.
4. Aucun contournement de paywall/captcha/authentification.
5. Liste de blocage : sites de scanlation non autorisés refusés (ex. mangas-origines).
Politique de crawl : UA identifiable, >= 1s entre requêtes, 1 concurrence, backoff sur 429/5xx.
Sortie : verdict JSON `{source, verdict: allowed|blocked, reasons, license}`.
Implémentation : `src/scalper/legal.py`.
+15
View File
@@ -0,0 +1,15 @@
---
name: llm-translator
description: Traduit un chapitre structuré vers une langue cible via LLM Mistral, avec glossaire injecté, cohérence des noms, préservation des placeholders [IMG:n], chunking respectant le budget de tokens.
---
# llm-translator
Paramètres : `target_lang`, `glossary` (JSON terme -> traduction), style.
Règles du prompt système : ne jamais traduire [IMG:n] ni les URLs ; respecter le glossaire ; conserver le registre ; aucune explication en sortie.
Pipeline : glossaire chargé/étendu au fil des chapitres ; chunks <= ~1500 tokens de sortie en respectant les frontières de blocs ; retry max 3 si sortie invalide.
Sortie : `chapter.<lang>.json`. Clé API via `MISTRAL_API_KEY` uniquement.
Implémentation : `src/scalper/translator.py`.
+10
View File
@@ -0,0 +1,10 @@
---
name: manga-exporter
description: Exporte un chapitre traduit en Markdown, JSON ou HTML, avec images relatives, page « Source et licence » obligatoire et noms de fichiers assainis.
---
# manga-exporter
Formats : `md`, `json`, `html` (EPUB en V2). Noms : `<series>-<chapitre>-<lang>.<ext>`. Page « Source et licence » (URL, licence, date) incluse dans chaque export. Jamais d'export depuis une source bloquée.
Implémentation : `src/scalper/exporter.py`.
+12
View File
@@ -0,0 +1,12 @@
---
name: manga-scraper
description: Scraping générique et respectueux via un SourceAdapter, avec rate limiting, stockage brut + JSON, et state.json pour reprendre après interruption.
---
# manga-scraper
Contrat `SourceAdapter` : `list_series()`, `list_chapters(series_id)`, `fetch_chapter(chapter, dest_dir)`.
Règles : passer par legal-source-check d'abord ; >= 1s entre requêtes, 1 thread, UA identifiable, backoff ; stockage `out/raw/<source>/<series>/<chapter>/` + `state.json` resumable ; jamais de contournement d'auth/paywall.
Implémentations : `src/scalper/sources/demo.py` (fixture), `src/scalper/sources/mangadex.py` (API officielle).
+11
View File
@@ -0,0 +1,11 @@
---
name: translation-qa
description: Contrôle qualité d'une traduction : segments non traduits, conformité glossaire, cohérence des noms, ratio de longueur, intégrité des placeholders [IMG:n], rapport de score 0-100.
---
# translation-qa
Contrôles : langue cible détectée ; conformité glossaire ; cohérence des noms ; ratio longueur 0.5x-2.5x ; nombre de blocs identique et placeholders intacts ; pas de blocs vides.
Sortie : `{score: 0-100, issues: [...], pass: score >= 80 et 0 issue critique}`.
Implémentation : `src/scalper/qa.py`.