MCPcopy
hub / github.com/HKUDS/DeepCode / process_requirement_analysis

Method process_requirement_analysis

cli/cli_app.py:115–228  ·  view source on GitHub ↗

处理需求分析工作流(交互式) (NEW: matching UI version)

(self)

Source from the content-addressed store, hash-verified

113 return {"status": "error", "error": error_msg}
114
115 async def process_requirement_analysis(self):
116 """处理需求分析工作流(交互式) (NEW: matching UI version)"""
117 try:
118 # Step 1: Get initial requirements from user
119 self.cli.print_separator()
120 self.cli.print_status(
121 "🧠 Starting requirement analysis workflow...", "info"
122 )
123
124 user_input = self.cli.get_requirement_analysis_input()
125
126 if not user_input:
127 self.cli.print_status("Requirement analysis cancelled", "warning")
128 return {"status": "cancelled"}
129
130 # Step 2: Generate guiding questions
131 self.cli.print_status(
132 "🤖 Generating AI-guided questions to refine your requirements...",
133 "processing",
134 )
135
136 questions_result = (
137 await self.workflow_adapter.execute_requirement_analysis_workflow(
138 user_input=user_input, analysis_mode="generate_questions"
139 )
140 )
141
142 if questions_result["status"] != "success":
143 self.cli.print_status(
144 f"❌ Failed to generate questions: {questions_result.get('error', 'Unknown error')}",
145 "error",
146 )
147 return questions_result
148
149 # Step 3: Display questions and get user answers
150 questions_json = questions_result["result"]
151 self.cli.display_guiding_questions(questions_json)
152
153 # Ask if user wants to answer the questions
154 proceed = (
155 input(
156 f"\n{Colors.BOLD}{Colors.YELLOW}Would you like to answer these questions? (y/n):{Colors.ENDC} "
157 )
158 .strip()
159 .lower()
160 )
161
162 if proceed != "y":
163 self.cli.print_status(
164 "You can still use the initial requirements for chat input",
165 "info",
166 )
167 return {"status": "partial", "initial_requirements": user_input}
168
169 user_answers = self.cli.get_question_answers(questions_json)
170
171 # Step 4: Generate requirement summary
172 self.cli.print_status(

Callers 1

Calls 10

process_inputMethod · 0.95
getMethod · 0.80
get_question_answersMethod · 0.80
print_separatorMethod · 0.45
print_statusMethod · 0.45
print_error_boxMethod · 0.45

Tested by

no test coverage detected