需求分析模式(非交互式) - NEW: matching UI version
(app: CLIApp, initial_idea: str)
| 205 | |
| 206 | |
| 207 | async def run_requirement_analysis(app: CLIApp, initial_idea: str): |
| 208 | """需求分析模式(非交互式) - NEW: matching UI version""" |
| 209 | try: |
| 210 | print( |
| 211 | f"\n{Colors.BOLD}{Colors.BLUE}🧠 Starting requirement analysis mode...{Colors.ENDC}" |
| 212 | ) |
| 213 | print(f"{Colors.CYAN}Initial Idea: {initial_idea}{Colors.ENDC}") |
| 214 | |
| 215 | # 初始化应用 |
| 216 | init_result = await app.initialize_mcp_app() |
| 217 | if init_result["status"] != "success": |
| 218 | print( |
| 219 | f"{Colors.FAIL}❌ Initialization failed: {init_result['message']}{Colors.ENDC}" |
| 220 | ) |
| 221 | return False |
| 222 | |
| 223 | # 执行需求分析工作流 |
| 224 | result = await app.process_requirement_analysis_non_interactive(initial_idea) |
| 225 | |
| 226 | if result["status"] == "success": |
| 227 | print( |
| 228 | f"\n{Colors.BOLD}{Colors.OKGREEN}🎉 Requirement analysis completed successfully!{Colors.ENDC}" |
| 229 | ) |
| 230 | return True |
| 231 | else: |
| 232 | print( |
| 233 | f"\n{Colors.BOLD}{Colors.FAIL}❌ Requirement analysis failed: {result.get('error', 'Unknown error')}{Colors.ENDC}" |
| 234 | ) |
| 235 | return False |
| 236 | |
| 237 | except Exception as e: |
| 238 | print(f"\n{Colors.FAIL}❌ Requirement analysis error: {str(e)}{Colors.ENDC}") |
| 239 | return False |
| 240 | finally: |
| 241 | await app.cleanup_mcp_app() |
| 242 | |
| 243 | |
| 244 | async def main(): |
no test coverage detected