docs(USAGE): hooks pre-commit/pre-push via run_agents_for_project.sh; fix hooks
This commit is contained in:
parent
25453b045e
commit
948b11793a
@ -75,26 +75,31 @@ git tag -a vYYYY.MM.P -m "release: vYYYY.MM.P (latest)"
|
||||
git push && git push origin vYYYY.MM.P
|
||||
```
|
||||
|
||||
### Hooks conseillés
|
||||
### Hooks conseillés (agents centralisés via 4NK_template)
|
||||
|
||||
`.git/hooks/pre-commit`:
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
npx -y markdownlint-cli "**/*.md" --ignore "archive/**"
|
||||
AUTO_FIX=1 SCOPE=changed scripts/agents/run.sh
|
||||
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 -e
|
||||
AUTO_FIX=1 SCOPE=all scripts/agents/run.sh
|
||||
bash scripts/security/audit.sh || true
|
||||
bash scripts/release/guard.sh || true
|
||||
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:
|
||||
Ou installez-les automatiquement (les hooks fournis appellent déjà le runner centralisé):
|
||||
|
||||
```bash
|
||||
bash scripts/local/install_hooks.sh
|
||||
|
@ -12,7 +12,8 @@ install_hook() {
|
||||
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."
|
||||
echo "Hooks installés (mode agents via 4NK_template)."
|
||||
|
@ -1,16 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR/.."
|
||||
# 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)"
|
||||
|
||||
# Exécuter les agents via le conteneur CI (Docker Compose)
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
docker compose -f docker-compose.ci.yml build
|
||||
RUNNER_MODE="agents" docker compose -f docker-compose.ci.yml up --abort-on-container-exit
|
||||
else
|
||||
echo "Docker requis pour exécuter les agents via conteneur." >&2
|
||||
exit 2
|
||||
fi
|
||||
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 Docker)"
|
||||
echo "[pre-commit] OK (agents via 4NK_template)"
|
||||
|
@ -1,20 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR/.."
|
||||
# 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)"
|
||||
|
||||
# Agents complets
|
||||
AUTO_FIX="${AUTO_FIX:-1}" SCOPE="${SCOPE:-all}" scripts/agents/run.sh
|
||||
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)
|
||||
if [ -f scripts/security/audit.sh ]; then
|
||||
bash scripts/security/audit.sh || true
|
||||
# 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)
|
||||
if [ -f scripts/release/guard.sh ]; then
|
||||
bash scripts/release/guard.sh || true
|
||||
# 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"
|
||||
echo "[pre-push] OK (agents via 4NK_template)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user