Compare commits
13 Commits
v2025.08.5
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6ced5d2923 | ||
![]() |
7f8dc0a926 | ||
![]() |
4c47efc9b4 | ||
![]() |
e43abef18f | ||
![]() |
043434bfe8 | ||
![]() |
57c047e76d | ||
![]() |
46d5d20c7d | ||
![]() |
99e1e0bda7 | ||
![]() |
948b11793a | ||
![]() |
25453b045e | ||
![]() |
21e4f76445 | ||
![]() |
5674437bc4 | ||
![]() |
1add88bcbb |
@ -1 +1 @@
|
|||||||
v2025.08.5
|
v2025.08.6
|
||||||
|
@ -12,6 +12,10 @@ MODE="${RUNNER_MODE:-agents}"
|
|||||||
TARGET_DIR="${TARGET_DIR:-/work}"
|
TARGET_DIR="${TARGET_DIR:-/work}"
|
||||||
OUTPUT_DIR="${OUTPUT_DIR:-/work/tests/reports/agents}"
|
OUTPUT_DIR="${OUTPUT_DIR:-/work/tests/reports/agents}"
|
||||||
|
|
||||||
|
# Rendre le dépôt monté sûr pour Git (propriétaire différent dans le conteneur)
|
||||||
|
git config --global --add safe.directory "/work" || true
|
||||||
|
git config --global --add safe.directory "${TARGET_DIR}" || true
|
||||||
|
|
||||||
normalize_scripts() {
|
normalize_scripts() {
|
||||||
if command -v dos2unix >/dev/null 2>&1; then
|
if command -v dos2unix >/dev/null 2>&1; then
|
||||||
find /work/scripts -type f -name "*.sh" -print0 | xargs -0 -r dos2unix -f || true
|
find /work/scripts -type f -name "*.sh" -print0 | xargs -0 -r dos2unix -f || true
|
||||||
|
156
docs/INDEX.md
156
docs/INDEX.md
@ -1,2 +1,156 @@
|
|||||||
# Index
|
# 📚 Index de Documentation - 4NK_template
|
||||||
|
|
||||||
|
Index complet de la documentation du template 4NK pour la création de nouveaux projets.
|
||||||
|
|
||||||
|
## 🚀 Vue d'Ensemble
|
||||||
|
|
||||||
|
4NK_template est un template complet pour créer de nouveaux projets dans l'écosystème 4NK. Il fournit une structure standardisée avec tous les éléments nécessaires pour un projet open source moderne.
|
||||||
|
|
||||||
|
## 📖 Guides Principaux
|
||||||
|
|
||||||
|
### 🚀 [Guide d'Installation](INSTALLATION.md)
|
||||||
|
Guide complet pour installer et configurer un nouveau projet basé sur 4NK_template.
|
||||||
|
- **Prérequis système et logiciels**
|
||||||
|
- **Installation du template**
|
||||||
|
- **Configuration initiale**
|
||||||
|
- **Personnalisation du projet**
|
||||||
|
- **Tests post-installation**
|
||||||
|
|
||||||
|
### 📖 [Guide d'Utilisation](USAGE.md)
|
||||||
|
Guide complet pour utiliser le template et créer de nouveaux projets.
|
||||||
|
- **Création d'un nouveau projet**
|
||||||
|
- **Personnalisation de la structure**
|
||||||
|
- **Configuration des scripts**
|
||||||
|
- **Adaptation de la documentation**
|
||||||
|
- **Tests et validation**
|
||||||
|
|
||||||
|
### ⚙️ [Guide de Configuration](CONFIGURATION.md)
|
||||||
|
Guide complet pour configurer le template selon vos besoins.
|
||||||
|
- **Configuration générale**
|
||||||
|
- **Personnalisation des scripts**
|
||||||
|
- **Configuration CI/CD**
|
||||||
|
- **Configuration Docker**
|
||||||
|
- **Configuration de sécurité**
|
||||||
|
|
||||||
|
## 🔧 Guides Techniques
|
||||||
|
|
||||||
|
### 🏗️ [Architecture Technique](ARCHITECTURE.md)
|
||||||
|
Documentation technique détaillée de l'architecture du template.
|
||||||
|
- **Structure générale du template**
|
||||||
|
- **Composants principaux**
|
||||||
|
- **Scripts et utilitaires**
|
||||||
|
- **Configuration Docker**
|
||||||
|
- **Intégration CI/CD**
|
||||||
|
- **Sécurité et bonnes pratiques**
|
||||||
|
|
||||||
|
### 📡 [API Reference](API.md)
|
||||||
|
Documentation des APIs et interfaces du template.
|
||||||
|
- **Scripts disponibles**
|
||||||
|
- **Configuration des hooks Git**
|
||||||
|
- **Variables d'environnement**
|
||||||
|
- **Format des fichiers de configuration**
|
||||||
|
|
||||||
|
### 🔒 [Sécurité](SECURITY.md)
|
||||||
|
Guide de sécurité et bonnes pratiques.
|
||||||
|
- **Audit de sécurité**
|
||||||
|
- **Bonnes pratiques**
|
||||||
|
- **Configuration sécurisée**
|
||||||
|
- **Tests de sécurité**
|
||||||
|
|
||||||
|
## 🧪 Guides de Test
|
||||||
|
|
||||||
|
### 🧪 [Guide des Tests](TESTING.md)
|
||||||
|
Guide complet pour les tests du template.
|
||||||
|
- **Tests unitaires**
|
||||||
|
- **Tests d'intégration**
|
||||||
|
- **Tests de sécurité**
|
||||||
|
- **Tests de configuration**
|
||||||
|
|
||||||
|
### 🔍 [Audit de Sécurité](SECURITY_AUDIT.md)
|
||||||
|
Audit de sécurité détaillé du template.
|
||||||
|
- **Vulnérabilités connues**
|
||||||
|
- **Tests de pénétration**
|
||||||
|
- **Audit de code**
|
||||||
|
- **Recommandations de sécurité**
|
||||||
|
|
||||||
|
## 🔧 Guides de Développement
|
||||||
|
|
||||||
|
### 🔧 [Guide de Développement](DEVELOPMENT.md)
|
||||||
|
Guide complet pour le développement avec le template.
|
||||||
|
- **Environnement de développement**
|
||||||
|
- **Workflow de développement**
|
||||||
|
- **Standards de code**
|
||||||
|
- **Debugging et profiling**
|
||||||
|
- **Optimisation des performances**
|
||||||
|
|
||||||
|
## 📊 Déploiement
|
||||||
|
|
||||||
|
### 🚀 [Guide de Déploiement](DEPLOYMENT.md)
|
||||||
|
Guide complet pour déployer des projets basés sur le template.
|
||||||
|
- **Configuration de production**
|
||||||
|
- **Déploiement Docker**
|
||||||
|
- **Intégration CI/CD**
|
||||||
|
- **Monitoring et observabilité**
|
||||||
|
|
||||||
|
## 🎯 Navigation Rapide
|
||||||
|
|
||||||
|
### 🚀 Démarrage Rapide
|
||||||
|
1. [Installation](INSTALLATION.md) - Installer le template
|
||||||
|
2. [Configuration](CONFIGURATION.md) - Configurer le projet
|
||||||
|
3. [Utilisation](USAGE.md) - Créer un nouveau projet
|
||||||
|
|
||||||
|
### 🔧 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. [Déploiement](DEPLOYMENT.md) - Guide de déploiement
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧪 Tests et Validation
|
||||||
|
|
||||||
|
### Tests Automatisés
|
||||||
|
```bash
|
||||||
|
# Tests du template
|
||||||
|
./scripts/test-template.sh
|
||||||
|
|
||||||
|
# Tests de configuration
|
||||||
|
./scripts/test-config.sh
|
||||||
|
|
||||||
|
# Tests de sécurité
|
||||||
|
./scripts/security-audit.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Développement
|
||||||
|
|
||||||
|
### Commandes Essentielles
|
||||||
|
```bash
|
||||||
|
# Créer un nouveau projet
|
||||||
|
./scripts/create-project.sh my-new-project
|
||||||
|
|
||||||
|
# Configurer un projet existant
|
||||||
|
./scripts/setup-project.sh
|
||||||
|
|
||||||
|
# Tests du template
|
||||||
|
./scripts/test-template.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 Métriques
|
||||||
|
|
||||||
|
### Fonctionnalités
|
||||||
|
- **Structure standardisée** : ✅ Complète
|
||||||
|
- **Scripts automatisés** : ✅ Disponibles
|
||||||
|
- **Configuration CI/CD** : ✅ Intégrée
|
||||||
|
- **Documentation** : ✅ Template complet
|
||||||
|
- **Tests** : ✅ Automatisés
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**📚 Documentation complète pour 4NK_template - Template pour nouveaux projets 4NK** 🚀
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
### Installation des dépendances hôte (Debian/Ubuntu)
|
||||||
|
|
||||||
|
Exécuter en root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ./scripts/local/install_host_deps.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Ce script installe: `dos2unix`, `rsync`, `direnv`, `git`, `curl`, `vim`, `tree`, `sed`, `net-tools`, `iproute2`, `procps`, `lsof`, `psmisc`, `htop`, `dstat`, `iotop`, `strace`, `ltrace`, `tcpdump`, `nmap`, `wget`, `jq`, `gawk`, `grep`, `coreutils`, `dnsutils`, `traceroute`, `whois`, `sysstat`, `iputils-ping`, `iputils-tracepath`, ainsi que Docker (`docker-ce`, `docker-ce-cli`, `containerd.io`, `docker-buildx-plugin`, `docker-compose-plugin`).
|
||||||
|
|
||||||
# Guide d’usage — 4NK_template (projet)
|
# Guide d’usage — 4NK_template (projet)
|
||||||
|
|
||||||
Ce document explique comment utiliser le template pour initier, documenter, contrôler et publier des projets dérivés, en respectant les standards qualité, sécurité et open source.
|
Ce document explique comment utiliser le template pour initier, documenter, contrôler et publier des projets dérivés, en respectant les standards qualité, sécurité et open source.
|
||||||
@ -75,26 +85,31 @@ git tag -a vYYYY.MM.P -m "release: vYYYY.MM.P (latest)"
|
|||||||
git push && git push origin vYYYY.MM.P
|
git push && git push origin vYYYY.MM.P
|
||||||
```
|
```
|
||||||
|
|
||||||
### Hooks conseillés
|
### Hooks conseillés (agents centralisés via 4NK_template)
|
||||||
|
|
||||||
`.git/hooks/pre-commit`:
|
`.git/hooks/pre-commit`:
|
||||||
```bash
|
```bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
npx -y markdownlint-cli "**/*.md" --ignore "archive/**"
|
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
AUTO_FIX=1 SCOPE=changed scripts/agents/run.sh
|
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"
|
||||||
```
|
```
|
||||||
|
|
||||||
`.git/hooks/pre-push`:
|
`.git/hooks/pre-push`:
|
||||||
```bash
|
```bash
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
AUTO_FIX=1 SCOPE=all scripts/agents/run.sh
|
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
bash scripts/security/audit.sh || true
|
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
|
||||||
bash scripts/release/guard.sh || true
|
mkdir -p "${PROJECT_DIR}/tests/reports/agents"
|
||||||
|
"${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
|
||||||
|
if [ -f "${PROJECT_DIR}/scripts/security/audit.sh" ]; then (cd "${PROJECT_DIR}" && bash scripts/security/audit.sh) || true; fi
|
||||||
|
if [ -f "${PROJECT_DIR}/scripts/release/guard.sh" ]; then (cd "${PROJECT_DIR}" && bash scripts/release/guard.sh) || true; fi
|
||||||
```
|
```
|
||||||
|
|
||||||
Ou installez-les automatiquement:
|
Ou installez-les automatiquement (les hooks fournis appellent déjà le runner centralisé):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash scripts/local/install_hooks.sh
|
bash scripts/local/install_hooks.sh
|
||||||
|
8
docs/templates/API.md
vendored
8
docs/templates/API.md
vendored
@ -1,8 +0,0 @@
|
|||||||
# Référence API — Template
|
|
||||||
|
|
||||||
- Vue d’ensemble
|
|
||||||
- Authentification/permissions
|
|
||||||
- Endpoints par domaine (schémas, invariants)
|
|
||||||
- Codes d’erreur
|
|
||||||
- Limites et quotas
|
|
||||||
- Sécurité et conformité
|
|
8
docs/templates/ARCHITECTURE.md
vendored
8
docs/templates/ARCHITECTURE.md
vendored
@ -1,8 +0,0 @@
|
|||||||
# Architecture — Template
|
|
||||||
|
|
||||||
- Contexte et objectifs
|
|
||||||
- Découpage en couches (UI, services, données)
|
|
||||||
- Flux principaux
|
|
||||||
- Observabilité
|
|
||||||
- CI/CD
|
|
||||||
- Contraintes et SLA
|
|
6
docs/templates/CONFIGURATION.md
vendored
6
docs/templates/CONFIGURATION.md
vendored
@ -1,6 +0,0 @@
|
|||||||
# Configuration — Template
|
|
||||||
|
|
||||||
- Variables d’environnement (nom, type, défaut, portée)
|
|
||||||
- Fichiers de configuration (format, validation)
|
|
||||||
- Réseau et sécurité (ports, TLS, auth)
|
|
||||||
- Observabilité (logs, métriques, traces)
|
|
12
docs/templates/INDEX.md
vendored
12
docs/templates/INDEX.md
vendored
@ -1,12 +0,0 @@
|
|||||||
# Index — Templates de documentation (pour projets dérivés)
|
|
||||||
|
|
||||||
Utilisez ces squelettes pour démarrer la documentation de votre projet.
|
|
||||||
|
|
||||||
- API.md — squelette de référence API
|
|
||||||
- ARCHITECTURE.md — squelette d’architecture
|
|
||||||
- CONFIGURATION.md — squelette de configuration
|
|
||||||
- USAGE.md — squelette d’usage
|
|
||||||
- TESTING.md — squelette de stratégie de tests
|
|
||||||
- SECURITY_AUDIT.md — squelette d’audit sécurité
|
|
||||||
- RELEASE_PLAN.md — squelette de plan de release
|
|
||||||
- OPEN_SOURCE_CHECKLIST.md — squelette de checklist open source
|
|
7
docs/templates/OPEN_SOURCE_CHECKLIST.md
vendored
7
docs/templates/OPEN_SOURCE_CHECKLIST.md
vendored
@ -1,7 +0,0 @@
|
|||||||
# Checklist open source — Template
|
|
||||||
|
|
||||||
- Gouvernance: LICENSE, CONTRIBUTING, CODE_OF_CONDUCT
|
|
||||||
- CI/CD: workflows, tests, security-audit, release-guard
|
|
||||||
- Documentation: README, INDEX, guides essentiels
|
|
||||||
- Sécurité: secrets, permissions, audit
|
|
||||||
- Publication: tag, changelog, release notes
|
|
29
docs/templates/README.md
vendored
29
docs/templates/README.md
vendored
@ -1,29 +0,0 @@
|
|||||||
# README — Template de projet
|
|
||||||
|
|
||||||
## Présentation
|
|
||||||
|
|
||||||
Décrivez brièvement l’objectif du projet, son périmètre et ses utilisateurs cibles.
|
|
||||||
|
|
||||||
## Démarrage rapide
|
|
||||||
|
|
||||||
- Prérequis (langages/outils)
|
|
||||||
- Étapes d’installation
|
|
||||||
- Commandes de démarrage
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- Index: `docs/INDEX.md`
|
|
||||||
- Architecture: `docs/ARCHITECTURE.md`
|
|
||||||
- Configuration: `docs/CONFIGURATION.md`
|
|
||||||
- Tests: `docs/TESTING.md`
|
|
||||||
- Sécurité: `docs/SECURITY_AUDIT.md`
|
|
||||||
- Déploiement: `docs/DEPLOYMENT.md`
|
|
||||||
|
|
||||||
## Contribution
|
|
||||||
|
|
||||||
- GUIDE: `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`
|
|
||||||
- Processus de PR et revues
|
|
||||||
|
|
||||||
## Licence
|
|
||||||
|
|
||||||
- Indiquez la licence choisie (MIT/Apache-2.0/GPL)
|
|
7
docs/templates/RELEASE_PLAN.md
vendored
7
docs/templates/RELEASE_PLAN.md
vendored
@ -1,7 +0,0 @@
|
|||||||
# Plan de release — Template
|
|
||||||
|
|
||||||
- Vue d’ensemble, objectifs, date cible
|
|
||||||
- Préparation (docs/CI/tests/sécurité)
|
|
||||||
- Communication (annonces, canaux)
|
|
||||||
- Lancement (checklist, tagging)
|
|
||||||
- Post‑lancement (support, retours)
|
|
7
docs/templates/SECURITY_AUDIT.md
vendored
7
docs/templates/SECURITY_AUDIT.md
vendored
@ -1,7 +0,0 @@
|
|||||||
# Audit de sécurité — Template
|
|
||||||
|
|
||||||
- Menaces et surfaces d’attaque
|
|
||||||
- Contrôles préventifs et détectifs
|
|
||||||
- Gestion des secrets
|
|
||||||
- Politique de dépendances
|
|
||||||
- Vérifications CI (security-audit)
|
|
6
docs/templates/TESTING.md
vendored
6
docs/templates/TESTING.md
vendored
@ -1,6 +0,0 @@
|
|||||||
# Tests — Template
|
|
||||||
|
|
||||||
- Pyramide: unit, integration, connectivity, external, performance
|
|
||||||
- Structure des répertoires
|
|
||||||
- Exécution et rapports
|
|
||||||
- Intégration CI
|
|
7
docs/templates/USAGE.md
vendored
7
docs/templates/USAGE.md
vendored
@ -1,7 +0,0 @@
|
|||||||
# Usage — Template
|
|
||||||
|
|
||||||
- Démarrage quotidien
|
|
||||||
- Opérations courantes
|
|
||||||
- Tests (référence vers TESTING.md)
|
|
||||||
- Sécurité (référence vers SECURITY_AUDIT.md)
|
|
||||||
- Déploiement (référence vers DEPLOYMENT.md)
|
|
0
scripts/agents/ai_prompt.sh
Normal file → Executable file
0
scripts/agents/ai_prompt.sh
Normal file → Executable file
2
scripts/agents/common.sh
Normal file → Executable file
2
scripts/agents/common.sh
Normal file → Executable file
@ -6,7 +6,7 @@ export SCOPE="${SCOPE:-all}"
|
|||||||
|
|
||||||
list_changed_paths() {
|
list_changed_paths() {
|
||||||
# Renvoie la liste des chemins modifiés (HEAD~1..HEAD), ou vide si non dispo
|
# 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
|
git -C "${TARGET_DIR:-.}" diff --name-only HEAD~1..HEAD 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
is_path_changed() {
|
is_path_changed() {
|
||||||
|
0
scripts/agents/compilation_agent.sh
Normal file → Executable file
0
scripts/agents/compilation_agent.sh
Normal file → Executable file
0
scripts/agents/dependances_agent.sh
Normal file → Executable file
0
scripts/agents/dependances_agent.sh
Normal file → Executable file
0
scripts/agents/deployment_agent.sh
Normal file → Executable file
0
scripts/agents/deployment_agent.sh
Normal file → Executable file
0
scripts/agents/derogations_locales_agent.sh
Normal file → Executable file
0
scripts/agents/derogations_locales_agent.sh
Normal file → Executable file
0
scripts/agents/documentation_agent.sh
Normal file → Executable file
0
scripts/agents/documentation_agent.sh
Normal file → Executable file
2
scripts/agents/documents_bureautiques_agent.sh
Normal file → Executable file
2
scripts/agents/documents_bureautiques_agent.sh
Normal file → Executable file
@ -10,7 +10,7 @@ echo "# Agent Documents bureautiques" > "$SUMMARY_FILE"
|
|||||||
echo >> "$SUMMARY_FILE"
|
echo >> "$SUMMARY_FILE"
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
pushd "$TARGET_DIR" >/dev/null
|
||||||
docsx=$(git ls-files '*.docx' 2>/dev/null || true)
|
docsx=$(git -C "$TARGET_DIR" ls-files '*.docx' 2>/dev/null || true)
|
||||||
if [[ -z "$docsx" ]]; then
|
if [[ -z "$docsx" ]]; then
|
||||||
echo "- Aucun fichier .docx détecté." >> "$SUMMARY_FILE"
|
echo "- Aucun fichier .docx détecté." >> "$SUMMARY_FILE"
|
||||||
else
|
else
|
||||||
|
2
scripts/agents/donnees_csv_agent.sh
Normal file → Executable file
2
scripts/agents/donnees_csv_agent.sh
Normal file → Executable file
@ -10,7 +10,7 @@ echo "# Agent Données CSV" > "$SUMMARY_FILE"
|
|||||||
echo >> "$SUMMARY_FILE"
|
echo >> "$SUMMARY_FILE"
|
||||||
|
|
||||||
pushd "$TARGET_DIR" >/dev/null
|
pushd "$TARGET_DIR" >/dev/null
|
||||||
csvs=$(git ls-files '*.csv' 2>/dev/null || true)
|
csvs=$(git -C "$TARGET_DIR" ls-files '*.csv' 2>/dev/null || true)
|
||||||
if [[ -z "$csvs" ]]; then
|
if [[ -z "$csvs" ]]; then
|
||||||
echo "- Aucun CSV détecté dans le dépôt." >> "$SUMMARY_FILE"
|
echo "- Aucun CSV détecté dans le dépôt." >> "$SUMMARY_FILE"
|
||||||
else
|
else
|
||||||
|
0
scripts/agents/fondation_agent.sh
Normal file → Executable file
0
scripts/agents/fondation_agent.sh
Normal file → Executable file
0
scripts/agents/frontend_agent.sh
Normal file → Executable file
0
scripts/agents/frontend_agent.sh
Normal file → Executable file
0
scripts/agents/gitea_agent.sh
Normal file → Executable file
0
scripts/agents/gitea_agent.sh
Normal file → Executable file
8
scripts/agents/lang_detect.sh
Normal file → Executable file
8
scripts/agents/lang_detect.sh
Normal file → Executable file
@ -12,7 +12,7 @@ export HAS_NODE=0 HAS_TYPESCRIPT=0 HAS_GO=0 HAS_RUST=0 HAS_PYTHON=0 HAS_SHELL_BA
|
|||||||
|
|
||||||
# Node / TypeScript
|
# Node / TypeScript
|
||||||
if has_file package.json; then HAS_NODE=1; fi
|
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
|
if has_file tsconfig.json || git -C "${TARGET_DIR:-.}" ls-files '*.ts' | grep -q . 2>/dev/null; then HAS_TYPESCRIPT=1; fi
|
||||||
|
|
||||||
# Go
|
# Go
|
||||||
if has_file go.mod || has_file go.work; then HAS_GO=1; fi
|
if has_file go.mod || has_file go.work; then HAS_GO=1; fi
|
||||||
@ -21,13 +21,13 @@ if has_file go.mod || has_file go.work; then HAS_GO=1; fi
|
|||||||
if has_file Cargo.toml; then HAS_RUST=1; fi
|
if has_file Cargo.toml; then HAS_RUST=1; fi
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
if has_file pyproject.toml || has_file requirements.txt || git ls-files '*.py' | grep -q . 2>/dev/null; then HAS_PYTHON=1; fi
|
if has_file pyproject.toml || has_file requirements.txt || git -C "${TARGET_DIR:-.}" ls-files '*.py' | grep -q . 2>/dev/null; then HAS_PYTHON=1; fi
|
||||||
|
|
||||||
# Shell (bash)
|
# Shell (bash)
|
||||||
if git ls-files '*.sh' | grep -q . 2>/dev/null; then HAS_SHELL_BASH=1; fi
|
if git -C "${TARGET_DIR:-.}" ls-files '*.sh' | grep -q . 2>/dev/null; then HAS_SHELL_BASH=1; fi
|
||||||
|
|
||||||
# PowerShell (pwsh)
|
# PowerShell (pwsh)
|
||||||
if git ls-files '*.ps1' | grep -q . 2>/dev/null; then HAS_SHELL_PWSH=1; fi
|
if git -C "${TARGET_DIR:-.}" ls-files '*.ps1' | grep -q . 2>/dev/null; then HAS_SHELL_PWSH=1; fi
|
||||||
|
|
||||||
# Exposer aussi l'état des outils lorsqu’ils existent
|
# 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
|
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
|
||||||
|
0
scripts/agents/open_source_agent.sh
Normal file → Executable file
0
scripts/agents/open_source_agent.sh
Normal file → Executable file
0
scripts/agents/performance_agent.sh
Normal file → Executable file
0
scripts/agents/performance_agent.sh
Normal file → Executable file
0
scripts/agents/qualite_formelle.sh
Normal file → Executable file
0
scripts/agents/qualite_formelle.sh
Normal file → Executable file
2
scripts/agents/quality_tech.sh
Normal file → Executable file
2
scripts/agents/quality_tech.sh
Normal file → Executable file
@ -75,7 +75,7 @@ if [[ "$HAS_PYTHON" -eq 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
if [[ "$HAS_SHELL_BASH" -eq 1 ]]; then
|
if [[ "$HAS_SHELL_BASH" -eq 1 ]]; then
|
||||||
if [[ "$HAS_SHELLCHECK" -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"
|
(git -C "$TARGET_DIR" 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
|
else
|
||||||
echo "- Shell: shellcheck non disponible" >> "$SUMMARY_FILE"
|
echo "- Shell: shellcheck non disponible" >> "$SUMMARY_FILE"
|
||||||
fi
|
fi
|
||||||
|
0
scripts/agents/resolution_agent.sh
Normal file → Executable file
0
scripts/agents/resolution_agent.sh
Normal file → Executable file
167
scripts/agents/run.sh
Normal file → Executable file
167
scripts/agents/run.sh
Normal file → Executable file
@ -12,98 +12,105 @@ fi
|
|||||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
TARGET_DIR="${1:-.}"
|
TARGET_DIR="${1:-.}"
|
||||||
OUTPUT_DIR="${2:-tests/reports/agents}"
|
OUTPUT_DIR="${2:-tests/reports/agents}"
|
||||||
|
AGENT="${3:-all}"
|
||||||
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
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 -C "$TARGET_DIR" status --porcelain || true) > "$before_status_file" 2>/dev/null || true
|
||||||
|
popd >/dev/null || true
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<USAGE
|
cat <<USAGE
|
||||||
Usage: $0 [target_dir] [output_dir] [agent]
|
Usage: $0 [target_dir] [output_dir] [agent]
|
||||||
Agents:
|
Agents: fondation, structure, documentation, donnees-csv, documents-bureautiques,
|
||||||
Fondamentaux: fondation, structure
|
tests, performance, qualite-technique/quality-tech, dependances, compilation,
|
||||||
Documentation: documentation, donnees-csv, documents-bureautiques
|
resolution, ssh-scripts, frontend, open-source, gitea, versionnage,
|
||||||
Tests: tests, performance
|
securite, deploiement, sync-template, derogations-locales, runner, all
|
||||||
Techniques: qualite-technique, quality-tech, dependances, compilation, resolution, ssh-scripts
|
|
||||||
Frontend: frontend
|
|
||||||
Open source et CI: open-source, gitea, versionnage, securite, deploiement
|
|
||||||
Synchronisation: sync-template, derogations-locales
|
|
||||||
Runner: runne
|
|
||||||
all
|
|
||||||
Par défaut: all
|
|
||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
AGENT="${3:-all}"
|
run_agent() {
|
||||||
|
local script_name="$1"
|
||||||
|
"$DIR/${script_name}" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||||
|
}
|
||||||
|
|
||||||
case "$AGENT" in
|
case "$AGENT" in
|
||||||
runner)
|
runner) run_agent "runner_agent.sh" ;;
|
||||||
"$DIR/runner_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
quality-tech|qualite-technique) run_agent "quality_tech.sh" ;;
|
||||||
quality-tech|qualite-technique)
|
qualite-formelle|fondation) "$DIR/qualite_formelle.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true; "$DIR/fondation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true ;;
|
||||||
"$DIR/quality_tech.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
structure) run_agent "structure_agent.sh" ;;
|
||||||
qualite-formelle|fondation)
|
tests) run_agent "tests_agent.sh" ;;
|
||||||
"$DIR/qualite_formelle.sh" "$TARGET_DIR" "$OUTPUT_DIR" || "$DIR/fondation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
performance) run_agent "performance_agent.sh" ;;
|
||||||
structure)
|
documentation) run_agent "documentation_agent.sh" ;;
|
||||||
"$DIR/structure_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
donnees-csv) run_agent "donnees_csv_agent.sh" ;;
|
||||||
tests)
|
documents-bureautiques)run_agent "documents_bureautiques_agent.sh" ;;
|
||||||
"$DIR/tests_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
securite) run_agent "security_agent.sh" ;;
|
||||||
performance)
|
deploiement) run_agent "deployment_agent.sh" ;;
|
||||||
"$DIR/performance_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
dependances) run_agent "dependances_agent.sh" ;;
|
||||||
documentation)
|
compilation) run_agent "compilation_agent.sh" ;;
|
||||||
"$DIR/documentation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
resolution) run_agent "resolution_agent.sh" ;;
|
||||||
donnees-csv)
|
ssh-scripts) run_agent "ssh_scripts_agent.sh" ;;
|
||||||
"$DIR/donnees_csv_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
frontend) run_agent "frontend_agent.sh" ;;
|
||||||
documents-bureautiques)
|
open-source) run_agent "open_source_agent.sh" ;;
|
||||||
"$DIR/documents_bureautiques_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
gitea) run_agent "gitea_agent.sh" ;;
|
||||||
securite)
|
versionnage) run_agent "versionnage_agent.sh" ;;
|
||||||
"$DIR/security_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
sync-template) run_agent "sync_template_agent.sh" ;;
|
||||||
deploiement)
|
derogations-locales) run_agent "derogations_locales_agent.sh" ;;
|
||||||
"$DIR/deployment_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
dependances)
|
|
||||||
"$DIR/dependances_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
compilation)
|
|
||||||
"$DIR/compilation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
resolution)
|
|
||||||
"$DIR/resolution_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
ssh-scripts)
|
|
||||||
"$DIR/ssh_scripts_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
frontend)
|
|
||||||
"$DIR/frontend_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
open-source)
|
|
||||||
"$DIR/open_source_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
gitea)
|
|
||||||
"$DIR/gitea_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
versionnage)
|
|
||||||
"$DIR/versionnage_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
sync-template)
|
|
||||||
"$DIR/sync_template_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
derogations-locales)
|
|
||||||
"$DIR/derogations_locales_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
|
||||||
all)
|
all)
|
||||||
"$DIR/runner_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
for a in \
|
||||||
"$DIR/quality_tech.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
runner_agent.sh quality_tech.sh qualite_formelle.sh fondation_agent.sh structure_agent.sh \
|
||||||
"$DIR/qualite_formelle.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
tests_agent.sh performance_agent.sh documentation_agent.sh donnees_csv_agent.sh \
|
||||||
"$DIR/fondation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
documents_bureautiques_agent.sh security_agent.sh deployment_agent.sh dependances_agent.sh \
|
||||||
"$DIR/structure_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
compilation_agent.sh resolution_agent.sh ssh_scripts_agent.sh frontend_agent.sh \
|
||||||
"$DIR/tests_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
open_source_agent.sh gitea_agent.sh versionnage_agent.sh sync_template_agent.sh derogations_locales_agent.sh; do
|
||||||
"$DIR/performance_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
"$DIR/$a" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||||
"$DIR/documentation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
done ;;
|
||||||
"$DIR/donnees_csv_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
-h|--help) usage; exit 0 ;;
|
||||||
"$DIR/documents_bureautiques_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
*) echo "Agent inconnu: $AGENT" >&2; usage; exit 2 ;;
|
||||||
"$DIR/security_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
|
||||||
"$DIR/deployment_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
|
||||||
"$DIR/dependances_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/compilation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/resolution_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/ssh_scripts_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/frontend_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/open_source_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/gitea_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/versionnage_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/sync_template_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
|
||||||
"$DIR/derogations_locales_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true ;;
|
|
||||||
-h|--help)
|
|
||||||
usage; exit 0 ;;
|
|
||||||
*)
|
|
||||||
echo "Agent inconnu: $AGENT" >&2; usage; exit 2 ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Capture état après et rapport
|
||||||
|
pushd "$TARGET_DIR" >/dev/null || true
|
||||||
|
(git -C "$TARGET_DIR" 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"
|
||||||
|
if git -C "$TARGET_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
git -C "$TARGET_DIR" diff --name-status || true
|
||||||
|
else
|
||||||
|
echo "(pas un dépôt git, diff ignoré)"
|
||||||
|
fi
|
||||||
|
} > "$changes_report"
|
||||||
|
popd >/dev/null || true
|
||||||
|
|
||||||
echo "Agents terminés → $OUTPUT_DIR"
|
echo "Agents terminés → $OUTPUT_DIR"
|
||||||
|
|
||||||
|
# Affichage des rapports générés
|
||||||
|
echo
|
||||||
|
echo "=== RAPPORTS GÉNÉRÉS ==="
|
||||||
|
if [[ -d "$OUTPUT_DIR" ]]; then
|
||||||
|
for report in "$OUTPUT_DIR"/*.md; do
|
||||||
|
if [[ -f "$report" ]]; then
|
||||||
|
echo
|
||||||
|
echo "📄 $(basename "$report"):"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
cat "$report"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Aucun rapport généré dans $OUTPUT_DIR"
|
||||||
|
fi
|
||||||
|
echo "=== FIN DES RAPPORTS ==="
|
||||||
|
0
scripts/agents/runner_agent.sh
Normal file → Executable file
0
scripts/agents/runner_agent.sh
Normal file → Executable file
0
scripts/agents/security_agent.sh
Normal file → Executable file
0
scripts/agents/security_agent.sh
Normal file → Executable file
0
scripts/agents/ssh_scripts_agent.sh
Normal file → Executable file
0
scripts/agents/ssh_scripts_agent.sh
Normal file → Executable file
0
scripts/agents/structure_agent.sh
Normal file → Executable file
0
scripts/agents/structure_agent.sh
Normal file → Executable file
0
scripts/agents/sync_template_agent.sh
Normal file → Executable file
0
scripts/agents/sync_template_agent.sh
Normal file → Executable file
0
scripts/agents/tests_agent.sh
Normal file → Executable file
0
scripts/agents/tests_agent.sh
Normal file → Executable file
0
scripts/agents/versionnage_agent.sh
Normal file → Executable file
0
scripts/agents/versionnage_agent.sh
Normal file → Executable file
0
scripts/checks/version_alignment.sh
Normal file → Executable file
0
scripts/checks/version_alignment.sh
Normal file → Executable file
0
scripts/deploy/setup.sh
Normal file → Executable file
0
scripts/deploy/setup.sh
Normal file → Executable file
0
scripts/dev/run_container.sh
Normal file → Executable file
0
scripts/dev/run_container.sh
Normal file → Executable file
0
scripts/dev/run_project_ci.sh
Normal file → Executable file
0
scripts/dev/run_project_ci.sh
Normal file → Executable file
0
scripts/env/ensure_env.sh
vendored
Normal file → Executable file
0
scripts/env/ensure_env.sh
vendored
Normal file → Executable file
3
scripts/local/install_hooks.sh
Normal file → Executable file
3
scripts/local/install_hooks.sh
Normal file → Executable file
@ -12,7 +12,8 @@ install_hook() {
|
|||||||
echo "Installed hook: $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-commit "$REPO_ROOT/scripts/local/precommit.sh"
|
||||||
install_hook pre-push "$REPO_ROOT/scripts/local/prepush.sh"
|
install_hook pre-push "$REPO_ROOT/scripts/local/prepush.sh"
|
||||||
|
|
||||||
echo "Hooks installés."
|
echo "Hooks installés (mode agents via 4NK_template)."
|
||||||
|
22
scripts/local/install_host_deps.sh
Executable file
22
scripts/local/install_host_deps.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Installation des dépendances hôte nécessaires aux projets 4NK
|
||||||
|
# Usage: sudo ./scripts/local/install_host_deps.sh
|
||||||
|
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "Veuillez exécuter ce script avec sudo." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Base outils CLI utiles
|
||||||
|
apt update -y
|
||||||
|
apt install -y dos2unix rsync direnv git curl vim tree sed net-tools iproute2 procps \
|
||||||
|
lsof psmisc tree htop dstat iotop strace ltrace tcpdump nmap curl wget jq sed gawk \
|
||||||
|
grep coreutils dnsutils traceroute whois sysstat iputils-ping iputils-tracepath
|
||||||
|
|
||||||
|
# Docker (requires docker repository préconfiguré)
|
||||||
|
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
|
||||||
|
echo "Dépendances hôte installées."
|
||||||
|
|
0
scripts/local/merge_branch.sh
Normal file → Executable file
0
scripts/local/merge_branch.sh
Normal file → Executable file
16
scripts/local/precommit.sh
Normal file → Executable file
16
scripts/local/precommit.sh
Normal file → Executable file
@ -1,15 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
# Exécuter les agents depuis l'image Docker de 4NK_template sur le projet courant
|
||||||
cd "$ROOT_DIR/.."
|
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
|
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
|
||||||
|
|
||||||
# Lint Markdown (best effort)
|
mkdir -p "${PROJECT_DIR}/tests/reports/agents"
|
||||||
if command -v npx >/dev/null 2>&1; then
|
"${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
|
||||||
npx -y markdownlint-cli "**/*.md" --ignore "archive/**" || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Agents rapides sur fichiers modifiés
|
echo "[pre-commit] OK (agents via 4NK_template)"
|
||||||
AUTO_FIX="${AUTO_FIX:-1}" SCOPE="${SCOPE:-changed}" scripts/agents/run.sh
|
|
||||||
|
|
||||||
echo "[pre-commit] OK"
|
|
||||||
|
23
scripts/local/prepush.sh
Normal file → Executable file
23
scripts/local/prepush.sh
Normal file → Executable file
@ -1,20 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
# Exécuter les agents depuis l'image Docker de 4NK_template sur le projet courant
|
||||||
cd "$ROOT_DIR/.."
|
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
|
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
|
||||||
|
|
||||||
# Agents complets
|
mkdir -p "${PROJECT_DIR}/tests/reports/agents"
|
||||||
AUTO_FIX="${AUTO_FIX:-1}" SCOPE="${SCOPE:-all}" scripts/agents/run.sh
|
"${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
|
||||||
|
|
||||||
# Audit sécurité (best effort)
|
# Audit sécurité (best effort) dans le contexte du projet
|
||||||
if [ -f scripts/security/audit.sh ]; then
|
if [ -f "${PROJECT_DIR}/scripts/security/audit.sh" ]; then
|
||||||
bash scripts/security/audit.sh || true
|
(cd "${PROJECT_DIR}" && bash scripts/security/audit.sh) || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Release guard (dry-run logique)
|
# Release guard (dry-run logique) dans le contexte du projet
|
||||||
if [ -f scripts/release/guard.sh ]; then
|
if [ -f "${PROJECT_DIR}/scripts/release/guard.sh" ]; then
|
||||||
bash scripts/release/guard.sh || true
|
(cd "${PROJECT_DIR}" && bash scripts/release/guard.sh) || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[pre-push] OK"
|
echo "[pre-push] OK (agents via 4NK_template)"
|
||||||
|
0
scripts/local/release_local.sh
Normal file → Executable file
0
scripts/local/release_local.sh
Normal file → Executable file
51
scripts/local/run_agents_for_project.sh
Executable file
51
scripts/local/run_agents_for_project.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/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
Normal file → Executable file
0
scripts/release/guard.sh
Normal file → Executable file
23
scripts/scripts/auto-ssh-push.sh
Normal file → Executable file
23
scripts/scripts/auto-ssh-push.sh
Normal file → Executable file
@ -26,8 +26,23 @@ 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=${1:-$(git branch --show-current)}
|
local branch
|
||||||
|
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"
|
||||||
@ -54,7 +69,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:-$(git branch --show-current)}
|
local branch=${2:-$(get_current_branch)}
|
||||||
|
|
||||||
echo "💬 Push avec message: $message"
|
echo "💬 Push avec message: $message"
|
||||||
auto_push "$branch" "$message"
|
auto_push "$branch" "$message"
|
||||||
@ -62,7 +77,7 @@ push_with_message() {
|
|||||||
|
|
||||||
# Fonction pour push rapide (sans message)
|
# Fonction pour push rapide (sans message)
|
||||||
quick_push() {
|
quick_push() {
|
||||||
local branch=${1:-$(git branch --show-current)}
|
local branch=${1:-$(get_current_branch)}
|
||||||
auto_push "$branch"
|
auto_push "$branch"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +92,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:-$(git branch --show-current)}
|
local source_branch=${1:-$(get_current_branch)}
|
||||||
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"
|
||||||
|
4
scripts/scripts/init-ssh-env.sh
Normal file → Executable file
4
scripts/scripts/init-ssh-env.sh
Normal file → Executable file
@ -44,8 +44,8 @@ fi
|
|||||||
|
|
||||||
# 4. Alias Git
|
# 4. Alias Git
|
||||||
print_status "Configuration des alias Git..."
|
print_status "Configuration des alias Git..."
|
||||||
git config --global alias.ssh-push '!f() { git add . && git commit -m "${1:-Auto-commit $(date)}" && git push origin $(git branch --show-current); }; f'
|
git config --global alias.ssh-push '!f() { git add . && git commit -m "${1:-Auto-commit $(date)}" && git push origin $(git rev-parse --abbrev-ref HEAD); }; f'
|
||||||
git config --global alias.quick-push '!f() { git add . && git commit -m "Update $(date)" && git push origin $(git branch --show-current); }; f'
|
git config --global alias.quick-push '!f() { git add . && git commit -m "Update $(date)" && git push origin $(git rev-parse --abbrev-ref HEAD); }; f'
|
||||||
print_success "Alias Git configurés"
|
print_success "Alias Git configurés"
|
||||||
|
|
||||||
# 5. Rendu exécutable des scripts si chemin standard
|
# 5. Rendu exécutable des scripts si chemin standard
|
||||||
|
0
scripts/scripts/setup-ssh-ci.sh
Normal file → Executable file
0
scripts/scripts/setup-ssh-ci.sh
Normal file → Executable file
0
scripts/security/audit.sh
Normal file → Executable file
0
scripts/security/audit.sh
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user