Compare commits
29 Commits
v2025.08.4
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6ced5d2923 | ||
![]() |
7f8dc0a926 | ||
![]() |
4c47efc9b4 | ||
![]() |
e43abef18f | ||
![]() |
043434bfe8 | ||
![]() |
57c047e76d | ||
![]() |
46d5d20c7d | ||
![]() |
99e1e0bda7 | ||
![]() |
948b11793a | ||
![]() |
25453b045e | ||
![]() |
21e4f76445 | ||
![]() |
5674437bc4 | ||
![]() |
1add88bcbb | ||
27297dbb77 | |||
01926eb9c0 | |||
5bf8bd280c | |||
a9f4ce0485 | |||
ee48b95f54 | |||
86b01563fc | |||
0783d30c10 | |||
dc92b4082a | |||
a624d091a0 | |||
86ad8eb62a | |||
68ce80c2cf | |||
270ad3488c | |||
8713c7f971 | |||
7f8e36f69e | |||
e1b89fa6ed | |||
c29e061c34 |
@ -1,3 +1,8 @@
|
||||
# Règles SSH & Automatisation — Flux local
|
||||
|
||||
- Interdiction de secrets en clair; secrets via `~/.4nk_template/.env` ou variables CI
|
||||
- Scripts SSH conservés exécutables, journaux non sensibles
|
||||
- Le flux local prime: agents exécutés avant merge/push/release; CI neutralisable via `CI_SKIP=true` et `[skip ci]`
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
|
@ -25,6 +25,9 @@ Tous les projets issus de 4NK_project_template. Contrôle de l’alignement sur
|
||||
- Erreur bloquante si un path requis n’existe pas après sync.
|
||||
- Erreur bloquante si tests/CI signalent des scripts non exécutables ou des fichiers sensibles.
|
||||
|
||||
[note]
|
||||
Les validations CI peuvent être remplacées par l’exécution locale des agents (AUTO_FIX/SCOPE) lorsque `CI_SKIP=true` est activé. Conserver une PR de synthèse et la traçabilité dans le changelog.
|
||||
|
||||
[artefacts concernés]
|
||||
- .4nk-sync.yml, TEMPLATE_VERSION, .cursor/**, .gitea/**, AGENTS.md, scripts/**, docs/SSH_UPDATE.md, CHANGELOG.md.
|
||||
# Synchronisation de template (4NK)
|
||||
@ -49,5 +52,8 @@ Tous les projets issus de 4NK_project_template. Contrôle de l’alignement sur
|
||||
- Erreur bloquante si un path requis n’existe pas après sync.
|
||||
- Erreur bloquante si tests/CI signalent des scripts non exécutables ou des fichiers sensibles.
|
||||
|
||||
[note]
|
||||
Les validations CI peuvent être remplacées par l’exécution locale des agents (AUTO_FIX/SCOPE) lorsque `CI_SKIP=true` est activé. Conserver une PR de synthèse et la traçabilité dans le changelog.
|
||||
|
||||
[artefacts concernés]
|
||||
- .4nk-sync.yml, TEMPLATE_VERSION, .cursor/**, .gitea/**, AGENTS.md, scripts/**, docs/SSH_UPDATE.md, CHANGELOG.md.
|
||||
|
@ -11,12 +11,14 @@ on:
|
||||
env:
|
||||
RUST_VERSION: '1.70'
|
||||
DOCKER_COMPOSE_VERSION: '2.20.0'
|
||||
CI_SKIP: 'true'
|
||||
|
||||
jobs:
|
||||
# Job de vérification du code
|
||||
code-quality:
|
||||
name: Code Quality
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -65,6 +67,7 @@ jobs:
|
||||
unit-tests:
|
||||
name: Unit Tests
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -101,6 +104,7 @@ jobs:
|
||||
integration-tests:
|
||||
name: Integration Tests
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
services:
|
||||
docker:
|
||||
@ -148,6 +152,7 @@ jobs:
|
||||
security-tests:
|
||||
name: Security Tests
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -185,6 +190,7 @@ jobs:
|
||||
docker-build:
|
||||
name: Docker Build & Test
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
services:
|
||||
docker:
|
||||
@ -228,6 +234,7 @@ jobs:
|
||||
documentation-tests:
|
||||
name: Documentation Tests
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -243,6 +250,7 @@ jobs:
|
||||
markdownlint:
|
||||
name: Markdown Lint
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@ -273,6 +281,7 @@ jobs:
|
||||
bash-required:
|
||||
name: Bash Requirement
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@ -290,6 +299,7 @@ jobs:
|
||||
agents-smoke:
|
||||
name: Agents Smoke (no AI)
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@ -310,7 +320,7 @@ jobs:
|
||||
openia-agents:
|
||||
name: Agents with OpenIA
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ secrets.OPENAI_API_KEY != '' }}
|
||||
if: ${{ env.CI_SKIP != 'true' && secrets.OPENAI_API_KEY != '' }}
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
OPENAI_MODEL: ${{ vars.OPENAI_MODEL }}
|
||||
@ -334,6 +344,7 @@ jobs:
|
||||
deployment-checks:
|
||||
name: Deployment Checks
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@ -351,6 +362,7 @@ jobs:
|
||||
security-audit:
|
||||
name: Security Audit
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@ -370,6 +382,7 @@ jobs:
|
||||
name: Release Guard
|
||||
runs-on: [self-hosted, linux]
|
||||
needs: [code-quality, unit-tests, documentation-tests, markdownlint, security-audit, deployment-checks, bash-required]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@ -401,7 +414,7 @@ jobs:
|
||||
name: Create Release (Gitea API)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-guard]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
if: ${{ env.CI_SKIP != 'true' && startsWith(github.ref, 'refs/tags/') }}
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
BASE_URL: ${{ vars.BASE_URL }}
|
||||
@ -431,6 +444,7 @@ jobs:
|
||||
performance-tests:
|
||||
name: Performance Tests
|
||||
runs-on: [self-hosted, linux]
|
||||
if: ${{ env.CI_SKIP != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -457,7 +471,7 @@ jobs:
|
||||
name: Notify
|
||||
runs-on: [self-hosted, linux]
|
||||
needs: [code-quality, unit-tests, integration-tests, security-tests, docker-build, documentation-tests]
|
||||
if: always()
|
||||
if: ${{ env.CI_SKIP != 'true' && always() }}
|
||||
|
||||
steps:
|
||||
- name: Notify success
|
||||
|
11
AGENTS.md
11
AGENTS.md
@ -399,3 +399,14 @@ Ce `AGENTS.md` mis à jour introduit l’**Agent Synchronisation de template** e
|
||||
|
||||
La matrice de coordination formalise les validations obligatoires pour chaque type de changement, garantissant cohérence structurelle, qualité documentaire, sécurité, traçabilité.
|
||||
Ainsi que la stabilité à long terme sur tous les projets issus de `4NK_project_template`.
|
||||
|
||||
---
|
||||
|
||||
## Exécution locale et neutralisation de la CI
|
||||
|
||||
- Les contrôles CI peuvent être remplacés par l’exécution locale des agents: `scripts/agents/run.sh` avec `AUTO_FIX=1`, `SCOPE=changed|all`.
|
||||
- La CI peut être neutralisée par défaut via `CI_SKIP=true` dans le workflow; ponctuellement via des commits `[skip ci]`.
|
||||
- Des hooks sont fournis pour automatiser le flux local:
|
||||
- `scripts/local/precommit.sh` et `scripts/local/prepush.sh`
|
||||
- installation: `bash scripts/local/install_hooks.sh`
|
||||
- Un conteneur unifié (runner+agents) permet une exécution reproductible: `docker-compose.ci.yml`.
|
||||
|
@ -1,3 +1 @@
|
||||
v2025.08.3
|
||||
|
||||
|
||||
v2025.08.6
|
||||
|
@ -12,6 +12,10 @@ MODE="${RUNNER_MODE:-agents}"
|
||||
TARGET_DIR="${TARGET_DIR:-/work}"
|
||||
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() {
|
||||
if command -v dos2unix >/dev/null 2>&1; then
|
||||
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** 🚀
|
||||
|
@ -29,6 +29,13 @@ Ce guide décrit comment utiliser et intégrer les agents de conformité (qualit
|
||||
- Exécuter agents: `docker compose -f docker-compose.ci.yml up --abort-on-container-exit`
|
||||
- Lancer runner: `RUNNER_MODE=runner BASE_URL=... REGISTRATION_TOKEN=... docker compose -f docker-compose.ci.yml up -d`
|
||||
|
||||
## 10. Intégration dans un projet existant
|
||||
|
||||
```bash
|
||||
bash scripts/deploy/setup.sh <git_url_du_projet> [--dest DIR] [--force]
|
||||
# Compléter ~/.4nk_template/.env si besoin
|
||||
```
|
||||
|
||||
## 4. Agents disponibles
|
||||
|
||||
- Documentation (`documentation`): fichiers essentiels et index
|
||||
@ -77,3 +84,4 @@ Ce guide décrit comment utiliser et intégrer les agents de conformité (qualit
|
||||
- Exécuter les agents avant chaque PR
|
||||
- Archiver les rapports significatifs
|
||||
- Documenter les décisions dans le changelog et la doc
|
||||
- Si contrôle local complet: activer `CI_SKIP=true` côté dépôt pour ne pas consommer la CI; ajouter au besoin `[skip ci]` dans les commits automatisés
|
||||
|
@ -9,6 +9,10 @@
|
||||
- **Runner unifié**:
|
||||
- `RUNNER_MODE` = `agents` | `runner` | `both` (par défaut: `agents`)
|
||||
- `REGISTRATION_TOKEN` (requis si `RUNNER_MODE=runner` ou `both` sans config existante)
|
||||
- **Flag de gel CI**:
|
||||
- `CI_SKIP` (défaut `true` dans le template): quand `true`, les jobs CI sont court‑circuités
|
||||
- Définir à `false` pour réactiver la CI côté dépôt
|
||||
- Alternative ponctuelle: commit message `[skip ci]`
|
||||
|
||||
## Variables d’environnement (agents)
|
||||
|
||||
@ -40,6 +44,10 @@ Variables utilisées par l’entrypoint `docker/entrypoint.ci.sh`:
|
||||
- `RUNNER_MODE` détermine le mode d’exécution
|
||||
- `BASE_URL` et `REGISTRATION_TOKEN` servent à l’enregistrement du runner (act_runner)
|
||||
|
||||
## Commit message — désactiver la CI ponctuellement
|
||||
|
||||
- Ajouter `[skip ci]` au message de commit pour ignorer un run côté Gitea Actions
|
||||
|
||||
## Gestion locale des secrets (~/.4nk_template/.env)
|
||||
|
||||
- Modèle fourni: `scripts/env/.env.template` (clés sans valeurs)
|
||||
|
@ -16,6 +16,23 @@
|
||||
- Tagging: `vX.Y.Z` ou `vX.Y.Z-wip.N`
|
||||
- Notes de release (résumé, changements majeurs, impacts)
|
||||
|
||||
### Stratégies de merge (tags → branches cibles)
|
||||
|
||||
- Tag sur `main` (latest):
|
||||
- Aligner `TEMPLATE_VERSION` et `CHANGELOG.md` sur la branche de travail
|
||||
- Taguer `vX.Y.Z` puis merger la branche (PR) vers `main`
|
||||
- Si flux local (CI désactivée): appliquer les agents en local avant tag/push
|
||||
|
||||
- Tag sur `develop` (pré‑release/wip):
|
||||
- Utiliser `vX.Y.Z-wip.N` pour itérer
|
||||
- Merger régulièrement vers `develop`; rebase/merge planifié vers `main` pour la release finale
|
||||
|
||||
### Cas particuliers
|
||||
|
||||
- Merge de tag existant vers `main` ou `develop`:
|
||||
- Créer une PR contenant l’alignement version/changelog correspondant au tag
|
||||
- Appliquer les agents (localement si CI neutre) puis merger
|
||||
|
||||
## Post‑lancement
|
||||
|
||||
- Suivi issues/retours
|
||||
|
@ -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)
|
||||
|
||||
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.
|
||||
@ -15,6 +25,25 @@ Ce document explique comment utiliser le template pour initier, documenter, cont
|
||||
3) Tenir `docs/INDEX.md` et `CHANGELOG.md` à jour
|
||||
4) Activer les workflows CI et vérifier `release-guard`/`security-audit`
|
||||
|
||||
## 2.1 Intégrer 4NK_template dans un projet existant
|
||||
|
||||
```bash
|
||||
# Depuis le dépôt 4NK_template
|
||||
bash scripts/deploy/setup.sh <git_url_du_projet> [--dest DIR] [--force]
|
||||
# Compléter ensuite ~/.4nk_template/.env si nécessaire (OPENAI_*, BASE_URL, RELEASE_TOKEN)
|
||||
```
|
||||
|
||||
### Intégration via Docker (recommandé)
|
||||
|
||||
```bash
|
||||
# Build l’image unifiée
|
||||
docker compose -f docker-compose.ci.yml build
|
||||
|
||||
# Appliquer le template depuis le conteneur (monter le repo projet sur /host)
|
||||
docker run --rm -v "$PWD":/work -v "/chemin/vers/projet":/host 4nk-template-ci:latest \
|
||||
bash -lc "/work/scripts/deploy/setup.sh file:///host/.git --dest /host"
|
||||
```
|
||||
|
||||
## 3. Documentation
|
||||
|
||||
- Utiliser les squelettes de `docs/templates/**` comme base
|
||||
@ -30,7 +59,73 @@ Ce document explique comment utiliser le template pour initier, documenter, cont
|
||||
- Variables utiles: `RUNNER_MODE`, `BASE_URL`, `REGISTRATION_TOKEN`
|
||||
- Script helper: `scripts/dev/run_project_ci.sh`
|
||||
- Auto‑corrections: `AUTO_FIX=1` pour créer la structure de tests et des squelettes docs
|
||||
- Agents utiles en premier passage: `documentation`, `quality-technique`, `open-source`, `securite`, `deploiement`
|
||||
|
||||
## 5. Remplacer la CI par une exécution locale (recommandé)
|
||||
|
||||
- CI neutre par défaut: `CI_SKIP=true` dans le workflow; réactivez en le passant à `false` côté dépôt.
|
||||
- Commits: contrôles rapides avant commit
|
||||
```bash
|
||||
npx -y markdownlint-cli "**/*.md" --ignore "archive/**"
|
||||
AUTO_FIX=1 SCOPE=changed scripts/agents/run.sh
|
||||
# Ajoutez [skip ci] dans le message de commit pour éviter les runs distants
|
||||
```
|
||||
- Push: contrôles complets pré‑push
|
||||
```bash
|
||||
AUTO_FIX=1 SCOPE=all scripts/agents/run.sh
|
||||
bash scripts/security/audit.sh || true
|
||||
# Si outillage présent (exemples): cargo check / go vet / npx eslint / tsc --noEmit / ruff…
|
||||
bash scripts/release/guard.sh || true
|
||||
```
|
||||
- Release locale (puis push tag)
|
||||
```bash
|
||||
echo "vYYYY.MM.P" > TEMPLATE_VERSION
|
||||
git add TEMPLATE_VERSION CHANGELOG.md
|
||||
git commit -m "[skip ci] chore(release): vYYYY.MM.P"
|
||||
git tag -a vYYYY.MM.P -m "release: vYYYY.MM.P (latest)"
|
||||
git push && git push origin vYYYY.MM.P
|
||||
```
|
||||
|
||||
### Hooks conseillés (agents centralisés via 4NK_template)
|
||||
|
||||
`.git/hooks/pre-commit`:
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
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"
|
||||
```
|
||||
|
||||
`.git/hooks/pre-push`:
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
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"
|
||||
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 (les hooks fournis appellent déjà le runner centralisé):
|
||||
|
||||
```bash
|
||||
bash scripts/local/install_hooks.sh
|
||||
```
|
||||
|
||||
- Agents utiles en premier passage: `documentation`, `quality-technique`, `open-source`, `securite`, `deploiement`
|
||||
|
||||
### Script de merge local (main/develop)
|
||||
|
||||
```bash
|
||||
# Merge de la branche courante vers main (valide localement avant)
|
||||
bash scripts/local/merge_branch.sh main
|
||||
|
||||
# Merge vers develop
|
||||
bash scripts/local/merge_branch.sh develop
|
||||
```
|
||||
|
||||
## 5. Qualité et CI
|
||||
|
||||
|
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() {
|
||||
# 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() {
|
||||
|
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"
|
||||
|
||||
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
|
||||
echo "- Aucun fichier .docx détecté." >> "$SUMMARY_FILE"
|
||||
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"
|
||||
|
||||
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
|
||||
echo "- Aucun CSV détecté dans le dépôt." >> "$SUMMARY_FILE"
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
# 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)
|
||||
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)
|
||||
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
|
||||
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
|
||||
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"
|
||||
(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
|
||||
echo "- Shell: shellcheck non disponible" >> "$SUMMARY_FILE"
|
||||
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)"
|
||||
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 -C "$TARGET_DIR" 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:
|
||||
Fondamentaux: fondation, structure
|
||||
Documentation: documentation, donnees-csv, documents-bureautiques
|
||||
Tests: tests, performance
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
AGENT="${3:-all}"
|
||||
run_agent() {
|
||||
local script_name="$1"
|
||||
"$DIR/${script_name}" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
}
|
||||
|
||||
case "$AGENT" in
|
||||
runner)
|
||||
"$DIR/runner_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
quality-tech|qualite-technique)
|
||||
"$DIR/quality_tech.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
qualite-formelle|fondation)
|
||||
"$DIR/qualite_formelle.sh" "$TARGET_DIR" "$OUTPUT_DIR" || "$DIR/fondation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
structure)
|
||||
"$DIR/structure_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
tests)
|
||||
"$DIR/tests_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
performance)
|
||||
"$DIR/performance_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
documentation)
|
||||
"$DIR/documentation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
donnees-csv)
|
||||
"$DIR/donnees_csv_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
documents-bureautiques)
|
||||
"$DIR/documents_bureautiques_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
securite)
|
||||
"$DIR/security_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
|
||||
deploiement)
|
||||
"$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" ;;
|
||||
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)
|
||||
"$DIR/runner_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
"$DIR/quality_tech.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
||||
"$DIR/qualite_formelle.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
||||
"$DIR/fondation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
"$DIR/structure_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
"$DIR/tests_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
||||
"$DIR/performance_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
"$DIR/documentation_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR"
|
||||
"$DIR/donnees_csv_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
"$DIR/documents_bureautiques_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" || true
|
||||
"$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 ;;
|
||||
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 -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"
|
||||
|
||||
# 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
19
scripts/local/install_hooks.sh
Executable file
19
scripts/local/install_hooks.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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)."
|
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."
|
||||
|
25
scripts/local/merge_branch.sh
Executable file
25
scripts/local/merge_branch.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
TARGET_BRANCH="${1:-main}"
|
||||
SOURCE_BRANCH="${2:-}"
|
||||
|
||||
if [[ -z "$SOURCE_BRANCH" ]]; then
|
||||
SOURCE_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
fi
|
||||
|
||||
if [[ "$SOURCE_BRANCH" == "$TARGET_BRANCH" ]]; then
|
||||
echo "Déjà sur $TARGET_BRANCH"; exit 0
|
||||
fi
|
||||
|
||||
# Valider localement avant merge
|
||||
AUTO_FIX="${AUTO_FIX:-1}" SCOPE="${SCOPE:-all}" scripts/agents/run.sh || true
|
||||
if [ -f scripts/security/audit.sh ]; then bash scripts/security/audit.sh || true; fi
|
||||
|
||||
git fetch origin --prune
|
||||
git checkout "$TARGET_BRANCH"
|
||||
git pull --ff-only origin "$TARGET_BRANCH" || true
|
||||
git merge --no-ff "$SOURCE_BRANCH" -m "[skip ci] merge: $SOURCE_BRANCH -> $TARGET_BRANCH"
|
||||
git push origin "$TARGET_BRANCH"
|
||||
|
||||
echo "Merge effectué: $SOURCE_BRANCH → $TARGET_BRANCH"
|
11
scripts/local/precommit.sh
Executable file
11
scripts/local/precommit.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/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)"
|
21
scripts/local/prepush.sh
Executable file
21
scripts/local/prepush.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/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)"
|
20
scripts/local/release_local.sh
Executable file
20
scripts/local/release_local.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/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"
|
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"
|
||||
|
||||
# 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() {
|
||||
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')"}
|
||||
|
||||
echo "🚀 Push automatique sur la branche: $branch"
|
||||
@ -54,7 +69,7 @@ auto_push() {
|
||||
# Fonction pour push avec message personnalisé
|
||||
push_with_message() {
|
||||
local message="$1"
|
||||
local branch=${2:-$(git branch --show-current)}
|
||||
local branch=${2:-$(get_current_branch)}
|
||||
|
||||
echo "💬 Push avec message: $message"
|
||||
auto_push "$branch" "$message"
|
||||
@ -62,7 +77,7 @@ push_with_message() {
|
||||
|
||||
# Fonction pour push rapide (sans message)
|
||||
quick_push() {
|
||||
local branch=${1:-$(git branch --show-current)}
|
||||
local branch=${1:-$(get_current_branch)}
|
||||
auto_push "$branch"
|
||||
}
|
||||
|
||||
@ -77,7 +92,7 @@ push_branch() {
|
||||
|
||||
# Fonction pour push et merge vers main
|
||||
push_and_merge() {
|
||||
local source_branch=${1:-$(git branch --show-current)}
|
||||
local source_branch=${1:-$(get_current_branch)}
|
||||
local target_branch=${2:-main}
|
||||
|
||||
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
|
||||
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.quick-push '!f() { git add . && git commit -m "Update $(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 rev-parse --abbrev-ref HEAD); }; f'
|
||||
print_success "Alias Git configurés"
|
||||
|
||||
# 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