@@ -674,13 +674,13 @@ index abc1234..def5678 100644
674674
675675/* *
676676 * Template for modification plan generation
677- * Generates concise, structured modification suggestions
677+ * Generates concise, structured modification suggestions using Plan-like format
678678 */
679679object ModificationPlanTemplate {
680680 val EN = """
681681# Modification Plan Generation
682682
683- Based on the code analysis, provide a **concise, structured modification plan**.
683+ Based on the code analysis and lint results , provide a **specific, actionable modification plan** using the Plan format .
684684
685685## Analysis Context
686686
@@ -692,69 +692,82 @@ ${'$'}{lintResults}
692692
693693## Your Task
694694
695- Generate a concise modification plan with **3-5 key points maximum** .
695+ Generate a **specific** modification plan with **maximum 5 items**, using the Plan markdown format with nested structure .
696696
697697### Required Format:
698698
699- ```markdown
700- ## Modification Plan
701-
702- ### 1. {Issue Category} - {Priority Level}
703- **What**: {Brief description of what needs to change}
704- **Why**: {One sentence explaining the reason}
705- **How**: {One sentence suggesting the approach}
699+ Your output MUST be inside a code block with language `plan`:
706700
707- ### 2. {Issue Category} - {Priority Level}
708- **What**: {Brief description}
709- **Why**: {Reason}
710- **How**: {Approach}
701+ ```plan
702+ 1. {Issue Category} - {Priority}
703+ - [ ] Fix [FileName](filepath) line {X}: {Specific issue}
704+ - [ ] {Why this fix is needed}
705+ - [ ] {How to fix: concrete action}
711706
712- ... (maximum 5 items)
707+ 2. {Issue Category} - {Priority}
708+ - [ ] Fix [FileName](filepath) line {Y}: {Specific issue}
709+ - [ ] {Why}
710+ - [ ] {How}
713711```
714712
715- ### Guidelines:
716-
717- 1. **Maximum 5 items** - Focus on the most critical issues
718- 2. **Priority levels**: 🔴 CRITICAL | ⚠️ HIGH | 📝 MEDIUM
719- 3. **Concise** - Each section should be 1-2 sentences max
720- 4. **Actionable** - Focus on what can be done, not just what's wrong
721- 5. **Group related issues** - Combine similar problems into one item
722-
723- ### Example:
724-
725- ```markdown
726- ## Modification Plan
713+ ### Key Requirements:
714+
715+ 1. **Maximum 5 items** - Focus on most critical errors (prioritize ERROR > WARNING)
716+ 2. **Must be specific** - Each item must mention specific file names using [FileName](filepath) format
717+ 3. **Priority**: CRITICAL (ERROR) | HIGH (WARNING) | MEDIUM (Code quality)
718+ 4. **Actionable** - "How" should provide concrete methods, not vague statements
719+ 5. **Based on Lint** - Must reference actual errors from Lint results above
720+ 6. **Use Plan format** - Ordered list for main items, unordered list for details
721+ 7. **File links** - Use [FileName](filepath) format for file references
722+
723+ ### Good Examples:
724+
725+ ```plan
726+ 1. Null Safety Issues - CRITICAL
727+ - [ ] Fix [UserService.kt](src/main/kotlin/UserService.kt) line 45: user parameter not null-checked
728+ - [ ] Prevents NullPointerException (detekt UseCheckOrError rule)
729+ - [ ] Add requireNotNull(user) at line 45 or use safe call operator ?.
730+
731+ 2. Exception Handling - CRITICAL
732+ - [ ] Fix [DatabaseHelper.kt](src/main/kotlin/DatabaseHelper.kt) line 62: catching overly generic Exception
733+ - [ ] May hide specific errors (detekt TooGenericExceptionCaught)
734+ - [ ] Catch specific exceptions like SQLException or IOException instead
735+
736+ 3. Resource Management - HIGH
737+ - [ ] Fix [FileProcessor.kt](src/main/kotlin/FileProcessor.kt) line 78: stream not closed
738+ - [ ] Potential memory leak (detekt UnclosedResource)
739+ - [ ] Use use() block or try-with-resources pattern
740+ ```
727741
728- ### 1. Null Safety Issues - 🔴 CRITICAL
729- **What**: Add null checks for user parameters in 3 methods
730- **Why**: Prevents NullPointerException at runtime
731- **How**: Add `requireNotNull()` or safe call operators before usage
742+ ### Bad Examples (DO NOT do this):
732743
733- ### 2. Resource Management - ⚠️ HIGH
734- **What**: Close database connections and file streams
735- **Why**: Prevents memory leaks and resource exhaustion
736- **How**: Use `use {}` blocks or add explicit `close()` calls in finally blocks
744+ ```plan
745+ ❌ 1. Code Quality Improvement - HIGH
746+ ❌ - [ ] Optimize code structure
747+ ❌ - [ ] Improve maintainability
748+ ❌ - [ ] Refactor code
737749
738- ### 3. Code Style Consistency - 📝 MEDIUM
739- **What**: Fix naming conventions for 5 variables
740- **Why**: Improves code readability and follows Kotlin conventions
741- **How**: Rename variables to camelCase format
750+ (Problems: No file name, no specific error, not actionable, no file links)
742751```
743752
744- **CRITICAL RULES**:
745- - ✅ Maximum 5 items
746- - ✅ Each item has What/Why/How structure
747- - ✅ Use priority emojis (🔴/⚠️/📝)
748- - ✅ Keep each section to 1-2 sentences
749- - ❌ DO NOT list every single issue
750- - ❌ DO NOT provide code examples
751- - ❌ DO NOT use any tools
753+ **STRICT RULES**:
754+ - ✅ Maximum 5 items (no more)
755+ - ✅ Use `plan` code block format
756+ - ✅ Each item must include [FileName](filepath) with actual file path
757+ - ✅ Must reference actual errors from Lint results
758+ - ✅ Priority based on ERROR/WARNING severity
759+ - ✅ Merge multiple similar errors in same file into one item
760+ - ✅ Use nested structure: ordered list for items, unordered list for details
761+ - ❌ DO NOT use vague descriptions (like "optimize code")
762+ - ❌ DO NOT provide code examples in the plan
763+ - ❌ DO NOT use tools
764+ - ❌ DO NOT use emojis in the plan content
752765""" .trimIndent()
753766
754767 val ZH = """
755768# 修改计划生成
756769
757- 基于代码分析 ,提供**极简、结构化的修改计划** 。
770+ 基于代码分析和 Lint 结果 ,提供**具体、可执行的修改计划**,使用 Plan 格式 。
758771
759772## 分析上下文
760773
@@ -766,47 +779,75 @@ ${'$'}{lintResults}
766779
767780## 你的任务
768781
769- 生成**极简 **修改计划,**最多 3 项**,每项一句话 。
782+ 生成**具体 **修改计划,**最多 5 项**,使用 Plan markdown 格式和嵌套结构 。
770783
771784### 必需格式:
772785
773- ```markdown
774- ### 1. {问题类别} - {优先级}
775- **需要改什么**: {10字以内描述}
776- **为什么改**: {10-15字原因}
777- **怎么改**: {10-15字方法}
786+ 你的输出必须在 `plan` 代码块中:
787+
788+ ```plan
789+ 1. {问题类别} - {优先级}
790+ - [ ] 修复 [文件名](文件路径) 第 {X} 行: {具体问题}
791+ - [ ] {为什么需要修复}
792+ - [ ] {如何修复: 具体操作}
778793
779- ### 2. {问题类别} - {优先级}
780- **需要改什么** : {简短描述 }
781- **为什么改**: {简短原因 }
782- **怎么改**: {简短方法 }
794+ 2. {问题类别} - {优先级}
795+ - [ ] 修复 [文件名](文件路径) 第 {Y} 行 : {具体问题 }
796+ - [ ] {原因 }
797+ - [ ] {方法 }
783798```
784799
785800### 关键要求:
786801
787- 1. **最多 3 项** - 只聚焦最关键的问题
788- 2. **优先级**: 高 | 中等
789- 3. **极简** - 每个字段控制在 10-15 字以内
790- 4. **合并问题** - 将同类问题合并为一项
791- 5. **优先级排序** - 按"高→中等"排序
802+ 1. **最多 5 项** - 聚焦最关键的错误(优先 ERROR > WARNING)
803+ 2. **必须具体** - 每项必须使用 [文件名](文件路径) 格式提到具体文件
804+ 3. **优先级**: 关键(ERROR)| 高(WARNING)| 中等(代码质量)
805+ 4. **可执行** - "如何修复"要提供具体方法,不要泛泛而谈
806+ 5. **基于 Lint** - 必须引用上面 Lint 结果中的实际错误
807+ 6. **使用 Plan 格式** - 有序列表用于主要项,无序列表用于详情
808+ 7. **文件链接** - 使用 [文件名](文件路径) 格式引用文件
809+
810+ ### 好的示例:
811+
812+ ```plan
813+ 1. 空安全问题 - 关键
814+ - [ ] 修复 [UserService.kt](src/main/kotlin/UserService.kt) 第 45 行: user 参数未做空检查
815+ - [ ] 防止 NullPointerException (detekt UseCheckOrError 规则)
816+ - [ ] 在第 45 行添加 requireNotNull(user) 或使用安全调用操作符 ?.
817+
818+ 2. 异常处理 - 关键
819+ - [ ] 修复 [DatabaseHelper.kt](src/main/kotlin/DatabaseHelper.kt) 第 62 行: 捕获了过于泛化的 Exception
820+ - [ ] 可能掩盖具体错误 (detekt TooGenericExceptionCaught)
821+ - [ ] 改为捕获具体异常类型如 SQLException 或 IOException
822+
823+ 3. 资源管理 - 高
824+ - [ ] 修复 [FileProcessor.kt](src/main/kotlin/FileProcessor.kt) 第 78 行: 流未关闭
825+ - [ ] 潜在内存泄漏 (detekt UnclosedResource)
826+ - [ ] 使用 use() 块或 try-with-resources 模式
827+ ```
792828
793- ### 示例 :
829+ ### 坏的示例(不要这样) :
794830
795- ```markdown
796- ### 1. 测试覆盖完善 - 高
797- **需要改什么**: 为 JsoupDocumentParser 添加更多边界测试
798- **为什么改**: 确保 HTML 解析器各种异常输入的稳定性
799- **怎么改**: 添加空内容、无效 HTML 和特殊字符的测试用例
831+ ```plan
832+ ❌ 1. 代码质量提升 - 高
833+ ❌ - [ ] 优化代码结构
834+ ❌ - [ ] 提高可维护性
835+ ❌ - [ ] 重构代码
836+
837+ (问题:没有文件名、没有具体错误、无法执行、没有文件链接)
800838```
801839
802840**严格规则**:
803- - ✅ 最多 3 项(不能更多)
804- - ✅ 每个字段 10-15 字以内
805- - ✅ 使用优先级文字(高/中等)
806- - ✅ 合并同类问题
807- - ❌ 不要列举所有问题
808- - ❌ 不要使用代码示例
841+ - ✅ 最多 5 项(不能更多)
842+ - ✅ 使用 `plan` 代码块格式
843+ - ✅ 每项必须包含 [文件名](文件路径) 和实际文件路径
844+ - ✅ 必须引用 Lint 结果中的实际错误
845+ - ✅ 优先级根据 ERROR/WARNING 严重性确定
846+ - ✅ 合并同一文件的多个相似错误到一项
847+ - ✅ 使用嵌套结构:有序列表用于项,无序列表用于详情
848+ - ❌ 不要使用泛泛的描述(如"优化代码")
849+ - ❌ 不要在计划中提供代码示例
809850- ❌ 不要使用工具
810- - ❌ 不要使用 emoji
851+ - ❌ 不要在计划内容中使用 emoji
811852""" .trimIndent()
812853}
0 commit comments