ai-rebase.sh 885 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. set -e
  3. VERSION=1.1
  4. echo "AI-Rebase v$VERSION"
  5. # Check for required Git configuration files
  6. if [ ! -f "$HOME/.gitconfig" ]; then
  7. >&2 echo "Error: Git configuration file not found at $HOME/.gitconfig"
  8. exit 1
  9. fi
  10. if [ ! -f "$HOME/.git-credentials" ]; then
  11. >&2 echo "Error: Git credentials file not found at $HOME/.git-credentials"
  12. exit 1
  13. fi
  14. if [ ! "$1" = "--delete-backups" ]; then
  15. IFS='/' read -r part1 part2 <<<"$1"
  16. if [ -z "$part1" ] || [ -z "$part2" ]; then
  17. echo no fetch
  18. else
  19. echo git fetch $part1 $part2
  20. git fetch $part1 $part2
  21. fi
  22. fi
  23. docker run --rm -it \
  24. -v "$(pwd):/repo" \
  25. -v "$HOME/.gitconfig:/home/appuser/.gitconfig:ro" \
  26. -v "$HOME/.git-credentials:/home/appuser/.git-credentials:ro" \
  27. -e GEMINI_API_KEY="$GEMINI_API_KEY" \
  28. -e GEMINI_MODEL="${GEMINI_MODEL:-gemini-1.5-flash}" \
  29. -u "$(id -u):$(id -g)" \
  30. "senomas/git-rebase:$VERSION" "$@"