refactor: Separate CLI presentation from core business logic
Complete architectural separation of concerns implementing clean layered design: • Services Layer: Pure business logic isolated from presentation - WorkspaceService: TDD workspace operations - IssueService: Issue management and creation - ProjectService: Project management and milestones - ExportService: Unix-friendly data export • CLI Layer: Clean presentation with command/presenter separation - Commands delegate to services for all business operations - Presenters handle formatted output and error messaging - Framework provides unified interface • Benefits: - Eliminates mixed concerns in 943-line CLI monolith - Enables easier testing and maintenance - Preserves all existing functionality and Unix pipeline compatibility - Provides foundation for future CLI development Resolves issue #20: CLI separation from core logic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
78
cli/core.py
Normal file
78
cli/core.py
Normal file
@@ -0,0 +1,78 @@
|
||||
"""
|
||||
CLI framework core.
|
||||
|
||||
Provides the main CLI framework and command delegation.
|
||||
"""
|
||||
|
||||
from .commands import WorkspaceCommands, IssueCommands, ProjectCommands, ExportCommands
|
||||
|
||||
|
||||
class CLIFramework:
|
||||
"""Main CLI framework that delegates to command classes."""
|
||||
|
||||
def __init__(self):
|
||||
self.workspace = WorkspaceCommands()
|
||||
self.issues = IssueCommands()
|
||||
self.project = ProjectCommands()
|
||||
self.export = ExportCommands()
|
||||
|
||||
# Workspace operations
|
||||
def workspace_status(self):
|
||||
return self.workspace.status()
|
||||
|
||||
def start_issue(self, issue_number: int):
|
||||
return self.workspace.start_issue(issue_number)
|
||||
|
||||
def finish_issue(self):
|
||||
return self.workspace.finish_issue()
|
||||
|
||||
def add_test_guidance(self):
|
||||
return self.workspace.add_test_guidance()
|
||||
|
||||
# Issue operations
|
||||
def list_issues(self):
|
||||
return self.issues.list_issues()
|
||||
|
||||
def list_open_issues(self):
|
||||
return self.issues.list_open_issues()
|
||||
|
||||
def show_issue(self, issue_number: int):
|
||||
return self.issues.show_issue(issue_number)
|
||||
|
||||
def create_issue(self, title: str, body: str, issue_type: str = "enhancement"):
|
||||
return self.issues.create_issue(title, body, issue_type)
|
||||
|
||||
def create_enhancement_issue(self, title: str, use_case: str, **kwargs):
|
||||
return self.issues.create_enhancement_issue(title, use_case, **kwargs)
|
||||
|
||||
def create_from_template(self, template_file: str, **kwargs):
|
||||
return self.issues.create_from_template(template_file, **kwargs)
|
||||
|
||||
def analyze_coverage(self, issue_number: int):
|
||||
return self.issues.analyze_coverage(issue_number)
|
||||
|
||||
# Project management operations
|
||||
def setup_project_management(self):
|
||||
return self.project.setup_project_management()
|
||||
|
||||
def move_issue_to_state(self, issue_number: int, state: str):
|
||||
return self.project.move_issue_to_state(issue_number, state)
|
||||
|
||||
def set_issue_priority(self, issue_number: int, priority: str):
|
||||
return self.project.set_issue_priority(issue_number, priority)
|
||||
|
||||
def create_milestone(self, title: str, description: str = ""):
|
||||
return self.project.create_milestone(title, description)
|
||||
|
||||
def list_milestones(self):
|
||||
return self.project.list_milestones()
|
||||
|
||||
def assign_issue_to_milestone(self, issue_number: int, milestone_id: int):
|
||||
return self.project.assign_issue_to_milestone(issue_number, milestone_id)
|
||||
|
||||
def project_overview(self):
|
||||
return self.project.project_overview()
|
||||
|
||||
# Export operations
|
||||
def issue_index(self, **kwargs):
|
||||
return self.export.issue_index(**kwargs)
|
||||
Reference in New Issue
Block a user