[skip ci] chore(agents): centralisation via 4NK_template (hooks+doc)

This commit is contained in:
Debian 2025-08-28 12:05:18 +00:00
parent ed2c658d88
commit 18434a787b
5 changed files with 63 additions and 24 deletions

View File

@ -0,0 +1,6 @@
# Intégration des agents 4NK_template
- Hooks centralisés: pre-commit / pre-push via ../4NK_template (Docker).
- Pré-requis: ~/.4nk_template/.env monté en RO dans le conteneur.
- Exécution: scripts/local/precommit.sh ou git push (déclenche pre-push).
- Rapports: tests/reports/agents/.

19
scripts/local/install_hooks.sh Executable file
View 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)."

View File

@ -1,18 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Script de pré-commit pour 4NK_wallet # Exécuter les agents depuis l'image Docker de 4NK_template sur le projet courant
# Lance les agents de 4NK_template sur ce projet PROJECT_DIR="$(git rev-parse --show-toplevel)"
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" mkdir -p "${PROJECT_DIR}/tests/reports/agents"
TEMPLATE_DIR="$(cd "$PROJECT_DIR/../4NK_template" && pwd)" "${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
echo "=== Pré-commit 4NK_wallet via 4NK_template ===" echo "[pre-commit] OK (agents via 4NK_template)"
# Créer le dossier de sortie
mkdir -p "$PROJECT_DIR/tests/reports/agents"
# Lancer les agents de 4NK_template sur ce projet
"$TEMPLATE_DIR/scripts/local/run_agents_for_project.sh" "$PROJECT_DIR" "tests/reports/agents"
echo "=== Pré-commit terminé ==="

View File

@ -1,20 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Exécuter les agents depuis l'image Docker de 4NK_template sur le projet courant
cd "$ROOT_DIR/.." PROJECT_DIR="$(git rev-parse --show-toplevel)"
TEMPLATE_DIR="$(cd "${PROJECT_DIR}/../4NK_template" && pwd)"
# Agents complets mkdir -p "${PROJECT_DIR}/tests/reports/agents"
AUTO_FIX="${AUTO_FIX:-1}" SCOPE="${SCOPE:-all}" scripts/agents/run.sh "${TEMPLATE_DIR}/scripts/local/run_agents_for_project.sh" "${PROJECT_DIR}" "tests/reports/agents"
# Audit sécurité (best effort) # Audit sécurité (best effort) dans le contexte du projet
if [ -f scripts/security/audit.sh ]; then if [ -f "${PROJECT_DIR}/scripts/security/audit.sh" ]; then
bash scripts/security/audit.sh || true (cd "${PROJECT_DIR}" && bash scripts/security/audit.sh) || true
fi fi
# Release guard (dry-run logique) # Release guard (dry-run logique) dans le contexte du projet
if [ -f scripts/release/guard.sh ]; then if [ -f "${PROJECT_DIR}/scripts/release/guard.sh" ]; then
bash scripts/release/guard.sh || true (cd "${PROJECT_DIR}" && bash scripts/release/guard.sh) || true
fi fi
echo "[pre-push] OK" echo "[pre-push] OK (agents via 4NK_template)"

20
scripts/local/release_local.sh Executable file
View 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"