🎯 MAJOR CLI ARCHITECTURE CONSOLIDATION: ✅ Added Missing CLI Entry Points: • tddai = "tddai_cli:main" - TDD workflow management • issue = "cli.issue_cli:main" - Pure issue management • All three CLIs now properly installed: markitect, tddai, issue 🧹 Eliminated Functionality Redundancy: • Removed issue commands from markitect/cli.py (clean separation) • MarkiTect now focuses purely on document processing • TDD workflow in tddai CLI, issue management in issue CLI 🏗️ Clean Architecture Implementation: • Created cli/issue_cli.py - Dedicated pure issue management • Enhanced cli/commands/export.py with export_issues_csv/json • Updated cli/core.py with proper export method delegation • Fixed pyproject.toml to include all required packages 🧪 Comprehensive Testing: • Added tests/test_cli_consolidation.py - Prevents CLI regression • Tests ensure all CLIs are installed and functional • Tests verify no functionality duplication • Regression protection against missing CLI commands 📋 Clear Separation of Concerns: • markitect CLI - Document processing, templates, performance • tddai CLI - TDD workflow, workspace management, coverage • issue CLI - Pure issue operations, project management, export 🔧 Package Configuration: • Updated pyproject.toml to include cli*, tddai*, services*, etc. • Added py-modules for tddai_cli standalone module • Fixed import paths and dependencies This consolidation resolves the major redundancy identified in issues functionality and ensures proper CLI interfaces are available and tested. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
82 lines
2.6 KiB
Python
82 lines
2.6 KiB
Python
"""
|
|
Export and reporting CLI commands.
|
|
"""
|
|
|
|
import sys
|
|
from typing import Optional
|
|
|
|
from tddai import TddaiError
|
|
from services import ExportService
|
|
from cli.presenters import OutputFormatter
|
|
|
|
|
|
class ExportCommands:
|
|
"""Commands for data export and reporting."""
|
|
|
|
def __init__(self):
|
|
self.service = ExportService()
|
|
|
|
def issue_index(self, format_type: str = "tsv", sort_by: str = "number",
|
|
filter_state: Optional[str] = None, filter_priority: Optional[str] = None,
|
|
include_state: bool = False) -> None:
|
|
"""Output compact index of all issues for Unix processing.
|
|
|
|
Args:
|
|
format_type: Output format (tsv, csv, json, fields)
|
|
sort_by: Sort by field (number, title, priority, state, created, updated)
|
|
filter_state: Filter by state (open, closed)
|
|
filter_priority: Filter by priority (low, medium, high, critical, none)
|
|
include_state: Include state column in output
|
|
"""
|
|
try:
|
|
output = self.service.export_issues(
|
|
format_type=format_type,
|
|
sort_by=sort_by,
|
|
filter_state=filter_state,
|
|
filter_priority=filter_priority,
|
|
include_state=include_state
|
|
)
|
|
|
|
# Output directly to stdout for piping
|
|
print(output)
|
|
|
|
except TddaiError as e:
|
|
# Send error to stderr to avoid corrupting piped output
|
|
print(f"❌ Error: {e}", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
def export_issues_csv(self, output_file: str = None) -> None:
|
|
"""Export issues in CSV format."""
|
|
try:
|
|
output = self.service.export_issues(
|
|
format_type="csv",
|
|
sort_by="number"
|
|
)
|
|
|
|
if output_file:
|
|
with open(output_file, 'w') as f:
|
|
f.write(output)
|
|
OutputFormatter.success(f"Issues exported to {output_file}")
|
|
else:
|
|
print(output)
|
|
|
|
except TddaiError as e:
|
|
OutputFormatter.exit_with_error(str(e))
|
|
|
|
def export_issues_json(self, output_file: str = None) -> None:
|
|
"""Export issues in JSON format."""
|
|
try:
|
|
output = self.service.export_issues(
|
|
format_type="json",
|
|
sort_by="number"
|
|
)
|
|
|
|
if output_file:
|
|
with open(output_file, 'w') as f:
|
|
f.write(output)
|
|
OutputFormatter.success(f"Issues exported to {output_file}")
|
|
else:
|
|
print(output)
|
|
|
|
except TddaiError as e:
|
|
OutputFormatter.exit_with_error(str(e)) |