diff --git a/Makefile b/Makefile index c404e805..9b775f5c 100644 --- a/Makefile +++ b/Makefile @@ -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