fix: resolve show-issue Makefile parameter inconsistency - Issue #128

Fix inconsistent parameter usage in Makefile issue-related commands.
Users can now use both ISSUE=X and NUM=X parameters consistently across all targets.

Changes:
- Modified all issue-related Makefile targets to accept both ISSUE and NUM parameters
- ISSUE parameter takes precedence for better user experience
- Maintained backward compatibility for existing NUM usage
- Updated error messages to show both parameter formats clearly
- Updated help documentation to prefer ISSUE parameter

Affected targets:
- show-issue: Accept both ISSUE=X and NUM=X
- close-issue: Accept both ISSUE=X and NUM=X
- close-issue-enhanced: Accept both ISSUE=X and NUM=X
- test-from-issue: Accept both ISSUE=X and NUM=X
- tdd-start: Accept both ISSUE=X and NUM=X
- test-coverage: Accept both ISSUE=X and NUM=X

Testing:
-  make show-issue ISSUE=128 works correctly
-  make show-issue NUM=128 works correctly (backward compatibility)
-  Error messages show both formats: "ISSUE=5 (or NUM=5)"
-  All affected targets use consistent dual parameter logic
-  Help documentation reflects preferred ISSUE usage

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-05 21:38:01 +02:00
parent b23ff30e97
commit 1ea26173b9

122
Makefile
View File

