# Makefile for AI Commit Tool # === Variables === # Override these on the command line like: make build IMAGE_TAG=2.0 IMAGE_NAME ?= docker.senomas.com/commit IMAGE_TAG ?= 1.1 # Full image reference used in commands FULL_IMAGE_NAME = $(IMAGE_NAME):$(IMAGE_TAG) # Pass arguments to the run script via ARGS # Example: make run ARGS="-a" ARGS ?= # === Targets === # Phony targets are not files .PHONY: help build run delete-backups # Default target when running 'make' .DEFAULT_GOAL := run help: ## Display this help message @echo "Usage: make [TARGET] [VARIABLE=VALUE ...]" @echo "" @echo "Targets:" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-10s %s\n", $$1, $$2}' @echo "" @echo "Variables:" @echo " IMAGE_NAME Docker image name (default: $(IMAGE_NAME))" @echo " IMAGE_TAG Docker image tag (default: $(IMAGE_TAG))" @echo " FULL_IMAGE_NAME Full image reference (derived: $(FULL_IMAGE_NAME))" @echo " ARGS Arguments to pass to ai-commit.sh (default: none)" build: ## Build the Docker image @echo "Building Docker image: $(FULL_IMAGE_NAME)..." docker build -t $(FULL_IMAGE_NAME) . @echo "Build complete: $(FULL_IMAGE_NAME)" run: build @echo "Running ai-commit.sh using image: $(FULL_IMAGE_NAME)..." @echo "Passing arguments: $(ARGS)" # Pass the image name via environment variable and arguments to the script DOCKER_IMAGE_NAME=$(FULL_IMAGE_NAME) ./ai-commit.sh $(ARGS) rebase: build @echo "Running ai-commit.sh using image: $(FULL_IMAGE_NAME)..." @echo "Passing arguments: $(ARGS)" # Pass the image name via environment variable and arguments to the script DOCKER_IMAGE_NAME=$(FULL_IMAGE_NAME) ./ai-commit.sh -r origin/master $(ARGS) rewrite: build @echo "Running ai-commit.sh using image: $(FULL_IMAGE_NAME)..." @echo "Passing arguments: $(ARGS)" # Pass the image name via environment variable and arguments to the script DOCKER_IMAGE_NAME=$(FULL_IMAGE_NAME) ./ai-commit.sh -w origin/master $(ARGS) delete-backups: git branch --list 'master-backup-*' | xargs git branch -D