Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Makefile for AI Commit Tool
  2. # === Variables ===
  3. # Override these on the command line like: make build IMAGE_TAG=2.0
  4. IMAGE_NAME ?= docker.senomas.com/commit
  5. IMAGE_TAG ?= 1.1
  6. # Full image reference used in commands
  7. FULL_IMAGE_NAME = $(IMAGE_NAME):$(IMAGE_TAG)
  8. # Pass arguments to the run script via ARGS
  9. # Example: make run ARGS="-a"
  10. ARGS ?=
  11. # === Targets ===
  12. # Phony targets are not files
  13. .PHONY: help build run delete-backups
  14. # Default target when running 'make'
  15. .DEFAULT_GOAL := run
  16. help: ## Display this help message
  17. @echo "Usage: make [TARGET] [VARIABLE=VALUE ...]"
  18. @echo ""
  19. @echo "Targets:"
  20. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-10s %s\n", $$1, $$2}'
  21. @echo ""
  22. @echo "Variables:"
  23. @echo " IMAGE_NAME Docker image name (default: $(IMAGE_NAME))"
  24. @echo " IMAGE_TAG Docker image tag (default: $(IMAGE_TAG))"
  25. @echo " FULL_IMAGE_NAME Full image reference (derived: $(FULL_IMAGE_NAME))"
  26. @echo " ARGS Arguments to pass to ai-commit.sh (default: none)"
  27. build: ## Build the Docker image
  28. @echo "Building Docker image: $(FULL_IMAGE_NAME)..."
  29. docker build -t $(FULL_IMAGE_NAME) .
  30. @echo "Build complete: $(FULL_IMAGE_NAME)"
  31. run: build
  32. @echo "Running ai-commit.sh using image: $(FULL_IMAGE_NAME)..."
  33. @echo "Passing arguments: $(ARGS)"
  34. # Pass the image name via environment variable and arguments to the script
  35. DOCKER_IMAGE_NAME=$(FULL_IMAGE_NAME) ./ai-commit.sh $(ARGS)
  36. rebase: build
  37. @echo "Running ai-commit.sh using image: $(FULL_IMAGE_NAME)..."
  38. @echo "Passing arguments: $(ARGS)"
  39. # Pass the image name via environment variable and arguments to the script
  40. DOCKER_IMAGE_NAME=$(FULL_IMAGE_NAME) ./ai-commit.sh -r origin/master $(ARGS)
  41. rewrite: build
  42. @echo "Running ai-commit.sh using image: $(FULL_IMAGE_NAME)..."
  43. @echo "Passing arguments: $(ARGS)"
  44. # Pass the image name via environment variable and arguments to the script
  45. DOCKER_IMAGE_NAME=$(FULL_IMAGE_NAME) ./ai-commit.sh -w origin/master $(ARGS)
  46. delete-backups:
  47. git branch --list 'master-backup-*' | xargs git branch -D