@@ -21,7 +21,7 @@ help:
@echo " test - Run all tests"
@echo " test-status - Show test status summary without re-running"
@echo " test-new - Create new test file template"
@echo " test-coverage NUM=X - Analyze test coverage for issue"
@echo " test-coverage ISSUE=X - Analyze test coverage for issue"
@echo " build - Build the package"
@echo " lint - Run code linting"
@echo " format - Format code"
@@ -80,9 +80,9 @@ help:
@echo " list-issues - Show all gitea issues with status and priority"
@echo " list-open-issues - Show only open issues (active backlog)"
@echo " create-issue TITLE='...' BODY='...' - Create a new issue (or BODY_FILE='/path/to/file.md')"
@echo " show-issue NUM=X - Show detailed view of specific issue"
@echo " close-issue NUM=X [COMMENT='reason'] - Close an issue and mark as completed"
@echo " close-issue-enhanced NUM=X [WORK='description'] - Close issue with enhanced tddai/issue_closer.py"
@echo " show-issue ISSUE=X (or NUM=X) - Show detailed view of specific issue"
@echo " close-issue ISSUE=X [COMMENT='reason'] - Close an issue and mark as completed"
@echo " close-issue-enhanced ISSUE=X [WORK='description'] - Close issue with enhanced functionality"
@echo " close-issues-batch NUMS='X Y Z' [COMMENT='reason'] - Close multiple issues at once"
@echo " issues-get - Export compact issue index to ISSUES.index"
@echo " issues-csv - Export issues as CSV for spreadsheet processing"
@@ -90,10 +90,10 @@ help:
@echo " issues-high - Export only high/critical priority issues"
@echo ""
@echo "Test-Driven Development:"
@echo " test-from-issue NUM=X - Generate test skeleton from issue (requires Claude Code)"
@echo " test-from-issue ISSUE=X - Generate test skeleton from issue (requires Claude Code)"
@echo ""
@echo "TDD Workspace:"
@echo " tdd-start NUM=X - Start working on issue (with requirements validation)"
@echo " tdd-start ISSUE=X - Start working on issue (with requirements validation)"
@echo " tdd-add-test - Add test to current issue workspace"
@echo " tdd-status - Show current workspace state"
@echo " tdd-finish - Complete issue work (moves tests to main)"
@@ -402,11 +402,17 @@ list-issues: $(VENV)/bin/activate
# Show detailed view of a specific issue
show-issue: $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make show-issue NUM=5"; \
@ISSUE_NUM=""; \
if [ -n "$(ISSUE)" ]; then \
ISSUE_NUM="$(ISSUE)"; \
elif [ -n "$(NUM)" ]; then \
ISSUE_NUM="$(NUM)"; \
fi; \
if [ -z "$$ISSUE_NUM" ]; then \
echo "❌ Please specify issue number: make show-issue ISSUE=5 (or NUM=5)"; \
exit 1; \
fi
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py show-issue $(NUM)
fi; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py show-issue $$ISSUE_NUM
# List only open issues (active backlog)
list-open-issues: $(VENV)/bin/activate
@@ -433,34 +439,46 @@ create-issue:
# Close an issue and mark as completed
close-issue: $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make close-issue NUM=5"; \
@ISSUE_NUM=""; \
if [ -n "$(ISSUE)" ]; then \
ISSUE_NUM="$(ISSUE)"; \
elif [ -n "$(NUM)" ]; then \
ISSUE_NUM="$(NUM)"; \
fi; \
if [ -z "$$ISSUE_NUM" ]; then \
echo "❌ Please specify issue number: make close-issue ISSUE=5 (or NUM=5)"; \
exit 1; \
fi
@if [ -n "$(COMMENT)" ]; then \
echo "🔄 Closing issue #$(NUM) with comment..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py close-issue $(NUM) --comment "$(COMMENT)"; \
fi; \
if [ -n "$(COMMENT)" ]; then \
echo "🔄 Closing issue #$$ISSUE_NUM with comment..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py close-issue $$ISSUE_NUM --comment "$(COMMENT)"; \
else \
echo "🔄 Closing issue #$(NUM)..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py close-issue $(NUM); \
fi
@echo "✅ Issue #$(NUM) closed successfully!"
echo "🔄 Closing issue #$$ISSUE_NUM..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py close-issue $$ISSUE_NUM; \
fi; \
echo "✅ Issue #$$ISSUE_NUM closed successfully!"
# Close issue using dedicated issue_closer.py script (enhanced functionality)
close-issue-enhanced: $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make close-issue-enhanced NUM=5"; \
@ISSUE_NUM=""; \
if [ -n "$(ISSUE)" ]; then \
ISSUE_NUM="$(ISSUE)"; \
elif [ -n "$(NUM)" ]; then \
ISSUE_NUM="$(NUM)"; \
fi; \
if [ -z "$$ISSUE_NUM" ]; then \
echo "❌ Please specify issue number: make close-issue-enhanced ISSUE=5 (or NUM=5)"; \
exit 1; \
fi
@if [ -n "$(WORK)" ]; then \
echo "🔄 Closing issue #$(NUM) with completion message..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai/issue_closer.py $(NUM) --work-completed "$(WORK)"; \
fi; \
if [ -n "$(WORK)" ]; then \
echo "🔄 Closing issue #$$ISSUE_NUM with completion message..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai/issue_closer.py $$ISSUE_NUM --work-completed "$(WORK)"; \
elif [ -n "$(COMMENT)" ]; then \
echo "🔄 Closing issue #$(NUM) with comment..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai/issue_closer.py $(NUM) --comment "$(COMMENT)"; \
echo "🔄 Closing issue #$$ISSUE_NUM with comment..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai/issue_closer.py $$ISSUE_NUM --comment "$(COMMENT)"; \
else \
echo "🔄 Closing issue #$(NUM)..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai/issue_closer.py $(NUM); \
echo "🔄 Closing issue #$$ISSUE_NUM..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai/issue_closer.py $$ISSUE_NUM; \
fi
# Close multiple issues at once using issue_closer.py
@@ -513,8 +531,14 @@ issues-high: $(VENV)/bin/activate
# 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"; \
@ISSUE_NUM=""; \
if [ -n "$(ISSUE)" ]; then \
ISSUE_NUM="$(ISSUE)"; \
elif [ -n "$(NUM)" ]; then \
ISSUE_NUM="$(NUM)"; \
fi; \
if [ -z "$$ISSUE_NUM" ]; then \
echo "❌ Please specify issue number: make test-from-issue ISSUE=1 (or NUM=1)"; \
exit 1; \
fi
@echo "🔍 Checking for Claude Code availability..."
@@ -531,17 +555,23 @@ test-from-issue:
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"
@echo "📋 Fetching issue #$$ISSUE_NUM details..."
@curl -s "$(ISSUES_API)/$$ISSUE_NUM" | jq -r 'if .title then "✅ Issue #'"$$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 #'"$$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_'"$$ISSUE_NUM"'_*.py\n - Include docstring referencing issue #'"$$ISSUE_NUM"'\n - Test should initially fail (red state)\n\n💡 After generation, run '"'"'make test'"'"' to verify test fails initially" else "❌ Issue #'"$$ISSUE_NUM"' not found or API error\n Use '"'"'make list-open-issues'"'"' to see available issues" end' 2>/dev/null || echo "❌ Issue #$$ISSUE_NUM not found or API error"
# Start working on an issue (creates workspace with requirements validation)
tdd-start: validate-requirements $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make tdd-start NUM=1"; \
@ISSUE_NUM=""; \
if [ -n "$(ISSUE)" ]; then \
ISSUE_NUM="$(ISSUE)"; \
elif [ -n "$(NUM)" ]; then \
ISSUE_NUM="$(NUM)"; \
fi; \
if [ -z "$$ISSUE_NUM" ]; then \
echo "❌ Please specify issue number: make tdd-start ISSUE=1 (or NUM=1)"; \
exit 1; \
fi
@echo "🚀 Starting TDD workflow with requirements validation..."
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py start-issue $(NUM)
fi; \
echo "🚀 Starting TDD workflow with requirements validation..."; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py start-issue $$ISSUE_NUM
# Add test to current issue workspace
tdd-add-test: $(VENV)/bin/activate
@@ -667,11 +697,17 @@ test-new: $(VENV)/bin/activate
# Analyze test coverage for a specific issue
test-coverage: $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make test-coverage NUM=5"; \
@ISSUE_NUM=""; \
if [ -n "$(ISSUE)" ]; then \
ISSUE_NUM="$(ISSUE)"; \
elif [ -n "$(NUM)" ]; then \
ISSUE_NUM="$(NUM)"; \
fi; \
if [ -z "$$ISSUE_NUM" ]; then \
echo "❌ Please specify issue number: make test-coverage ISSUE=5 (or NUM=5)"; \
exit 1; \
fi
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py analyze-coverage $(NUM)
fi; \
PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py analyze-coverage $$ISSUE_NUM
# ============================================================================
# Architectural Testing Targets