Skip to content

Commit 8808944

Browse files
committed
Migrate remaining files from monorepo
1 parent 2df19e9 commit 8808944

74 files changed

Lines changed: 31755 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# AutoPR Engine - Development Makefile
2+
# =====================================
3+
# Usage: make [target]
4+
# Run 'make help' for available commands
5+
6+
.PHONY: help install install-dev install-full clean clean-all test test-cov test-fast \
7+
lint lint-fix format check run server worker \
8+
docker-build docker-up docker-down docker-logs docker-shell docker-restart docker-clean \
9+
setup-action setup-venv setup-poetry env deps-update docs quickstart
10+
11+
# Default target
12+
.DEFAULT_GOAL := help
13+
14+
# Variables
15+
PYTHON := python3
16+
PIP := pip3
17+
DOCKER_COMPOSE := docker compose
18+
19+
# Colors
20+
BLUE := \033[0;34m
21+
GREEN := \033[0;32m
22+
YELLOW := \033[1;33m
23+
NC := \033[0m
24+
25+
#------------------------------------------------------------------------------
26+
# HELP
27+
#------------------------------------------------------------------------------
28+
29+
help: ## Show this help message
30+
@echo ""
31+
@echo "AutoPR Engine - Development Commands"
32+
@echo "====================================="
33+
@echo ""
34+
@echo "$(BLUE)Installation:$(NC)"
35+
@grep -E '^(install|setup)[a-zA-Z_-]*:.*?## ' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
36+
@echo ""
37+
@echo "$(BLUE)Development:$(NC)"
38+
@grep -E '^(test|lint|format|check|run|server|worker)[a-zA-Z_-]*:.*?## ' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
39+
@echo ""
40+
@echo "$(BLUE)Docker:$(NC)"
41+
@grep -E '^docker[a-zA-Z_-]*:.*?## ' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
42+
@echo ""
43+
@echo "$(BLUE)Utilities:$(NC)"
44+
@grep -E '^(clean|env)[a-zA-Z_-]*:.*?## ' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
45+
@echo ""
46+
47+
#------------------------------------------------------------------------------
48+
# INSTALLATION
49+
#------------------------------------------------------------------------------
50+
51+
install: ## Install AutoPR Engine (standard)
52+
@echo "$(BLUE)Installing AutoPR Engine...$(NC)"
53+
$(PIP) install -e .
54+
@echo "$(GREEN)Installation complete!$(NC)"
55+
56+
install-dev: ## Install with development dependencies
57+
@echo "$(BLUE)Installing AutoPR Engine (development mode)...$(NC)"
58+
$(PIP) install -e ".[dev]"
59+
pre-commit install
60+
@echo "$(GREEN)Development installation complete!$(NC)"
61+
62+
install-full: ## Install with all features
63+
@echo "$(BLUE)Installing AutoPR Engine (full)...$(NC)"
64+
$(PIP) install -e ".[full]"
65+
@echo "$(GREEN)Full installation complete!$(NC)"
66+
67+
setup-venv: ## Create and activate virtual environment
68+
@echo "$(BLUE)Creating virtual environment...$(NC)"
69+
$(PYTHON) -m venv venv
70+
@echo "$(GREEN)Virtual environment created!$(NC)"
71+
@echo "$(YELLOW)Activate with: source venv/bin/activate$(NC)"
72+
73+
setup-poetry: ## Install using Poetry
74+
@echo "$(BLUE)Installing with Poetry...$(NC)"
75+
poetry install
76+
@echo "$(GREEN)Poetry installation complete!$(NC)"
77+
78+
setup-action: ## Create GitHub Action workflow in current repo
79+
@echo "$(BLUE)Setting up GitHub Action...$(NC)"
80+
@mkdir -p .github/workflows
81+
@if [ -f templates/quick-start/autopr-workflow.yml ]; then \
82+
cp templates/quick-start/autopr-workflow.yml .github/workflows/autopr.yml; \
83+
echo "$(GREEN)Copied from local templates$(NC)"; \
84+
elif curl -sSL --fail https://raw.githubusercontent.com/JustAGhosT/autopr-engine/main/templates/quick-start/autopr-workflow.yml -o .github/workflows/autopr.yml; then \
85+
echo "$(GREEN)Downloaded from GitHub$(NC)"; \
86+
else \
87+
echo "$(RED)Failed to set up GitHub Action$(NC)"; \
88+
exit 1; \
89+
fi
90+
@echo "$(GREEN)Created .github/workflows/autopr.yml$(NC)"
91+
@echo "$(YELLOW)Remember to add OPENAI_API_KEY to your repository secrets!$(NC)"
92+
93+
#------------------------------------------------------------------------------
94+
# DEVELOPMENT
95+
#------------------------------------------------------------------------------
96+
97+
test: ## Run tests
98+
@echo "$(BLUE)Running tests...$(NC)"
99+
pytest tests/ -v
100+
101+
test-cov: ## Run tests with coverage
102+
@echo "$(BLUE)Running tests with coverage...$(NC)"
103+
pytest tests/ --cov=autopr --cov-report=html --cov-report=term
104+
105+
test-fast: ## Run tests (fast mode, stop on first failure)
106+
@echo "$(BLUE)Running tests (fast mode)...$(NC)"
107+
pytest tests/ -x -v
108+
109+
lint: ## Run linting checks
110+
@echo "$(BLUE)Running linters...$(NC)"
111+
ruff check autopr/
112+
mypy autopr/ --ignore-missing-imports
113+
114+
lint-fix: ## Fix linting issues automatically
115+
@echo "$(BLUE)Fixing linting issues...$(NC)"
116+
ruff check autopr/ --fix
117+
black autopr/
118+
119+
format: ## Format code with black and isort
120+
@echo "$(BLUE)Formatting code...$(NC)"
121+
black autopr/ tests/
122+
isort autopr/ tests/
123+
124+
check: lint test ## Run all checks (lint + test)
125+
126+
run: ## Run the CLI
127+
@echo "$(BLUE)Running AutoPR CLI...$(NC)"
128+
$(PYTHON) -m autopr.cli
129+
130+
server: ## Run the API server
131+
@echo "$(BLUE)Starting API server...$(NC)"
132+
$(PYTHON) -m autopr.server --reload
133+
134+
worker: ## Run the background worker
135+
@echo "$(BLUE)Starting background worker...$(NC)"
136+
$(PYTHON) -m autopr.worker
137+
138+
#------------------------------------------------------------------------------
139+
# DOCKER
140+
#------------------------------------------------------------------------------
141+
142+
docker-build: ## Build Docker image
143+
@echo "$(BLUE)Building Docker image...$(NC)"
144+
docker build -t autopr-engine:latest .
145+
146+
docker-up: ## Start all services with Docker Compose
147+
@echo "$(BLUE)Starting Docker services...$(NC)"
148+
$(DOCKER_COMPOSE) up -d
149+
150+
docker-down: ## Stop all Docker services
151+
@echo "$(BLUE)Stopping Docker services...$(NC)"
152+
$(DOCKER_COMPOSE) down
153+
154+
docker-logs: ## View Docker logs
155+
$(DOCKER_COMPOSE) logs -f
156+
157+
docker-shell: ## Open shell in running container
158+
$(DOCKER_COMPOSE) exec autopr-engine bash
159+
160+
docker-restart: docker-down docker-up ## Restart Docker services
161+
162+
docker-clean: ## Remove Docker containers and volumes
163+
@echo "$(YELLOW)Removing Docker containers and volumes...$(NC)"
164+
$(DOCKER_COMPOSE) down -v --remove-orphans
165+
166+
#------------------------------------------------------------------------------
167+
# UTILITIES
168+
#------------------------------------------------------------------------------
169+
170+
env: ## Create .env file from template
171+
@if [ ! -f .env ]; then \
172+
cp .env.example .env; \
173+
echo "$(GREEN)Created .env file$(NC)"; \
174+
echo "$(YELLOW)Please edit .env with your API keys$(NC)"; \
175+
else \
176+
echo "$(YELLOW).env file already exists$(NC)"; \
177+
fi
178+
179+
clean: ## Clean build artifacts
180+
@echo "$(BLUE)Cleaning build artifacts...$(NC)"
181+
rm -rf build/ dist/ *.egg-info/ .pytest_cache/ .mypy_cache/ .ruff_cache/
182+
rm -rf htmlcov/ .coverage
183+
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
184+
@echo "$(GREEN)Clean complete!$(NC)"
185+
186+
clean-all: clean ## Clean everything including venv
187+
rm -rf venv/
188+
rm -rf .venv/
189+
190+
deps-update: ## Update dependencies
191+
@echo "$(BLUE)Updating dependencies...$(NC)"
192+
poetry update
193+
194+
docs: ## Build documentation
195+
@echo "$(BLUE)Building documentation...$(NC)"
196+
cd docs && make html
197+
198+
#------------------------------------------------------------------------------
199+
# QUICK START
200+
#------------------------------------------------------------------------------
201+
202+
quickstart: env install ## Quick start: create env and install
203+
@echo ""
204+
@echo "$(GREEN)============================================$(NC)"
205+
@echo "$(GREEN)AutoPR Engine is ready!$(NC)"
206+
@echo "$(GREEN)============================================$(NC)"
207+
@echo ""
208+
@echo "Next steps:"
209+
@echo " 1. Edit .env with your API keys"
210+
@echo " 2. Run: make server"
211+
@echo " 3. Or add to your repo: make setup-action"
212+
@echo ""

alembic/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Generic single-database configuration.

0 commit comments

Comments
 (0)