Compare commits
No commits in common. "docker-support" and "main" have entirely different histories.
docker-sup
...
main
@ -1,11 +0,0 @@
|
|||||||
# Ignorer les sorties volumineuses ou non pertinentes pour le contexte IA
|
|
||||||
archive/**
|
|
||||||
tests/logs/**
|
|
||||||
tests/reports/**
|
|
||||||
node_modules/**
|
|
||||||
dist/**
|
|
||||||
build/**
|
|
||||||
.tmp/**
|
|
||||||
.cache/**#
|
|
||||||
.env
|
|
||||||
.env.*
|
|
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Gouvernance du template 4NK
|
|
||||||
|
|
||||||
[portée]
|
|
||||||
Assurer que chaque projet adapte intelligemment le template et que les améliorations génériques reviennent dans `4NK_template`.
|
|
||||||
|
|
||||||
[directives]
|
|
||||||
- Conserver `security-audit` et `release-guard` dans tous projets.
|
|
||||||
- Adapter la CI, les docs et `AGENTS.md` au contexte local.
|
|
||||||
- En cas d'amélioration générique : ouvrir une issue "Template Feedback", prototyper, valider CI, mettre à jour `CHANGELOG.md`/`TEMPLATE_VERSION`.
|
|
||||||
|
|
||||||
[validation]
|
|
||||||
- Refuser un push/tag si l'adaptation a retiré les vérifications minimales (sécurité, tests, build, version/changelog/tag).
|
|
||||||
- Exiger une documentation claire dans `docs/TEMPLATE_ADAPTATION.md` et `docs/TEMPLATE_FEEDBACK.md`.
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
|
|
||||||
quand tu fais une commande ou un requète complexe, explique là avant de la lancer
|
|
@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
description:
|
|
||||||
globs:
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Lint
|
|
||||||
|
|
||||||
respecter strictement les règles de lint du markdown
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"MD013": {
|
|
||||||
"line_length": 200,
|
|
||||||
"code_blocks": false,
|
|
||||||
"tables": false,
|
|
||||||
"headings": false
|
|
||||||
},
|
|
||||||
"MD007": {
|
|
||||||
"indent": 2
|
|
||||||
},
|
|
||||||
"MD024": {
|
|
||||||
"siblings_only": true
|
|
||||||
}
|
|
||||||
}
|
|
257
SECURITY.md
257
SECURITY.md
@ -1,257 +0,0 @@
|
|||||||
# Politique de Sécurité - 4NK Node
|
|
||||||
|
|
||||||
## 🛡️ Signalement de Vulnérabilités
|
|
||||||
|
|
||||||
Nous prenons la sécurité très au sérieux. Si vous découvrez une vulnérabilité de sécurité, nous vous demandons de la signaler de manière responsable.
|
|
||||||
|
|
||||||
### Comment Signaler une Vulnérabilité
|
|
||||||
|
|
||||||
**NE PAS** créer d'issue publique pour les vulnérabilités de sécurité.
|
|
||||||
|
|
||||||
#### À la place
|
|
||||||
|
|
||||||
1. Envoyez un email à [security@4nkweb.com](mailto:security@4nkweb.com)
|
|
||||||
2. Incluez "SECURITY VULNERABILITY" dans l'objet
|
|
||||||
3. Décrivez la vulnérabilité de manière détaillée
|
|
||||||
4. Incluez les étapes pour reproduire le problème
|
|
||||||
5. Proposez une solution si possible
|
|
||||||
|
|
||||||
### Ce que nous attendons
|
|
||||||
|
|
||||||
- **Confidentialité** : Ne divulguez pas la vulnérabilité publiquement
|
|
||||||
- **Détails** : Fournissez suffisamment d'informations pour reproduire le problème
|
|
||||||
- **Patience** : Nous examinerons et répondrons dans les 48h
|
|
||||||
- **Coopération** : Nous pouvons avoir besoin de clarifications
|
|
||||||
|
|
||||||
### Ce que vous pouvez attendre
|
|
||||||
|
|
||||||
- **Réponse rapide** : Accusé de réception dans les 48h
|
|
||||||
- **Évaluation** : Analyse de la vulnérabilité
|
|
||||||
- **Mise à jour** : Statut de la correction
|
|
||||||
- **Reconnaissance** : Mention dans les remerciements (si souhaité)
|
|
||||||
|
|
||||||
## 🔒 Bonnes Pratiques de Sécurité
|
|
||||||
|
|
||||||
### Pour les Contributeurs
|
|
||||||
|
|
||||||
#### Code
|
|
||||||
|
|
||||||
- Validez toutes les entrées utilisateur
|
|
||||||
- Utilisez des requêtes préparées pour les bases de données
|
|
||||||
- Évitez les injections de code
|
|
||||||
- Implémentez l'authentification appropriée
|
|
||||||
- Utilisez HTTPS pour toutes les communications
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
|
|
||||||
- Ne committez jamais de secrets
|
|
||||||
- Utilisez des variables d'environnement pour les données sensibles
|
|
||||||
- Vérifiez les permissions des fichiers
|
|
||||||
- Maintenez les dépendances à jour
|
|
||||||
|
|
||||||
#### Tests
|
|
||||||
|
|
||||||
- Incluez des tests de sécurité
|
|
||||||
- Testez les cas limites
|
|
||||||
- Validez les entrées malveillantes
|
|
||||||
- Vérifiez les fuites de mémoire
|
|
||||||
|
|
||||||
### Pour les Utilisateurs
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
- Utilisez des sources officielles
|
|
||||||
- Vérifiez les checksums
|
|
||||||
- Maintenez le système à jour
|
|
||||||
- Utilisez un pare-feu
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
|
|
||||||
- Changez les mots de passe par défaut
|
|
||||||
- Utilisez des clés SSH fortes
|
|
||||||
- Limitez l'accès réseau
|
|
||||||
- Surveillez les logs
|
|
||||||
|
|
||||||
#### Opération
|
|
||||||
|
|
||||||
- Surveillez les connexions
|
|
||||||
- Sauvegardez régulièrement
|
|
||||||
- Testez les sauvegardes
|
|
||||||
- Documentez les incidents
|
|
||||||
|
|
||||||
## 🔍 Audit de Sécurité
|
|
||||||
|
|
||||||
### Composants Principaux
|
|
||||||
|
|
||||||
#### Bitcoin Core
|
|
||||||
|
|
||||||
- **RPC Interface** : Authentification requise
|
|
||||||
- **ZMQ** : Communication locale uniquement
|
|
||||||
- **P2P** : Validation des blocs
|
|
||||||
- **Wallet** : Chiffrement des clés
|
|
||||||
|
|
||||||
#### Blindbit
|
|
||||||
|
|
||||||
- **API HTTP** : Validation des entrées
|
|
||||||
- **Filtres** : Vérification des signatures
|
|
||||||
- **Cache** : Protection contre les attaques DoS
|
|
||||||
- **Logs** : Pas d'informations sensibles
|
|
||||||
|
|
||||||
#### SDK Relay
|
|
||||||
|
|
||||||
- **WebSocket** : Validation des messages
|
|
||||||
- **Synchronisation** : Authentification des pairs
|
|
||||||
- **Cache** : Protection contre les attaques
|
|
||||||
- **Configuration** : Validation des paramètres
|
|
||||||
|
|
||||||
#### Tor
|
|
||||||
|
|
||||||
- **Proxy** : Configuration sécurisée
|
|
||||||
- **Contrôle** : Accès restreint
|
|
||||||
- **Logs** : Anonymisation
|
|
||||||
- **Mise à jour** : Versions récentes
|
|
||||||
|
|
||||||
### Tests de Sécurité
|
|
||||||
|
|
||||||
#### Tests Automatisés
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Tests de sécurité
|
|
||||||
./tests/run_security_tests.sh
|
|
||||||
|
|
||||||
# Vérification des vulnérabilités
|
|
||||||
./tests/check_vulnerabilities.sh
|
|
||||||
|
|
||||||
# Audit des dépendances
|
|
||||||
./tests/audit_dependencies.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Tests Manuels
|
|
||||||
|
|
||||||
- Tests de pénétration
|
|
||||||
- Audit de code
|
|
||||||
- Tests de configuration
|
|
||||||
- Tests de performance sous charge
|
|
||||||
|
|
||||||
## 🚨 Réponse aux Incidents
|
|
||||||
|
|
||||||
### Procédure d'Urgence
|
|
||||||
|
|
||||||
1. **Détection** : Identifier l'incident
|
|
||||||
2. **Containment** : Limiter l'impact
|
|
||||||
3. **Éradication** : Supprimer la cause
|
|
||||||
4. **Récupération** : Restaurer les services
|
|
||||||
5. **Post-mortem** : Analyser et améliorer
|
|
||||||
|
|
||||||
### Communication
|
|
||||||
|
|
||||||
- **Interne** : Équipe de sécurité
|
|
||||||
- **Utilisateurs** : Notification appropriée
|
|
||||||
- **Communauté** : Disclosure responsable
|
|
||||||
- **Autorités** : Si nécessaire
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
- **Incident Report** : Détails de l'incident
|
|
||||||
- **Timeline** : Chronologie des événements
|
|
||||||
- **Actions** : Mesures prises
|
|
||||||
- **Lessons Learned** : Améliorations
|
|
||||||
|
|
||||||
## 📋 Checklist de Sécurité
|
|
||||||
|
|
||||||
### Avant le Déploiement
|
|
||||||
|
|
||||||
- [ ] Audit de code de sécurité
|
|
||||||
- [ ] Tests de vulnérabilités
|
|
||||||
- [ ] Vérification des dépendances
|
|
||||||
- [ ] Configuration sécurisée
|
|
||||||
- [ ] Tests de charge
|
|
||||||
|
|
||||||
### Pendant l'Opération
|
|
||||||
|
|
||||||
- [ ] Monitoring de sécurité
|
|
||||||
- [ ] Surveillance des logs
|
|
||||||
- [ ] Mise à jour des composants
|
|
||||||
- [ ] Sauvegarde des données
|
|
||||||
- [ ] Tests de récupération
|
|
||||||
|
|
||||||
### Après un Incident
|
|
||||||
|
|
||||||
- [ ] Analyse post-mortem
|
|
||||||
- [ ] Mise à jour des procédures
|
|
||||||
- [ ] Formation de l'équipe
|
|
||||||
- [ ] Amélioration des outils
|
|
||||||
- [ ] Communication à la communauté
|
|
||||||
|
|
||||||
## 🔧 Outils de Sécurité
|
|
||||||
|
|
||||||
### Monitoring
|
|
||||||
|
|
||||||
- **Logs** : Centralisation et analyse
|
|
||||||
- **Métriques** : Surveillance en temps réel
|
|
||||||
- **Alertes** : Notification automatique
|
|
||||||
- **Tableaux de bord** : Vue d'ensemble
|
|
||||||
|
|
||||||
### Tests
|
|
||||||
|
|
||||||
- **SAST** : Analyse statique
|
|
||||||
- **DAST** : Tests dynamiques
|
|
||||||
- **IAST** : Tests interactifs
|
|
||||||
- **Fuzzing** : Tests de robustesse
|
|
||||||
|
|
||||||
### Protection
|
|
||||||
|
|
||||||
- **WAF** : Pare-feu applicatif
|
|
||||||
- **IDS/IPS** : Détection d'intrusion
|
|
||||||
- **Antivirus** : Protection des endpoints
|
|
||||||
- **Chiffrement** : Protection des données
|
|
||||||
|
|
||||||
## 📚 Ressources
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
- [Guide de Sécurité Bitcoin](https://bitcoin.org/en/security)
|
|
||||||
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
|
||||||
- [CWE/SANS Top 25](https://cwe.mitre.org/top25/)
|
|
||||||
- [NIST Cybersecurity Framework](https://www.nist.gov/cyberframework)
|
|
||||||
|
|
||||||
### Outils
|
|
||||||
|
|
||||||
- [Bandit](https://bandit.readthedocs.io/) - Analyse Python
|
|
||||||
- [Clang Static Analyzer](https://clang-analyzer.llvm.org/) - Analyse C/C++
|
|
||||||
- [SonarQube](https://www.sonarqube.org/) - Qualité du code
|
|
||||||
- [OpenVAS](https://www.openvas.org/) - Scan de vulnérabilités
|
|
||||||
|
|
||||||
### Formation
|
|
||||||
|
|
||||||
- Cours de sécurité applicative
|
|
||||||
- Formation aux tests de pénétration
|
|
||||||
- Certification en cybersécurité
|
|
||||||
- Participation à des CTF
|
|
||||||
|
|
||||||
## 🤝 Collaboration
|
|
||||||
|
|
||||||
### Bug Bounty
|
|
||||||
|
|
||||||
- Programme de récompenses pour les vulnérabilités
|
|
||||||
- Critères d'éligibilité
|
|
||||||
- Montants des récompenses
|
|
||||||
- Processus de validation
|
|
||||||
|
|
||||||
### Responsible Disclosure
|
|
||||||
|
|
||||||
- Timeline de divulgation
|
|
||||||
- Coordination avec les chercheurs
|
|
||||||
- Communication publique
|
|
||||||
- Remerciements
|
|
||||||
|
|
||||||
### Communauté
|
|
||||||
|
|
||||||
- Groupe de sécurité
|
|
||||||
- Discussions techniques
|
|
||||||
- Partage d'informations
|
|
||||||
- Collaboration avec d'autres projets
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**La sécurité est une responsabilité partagée. Merci de contribuer à maintenir 4NK Node sécurisé !** 🔒
|
|
@ -1 +0,0 @@
|
|||||||
v2025.08.1
|
|
@ -1,6 +0,0 @@
|
|||||||
# Intégration des agents 4NK_template
|
|
||||||
|
|
||||||
- Hooks centralisés: pre-commit / pre-push via ../4NK_template (Docker).
|
|
||||||
- Pré-requis: ~/.4nk_template/.env monté en RO dans le conteneur.
|
|
||||||
- Exécution: scripts/local/precommit.sh ou git push (déclenche pre-push).
|
|
||||||
- Rapports: tests/reports/agents/.
|
|
@ -1,2 +0,0 @@
|
|||||||
# Déploiement
|
|
||||||
|
|
187
docs/INDEX.md
187
docs/INDEX.md
@ -1,183 +1,6 @@
|
|||||||
# 📚 Index de Documentation - 4NK_wallet
|
# Documentation - 4NK_wallet
|
||||||
|
|
||||||
Index complet de la documentation du wallet 4NK pour les Silent Payments.
|
- Architecture: `ARCHITECTURE.md`
|
||||||
|
- Intégration iframe/WebView: `INTEGRATION.md`
|
||||||
## 🚀 Vue d'Ensemble
|
- Tests: `TESTING.md`
|
||||||
|
- Notes de version: `../CHANGELOG.md`
|
||||||
4NK_wallet est un wallet moderne et sécurisé pour les Silent Payments Bitcoin. Il fournit une interface utilisateur intuitive pour gérer les paiements silencieux avec une sécurité de niveau bancaire.
|
|
||||||
|
|
||||||
## 📖 Guides Principaux
|
|
||||||
|
|
||||||
### 🚀 [Guide d'Installation](INSTALLATION.md)
|
|
||||||
Guide complet pour installer et configurer 4NK_wallet.
|
|
||||||
- **Prérequis système et logiciels**
|
|
||||||
- **Installation de l'application**
|
|
||||||
- **Configuration initiale**
|
|
||||||
- **Création du premier wallet**
|
|
||||||
- **Tests post-installation**
|
|
||||||
|
|
||||||
### 📖 [Guide d'Utilisation](USAGE.md)
|
|
||||||
Guide complet pour utiliser 4NK_wallet au quotidien.
|
|
||||||
- **Création et gestion des wallets**
|
|
||||||
- **Envoi et réception de paiements silencieux**
|
|
||||||
- **Gestion des adresses**
|
|
||||||
- **Sécurité et sauvegarde**
|
|
||||||
- **Tests et validation**
|
|
||||||
|
|
||||||
### ⚙️ [Guide de Configuration](CONFIGURATION.md)
|
|
||||||
Guide complet pour configurer le wallet selon vos besoins.
|
|
||||||
- **Configuration de sécurité**
|
|
||||||
- **Configuration réseau**
|
|
||||||
- **Configuration des notifications**
|
|
||||||
- **Configuration de sauvegarde**
|
|
||||||
- **Configuration avancée**
|
|
||||||
|
|
||||||
## 🔧 Guides Techniques
|
|
||||||
|
|
||||||
### 🏗️ [Architecture Technique](ARCHITECTURE.md)
|
|
||||||
Documentation technique détaillée de l'architecture.
|
|
||||||
- **Architecture générale du wallet**
|
|
||||||
- **Composants principaux**
|
|
||||||
- **Gestion des clés cryptographiques**
|
|
||||||
- **Intégration avec les Silent Payments**
|
|
||||||
- **Sécurité et isolation**
|
|
||||||
- **Performance et optimisations**
|
|
||||||
|
|
||||||
### 📡 [API Reference](API.md)
|
|
||||||
Documentation des APIs disponibles.
|
|
||||||
- **API de gestion des wallets**
|
|
||||||
- **API de transactions**
|
|
||||||
- **API de sécurité**
|
|
||||||
- **API d'intégration**
|
|
||||||
|
|
||||||
### 🔒 [Sécurité](SECURITY.md)
|
|
||||||
Guide de sécurité et bonnes pratiques.
|
|
||||||
- **Authentification et autorisation**
|
|
||||||
- **Chiffrement des données**
|
|
||||||
- **Gestion sécurisée des clés**
|
|
||||||
- **Audit et monitoring de sécurité**
|
|
||||||
- **Bonnes pratiques**
|
|
||||||
|
|
||||||
## 🧪 Guides de Test
|
|
||||||
|
|
||||||
### 🧪 [Guide des Tests](TESTING.md)
|
|
||||||
Guide complet pour les tests du wallet.
|
|
||||||
- **Tests unitaires**
|
|
||||||
- **Tests d'intégration**
|
|
||||||
- **Tests de sécurité**
|
|
||||||
- **Tests de performance**
|
|
||||||
- **Tests d'interface utilisateur**
|
|
||||||
|
|
||||||
### 🔍 [Audit de Sécurité](SECURITY_AUDIT.md)
|
|
||||||
Audit de sécurité détaillé.
|
|
||||||
- **Vulnérabilités connues**
|
|
||||||
- **Tests de pénétration**
|
|
||||||
- **Audit de code**
|
|
||||||
- **Recommandations de sécurité**
|
|
||||||
- **Plan de remédiation**
|
|
||||||
|
|
||||||
## 🔧 Guides de Développement
|
|
||||||
|
|
||||||
### 🔧 [Guide de Développement](DEVELOPMENT.md)
|
|
||||||
Guide complet pour le développement.
|
|
||||||
- **Environnement de développement**
|
|
||||||
- **Workflow de développement**
|
|
||||||
- **Standards de code**
|
|
||||||
- **Debugging et profiling**
|
|
||||||
- **Optimisation des performances**
|
|
||||||
|
|
||||||
## 🌐 Guides d'Intégration
|
|
||||||
|
|
||||||
### 🔗 [Intégration](INTEGRATION.md)
|
|
||||||
Guide d'intégration avec d'autres systèmes.
|
|
||||||
- **Intégration iframe/WebView**
|
|
||||||
- **API d'intégration**
|
|
||||||
- **Webhooks et notifications**
|
|
||||||
- **Intégration avec 4NK_node**
|
|
||||||
|
|
||||||
## 📊 Déploiement
|
|
||||||
|
|
||||||
### 🚀 [Guide de Déploiement](DEPLOYMENT.md)
|
|
||||||
Guide complet pour déployer 4NK_wallet.
|
|
||||||
- **Configuration de production**
|
|
||||||
- **Déploiement Docker**
|
|
||||||
- **Intégration CI/CD**
|
|
||||||
- **Monitoring et observabilité**
|
|
||||||
|
|
||||||
## 🎯 Navigation Rapide
|
|
||||||
|
|
||||||
### 🚀 Démarrage Rapide
|
|
||||||
1. [Installation](INSTALLATION.md) - Installer 4NK_wallet
|
|
||||||
2. [Configuration](CONFIGURATION.md) - Configurer le wallet
|
|
||||||
3. [Utilisation](USAGE.md) - Utiliser le wallet
|
|
||||||
|
|
||||||
### 🔧 Développement
|
|
||||||
1. [Architecture](ARCHITECTURE.md) - Comprendre l'architecture
|
|
||||||
2. [API](API.md) - Consulter les APIs
|
|
||||||
3. [Tests](TESTING.md) - Exécuter les tests
|
|
||||||
|
|
||||||
### 📚 Documentation
|
|
||||||
1. [Index](INDEX.md) - Cet index
|
|
||||||
2. [Intégration](INTEGRATION.md) - Guide d'intégration
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🧪 Tests et Validation
|
|
||||||
|
|
||||||
### Tests Automatisés
|
|
||||||
```bash
|
|
||||||
# Tests unitaires
|
|
||||||
npm test
|
|
||||||
|
|
||||||
# Tests d'intégration
|
|
||||||
npm run test:integration
|
|
||||||
|
|
||||||
# Tests de sécurité
|
|
||||||
npm run test:security
|
|
||||||
|
|
||||||
# Tests de performance
|
|
||||||
npm run test:performance
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🚀 Développement
|
|
||||||
|
|
||||||
### Commandes Essentielles
|
|
||||||
```bash
|
|
||||||
# Installation des dépendances
|
|
||||||
npm install
|
|
||||||
|
|
||||||
# Build de développement
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# Build de production
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
npm test
|
|
||||||
|
|
||||||
# Linting
|
|
||||||
npm run lint
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📊 Métriques
|
|
||||||
|
|
||||||
### Fonctionnalités
|
|
||||||
- **Gestion des wallets** : ✅ Complète
|
|
||||||
- **Paiements silencieux** : ✅ Supportés
|
|
||||||
- **Sécurité** : ✅ Niveau bancaire
|
|
||||||
- **Interface utilisateur** : ✅ Moderne
|
|
||||||
- **Tests** : ✅ Automatisés
|
|
||||||
|
|
||||||
### Sécurité
|
|
||||||
- **Chiffrement** : ✅ AES-256
|
|
||||||
- **Authentification** : ✅ Multi-facteurs
|
|
||||||
- **Sauvegarde** : ✅ Chiffrée
|
|
||||||
- **Audit** : ✅ Automatisé
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**📚 Documentation complète pour 4NK_wallet - Wallet sécurisé pour Silent Payments** 🚀
|
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Utilitaire générique pour appeler l'API OpenAI Chat Completions.
|
|
||||||
# Prérequis: variable d'environnement OPENAI_API_KEY et curl.
|
|
||||||
|
|
||||||
# Chargement env utilisateur (~/.4nk_template/.env) pour exécutions locales/CI docke
|
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
|
|
||||||
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
|
|
||||||
set -a
|
|
||||||
. "${HOME}/.4nk_template/.env"
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
for bin in curl jq; do
|
|
||||||
if ! command -v "$bin" >/dev/null 2>&1; then
|
|
||||||
echo "$bin manquant. Installez $bin." >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
MODEL="${OPENAI_MODEL}"
|
|
||||||
API_BASE="${OPENAI_API_BASE:-https://api.openai.com/v1}"
|
|
||||||
TEMPERATURE="${OPENAI_TEMPERATURE:-0.2}"
|
|
||||||
|
|
||||||
read -r -d '' SYSTEM_PROMPT <<'SYS'
|
|
||||||
Tu es un agent de conformité pour le template 4NK. Réponds en français, sans exemples d'application. Produit des listes d'actions, des risques et des recommandations courtes. Respecte la typographie française.
|
|
||||||
SYS
|
|
||||||
|
|
||||||
PROMPT="${1:-}"
|
|
||||||
if [[ -z "${PROMPT}" ]]; then
|
|
||||||
echo "Usage: $0 'message utilisateur'" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "${OPENAI_API_KEY:-}" ]]; then
|
|
||||||
echo "OPENAI_API_KEY non défini; exécution sans IA (noop)." >&2
|
|
||||||
# No-op mode: renvoyer le prompt pour traçabilité
|
|
||||||
echo "[NO-AI] ${PROMPT}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
payload=$(jq -n \
|
|
||||||
--arg model "$MODEL" \
|
|
||||||
--arg system "$SYSTEM_PROMPT" \
|
|
||||||
--arg user "$PROMPT" \
|
|
||||||
--arg temperature "$TEMPERATURE" \
|
|
||||||
'{model: $model, temperature: ($temperature|tonumber? // 0.2), messages: [ {role:"system", content:$system}, {role:"user", content:$user} ] }')
|
|
||||||
|
|
||||||
curl -sS -X POST "${API_BASE}/chat/completions" \
|
|
||||||
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$payload" | jq -r '.choices[0].message.content // ""'
|
|
@ -1,19 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Portée des contrôles: all (défaut) ou changed
|
|
||||||
export SCOPE="${SCOPE:-all}"
|
|
||||||
|
|
||||||
list_changed_paths() {
|
|
||||||
# Renvoie la liste des chemins modifiés (HEAD~1..HEAD), ou vide si non dispo
|
|
||||||
git diff --name-only HEAD~1..HEAD 2>/dev/null || true
|
|
||||||
}
|
|
||||||
|
|
||||||
is_path_changed() {
|
|
||||||
local path="$1"
|
|
||||||
if [[ "$SCOPE" != "changed" ]]; then return 0; fi
|
|
||||||
local changed
|
|
||||||
changed=$(list_changed_paths)
|
|
||||||
if [[ -z "$changed" ]]; then return 0; fi
|
|
||||||
grep -q "^${path%/}\(/\|$\)" <<<"$changed" && return 0 || return 1
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/compilation_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Compilation" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(.gitea/workflows/ci.yml)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement compilation CI (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
if grep -q "cargo" .gitea/workflows/ci.yml 2>/dev/null; then
|
|
||||||
echo "- Étapes de build/format/clippy Rust détectées dans la CI." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Étapes de compilation non détectées dans la CI (à ajouter si nécessaire)." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Précise une cadence de compilation (avant refactor/push, après update deps) et les conditions de blocage si erreurs.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,31 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/dependances_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Dépendances" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
echo "- Vérifier régulièrement les dépendances (audit sécurité, mises à jour stables)." >> "$SUMMARY_FILE"
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(package.json package-lock.json pnpm-lock.yaml yarn.lock requirements.txt pyproject.toml Cargo.toml go.mod .gitea/workflows/ci.yml)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement dépendances/CI (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
if grep -q "security-audit" .gitea/workflows/ci.yml 2>/dev/null; then
|
|
||||||
echo "- Job CI security-audit détecté." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Établis une politique de dépendances: ajout automatique si justifié, vérification des dernières versions stables, documentation des impacts (ARCHITECTURE, CONFIGURATION, CHANGELOG), et rollback.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/deployment_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Déploiement" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
echo "## Résultats locaux" >> "$SUMMARY_FILE"
|
|
||||||
ok=1
|
|
||||||
for f in docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml; do
|
|
||||||
if [[ ! -e "$f" ]]; then echo "- Manquant: $f" >> "$SUMMARY_FILE"; ok=0; fi
|
|
||||||
done
|
|
||||||
if [[ $ok -eq 1 ]]; then echo "- Pré‑requis documentaires présents." >> "$SUMMARY_FILE"; fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Établis une checklist de déploiement minimale (pré‑checks, variables, smoke tests, rollback, post‑deploy) adaptée à un template CI Gitea.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/derogations_locales_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Dérogations locales" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ -f LOCAL_OVERRIDES.yml || -f .gitea/workflows/LOCAL_OVERRIDES.yml ]]; then
|
|
||||||
echo "- Fichier de dérogations locales détecté." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Aucun fichier de dérogations locales détecté." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Définis un format pour enregistrer les dérogations (path, raison, propriétaire, échéance), tolérance CI, et revue périodique.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,52 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/documentation_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Documentation" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
required=(docs/INDEX.md docs/ARCHITECTURE.md docs/TESTING.md docs/SECURITY_AUDIT.md docs/DEPLOYMENT.md)
|
|
||||||
missing=()
|
|
||||||
for f in "${required[@]}"; do [[ -f "$f" ]] || missing+=("$f"); done
|
|
||||||
|
|
||||||
echo "## Résultats locaux" >> "$SUMMARY_FILE"
|
|
||||||
if ((${#missing[@]}==0)); then
|
|
||||||
echo "- Documentation essentielle présente." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Fichiers manquants:" >> "$SUMMARY_FILE"
|
|
||||||
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
|
|
||||||
if [[ "${AUTO_FIX:-0}" == "1" ]]; then
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
echo "## Auto‑corrections" >> "$SUMMARY_FILE"
|
|
||||||
for m in "${missing[@]}"; do
|
|
||||||
case "$m" in
|
|
||||||
docs/INDEX.md)
|
|
||||||
mkdir -p docs && printf "# Index\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
|
|
||||||
docs/ARCHITECTURE.md)
|
|
||||||
mkdir -p docs && printf "# Architecture\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
|
|
||||||
docs/TESTING.md)
|
|
||||||
mkdir -p docs && printf "# Tests\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
|
|
||||||
docs/SECURITY_AUDIT.md)
|
|
||||||
mkdir -p docs && printf "# Security Audit\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
|
|
||||||
docs/DEPLOYMENT.md)
|
|
||||||
mkdir -p docs && printf "# Déploiement\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
|
|
||||||
*) : ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Élabore une liste courte d’améliorations documentation (INDEX à jour, traçabilité changes ↔ CHANGELOG, sections sécurité/tests/déploiement).
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/documents_bureautiques_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Documents bureautiques" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
docsx=$(git ls-files '*.docx' 2>/dev/null || true)
|
|
||||||
if [[ -z "$docsx" ]]; then
|
|
||||||
echo "- Aucun fichier .docx détecté." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- .docx détectés:" >> "$SUMMARY_FILE"
|
|
||||||
echo "$docsx" | sed 's/^/ - /' >> "$SUMMARY_FILE"
|
|
||||||
echo "- Utiliser docx2txt pour extraction et documenter dans docs/INDEX.md" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Décris une procédure standard de traitement des .docx (docx2txt, import, traçabilité dans docs/INDEX.md) et les risques à éviter.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/donnees_csv_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Données CSV" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
csvs=$(git ls-files '*.csv' 2>/dev/null || true)
|
|
||||||
if [[ -z "$csvs" ]]; then
|
|
||||||
echo "- Aucun CSV détecté dans le dépôt." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- CSV détectés:" >> "$SUMMARY_FILE"
|
|
||||||
echo "$csvs" | sed 's/^/ - /' >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
À partir des CSV présents (en‑têtes multi‑lignes possibles), propose une méthode pour définir toutes les colonnes, types et validations, et pointer vers les docs à mettre à jour (API, ARCHITECTURE, USAGE).
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/fondation_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Fondation" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
issues=0
|
|
||||||
# Vérification basique: fichiers de gouvernance présents
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
for f in README.md CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE; do
|
|
||||||
if [[ ! -f "$f" ]]; then echo "- Manquant: $f" >> "$SUMMARY_FILE"; issues=$((issues+1)); fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $issues -eq 0 ]]; then echo "- Conformité éditoriale de base: OK (présence des fichiers clés)." >> "$SUMMARY_FILE"; fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Évalue la conformité éditoriale (français, pas d’exemples applicatifs, intro/conclusion) et liste 5 actions d’amélioration priorisées.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/frontend_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Frontend" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Définis des principes front: code splitting (React.lazy/Suspense), centralisation d’état (Redux/Context), abstraction des services, et tests associés.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(package.json tsconfig.json src/)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement frontend pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/gitea_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Gitea" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(.gitea/ISSUE_TEMPLATE/bug_report.md .gitea/ISSUE_TEMPLATE/feature_request.md .gitea/PULL_REQUEST_TEMPLATE.md .gitea/workflows/ci.yml)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement Gitea pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
need=(.gitea/ISSUE_TEMPLATE/bug_report.md .gitea/ISSUE_TEMPLATE/feature_request.md .gitea/PULL_REQUEST_TEMPLATE.md .gitea/workflows/ci.yml)
|
|
||||||
missing=()
|
|
||||||
for f in "${need[@]}"; do [[ -f "$f" ]] || missing+=("$f"); done
|
|
||||||
|
|
||||||
if ((${#missing[@]}==0)); then
|
|
||||||
echo "- Configuration Gitea présente." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Manquants:" >> "$SUMMARY_FILE"; for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Propose des vérifications CI additionnelles Gitea (lint, tests, sécurité, scripts exécutables) et notifications en cas d’échecs.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Détection de langages et outillages par conventions de fichiers.
|
|
||||||
# À sourcer depuis les agents. Utilise le répertoire courant comme racine projet.
|
|
||||||
|
|
||||||
has_file() { [[ -f "$1" ]]; }
|
|
||||||
has_dir() { [[ -d "$1" ]]; }
|
|
||||||
has_bin() { command -v "$1" >/dev/null 2>&1; }
|
|
||||||
|
|
||||||
export HAS_NODE=0 HAS_TYPESCRIPT=0 HAS_GO=0 HAS_RUST=0 HAS_PYTHON=0 HAS_SHELL_BASH=0 HAS_SHELL_PWSH=0
|
|
||||||
|
|
||||||
# Node / TypeScript
|
|
||||||
if has_file package.json; then HAS_NODE=1; fi
|
|
||||||
if has_file tsconfig.json || git ls-files '*.ts' | grep -q . 2>/dev/null; then HAS_TYPESCRIPT=1; fi
|
|
||||||
|
|
||||||
# Go
|
|
||||||
if has_file go.mod || has_file go.work; then HAS_GO=1; fi
|
|
||||||
|
|
||||||
# Rust
|
|
||||||
if has_file Cargo.toml; then HAS_RUST=1; fi
|
|
||||||
|
|
||||||
# Python
|
|
||||||
if has_file pyproject.toml || has_file requirements.txt || git ls-files '*.py' | grep -q . 2>/dev/null; then HAS_PYTHON=1; fi
|
|
||||||
|
|
||||||
# Shell (bash)
|
|
||||||
if git ls-files '*.sh' | grep -q . 2>/dev/null; then HAS_SHELL_BASH=1; fi
|
|
||||||
|
|
||||||
# PowerShell (pwsh)
|
|
||||||
if git ls-files '*.ps1' | grep -q . 2>/dev/null; then HAS_SHELL_PWSH=1; fi
|
|
||||||
|
|
||||||
# Exposer aussi l'état des outils lorsqu’ils existent
|
|
||||||
export HAS_NPM=0 HAS_NPX=0 HAS_GO_BIN=0 HAS_CARGO=0 HAS_PYTHON_BIN=0 HAS_PIP=0 HAS_SHELLCHECK=0 HAS_PWSH=0
|
|
||||||
has_bin npm && HAS_NPM=1
|
|
||||||
has_bin npx && HAS_NPX=1
|
|
||||||
has_bin go && HAS_GO_BIN=1
|
|
||||||
has_bin cargo && HAS_CARGO=1
|
|
||||||
has_bin python && HAS_PYTHON_BIN=1 || true
|
|
||||||
has_bin pip && HAS_PIP=1 || true
|
|
||||||
has_bin shellcheck && HAS_SHELLCHECK=1 || true
|
|
||||||
has_bin pwsh && HAS_PWSH=1 || true
|
|
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/open_source_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Open Source" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(LICENSE CONTRIBUTING.md CODE_OF_CONDUCT.md docs/OPEN_SOURCE_CHECKLIST.md)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement open source pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
need=(LICENSE CONTRIBUTING.md CODE_OF_CONDUCT.md docs/OPEN_SOURCE_CHECKLIST.md)
|
|
||||||
missing=()
|
|
||||||
for f in "${need[@]}"; do [[ -f "$f" ]] || missing+=("$f"); done
|
|
||||||
|
|
||||||
if ((${#missing[@]}==0)); then
|
|
||||||
echo "- Pré‑requis open source présents." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Manquants:" >> "$SUMMARY_FILE"; for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Propose une checklist pour préparer l’ouverture open source (gouvernance, CI, sécurité, documentation) compatible avec Gitea.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/performance_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Performance" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ -d tests/performance ]]; then
|
|
||||||
echo "- Dossier tests/performance présent." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Dossier tests/performance manquant." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Propose un plan minimal de tests de performance reproductibles (outillage, métriques, critères de succès) et archivage des rapports.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Chargement env utilisateur (~/.4nk_template/.env)
|
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
|
|
||||||
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
|
|
||||||
set -a
|
|
||||||
. "${HOME}/.4nk_template/.env"
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/qualite_formelle.md"
|
|
||||||
|
|
||||||
echo "# Agent Qualité formelle" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
# Contrôles basiques
|
|
||||||
issues=0
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if grep -R "RESUME" docs/ >/dev/null 2>&1; then
|
|
||||||
echo "- Placeholder 'RESUME' détecté dans docs/ (à remplacer)." >> "$SUMMARY_FILE"; issues=$((issues+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "## Résultats locaux" >> "$SUMMARY_FILE"
|
|
||||||
if [[ $issues -eq 0 ]]; then
|
|
||||||
echo "- Aucun problème formel bloquant détecté." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Évalue la qualité formelle (français uniquement, typographie, absence d’exemples applicatifs, intro/conclusion) et propose 5 recommandations priorisées.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,95 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Chargement env utilisateur (~/.4nk_template/.env)
|
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
|
|
||||||
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
|
|
||||||
set -a
|
|
||||||
. "${HOME}/.4nk_template/.env"
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Portée (all|changed)
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/quality_tech.md"
|
|
||||||
|
|
||||||
# Checks de base (adaptés à ce template)
|
|
||||||
mapfile -t required_files < <(cat <<'REQ'
|
|
||||||
README.md
|
|
||||||
LICENSE
|
|
||||||
CONTRIBUTING.md
|
|
||||||
CODE_OF_CONDUCT.md
|
|
||||||
CHANGELOG.md
|
|
||||||
docs/INDEX.md
|
|
||||||
docs/ARCHITECTURE.md
|
|
||||||
docs/TESTING.md
|
|
||||||
.gitea/workflows/ci.yml
|
|
||||||
REQ
|
|
||||||
)
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
missing=()
|
|
||||||
for f in "${required_files[@]}"; do
|
|
||||||
[[ -f "$f" ]] || missing+=("$f")
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "# Agent Qualité technique" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
echo "## Résultats locaux" >> "$SUMMARY_FILE"
|
|
||||||
if ((${#missing[@]}==0)); then
|
|
||||||
echo "- Tous les fichiers requis sont présents." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Fichiers manquants:" >> "$SUMMARY_FILE"
|
|
||||||
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Détection des langages et contrôles best‑effort
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lang_detect.sh"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
echo "## Contrôles automatiques (best‑effort)" >> "$SUMMARY_FILE"
|
|
||||||
if [[ "$HAS_RUST" -eq 1 && "$HAS_CARGO" -eq 1 ]]; then
|
|
||||||
(cargo check -q && echo "- Rust: cargo check OK" >> "$SUMMARY_FILE") || echo "- Rust: cargo check a signalé des problèmes" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
if [[ "$HAS_GO" -eq 1 && "$HAS_GO_BIN" -eq 1 ]]; then
|
|
||||||
(go vet ./... >/dev/null 2>&1 && echo "- Go: go vet OK" >> "$SUMMARY_FILE") || echo "- Go: go vet a signalé des problèmes" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
if [[ "$HAS_NODE" -eq 1 && "$HAS_NPX" -eq 1 ]]; then
|
|
||||||
(npx -y --yes -- eslint . >/dev/null 2>&1 && echo "- Node: eslint OK" >> "$SUMMARY_FILE") || echo "- Node: eslint non exécuté ou problèmes" >> "$SUMMARY_FILE"
|
|
||||||
if [[ "$HAS_TYPESCRIPT" -eq 1 ]]; then
|
|
||||||
(npx -y --yes -- tsc --noEmit >/dev/null 2>&1 && echo "- TS: tsc --noEmit OK" >> "$SUMMARY_FILE") || echo "- TS: tsc a signalé des problèmes" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ "$HAS_PYTHON" -eq 1 ]]; then
|
|
||||||
if command -v ruff >/dev/null 2>&1; then
|
|
||||||
(ruff . >/dev/null 2>&1 && echo "- Python: ruff OK" >> "$SUMMARY_FILE") || echo "- Python: ruff a signalé des problèmes" >> "$SUMMARY_FILE"
|
|
||||||
elif command -v flake8 >/dev/null 2>&1; then
|
|
||||||
(flake8 . >/dev/null 2>&1 && echo "- Python: flake8 OK" >> "$SUMMARY_FILE") || echo "- Python: flake8 a signalé des problèmes" >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Python: aucun linter détecté (ruff/flake8)" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ "$HAS_SHELL_BASH" -eq 1 ]]; then
|
|
||||||
if [[ "$HAS_SHELLCHECK" -eq 1 ]]; then
|
|
||||||
(git ls-files '*.sh' | xargs -r shellcheck >/dev/null 2>&1 && echo "- Shell: shellcheck OK" >> "$SUMMARY_FILE") || echo "- Shell: shellcheck a signalé des problèmes" >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Shell: shellcheck non disponible" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ "$HAS_SHELL_PWSH" -eq 1 && "$HAS_PWSH" -eq 1 ]]; then
|
|
||||||
echo "- PowerShell: PSScriptAnalyzer recommandé" >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# IA (optionnelle)
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Analyse la conformité qualité technique du dépôt selon AGENTS.md et la CI. Priorise: lint/format/type-check, structure de tests, cohérence docs/CI, sécurité basique. Propose 5 actions concrètes.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/resolution_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Résolution" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ -d archive ]]; then
|
|
||||||
echo "- Dossier archive/ présent (pour REX)." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Dossier archive/ manquant (recommandé pour REX)." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Décris la boucle de triage complète (repro minimale, logs, bissection, hypothèses, tests ciblés, correctif, non‑régression) et quand produire un REX.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,94 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Chargement env utilisateur (~/.4nk_template/.env)
|
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
|
|
||||||
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
|
|
||||||
set -a
|
|
||||||
. "${HOME}/.4nk_template/.env"
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
AGENT="${3:-all}"
|
|
||||||
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
|
|
||||||
# Capture état avant
|
|
||||||
pushd "$TARGET_DIR" >/dev/null || true
|
|
||||||
before_status_file="$OUTPUT_DIR/.before_status.txt"
|
|
||||||
after_status_file="$OUTPUT_DIR/.after_status.txt"
|
|
||||||
changes_report="$OUTPUT_DIR/changes_applied.md"
|
|
||||||
(git status --porcelain || true) > "$before_status_file" 2>/dev/null || true
|
|
||||||
popd >/dev/null || true
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
cat <<USAGE
|
|
||||||
Usage: $0 [target_dir] [output_dir] [agent]
|
|
||||||
Agents: fondation, structure, documentation, donnees-csv, documents-bureautiques,
|
|
||||||
tests, performance, qualite-technique/quality-tech, dependances, compilation,
|
|
||||||
resolution, ssh-scripts, frontend, open-source, gitea, versionnage,
|
|
||||||
securite, deploiement, sync-template, derogations-locales, runner, all
|
|
||||||
USAGE
|
|
||||||
}
|
|
||||||
|
|
||||||
run_agent() {
|
|
||||||
local script_name="$1"
|
|
||||||
"$DIR/${script_name}" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$AGENT" in
|
|
||||||
runner) run_agent "runner_agent.sh" ;;
|
|
||||||
quality-tech|qualite-technique) run_agent "quality_tech.sh" ;;
|
|
||||||
qualite-formelle|fondation) "$DIR/qualite_formelle.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true; "$DIR/fondation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true ;;
|
|
||||||
structure) run_agent "structure_agent.sh" ;;
|
|
||||||
tests) run_agent "tests_agent.sh" ;;
|
|
||||||
performance) run_agent "performance_agent.sh" ;;
|
|
||||||
documentation) run_agent "documentation_agent.sh" ;;
|
|
||||||
donnees-csv) run_agent "donnees_csv_agent.sh" ;;
|
|
||||||
documents-bureautiques)run_agent "documents_bureautiques_agent.sh" ;;
|
|
||||||
securite) run_agent "security_agent.sh" ;;
|
|
||||||
deploiement) run_agent "deployment_agent.sh" ;;
|
|
||||||
dependances) run_agent "dependances_agent.sh" ;;
|
|
||||||
compilation) run_agent "compilation_agent.sh" ;;
|
|
||||||
resolution) run_agent "resolution_agent.sh" ;;
|
|
||||||
ssh-scripts) run_agent "ssh_scripts_agent.sh" ;;
|
|
||||||
frontend) run_agent "frontend_agent.sh" ;;
|
|
||||||
open-source) run_agent "open_source_agent.sh" ;;
|
|
||||||
gitea) run_agent "gitea_agent.sh" ;;
|
|
||||||
versionnage) run_agent "versionnage_agent.sh" ;;
|
|
||||||
sync-template) run_agent "sync_template_agent.sh" ;;
|
|
||||||
derogations-locales) run_agent "derogations_locales_agent.sh" ;;
|
|
||||||
all)
|
|
||||||
for a in \
|
|
||||||
runner_agent.sh quality_tech.sh qualite_formelle.sh fondation_agent.sh structure_agent.sh \
|
|
||||||
tests_agent.sh performance_agent.sh documentation_agent.sh donnees_csv_agent.sh \
|
|
||||||
documents_bureautiques_agent.sh security_agent.sh deployment_agent.sh dependances_agent.sh \
|
|
||||||
compilation_agent.sh resolution_agent.sh ssh_scripts_agent.sh frontend_agent.sh \
|
|
||||||
open_source_agent.sh gitea_agent.sh versionnage_agent.sh sync_template_agent.sh derogations_locales_agent.sh; do
|
|
||||||
"$DIR/$a" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
done ;;
|
|
||||||
-h|--help) usage; exit 0 ;;
|
|
||||||
*) echo "Agent inconnu: $AGENT" >&2; usage; exit 2 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Capture état après et rapport
|
|
||||||
pushd "$TARGET_DIR" >/dev/null || true
|
|
||||||
(git status --porcelain || true) > "$after_status_file" 2>/dev/null || true
|
|
||||||
{
|
|
||||||
echo "# Modifications appliquées par les agents"
|
|
||||||
echo
|
|
||||||
echo "## Fichiers modifiés/non suivis (avant)"
|
|
||||||
if [[ -s "$before_status_file" ]]; then sed "s/^/ /" "$before_status_file"; else echo " (aucun)"; fi
|
|
||||||
echo
|
|
||||||
echo "## Fichiers modifiés/non suivis (après)"
|
|
||||||
if [[ -s "$after_status_file" ]]; then sed "s/^/ /" "$after_status_file"; else echo " (aucun)"; fi
|
|
||||||
echo
|
|
||||||
echo "## Diff par rapport au dernier commit"
|
|
||||||
git diff --name-status || true
|
|
||||||
} > "$changes_report"
|
|
||||||
popd >/dev/null || true
|
|
||||||
|
|
||||||
echo "Agents terminés → $OUTPUT_DIR"
|
|
@ -1,31 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
|
|
||||||
mkdir -p "${OUTPUT_DIR}"
|
|
||||||
report="${OUTPUT_DIR}/runner_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Runner" >"${report}"
|
|
||||||
echo >>"${report}"
|
|
||||||
|
|
||||||
if ! command -v docker >/dev/null 2>&1; then
|
|
||||||
echo "- Docker non détecté sur l'hôte. Impossible de gérer le runner." >>"${report}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "runner/docker-compose.yml" ]]; then
|
|
||||||
(
|
|
||||||
cd runne
|
|
||||||
# Démarre (ou met à jour) le runne
|
|
||||||
docker compose up -d || true
|
|
||||||
)
|
|
||||||
echo "- Runner démarré/présent via docker compose (runner/docker-compose.yml)." >>"${report}"
|
|
||||||
else
|
|
||||||
echo "- Fichier runner/docker-compose.yml introuvable; aucun démarrage effectué." >>"${report}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "- Rapports: ${report}" >>"${report}"
|
|
||||||
exit 0
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/security_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Sécurité" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(scripts/security/audit.sh .gitea/workflows/ci.yml docs/SECURITY_AUDIT.md)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement sécurité pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
echo "## Résultats locaux" >> "$SUMMARY_FILE"
|
|
||||||
if [[ -x scripts/security/audit.sh ]]; then
|
|
||||||
if scripts/security/audit.sh >> "$SUMMARY_FILE" 2>&1; then
|
|
||||||
echo "- Audit sécurité scripté exécuté (voir détails ci‑dessus)." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Audit a signalé des problèmes (ci‑dessus)." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "- scripts/security/audit.sh introuvable ou non exécutable." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
À partir d’un dépôt template, propose 5 contrôles sécurité CI/CD additionnels (secrets, permissions, dépendances, scans) et un ordre de priorité.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,43 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/ssh_scripts_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent SSH & scripts" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(scripts/auto-ssh-push.sh scripts/init-ssh-env.sh scripts/setup-ssh-ci.sh docs/SSH_UPDATE.md)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement SSH/scripts pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
paths=(
|
|
||||||
scripts/auto-ssh-push.sh
|
|
||||||
scripts/init-ssh-env.sh
|
|
||||||
scripts/setup-ssh-ci.sh
|
|
||||||
scripts/scripts/auto-ssh-push.sh
|
|
||||||
scripts/scripts/init-ssh-env.sh
|
|
||||||
scripts/scripts/setup-ssh-ci.sh
|
|
||||||
)
|
|
||||||
|
|
||||||
found=0
|
|
||||||
for p in "${paths[@]}"; do
|
|
||||||
if [[ -f "$p" ]]; then echo "- Trouvé: $p" >> "$SUMMARY_FILE"; found=1; fi
|
|
||||||
done
|
|
||||||
if [[ $found -eq 0 ]]; then echo "- Scripts SSH standard introuvables (vérifier l’arborescence)." >> "$SUMMARY_FILE"; fi
|
|
||||||
|
|
||||||
if [[ -f docs/SSH_UPDATE.md ]]; then echo "- docs/SSH_UPDATE.md présent." >> "$SUMMARY_FILE"; fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Propose une checklist de conformité SSH (permissions, secrets CI, idempotence, journalisation non sensible) et intégration de contrôles CI.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/structure_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Structure" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(docs .gitea scripts CHANGELOG.md AGENTS.md)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement structurel pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
need=(docs .gitea scripts CHANGELOG.md AGENTS.md)
|
|
||||||
missing=()
|
|
||||||
for p in "${need[@]}"; do [[ -e "$p" ]] || missing+=("$p"); done
|
|
||||||
|
|
||||||
if ((${#missing[@]}==0)); then
|
|
||||||
echo "- Arborescence de base présente." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Éléments manquants:" >> "$SUMMARY_FILE"
|
|
||||||
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Vérifie l’alignement avec l’arborescence 4NK_node et propose 5 corrections prioritaires (créations/archives/métadonnées) si des écarts sont détectés.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/sync_template_agent.md"
|
|
||||||
|
|
||||||
echo "# Agent Synchronisation de template" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ -f .gitea/workflows/template-sync.yml ]]; then
|
|
||||||
echo "- Workflow template-sync présent." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Workflow template-sync manquant." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f .4nk-sync.yml ]]; then
|
|
||||||
echo "- Manifeste .4nk-sync.yml présent." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Manifeste .4nk-sync.yml manquant." >> "$SUMMARY_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Propose une procédure de synchronisation contrôlée (PR dédiée, vérif checksums/manifest_checksum, mise à jour TEMPLATE_VERSION, mise à jour CHANGELOG/INDEX).
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,50 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Chargement env utilisateur (~/.4nk_template/.env)
|
|
||||||
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
|
|
||||||
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
|
|
||||||
set -a
|
|
||||||
. "${HOME}/.4nk_template/.env"
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/tests_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Tests" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
# Vérifier existence structure
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
need=(tests/unit tests/integration tests/connectivity tests/external tests/performance tests/logs tests/reports)
|
|
||||||
missing=()
|
|
||||||
for d in "${need[@]}"; do [[ -d "$d" ]] || missing+=("$d"); done
|
|
||||||
|
|
||||||
echo "## Résultats locaux" >> "$SUMMARY_FILE"
|
|
||||||
if ((${#missing[@]}==0)); then
|
|
||||||
echo "- Structure de tests conforme au template." >> "$SUMMARY_FILE"
|
|
||||||
else
|
|
||||||
echo "- Dossiers manquants:" >> "$SUMMARY_FILE"
|
|
||||||
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
|
|
||||||
if [[ "${AUTO_FIX:-0}" == "1" ]]; then
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
echo "## Auto‑corrections" >> "$SUMMARY_FILE"
|
|
||||||
for m in "${missing[@]}"; do
|
|
||||||
mkdir -p "$m" && echo "- Créé: $m" >> "$SUMMARY_FILE"
|
|
||||||
done
|
|
||||||
mkdir -p tests/reports/agents tests/logs || true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Propose un plan court pour renforcer la pyramide de tests (unit, integration, connectivity, external, performance) pour ce template, avec 5 actions.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
TARGET_DIR="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
SUMMARY_FILE="$OUTPUT_DIR/versionnage_agent.md"
|
|
||||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
|
|
||||||
|
|
||||||
echo "# Agent Versionnage" > "$SUMMARY_FILE"
|
|
||||||
echo >> "$SUMMARY_FILE"
|
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
|
||||||
if [[ "$SCOPE" == "changed" ]]; then
|
|
||||||
relevant=(CHANGELOG.md TEMPLATE_VERSION)
|
|
||||||
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
|
|
||||||
if [[ $any -eq 0 ]]; then echo "- Aucun changement versionnage pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
|
|
||||||
fi
|
|
||||||
ok=1
|
|
||||||
for f in CHANGELOG.md TEMPLATE_VERSION; do
|
|
||||||
if [[ ! -f "$f" ]]; then echo "- Manquant: $f" >> "$SUMMARY_FILE"; ok=0; fi
|
|
||||||
done
|
|
||||||
if [[ $ok -eq 1 ]]; then echo "- CHANGELOG et TEMPLATE_VERSION présents." >> "$SUMMARY_FILE"; fi
|
|
||||||
|
|
||||||
PROMPT=$(cat <<'EOF'
|
|
||||||
Décris la procédure d’alignement version ↔ changelog ↔ tag git (latest vs wip) et conditions de blocage release.
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
|
|
||||||
|
|
||||||
echo "Rapport: $SUMMARY_FILE"
|
|
||||||
popd >/dev/null
|
|
15
scripts/build-ihm.ps1
Normal file
15
scripts/build-ihm.ps1
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
param()
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
Push-Location "$PSScriptRoot/../..\ihm_client"
|
||||||
|
try {
|
||||||
|
if (Test-Path package-lock.json) {
|
||||||
|
npm ci --silent
|
||||||
|
} else {
|
||||||
|
npm install --silent
|
||||||
|
}
|
||||||
|
npm run build
|
||||||
|
} finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
0
scripts/checks/version_alignment.sh
Executable file → Normal file
0
scripts/checks/version_alignment.sh
Executable file → Normal file
22
scripts/copy-ihm-dist.ps1
Normal file
22
scripts/copy-ihm-dist.ps1
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
param()
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$repoRoot = Resolve-Path "$PSScriptRoot/../.."
|
||||||
|
$ihmDist = Join-Path $repoRoot 'ihm_client/dist'
|
||||||
|
$targetAssets = Join-Path (Resolve-Path "$PSScriptRoot/..") 'assets/ihm'
|
||||||
|
$targetWeb = Join-Path (Resolve-Path "$PSScriptRoot/..") 'web/ihm'
|
||||||
|
|
||||||
|
if (!(Test-Path $ihmDist)) {
|
||||||
|
Write-Error "Le build d'ihm_client est introuvable: $ihmDist"
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $targetAssets | Out-Null
|
||||||
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue (Join-Path $targetAssets '*') | Out-Null
|
||||||
|
Copy-Item -Recurse -Force "$ihmDist/*" $targetAssets
|
||||||
|
Write-Host "Copie terminée: $ihmDist -> $targetAssets"
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $targetWeb | Out-Null
|
||||||
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue (Join-Path $targetWeb '*') | Out-Null
|
||||||
|
Copy-Item -Recurse -Force "$ihmDist/*" $targetWeb
|
||||||
|
Write-Host "Copie terminée: $ihmDist -> $targetWeb"
|
||||||
|
|
@ -1,145 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
ENV_DIR="${HOME}/.4nk_template"
|
|
||||||
ENV_FILE="${ENV_DIR}/.env"
|
|
||||||
TEMPLATE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
||||||
TEMPLATE_IN_REPO="${TEMPLATE_ROOT}/scripts/env/.env.template"
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
cat <<USAGE
|
|
||||||
Usage: $0 <git_url> [--dest DIR] [--force]
|
|
||||||
|
|
||||||
Actions:
|
|
||||||
1) Provisionne ~/.4nk_template/.env (si absent)
|
|
||||||
2) Clone le dépôt cible si le dossier n'existe pas
|
|
||||||
3) Copie la structure normative 4NK_template dans le projet cible:
|
|
||||||
- .gitea/** (workflows, templates issues/PR)
|
|
||||||
- AGENTS.md
|
|
||||||
- .cursor/rules/** (si présent)
|
|
||||||
- scripts/agents/**, scripts/env/ensure_env.sh, scripts/deploy/setup.sh
|
|
||||||
- docs/templates/** et docs/INDEX.md (table des matières)
|
|
||||||
4) Ne remplace pas les fichiers existants sauf si --force
|
|
||||||
|
|
||||||
Exemples:
|
|
||||||
$0 https://git.example.com/org/projet.git
|
|
||||||
$0 git@host:org/projet.git --dest ~/work --force
|
|
||||||
USAGE
|
|
||||||
}
|
|
||||||
|
|
||||||
GIT_URL="${1:-}"
|
|
||||||
DEST_PARENT="$(pwd)"
|
|
||||||
FORCE_COPY=0
|
|
||||||
shift || true
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case "$1" in
|
|
||||||
--dest)
|
|
||||||
DEST_PARENT="${2:-}"; shift 2 ;;
|
|
||||||
--force)
|
|
||||||
FORCE_COPY=1; shift ;;
|
|
||||||
-h|--help)
|
|
||||||
usage; exit 0 ;;
|
|
||||||
*)
|
|
||||||
echo "Option inconnue: $1" >&2; usage; exit 2 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -z "${GIT_URL}" ]]; then
|
|
||||||
usage; exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "${ENV_DIR}"
|
|
||||||
chmod 700 "${ENV_DIR}" || true
|
|
||||||
|
|
||||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
|
||||||
if [[ -f "${TEMPLATE_IN_REPO}" ]]; then
|
|
||||||
cp "${TEMPLATE_IN_REPO}" "${ENV_FILE}"
|
|
||||||
else
|
|
||||||
cat >"${ENV_FILE}" <<'EOF'
|
|
||||||
# Fichier d'exemple d'environnement pour 4NK_template
|
|
||||||
# Copiez ce fichier vers ~/.4nk_template/.env puis complétez les valeurs.
|
|
||||||
# Ne committez jamais de fichier contenant des secrets.
|
|
||||||
|
|
||||||
# OpenAI (agents IA)
|
|
||||||
OPENAI_API_KEY=
|
|
||||||
OPENAI_MODEL=
|
|
||||||
OPENAI_API_BASE=https://api.openai.com/v1
|
|
||||||
OPENAI_TEMPERATURE=0.2
|
|
||||||
|
|
||||||
# Gitea (release via API)
|
|
||||||
BASE_URL=https://git.4nkweb.com
|
|
||||||
RELEASE_TOKEN=
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
chmod 600 "${ENV_FILE}" || true
|
|
||||||
echo "Fichier créé: ${ENV_FILE}. Complétez les valeurs requises (ex: OPENAI_API_KEY, OPENAI_MODEL, RELEASE_TOKEN)." >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 2) Clonage du dépôt si nécessaire
|
|
||||||
repo_name="$(basename -s .git "${GIT_URL}")"
|
|
||||||
target_dir="${DEST_PARENT%/}/${repo_name}"
|
|
||||||
if [[ ! -d "${target_dir}" ]]; then
|
|
||||||
echo "Clonage: ${GIT_URL} → ${target_dir}" >&2
|
|
||||||
git clone --depth 1 "${GIT_URL}" "${target_dir}"
|
|
||||||
else
|
|
||||||
echo "Dossier existant, pas de clone: ${target_dir}" >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
copy_item() {
|
|
||||||
local src="$1" dst="$2"
|
|
||||||
if [[ ! -e "$src" ]]; then return 0; fi
|
|
||||||
if [[ -d "$src" ]]; then
|
|
||||||
mkdir -p "$dst"
|
|
||||||
if (( FORCE_COPY )); then
|
|
||||||
cp -a "$src/." "$dst/"
|
|
||||||
else
|
|
||||||
(cd "$src" && find . -type f -print0) | while IFS= read -r -d '' f; do
|
|
||||||
if [[ ! -e "$dst/$f" ]]; then
|
|
||||||
mkdir -p "$(dirname "$dst/$f")"
|
|
||||||
cp -a "$src/$f" "$dst/$f"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [[ -e "$dst" && $FORCE_COPY -eq 0 ]]; then return 0; fi
|
|
||||||
mkdir -p "$(dirname "$dst")" && cp -a "$src" "$dst"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 3) Copie de la structure normative
|
|
||||||
copy_item "${TEMPLATE_ROOT}/.gitea" "${target_dir}/.gitea"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/AGENTS.md" "${target_dir}/AGENTS.md"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/.cursor" "${target_dir}/.cursor"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/.cursorignore" "${target_dir}/.cursorignore"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/.gitignore" "${target_dir}/.gitignore"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/.markdownlint.json" "${target_dir}/.markdownlint.json"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/LICENSE" "${target_dir}/LICENSE"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/CONTRIBUTING.md" "${target_dir}/CONTRIBUTING.md"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/CODE_OF_CONDUCT.md" "${target_dir}/CODE_OF_CONDUCT.md"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/SECURITY.md" "${target_dir}/SECURITY.md"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/TEMPLATE_VERSION" "${target_dir}/TEMPLATE_VERSION"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/security" "${target_dir}/security"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/scripts" "${target_dir}/scripts"
|
|
||||||
copy_item "${TEMPLATE_ROOT}/docs/templates" "${target_dir}/docs/templates"
|
|
||||||
|
|
||||||
# Génération docs/INDEX.md dans le projet cible (si absent ou --force)
|
|
||||||
INDEX_DST="${target_dir}/docs/INDEX.md"
|
|
||||||
if [[ ! -f "${INDEX_DST}" || $FORCE_COPY -eq 1 ]]; then
|
|
||||||
mkdir -p "$(dirname "${INDEX_DST}")"
|
|
||||||
cat >"${INDEX_DST}" <<'IDX'
|
|
||||||
# Documentation du projet
|
|
||||||
|
|
||||||
Cette table des matières oriente vers:
|
|
||||||
- Documentation spécifique au projet: `docs/project/`
|
|
||||||
- Modèles génériques à adapter: `docs/templates/`
|
|
||||||
|
|
||||||
## Sommaire
|
|
||||||
- À personnaliser: `docs/project/README.md`, `docs/project/INDEX.md`, `docs/project/ARCHITECTURE.md`, `docs/project/USAGE.md`, etc.
|
|
||||||
|
|
||||||
## Modèles génériques
|
|
||||||
- Voir: `docs/templates/`
|
|
||||||
IDX
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Template 4NK appliqué à: ${target_dir}" >&2
|
|
||||||
exit 0
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
IMAGE_NAME="4nk-template-dev:debian"
|
|
||||||
DOCKERFILE="docker/Dockerfile.debian"
|
|
||||||
|
|
||||||
echo "[build] ${IMAGE_NAME}"
|
|
||||||
docker build -t "${IMAGE_NAME}" -f "${DOCKERFILE}" .
|
|
||||||
|
|
||||||
echo "[run] launching container and executing agents"
|
|
||||||
docker run --rm -it \
|
|
||||||
-v "${PWD}:/work" -w /work \
|
|
||||||
"${IMAGE_NAME}" \
|
|
||||||
"scripts/agents/run.sh; ls -la tests/reports/agents || true"
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Build et lance le conteneur unifié (runner+agents) sur ce projet
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
||||||
cd "$ROOT_DIR"
|
|
||||||
|
|
||||||
# Build image
|
|
||||||
docker compose -f docker-compose.ci.yml build
|
|
||||||
|
|
||||||
# Exécuter agents par défaut
|
|
||||||
RUNNER_MODE="${RUNNER_MODE:-agents}" BASE_URL="${BASE_URL:-}" REGISTRATION_TOKEN="${REGISTRATION_TOKEN:-}" \
|
|
||||||
docker compose -f docker-compose.ci.yml up --remove-orphans --abort-on-container-exit
|
|
42
scripts/env/ensure_env.sh
vendored
42
scripts/env/ensure_env.sh
vendored
@ -1,42 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
||||||
TEMPLATE_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.env.template"
|
|
||||||
ENV_DIR="${HOME}/.4nk_template"
|
|
||||||
ENV_FILE="${ENV_DIR}/.env"
|
|
||||||
|
|
||||||
mkdir -p "${ENV_DIR}"
|
|
||||||
chmod 700 "${ENV_DIR}" || true
|
|
||||||
|
|
||||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
|
||||||
if [[ -f "${TEMPLATE_FILE}" ]]; then
|
|
||||||
cp "${TEMPLATE_FILE}" "${ENV_FILE}"
|
|
||||||
chmod 600 "${ENV_FILE}" || true
|
|
||||||
echo "Fichier d'environnement créé: ${ENV_FILE}" >&2
|
|
||||||
echo "Veuillez renseigner les variables requises (OPENAI_API_KEY, OPENAI_MODEL, etc.)." >&2
|
|
||||||
exit 3
|
|
||||||
else
|
|
||||||
echo "Modèle d'environnement introuvable: ${TEMPLATE_FILE}" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Charger pour validation
|
|
||||||
set -a
|
|
||||||
. "${ENV_FILE}"
|
|
||||||
set +a
|
|
||||||
|
|
||||||
MISSING=()
|
|
||||||
for var in OPENAI_API_KEY OPENAI_MODEL; do
|
|
||||||
if [[ -z "${!var:-}" ]]; then
|
|
||||||
MISSING+=("$var")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if (( ${#MISSING[@]} > 0 )); then
|
|
||||||
echo "Variables manquantes dans ${ENV_FILE}: ${MISSING[*]}" >&2
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Environnement valide: ${ENV_FILE}" >&2
|
|
@ -1,19 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"/..
|
|
||||||
HOOKS_DIR="$REPO_ROOT/.git/hooks"
|
|
||||||
|
|
||||||
mkdir -p "$HOOKS_DIR"
|
|
||||||
install_hook() {
|
|
||||||
local name="$1" src="$2"
|
|
||||||
cp -f "$src" "$HOOKS_DIR/$name"
|
|
||||||
chmod +x "$HOOKS_DIR/$name"
|
|
||||||
echo "Installed hook: $name"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Hooks qui délèguent aux agents via l'image Docker du template sur le projet courant
|
|
||||||
install_hook pre-commit "$REPO_ROOT/scripts/local/precommit.sh"
|
|
||||||
install_hook pre-push "$REPO_ROOT/scripts/local/prepush.sh"
|
|
||||||
|
|
||||||
echo "Hooks installés (mode agents via 4NK_template)."
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Exécuter les agents depuis l'image Docker de 4NK_template sur le projet courant
|
|
||||||
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
|
||||||
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
|
|
||||||
|
|
||||||
mkdir -p "${PROJECT_DIR}/tests/reports/agents"
|
|
||||||
"${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
|
|
||||||
|
|
||||||
echo "[pre-commit] OK (agents via 4NK_template)"
|
|
@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Exécuter les agents depuis l'image Docker de 4NK_template sur le projet courant
|
|
||||||
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
|
||||||
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
|
|
||||||
|
|
||||||
mkdir -p "${PROJECT_DIR}/tests/reports/agents"
|
|
||||||
"${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
|
|
||||||
|
|
||||||
# Audit sécurité (best effort) dans le contexte du projet
|
|
||||||
if [ -f "${PROJECT_DIR}/scripts/security/audit.sh" ]; then
|
|
||||||
(cd "${PROJECT_DIR}" && bash scripts/security/audit.sh) || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Release guard (dry-run logique) dans le contexte du projet
|
|
||||||
if [ -f "${PROJECT_DIR}/scripts/release/guard.sh" ]; then
|
|
||||||
(cd "${PROJECT_DIR}" && bash scripts/release/guard.sh) || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[pre-push] OK (agents via 4NK_template)"
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
VERSION="${1:-}"
|
|
||||||
if [[ -z "$VERSION" ]]; then
|
|
||||||
echo "Usage: $0 vYYYY.MM.P" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
||||||
cd "$ROOT_DIR/.."
|
|
||||||
|
|
||||||
echo "$VERSION" > TEMPLATE_VERSION
|
|
||||||
git add TEMPLATE_VERSION CHANGELOG.md 2>/dev/null || true
|
|
||||||
git commit -m "[skip ci] chore(release): $VERSION" || true
|
|
||||||
git tag -a "$VERSION" -m "release: $VERSION (latest)"
|
|
||||||
git push || true
|
|
||||||
git push origin "$VERSION"
|
|
||||||
|
|
||||||
echo "Release locale préparée: $VERSION"
|
|
@ -1,51 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Script pour lancer les agents de 4NK_template sur un projet externe
|
|
||||||
# Usage: ./run_agents_for_project.sh [project_path] [output_dir]
|
|
||||||
|
|
||||||
PROJECT_PATH="${1:-.}"
|
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
|
||||||
TEMPLATE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
||||||
MODULE_LAST_IMAGE_FILE="$(cd "$TEMPLATE_DIR/.." && pwd)/modules/4NK_template/.last_image"
|
|
||||||
|
|
||||||
if [[ ! -d "$PROJECT_PATH" ]]; then
|
|
||||||
echo "Erreur: Le projet '$PROJECT_PATH' n'existe pas" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$PROJECT_PATH/$OUTPUT_DIR"
|
|
||||||
|
|
||||||
echo "=== Lancement des agents 4NK_template sur: $PROJECT_PATH ==="
|
|
||||||
|
|
||||||
if ! command -v docker >/dev/null 2>&1; then
|
|
||||||
echo "Docker requis pour exécuter les agents via conteneur." >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Si une image du module existe, l'utiliser en priorité
|
|
||||||
if [[ -f "$MODULE_LAST_IMAGE_FILE" ]]; then
|
|
||||||
IMAGE_NAME="$(cat "$MODULE_LAST_IMAGE_FILE" | tr -d '\r\n')"
|
|
||||||
echo "Utilisation de l'image du module: $IMAGE_NAME"
|
|
||||||
# Préparer montage du fichier d'env si présent
|
|
||||||
ENV_MOUNT=""
|
|
||||||
if [[ -f "$HOME/.4nk_template/.env" ]]; then
|
|
||||||
ENV_MOUNT="-v $HOME/.4nk_template/.env:/root/.4nk_template/.env:ro"
|
|
||||||
fi
|
|
||||||
# Lancer le conteneur en utilisant l'ENTRYPOINT qui configure safe.directory
|
|
||||||
docker run --rm \
|
|
||||||
-e RUNNER_MODE=agents \
|
|
||||||
-e TARGET_DIR=/work \
|
|
||||||
-e OUTPUT_DIR=/work/$OUTPUT_DIR \
|
|
||||||
-v "$(realpath "$PROJECT_PATH"):/work" \
|
|
||||||
$ENV_MOUNT \
|
|
||||||
"$IMAGE_NAME" || true
|
|
||||||
else
|
|
||||||
echo "Aucune image de module détectée, fallback docker compose dans 4NK_template"
|
|
||||||
cd "$TEMPLATE_DIR"
|
|
||||||
docker compose -f docker-compose.ci.yml build
|
|
||||||
RUNNER_MODE="agents" TARGET_DIR="/work" OUTPUT_DIR="/work/$OUTPUT_DIR" \
|
|
||||||
docker compose -f docker-compose.ci.yml run --rm project-ci || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "=== Agents terminés → $PROJECT_PATH/$OUTPUT_DIR ==="
|
|
0
scripts/release/guard.sh
Executable file → Normal file
0
scripts/release/guard.sh
Executable file → Normal file
26
scripts/scripts/auto-ssh-push.sh
Executable file → Normal file
26
scripts/scripts/auto-ssh-push.sh
Executable file → Normal file
@ -26,23 +26,8 @@ fi
|
|||||||
echo "✅ Authentification SSH réussie"
|
echo "✅ Authentification SSH réussie"
|
||||||
|
|
||||||
# Fonction pour push automatique
|
# Fonction pour push automatique
|
||||||
get_current_branch() {
|
|
||||||
# Détecte la branche courante, compatible anciennes versions de git
|
|
||||||
local br
|
|
||||||
br="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
|
|
||||||
if [ -z "$br" ] || [ "$br" = "HEAD" ]; then
|
|
||||||
br="$(git symbolic-ref --short -q HEAD 2>/dev/null || true)"
|
|
||||||
fi
|
|
||||||
if [ -z "$br" ]; then
|
|
||||||
# dernier recours: parser la sortie de "git branch"
|
|
||||||
br="$(git branch 2>/dev/null | sed -n 's/^* //p' | head -n1)"
|
|
||||||
fi
|
|
||||||
echo "$br"
|
|
||||||
}
|
|
||||||
|
|
||||||
auto_push() {
|
auto_push() {
|
||||||
local branch
|
local branch=${1:-$(git branch --show-current)}
|
||||||
branch=${1:-$(get_current_branch)}
|
|
||||||
local commit_message=${2:-"Auto-commit $(date '+%Y-%m-%d %H:%M:%S')"}
|
local commit_message=${2:-"Auto-commit $(date '+%Y-%m-%d %H:%M:%S')"}
|
||||||
|
|
||||||
echo "🚀 Push automatique sur la branche: $branch"
|
echo "🚀 Push automatique sur la branche: $branch"
|
||||||
@ -50,7 +35,7 @@ auto_push() {
|
|||||||
# Ajouter tous les changements
|
# Ajouter tous les changements
|
||||||
git add .
|
git add .
|
||||||
|
|
||||||
# Ne pas commiter si rien à commite
|
# Ne pas commiter si rien à commiter
|
||||||
if [[ -z "$(git diff --cached --name-only)" ]]; then
|
if [[ -z "$(git diff --cached --name-only)" ]]; then
|
||||||
echo "ℹ️ Aucun changement indexé. Skip commit/push."
|
echo "ℹ️ Aucun changement indexé. Skip commit/push."
|
||||||
return 0
|
return 0
|
||||||
@ -69,7 +54,7 @@ auto_push() {
|
|||||||
# Fonction pour push avec message personnalisé
|
# Fonction pour push avec message personnalisé
|
||||||
push_with_message() {
|
push_with_message() {
|
||||||
local message="$1"
|
local message="$1"
|
||||||
local branch=${2:-$(get_current_branch)}
|
local branch=${2:-$(git branch --show-current)}
|
||||||
|
|
||||||
echo "💬 Push avec message: $message"
|
echo "💬 Push avec message: $message"
|
||||||
auto_push "$branch" "$message"
|
auto_push "$branch" "$message"
|
||||||
@ -77,7 +62,7 @@ push_with_message() {
|
|||||||
|
|
||||||
# Fonction pour push rapide (sans message)
|
# Fonction pour push rapide (sans message)
|
||||||
quick_push() {
|
quick_push() {
|
||||||
local branch=${1:-$(get_current_branch)}
|
local branch=${1:-$(git branch --show-current)}
|
||||||
auto_push "$branch"
|
auto_push "$branch"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +77,7 @@ push_branch() {
|
|||||||
|
|
||||||
# Fonction pour push et merge vers main
|
# Fonction pour push et merge vers main
|
||||||
push_and_merge() {
|
push_and_merge() {
|
||||||
local source_branch=${1:-$(get_current_branch)}
|
local source_branch=${1:-$(git branch --show-current)}
|
||||||
local target_branch=${2:-main}
|
local target_branch=${2:-main}
|
||||||
|
|
||||||
echo "🔄 Push et merge $source_branch -> $target_branch"
|
echo "🔄 Push et merge $source_branch -> $target_branch"
|
||||||
@ -164,3 +149,4 @@ case "$1" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
echo "🎯 Push SSH automatique terminé !"
|
echo "🎯 Push SSH automatique terminé !"
|
||||||
|
|
||||||
|
0
scripts/scripts/init-ssh-env.sh
Executable file → Normal file
0
scripts/scripts/init-ssh-env.sh
Executable file → Normal file
0
scripts/scripts/setup-ssh-ci.sh
Executable file → Normal file
0
scripts/scripts/setup-ssh-ci.sh
Executable file → Normal file
0
scripts/security/audit.sh
Executable file → Normal file
0
scripts/security/audit.sh
Executable file → Normal file
@ -1,47 +0,0 @@
|
|||||||
Param(
|
|
||||||
[string]$Root = "."
|
|
||||||
)
|
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$files = Get-ChildItem -Path $Root -Recurse -Filter *.md | Where-Object { $_.FullName -notmatch '\\archive\\' }
|
|
||||||
$had = $false
|
|
||||||
foreach ($f in $files) {
|
|
||||||
try {
|
|
||||||
$lines = Get-Content -LiteralPath $f.FullName -Encoding UTF8 -ErrorAction Stop
|
|
||||||
} catch {
|
|
||||||
Write-Warning ("Impossible de lire: {0} — {1}" -f $f.FullName, $_.Exception.Message)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
$map = @{}
|
|
||||||
$firstMap = @{}
|
|
||||||
$dups = @{}
|
|
||||||
for ($i = 0; $i -lt $lines.Count; $i++) {
|
|
||||||
$line = $lines[$i]
|
|
||||||
if ($line -match '^\s{0,3}#{1,6}\s+(.*)$') {
|
|
||||||
$t = $Matches[1].Trim()
|
|
||||||
$norm = ([regex]::Replace($t, '\s+', ' ')).ToLowerInvariant()
|
|
||||||
if ($map.ContainsKey($norm)) {
|
|
||||||
if (-not $dups.ContainsKey($norm)) {
|
|
||||||
$dups[$norm] = New-Object System.Collections.ArrayList
|
|
||||||
$firstMap[$norm] = $map[$norm]
|
|
||||||
}
|
|
||||||
[void]$dups[$norm].Add($i + 1)
|
|
||||||
} else {
|
|
||||||
$map[$norm] = $i + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($dups.Keys.Count -gt 0) {
|
|
||||||
$had = $true
|
|
||||||
Write-Output "=== $($f.FullName) ==="
|
|
||||||
foreach ($k in $dups.Keys) {
|
|
||||||
$first = $firstMap[$k]
|
|
||||||
$others = ($dups[$k] -join ', ')
|
|
||||||
Write-Output ("Heading: '{0}' first@{1} duplicates@[{2}]" -f $k, $first, $others)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (-not $had) {
|
|
||||||
Write-Output "No duplicate headings detected."
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
M tests/reports/agents/.before_status.txt
|
|
||||||
M tests/reports/agents/changes_applied.md
|
|
||||||
M tests/reports/agents/quality_tech.md
|
|
@ -1,3 +0,0 @@
|
|||||||
M tests/reports/agents/.after_status.txt
|
|
||||||
M tests/reports/agents/changes_applied.md
|
|
||||||
M tests/reports/agents/quality_tech.md
|
|
@ -1,17 +0,0 @@
|
|||||||
# Modifications appliquées par les agents
|
|
||||||
|
|
||||||
## Fichiers modifiés/non suivis (avant)
|
|
||||||
M tests/reports/agents/.after_status.txt
|
|
||||||
M tests/reports/agents/changes_applied.md
|
|
||||||
M tests/reports/agents/quality_tech.md
|
|
||||||
|
|
||||||
## Fichiers modifiés/non suivis (après)
|
|
||||||
M tests/reports/agents/.before_status.txt
|
|
||||||
M tests/reports/agents/changes_applied.md
|
|
||||||
M tests/reports/agents/quality_tech.md
|
|
||||||
|
|
||||||
## Diff par rapport au dernier commit
|
|
||||||
M tests/reports/agents/.after_status.txt
|
|
||||||
M tests/reports/agents/.before_status.txt
|
|
||||||
M tests/reports/agents/changes_applied.md
|
|
||||||
M tests/reports/agents/quality_tech.md
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Compilation
|
|
||||||
|
|
||||||
- Étapes de build/format/clippy Rust détectées dans la CI.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Dépendances
|
|
||||||
|
|
||||||
- Vérifier régulièrement les dépendances (audit sécurité, mises à jour stables).
|
|
||||||
- Job CI security-audit détecté.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Déploiement
|
|
||||||
|
|
||||||
## Résultats locaux
|
|
||||||
- Manquant: docs/RELEASE_PLAN.md
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Dérogations locales
|
|
||||||
|
|
||||||
- Fichier de dérogations locales détecté.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Documentation
|
|
||||||
|
|
||||||
## Résultats locaux
|
|
||||||
- Documentation essentielle présente.
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Documents bureautiques
|
|
||||||
|
|
||||||
- Aucun fichier .docx détecté.
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Données CSV
|
|
||||||
|
|
||||||
- Aucun CSV détecté dans le dépôt.
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Fondation
|
|
||||||
|
|
||||||
- Conformité éditoriale de base: OK (présence des fichiers clés).
|
|
@ -1,2 +0,0 @@
|
|||||||
# Agent Frontend
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Gitea
|
|
||||||
|
|
||||||
- Configuration Gitea présente.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Open Source
|
|
||||||
|
|
||||||
- Manquants:
|
|
||||||
- docs/OPEN_SOURCE_CHECKLIST.md
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Performance
|
|
||||||
|
|
||||||
- Dossier tests/performance présent.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Qualité formelle
|
|
||||||
|
|
||||||
## Résultats locaux
|
|
||||||
- Aucun problème formel bloquant détecté.
|
|
@ -1,7 +0,0 @@
|
|||||||
# Agent Qualité technique
|
|
||||||
|
|
||||||
## Résultats locaux
|
|
||||||
- Tous les fichiers requis sont présents.
|
|
||||||
|
|
||||||
## Contrôles automatiques (best‑effort)
|
|
||||||
- Shell: shellcheck non disponible
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Résolution
|
|
||||||
|
|
||||||
- Dossier archive/ manquant (recommandé pour REX).
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Runner
|
|
||||||
|
|
||||||
- Docker non détecté sur l'hôte. Impossible de gérer le runner.
|
|
@ -1,11 +0,0 @@
|
|||||||
# Agent Sécurité
|
|
||||||
|
|
||||||
## Résultats locaux
|
|
||||||
[security-audit] démarrage
|
|
||||||
[security-audit] npm audit --audit-level=moderate
|
|
||||||
scripts/security/audit.sh: line 13: npm: command not found
|
|
||||||
[security-audit] pas de projet Rust (ok)
|
|
||||||
[security-audit] scan secrets
|
|
||||||
[security-audit] aucun secret évident
|
|
||||||
[security-audit] terminé rc=1
|
|
||||||
- Audit a signalé des problèmes (ci‑dessus).
|
|
@ -1,5 +0,0 @@
|
|||||||
# Agent SSH & scripts
|
|
||||||
|
|
||||||
- Trouvé: scripts/scripts/auto-ssh-push.sh
|
|
||||||
- Trouvé: scripts/scripts/init-ssh-env.sh
|
|
||||||
- Trouvé: scripts/scripts/setup-ssh-ci.sh
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Structure
|
|
||||||
|
|
||||||
- Arborescence de base présente.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Synchronisation de template
|
|
||||||
|
|
||||||
- Workflow template-sync présent.
|
|
||||||
- Manifeste .4nk-sync.yml manquant.
|
|
@ -1,4 +0,0 @@
|
|||||||
# Agent Tests
|
|
||||||
|
|
||||||
## Résultats locaux
|
|
||||||
- Structure de tests conforme au template.
|
|
@ -1,3 +0,0 @@
|
|||||||
# Agent Versionnage
|
|
||||||
|
|
||||||
- CHANGELOG et TEMPLATE_VERSION présents.
|
|
Loading…
x
Reference in New Issue
Block a user