From 0043bc6cef17af7cac440a1c00d46d859a8f0d84 Mon Sep 17 00:00:00 2001 From: Bernd Worsch Date: Mon, 22 Sep 2025 01:17:54 +0200 Subject: [PATCH] build: Add test-from-issue target for TDD workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- Makefile | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c18b036b..1f35603d 100644 --- a/Makefile +++ b/Makefile @@ -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"