2025-09-21 23:46:46 +02:00
# MarkiTect - Advanced Markdown Engine
# Makefile for common development tasks
2025-10-03 11:09:47 +02:00
.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 create -issue close -issue close -issue -enhanced close -issues -batch test -from -issue tdd -start tdd -add -test tdd -finish tdd -status test -status test -new test -coverage test -arch test -foundation test -infrastructure test -integration test -domain test -service test -application test -presentation test -quick test -layers test -random test -random -seed test -random -repeat test -install -randomly test -clean test -tdd test -changed test -module test -cache -clean test -efficient cli -help release -status release -validate release -prepare release -build release -publish release -dry -run chaos -validate chaos -matrix chaos -inject chaos -report
2025-09-21 23:46:46 +02:00
# Default target
help :
@echo "MarkiTect Development Commands"
@echo "=============================="
@echo ""
2025-09-22 00:18:24 +02:00
@echo "Environment Status:"
@$( MAKE) --no-print-directory venv-status
@echo ""
2025-09-21 23:46:46 +02:00
@echo "Setup & Installation:"
@echo " setup - Initial project setup (venv + install)"
@echo " install - Install package in development mode"
@echo " dev - Install with development dependencies"
2025-09-22 00:18:24 +02:00
@echo " venv-status - Check if venv is active"
2025-09-21 23:46:46 +02:00
@echo ""
@echo "Development:"
@echo " test - Run all tests"
2025-09-23 03:16:50 +02:00
@echo " test-status - Show test status summary without re-running"
2025-09-23 03:26:02 +02:00
@echo " test-new - Create new test file template"
2025-09-23 03:35:20 +02:00
@echo " test-coverage NUM=X - Analyze test coverage for issue"
2025-09-21 23:46:46 +02:00
@echo " build - Build the package"
@echo " lint - Run code linting"
@echo " format - Format code"
@echo ""
2025-10-03 06:07:10 +02:00
@echo "Release Management:"
@echo " release-status - Show current release status"
@echo " release-validate - Validate repository for release"
@echo " release-prepare VERSION=x.y.z - Prepare new release"
@echo " release-build - Build release packages"
@echo " release-publish VERSION=x.y.z - Publish complete release"
@echo " release-dry-run VERSION=x.y.z - Test release preparation"
@echo ""
2025-10-03 09:09:32 +02:00
@echo "Chaos Engineering:"
@echo " chaos-validate - Run architectural independence validation"
@echo " chaos-matrix - Show dependency matrix"
@echo " chaos-inject LAYER=X TYPE=Y - Inject chaos into specific layer"
@echo " chaos-report - Generate chaos engineering report"
@echo ""
feat: Revolutionary Test Architecture - 7-Layer Organization with Advanced Testing Capabilities
ARCHITECTURAL MILESTONE: Complete transformation of test suite from issue-based to sophisticated
architectural layer organization with 348 tests across 7 layers (Foundation → Infrastructure →
Integration → Domain → Service → Application → Presentation).
Major Components:
🏗️ ARCHITECTURAL TEST ORGANIZATION:
• Renamed 23 test files to architectural layers (e.g. test_parser.py → test_l7_foundation_markdown_parsing.py)
• Created reverse dependency execution order for 60-80% faster feedback
• Foundation layer (10 tests, ~9s) provides immediate failure detection
• Complete dependency mapping across all 7 architectural layers
🎯 ADVANCED TEST RUNNERS:
• run_architectural_tests.py - Reverse dependency execution with performance metrics
• run_randomized_tests.py - Seed-based randomization for dependency detection
• Comprehensive error handling and colored output for optimal UX
• Support for layer-specific execution and early termination on failures
📋 COMPREHENSIVE DOCUMENTATION:
• ARCHITECTURE.md - 7-layer architecture blueprint with migration strategy
• CAPABILITIES.md - Complete inventory of 73+ system capabilities across 15 categories
• TEST_ARCHITECTURE.md - Detailed test execution strategy and naming conventions
• ARCHITECTURAL_CHAOS_TESTING_ISSUE.md - Chaos engineering gameplan (Issue #35)
🔧 MAKEFILE INTEGRATION:
• 15+ new testing targets (test-arch, test-foundation, test-random, etc.)
• Layer-specific execution (test-infrastructure, test-domain, test-service)
• Advanced options (test-quick, test-layers, test-random-repeat)
• Comprehensive help system with organized testing categories
🎲 RANDOMIZED TESTING:
• Seed-based reproducible test execution for debugging
• Multi-iteration testing to detect flaky tests and hidden dependencies
• Enhanced randomization support with pytest-randomly integration
• Performance analysis across different execution orders
🚀 PERFORMANCE OPTIMIZATION:
• Foundation-first execution prevents cascade failure debugging
• Quick testing (foundation + infrastructure) completes in ~22 seconds
• Layer isolation enables targeted debugging and development
• Optimal feedback loops for architectural development
This revolutionary testing infrastructure establishes MarkiTect as having enterprise-grade
test organization with architectural principles, performance optimization, and advanced
testing methodologies including chaos engineering foundations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 12:18:25 +02:00
@echo "Architectural Testing:"
@echo " test-arch - Run all tests in architectural order"
@echo " test-foundation - Run foundation layer tests only"
@echo " test-infrastructure - Run infrastructure layer tests only"
@echo " test-integration - Run integration layer tests only"
@echo " test-domain - Run domain layer tests only"
@echo " test-service - Run service layer tests only"
@echo " test-application - Run application layer tests only"
@echo " test-presentation - Run presentation layer tests only"
@echo " test-quick - Run foundation + infrastructure only (fast)"
@echo " test-layers - List all architectural layers"
@echo ""
@echo "Randomized Testing:"
@echo " test-random - Run tests in random order (dependency detection)"
@echo " test-random-seed SEED=X - Run with specific seed for reproducibility"
@echo " test-random-repeat NUM=X - Run multiple random iterations"
@echo " test-install-randomly - Install pytest-randomly plugin"
@echo ""
2025-10-01 15:59:33 +02:00
@echo "Test Efficiency (Issue #57):"
@echo " test-clean - Clean test run (exclude workspaces, fresh cache)"
@echo " test-tdd - Quick TDD tests for fast feedback (<30s)"
@echo " test-changed - Run tests for changed files only"
@echo " test-module MODULE=name - Run tests for specific module"
@echo " test-cache-clean - Clean pytest cache"
@echo " test-efficient - Enhanced test suite (exclude workspaces)"
@echo ""
2025-09-21 23:46:46 +02:00
@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"
2025-09-22 00:37:04 +02:00
@echo ""
@echo "Documentation:"
2025-09-22 00:49:23 +02:00
@echo " update-digest - Update ProjectStatusDigest.md (requires Claude Code)"
@echo " add-diary-entry - Add new entry to ProjectDiary.md (requires Claude Code)"
2025-09-22 01:11:00 +02:00
@echo ""
@echo "Issue Management:"
feat: Add Unix-friendly issue index with multiple output formats
- Add issue-index command with TSV, CSV, JSON, and fields output formats
- Support sorting by number, title, priority, state, created, updated
- Add filtering by state (open/closed) and priority level
- Include proper data cleaning for Unix pipeline processing
- Add make targets: issues-get, issues-csv, issues-json, issues-high
- Optimize for awk, cut, grep, and other Unix text processing tools
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:24:25 +02:00
@echo " list-issues - Show all gitea issues with status and priority"
@echo " list-open-issues - Show only open issues (active backlog)"
2025-10-03 11:09:47 +02:00
@echo " create-issue TITLE='...' BODY='...' - Create a new issue (or BODY_FILE='/path/to/file.md')"
feat: Add Unix-friendly issue index with multiple output formats
- Add issue-index command with TSV, CSV, JSON, and fields output formats
- Support sorting by number, title, priority, state, created, updated
- Add filtering by state (open/closed) and priority level
- Include proper data cleaning for Unix pipeline processing
- Add make targets: issues-get, issues-csv, issues-json, issues-high
- Optimize for awk, cut, grep, and other Unix text processing tools
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:24:25 +02:00
@echo " show-issue NUM=X - Show detailed view of specific issue"
2025-10-02 22:30:53 +02:00
@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 " close-issues-batch NUMS='X Y Z' [COMMENT='reason'] - Close multiple issues at once"
feat: Add Unix-friendly issue index with multiple output formats
- Add issue-index command with TSV, CSV, JSON, and fields output formats
- Support sorting by number, title, priority, state, created, updated
- Add filtering by state (open/closed) and priority level
- Include proper data cleaning for Unix pipeline processing
- Add make targets: issues-get, issues-csv, issues-json, issues-high
- Optimize for awk, cut, grep, and other Unix text processing tools
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:24:25 +02:00
@echo " issues-get - Export compact issue index to ISSUES.index"
@echo " issues-csv - Export issues as CSV for spreadsheet processing"
@echo " issues-json - Export issues as JSON for programmatic processing"
@echo " issues-high - Export only high/critical priority issues"
2025-09-22 01:17:54 +02:00
@echo ""
@echo "Test-Driven Development:"
@echo " test-from-issue NUM=X - Generate test skeleton from issue (requires Claude Code)"
2025-09-22 01:28:55 +02:00
@echo ""
2025-09-22 02:14:57 +02:00
@echo "TDD Workspace:"
2025-10-02 00:45:06 +02:00
@echo " tdd-start NUM=X - Start working on issue (with requirements validation)"
2025-09-22 02:14:57 +02:00
@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)"
2025-09-29 21:21:21 +02:00
@echo ""
2025-10-02 00:45:06 +02:00
@echo "Requirements Engineering:"
@echo " validate-requirements - Analyze foundations before development"
@echo " check-interface-compatibility INTERFACE=Name - Check interface compatibility"
@echo " generate-dev-checklist FEATURE='Name' - Generate development checklist"
@echo " validate-mocks - Validate mock object compatibility"
@echo " pre-commit-validate - Complete pre-commit validation"
@echo " view-requirements-examples - Show usage examples"
@echo ""
2025-09-29 21:21:21 +02:00
@echo "MarkiTect CLI Usage:"
@echo " cli-help - Show detailed CLI usage targets and examples"
@echo " cli-ingest [FILE=doc.md] - Process and store markdown files"
@echo " cli-workflow-basic - Run complete basic workflow demo"
@echo " cli-workflow-schema FILE=doc.md - Run schema generation workflow"
2025-09-21 23:46:46 +02:00
# Python and virtual environment setup
PYTHON := python3
VENV := .venv
VENV_PYTHON := $( VENV) /bin/python
VENV_PIP := $( VENV) /bin/pip
2025-09-22 00:18:24 +02:00
# 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
2025-09-21 23:46:46 +02:00
# 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 \
2025-09-22 02:07:05 +02:00
PYTHONPATH = . $( VENV) /bin/pytest tests/ -v; \
2025-09-21 23:46:46 +02:00
else \
2025-09-22 02:07:05 +02:00
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
PYTHONPATH = . $( VENV_PYTHON) -m unittest discover tests/ -v; \
2025-09-21 23:46:46 +02:00
fi
2025-10-02 05:11:25 +02:00
# TDD8 Workflow Optimized Test Targets (Issue #57)
# Fast test execution for TDD red phase
test-red : $( VENV ) /bin /activate
@echo "🔴 TDD Red Phase - Fast test execution..."
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/ -x --maxfail= 1 --tb= short -q
# Comprehensive test execution for TDD green phase
test-green : $( VENV ) /bin /activate
@echo "🟢 TDD Green Phase - Comprehensive validation..."
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/ --tb= short
# Smart test selection - changed files only
test-smart : $( VENV ) /bin /activate
@echo "🧠 Smart test selection - changed files only..."
@changed_tests= $$ ( git diff --name-only HEAD~1 | grep test_ | tr '\n' ' ' ) ; \
if [ -n " $$ changed_tests " ] ; then \
PYTHONPATH = . $( VENV_PYTHON) -m pytest $$ changed_tests -v; \
else \
echo "No test files changed, running fast subset" ; \
$( MAKE) test-fast; \
fi
# Ultra-fast test execution
test-ultra-fast : $( VENV ) /bin /activate
@echo "⚡ Ultra-fast test execution..."
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/ -m "not slow" --maxfail= 1 -x -q
# Test with performance monitoring
test-perf : $( VENV ) /bin /activate
@echo "📊 Test execution with performance monitoring..."
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/ --durations= 10 --tb= short
# Test health check
test-health : $( VENV ) /bin /activate
@echo "🏥 Test infrastructure health check..."
@PYTHONPATH= . $( VENV_PYTHON) tools/testing_efficiency_optimizer.py diagnose
# Clean all test caches (Enhanced for Issue #57)
test-cache-clean-enhanced : $( VENV ) /bin /activate
@echo "🧹 Enhanced cache cleaning..."
find . -name '.pytest_cache' -type d -exec rm -rf { } + 2>/dev/null || true
find . -name '__pycache__' -type d -exec rm -rf { } + 2>/dev/null || true
find . -name '*.pyc' -delete 2>/dev/null || true
2025-09-21 23:46:46 +02:00
# 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
2025-10-03 06:07:10 +02:00
# Release management
release-status :
@echo "🔍 Checking release status..."
$( VENV_PYTHON) release.py status
release-validate :
@echo "✅ Validating release readiness..."
$( VENV_PYTHON) release.py validate
release-prepare :
@echo "🚀 Preparing release..."
@if [ -z " $( VERSION) " ] ; then \
echo "❌ Usage: make release-prepare VERSION=1.0.0" ; \
exit 1; \
fi
$( VENV_PYTHON) release.py prepare --version $( VERSION)
release-build :
@echo "📦 Building release packages..."
$( VENV_PYTHON) release.py build $( if $( VERSION) ,--version $( VERSION) )
release-publish :
@echo "📢 Publishing release..."
@if [ -z " $( VERSION) " ] ; then \
echo "❌ Usage: make release-publish VERSION=1.0.0" ; \
exit 1; \
fi
$( VENV_PYTHON) release.py publish --version $( VERSION)
release-dry-run :
@echo "🧪 Dry run release preparation..."
@if [ -z " $( VERSION) " ] ; then \
echo "❌ Usage: make release-dry-run VERSION=1.0.0" ; \
exit 1; \
fi
$( VENV_PYTHON) release.py prepare --version $( VERSION) --dry-run
2025-10-03 09:09:32 +02:00
# Chaos Engineering targets
chaos-validate :
@echo "🔥 Running architectural independence validation..."
2025-10-03 10:25:33 +02:00
$( VENV_PYTHON) tools/chaos_test_runner.py validate-independence
2025-10-03 09:09:32 +02:00
chaos-matrix :
@echo "🏗️ Showing architectural dependency matrix..."
2025-10-03 10:25:33 +02:00
$( VENV_PYTHON) tools/chaos_test_runner.py dependency-matrix
2025-10-03 09:09:32 +02:00
chaos-inject :
@echo "💥 Injecting chaos into layer..."
@if [ -z " $( LAYER) " ] ; then \
echo "❌ Usage: make chaos-inject LAYER=L1_Presentation TYPE=import_failure" ; \
exit 1; \
fi
2025-10-03 10:25:33 +02:00
$( VENV_PYTHON) tools/chaos_test_runner.py inject-layer-failure --layer $( LAYER) $( if $( TYPE) ,--injection-type $( TYPE) )
2025-10-03 09:09:32 +02:00
chaos-report :
@echo "📄 Generating chaos engineering report..."
2025-10-03 10:25:33 +02:00
$( VENV_PYTHON) tools/chaos_test_runner.py chaos-report
2025-10-03 09:09:32 +02:00
2025-09-21 23:46:46 +02:00
# 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:"
2025-09-22 00:18:24 +02:00
$( VENV_PIP) check
2025-09-22 00:37:04 +02:00
# 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"
2025-09-22 00:49:23 +02:00
# 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"
2025-09-22 01:11:00 +02:00
# 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
2025-09-22 01:28:55 +02:00
# Issue workspace configuration
WORKSPACE_DIR := .markitect_workspace
CURRENT_ISSUE_FILE := $( WORKSPACE_DIR) /current_issue.json
2025-09-22 01:11:00 +02:00
# List all gitea issues
2025-09-22 02:07:05 +02:00
list-issues : $( VENV ) /bin /activate
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py list-issues
2025-09-22 01:11:00 +02:00
# Show detailed view of a specific issue
2025-09-22 02:07:05 +02:00
show-issue : $( VENV ) /bin /activate
2025-09-22 01:11:00 +02:00
@if [ -z " $( NUM) " ] ; then \
echo "❌ Please specify issue number: make show-issue NUM=5" ; \
exit 1; \
fi
2025-09-22 02:07:05 +02:00
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py show-issue $( NUM)
2025-09-22 01:11:00 +02:00
# List only open issues (active backlog)
2025-09-22 02:07:05 +02:00
list-open-issues : $( VENV ) /bin /activate
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py list-open-issues
2025-09-22 01:17:54 +02:00
2025-10-03 11:09:47 +02:00
# Create a new issue
create-issue :
@if [ -z " $( TITLE) " ] ; then \
echo "❌ Please specify issue title: make create-issue TITLE='Fix bug' BODY='Description'" ; \
echo "❌ Or use: make create-issue TITLE='Fix bug' BODY_FILE='/path/to/body.md'" ; \
exit 1; \
fi
@if [ -z " $( BODY) " ] && [ -z " $( BODY_FILE) " ] ; then \
echo "❌ Please specify either BODY='...' or BODY_FILE='/path/to/file.md'" ; \
exit 1; \
fi
@echo "📋 Creating new issue..."
@echo " 📋 Title: $( TITLE) "
@if [ -n " $( BODY_FILE) " ] ; then \
tea issue create --title " $( TITLE) " --description " $$ (cat $( BODY_FILE) ) " ; \
else \
tea issue create --title " $( TITLE) " --description " $( BODY) " ; \
fi
2025-09-30 17:32:29 +02:00
# 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" ; \
exit 1; \
fi
2025-10-02 22:30:53 +02:00
@if [ -n " $( COMMENT) " ] ; then \
echo " 🔄 Closing issue # $( NUM) with comment... " ; \
PYTHONPATH = . $( VENV_PYTHON) tddai_cli.py close-issue $( NUM) --comment " $( COMMENT) " ; \
else \
echo " 🔄 Closing issue # $( NUM) ... " ; \
PYTHONPATH = . $( VENV_PYTHON) tddai_cli.py close-issue $( NUM) ; \
fi
2025-09-30 17:32:29 +02:00
@echo " ✅ Issue # $( NUM) closed successfully! "
2025-10-02 22:30:53 +02:00
# 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" ; \
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) " ; \
elif [ -n " $( COMMENT) " ] ; then \
echo " 🔄 Closing issue # $( NUM) with comment... " ; \
PYTHONPATH = . $( VENV_PYTHON) tddai/issue_closer.py $( NUM) --comment " $( COMMENT) " ; \
else \
echo " 🔄 Closing issue # $( NUM) ... " ; \
PYTHONPATH = . $( VENV_PYTHON) tddai/issue_closer.py $( NUM) ; \
fi
# Close multiple issues at once using issue_closer.py
close-issues-batch : $( VENV ) /bin /activate
@if [ -z " $( NUMS) " ] ; then \
echo "❌ Please specify issue numbers: make close-issues-batch NUMS='42 43 44'" ; \
exit 1; \
fi
@if [ -n " $( COMMENT) " ] ; then \
echo " 🔄 Closing issues $( NUMS) with comment... " ; \
PYTHONPATH = . $( VENV_PYTHON) tddai/issue_closer.py $( NUMS) --comment " $( COMMENT) " ; \
else \
echo " 🔄 Closing issues $( NUMS) ... " ; \
PYTHONPATH = . $( VENV_PYTHON) tddai/issue_closer.py $( NUMS) ; \
fi
feat: Add Unix-friendly issue index with multiple output formats
- Add issue-index command with TSV, CSV, JSON, and fields output formats
- Support sorting by number, title, priority, state, created, updated
- Add filtering by state (open/closed) and priority level
- Include proper data cleaning for Unix pipeline processing
- Add make targets: issues-get, issues-csv, issues-json, issues-high
- Optimize for awk, cut, grep, and other Unix text processing tools
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:24:25 +02:00
# Export compact issue index to ISSUES.index file (TSV format)
issues-get : $( VENV ) /bin /activate
@echo "📋 Fetching issue index from gitea..."
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py issue-index --format tsv --sort number > ISSUES.index
@echo "✅ Issue index exported to ISSUES.index (TSV format)"
@echo "📄 File contents:"
@cat ISSUES.index
# Export issues as CSV for spreadsheet processing
issues-csv : $( VENV ) /bin /activate
@echo "📊 Exporting issues as CSV..."
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py issue-index --format csv --sort priority --include-state > ISSUES.csv
@echo "✅ Issues exported to ISSUES.csv"
@wc -l ISSUES.csv | awk '{print "📄 Total entries:", $$1-1, "(excluding header)"}'
# Export issues as JSON for programmatic processing
issues-json : $( VENV ) /bin /activate
@echo "🔧 Exporting issues as JSON..."
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py issue-index --format json --sort priority > ISSUES.json
@echo "✅ Issues exported to ISSUES.json"
@echo "📄 Sample entry:"
@head -20 ISSUES.json
# Export only high and critical priority issues
issues-high : $( VENV ) /bin /activate
@echo "🚨 Exporting high priority issues..."
@echo "High priority issues:" > ISSUES.high.txt
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py issue-index --format tsv --filter-priority high --sort number >> ISSUES.high.txt
@echo "" >> ISSUES.high.txt
@echo "Critical priority issues:" >> ISSUES.high.txt
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py issue-index --format tsv --filter-priority critical --sort number >> ISSUES.high.txt
@echo "✅ High priority issues exported to ISSUES.high.txt"
@cat ISSUES.high.txt
2025-09-22 01:17:54 +02:00
# 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 "
2025-09-22 01:28:55 +02:00
2025-10-02 00:45:06 +02:00
# Start working on an issue (creates workspace with requirements validation)
tdd-start : validate -requirements $( VENV ) /bin /activate
2025-09-22 01:28:55 +02:00
@if [ -z " $( NUM) " ] ; then \
2025-09-22 02:14:57 +02:00
echo "❌ Please specify issue number: make tdd-start NUM=1" ; \
2025-09-22 01:28:55 +02:00
exit 1; \
fi
2025-10-02 00:45:06 +02:00
@echo "🚀 Starting TDD workflow with requirements validation..."
2025-09-22 02:07:05 +02:00
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py start-issue $( NUM)
2025-09-22 01:28:55 +02:00
# Add test to current issue workspace
2025-09-22 02:14:57 +02:00
tdd-add-test : $( VENV ) /bin /activate
2025-09-22 02:07:05 +02:00
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py add-test
2025-09-22 01:28:55 +02:00
# Show current workspace status
2025-09-22 02:14:57 +02:00
tdd-status : $( VENV ) /bin /activate
2025-09-22 02:07:05 +02:00
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py workspace-status
2025-09-22 01:28:55 +02:00
# Complete issue work (move tests to main and cleanup)
2025-09-22 02:14:57 +02:00
tdd-finish : $( VENV ) /bin /activate
2025-09-22 02:07:05 +02:00
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py finish-issue
2025-09-23 03:16:50 +02:00
# Show test status summary without re-running tests
test-status : $( VENV ) /bin /activate
@echo "📊 MarkiTect Test Status Summary"
@echo "==============================="
@echo ""
@echo "📄 Test Files:"
@find tests/ -name "test_*.py" -exec basename { } \; | sort | sed 's/^/ 📝 /'
@echo ""
@echo "📊 Quick Stats:"
@echo -n " Total test files: "
@find tests/ -name "test_*.py" | wc -l
@echo ""
@if [ -f ".pytest_cache/CACHEDIR.TAG" ] ; then \
echo "💾 Last Test Results (cached):" ; \
if [ -f ".pytest_cache/v/cache/lastfailed" ] ; then \
echo " ❌ Recent failures detected" ; \
echo -n " Failed tests: " ; \
cat .pytest_cache/v/cache/lastfailed | jq -r 'keys[]' 2>/dev/null | wc -l || echo "Unknown" ; \
else \
echo " ✅ No recent failures in cache" ; \
fi ; \
echo " 📁 Cache: .pytest_cache/ ( $$ (du -sh .pytest_cache/ 2>/dev/null | cut -f1 || echo 'Unknown size')) " ; \
if [ -f ".pytest_cache/README.md" ] ; then \
echo " 📅 Last run: $$ (stat -c %y .pytest_cache/README.md 2>/dev/null | cut -d. -f1 || echo 'Unknown') " ; \
fi ; \
else \
echo "❓ No test cache found - run 'make test' to generate results" ; \
fi
@echo ""
@echo "🔍 For detailed status:"
@echo " make test # Run all tests with full output"
@echo " make test 2>&1 | grep -E 'PASSED|FAILED' # Show only results"
@echo ""
@if [ -f "test_status_report.md" ] ; then \
echo "📋 Full Status Report: test_status_report.md" ; \
echo " Last updated: $$ (stat -c %y test_status_report.md 2>/dev/null || echo 'Unknown') " ; \
else \
echo "💡 Generate detailed report with test run data" ; \
fi
2025-09-23 03:26:02 +02:00
# Create new test file template
test-new : $( VENV ) /bin /activate
@echo "🧪 Creating new test file"
@echo "========================"
@echo ""
@read -p "Test name (e.g., feature_name): " test_name; \
if [ -z " $$ test_name " ] ; then \
echo "❌ Test name cannot be empty" ; \
exit 1; \
fi ; \
test_file = " tests/test_ $$ test_name.py " ; \
if [ -f " $$ test_file " ] ; then \
echo " ❌ Test file already exists: $$ test_file " ; \
exit 1; \
fi ; \
echo " 📝 Creating: $$ test_file " ; \
echo '"""' > " $$ test_file " ; \
echo " Test for $$ test_name functionality. " >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo "This test module validates [describe what you're testing]." >> " $$ test_file " ; \
echo '"""' >> " $$ test_file " ; \
echo "import pytest" >> " $$ test_file " ; \
echo "from markitect import [import what you need]" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
class_name = $$ ( echo $$ test_name | sed 's/_/ /g' | sed 's/\b\w/\U&/g' | sed 's/ //g' ) ; \
echo " class Test $$ class_name: " >> " $$ test_file " ; \
echo ' """Test suite for ' $$ test_name' functionality."""' >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " def setup_method(self):" >> " $$ test_file " ; \
echo ' """Set up test environment."""' >> " $$ test_file " ; \
echo " pass" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " def teardown_method(self):" >> " $$ test_file " ; \
echo ' """Clean up after tests."""' >> " $$ test_file " ; \
echo " pass" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " def test_basic_functionality(self):" >> " $$ test_file " ; \
echo ' """Test basic ' $$ test_name' functionality."""' >> " $$ test_file " ; \
echo " # Arrange" >> " $$ test_file " ; \
echo " # TODO: Set up test data" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " # Act" >> " $$ test_file " ; \
echo " # TODO: Execute the functionality" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " # Assert" >> " $$ test_file " ; \
echo " # TODO: Verify expected results" >> " $$ test_file " ; \
echo " assert True # Replace with actual assertions" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " def test_edge_cases(self):" >> " $$ test_file " ; \
echo ' """Test edge cases for ' $$ test_name'."""' >> " $$ test_file " ; \
echo " # TODO: Test boundary conditions, empty inputs, etc." >> " $$ test_file " ; \
echo " pass" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo " def test_error_handling(self):" >> " $$ test_file " ; \
echo ' """Test error handling for ' $$ test_name'."""' >> " $$ test_file " ; \
echo " # TODO: Test invalid inputs, exception cases" >> " $$ test_file " ; \
echo " pass" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo "" >> " $$ test_file " ; \
echo "if __name__ == '__main__':" >> " $$ test_file " ; \
echo " pytest.main([__file__, '-v'])" >> " $$ test_file " ; \
echo " ✅ Test file created: $$ test_file " ; \
echo "" ; \
echo "🎯 Next steps:" ; \
echo " 1. Edit the test file to add your specific tests" ; \
echo " 2. Run: make test to check if it works" ; \
echo " 3. Implement the actual functionality" ; \
echo " 4. Run tests again to verify (TDD cycle)"
2025-09-23 03:35:20 +02:00
# 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" ; \
exit 1; \
fi
@PYTHONPATH= . $( VENV_PYTHON) tddai_cli.py analyze-coverage $( NUM)
feat: Revolutionary Test Architecture - 7-Layer Organization with Advanced Testing Capabilities
ARCHITECTURAL MILESTONE: Complete transformation of test suite from issue-based to sophisticated
architectural layer organization with 348 tests across 7 layers (Foundation → Infrastructure →
Integration → Domain → Service → Application → Presentation).
Major Components:
🏗️ ARCHITECTURAL TEST ORGANIZATION:
• Renamed 23 test files to architectural layers (e.g. test_parser.py → test_l7_foundation_markdown_parsing.py)
• Created reverse dependency execution order for 60-80% faster feedback
• Foundation layer (10 tests, ~9s) provides immediate failure detection
• Complete dependency mapping across all 7 architectural layers
🎯 ADVANCED TEST RUNNERS:
• run_architectural_tests.py - Reverse dependency execution with performance metrics
• run_randomized_tests.py - Seed-based randomization for dependency detection
• Comprehensive error handling and colored output for optimal UX
• Support for layer-specific execution and early termination on failures
📋 COMPREHENSIVE DOCUMENTATION:
• ARCHITECTURE.md - 7-layer architecture blueprint with migration strategy
• CAPABILITIES.md - Complete inventory of 73+ system capabilities across 15 categories
• TEST_ARCHITECTURE.md - Detailed test execution strategy and naming conventions
• ARCHITECTURAL_CHAOS_TESTING_ISSUE.md - Chaos engineering gameplan (Issue #35)
🔧 MAKEFILE INTEGRATION:
• 15+ new testing targets (test-arch, test-foundation, test-random, etc.)
• Layer-specific execution (test-infrastructure, test-domain, test-service)
• Advanced options (test-quick, test-layers, test-random-repeat)
• Comprehensive help system with organized testing categories
🎲 RANDOMIZED TESTING:
• Seed-based reproducible test execution for debugging
• Multi-iteration testing to detect flaky tests and hidden dependencies
• Enhanced randomization support with pytest-randomly integration
• Performance analysis across different execution orders
🚀 PERFORMANCE OPTIMIZATION:
• Foundation-first execution prevents cascade failure debugging
• Quick testing (foundation + infrastructure) completes in ~22 seconds
• Layer isolation enables targeted debugging and development
• Optimal feedback loops for architectural development
This revolutionary testing infrastructure establishes MarkiTect as having enterprise-grade
test organization with architectural principles, performance optimization, and advanced
testing methodologies including chaos engineering foundations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 12:18:25 +02:00
# ============================================================================
# Architectural Testing Targets
# ============================================================================
# Run all tests in architectural order (reverse dependency)
test-arch : $( VENV ) /bin /activate
@echo "🏗️ Running architectural test suite in reverse dependency order..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py
# Run foundation layer tests only (Layer 7 - fastest feedback)
test-foundation : $( VENV ) /bin /activate
@echo "🏢 Running Foundation Layer tests (Layer 7)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer foundation
# Run infrastructure layer tests only (Layer 5 - technical capabilities)
test-infrastructure : $( VENV ) /bin /activate
@echo "🔧 Running Infrastructure Layer tests (Layer 5)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer infrastructure
# Run integration layer tests only (Layer 6 - external systems)
test-integration : $( VENV ) /bin /activate
@echo "🌐 Running Integration Layer tests (Layer 6)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer integration
# Run domain layer tests only (Layer 3 - business logic)
test-domain : $( VENV ) /bin /activate
@echo "🏛️ Running Domain Layer tests (Layer 3)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer domain
# Run service layer tests only (Layer 4 - application services)
test-service : $( VENV ) /bin /activate
@echo "⚙️ Running Service Layer tests (Layer 4)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer service
# Run application layer tests only (Layer 2 - use cases & workflows)
test-application : $( VENV ) /bin /activate
@echo "🚀 Running Application Layer tests (Layer 2)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer application
# Run presentation layer tests only (Layer 1 - user interface)
test-presentation : $( VENV ) /bin /activate
@echo "🎯 Running Presentation Layer tests (Layer 1)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --layer presentation
# Run foundation + infrastructure only (quick feedback)
test-quick : $( VENV ) /bin /activate
@echo "⚡ Running quick test suite (Foundation + Infrastructure)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --quick
# List all architectural layers and their test files
test-layers : $( VENV ) /bin /activate
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --list-layers
# Advanced architectural testing options
test-arch-verbose : $( VENV ) /bin /activate
@echo "🏗️ Running architectural test suite with verbose output..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --verbose
test-arch-continue : $( VENV ) /bin /activate
@echo "🏗️ Running architectural test suite (continue on failures)..."
@PYTHONPATH= src $( VENV_PYTHON) run_architectural_tests.py --continue-on-failure
# Update .PHONY for advanced targets
.PHONY : test -arch -verbose test -arch -continue
# ============================================================================
# Randomized Testing Targets
# ============================================================================
# Run tests in random order to detect hidden dependencies
test-random : $( VENV ) /bin /activate
@echo "🎲 Running tests in randomized order..."
@PYTHONPATH= src $( VENV_PYTHON) run_randomized_tests.py
# Run tests with specific seed for reproducibility
test-random-seed : $( VENV ) /bin /activate
@if [ -z " $( SEED) " ] ; then \
echo "❌ Please specify seed: make test-random-seed SEED=12345" ; \
exit 1; \
fi
@echo " 🎲 Running tests with seed $( SEED) ... "
@PYTHONPATH= src $( VENV_PYTHON) run_randomized_tests.py --seed $( SEED)
# Run multiple random iterations to find flaky tests
test-random-repeat : $( VENV ) /bin /activate
@if [ -z " $( NUM) " ] ; then \
echo "❌ Please specify number of iterations: make test-random-repeat NUM=5" ; \
exit 1; \
fi
@echo " 🔄 Running $( NUM) randomized test iterations... "
@PYTHONPATH= src $( VENV_PYTHON) run_randomized_tests.py --repeat $( NUM)
# Install pytest-randomly plugin for enhanced randomization
test-install-randomly : $( VENV ) /bin /activate
@echo "📦 Installing pytest-randomly plugin..."
@$( VENV_PIP) install pytest-randomly
@echo "✅ pytest-randomly installed - now supports within-file randomization"
@echo "💡 Use --shuffle-within-file flag for enhanced randomization"
# Advanced randomized testing options
test-random-verbose : $( VENV ) /bin /activate
@echo "🎲 Running randomized tests with verbose output..."
@PYTHONPATH= src $( VENV_PYTHON) run_randomized_tests.py --verbose
test-random-enhanced : $( VENV ) /bin /activate
@echo "🎲 Running enhanced randomized tests (within-file shuffling)..."
@PYTHONPATH= src $( VENV_PYTHON) run_randomized_tests.py --shuffle-within-file --verbose
# Update .PHONY for randomized targets
.PHONY : test -random -verbose test -random -enhanced
2025-09-29 21:21:21 +02:00
2025-10-01 15:59:33 +02:00
# ============================================================================
# Test Efficiency Targets (Issue #57)
# ============================================================================
# Clean test runner that excludes workspace directories and cleans cache
test-clean : $( VENV ) /bin /activate
@echo "🧹 Running clean test suite (excluding workspaces, fresh cache)..."
@echo " Cleaning pytest cache..."
@rm -rf .pytest_cache/
@echo " Running tests with workspace exclusion..."
@PYTHONPATH= . $( VENV_PYTHON) -m pytest tests/ -v \
--ignore= .markitect_workspace/ \
--cache-clear \
--tb= short
# Quick test suite for TDD workflows (fast feedback)
test-tdd : $( VENV ) /bin /activate
@echo "⚡ Running TDD test suite for fast feedback..."
@PYTHONPATH= . $( VENV_PYTHON) -m pytest tests/ \
--ignore= .markitect_workspace/ \
-x \
--tb= line \
-q \
-m "not slow and not integration and not e2e"
# Run tests for changed files only (intelligent selection)
test-changed : $( VENV ) /bin /activate
@echo "🎯 Running tests for changed files..."
@if git diff --name-only HEAD~1 | grep -E " \.(py) $$ " >/dev/null 2>& 1; then \
echo " Detected Python file changes" ; \
changed_files = $$ ( git diff --name-only HEAD~1 | grep -E " \.(py) $$ " | tr '\n' ' ' ) ; \
echo " Changed files: $$ changed_files " ; \
PYTHONPATH = . $( VENV_PYTHON) -m pytest \
--ignore= .markitect_workspace/ \
-v \
--tb= short; \
else \
echo " No Python file changes detected" ; \
echo " Running smoke tests instead..." ; \
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/ \
--ignore= .markitect_workspace/ \
-m "smoke" \
-q; \
fi
# Run tests for a specific module
test-module : $( VENV ) /bin /activate
@if [ -z " $( MODULE) " ] ; then \
echo "❌ Please specify module: make test-module MODULE=markitect.cli" ; \
exit 1; \
fi
@echo " 🎯 Running tests for module: $( MODULE) ... "
@PYTHONPATH= . $( VENV_PYTHON) -m pytest tests/ \
--ignore= .markitect_workspace/ \
-k " $( MODULE) " \
-v \
--tb= short
# Clean up stale cache entries
test-cache-clean : $( VENV ) /bin /activate
@echo "🧹 Cleaning test cache..."
@if [ -d ".pytest_cache" ] ; then \
echo " Removing pytest cache directory..." ; \
rm -rf .pytest_cache/; \
echo " ✅ Cache cleaned" ; \
else \
echo " ✅ No cache to clean" ; \
fi
# Enhanced test command with workspace exclusion (replace default test)
test-efficient : $( VENV ) /bin /activate
@echo "🧪 Running efficient test suite (excluding workspaces)..."
@PYTHONPATH= . $( VENV_PYTHON) -m pytest tests/ \
--ignore= .markitect_workspace/ \
-v \
--tb= short \
--maxfail= 5
.PHONY : test -clean test -tdd test -changed test -module test -cache -clean test -efficient
2025-09-29 21:21:21 +02:00
# ============================================================================
# MarkiTect CLI Usage Targets
# ============================================================================
# Variables for CLI targets
MARKITECT := PYTHONPATH = . $( VENV_PYTHON) -c "from markitect.cli import cli; import sys; cli(sys.argv[1:])"
SAMPLE_DOC := test_frontmatter.md
OUTPUT_FORMAT := table
# Basic document operations
cli-ingest : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "📄 Processing sample document..." ; \
$( MARKITECT) ingest $( SAMPLE_DOC) ; \
else \
echo " 📄 Processing document: $( FILE) " ; \
$( MARKITECT) ingest $( FILE) ; \
fi
cli-status : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "📊 Checking status of sample document..." ; \
$( MARKITECT) status $( SAMPLE_DOC) ; \
else \
echo " 📊 Checking status of document: $( FILE) " ; \
$( MARKITECT) status $( FILE) ; \
fi
cli-list : $( VENV ) /bin /activate
@echo "📋 Listing all processed documents..."
@$( MARKITECT) list --format $( OUTPUT_FORMAT)
cli-get : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "📖 Retrieving sample document..." ; \
$( MARKITECT) get $( SAMPLE_DOC) ; \
else \
echo " 📖 Retrieving document: $( FILE) " ; \
$( MARKITECT) get $( FILE) ; \
fi
# Schema operations
2025-09-30 02:59:43 +02:00
cli-schema-generate : $( VENV ) /bin /activate
2025-09-29 21:21:21 +02:00
@if [ -z " $( FILE) " ] ; then \
echo "🔧 Generating schema from sample document..." ; \
2025-09-30 02:59:43 +02:00
$( MARKITECT) schema-generate $( SAMPLE_DOC) --format json; \
2025-09-29 21:21:21 +02:00
else \
echo " 🔧 Generating schema from document: $( FILE) " ; \
2025-09-30 02:59:43 +02:00
$( MARKITECT) schema-generate $( FILE) --format json; \
2025-09-29 21:21:21 +02:00
fi
2025-09-30 02:59:43 +02:00
cli-schema-ingest : $( VENV ) /bin /activate
@if [ -z " $( SCHEMA) " ] ; then \
echo "❌ Usage: make cli-schema-ingest SCHEMA=schema.json" ; \
echo " Example: make cli-schema-ingest SCHEMA=my_schema.json" ; \
exit 1; \
fi
@echo " 📥 Ingesting schema: $( SCHEMA) "
@$( MARKITECT) schema-ingest $( SCHEMA)
cli-schema-list : $( VENV ) /bin /activate
@echo "📋 Listing stored schemas..."
@$( MARKITECT) schema-list --format $( OUTPUT_FORMAT)
cli-schema-get : $( VENV ) /bin /activate
@if [ -z " $( SCHEMA) " ] ; then \
echo "❌ Usage: make cli-schema-get SCHEMA=schema_name" ; \
echo " Example: make cli-schema-get SCHEMA=my_schema.json" ; \
exit 1; \
fi
@echo " 📖 Retrieving schema: $( SCHEMA) "
@$( MARKITECT) schema-get $( SCHEMA)
2025-09-29 21:21:21 +02:00
cli-validate : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] || [ -z " $( SCHEMA) " ] ; then \
echo "❌ Usage: make cli-validate FILE=document.md SCHEMA=schema.json" ; \
echo " Example: make cli-validate FILE=test_frontmatter.md SCHEMA=generated_schema.json" ; \
exit 1; \
fi
@echo " ✅ Validating $( FILE) against $( SCHEMA) ... "
@$( MARKITECT) validate $( FILE) $( SCHEMA)
cli-validate-detailed : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] || [ -z " $( SCHEMA) " ] ; then \
echo "❌ Usage: make cli-validate-detailed FILE=document.md SCHEMA=schema.json" ; \
echo " Example: make cli-validate-detailed FILE=test_frontmatter.md SCHEMA=generated_schema.json" ; \
exit 1; \
fi
@echo " 🔍 Validating $( FILE) with detailed errors... "
@$( MARKITECT) validate $( FILE) $( SCHEMA) --detailed-errors --error-format text
# AST operations
cli-ast-show : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "🌳 Showing AST for sample document..." ; \
$( MARKITECT) ast-show $( SAMPLE_DOC) ; \
else \
echo " 🌳 Showing AST for document: $( FILE) " ; \
$( MARKITECT) ast-show $( FILE) ; \
fi
cli-ast-stats : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "📈 Showing AST statistics for sample document..." ; \
$( MARKITECT) ast-stats $( SAMPLE_DOC) ; \
else \
echo " 📈 Showing AST statistics for document: $( FILE) " ; \
$( MARKITECT) ast-stats $( FILE) ; \
fi
cli-ast-query : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] || [ -z " $( QUERY) " ] ; then \
echo "❌ Usage: make cli-ast-query FILE=document.md QUERY='JSONPath expression'" ; \
echo " Example: make cli-ast-query FILE=test_frontmatter.md QUERY=' $.headings[*].text' " ; \
exit 1; \
fi
@echo " 🔍 Querying AST: $( QUERY) "
@$( MARKITECT) ast-query $( FILE) '$(QUERY)'
# Metadata operations
cli-metadata : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "🏷️ Showing metadata for sample document..." ; \
$( MARKITECT) metadata $( SAMPLE_DOC) --format $( OUTPUT_FORMAT) ; \
else \
echo " 🏷️ Showing metadata for document: $( FILE) " ; \
$( MARKITECT) metadata $( FILE) --format $( OUTPUT_FORMAT) ; \
fi
# Database operations
cli-query : $( VENV ) /bin /activate
@if [ -z " $( SQL) " ] ; then \
echo "❌ Usage: make cli-query SQL='SELECT statement'" ; \
echo " Example: make cli-query SQL='SELECT * FROM files LIMIT 5'" ; \
exit 1; \
fi
@echo "🗄️ Executing SQL query..."
@$( MARKITECT) query '$(SQL)' --format $( OUTPUT_FORMAT)
cli-schema-db : $( VENV ) /bin /activate
@echo "🗄️ Showing database schema..."
@$( MARKITECT) schema
# Cache management
cli-cache-info : $( VENV ) /bin /activate
@echo "💾 Cache information..."
@$( MARKITECT) cache-info
cli-cache-clean : $( VENV ) /bin /activate
@echo "🧹 Cleaning cache..."
@$( MARKITECT) cache-clean
cli-cache-invalidate : $( VENV ) /bin /activate
@if [ -z " $( FILE) " ] ; then \
echo "❌ Usage: make cli-cache-invalidate FILE=document.md" ; \
exit 1; \
fi
@echo " 🔄 Invalidating cache for $( FILE) ... "
@$( MARKITECT) cache-invalidate $( FILE)
# Schema visualization
cli-visualize-schema : $( VENV ) /bin /activate
@if [ -z " $( SCHEMA) " ] ; then \
echo "❌ Usage: make cli-visualize-schema SCHEMA=schema.json" ; \
echo " Example: make cli-visualize-schema SCHEMA=generated_schema.json" ; \
exit 1; \
fi
@echo " 🎨 Visualizing schema: $( SCHEMA) "
@$( VENV_PYTHON) visualize_schema.py $( SCHEMA)
cli-visualize-schema-ascii : $( VENV ) /bin /activate
@if [ -z " $( SCHEMA) " ] ; then \
echo "❌ Usage: make cli-visualize-schema-ascii SCHEMA=schema.json" ; \
echo " Example: make cli-visualize-schema-ascii SCHEMA=generated_schema.json" ; \
exit 1; \
fi
@echo " 🎨 Visualizing schema (ASCII mode): $( SCHEMA) "
@$( VENV_PYTHON) visualize_schema.py $( SCHEMA) --ascii
# Complete workflow examples
cli-workflow-basic : $( VENV ) /bin /activate
@echo "🔄 Running basic MarkiTect workflow..."
@echo " Step 1: Ingest document"
@$( MARKITECT) ingest $( SAMPLE_DOC)
@echo ""
@echo " Step 2: Show status"
@$( MARKITECT) status $( SAMPLE_DOC)
@echo ""
@echo " Step 3: Show AST statistics"
@$( MARKITECT) ast-stats $( SAMPLE_DOC)
@echo ""
@echo "✅ Basic workflow complete!"
cli-workflow-schema : $( VENV ) /bin /activate
@echo "🔄 Running schema generation and validation workflow..."
@if [ -z " $( FILE) " ] ; then \
echo "❌ Usage: make cli-workflow-schema FILE=document.md" ; \
echo " Example: make cli-workflow-schema FILE=test_frontmatter.md" ; \
exit 1; \
fi
@echo " Step 1: Ingest document"
@$( MARKITECT) ingest $( FILE)
@echo ""
@echo " Step 2: Generate schema"
2025-09-30 02:59:43 +02:00
@$( MARKITECT) schema-generate $( FILE) --format json > temp_schema.json
2025-09-29 21:21:21 +02:00
@echo " Schema saved to temp_schema.json"
@echo ""
@echo " Step 3: Validate document against generated schema"
@$( MARKITECT) validate $( FILE) temp_schema.json
@echo ""
@echo " Step 4: Visualize schema"
@$( VENV_PYTHON) visualize_schema.py temp_schema.json --ascii
@echo ""
@echo "✅ Schema workflow complete!"
@echo "💡 Schema file: temp_schema.json"
# Help for CLI targets
cli-help :
@echo "🚀 MarkiTect CLI Usage Targets"
@echo "============================="
@echo ""
@echo "Document Operations:"
@echo " cli-ingest [FILE=doc.md] - Process and store markdown file"
@echo " cli-status [FILE=doc.md] - Show processing status"
@echo " cli-list [OUTPUT_FORMAT=table] - List all processed documents"
@echo " cli-get [FILE=doc.md] - Retrieve processed document"
@echo " cli-metadata [FILE=doc.md] - Show document metadata"
@echo ""
@echo "Schema Operations:"
2025-09-30 02:59:43 +02:00
@echo " cli-schema-generate [FILE=doc.md] - Generate JSON schema"
@echo " cli-schema-ingest SCHEMA=schema.json - Store schema in database"
@echo " cli-schema-list [OUTPUT_FORMAT=table] - List stored schemas"
@echo " cli-schema-get SCHEMA=name - Retrieve stored schema"
2025-09-29 21:21:21 +02:00
@echo " cli-validate FILE=doc.md SCHEMA=schema.json - Validate document"
@echo " cli-validate-detailed FILE=doc.md SCHEMA=schema.json - Detailed validation"
@echo " cli-visualize-schema SCHEMA=schema.json - Visualize schema (colorful)"
@echo " cli-visualize-schema-ascii SCHEMA=schema.json - Visualize schema (ASCII)"
@echo ""
@echo "AST Operations:"
@echo " cli-ast-show [FILE=doc.md] - Display AST structure"
@echo " cli-ast-stats [FILE=doc.md] - Show AST statistics"
@echo " cli-ast-query FILE=doc.md QUERY='JSONPath' - Query AST"
@echo ""
@echo "Database Operations:"
@echo " cli-query SQL='SELECT...' - Execute SQL query"
@echo " cli-schema-db - Show database schema"
@echo ""
@echo "Cache Management:"
@echo " cli-cache-info - Show cache statistics"
@echo " cli-cache-clean - Clear all caches"
@echo " cli-cache-invalidate FILE=doc.md - Invalidate specific file cache"
@echo ""
@echo "Complete Workflows:"
@echo " cli-workflow-basic - Basic ingest → status → stats workflow"
@echo " cli-workflow-schema FILE=doc.md - Complete schema workflow"
@echo ""
@echo "📋 Variables:"
@echo " FILE - Target markdown file (default: $( SAMPLE_DOC) ) "
2025-09-30 02:59:43 +02:00
@echo " OUTPUT_FORMAT - Output format: table, json, yaml, simple (default: $( OUTPUT_FORMAT) ) "
2025-09-29 21:21:21 +02:00
@echo " SCHEMA - JSON schema file"
@echo " SQL - SQL query string"
@echo " QUERY - JSONPath query expression"
@echo ""
@echo "💡 Examples:"
@echo " make cli-ingest FILE=my_document.md"
2025-09-30 02:59:43 +02:00
@echo " make cli-list OUTPUT_FORMAT=table"
@echo " make cli-schema-list OUTPUT_FORMAT=simple"
2025-09-29 21:21:21 +02:00
@echo " make cli-validate FILE=doc.md SCHEMA=doc_schema.json"
@echo " make cli-ast-query FILE=doc.md QUERY=' $.headings[*].text' "
@echo " make cli-query SQL='SELECT title FROM metadata WHERE status=\"draft\"'"
# Update .PHONY for CLI targets
2025-09-30 02:59:43 +02:00
.PHONY : cli -ingest cli -status cli -list cli -get cli -schema -generate cli -schema -ingest cli -schema -list cli -schema -get cli -validate cli -validate -detailed cli -ast -show cli -ast -stats cli -ast -query cli -metadata cli -query cli -schema -db cli -cache -info cli -cache -clean cli -cache -invalidate cli -visualize -schema cli -visualize -schema -ascii cli -workflow -basic cli -workflow -schema cli -help
2025-10-02 00:45:06 +02:00
# ============================================================================
# Requirements Engineering Integration
# ============================================================================
# Validate project requirements and foundations before development
validate-requirements : $( VENV ) /bin /activate
@echo "🔍 Validating project requirements and foundations..."
@PYTHONPATH= . $( VENV_PYTHON) tools/requirements_engineering_toolkit.py analyze
# Check interface compatibility for specific interface
check-interface-compatibility : $( VENV ) /bin /activate
@if [ -z " $( INTERFACE) " ] ; then \
echo "❌ Please specify interface: make check-interface-compatibility INTERFACE=IssueBackend" ; \
exit 1; \
fi
@echo " 🔌 Checking interface compatibility for $( INTERFACE) ... "
@PYTHONPATH= . $( VENV_PYTHON) tools/requirements_engineering_toolkit.py plan-interface --interface $( INTERFACE)
# Generate development checklist for specific feature
generate-dev-checklist : $( VENV ) /bin /activate
@if [ -z " $( FEATURE) " ] ; then \
echo "❌ Please specify feature: make generate-dev-checklist FEATURE='Your Feature Name'" ; \
exit 1; \
fi
@echo " 📋 Generating development checklist for $( FEATURE) ... "
@PYTHONPATH= . $( VENV_PYTHON) tools/requirements_engineering_toolkit.py checklist --feature " $( FEATURE) "
# Validate mock object compatibility
validate-mocks : $( VENV ) /bin /activate
@echo "🧪 Validating mock object compatibility..."
@if [ -f "tests/test_mock_compatibility.py" ] ; then \
PYTHONPATH = . $( VENV_PYTHON) -m pytest tests/test_mock_compatibility.py -xvs; \
else \
echo "⚠️ Mock compatibility tests not found" ; \
echo " Run 'make setup-mock-validation' to create them" ; \
fi
# Pre-commit validation including requirements
pre-commit-validate : validate -requirements validate -mocks
@echo "✅ Pre-commit validation complete"
# Setup mock validation test file
setup-mock-validation : $( VENV ) /bin /activate
@echo "🔧 Setting up mock validation tests..."
@if [ ! -f "tests/test_mock_compatibility.py" ] ; then \
cp docs/integration/requirements_engineering_integration.md tests/temp_integration_guide.md; \
echo "💡 Mock compatibility test template available in integration guide" ; \
echo " Create tests/test_mock_compatibility.py based on the guide" ; \
echo " See docs/integration/requirements_engineering_integration.md" ; \
else \
echo "✅ Mock validation tests already exist" ; \
fi
# View requirements engineering usage examples
view-requirements-examples : $( VENV ) /bin /activate
@echo "📖 Requirements Engineering Usage Examples"
@echo "========================================="
@echo ""
@echo "Foundation Analysis:"
@echo " make validate-requirements"
@echo ""
@echo "Interface Planning:"
@echo " make check-interface-compatibility INTERFACE=IssueBackend"
@echo " make check-interface-compatibility INTERFACE=PluginManager"
@echo ""
@echo "Feature Development:"
@echo " make generate-dev-checklist FEATURE='New Plugin System'"
@echo " make generate-dev-checklist FEATURE='CLI Enhancement'"
@echo ""
@echo "Mock Validation:"
@echo " make validate-mocks"
@echo " make setup-mock-validation"
@echo ""
@echo "Complete Workflow:"
@echo " make pre-commit-validate"
@echo ""
@echo "📋 Prevention Demo:"
@echo " PYTHONPATH=. $( VENV_PYTHON) examples/issue_59_prevention_demo.py "
# Update .PHONY for requirements engineering targets
.PHONY : validate -requirements check -interface -compatibility generate -dev -checklist validate -mocks pre -commit -validate setup -mock -validation view -requirements -examples