-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.py
More file actions
275 lines (226 loc) · 8.39 KB
/
Copy pathinit.py
File metadata and controls
275 lines (226 loc) · 8.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#!/usr/bin/env python3
"""
init - Initialiser la mémoire interne AIDD
Cette commande crée et initialise les fichiers de mémoire du projet.
Usage: python init.py
"""
import os
import json
from datetime import datetime
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
AIDD_DIR = os.path.join(PROJECT_ROOT, "aidd_docs")
def create_memory_files():
"""Créer les fichiers de mémoire AIDD"""
memory_dir = os.path.join(AIDD_DIR, "memory")
os.makedirs(memory_dir, exist_ok=True)
# 1. DECISIONS.md - Décisions architecturales
decisions_file = os.path.join(memory_dir, "DECISIONS.md")
if not os.path.exists(decisions_file):
with open(decisions_file, "w", encoding="utf-8") as f:
f.write("""# 🧠 Décisions Architecturales
## Structure du projet
- **aidd_docs/**: Documentation AIDD (plans, reviews, memory, changelog)
- **scripts/**: Scripts Python (scraping, training, conversion)
- **data/**: Données (raw, clean, final)
- **logs/**: Logs d'exécution
- **config/**: Configuration (Axolotl, scraping, etc.)
## Technologies choisies
- **Scraping**: Python, requests, BeautifulSoup4
- **Training**: Axolotl, PyTorch, LoRA/QLoRA
- **API**: Together.ai, Fireworks.ai, Hugging Face
- **Versioning**: Git, GitHub CLI
- **Workflow**: AIDD (tasks, challenge, plans, learn)
## Convention de code
- **Naming**: snake_case pour Python, kebab-case pour fichiers
- **Documentation**: Docstrings, commentaires explicatifs
- **Testing**: Tests unitaires avant implémentation (TDD)
- **Git**: Branches dédiées, PRs obligatoires, merge protégé
## Sécurité
- **Tokens**: `.env` (non versionné)
- **API Keys**: Variables d'environnement Railway
- **GitHub**: Fine-grained tokens avec permissions minimales
""")
print("✅ DECISIONS.md créé")
# 2. LESSONS.md - Lessons learned global
lessons_file = os.path.join(memory_dir, "LESSONS.md")
if not os.path.exists(lessons_file):
with open(lessons_file, "w", encoding="utf-8") as f:
f.write("""# 📚 Lessons Learned - Projet Suddenly AI Hub
## 📝 Historique des apprentissages
### Session 1 - Exploration jdRoll
- **Succès**: Script de scraping fonctionnel
- **Échec**: Regex complexes non supportées
- **Leçon**: Utiliser des regex simples et testées
### Session 2 - Scraping 20 campagnes
- **Succès**: Structure de données JSON
- **Échec**: Pas de logs générés
- **Leçon**: Toujours ajouter `try/except` partout
### Phase 3 - Fine-tuning
- **Succès**: Scripts prêts
- **Échec**: Données non disponibles
- **Leçon**: Attendre données complètes avant de commencer
---
## 📋 Méthodologie AIDD
### Planning
- **Writing-plans**: Documentation structurée avant implémentation
- **Challenge-plan**: Validation systématique (9+/10 requis)
- **TDD**: Tests avant implémentation
- **Learn**: Documentation immédiate après chaque phase
### Workflow Git
- **Branches**: Une branche par phase/feature
- **PRs**: Obligatoires pour merge
- **Commits**: Mesgés conventionnels
- **Merge**: Fast-forward uniquement
---
## 💡 Bonnes pratiques
1. **Documentation**: Écrire avant de coder
2. **Validation**: Challenges systématiques
3. **Testing**: Tests unitaires obligatoires
4. **Security**: Tokens dans variables d'environnement
5. **Git**: Branches protégées, PRs reviewées
---
**Dernière mise à jour**: 2026-05-13
**Auteur**: RebelliousSmile
""")
print("✅ LESSONS.md créé")
# 3. PROJECT_INFO.json - Informations projet
info_file = os.path.join(memory_dir, "PROJECT_INFO.json")
if not os.path.exists(info_file):
project_info = {
"project_name": "Suddenly AI Hub",
"description": "Fine-tuning LLM pour JDR français",
"version": "1.0.0",
"start_date": "2026-05-13",
"author": "RebelliousSmile",
"license": "MIT",
"workflow": "AIDD",
"phases": {
"session1": {"status": "completed", "description": "Exploration jdRoll"},
"session2": {"status": "pending", "description": "Scraping 20 campagnes"},
"phase3": {"status": "planned", "description": "Fine-tuning Qwen2.5-7B"},
"phase4": {"status": "planned", "description": "Amélioration continue"},
"phase5": {"status": "planned", "description": "Scaling 100+ campagnes"},
"phase6": {"status": "planned", "description": "Production & Haute disponibilité"},
"phase7": {"status": "planned", "description": "Communauté & Open source"}
},
"tech_stack": {
"scraping": ["Python", "requests", "beautifulsoup4"],
"training": ["Axolotl", "PyTorch", "LoRA", "QLoRA"],
"inference": ["Together.ai", "Fireworks.ai", "vLLM"],
"storage": ["Hugging Face", "GitHub"],
"workflow": ["AIDD", "GitHub CLI", "Git"]
},
"api_keys": {
"together_ai": "configured",
"fireworks_ai": "configured",
"github": "configured",
"hugging_face": "configured"
},
"metrics": {
"total_scripts": 13,
"total_plans": 7,
"total_reviews": 7,
"average_review_score": 9.5
}
}
with open(info_file, "w", encoding="utf-8") as f:
json.dump(project_info, f, indent=2, ensure_ascii=False)
print("✅ PROJECT_INFO.json créé")
# 4. WORKFLOW.md - Guide workflow
workflow_file = os.path.join(PROJECT_ROOT, "aidd_docs", "WORKFLOW.md")
if not os.path.exists(workflow_file):
with open(workflow_file, "w", encoding="utf-8") as f:
f.write("""# 🔄 Workflow AIDD - Suddenly AI Hub
## 📋 Structure
```
aidd_docs/
├── tasks/ # Plans AIDD (issues)
├── plans/ # Plans détaillés
├── reviews/ # Challenges et validations
├── memory/ # Mémoire interne (LESSONS, DECISIONS)
└── changelog/ # Changelog et versions
```
## 🎯 Processus
### 1. Planification (Issue → Tasks)
- Créer issue GitHub
- Écrire plan dans `aidd_docs/tasks/`
- Utiliser `writing-plans` skill
### 2. Validation (Challenge)
- Lancer `challenge-plan` skill
- Score ≥ 9/10 requis
- Documenter dans `aidd_docs/reviews/`
### 3. Implémentation (Git)
- Créer branche dédiée
- Implémenter selon plan
- Tests TDD obligatoires
### 4. Review (PR)
- Créer Pull Request
- Code review obligatoire
- Merge après approbation
### 5. Documentation (Learn)
- Documenter lessons learned
- Mettre à jour `LESSONS.md`
- Changelog à jour
## 🛠️ Skills AIDD
- `writing-plans`: Documentation structurée
- `challenge-plan`: Validation automatisée
- `test-driven-development`: Tests avant implémentation
- `learn`: Documentation des apprentissages
- `monitoring`: Suivi des métriques
## 📝 Templates
### Plan de tâche
```yaml
---
issue_id: #50
title: Phase X - Description
author: RebelliousSmile
created_at: YYYY-MM-DD
status: planned
---
```
### Rapport de challenge
```yaml
---
session: X
plan_ref: phaseX_*.md
score: X.X/10
status: approved/rejected
---
```
---
**Dernière mise à jour**: 2026-05-13
**Mainteneur**: RebelliousSmile
""")
print("✅ WORKFLOW.md mis à jour")
print("\n✅ Tous les fichiers de mémoire créés !")
def main():
"""Point d'entrée principal"""
print("="*80)
print("🚀 INIT AIDD - Initialisation de la mémoire interne")
print("="*80)
print(f"Project: {PROJECT_ROOT}")
print(f"AIDD dir: {AIDD_DIR}")
print("="*80)
# Créer les fichiers
create_memory_files()
# Afficher la structure
print("\n📁 Structure aidd_docs/:")
for root, dirs, files in os.walk(AIDD_DIR):
level = root.replace(AIDD_DIR, '').count(os.sep)
indent = ' ' * 2 * level
print(f"{indent}{os.path.basename(root)}/")
subindent = ' ' * 2 * (level + 1)
for file in files:
print(f"{subindent}{file}")
print("\n" + "="*80)
print("✅ INITIATION TERMINÉE")
print("="*80)
print("\nProchaines étapes:")
print("1. Créer une nouvelle issue GitHub")
print("2. Écrire un plan dans aidd_docs/tasks/")
print("3. Lancer challenge-plan")
print("4. Implémenter et créer PR")
print("\n🎯 Workflow AIDD est prêt !")
print("="*80)
if __name__ == "__main__":
main()