From 69f6fd182724a851094a25b1307f4a7b72badab1 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Sun, 14 Sep 2025 15:57:50 -0700 Subject: [PATCH] feat: integrate environment configuration into development workflow - Auto-create .env file from template during setup-dev - Add validate-config target to Makefile for configuration validation - Update check-uv.sh to use environment variable for GitHub URL - Provide helpful setup messages and next steps for developers --- Makefile | 17 +++++++++++++++-- check-uv.sh | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fead9d1..be9bc4f 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ .PHONY: help install install-dev clean test test-cov lint format type-check .PHONY: server cli demo docker-build docker-dev docker-prod docker-test .PHONY: pre-commit setup-dev deps-update deps-check security-check -.PHONY: build package publish docs release +.PHONY: build package publish docs release validate-config # Default target .DEFAULT_GOAL := help @@ -48,6 +48,11 @@ setup-dev: check-uv ## Set up development environment with uv uv venv --python python3 $(call success,Virtual environment created) @$(MAKE) install-dev + @if [ ! -f ".env" ] && [ -f ".env.example" ]; then \ + echo -e "$(BLUE)$(INFO_SYMBOL)$(NC) Creating .env file from template..."; \ + cp .env.example .env; \ + echo -e "$(GREEN)$(SUCCESS_SYMBOL)$(NC) .env file created. Please review and customize the settings."; \ + fi @if [ -f ".pre-commit-config.yaml" ]; then \ echo -e "$(BLUE)$(INFO_SYMBOL)$(NC) Installing pre-commit hooks..."; \ . $(VENV_PATH)/bin/activate && pre-commit install; \ @@ -196,13 +201,21 @@ cli: ## Run CLI with help fi demo: ## Run interactive demo - $(call info,Starting interactive demo...) + $(call header,UnitForge Demo) @if [ -f "$(VENV_PATH)/bin/activate" ]; then \ . $(VENV_PATH)/bin/activate && ./demo.sh; \ else \ ./demo.sh; \ fi +validate-config: ## Validate environment configuration + $(call header,Validating Configuration) + @if [ -f "$(VENV_PATH)/bin/activate" ]; then \ + . $(VENV_PATH)/bin/activate && python scripts/validate_config.py; \ + else \ + python3 scripts/validate_config.py; \ + fi + # Docker targets docker-build: ## Build Docker images $(call info,Building Docker images...) diff --git a/check-uv.sh b/check-uv.sh index 602bb67..256a775 100755 --- a/check-uv.sh +++ b/check-uv.sh @@ -233,7 +233,7 @@ fi echo "" echo -e "${CYAN}For more information:${NC}" -echo -e " ${BLUE}UnitForge: https://github.com/unitforge/unitforge${NC}" +echo -e " ${BLUE}UnitForge: ${GITHUB_URL:-https://github.com/will666/unitforge}${NC}" echo -e " ${BLUE}uv docs: https://github.com/astral-sh/uv${NC}" # Exit with appropriate code