build: Add test-from-issue target for TDD workflow

- Add test-from-issue NUM=X target to generate test skeletons from gitea issues
- Integrate Claude Code requirement checking and issue data fetching
- Provide comprehensive test generation guidance with TDD best practices
- Include issue details, test naming conventions, and pytest requirements
- Enable systematic conversion of issue backlog into test-driven development
- Support error handling for non-existent issues

This establishes the core infrastructure for issue-driven TDD workflow

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-22 01:17:54 +02:00
parent adf48c704c
commit 0043bc6cef

View File

@@ -1,7 +1,7 @@
# 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
.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 test-from-issue
# Default target
help:
@@ -37,6 +37,9 @@ help:
@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"
@echo ""
@echo "Test-Driven Development:"
@echo " test-from-issue NUM=X - Generate test skeleton from issue (requires Claude Code)"
# Python and virtual environment setup
PYTHON := python3
@@ -273,3 +276,26 @@ list-open-issues:
fi
@echo ""
@echo "💡 Tip: Use 'make show-issue NUM=X' for full details or 'make list-issues' for all issues"
# Generate test skeleton from gitea issue (requires Claude Code)
test-from-issue:
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make test-from-issue NUM=1"; \
exit 1; \
fi
@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 "🔍 Checking for curl..."
@if ! command -v curl >/dev/null 2>&1; then \
echo "❌ curl not found - required for API access"; \
exit 1; \
fi
@echo "✅ curl found"
@echo "📋 Fetching issue #$(NUM) details..."
@curl -s "$(ISSUES_API)/$(NUM)" | jq -r 'if .title then "✅ Issue #$(NUM): " + .title + "\n\n🧪 Generating test skeleton...\n Please ask Claude Code to generate a test for this issue:\n\n Command: '"'"'Generate a test skeleton for issue #$(NUM)'"'"'\n\n📋 Issue Details:\n Title: " + .title + "\n Description: " + .body + "\n\n📝 Test Requirements:\n - Follow TDD principles (test first, then implementation)\n - Use pytest framework (existing project convention)\n - Place test in tests/ directory\n - Name test file: test_issue_$(NUM)_*.py\n - Include docstring referencing issue #$(NUM)\n - Test should initially fail (red state)\n\n💡 After generation, run '"'"'make test'"'"' to verify test fails initially" else "❌ Issue #$(NUM) not found or API error\n Use '"'"'make list-open-issues'"'"' to see available issues" end' 2>/dev/null || echo "❌ Issue #$(NUM) not found or API error"