Compare commits

...

10 Commits

52 changed files with 549 additions and 215 deletions

View File

@ -21,3 +21,4 @@ tests/reports/
!/.cursor
!/AGENTS.md

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ git-installer.exe
# Ne pas ignorer .cursor ni AGENTS.md

View File

@ -44,6 +44,21 @@ Fallback Windows: `scripts/agents/run.ps1`.
Guide complet: `docs/project/AGENTS_RUNTIME.md`.
## 🐳 Conteneur unifié (runner + agents)
```bash
# Build
docker compose -f docker-compose.ci.yml build
# Exécuter les agents sur le dépôt courant
docker compose -f docker-compose.ci.yml up --abort-on-container-exit
# Rapports: tests/reports/agents/*.md
# Lancer le runner dans ce conteneur
RUNNER_MODE=runner BASE_URL="https://git.4nkweb.com" REGISTRATION_TOKEN="<token>" \
docker compose -f docker-compose.ci.yml up -d
```
## 🔁 CI/CD (Gitea Actions)
- Runners: labels requis `self-hosted,linux` (voir `docs/project/GITEA_SETUP.md`)

View File

@ -1,2 +1 @@
v2025.08.3
v2025.08.4

19
docker-compose.ci.yml Normal file
View File

@ -0,0 +1,19 @@
services:
project-ci:
build:
context: .
dockerfile: docker/Dockerfile.ci
image: 4nk-template-ci:latest
environment:
- RUNNER_MODE=${RUNNER_MODE:-agents}
- TARGET_DIR=/work
- OUTPUT_DIR=/work/tests/reports/agents
- BASE_URL
- REGISTRATION_TOKEN
volumes:
- ./:/work
- ${HOME}/.4nk_template/.env:/root/.4nk_template/.env:ro
tty: true
labels:
- "com.4nk.template=ci"

26
docker/Dockerfile.ci Normal file
View File

@ -0,0 +1,26 @@
FROM gitea/act_runner:nightly
USER root
RUN apk update || true && \
(apk add --no-cache bash curl jq git coreutils dos2unix || \
(apt-get update && apt-get install -y bash curl jq git coreutils dos2unix)) && \
mkdir -p /app /work /root/.4nk_template && chmod 700 /root/.4nk_template
WORKDIR /app
# Copier les scripts agents
COPY scripts /work/scripts
# Normaliser les fins de ligne et permissions
RUN find /work/scripts -type f -name "*.sh" -print0 | xargs -0 -r dos2unix -f && \
find /work/scripts -type f -name "*.sh" -exec chmod +x {} +
# Entrypoint unifié: lance le runner si variables présentes, sinon agents
COPY docker/entrypoint.ci.sh /entrypoint.sh
RUN dos2unix -f /entrypoint.sh && chmod +x /entrypoint.sh
WORKDIR /work
ENTRYPOINT ["/entrypoint.sh"]

10
docker/Dockerfile.debian Normal file
View File

@ -0,0 +1,10 @@
FROM debian:12-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash curl jq ca-certificates git docker.io docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /work
ENTRYPOINT ["/bin/bash","-lc"]

51
docker/entrypoint.ci.sh Normal file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
# Charge l'env utilisateur si monté
if [[ -f "/root/.4nk_template/.env" ]]; then
set -a
. "/root/.4nk_template/.env"
set +a
fi
MODE="${RUNNER_MODE:-agents}"
TARGET_DIR="${TARGET_DIR:-/work}"
OUTPUT_DIR="${OUTPUT_DIR:-/work/tests/reports/agents}"
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
fi
find /work/scripts -type f -name "*.sh" -exec chmod +x {} + || true
}
start_runner() {
# Démarre le runner gitea/act_runner (processus au premier plan)
# Requiert : GITEA_INSTANCE_URL (BASE_URL), REGISTRATION_TOKEN ou config existante
if [[ -n "${BASE_URL:-}" && -n "${REGISTRATION_TOKEN:-}" ]]; then
act_runner register --no-interactive \
--instance "$BASE_URL" \
--token "$REGISTRATION_TOKEN" \
--labels "self-hosted,linux" || true
fi
exec act_runner daemon
}
run_agents() {
normalize_scripts
mkdir -p "$OUTPUT_DIR"
cd "$TARGET_DIR"
/work/scripts/agents/run.sh "$TARGET_DIR" "$OUTPUT_DIR" all || true
echo "Rapports disponibles dans $OUTPUT_DIR" >&2
}
case "$MODE" in
runner) start_runner ;;
agents) run_agents ;;
both)
start_runner &
run_agents
wait -n || true
;;
*) run_agents ;;
esac

2
docs/ARCHITECTURE.md Normal file
View File

@ -0,0 +1,2 @@
# Architecture

