@@ -205,34 +205,21 @@ def _build_task_prompt(task: dict, metrics: Any) -> str:
205205
206206Description:
207207{ task .get ('description' , '' )}
208-
209- ## Project Context
210208"""
211209
212- # Add metrics if available
213- if hasattr (metrics , 'total_files' ):
214- prompt += f"- Files: { metrics .total_files } \n "
215- prompt += f"- Lines of code: { metrics .total_lines :,} \n "
216- prompt += f"- Average cyclomatic complexity: { metrics .avg_cc :.1f} \n "
217- prompt += f"- Max complexity: { metrics .max_cc } \n "
218- prompt += f"- Critical functions (CC > 10): { metrics .critical_count } \n "
219- else :
220- prompt += "- Metrics not available\n "
221-
222210 # Add file content if file is specified
223211 if file_path :
224212 try :
225213 from pathlib import Path
226214 file_full_path = Path (file_path )
227215 if not file_full_path .is_absolute ():
228- # Assume relative to current directory
229216 file_full_path = Path .cwd () / file_path
230217
231218 if file_full_path .exists ():
232219 with open (file_full_path , "r" , encoding = "utf-8" ) as f :
233220 file_content = f .read ()
234221 prompt += f"""
235- ## Current File Content
222+ ## Current File Content (ONLY this file may be modified)
236223
237224```python
238225{ file_content }
@@ -246,25 +233,20 @@ def _build_task_prompt(task: dict, metrics: Any) -> str:
246233 prompt += f"""
247234## Instructions
248235
249- CRITICAL: You MUST output the complete modified file content in a code block.
236+ CRITICAL RULES:
237+ 1. You may ONLY modify the Target File listed above.
238+ 2. Do NOT modify, create, or reference any other files.
239+ 3. Do NOT output code blocks for any other file path.
250240
251- For each file you modify, use this format :
241+ Output format ( use EXACTLY this) :
252242```python:{ file_path if file_path else 'path/to/file.py' }
253- # Complete file content here
243+ <COMPLETE file content here>
254244```
255245
256- If modifying multiple files, use separate code blocks with file paths.
257-
258246Requirements:
259- 1. Read and understand the current file content
260- 2. Apply the necessary changes to fix the issue
261- 3. Output the COMPLETE modified file content (not just snippets)
262- 4. Ensure the code is syntactically correct and complete
263- 5. Do not truncate or omit any parts of the file
264-
265- If the issue does not exist or cannot be found, explicitly state: "Issue not found" or "No action needed".
266-
267- Focus on practical, actionable changes that improve the codebase.
247+ - Output the COMPLETE modified file content (not snippets).
248+ - Ensure syntactic correctness; do not truncate or omit anything.
249+ - If the issue does not exist in the Target File, state exactly: "No action needed".
268250"""
269251
270252 return prompt
0 commit comments