From 44438093a9daba56e1631dabe2fc128449bdc0e0 Mon Sep 17 00:00:00 2001 From: michele Date: Wed, 11 Mar 2026 17:31:54 +0000 Subject: [PATCH] feat: add day0 command handbook and git-linked changelog in Filament --- docs/NETGESCON-GIT-AUTOCHANGELOG.md | 36 ++++++ .../restart/AGENT-OPERATIVO-COMANDI-DAY0.md | 121 ++++++++++++++++++ docs/ai/restart/START-HERE-NETGESCON-DAY0.md | 13 +- .../pages/supporto/modifiche.blade.php | 13 ++ scripts/ops/netgescon-sync-git-changelog.sh | 119 +++++++++++++++++ 5 files changed, 296 insertions(+), 6 deletions(-) create mode 100644 docs/NETGESCON-GIT-AUTOCHANGELOG.md create mode 100644 docs/ai/restart/AGENT-OPERATIVO-COMANDI-DAY0.md create mode 100755 scripts/ops/netgescon-sync-git-changelog.sh diff --git a/docs/NETGESCON-GIT-AUTOCHANGELOG.md b/docs/NETGESCON-GIT-AUTOCHANGELOG.md new file mode 100644 index 0000000..99f34b6 --- /dev/null +++ b/docs/NETGESCON-GIT-AUTOCHANGELOG.md @@ -0,0 +1,36 @@ +# NetGescon Git Auto Changelog + +Generato automaticamente da Git il 11/03/2026 16:20. + +Repository sorgente: `/home/michele/netgescon/netgescon-day0` + +## Milestone Storico +- Prima registrazione Git disponibile: **29/06/2025** - `24992624` - Initial commit +- Commit storico dichiarato `1448a3d`: non presente nel repository locale corrente (possibile storico esterno). + +## Ultimi Commit Classificati + +| Data | Commit | Tipo | Messaggio | +| --- | --- | --- | --- | +| 11/03/2026 | `80cc382` | Operativo | ops: complete day0 restart commands and fix supporto/modifiche flow | +| 11/03/2026 | `13813fe` | Documentazione | docs: include continuity and filament cutover docs in start order | +| 11/03/2026 | `8fef3b2` | Aggiunto | feat: add filament-only cutover mode and checklist | +| 11/03/2026 | `dbbde9c` | Operativo | chore: ignore generated day0 audit reports | +| 11/03/2026 | `5375713` | Operativo | ops: add legacy vault sync for day0 continuity | +| 11/03/2026 | `f0932be` | Documentazione | docs: add day0 restart handoff pack | +| 10/03/2026 | `f52e56d` | Documentazione | docs: note gitea unblock and final day-0 push | +| 10/03/2026 | `ff0dc59` | Operativo | chore: day-0 workspace alignment and miki-bug isolation | + +## Uso Operativo + +1. Aggiorna il changelog automatico: + +```bash +bash scripts/ops/netgescon-sync-git-changelog.sh +``` + +2. Aggiorna changelog funzionale manuale (supporto/modifiche): + +```bash +bash scripts/ops/netgescon-add-modifica.sh --area "" --desc "" --type U +``` diff --git a/docs/ai/restart/AGENT-OPERATIVO-COMANDI-DAY0.md b/docs/ai/restart/AGENT-OPERATIVO-COMANDI-DAY0.md new file mode 100644 index 0000000..b0c7e07 --- /dev/null +++ b/docs/ai/restart/AGENT-OPERATIVO-COMANDI-DAY0.md @@ -0,0 +1,121 @@ +# Agent Operativo - Comandi Day-0 + +Documento operativo da dare al nuovo agent. + +## 0. Letture obbligatorie iniziali + +```bash +cd /home/michele/netgescon/netgescon-day0 +sed -n '1,220p' docs/ai/restart/START-HERE-NETGESCON-DAY0.md +sed -n '1,260p' docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md +sed -n '1,260p' docs/ai/restart/CONTINUITA-STORICO-DAY0.md +sed -n '1,260p' docs/ai/restart/FILAMENT-ONLY-CUTOVER-CHECKLIST.md +``` + +## 1. Preflight workspace e continuita + +```bash +cd /home/michele/netgescon/netgescon-day0 +git pull --rebase origin main +git status --short --branch +bash scripts/ops/netgescon-day0-legacy-sync.sh +``` + +## 2. Dipendenze locali (se mancanti) + +```bash +cd /home/michele/netgescon/netgescon-day0 +composer install +npm install +``` + +## 3. Avvio/Riavvio server sviluppo su :8000 + +```bash +pkill -f "php artisan serve --host=0.0.0.0 --port=8000" || true +cd /home/michele/netgescon/netgescon-day0 +mkdir -p storage/logs +nohup php artisan serve --host=0.0.0.0 --port=8000 --no-reload > storage/logs/dev-server.log 2>&1 & +sleep 2 +curl -I -sS http://127.0.0.1:8000/up | head -n 1 +``` + +## 4. Check Filament e pagina modifiche + +```bash +curl -I -sS http://127.0.0.1:8000/admin-filament | head -n 1 +curl -I -sS http://127.0.0.1:8000/admin-filament/supporto/modifiche | head -n 1 +``` + +## 5. Aggiornare changelog manuale (feature/bug) + +```bash +cd /home/michele/netgescon/netgescon-day0 +bash scripts/ops/netgescon-add-modifica.sh \ + --area "Filament / Ticket / Google" \ + --desc "" \ + --type U +``` + +Tipi validi: + +- `U` utenti finali +- `P` operativo/sviluppo +- `E` errore non bloccante +- `E!` errore bloccante + +## 6. Agganciare il changelog automatico al Git + +```bash +cd /home/michele/netgescon/netgescon-day0 +bash scripts/ops/netgescon-sync-git-changelog.sh +``` + +File generato: + +- `docs/NETGESCON-GIT-AUTOCHANGELOG.md` + +## 7. Commit e push con changelog aggiornato + +```bash +cd /home/michele/netgescon/netgescon-day0 +git add docs/NETGESCON-MODIFICHE.md docs/NETGESCON-GIT-AUTOCHANGELOG.md +git add -A +git commit -m "feat: " +git push origin main +``` + +## 8. Backup chat/sessione AI (anti-perdita) + +```bash +cd /home/michele/netgescon/netgescon-day0 +bash scripts/ai/handoff_checkpoint.sh +bash scripts/ai/topic_checkpoint.sh "NetGescon Day-0" "Checkpoint operativo" +bash scripts/ai/save_periodic_summary.sh "NetGescon Day-0" both +bash scripts/ai/archive_heavy_chats.sh --threshold=150 --dry-run +bash scripts/ai/archive_heavy_chats.sh --threshold=150 --apply +bash scripts/ai/continuity_auto.sh --threshold=150 --topic="NetGescon Day-0" --note="Ripartenza sviluppo" +``` + +## 9. Ciclo aggiornamento staging + +```bash +cd /var/www/netgescon +php artisan optimize:clear +php artisan config:clear +php artisan route:clear +php artisan netgescon:update --channel=free +php artisan netgescon:update --channel=free --apply +curl -I -sS "https://staging.netgescon.it/up" | head -n 1 +curl -I -sS "https://staging.netgescon.it/fornitore/tickets?fornitore=1" | head -n 1 +``` + +## 10. Prompt standard da dare al nuovo agent + +```text +Leggi prima: +- docs/ai/restart/AGENT-OPERATIVO-COMANDI-DAY0.md +- docs/ai/restart/START-HERE-NETGESCON-DAY0.md +- docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md +Poi esegui i passi 1->10 senza saltare controlli. +``` diff --git a/docs/ai/restart/START-HERE-NETGESCON-DAY0.md b/docs/ai/restart/START-HERE-NETGESCON-DAY0.md index 9bba455..6720d47 100644 --- a/docs/ai/restart/START-HERE-NETGESCON-DAY0.md +++ b/docs/ai/restart/START-HERE-NETGESCON-DAY0.md @@ -118,12 +118,13 @@ ### H. Ciclo update staging ## Documenti da leggere in ordine (ripartenza agent) 1. `docs/ai/restart/START-HERE-NETGESCON-DAY0.md` (questo file) -2. `docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md` -3. `docs/ai/restart/CONTINUITA-STORICO-DAY0.md` -4. `docs/ai/restart/FILAMENT-ONLY-CUTOVER-CHECKLIST.md` -5. `docs/RUNBOOK-DISTRIBUZIONE-REMOTA-NETGESCON.md` -6. `docs/distribuzione-update-netgescon.md` -7. `Miki-Bug-workspace/AGENT_GIT.MD` +2. `docs/ai/restart/AGENT-OPERATIVO-COMANDI-DAY0.md` +3. `docs/ai/restart/HANDOFF_AGENT_OPERATIVO_20260311.md` +4. `docs/ai/restart/CONTINUITA-STORICO-DAY0.md` +5. `docs/ai/restart/FILAMENT-ONLY-CUTOVER-CHECKLIST.md` +6. `docs/RUNBOOK-DISTRIBUZIONE-REMOTA-NETGESCON.md` +7. `docs/distribuzione-update-netgescon.md` +8. `Miki-Bug-workspace/AGENT_GIT.MD` ## Modifiche chiave gia presenti nel Day-0 diff --git a/resources/views/filament/pages/supporto/modifiche.blade.php b/resources/views/filament/pages/supporto/modifiche.blade.php index bf65c41..fdb8ae3 100644 --- a/resources/views/filament/pages/supporto/modifiche.blade.php +++ b/resources/views/filament/pages/supporto/modifiche.blade.php @@ -30,6 +30,9 @@ $path = base_path('docs/NETGESCON-MODIFICHE.md'); $raw = file_exists($path) ? file_get_contents($path) : "# Modifiche\n\nFile non trovato: {$path}\n"; + $gitPath = base_path('docs/NETGESCON-GIT-AUTOCHANGELOG.md'); + $gitRaw = file_exists($gitPath) ? file_get_contents($gitPath) : "# Git Auto Changelog\n\nFile non trovato: {$gitPath}\nEsegui: `bash scripts/ops/netgescon-sync-git-changelog.sh`\n"; + // Mini-render: sostituisce tag tipo [U], [P], [E], [E!] con un quadratino colorato. $replacements = [ '[E!]' => 'E!', @@ -40,6 +43,9 @@ $rawHtml = \Illuminate\Support\Str::markdown($raw); $rawHtml = str_replace(array_keys($replacements), array_values($replacements), $rawHtml); + + $gitRawHtml = \Illuminate\Support\Str::markdown($gitRaw); + $gitRawHtml = str_replace(array_keys($replacements), array_values($replacements), $gitRawHtml); @endphp @@ -47,5 +53,12 @@ {!! $rawHtml !!} + + +
Changelog Automatico da Git
+
+ {!! $gitRawHtml !!} +
+
diff --git a/scripts/ops/netgescon-sync-git-changelog.sh b/scripts/ops/netgescon-sync-git-changelog.sh new file mode 100755 index 0000000..b856656 --- /dev/null +++ b/scripts/ops/netgescon-sync-git-changelog.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Generate an automatic Git-based changelog used by Filament support page. + +REPO_DIR="$(pwd)" +LEGACY_REPO_DIR="/home/michele/netgescon/netgescon-laravel" +OUTPUT_FILE="docs/NETGESCON-GIT-AUTOCHANGELOG.md" +LIMIT="180" + +usage() { + cat <<'EOF' +Usage: + bash scripts/ops/netgescon-sync-git-changelog.sh [options] + +Options: + --repo Source repository for commit history (default: cwd) + --legacy-repo Legacy repo for long-term milestones (default: /home/michele/netgescon/netgescon-laravel) + --output Output markdown file (default: docs/NETGESCON-GIT-AUTOCHANGELOG.md) + --limit Number of commits to include (default: 180) + +Example: + bash scripts/ops/netgescon-sync-git-changelog.sh --repo /home/michele/netgescon/netgescon-day0 +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --repo) REPO_DIR="$2"; shift 2 ;; + --legacy-repo) LEGACY_REPO_DIR="$2"; shift 2 ;; + --output) OUTPUT_FILE="$2"; shift 2 ;; + --limit) LIMIT="$2"; shift 2 ;; + -h|--help) usage; exit 0 ;; + *) echo "Unknown option: $1" >&2; exit 1 ;; + esac +done + +[[ -d "$REPO_DIR/.git" ]] || { echo "Repo not found: $REPO_DIR" >&2; exit 1; } + +classify() { + local msg="$1" + local m + m="$(printf '%s' "$msg" | tr '[:upper:]' '[:lower:]')" + + if [[ "$m" =~ ^feat(\(.+\))?: ]]; then + echo "Aggiunto" + elif [[ "$m" =~ ^fix(\(.+\))?: ]]; then + echo "Risolto" + elif [[ "$m" =~ ^perf(\(.+\))?:|^refactor(\(.+\))?: ]]; then + echo "Migliorato" + elif [[ "$m" =~ ^docs(\(.+\))?: ]]; then + echo "Documentazione" + elif [[ "$m" =~ ^chore(\(.+\))?:|^ops(\(.+\))?: ]]; then + echo "Operativo" + else + echo "Aggiornato" + fi +} + +mkdir -p "$(dirname "$OUTPUT_FILE")" + +{ + echo "# NetGescon Git Auto Changelog" + echo + echo "Generato automaticamente da Git il $(date '+%d/%m/%Y %H:%M')." + echo + echo "Repository sorgente: \ +\`$REPO_DIR\`" + echo + echo "## Milestone Storico" + + if [[ -d "$LEGACY_REPO_DIR/.git" ]]; then + first_line="$(git -C "$LEGACY_REPO_DIR" log --reverse --date=format:'%d/%m/%Y' --pretty=format:'%h|%ad|%s' | head -n 1 || true)" + if [[ -n "$first_line" ]]; then + IFS='|' read -r fh fd fs <<< "$first_line" + echo "- Prima registrazione Git disponibile: **$fd** - \`$fh\` - $fs" + fi + + if git -C "$LEGACY_REPO_DIR" cat-file -e 1448a3d^{commit} 2>/dev/null; then + cdate="$(git -C "$LEGACY_REPO_DIR" show -s --date=format:'%d/%m/%Y' --pretty=format:'%ad' 1448a3d)" + cmsg="$(git -C "$LEGACY_REPO_DIR" show -s --pretty=format:'%s' 1448a3d)" + echo "- Commit storico dichiarato trovato: **$cdate** - \`1448a3d\` - $cmsg" + else + echo "- Commit storico dichiarato \`1448a3d\`: non presente nel repository locale corrente (possibile storico esterno)." + fi + else + echo "- Repository legacy non disponibile in: \`$LEGACY_REPO_DIR\`." + fi + + echo + echo "## Ultimi Commit Classificati" + echo + echo "| Data | Commit | Tipo | Messaggio |" + echo "| --- | --- | --- | --- |" + + git -C "$REPO_DIR" log --date=format:'%d/%m/%Y' --pretty=format:'%h|%ad|%s' -n "$LIMIT" | while IFS='|' read -r hash date msg; do + kind="$(classify "$msg")" + clean_msg="$(printf '%s' "$msg" | sed 's/|/-/g')" + echo "| $date | \`$hash\` | $kind | $clean_msg |" + done + + echo + echo "## Uso Operativo" + echo + echo "1. Aggiorna il changelog automatico:" + echo + echo "\`\`\`bash" + echo "bash scripts/ops/netgescon-sync-git-changelog.sh" + echo "\`\`\`" + echo + echo "2. Aggiorna changelog funzionale manuale (supporto/modifiche):" + echo + echo "\`\`\`bash" + echo "bash scripts/ops/netgescon-add-modifica.sh --area \"\" --desc \"\" --type U" + echo "\`\`\`" +} > "$OUTPUT_FILE" + +echo "OK" +echo "GENERATED: $OUTPUT_FILE"