From fb57233ce8909cbbd5402e1ff3507b6b799ce0fd Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Mon, 29 Jun 2026 20:50:56 -0600 Subject: [PATCH] Add Jeannie last change review --- README.md | 4 +++ README.md.tmpl | 4 +++ docs/jeannie.1.md | 4 +++ jeannie | 8 ++++++ scripts/review-last-change | 54 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100755 scripts/review-last-change diff --git a/README.md b/README.md index 76a65ef..c5aaa7b 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,7 @@ Run a read-only health snapshot from the Debian server with: ./jeannie recover-plan ./jeannie recover-power --dry-run ./jeannie impact --since HEAD~1 +./jeannie review-last-change ./jeannie scorecard ./jeannie explain scorecard ./jeannie gitops-status @@ -346,6 +347,9 @@ edge/public checks. Use `recover-power --dry-run` to preview the sequence. `./jeannie impact --since HEAD~1` for the last commit or pass paths like `bootstrap/edge` and `apps/website`. +`review-last-change` summarizes the last commit, runs impact analysis for the +touched files, and prints validation plus rollback hints. + `scorecard` rolls up backup readiness, GitOps health, DNS/RPi health, cluster health, edge health, capacity pressure, security posture, public certificates, inventory, and docs freshness into a compact pass/warn/fail report. diff --git a/README.md.tmpl b/README.md.tmpl index 1399100..232de02 100644 --- a/README.md.tmpl +++ b/README.md.tmpl @@ -277,6 +277,7 @@ Run a read-only health snapshot from the Debian server with: ./{{ main_script }} recover-plan ./{{ main_script }} recover-power --dry-run ./{{ main_script }} impact --since HEAD~1 +./{{ main_script }} review-last-change ./{{ main_script }} scorecard ./{{ main_script }} explain scorecard ./{{ main_script }} gitops-status @@ -346,6 +347,9 @@ edge/public checks. Use `recover-power --dry-run` to preview the sequence. `./{{ main_script }} impact --since HEAD~1` for the last commit or pass paths like `bootstrap/edge` and `apps/website`. +`review-last-change` summarizes the last commit, runs impact analysis for the +touched files, and prints validation plus rollback hints. + `scorecard` rolls up backup readiness, GitOps health, DNS/RPi health, cluster health, edge health, capacity pressure, security posture, public certificates, inventory, and docs freshness into a compact pass/warn/fail report. diff --git a/docs/jeannie.1.md b/docs/jeannie.1.md index ec04b5a..73afbd3 100644 --- a/docs/jeannie.1.md +++ b/docs/jeannie.1.md @@ -118,6 +118,10 @@ pointers. : Explain which homelab areas are affected by changed files or explicit paths, including risk, touched services, validation commands, and apply path. +`review-last-change [REF]` +: Summarize a commit, list touched files, run impact analysis, and print generic +validation plus rollback hints. Defaults to `HEAD`. + `backup-status` : Report freshness for Gitea backups, OpenTofu state backups, restore drill reports, and repo-managed Pi-hole restore inputs. The main `status` cascade diff --git a/jeannie b/jeannie index 64a8160..e0029af 100755 --- a/jeannie +++ b/jeannie @@ -5875,6 +5875,10 @@ impact() { "${REPO_ROOT}/scripts/impact" "${@:2}" } +review_last_change() { + "${REPO_ROOT}/scripts/review-last-change" "${@:2}" +} + security_scan() { require_debian_server "security-scan" "${REPO_ROOT}/scripts/security-scan" all @@ -6142,6 +6146,7 @@ Operator View And Reports recover-plan Print disaster recovery order and prerequisites. recover-power [--dry-run] Run or preview post-outage recovery. impact [--since REF] [PATH...] Explain affected lab areas before changes. + review-last-change [REF] Summarize changed files, impact, validation. map [--dot] Print the homelab dependency map. change-journal {list|path} Show risky-command journal entries. release-snapshot Write a pre-change release snapshot. @@ -6415,6 +6420,9 @@ case "${1:-}" in impact) impact "$@" ;; + review-last-change) + review_last_change "$@" + ;; security-scan) security_scan ;; diff --git a/scripts/review-last-change b/scripts/review-last-change new file mode 100755 index 0000000..f06c6f4 --- /dev/null +++ b/scripts/review-last-change @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +REF="${1:-HEAD}" +changed_files=() + +usage() { + cat <<'EOF' +Usage: ./jeannie review-last-change [REF] + +Summarize a commit, show touched files, run impact analysis, and print useful +validation and rollback hints. Defaults to HEAD. +EOF +} + +case "$REF" in + -h|--help|help) + usage + exit 0 + ;; +esac + +if ! git -C "$REPO_ROOT" rev-parse --verify "$REF" >/dev/null 2>&1; then + echo "Unknown git ref: $REF" >&2 + exit 1 +fi + +echo "Jeannie Last Change Review" +echo "==========================" +echo +git -C "$REPO_ROOT" show --no-renames --stat --oneline "$REF" + +echo +echo "Changed files" +mapfile -t changed_files < <(git -C "$REPO_ROOT" diff-tree --no-commit-id --name-only -r "$REF") +printf ' %s\n' "${changed_files[@]}" + +echo +"${REPO_ROOT}/scripts/impact" "${changed_files[@]}" + +cat <