ai-rebase.sh 812 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. set -e
  3. VERSION=1.0
  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. echo git fetch $part1 $part2
  17. git fetch $part1 $part2
  18. fi
  19. docker run --rm -it \
  20. -v "$(pwd):/repo" \
  21. -v "$HOME/.gitconfig:/home/appuser/.gitconfig:ro" \
  22. -v "$HOME/.git-credentials:/home/appuser/.git-credentials:ro" \
  23. -e GEMINI_API_KEY="$GEMINI_API_KEY" \
  24. -e GEMINI_MODEL="${GEMINI_MODEL:-gemini-2.0-flash}" \
  25. -u "$(id -u):$(id -g)" \
  26. "senomas/git-rebase:$VERSION" "$@"