- Reorganize docs/ (flatten to architecture/ and implementation/) - Remove MonitoringModule from MVP (no app detection) - Add LanguageLearningModule to MVP - Create CLAUDE.md (concise project overview) - Add language learning to README and architecture - Update all examples to use SchedulerModule instead of MonitoringModule 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
499 lines
12 KiB
Markdown
499 lines
12 KiB
Markdown
# 🤖 Warfactory Complete Automation Guide
|
|
|
|
Ce guide décrit le système d'automation complet de Warfactory, conçu pour automatiser **complètement** le workflow de développement multi-engines avec Claude Code.
|
|
|
|
## 🎯 Vue d'ensemble de l'automation
|
|
|
|
Le système combine **12 couches d'automation** :
|
|
|
|
1. **🔧 Dependency Management** - FetchContent automatique
|
|
2. **🧪 Testing per Engine** - CTest intégré
|
|
3. **📚 Documentation Auto** - Doxygen pour tous les engines
|
|
4. **🔗 Export/Import System** - Engines peuvent s'importer mutuellement
|
|
5. **⚙️ Multiple Build Configs** - Debug/Release/Testing/Profiling
|
|
6. **⚡ Precompiled Headers** - Compilation accélérée
|
|
7. **📦 Packaging Auto** - DEB/RPM/NSIS/Bundle
|
|
8. **🛡️ Advanced Defenses** - Fuzzing, formal verification, etc.
|
|
9. **🤖 Claude Code Targets** - Workflow spécialisé pour Claude
|
|
10. **📊 Performance Monitoring** - Benchmarks automatiques
|
|
11. **🔍 Static Analysis** - Validation de code continue
|
|
12. **🚀 CI/CD Simulation** - Pipeline complet local
|
|
|
|
## 🚀 Installation complète
|
|
|
|
```bash
|
|
# 1. Setup des outils avancés
|
|
./scripts/setup_advanced_tools.sh
|
|
|
|
# 2. Application automation complète
|
|
./scripts/apply_full_automation.sh
|
|
|
|
# 3. Build avec automation complète
|
|
mkdir build && cd build
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ADVANCED_TOOLS=ON -DENABLE_BENCHMARKING=ON ..
|
|
|
|
# 4. Workflow complet Claude Code
|
|
make claude-workflow
|
|
```
|
|
|
|
## ⚙️ Configurations de build disponibles
|
|
|
|
### 🐛 **Debug Mode** (Développement)
|
|
```bash
|
|
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
|
# → Tous les sanitizers, assertions, debug symbols
|
|
# → Optimisation: -O0 -g
|
|
# → Parfait pour développement avec Claude Code
|
|
```
|
|
|
|
### 🚀 **Release Mode** (Production)
|
|
```bash
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
# → Optimisation maximale, pas de debug
|
|
# → Optimisation: -O3 -DNDEBUG
|
|
# → Parfait pour déploiement
|
|
```
|
|
|
|
### 🧪 **Testing Mode** (CI/CD)
|
|
```bash
|
|
cmake -DCMAKE_BUILD_TYPE=Testing ..
|
|
# → Coverage activé, optimisation minimale
|
|
# → Optimisation: -O0 -g --coverage
|
|
# → Parfait pour mesurer la couverture de test
|
|
```
|
|
|
|
### 📊 **Profiling Mode** (Performance)
|
|
```bash
|
|
cmake -DCMAKE_BUILD_TYPE=Profiling ..
|
|
# → Profiling activé, optimisation modérée
|
|
# → Optimisation: -O2 -g -pg
|
|
# → Parfait pour analyser les performances
|
|
```
|
|
|
|
## 📦 Dependency Management automatique
|
|
|
|
### Librairies auto-installées par FetchContent :
|
|
|
|
- **Redis++** : Communication inter-engines
|
|
- **nlohmann/json** : Sérialisation uniforme
|
|
- **spdlog** : Logging unifié
|
|
- **Catch2** : Framework de test
|
|
- **Google Benchmark** : Mesure de performance
|
|
- **Microsoft GSL** : Guidelines Support Library
|
|
|
|
### Usage dans le code :
|
|
```cpp
|
|
#include <sw/redis++/redis++.h> // Communication
|
|
#include <nlohmann/json.hpp> // JSON
|
|
#include <spdlog/spdlog.h> // Logging
|
|
#include <catch2/catch_test_macros.hpp> // Tests
|
|
#include <benchmark/benchmark.h> // Benchmarks
|
|
#include <gsl/gsl> // Safety contracts
|
|
```
|
|
|
|
## 🧪 Testing automatique par engine
|
|
|
|
### Structure auto-générée :
|
|
```
|
|
engines/Economy-Engine/
|
|
├── tests/
|
|
│ └── test_economy-engine.cpp # Tests unitaires
|
|
├── benchmarks/
|
|
│ └── bench_economy-engine.cpp # Benchmarks performance
|
|
└── CMakeLists.txt # Configuration auto
|
|
```
|
|
|
|
### Commandes de test :
|
|
```bash
|
|
# Tests d'un engine spécifique
|
|
make economy-engine-tests
|
|
ctest -R economy-engine
|
|
|
|
# Tests de tous les engines
|
|
make test-all-engines
|
|
ctest --parallel 4
|
|
|
|
# Benchmarks de performance
|
|
make economy-engine-bench
|
|
make bench-all-engines
|
|
```
|
|
|
|
## 📚 Documentation automatique
|
|
|
|
### Génération auto avec Doxygen :
|
|
```bash
|
|
# Documentation d'un engine
|
|
make economy-engine_docs
|
|
|
|
# Documentation de tous les engines
|
|
make docs-all
|
|
|
|
# Visualiser
|
|
open build/docs/economy-engine/html/index.html
|
|
```
|
|
|
|
### Configuration automatique :
|
|
- **HTML + XML** générés
|
|
- **Source browser** activé
|
|
- **Code inline** inclus
|
|
- **Diagrammes** automatiques
|
|
|
|
## 🔗 Export/Import entre engines
|
|
|
|
### Usage automatique :
|
|
```cmake
|
|
# Dans Economy-Engine/CMakeLists.txt - automatique
|
|
warfactory_add_full_automation(economy-engine)
|
|
|
|
# Dans un autre engine qui dépend d'Economy
|
|
find_package(economy-engine REQUIRED)
|
|
target_link_libraries(war-engine PRIVATE Warfactory::economy-engine-lib)
|
|
```
|
|
|
|
### Installation des packages :
|
|
```bash
|
|
# Installer pour utilisation externe
|
|
make install
|
|
|
|
# Ou créer package
|
|
make package-all
|
|
```
|
|
|
|
## ⚡ Precompiled Headers automatiques
|
|
|
|
### Headers pré-compilés automatiquement :
|
|
- **STL containers** (vector, string, unordered_map...)
|
|
- **I/O streams** (iostream, fstream...)
|
|
- **Threading** (thread, future, atomic...)
|
|
- **Math** (cmath, algorithm...)
|
|
- **Warfactory contracts**
|
|
- **Third-party libs** (si disponibles)
|
|
|
|
### Fichier `pch.h` auto-généré dans chaque engine
|
|
|
|
## 🤖 Targets d'automation pour Claude Code
|
|
|
|
### Workflow de développement optimal :
|
|
```bash
|
|
# Workflow complet Claude Code (build + test + validate)
|
|
make claude-workflow
|
|
|
|
# Build rapide tous les engines
|
|
make build-all-fast
|
|
|
|
# Validation complète du code
|
|
make validate-all
|
|
|
|
# Simulation CI/CD complète
|
|
make ci-simulation
|
|
|
|
# Rebuild complet propre
|
|
make rebuild-all
|
|
```
|
|
|
|
### Static analysis automatique :
|
|
```bash
|
|
# Cppcheck sur tous les engines
|
|
make cppcheck-all
|
|
|
|
# clang-tidy sur tous les engines
|
|
make clang-tidy-all
|
|
|
|
# Validation combinée
|
|
make validate-all
|
|
```
|
|
|
|
## 📦 Packaging automatique multi-plateforme
|
|
|
|
### Formats supportés automatiquement :
|
|
|
|
**Linux :**
|
|
- **DEB** packages (Ubuntu/Debian)
|
|
- **RPM** packages (Fedora/CentOS)
|
|
- **TGZ/ZIP** archives
|
|
|
|
**Windows :**
|
|
- **NSIS** installer
|
|
- **WIX** installer (MSI)
|
|
- **ZIP** archives
|
|
|
|
**macOS :**
|
|
- **Bundle** (.app)
|
|
- **DragNDrop** (.dmg)
|
|
- **TGZ** archives
|
|
|
|
### Commandes de packaging :
|
|
```bash
|
|
# Package par défaut
|
|
make package
|
|
|
|
# Tous les formats
|
|
make package-all
|
|
|
|
# Source seulement
|
|
make package-source
|
|
|
|
# Binaires seulement
|
|
make package-binary
|
|
```
|
|
|
|
### Installation sélective par composants :
|
|
- **engines** : Executables de jeu
|
|
- **libraries** : Libs de développement
|
|
- **headers** : Headers C++
|
|
- **documentation** : Docs générées
|
|
|
|
## 🔧 Options CMake complètes
|
|
|
|
### Options principales :
|
|
```bash
|
|
-DCMAKE_BUILD_TYPE=Debug|Release|Testing|Profiling
|
|
-DENABLE_ADVANCED_TOOLS=ON # Fuzzing, verification, etc.
|
|
-DENABLE_STATIC_ANALYSIS=ON # Clang Static Analyzer
|
|
-DENABLE_FUZZING=ON # Fuzzing automatique
|
|
-DENABLE_BENCHMARKING=ON # Google Benchmark
|
|
```
|
|
|
|
### Build examples complets :
|
|
```bash
|
|
# Développement Claude Code
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ADVANCED_TOOLS=ON ..
|
|
|
|
# Testing avec coverage
|
|
cmake -DCMAKE_BUILD_TYPE=Testing -DENABLE_BENCHMARKING=ON ..
|
|
|
|
# Production optimisée
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
|
|
# Profiling performance
|
|
cmake -DCMAKE_BUILD_TYPE=Profiling -DENABLE_BENCHMARKING=ON ..
|
|
```
|
|
|
|
## 🎯 Targets disponibles par engine (exemple: economy-engine)
|
|
|
|
### Build & Core :
|
|
```bash
|
|
make economy-engine # Build basic
|
|
make economy-engine-lib # Build library
|
|
make economy-engine-tests # Build tests
|
|
make economy-engine-bench # Build benchmarks
|
|
```
|
|
|
|
### Documentation :
|
|
```bash
|
|
make economy-engine_docs # Generate docs
|
|
```
|
|
|
|
### Testing :
|
|
```bash
|
|
make economy-engine_unit_tests # Unit tests
|
|
make economy-engine_integration_tests # Integration tests
|
|
make economy-engine_benchmarks # Performance tests
|
|
```
|
|
|
|
### Advanced Testing :
|
|
```bash
|
|
make economy-engine_fuzz_all # All fuzzing
|
|
make economy-engine_cbmc # Formal verification
|
|
make economy-engine_helgrind # Race detection
|
|
make economy-engine_coverage_run # Coverage report
|
|
```
|
|
|
|
### Static Analysis :
|
|
```bash
|
|
make economy-engine_cppcheck # Cppcheck
|
|
make economy-engine_pvs # PVS-Studio
|
|
```
|
|
|
|
### ABI :
|
|
```bash
|
|
make economy-engine_abi_dump # Create ABI dump
|
|
make economy-engine_abi_check # Check compatibility
|
|
```
|
|
|
|
## 🎮 Targets globaux (tous les engines)
|
|
|
|
### Build :
|
|
```bash
|
|
make all-engines # Build all
|
|
make build-all-fast # Quick build
|
|
make rebuild-all # Clean + rebuild
|
|
```
|
|
|
|
### Testing :
|
|
```bash
|
|
make test-all-engines # All tests
|
|
make bench-all-engines # All benchmarks
|
|
make coverage-all-engines # All coverage
|
|
```
|
|
|
|
### Advanced :
|
|
```bash
|
|
make fuzz-all-engines # Fuzzing massif
|
|
make analyze-all-engines # Static analysis
|
|
make concurrency-all-engines # Concurrency analysis
|
|
make test-everything # TOUT en parallèle
|
|
```
|
|
|
|
### Documentation :
|
|
```bash
|
|
make docs-all # All documentation
|
|
```
|
|
|
|
### Validation :
|
|
```bash
|
|
make validate-all # Complete validation
|
|
make cppcheck-all # Cppcheck on all
|
|
make clang-tidy-all # clang-tidy on all
|
|
```
|
|
|
|
### Claude Code Workflow :
|
|
```bash
|
|
make claude-workflow # Dev workflow
|
|
make ci-simulation # CI/CD simulation
|
|
```
|
|
|
|
### Packaging :
|
|
```bash
|
|
make package # Default package
|
|
make package-all # All formats
|
|
make package-source # Source distribution
|
|
make package-binary # Binary distribution
|
|
```
|
|
|
|
## 🔄 Workflow types recommandés
|
|
|
|
### 👨💻 **Développement quotidien avec Claude**
|
|
```bash
|
|
mkdir build && cd build
|
|
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
|
make claude-workflow
|
|
# → Build + test + validation en une commande
|
|
```
|
|
|
|
### 🧪 **Testing & QA**
|
|
```bash
|
|
mkdir build-testing && cd build-testing
|
|
cmake -DCMAKE_BUILD_TYPE=Testing -DENABLE_BENCHMARKING=ON ..
|
|
make ci-simulation
|
|
# → Tests complets + coverage + benchmarks
|
|
```
|
|
|
|
### 🚀 **Préparation release**
|
|
```bash
|
|
mkdir build-release && cd build-release
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
make all-engines
|
|
make package-all
|
|
# → Build optimisé + packaging multi-plateforme
|
|
```
|
|
|
|
### 🔬 **Debug performance**
|
|
```bash
|
|
mkdir build-profiling && cd build-profiling
|
|
cmake -DCMAKE_BUILD_TYPE=Profiling -DENABLE_BENCHMARKING=ON ..
|
|
make bench-all-engines
|
|
# → Profiling + benchmarks détaillés
|
|
```
|
|
|
|
### 🛡️ **Security audit**
|
|
```bash
|
|
mkdir build-security && cd build-security
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ADVANCED_TOOLS=ON ..
|
|
make test-everything
|
|
# → Fuzzing + static analysis + formal verification
|
|
```
|
|
|
|
## 📊 Monitoring automatique
|
|
|
|
### Métriques collectées automatiquement :
|
|
- **Build times** par engine
|
|
- **Test coverage** par engine
|
|
- **Performance benchmarks**
|
|
- **Memory usage** par engine
|
|
- **Static analysis** issues
|
|
- **ABI compatibility** changes
|
|
|
|
### Visualisation :
|
|
```bash
|
|
# Coverage reports HTML
|
|
open build/economy-engine_coverage_report/index.html
|
|
|
|
# Documentation générée
|
|
open build/docs/economy-engine/html/index.html
|
|
|
|
# ABI compatibility reports
|
|
open economy-engine_abi_report.html
|
|
```
|
|
|
|
## 🎯 Integration CI/CD
|
|
|
|
### GitHub Actions exemple :
|
|
```yaml
|
|
name: Warfactory CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
full-automation:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Advanced Tools
|
|
run: ./scripts/setup_advanced_tools.sh
|
|
|
|
- name: Apply Full Automation
|
|
run: ./scripts/apply_full_automation.sh
|
|
|
|
- name: Configure
|
|
run: |
|
|
mkdir build && cd build
|
|
cmake -DCMAKE_BUILD_TYPE=Testing -DENABLE_ADVANCED_TOOLS=ON ..
|
|
|
|
- name: Run Complete CI Simulation
|
|
run: cd build && make ci-simulation
|
|
|
|
- name: Upload Coverage
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
files: build/coverage.xml
|
|
```
|
|
|
|
## 🚨 Troubleshooting
|
|
|
|
### Si la configuration échoue :
|
|
```bash
|
|
# 1. Vérifier les dépendances
|
|
./scripts/setup_advanced_tools.sh
|
|
|
|
# 2. Build minimal
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
|
|
# 3. Désactiver automation temporairement
|
|
cmake -DENABLE_ADVANCED_TOOLS=OFF ..
|
|
```
|
|
|
|
### Si les tests échouent :
|
|
```bash
|
|
# Tests détaillés avec output
|
|
ctest --output-on-failure --verbose
|
|
|
|
# Tests d'un engine spécifique
|
|
ctest -R economy-engine -V
|
|
```
|
|
|
|
### Si le packaging échoue :
|
|
```bash
|
|
# Vérifier installation
|
|
make install DESTDIR=/tmp/test-install
|
|
|
|
# Package basique seulement
|
|
make package-binary
|
|
```
|
|
|
|
---
|
|
|
|
**💡 Philosophie Warfactory Automation** : *"Automatiser complètement le workflow pour que Claude Code puisse se concentrer sur la logique métier, pas sur l'infrastructure"*
|
|
|
|
**🎯 Résultat** : Un seul `make claude-workflow` fait **tout** automatiquement ! |