OSVauco/scripts/osv-auto-commit.sh

46 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# OSVauco auto-commit — legger bare til "lovlige" paths
set -euo pipefail
GREEN="$(tput setaf 2 || true)"
YELLOW="$(tput setaf 3 || true)"
RED="$(tput setaf 1 || true)"
RESET="$(tput sgr0 || true)"
echo "============================================================"
echo " OSVAUCO · AUTO-COMMIT"
echo "============================================================"
echo
# Vis kort status
git status --short || {
echo " ${RED}git status feilet — er du i riktig repo?${RESET}"
exit 1
}
echo
echo " ${YELLOW}Legger til endringer i disse pathene:${RESET}"
echo " - docs/"
echo " - scripts/"
echo " - .gemini/"
echo " - README*"
echo
git add docs/ scripts/ .gemini/ README* 2>/dev/null || true
if git diff --cached --quiet; then
echo " ${YELLOW}Ingen staged endringer etter filteret — ingenting å committe.${RESET}"
exit 0
fi
echo
read -r -p "[OSVauco] Commit-melding: " MSG
if [ -z "$MSG" ]; then
echo " ${RED}Avbryter: tom commit-melding.${RESET}"
exit 1
fi
git commit -m "$MSG"
echo " ${GREEN}✅ Commit OK. Husk: git push origin main${RESET}"