2
docs/DEPLOYMENT.md Normal file
View File

@ -0,0 +1,2 @@
# Déploiement

2
docs/INDEX.md Normal file
View File

@ -0,0 +1,2 @@
# Index

2
docs/SECURITY_AUDIT.md Normal file
View File

@ -0,0 +1,2 @@
# Security Audit

2
docs/TESTING.md Normal file
View File

@ -0,0 +1,2 @@
# Tests

View File

@ -12,6 +12,7 @@ Ce guide décrit comment utiliser et intégrer les agents de conformité (qualit
- bash disponible (Git Bash/WSL/Linux/macOS) pour les contrôles complets
- (Optionnel) `OPENAI_API_KEY` pour activer lanalyse IA
- (Option) conteneur unifié runner+agents: `docker-compose.ci.yml`
## 3. Commandes
@ -23,6 +24,11 @@ Ce guide décrit comment utiliser et intégrer les agents de conformité (qualit
- `scripts/agents/run.ps1`
- Options (facultatives): `-TargetDir . -OutputDir tests/reports/agents -Agent <nom>`
- Conteneur unifié:
- Build: `docker compose -f docker-compose.ci.yml build`
- 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`
## 4. Agents disponibles
- Documentation (`documentation`): fichiers essentiels et index
@ -53,12 +59,20 @@ Ce guide décrit comment utiliser et intégrer les agents de conformité (qualit
- `openia-agents`: agents avec IA si `OPENAI_API_KEY` fourni
- `bash-required`: bloque si bash/runner absent
- `release-guard`: dépend des checks en amont
- (Option) étape pour builder/lancer `docker-compose.ci.yml` si utilisation du conteneur unifié
## 7. Paramètres IA (optionnels)
- `OPENAI_API_KEY`, `OPENAI_MODEL`, `OPENAI_API_BASE`, `OPENAI_TEMPERATURE`
## 8. Bonnes pratiques
## 8. Autocorrections (optionnelles)
- `AUTO_FIX=1` permet aux agents dappliquer des corrections minimales:
- création des dossiers `tests/**` manquants
- génération de squelettes Markdown basiques pour quelques fichiers de `docs/`
- Traçabilité: les actions sont listées dans les rapports `tests/reports/agents/*.md`
## 9. Bonnes pratiques
- Exécuter les agents avant chaque PR
- Archiver les rapports significatifs

View File

@ -3,9 +3,21 @@
## Variables denvironnement (CI)
- Secrets CI uniquement (pas de secrets en clair)
- Variables agents : OPENAI_API_KEY, OPENAI_MODEL, OPENAI_API_BASE, OPENAI_TEMPERATURE
- Secret release: RELEASE_TOKEN (publication des releases via lAPI Gitea)
- Variable optionnelle: BASE_URL (ex: `https://git.4nkweb.com`)
- **Agents IA**: `OPENAI_API_KEY`, `OPENAI_MODEL`, `OPENAI_API_BASE`, `OPENAI_TEMPERATURE`
- **Release**: `RELEASE_TOKEN` (publication des releases via lAPI Gitea)
- **Forge**: `BASE_URL` (ex: `https://git.4nkweb.com`)
- **Runner unifié**:
- `RUNNER_MODE` = `agents` | `runner` | `both` (par défaut: `agents`)
- `REGISTRATION_TOKEN` (requis si `RUNNER_MODE=runner` ou `both` sans config existante)
## Variables denvironnement (agents)
- `AUTO_FIX` (0/1, défaut 0): active les corrections automatiques côté agents
- Création de la structure `tests/**` manquante
- Génération de squelettes minimalistes pour certains fichiers de `docs/`
- `SCOPE` (`all`|`changed`, défaut `all`):
- `all`: passe sur lensemble du dépôt
- `changed`: focalise les contrôles/corrections sur les fichiers modifiés du dernier commit
## Conventions
@ -17,6 +29,17 @@
- bash requis (job CI `bash-required`)
- Fallback PowerShell utilisable localement
## Conteneur unifié (runner+agents)
- Image: construite via `docker/Dockerfile.ci`, orchestrée par `docker-compose.ci.yml`
- Montage: le projet courant est monté sur `/work`, les rapports dans `/work/tests/reports/agents`
- Secrets locaux: `~/.4nk_template/.env` monté en lecture seule dans le conteneur
Variables utilisées par lentrypoint `docker/entrypoint.ci.sh`:
- `RUNNER_MODE` détermine le mode dexécution
- `BASE_URL` et `REGISTRATION_TOKEN` servent à lenregistrement du runner (act_runner)
## Gestion locale des secrets (~/.4nk_template/.env)
- Modèle fourni: `scripts/env/.env.template` (clés sans valeurs)

View File

@ -47,3 +47,25 @@ bash scripts/deploy/setup.sh git@host:org/mon-projet.git --dest ~/work --force
- Vérification santé/logs/dashboards
- Suivi des erreurs et retours
## Conteneur unifié (runner + agents)
- Build:
```bash
docker compose -f docker-compose.ci.yml build
```
- Exécuter les agents sur le dépôt courant:
```bash
docker compose -f docker-compose.ci.yml up --abort-on-container-exit
# Rapports: tests/reports/agents/*.md
```
- Lancer le runner dans le conteneur unifié:
```bash
export RUNNER_MODE=runner BASE_URL="https://git.4nkweb.com" REGISTRATION_TOKEN="<token>"
docker compose -f docker-compose.ci.yml up -d
```

View File

@ -25,15 +25,17 @@
### Runner Gitea (labels)
- Configurez votre runner avec labels: `self-hosted,linux`
- Exemple (act_runner):
- Enregistrement: `./act_runner register --labels "self-hosted,linux"`
- Service: définissez `RUNNER_LABELS="self-hosted,linux"`
- Option A (runner dédié): `gitea/act_runner` via docker-compose dans `runner/`
- Option B (conteneur unifié): `RUNNER_MODE=runner` dans `docker-compose.ci.yml` + `BASE_URL` et `REGISTRATION_TOKEN`
- Enregistrement (automatisé par entrypoint si variables présentes)
- Démarrage: `docker compose -f docker-compose.ci.yml up -d`
## 4. Workflows requis
- `code-quality`, `unit-tests`, `documentation-tests`, `security-audit`
- `deployment-checks`, `bash-required`, `markdownlint`, `release-guard`, `release-create`
- (Optionnels) `agents-smoke`, `openia-agents`
- (Conteneur unifié) job custom pour builder et lancer `docker-compose.ci.yml` si nécessaire
## 5. Processus PR

View File

@ -25,8 +25,12 @@ Ce document explique comment utiliser le template pour initier, documenter, cont
- Recommandé (bash): `scripts/agents/run.sh [target_dir] [output_dir] [agent]`
- Windows fallback: `scripts/agents/run.ps1 -TargetDir . -OutputDir tests/reports/agents -Agent <nom>`
- Rapports: `tests/reports/agents/*.md`
- Agents utiles en premier passage: `documentation`, `quality-technique`, `open-source`, `securite`, `deploiement`
- Conteneur (option): `docker compose -f docker-compose.ci.yml up --abort-on-container-exit`
- Rapports: `tests/reports/agents/*.md`
- Variables utiles: `RUNNER_MODE`, `BASE_URL`, `REGISTRATION_TOKEN`
- Script helper: `scripts/dev/run_project_ci.sh`
- Autocorrections: `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. Qualité et CI

49
runner/README.md Normal file
View File

@ -0,0 +1,49 @@
# Runner Gitea (act_runner)
Ce dossier contient une configuration prête à l'emploi pour exécuter un runner Gitea via Docker Compose.
## Prérequis
- Hôte Linux avec Docker et Docker Compose
- URL de l'instance Gitea et un token d'enregistrement (repo/org/instance)
## Configuration
- Le runner lit un fichier .env GLOBAL: `$HOME/4nk_template/.env` (commun à tous les dépôts)
- Variables attendues dans ce fichier:
- `INSTANCE_URL` (ex: `https://git.4nkweb.com`)
- `REGISTRATION_TOKEN` (token d'enregistrement)
- `RUNNER_NAME` (optionnel)
- `RUNNER_LABELS` (optionnel, défaut: `self-hosted,linux`)
- Aucun `.env` local dans `runner/` nest nécessaire.
Exemple de contenu minimal:
```dotenv
INSTANCE_URL=https://git.4nkweb.com
REGISTRATION_TOKEN=...
RUNNER_NAME=$(hostname)-runner
RUNNER_LABELS=self-hosted,linux
```
## Démarrage
```bash
cd runner
docker compose up -d
```
Le runner s'enregistre automatiquement et apparaît dans Settings → Actions → Runners.
## Arrêt / Mise à jour
```bash
docker compose down
# Mise à jour d'image
docker compose pull && docker compose up -d
```
## Mode éphémère (optionnel)
Activez `GITEA_RUNNER_EPHEMERAL=1` dans `docker-compose.yml` pour des runners jetables.
Réf: Gitea Act Runner — https://docs.gitea.com/usage/actions/act-runner

18
runner/docker-compose.yml Normal file
View File

@ -0,0 +1,18 @@
version: "3.8"
services:
runner:
image: docker.io/gitea/act_runner:nightly
container_name: gitea-act-runner
restart: unless-stopped
env_file:
- ${USERPROFILE}/.4nk_template/.env
environment:
- GITEA_RUNNER_LABELS=${RUNNER_LABELS:-self-hosted,linux}
- GITEA_RUNNER_NAME=${RUNNER_NAME:-local-runner}
- GITEA_INSTANCE_URL=${INSTANCE_URL}
- GITEA_RUNNER_REGISTRATION_TOKEN=${REGISTRATION_TOKEN}
# Uncomment to enable ephemeral mode
# - GITEA_RUNNER_EPHEMERAL=1
volumes:
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock

View File

@ -4,6 +4,14 @@ set -euo pipefail
# Utilitaire générique pour appeler l'API OpenAI Chat Completions.
# Prérequis: variable d'environnement OPENAI_API_KEY et curl.
# Chargement env utilisateur (~/.4nk_template/.env) pour exécutions locales/CI docke
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
set -a
. "${HOME}/.4nk_template/.env"
set +a
fi
for bin in curl jq; do
if ! command -v "$bin" >/dev/null 2>&1; then
echo "$bin manquant. Installez $bin." >&2

19
scripts/agents/common.sh Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
# Portée des contrôles: all (défaut) ou changed
export SCOPE="${SCOPE:-all}"
list_changed_paths() {
# Renvoie la liste des chemins modifiés (HEAD~1..HEAD), ou vide si non dispo
git diff --name-only HEAD~1..HEAD 2>/dev/null || true
}
is_path_changed() {
local path="$1"
if [[ "$SCOPE" != "changed" ]]; then return 0; fi
local changed
changed=$(list_changed_paths)
if [[ -z "$changed" ]]; then return 0; fi
grep -q "^${path%/}\(/\|$\)" <<<"$changed" && return 0 || return 1
}

View File

@ -5,22 +5,28 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/compilation_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Compilation" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(.gitea/workflows/ci.yml)
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement compilation CI (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
if grep -q "cargo" .gitea/workflows/ci.yml 2>/dev/null; then
echo "- Étapes de build/format/clippy Rust détectées dans la CI." >> "$SUMMARY_FILE"
else
echo "- Étapes de compilation non détectées dans la CI (à ajouter si nécessaire)." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Précise une cadence de compilation (avant refactor/push, après update deps) et les conditions de blocage si erreurs.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,21 +5,27 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/dependances_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Dépendances" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
echo "- Vérifier régulièrement les dépendances (audit sécurité, mises à jour stables)." >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(package.json package-lock.json pnpm-lock.yaml yarn.lock requirements.txt pyproject.toml Cargo.toml go.mod .gitea/workflows/ci.yml)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement dépendances/CI (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
if grep -q "security-audit" .gitea/workflows/ci.yml 2>/dev/null; then
echo "- Job CI security-audit détecté." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Établis une politique de dépendances: ajout automatique si justifié, vérification des dernières versions stables, documentation des impacts (ARCHITECTURE, CONFIGURATION, CHANGELOG), et rollback.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,11 +5,17 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/deployment_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Déploiement" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml)
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
echo "## Résultats locaux" >> "$SUMMARY_FILE"
ok=1
for f in docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml; do
@ -17,11 +23,11 @@ for f in docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml; do
done
if [[ $ok -eq 1 ]]; then echo "- Prérequis documentaires présents." >> "$SUMMARY_FILE"; fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Établis une checklist de déploiement minimale (préchecks, variables, smoke tests, rollback, postdeploy) adaptée à un template CI Gitea.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -16,11 +16,11 @@ else
echo "- Aucun fichier de dérogations locales détecté." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Définis un format pour enregistrer les dérogations (path, raison, propriétaire, échéance), tolérance CI, et revue périodique.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,6 +5,7 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/documentation_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Documentation" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
@ -20,13 +21,32 @@ if ((${#missing[@]}==0)); then
else
echo "- Fichiers manquants:" >> "$SUMMARY_FILE"
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
if [[ "${AUTO_FIX:-0}" == "1" ]]; then
echo >> "$SUMMARY_FILE"
echo "## Autocorrections" >> "$SUMMARY_FILE"
for m in "${missing[@]}"; do
case "$m" in
docs/INDEX.md)
mkdir -p docs && printf "# Index\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
docs/ARCHITECTURE.md)
mkdir -p docs && printf "# Architecture\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
docs/TESTING.md)
mkdir -p docs && printf "# Tests\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
docs/SECURITY_AUDIT.md)
mkdir -p docs && printf "# Security Audit\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
docs/DEPLOYMENT.md)
mkdir -p docs && printf "# Déploiement\n\n" > "$m" && echo "- Créé squelette: $m" >> "$SUMMARY_FILE" ;;
*) : ;;
esac
done
fi
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Élabore une liste courte daméliorations documentation (INDEX à jour, traçabilité changes ↔ CHANGELOG, sections sécurité/tests/déploiement).
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -19,11 +19,11 @@ else
echo "- Utiliser docx2txt pour extraction et documenter dans docs/INDEX.md" >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Décris une procédure standard de traitement des .docx (docx2txt, import, traçabilité dans docs/INDEX.md) et les risques à éviter.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -18,11 +18,11 @@ else
echo "$csvs" | sed 's/^/ - /' >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
À partir des CSV présents (entêtes multilignes possibles), propose une méthode pour définir toutes les colonnes, types et validations, et pointer vers les docs à mettre à jour (API, ARCHITECTURE, USAGE).
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -18,11 +18,11 @@ done
if [[ $issues -eq 0 ]]; then echo "- Conformité éditoriale de base: OK (présence des fichiers clés)." >> "$SUMMARY_FILE"; fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Évalue la conformité éditoriale (français, pas dexemples applicatifs, intro/conclusion) et liste 5 actions damélioration priorisées.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,16 +5,22 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/frontend_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Frontend" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Définis des principes front: code splitting (React.lazy/Suspense), centralisation détat (Redux/Context), abstraction des services, et tests associés.
P
EOF
)
pushd "$TARGET_DIR" >/dev/null
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
if [[ "$SCOPE" == "changed" ]]; then
relevant=(package.json tsconfig.json src/)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement frontend pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,11 +5,17 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/gitea_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Gitea" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(.gitea/ISSUE_TEMPLATE/bug_report.md .gitea/ISSUE_TEMPLATE/feature_request.md .gitea/PULL_REQUEST_TEMPLATE.md .gitea/workflows/ci.yml)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement Gitea pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
need=(.gitea/ISSUE_TEMPLATE/bug_report.md .gitea/ISSUE_TEMPLATE/feature_request.md .gitea/PULL_REQUEST_TEMPLATE.md .gitea/workflows/ci.yml)
missing=()
for f in "${need[@]}"; do [[ -f "$f" ]] || missing+=("$f"); done
@ -20,11 +26,11 @@ else
echo "- Manquants:" >> "$SUMMARY_FILE"; for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Propose des vérifications CI additionnelles Gitea (lint, tests, sécurité, scripts exécutables) et notifications en cas déchecs.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,11 +5,17 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/open_source_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Open Source" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(LICENSE CONTRIBUTING.md CODE_OF_CONDUCT.md docs/OPEN_SOURCE_CHECKLIST.md)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement open source pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
need=(LICENSE CONTRIBUTING.md CODE_OF_CONDUCT.md docs/OPEN_SOURCE_CHECKLIST.md)
missing=()
for f in "${need[@]}"; do [[ -f "$f" ]] || missing+=("$f"); done
@ -20,11 +26,11 @@ else
echo "- Manquants:" >> "$SUMMARY_FILE"; for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Propose une checklist pour préparer louverture open source (gouvernance, CI, sécurité, documentation) compatible avec Gitea.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -16,11 +16,11 @@ else
echo "- Dossier tests/performance manquant." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Propose un plan minimal de tests de performance reproductibles (outillage, métriques, critères de succès) et archivage des rapports.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -1,6 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
# Chargement env utilisateur (~/.4nk_template/.env)
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
set -a
. "${HOME}/.4nk_template/.env"
set +a
fi
TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
@ -21,11 +29,11 @@ if [[ $issues -eq 0 ]]; then
echo "- Aucun problème formel bloquant détecté." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Évalue la qualité formelle (français uniquement, typographie, absence dexemples applicatifs, intro/conclusion) et propose 5 recommandations priorisées.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -1,6 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
# Chargement env utilisateur (~/.4nk_template/.env)
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
set -a
. "${HOME}/.4nk_template/.env"
set +a
fi
# Portée (all|changed)
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
@ -74,11 +85,11 @@ if [[ "$HAS_SHELL_PWSH" -eq 1 && "$HAS_PWSH" -eq 1 ]]; then
fi
# IA (optionnelle)
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Analyse la conformité qualité technique du dépôt selon AGENTS.md et la CI. Priorise: lint/format/type-check, structure de tests, cohérence docs/CI, sécurité basique. Propose 5 actions concrètes.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -16,11 +16,11 @@ else
echo "- Dossier archive/ manquant (recommandé pour REX)." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Décris la boucle de triage complète (repro minimale, logs, bissection, hypothèses, tests ciblés, correctif, nonrégression) et quand produire un REX.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -1,140 +0,0 @@
Param(
[string]$TargetDir='.',
[string]$OutputDir='tests/reports/agents',
[string]$Agent='all'
)
$bashOk = $false
try {
& bash -lc 'echo ok' | Out-Null
if ($LASTEXITCODE -eq 0) { $bashOk = $true }
} catch {}
if ($bashOk) {
& bash "scripts/agents/run.sh" $TargetDir $OutputDir $Agent
exit $LASTEXITCODE
}
# Fallback PowerShell (best-effort) lorsque bash n'est pas disponible
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
function Write-Report($name, $lines) {
$file = Join-Path $OutputDir $name
$lines | Out-File -FilePath $file -Encoding UTF8 -Force
Write-Host "Rapport: $file"
}
Set-Location $TargetDir
switch ($Agent) {
'documentation' {
$missing = @()
$required = @('docs/INDEX.md','docs/project/INDEX.md','docs/templates/INDEX.md')
foreach ($f in $required) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Documentation', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Documentation essentielle présente.' }
else { $content += '- Fichiers manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'documentation_agent.md' $content
}
'tests' {
$need = @('tests/unit','tests/integration','tests/connectivity','tests/external','tests/performance','tests/logs','tests/reports')
$missing = @(); foreach ($d in $need) { if (-not (Test-Path $d)) { $missing += $d } }
$content = @('# Agent Tests', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Structure de tests conforme.' } else { $content += '- Dossiers manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'tests_agent.md' $content
}
'performance' {
$content = @('# Agent Performance', '', '## Résultats (fallback PowerShell)')
if (Test-Path 'tests/performance') { $content += '- tests/performance présent.' } else { $content += '- tests/performance manquant.' }
Write-Report 'performance_agent.md' $content
}
'quality-technique' {
$missing = @()
$required = @('README.md','LICENSE','CONTRIBUTING.md','CODE_OF_CONDUCT.md','CHANGELOG.md','.gitea/workflows/ci.yml')
foreach ($f in $required) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Qualité technique', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Fichiers de base présents.' }
else { $content += '- Fichiers manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'quality_tech.md' $content
}
'open-source' {
$missing = @()
$required = @('LICENSE','CONTRIBUTING.md','CODE_OF_CONDUCT.md','docs/OPEN_SOURCE_CHECKLIST.md')
foreach ($f in $required) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Open Source', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Prérequis open source présents.' }
else { $content += '- Manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'open_source_agent.md' $content
}
'securite' {
$missing = @(); foreach ($f in @('docs/SECURITY_AUDIT.md','.gitea/workflows/ci.yml')) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Sécurité', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Socle sécurité et CI présents.' } else { $content += '- Manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'security_agent.md' $content
}
'deploiement' {
$missing = @(); foreach ($f in @('docs/DEPLOYMENT.md','.gitea/workflows/ci.yml')) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Déploiement', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Documentation et CI de déploiement présentes (à valider).' } else { $content += '- Manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'deployment_agent.md' $content
}
'dependances' {
$content = @('# Agent Dépendances', '', '## Résultats (fallback PowerShell)','- Politique à documenter dans ARCHITECTURE/CONFIGURATION/CHANGELOG')
Write-Report 'dependances_agent.md' $content
}
'compilation' {
$content = @('# Agent Compilation', '', '## Résultats (fallback PowerShell)')
if (Test-Path '.gitea/workflows/ci.yml') { $content += '- Étapes de build à vérifier dans la CI.' } else { $content += '- CI absente.' }
Write-Report 'compilation_agent.md' $content
}
'resolution' {
$content = @('# Agent Résolution', '', '## Résultats (fallback PowerShell)')
if (Test-Path 'archive') { $content += '- Dossier archive/ présent pour REX.' } else { $content += '- Dossier archive/ manquant.' }
Write-Report 'resolution_agent.md' $content
}
'ssh-scripts' {
$found = @(); $paths = @('scripts/auto-ssh-push.sh','scripts/init-ssh-env.sh','scripts/setup-ssh-ci.sh','scripts/scripts/auto-ssh-push.sh','scripts/scripts/init-ssh-env.sh','scripts/scripts/setup-ssh-ci.sh')
foreach ($p in $paths) { if (Test-Path $p) { $found += $p } }
$content = @('# Agent SSH & scripts', '', '## Résultats (fallback PowerShell)')
if ($found.Count -gt 0) { $content += '- Scripts trouvés:'; $found | ForEach-Object { $content += " - $_" } } else { $content += '- Aucun script standard détecté.' }
if (Test-Path 'docs/SSH_UPDATE.md') { $content += '- docs/SSH_UPDATE.md présent.' }
Write-Report 'ssh_scripts_agent.md' $content
}
'frontend' {
$content = @('# Agent Frontend', '', '## Résultats (fallback PowerShell)','- Vérifier code splitting, état centralisé, abstraction services (si frontend présent).')
Write-Report 'frontend_agent.md' $content
}
'gitea' {
$need = @('.gitea/ISSUE_TEMPLATE/bug_report.md','.gitea/ISSUE_TEMPLATE/feature_request.md','.gitea/PULL_REQUEST_TEMPLATE.md','.gitea/workflows/ci.yml')
$missing = @(); foreach ($f in $need) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Gitea', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- Configuration Gitea présente.' } else { $content += '- Manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'gitea_agent.md' $content
}
'versionnage' {
$missing = @(); foreach ($f in @('CHANGELOG.md','TEMPLATE_VERSION')) { if (-not (Test-Path $f)) { $missing += $f } }
$content = @('# Agent Versionnage', '', '## Résultats (fallback PowerShell)')
if ($missing.Count -eq 0) { $content += '- CHANGELOG et TEMPLATE_VERSION présents.' } else { $content += '- Manquants:'; $missing | ForEach-Object { $content += " - $_" } }
Write-Report 'versionnage_agent.md' $content
}
'sync-template' {
$content = @('# Agent Synchronisation de template', '', '## Résultats (fallback PowerShell)')
if (Test-Path '.gitea/workflows/template-sync.yml') { $content += '- Workflow template-sync présent.' } else { $content += '- Workflow template-sync manquant.' }
if (Test-Path '.4nk-sync.yml') { $content += '- Manifeste .4nk-sync.yml présent.' } else { $content += '- Manifeste .4nk-sync.yml manquant.' }
Write-Report 'sync_template_agent.md' $content
}
'derogations-locales' {
$content = @('# Agent Dérogations locales', '', '## Résultats (fallback PowerShell)')
if ((Test-Path 'LOCAL_OVERRIDES.yml') -or (Test-Path '.gitea/workflows/LOCAL_OVERRIDES.yml')) { $content += '- Fichier de dérogations détecté.' } else { $content += '- Aucun fichier de dérogations détecté.' }
Write-Report 'derogations_locales_agent.md' $content
}
'all' {
foreach ($a in @('documentation','tests','performance','quality-technique','open-source','securite','deploiement','dependances','compilation','resolution','ssh-scripts','frontend','gitea','versionnage','sync-template','derogations-locales')) {
& $PSCommandPath -TargetDir $TargetDir -OutputDir $OutputDir -Agent $a
}
}
default {
Write-Error "Agent inconnu (fallback): $Agent"; exit 2
}
}
exit 0

View File

@ -26,6 +26,7 @@ Agents:
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
@ -34,6 +35,8 @@ USAGE
AGENT="${3:-all}"
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)
@ -75,6 +78,7 @@ case "$AGENT" in
derogations-locales)
"$DIR/derogations_locales_agent.sh" "$TARGET_DIR" "$OUTPUT_DIR" ;;
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

View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "${OUTPUT_DIR}"
report="${OUTPUT_DIR}/runner_agent.md"
echo "# Agent Runner" >"${report}"
echo >>"${report}"
if ! command -v docker >/dev/null 2>&1; then
echo "- Docker non détecté sur l'hôte. Impossible de gérer le runner." >>"${report}"
exit 0
fi
if [[ -f "runner/docker-compose.yml" ]]; then
(
cd runne
# Démarre (ou met à jour) le runne
docker compose up -d || true
)
echo "- Runner démarré/présent via docker compose (runner/docker-compose.yml)." >>"${report}"
else
echo "- Fichier runner/docker-compose.yml introuvable; aucun démarrage effectué." >>"${report}"
fi
echo "- Rapports: ${report}" >>"${report}"
exit 0

View File

@ -5,11 +5,17 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/security_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Sécurité" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(scripts/security/audit.sh .gitea/workflows/ci.yml docs/SECURITY_AUDIT.md)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement sécurité pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
echo "## Résultats locaux" >> "$SUMMARY_FILE"
if [[ -x scripts/security/audit.sh ]]; then
if scripts/security/audit.sh >> "$SUMMARY_FILE" 2>&1; then
@ -21,11 +27,11 @@ else
echo "- scripts/security/audit.sh introuvable ou non exécutable." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
À partir dun dépôt template, propose 5 contrôles sécurité CI/CD additionnels (secrets, permissions, dépendances, scans) et un ordre de priorité.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,11 +5,17 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/ssh_scripts_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent SSH & scripts" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(scripts/auto-ssh-push.sh scripts/init-ssh-env.sh scripts/setup-ssh-ci.sh docs/SSH_UPDATE.md)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement SSH/scripts pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
paths=(
scripts/auto-ssh-push.sh
scripts/init-ssh-env.sh
@ -27,11 +33,11 @@ if [[ $found -eq 0 ]]; then echo "- Scripts SSH standard introuvables (vérifier
if [[ -f docs/SSH_UPDATE.md ]]; then echo "- docs/SSH_UPDATE.md présent." >> "$SUMMARY_FILE"; fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Propose une checklist de conformité SSH (permissions, secrets CI, idempotence, journalisation non sensible) et intégration de contrôles CI.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,11 +5,17 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/structure_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Structure" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(docs .gitea scripts CHANGELOG.md AGENTS.md)
any=0; for p in "${relevant[@]}"; do if [[ -e "$p" ]] && is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement structurel pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
need=(docs .gitea scripts CHANGELOG.md AGENTS.md)
missing=()
for p in "${need[@]}"; do [[ -e "$p" ]] || missing+=("$p"); done
@ -21,11 +27,11 @@ else
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Vérifie lalignement avec larborescence 4NK_node et propose 5 corrections prioritaires (créations/archives/métadonnées) si des écarts sont détectés.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -22,11 +22,11 @@ else
echo "- Manifeste .4nk-sync.yml manquant." >> "$SUMMARY_FILE"
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Propose une procédure de synchronisation contrôlée (PR dédiée, vérif checksums/manifest_checksum, mise à jour TEMPLATE_VERSION, mise à jour CHANGELOG/INDEX).
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -1,10 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
# Chargement env utilisateur (~/.4nk_template/.env)
"$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/env/ensure_env.sh" || true
if [[ -f "${HOME}/.4nk_template/.env" ]]; then
set -a
. "${HOME}/.4nk_template/.env"
set +a
fi
TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/tests_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Tests" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
@ -21,13 +30,21 @@ if ((${#missing[@]}==0)); then
else
echo "- Dossiers manquants:" >> "$SUMMARY_FILE"
for m in "${missing[@]}"; do echo " - $m" >> "$SUMMARY_FILE"; done
if [[ "${AUTO_FIX:-0}" == "1" ]]; then
echo >> "$SUMMARY_FILE"
echo "## Autocorrections" >> "$SUMMARY_FILE"
for m in "${missing[@]}"; do
mkdir -p "$m" && echo "- Créé: $m" >> "$SUMMARY_FILE"
done
mkdir -p tests/reports/agents tests/logs || true
fi
fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Propose un plan court pour renforcer la pyramide de tests (unit, integration, connectivity, external, performance) pour ce template, avec 5 actions.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -5,22 +5,28 @@ TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/versionnage_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Versionnage" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(CHANGELOG.md TEMPLATE_VERSION)
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement versionnage pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
ok=1
for f in CHANGELOG.md TEMPLATE_VERSION; do
if [[ ! -f "$f" ]]; then echo "- Manquant: $f" >> "$SUMMARY_FILE"; ok=0; fi
done
if [[ $ok -eq 1 ]]; then echo "- CHANGELOG et TEMPLATE_VERSION présents." >> "$SUMMARY_FILE"; fi
PROMPT=$(cat <<'P'
PROMPT=$(cat <<'EOF'
Décris la procédure dalignement version ↔ changelog ↔ tag git (latest vs wip) et conditions de blocage release.
P
EOF
)
"scripts/agents/ai_prompt.sh" "$PROMPT" >> "$SUMMARY_FILE" || true
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null

View File

@ -19,3 +19,4 @@ fi
echo "Version alignment OK"

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
IMAGE_NAME="4nk-template-dev:debian"
DOCKERFILE="docker/Dockerfile.debian"
echo "[build] ${IMAGE_NAME}"
docker build -t "${IMAGE_NAME}" -f "${DOCKERFILE}" .
echo "[run] launching container and executing agents"
docker run --rm -it \
-v "${PWD}:/work" -w /work \
"${IMAGE_NAME}" \
"scripts/agents/run.sh; ls -la tests/reports/agents || true"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
# Build et lance le conteneur unifié (runner+agents) sur ce projet
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$ROOT_DIR"
# Build image
docker compose -f docker-compose.ci.yml build
# Exécuter agents par défaut
RUNNER_MODE="${RUNNER_MODE:-agents}" BASE_URL="${BASE_URL:-}" REGISTRATION_TOKEN="${REGISTRATION_TOKEN:-}" \
docker compose -f docker-compose.ci.yml up --remove-orphans --abort-on-container-exit

View File

@ -64,3 +64,4 @@ esac
echo "[release-guard] OK"

View File

@ -35,7 +35,7 @@ auto_push() {
# Ajouter tous les changements
git add .
# Ne pas commiter si rien à commiter
# Ne pas commiter si rien à commite
if [[ -z "$(git diff --cached --name-only)" ]]; then
echo " Aucun changement indexé. Skip commit/push."
return 0

View File

@ -34,3 +34,4 @@ fi
echo "[security-audit] terminé rc=$rc"
exit $rc