- Add list-issues target for comprehensive issue overview - Add show-issue NUM=X target for detailed issue inspection - Add list-open-issues target for active backlog filtering - Configure gitea API endpoints with proper URL handling - Include error handling and jq fallback support - Enable command-line access to issue tracking and backlog This establishes foundation for issue-driven TDD workflow 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
276 lines
9.8 KiB
Makefile
276 lines
9.8 KiB
Makefile
# MarkiTect - Advanced Markdown Engine
|
|
# Makefile for common development tasks
|
|
|
|
.PHONY: help setup install test build clean update status dev lint format check-deps venv-status update-digest add-diary-entry list-issues show-issue list-open-issues
|
|
|
|
# Default target
|
|
help:
|
|
@echo "MarkiTect Development Commands"
|
|
@echo "=============================="
|
|
@echo ""
|
|
@echo "Environment Status:"
|
|
@$(MAKE) --no-print-directory venv-status
|
|
@echo ""
|
|
@echo "Setup & Installation:"
|
|
@echo " setup - Initial project setup (venv + install)"
|
|
@echo " install - Install package in development mode"
|
|
@echo " dev - Install with development dependencies"
|
|
@echo " venv-status - Check if venv is active"
|
|
@echo ""
|
|
@echo "Development:"
|
|
@echo " test - Run all tests"
|
|
@echo " build - Build the package"
|
|
@echo " lint - Run code linting"
|
|
@echo " format - Format code"
|
|
@echo ""
|
|
@echo "Maintenance:"
|
|
@echo " update - Update from upstream (git + submodules)"
|
|
@echo " status - Show git status for repo and submodules"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " check-deps - Check dependency status"
|
|
@echo ""
|
|
@echo "Documentation:"
|
|
@echo " update-digest - Update ProjectStatusDigest.md (requires Claude Code)"
|
|
@echo " add-diary-entry - Add new entry to ProjectDiary.md (requires Claude Code)"
|
|
@echo ""
|
|
@echo "Issue Management:"
|
|
@echo " list-issues - Show all gitea issues with status and priority"
|
|
@echo " list-open-issues - Show only open issues (active backlog)"
|
|
@echo " show-issue NUM=X - Show detailed view of specific issue"
|
|
|
|
# Python and virtual environment setup
|
|
PYTHON := python3
|
|
VENV := .venv
|
|
VENV_PYTHON := $(VENV)/bin/python
|
|
VENV_PIP := $(VENV)/bin/pip
|
|
|
|
# Check virtual environment status (read-only)
|
|
venv-status:
|
|
@if [ -f $(VENV)/bin/activate ] && [ -f $(VENV)/bin/python ]; then \
|
|
if [ -n "$$VIRTUAL_ENV" ] && [ "$$VIRTUAL_ENV" = "$$(realpath $(VENV))" ]; then \
|
|
echo " ✅ Virtual environment: Active in current shell"; \
|
|
elif [ -n "$$VIRTUAL_ENV" ]; then \
|
|
echo " ⚠️ Virtual environment: Different venv active ($$VIRTUAL_ENV)"; \
|
|
echo " Run 'deactivate' then 'source $(VENV)/bin/activate'"; \
|
|
else \
|
|
echo " 📁 Virtual environment: Ready but not activated"; \
|
|
echo " Run 'source $(VENV)/bin/activate' to activate"; \
|
|
fi; \
|
|
else \
|
|
echo " ❌ Virtual environment: Not found"; \
|
|
echo " Run 'make setup' to create and configure"; \
|
|
fi
|
|
|
|
# Setup virtual environment and install package
|
|
setup: $(VENV)/bin/activate install
|
|
@echo "✅ Project setup complete!"
|
|
|
|
$(VENV)/bin/activate:
|
|
@echo "🔧 Creating virtual environment..."
|
|
$(PYTHON) -m venv $(VENV)
|
|
$(VENV_PIP) install --upgrade pip setuptools wheel
|
|
|
|
# Install package in development mode
|
|
install: $(VENV)/bin/activate
|
|
@echo "📦 Installing MarkiTect in development mode..."
|
|
$(VENV_PIP) install -e .
|
|
|
|
# Install with development dependencies
|
|
dev: install
|
|
@echo "🛠️ Installing development dependencies..."
|
|
$(VENV_PIP) install pytest pytest-cov black flake8 mypy
|
|
|
|
# Run tests
|
|
test: $(VENV)/bin/activate
|
|
@echo "🧪 Running tests..."
|
|
@if [ -f $(VENV)/bin/pytest ]; then \
|
|
$(VENV)/bin/pytest tests/ -v; \
|
|
else \
|
|
$(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
|
|
$(VENV_PYTHON) -m unittest discover tests/ -v; \
|
|
fi
|
|
|
|
# Build the package
|
|
build: $(VENV)/bin/activate
|
|
@echo "🏗️ Building package..."
|
|
$(VENV_PYTHON) -m build 2>/dev/null || \
|
|
$(VENV_PIP) install build && $(VENV_PYTHON) -m build
|
|
|
|
# Code linting
|
|
lint: $(VENV)/bin/activate
|
|
@echo "🔍 Running linting..."
|
|
@if [ -f $(VENV)/bin/flake8 ]; then \
|
|
$(VENV)/bin/flake8 markitect/ tests/; \
|
|
else \
|
|
echo "⚠️ flake8 not installed. Run 'make dev' first."; \
|
|
fi
|
|
|
|
# Code formatting
|
|
format: $(VENV)/bin/activate
|
|
@echo "✨ Formatting code..."
|
|
@if [ -f $(VENV)/bin/black ]; then \
|
|
$(VENV)/bin/black markitect/ tests/; \
|
|
else \
|
|
echo "⚠️ black not installed. Run 'make dev' first."; \
|
|
fi
|
|
|
|
# Update from upstream
|
|
update:
|
|
@echo "🔄 Updating from upstream..."
|
|
@git status --porcelain | grep -q . && echo "⚠️ Working directory not clean. Commit or stash changes first." && exit 1 || true
|
|
git pull origin main
|
|
git submodule update --remote
|
|
@if git status --porcelain | grep -q "wiki"; then \
|
|
echo "📝 Committing wiki submodule update..."; \
|
|
git add wiki; \
|
|
git commit -m "Update wiki submodule to latest"; \
|
|
fi
|
|
@echo "✅ Update complete!"
|
|
|
|
# Show git status
|
|
status:
|
|
@echo "📊 Repository Status"
|
|
@echo "==================="
|
|
@echo ""
|
|
@echo "Main Repository:"
|
|
git status --short
|
|
@echo ""
|
|
@echo "Wiki Submodule:"
|
|
@cd wiki && git status --short
|
|
@echo ""
|
|
@echo "Recent Commits:"
|
|
git log --oneline -5
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
@echo "🧹 Cleaning build artifacts..."
|
|
rm -rf build/
|
|
rm -rf dist/
|
|
rm -rf *.egg-info/
|
|
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
find . -name "*.pyc" -delete 2>/dev/null || true
|
|
@echo "✅ Clean complete!"
|
|
|
|
# Check dependency status
|
|
check-deps: $(VENV)/bin/activate
|
|
@echo "📋 Dependency Status"
|
|
@echo "==================="
|
|
@echo ""
|
|
@echo "Python version:"
|
|
$(VENV_PYTHON) --version
|
|
@echo ""
|
|
@echo "Installed packages:"
|
|
$(VENV_PIP) list
|
|
@echo ""
|
|
@echo "Project dependencies:"
|
|
$(VENV_PIP) check
|
|
|
|
# Update project status digest (requires Claude Code)
|
|
update-digest:
|
|
@echo "🔍 Checking for Claude Code availability..."
|
|
@if ! command -v claude >/dev/null 2>&1; then \
|
|
echo "❌ Claude Code not found in PATH"; \
|
|
echo " This target requires Claude Code CLI to be installed"; \
|
|
echo " Visit: https://claude.ai/code for installation instructions"; \
|
|
exit 1; \
|
|
fi
|
|
@echo "✅ Claude Code found"
|
|
@echo "📝 Updating ProjectStatusDigest.md..."
|
|
@echo " Please ask Claude Code to update the project digest based on current state"
|
|
@echo " Command: 'Please update ProjectStatusDigest.md with the current project state'"
|
|
@echo ""
|
|
@echo "💡 Tip: You can also manually edit ProjectStatusDigest.md if needed"
|
|
|
|
# Add new entry to project diary (requires Claude Code)
|
|
add-diary-entry:
|
|
@echo "🔍 Checking for Claude Code availability..."
|
|
@if ! command -v claude >/dev/null 2>&1; then \
|
|
echo "❌ Claude Code not found in PATH"; \
|
|
echo " This target requires Claude Code CLI to be installed"; \
|
|
echo " Visit: https://claude.ai/code for installation instructions"; \
|
|
exit 1; \
|
|
fi
|
|
@echo "✅ Claude Code found"
|
|
@if [ ! -f ProjectDiary.md ]; then \
|
|
echo "❌ ProjectDiary.md not found"; \
|
|
echo " Create the diary file first or run this from the project root"; \
|
|
exit 1; \
|
|
fi
|
|
@echo "📖 Adding new entry to ProjectDiary.md..."
|
|
@echo " Please ask Claude Code to add a new diary entry for recent work"
|
|
@echo " Command: 'Please add a new entry to ProjectDiary.md summarizing recent progress'"
|
|
@echo ""
|
|
@echo "📋 Entry should include:"
|
|
@echo " - Date ($(shell date +%Y-%m-%d))"
|
|
@echo " - One-line progress characterization"
|
|
@echo " - Contributors since last entry"
|
|
@echo " - Time estimate and AI token usage"
|
|
@echo " - One paragraph work summary"
|
|
@echo ""
|
|
@echo "💡 Tip: New entries are added to the top for reverse chronological order"
|
|
|
|
# Git repository and API configuration
|
|
GITEA_URL := http://92.205.130.254:32166
|
|
REPO_OWNER := coulomb
|
|
REPO_NAME := markitect_project
|
|
ISSUES_API := $(GITEA_URL)/api/v1/repos/$(REPO_OWNER)/$(REPO_NAME)/issues
|
|
|
|
# List all gitea issues
|
|
list-issues:
|
|
@echo "📋 MarkiTect Issues from Gitea Repository"
|
|
@echo "========================================"
|
|
@echo ""
|
|
@if ! command -v curl >/dev/null 2>&1; then \
|
|
echo "❌ curl not found - required for API access"; \
|
|
exit 1; \
|
|
fi
|
|
@if ! command -v jq >/dev/null 2>&1; then \
|
|
echo "⚠️ jq not found - using basic formatting"; \
|
|
echo " Install jq for better formatting: sudo apt install jq"; \
|
|
curl -s "$(ISSUES_API)" | head -20; \
|
|
else \
|
|
curl -s "$(ISSUES_API)" | jq -r '.[] | "[\(.state | ascii_upcase)] #\(.number): \(.title)\n Created: \(.created_at[:10]) | Updated: \(.updated_at[:10])\n \(.body[:80])...\n"' | head -40; \
|
|
fi
|
|
@echo ""
|
|
@echo "💡 Tip: Use 'make show-issue NUM=X' to see full details"
|
|
|
|
# Show detailed view of a specific issue
|
|
show-issue:
|
|
@if [ -z "$(NUM)" ]; then \
|
|
echo "❌ Please specify issue number: make show-issue NUM=5"; \
|
|
exit 1; \
|
|
fi
|
|
@if ! command -v curl >/dev/null 2>&1; then \
|
|
echo "❌ curl not found - required for API access"; \
|
|
exit 1; \
|
|
fi
|
|
@echo "🔍 Issue #$(NUM) Details"
|
|
@echo "======================="
|
|
@echo ""
|
|
@if ! command -v jq >/dev/null 2>&1; then \
|
|
echo "⚠️ jq not found - using basic formatting"; \
|
|
curl -s "$(ISSUES_API)/$(NUM)"; \
|
|
else \
|
|
curl -s "$(ISSUES_API)/$(NUM)" | jq -r 'if . == null or .message then "❌ Issue #$(NUM) not found or API error" else "**Title:** " + .title + "\n**Status:** " + (.state | ascii_upcase) + "\n**Number:** #" + (.number | tostring) + "\n**Created:** " + (.created_at[:10]) + " by " + (.user.full_name // .user.login) + "\n**Updated:** " + (.updated_at[:10]) + "\n**URL:** " + .html_url + "\n\n**Description:**\n" + .body end' 2>/dev/null || echo "❌ Issue #$(NUM) not found or API error"; \
|
|
fi
|
|
@echo ""
|
|
@echo "💡 Tip: Use 'make list-issues' to see all issues"
|
|
|
|
# List only open issues (active backlog)
|
|
list-open-issues:
|
|
@echo "📋 Open MarkiTect Issues (Active Backlog)"
|
|
@echo "========================================"
|
|
@echo ""
|
|
@if ! command -v curl >/dev/null 2>&1; then \
|
|
echo "❌ curl not found - required for API access"; \
|
|
exit 1; \
|
|
fi
|
|
@if ! command -v jq >/dev/null 2>&1; then \
|
|
echo "⚠️ jq not found - using basic formatting"; \
|
|
curl -s "$(ISSUES_API)?state=open" | head -20; \
|
|
else \
|
|
curl -s "$(ISSUES_API)?state=open" | jq -r '.[] | "[OPEN] #\(.number): \(.title)\n Created: \(.created_at[:10]) | Updated: \(.updated_at[:10])\n \(.body[:80])...\n"' | head -40; \
|
|
fi
|
|
@echo ""
|
|
@echo "💡 Tip: Use 'make show-issue NUM=X' for full details or 'make list-issues' for all issues"
|