Add global installation capability and fix venv accessibility issue

- Add make install-global target with intelligent installation methods
- Support pipx (recommended), pip --user, and fallback options
- Resolve issue where kaizen-agentic was only available in local venv
- Update documentation to clearly explain 4 installation options:
  - Development mode (local venv)
  - Global installation (any directory)
  - Local package testing (local venv)
  - Future PyPI installation
- CLI now available globally from any directory after make install-global

Fixes the core issue where users couldn't access kaizen-agentic from other repos.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-19 22:03:10 +02:00
parent 19b3c16cce
commit b257b3c906
3 changed files with 113 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
# Makefile for Kaizen Agentic development tasks
.PHONY: help setup-complete setup-structure setup-python setup-tools setup-docs setup-tests setup-verify ensure-project-structure install-dev install-local standards-check standards-fix standards-test test test-all build clean lint format venv-status agents-list agents-update agents-validate agents-status agents-install-cli release-check release-prepare release-test release-publish release-finalize release-rollback
.PHONY: help setup-complete setup-structure setup-python setup-tools setup-docs setup-tests setup-verify ensure-project-structure install-dev install-local install-global standards-check standards-fix standards-test test test-all build clean lint format venv-status agents-list agents-update agents-validate agents-status agents-install-cli release-check release-prepare release-test release-publish release-finalize release-rollback
# Variables
VENV = .venv
@@ -25,6 +25,7 @@ help:
@echo " setup-verify - Verify complete setup functionality"
@echo " install-dev - Install package in development mode"
@echo " install-local - Install from locally built package (test PyPI installation)"
@echo " install-global - Install globally from locally built package"
@echo " venv-status - Check if venv is active"
@echo ""
@echo "Standards Compliance:"
@@ -128,6 +129,77 @@ install-local: $(VENV)/bin/activate
echo " source $(VENV)/bin/activate"; \
echo " kaizen-agentic --help"
# Install globally from locally built package
install-global:
@echo "🌍 Installing kaizen-agentic globally from local package..."
@if [ ! -d "dist" ] || [ -z "$$(ls dist/*.whl 2>/dev/null)" ]; then \
echo "❌ No wheel package found in dist/"; \
echo " Run 'python3 -m build' first to create the package"; \
echo " Or run 'make release-prepare' for full build"; \
exit 1; \
fi; \
WHEEL_FILE=$$(ls dist/*.whl | head -1); \
VERSION=$$(basename "$$WHEEL_FILE" | sed 's/kaizen_agentic-\(.*\)-py3.*/\1/'); \
echo " Installing kaizen-agentic v$$VERSION globally..."; \
echo ""; \
echo "🔧 Trying installation methods in order:"; \
echo ""; \
if command -v pipx >/dev/null 2>&1; then \
echo " 📦 Method 1: Using pipx (recommended)..."; \
pipx uninstall kaizen-agentic 2>/dev/null || true; \
pipx install "$$WHEEL_FILE" && \
echo " ✅ Installed via pipx" && \
INSTALL_SUCCESS=1; \
else \
echo " ⚠️ pipx not found, trying pip --user..."; \
INSTALL_SUCCESS=0; \
fi; \
if [ "$$INSTALL_SUCCESS" != "1" ]; then \
echo " 📦 Method 2: Using pip --user..."; \
python3 -m pip uninstall -y kaizen-agentic 2>/dev/null || true; \
if python3 -m pip install --user "$$WHEEL_FILE" --force-reinstall 2>/dev/null; then \
echo " ✅ Installed via pip --user"; \
INSTALL_SUCCESS=1; \
else \
echo " ⚠️ pip --user failed, trying with --break-system-packages..."; \
fi; \
fi; \
if [ "$$INSTALL_SUCCESS" != "1" ]; then \
echo " 📦 Method 3: Using pip --break-system-packages..."; \
python3 -m pip install --user "$$WHEEL_FILE" --force-reinstall --break-system-packages && \
echo " ✅ Installed via pip with system override" && \
INSTALL_SUCCESS=1; \
fi; \
echo ""; \
if [ "$$INSTALL_SUCCESS" = "1" ]; then \
echo "✅ Global installation completed!"; \
echo " Version: $$VERSION"; \
echo ""; \
echo "🧪 Testing global installation..."; \
if command -v kaizen-agentic >/dev/null 2>&1; then \
echo " ✅ CLI command available globally"; \
kaizen-agentic --version; \
else \
echo " ⚠️ CLI not in PATH. Add to your PATH:"; \
if command -v pipx >/dev/null 2>&1; then \
echo " export PATH=\"$$HOME/.local/bin:$$PATH\""; \
else \
echo " export PATH=\"$$HOME/.local/bin:$$PATH\""; \
fi; \
echo " Add this to your ~/.bashrc or ~/.zshrc for persistence"; \
fi; \
echo ""; \
echo "💡 Usage:"; \
echo " kaizen-agentic --help # Available from any directory"; \
echo " cd /any/other/project && kaizen-agentic list"; \
else \
echo "❌ Global installation failed!"; \
echo " Manual installation options:"; \
echo " 1. Install pipx: python3 -m pip install --user pipx"; \
echo " 2. Or use: python3 -m pip install --user $$WHEEL_FILE --break-system-packages"; \
exit 1; \
fi
# Ensure proper Python project structure exists
ensure-project-structure:
@echo "🔍 Ensuring proper Python project structure..."