-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (91 loc) · 3.19 KB
/
Makefile
File metadata and controls
107 lines (91 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Makefile for abc (AI bash/zsh/tcsh Command)
# Variables
PYTHON := python3
CONFIG_FILE := $(HOME)/.abc.conf
SHELL := /bin/bash
VENV := .venv
VENV_PYTHON := $(VENV)/bin/python
VENV_PIP := $(VENV)/bin/pip
# Files
CONFIG_TEMPLATE := abc.conf.template
# Default target
.DEFAULT_GOAL := help
.PHONY: help
help: ## Display this help message
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: install-pipx
install-pipx:
@if ! command -v pipx &> /dev/null; then \
echo "pipx is not installed. Please install it using your system package manager:"; \
echo " Ubuntu/Debian: sudo apt install pipx"; \
echo " macOS: brew install pipx"; \
echo " Other: python3 -m pip install --user pipx"; \
exit 1; \
fi
@$(PYTHON) -m pipx ensurepath
.PHONY: install
install: install-pipx ## Install abc with all providers
@echo "Installing abc using pipx..."
@$(PYTHON) -m pipx install --force .
@echo "Installing providers..."
@$(PYTHON) -m pipx inject abc-cli ./abc_provider_anthropic
@$(PYTHON) -m pipx inject abc-cli ./abc_provider_aws_bedrock
@$(PYTHON) -m pipx inject abc-cli ./abc_provider_openai
@abc_setup
.PHONY: install-dev
install-dev: install-pipx ## Install abc in development mode (editable)
@echo "Installing abc in development mode..."
@$(PYTHON) -m pipx install --force -e .
@echo "Installing providers in development mode..."
@$(PYTHON) -m pipx inject abc-cli -e ./abc_provider_anthropic
@$(PYTHON) -m pipx inject abc-cli -e ./abc_provider_aws_bedrock
@$(PYTHON) -m pipx inject abc-cli -e ./abc_provider_openai
@abc_setup
.PHONY: install-nix
install-nix: ## Install abc using Nix
@echo "Installing abc using Nix..."
@nix profile install .
@abc_setup
.PHONY: uninstall-nix
uninstall-nix: ## Uninstall abc from Nix profile
@echo "Uninstalling abc from Nix profile..."
@abc_setup --uninstall
@nix profile remove abc
.PHONY: setup
setup: ## Re-create the config file
@abc_setup
.PHONY: uninstall
uninstall: ## Uninstall abc
@echo "Uninstalling abc..."
@abc_setup --uninstall
@$(PYTHON) -m pipx uninstall abc-cli
.PHONY: tree
tree: ## Show a file tree
@git ls-files | tree --fromfile -a --filesfirst
$(VENV)/bin/activate: ## Create virtual environment
@echo "Creating virtual environment..."
@$(PYTHON) -m venv $(VENV)
$(VENV)/.test-deps: $(VENV)/bin/activate pyproject.toml
@echo "Installing test dependencies..."
@$(VENV_PIP) install -q -e ".[test]"
@touch $@
.PHONY: test
test: $(VENV)/.test-deps ## Run tests (use COVERAGE=1 for coverage report)
@echo "Running tests..."
@if [ "$(COVERAGE)" = "1" ]; then \
$(VENV_PYTHON) -m pytest --cov=abc_cli --cov-report=term-missing; \
else \
$(VENV_PYTHON) -m pytest; \
fi
.PHONY: clean
clean: ## Clean all artifacts (Python cache, test artifacts, and virtual environment)
@echo "Cleaning all artifacts..."
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
@find . -type f -name ".coverage" -exec rm -f {} + 2>/dev/null || true
@find . -type d -name "htmlcov" -exec rm -rf {} + 2>/dev/null || true
@rm -rf $(VENV)
@echo "Clean complete."