MCPcopy Index your code
hub / github.com/HKUDS/DeepCode / CLIApp

Class CLIApp

cli/cli_app.py:31–463  ·  view source on GitHub ↗

CLI应用主类 - 升级版智能体编排引擎

Source from the content-addressed store, hash-verified

29
30
31class CLIApp:
32 """CLI应用主类 - 升级版智能体编排引擎"""
33
34 def __init__(self):
35 self.cli = CLIInterface()
36 self.workflow_adapter = CLIWorkflowAdapter(cli_interface=self.cli)
37 self.app = None # Will be initialized by workflow adapter
38 self.logger = None
39 self.context = None
40 # Document segmentation will be managed by CLI interface
41
42 async def initialize_mcp_app(self):
43 """初始化MCP应用 - 使用工作流适配器"""
44 # Workflow adapter will handle MCP initialization
45 return await self.workflow_adapter.initialize_mcp_app()
46
47 async def cleanup_mcp_app(self):
48 """清理MCP应用 - 使用工作流适配器"""
49 await self.workflow_adapter.cleanup_mcp_app()
50
51 async def process_requirement_analysis_non_interactive(self, initial_idea: str):
52 """处理需求分析工作流(非交互式,用于命令行参数) (NEW: matching UI version)"""
53 try:
54 self.cli.print_separator()
55 self.cli.print_status(
56 "🧠 Starting requirement analysis workflow...", "info"
57 )
58
59 # Step 1: Generate guiding questions
60 self.cli.print_status(
61 "🤖 Generating AI-guided questions to refine your requirements...",
62 "processing",
63 )
64
65 questions_result = (
66 await self.workflow_adapter.execute_requirement_analysis_workflow(
67 user_input=initial_idea, analysis_mode="generate_questions"
68 )
69 )
70
71 if questions_result["status"] != "success":
72 self.cli.print_status(
73 f"❌ Failed to generate questions: {questions_result.get('error', 'Unknown error')}",
74 "error",
75 )
76 return questions_result
77
78 # Step 2: Display questions
79 questions_json = questions_result["result"]
80 self.cli.display_guiding_questions(questions_json)
81
82 # For non-interactive mode, we can't get user answers, so we provide a summary
83 self.cli.print_status(
84 "ℹ️ In non-interactive mode, using initial idea for implementation",
85 "info",
86 )
87 self.cli.print_status(
88 "💡 For guided analysis, please use interactive mode (python main_cli.py)",

Callers 2

mainFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected