#!/usr/bin/env bash
set -euo pipefail

cd "$(dirname "$0")/.."

if [[ -z "$(git status --porcelain)" ]]; then
  echo "Nothing to commit."
  exit 0
fi

echo "Current changes:"
git status --short
echo ""

read -rp "Commit note: " note

if [[ -z "$note" ]]; then
  echo "Aborted — empty commit message."
  exit 1
fi

git add -A
git commit -m "$note"
git push -u origin main
