auto-coder 0.1.369__py3-none-any.whl → 0.1.371__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of auto-coder might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.369
3
+ Version: 0.1.371
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -14,7 +14,7 @@ autocoder/command_parser.py,sha256=fx1g9E6GaM273lGTcJqaFQ-hoksS_Ik2glBMnVltPCE,1
14
14
  autocoder/lang.py,sha256=PFtATuOhHRnfpqHQkXr6p4C893JvpsgwTMif3l-GEi0,14321
15
15
  autocoder/models.py,sha256=Gu50IATQtZtgEir1PpCfwgH6o4ygw6XqqbQRj3lx5dU,13798
16
16
  autocoder/run_context.py,sha256=IUfSO6_gp2Wt1blFWAmOpN0b0nDrTTk4LmtCYUBIoro,1643
17
- autocoder/version.py,sha256=JeehxQcnVWSrItvPu8R4Gmgu-fvSBfT0YK_GQNxNeqY,25
17
+ autocoder/version.py,sha256=TF3nTF1dVsGKrBxxmicuLEHtRY_sMAMci7qfrDHNAPw,25
18
18
  autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  autocoder/agent/agentic_edit.py,sha256=XsfePZ-t6M-uBSdG1VLZXk1goqXk2HPeJ_A8IYyBuWQ,58896
20
20
  autocoder/agent/agentic_edit_types.py,sha256=oFcDd_cxJ2yH9Ed1uTpD3BipudgoIEWDMPb5pAkq4gI,3288
@@ -22,7 +22,7 @@ autocoder/agent/agentic_filter.py,sha256=zlInIRhawKIYTJjCiJBWqPCOV5UtMbh5VnvszfT
22
22
  autocoder/agent/auto_demand_organizer.py,sha256=URAq0gSEiHeV_W4zwhOI_83kHz0Ryfj1gcfh5jwCv_w,6501
23
23
  autocoder/agent/auto_filegroup.py,sha256=pBsAkBcpFTff-9L5OwI8xhf2xPKpl-aZwz-skF2B6dc,6296
24
24
  autocoder/agent/auto_guess_query.py,sha256=rDSdhpPHcOGE5MuDXvIrhCXAPR4ARS1LqpyoLsx2Jhw,11374
25
- autocoder/agent/auto_learn.py,sha256=yZTapSm3kQ9zHnGknDUWGju6_Q9GE7EY0qfDJgV_Fls,23281
25
+ autocoder/agent/auto_learn.py,sha256=EMSbIVo2DK9Lp4sxFtpK4HRxqclGVKHYex51SG7SJpM,13942
26
26
  autocoder/agent/auto_learn_from_commit.py,sha256=edD4GQJyO2qvVnTKyldeswWoNeKe1Aaua6ieJzlGlFI,10662
27
27
  autocoder/agent/auto_review_commit.py,sha256=1z9FOUDPZTWnrPmJ-TwUlXLOTDPmRcAlYqXbUj1pi08,11015
28
28
  autocoder/agent/auto_tool.py,sha256=DBzip-P_T6ZtT2eHexPcusmKYD0h7ufzp7TLwXAY10E,11554
@@ -192,7 +192,7 @@ autocoder/common/v2/code_editblock_manager.py,sha256=DMwJw-FAM6VyaBQV3p4xespHpgZ
192
192
  autocoder/common/v2/code_manager.py,sha256=C403bS-f6urixwitlKHcml-J03hci-UyNwHJOqBiY6Q,9182
193
193
  autocoder/common/v2/code_strict_diff_manager.py,sha256=Bys7tFAq4G03R1zUZuxrszBTvP4QB96jIw2y5BDLyRM,9424
194
194
  autocoder/common/v2/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
195
- autocoder/common/v2/agent/agentic_edit.py,sha256=IqOku4jEWnmc_5Tn984t84TMDqIzIFCp6UhOVF3cY8k,116071
195
+ autocoder/common/v2/agent/agentic_edit.py,sha256=JyU1-D-ZspfC_ue7rt5sTm97xFP1wzJ-BSn5twHz7sM,116262
196
196
  autocoder/common/v2/agent/agentic_edit_conversation.py,sha256=pFgWPWHKhZ4J9EcFmIdiGsrSolTZuYcH1qkgKdD8nwk,7726
197
197
  autocoder/common/v2/agent/agentic_edit_types.py,sha256=nEcZc2MOZ_fQLaJX-YDha_x9Iim22ao4tykYM2iIy4k,4908
198
198
  autocoder/common/v2/agent/agentic_tool_display.py,sha256=-a-JTQLc4q03E_rdIILKMI0B6DHN-5gcGlrqq-mBYK4,7239
@@ -359,9 +359,9 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
359
  autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
360
  autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=t902pKxQ5xM7zgIHiAOsTPLwxhE6VuvXAqPy751S7fg,14096
361
361
  autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
- auto_coder-0.1.369.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
363
- auto_coder-0.1.369.dist-info/METADATA,sha256=4KZiRdKwKx1Zekk7MhVmWVSMpFmv6iwcEjgt7PuovUo,2775
364
- auto_coder-0.1.369.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
365
- auto_coder-0.1.369.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
366
- auto_coder-0.1.369.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
367
- auto_coder-0.1.369.dist-info/RECORD,,
362
+ auto_coder-0.1.371.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
363
+ auto_coder-0.1.371.dist-info/METADATA,sha256=2joes7nDokrZ64EfIp34syT49UzE2VrHucIO3L1cXYc,2775
364
+ auto_coder-0.1.371.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
365
+ auto_coder-0.1.371.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
366
+ auto_coder-0.1.371.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
367
+ auto_coder-0.1.371.dist-info/RECORD,,
@@ -33,17 +33,8 @@ class AutoLearn:
33
33
  querie_with_urls_and_changes: List[Tuple[str, List[str], Dict[str, Tuple[str, str]]]],
34
34
  new_query:str,
35
35
  ) -> str:
36
- """
37
- 作为高级软件工程师,请对提供的代码提交变更进行深入分析,提取具有通用价值的功能模式和设计模式,转化为可在其他项目中复用的代码规则(rules)。
38
-
39
- ## 任务目标
40
- - 识别代码变更中具有普遍应用价值的功能点和模式
41
- - 将这些功能点提炼为结构化规则,便于在其他项目中快速复用
42
- - 生成清晰的使用示例,包含完整依赖和调用方式
43
- - 这些规则将被存储在项目的 {{ project_root }}/.autocoderrules 目录,供后续自动化代码生成使用
44
-
45
- ## 分析对象
46
- 下面是本次提交的代码变更:
36
+ """
37
+ 下面是用户一次提交的代码变更:
47
38
  <changes>
48
39
  {% for query,urls,changes in querie_with_urls_and_changes %}
49
40
  ## 原始的任务需求
@@ -69,360 +60,124 @@ class AutoLearn:
69
60
  {% endfor %}
70
61
  {% endfor %}
71
62
  </changes>
63
+
72
64
 
73
- {% if index_file_content %}
74
- ## 现有索引内容
75
- index.md 当前内容:
76
- <files>
77
- <file>
78
- ##File:
65
+ 请对根据上面的代码变更进行深入分析,提取具有通用价值的功能模式和设计模式,转化为可在其他项目中复用的代码规则(rules)。
66
+
67
+ - 识别代码变更中具有普遍应用价值的功能点和模式
68
+ - 将这些功能点提炼为结构化规则,便于在其他项目中快速复用
69
+ - 生成清晰的使用示例,包含完整依赖和调用方式
70
+ - 这些规则将被存储在项目的 {{ rules_path }} 目录,供后续自动化代码生成使用
71
+ - 更新 {{rules_index_path}} 文件,确保改文件有新增文件的描述信息
72
+
73
+ 当前 {{rules_index_path}} 文件内容:
74
+ {% if index_file_content %}
79
75
  {{ index_file_content }}
80
- </file>
81
- </files>
76
+ {% else %}
77
+ <为空>
82
78
  {% endif %}
83
-
84
- ## 用户需求
85
- {{ new_query }}
86
-
87
- ## 生成或者更新的规则文件结构
88
-
89
- ---
90
- description: [简明描述规则的功能,20字以内]
91
- globs: [匹配应用此规则的文件路径,如"src/services/*.py"]
92
- alwaysApply: [是否总是应用,通常为false]
93
- ---
94
-
95
- # [规则主标题]
96
-
97
- ## 简要说明
98
- [该规则的功能、适用场景和价值,100字以内]
99
-
100
- ## 典型用法
101
- ```python
102
- # 完整的代码示例,包含:
103
- # 1. 必要的import语句
104
- # 2. 类/函数定义
105
- # 3. 参数说明
106
- # 4. 调用方式
107
- # 5. 关键注释
108
- ```
109
-
110
- ## 依赖说明
111
- - [必要的依赖库及版本]
112
- - [环境要求]
113
- - [初始化流程(如有)]
114
-
115
- ## 学习来源
116
- [从哪个提交变更的哪部分代码中提取的该功能点]
117
-
118
- ## 生成或者更新的规则文件示例
119
-
120
- ---
121
- description: Git提交分析工具
122
- globs: "src/utils/git_analyzer.py"
123
- alwaysApply: false
124
- ---
125
-
126
- # Git提交分析工具
127
-
128
- ## 简要说明
129
- 提供从Git仓库中获取提交变更并分析差异的工具函数,支持首次提交和普通提交的差异获取,适用于代码审查、变更追踪和自动化分析场景。
130
-
131
- ## 典型用法
132
- ```python
133
- import git
134
- from typing import Dict, Tuple, List, Optional
135
-
136
- def get_commit_changes(repo_path: str, commit_id: str) -> Dict[str, Tuple[Optional[str], Optional[str]]]:
137
- '''
138
- 获取指定commit的文件变更内容
139
-
140
- Args:
141
- repo_path: Git仓库路径
142
- commit_id: 提交ID
143
-
144
- Returns:
145
- Dict[str, Tuple[Optional[str], Optional[str]]]: 文件路径到(变更前内容,变更后内容)的映射
146
- '''
147
- changes = {}
148
- try:
149
- repo = git.Repo(repo_path)
150
- commit = repo.commit(commit_id)
151
-
152
- # 检查是否是首次提交(没有父提交)
153
- if not commit.parents:
154
- # 首次提交,获取所有文件
155
- for item in commit.tree.traverse():
156
- if item.type == 'blob': # 只处理文件,不处理目录
157
- file_path = item.path
158
- # 首次提交前没有内容
159
- before_content = None
160
- # 获取提交后的内容
161
- after_content = repo.git.show(f"{commit.hexsha}:{file_path}")
162
- changes[file_path] = (before_content, after_content)
163
- else:
164
- # 获取parent commit
165
- parent = commit.parents[0]
166
- # 获取变更的文件列表
167
- for diff_item in parent.diff(commit):
168
- file_path = diff_item.a_path if diff_item.a_path else diff_item.b_path
169
-
170
- # 获取变更前内容
171
- before_content = None
172
- try:
173
- if diff_item.a_blob:
174
- before_content = repo.git.show(f"{parent.hexsha}:{file_path}")
175
- except git.exc.GitCommandError:
176
- pass # 文件可能是新增的
177
-
178
- # 获取变更后内容
179
- after_content = None
180
- try:
181
- if diff_item.b_blob:
182
- after_content = repo.git.show(f"{commit.hexsha}:{file_path}")
183
- except git.exc.GitCommandError:
184
- pass # 文件可能被删除
185
-
186
- changes[file_path] = (before_content, after_content)
187
-
188
- return changes
189
- except Exception as e:
190
- print(f"获取提交变更时出错: {str(e)}")
191
- return {}
192
- ```
193
-
194
- ## 依赖说明
195
- - GitPython>=3.1.0
196
- - Python>=3.7
197
-
198
- ## 学习来源
199
- 从代码提交变更中提取的Git仓库差异分析功能
200
-
201
- ## 索引文件更新说明
202
-
203
- 除了生成规则文件外,请务必更新index.md索引文件,记录所有规则及其作用。如果 index.md 当前内容为空,请按如下格式创建:
204
-
205
- # Rules索引
206
-
207
- 本文档记录项目中所有可用的代码规则(rules)及其用途。
208
-
209
- ## [规则文件路径]
210
- [规则文件的主要功能和适用场景简述]
211
-
212
- ## 评价标准
213
- - 提取的功能点必须具备独立价值,能在其他项目中实际复用
214
- - 代码示例必须完整、可执行,包含所有必要组件
215
- - 文档结构清晰,遵循规定格式
216
- - 依赖说明明确具体,便于用户快速配置环境
217
-
218
- 请根据要求生成或者更新规则文件(markdown文件),并将规则文件存储在项目的 {{ project_root }}/.autocoderrules 目录,供后续自动化代码生成使用。
79
+ - {{ new_query }}
80
+
81
+
82
+ 最后,新生成的文件格式要是这种形态的:
83
+
84
+ <example_rules>
85
+ ---
86
+ description: [简明描述规则的功能,20字以内]
87
+ globs: [匹配应用此规则的文件路径,如"src/services/*.py"]
88
+ alwaysApply: [是否总是应用,通常为false]
89
+ ---
90
+
91
+ # [规则主标题]
92
+
93
+ ## 简要说明
94
+ [该规则的功能、适用场景和价值,100字以内]
95
+
96
+ ## 典型用法
97
+ ```python
98
+ # 完整的代码示例,包含:
99
+ # 1. 必要的import语句
100
+ # 2. 类/函数定义
101
+ # 3. 参数说明
102
+ # 4. 调用方式
103
+ # 5. 关键注释
104
+ ```
105
+
106
+ ## 依赖说明
107
+ - [必要的依赖库及版本]
108
+ - [环境要求]
109
+ - [初始化流程(如有)]
110
+
111
+ ## 学习来源
112
+ [从哪个提交变更的哪部分代码中提取的该功能点]
113
+ </example_rules>
219
114
  """
220
115
  return {
221
116
  "project_root": os.path.abspath(self.args.source_dir),
222
- "index_file_content": self._get_index_file_content()
117
+ "index_file_content": self._get_index_file_content(),
118
+ "rules_path": os.path.join(os.path.abspath(self.args.source_dir), ".autocoderrules"),
119
+ "rules_index_path": os.path.join(os.path.abspath(self.args.source_dir), ".autocoderrules", "index.md")
223
120
  }
224
121
 
225
122
  @byzerllm.prompt()
226
123
  def analyze_modules(self, sources: SourceCodeList, query: str) -> str:
227
124
  """
228
- 作为高级软件工程师,请对提供的模块代码进行深入分析,提取具有通用价值的功能模式和设计模式,转化为可在其他项目中复用的代码规则(rules)。
229
-
230
- ## 任务目标
231
- - 识别代码中具有普遍应用价值的功能点和模式
232
- - 将这些功能点提炼为结构化规则,便于在其他项目中快速复用
233
- - 生成清晰的使用示例,包含完整依赖和调用方式
234
- - 这些规则将被存储在项目的 {{ project_root }}/.autocoderrules 目录,供后续自动化代码生成使用
235
-
236
- 项目根目录: {{ project_root }}
237
-
238
- ## 分析对象
239
- {% if sources.sources %}
240
- 分析目标文件:
241
- {% for source in sources.sources %}
242
- - {{ source.module_name }}
243
- {% endfor %}
244
- {% else %}
245
- 前面提供的文件。
246
- {% endif %}
247
-
248
- {% if sources.sources %}
249
- ## 源代码内容
125
+ 下面是用户提供的需要抽取规则的代码:
250
126
  <files>
251
127
  {% for source in sources.sources %}
252
128
  ##File: {{ source.module_name }}
253
129
  {{ source.source_code }}
254
130
  {% endfor %}
255
131
  </files>
256
- {% endif %}
257
-
258
- {% if index_file_content %}
259
- ## 现有索引内容
260
- index.md 当前内容:
261
- <files>
262
- <file>
263
- ##File:
264
- {{ index_file_content }}
265
- </file>
266
- </files>
267
- {% endif %}
268
132
 
269
- ## 用户需求
270
- {{ query }}
271
-
272
- ## 生成或者更新的规则文件结构
133
+ 请对对上面的代码进行深入分析,提取具有通用价值的功能模式和设计模式,转化为可在其他项目中复用的代码规则(rules)。
273
134
 
274
- ---
275
- description: [简明描述规则的功能,20字以内]
276
- globs: [匹配应用此规则的文件路径,如"src/services/*.py"]
277
- alwaysApply: [是否总是应用,通常为false]
278
- ---
279
-
280
- # [规则主标题]
281
-
282
- ## 简要说明
283
- [该规则的功能、适用场景和价值,100字以内]
284
-
285
- ## 典型用法
286
- ```python
287
- # 完整的代码示例,包含:
288
- # 1. 必要的import语句
289
- # 2. 类/函数定义
290
- # 3. 参数说明
291
- # 4. 调用方式
292
- # 5. 关键注释
293
-
294
- ## 依赖说明
295
- - [必要的依赖库及版本]
296
- - [环境要求]
297
- - [初始化流程(如有)]
298
-
299
- ## 学习来源
300
- [从哪个模块的哪部分代码中提取的该功能点]
301
- </markdown>
302
-
303
- ## 生成或者更新的规则文件示例
135
+ - 识别代码变更中具有普遍应用价值的功能点和模式
136
+ - 将这些功能点提炼为结构化规则,便于在其他项目中快速复用
137
+ - 生成清晰的使用示例,包含完整依赖和调用方式
138
+ - 这些规则将被存储在项目的 {{ rules_path }} 目录,供后续自动化代码生成使用
139
+ - 更新 {{rules_index_path}} 文件,确保改文件有新增文件的描述信息
304
140
 
305
- ---
306
- description: RPC服务模板
307
- globs: "src/services/rpc_service.py"
308
- alwaysApply: false
309
- ---
310
-
311
- # RPC服务快速实现模板
312
-
313
- ## 简要说明
314
- 提供gRPC服务端与客户端的标准实现模板,包含服务定义、请求处理、错误处理和客户端调用。适用于需要高性能RPC通信的微服务架构。
315
-
316
- ## 典型用法
317
- ```python
318
- # 服务端实现
319
- import grpc
320
- from concurrent import futures
321
- import logging
322
- import time
323
- from typing import Dict, Any
324
-
325
- import service_pb2
326
- import service_pb2_grpc
327
-
328
- class ServiceImplementation(service_pb2_grpc.MyServiceServicer):
329
- def __init__(self, config: Dict[str, Any] = None):
330
- self.config = config or {}
331
- logging.info("RPC服务初始化完成")
332
-
333
- def ProcessRequest(self, request, context):
334
- try:
335
- # 业务逻辑处理
336
- result = self._process_business_logic(request)
337
-
338
- # 构建响应
339
- return service_pb2.Response(
340
- status=200,
341
- message="处理成功",
342
- data=result
343
- )
344
- except Exception as e:
345
- logging.error(f"处理请求时发生错误: {str(e)}")
346
- context.set_code(grpc.StatusCode.INTERNAL)
347
- context.set_details(f"服务器内部错误: {str(e)}")
348
- return service_pb2.Response(
349
- status=500,
350
- message=f"处理失败: {str(e)}",
351
- data={}
352
- )
353
-
354
- def _process_business_logic(self, request):
355
- # 实际业务逻辑处理
356
- return {"result": request.param1 + request.param2}
357
-
358
- def serve(port=50051, max_workers=10):
359
- server = grpc.server(futures.ThreadPoolExecutor(max_workers=max_workers))
360
- service_pb2_grpc.add_MyServiceServicer_to_server(
361
- ServiceImplementation(), server
362
- )
363
- server.add_insecure_port(f'[::]:{port}')
364
- server.start()
365
- logging.info(f"服务已启动,监听端口: {port}")
366
-
367
- try:
368
- while True:
369
- time.sleep(86400) # 一天
370
- except KeyboardInterrupt:
371
- server.stop(0)
372
- logging.info("服务已停止")
373
-
374
- if __name__ == '__main__':
375
- logging.basicConfig(level=logging.INFO)
376
- serve()
377
- ```
378
-
379
- ## 依赖说明
380
- - 需要安装 grpcio>=1.44.0 和 grpcio-tools>=1.44.0
381
- - 需要预先定义proto文件并生成对应Python代码:
382
- ```bash
383
- python -m grpc_tools.protoc -I./protos --python_out=. --grpc_python_out=. ./protos/service.proto
384
- ```
385
- - 示例proto文件结构:
386
- ```protobuf
387
- syntax = "proto3";
388
-
389
- service MyService {
390
- rpc ProcessRequest (Request) returns (Response) {}
391
- }
392
-
393
- message Request {
394
- int32 param1 = 1;
395
- int32 param2 = 2;
396
- }
397
-
398
- message Response {
399
- int32 status = 1;
400
- string message = 2;
401
- map<string, string> data = 3;
402
- }
403
- ```
404
-
405
- ## 学习来源
406
- 从src/services/rpc_service.py模块中的Server类和RequestHandler实现提取
407
-
408
- ## 索引文件更新说明
409
-
410
- 除了生成规则文件外,请务必更新index.md索引文件,记录所有规则及其作用。如果 index.md 当前内容为空,请按如下格式创建:
411
-
412
- # Rules索引
413
-
414
- 本文档记录项目中所有可用的代码规则(rules)及其用途。
415
-
416
- ## [规则文件路径]
417
- [规则文件的主要功能和适用场景简述]
418
-
419
- ## 评价标准
420
- - 提取的功能点必须具备独立价值,能在其他项目中实际复用
421
- - 代码示例必须完整、可执行,包含所有必要组件
422
- - 文档结构清晰,遵循规定格式
423
- - 依赖说明明确具体,便于用户快速配置环境
424
-
425
- 请根据要求生成或者更新规则文件(markdown文件),并将规则文件存储在项目的 {{ project_root }}/.autocoderrules 目录,供后续自动化代码生成使用。
141
+ 当前 {{rules_index_path}} 文件内容:
142
+ {% if index_file_content %}
143
+ {{ index_file_content }}
144
+ {% else %}
145
+ <为空>
146
+ {% endif %}
147
+ - {{ query }}
148
+
149
+ 最后,新生成的文件格式要是这种形态的:
150
+
151
+ <example_rules>
152
+ ---
153
+ description: [简明描述规则的功能,20字以内]
154
+ globs: [匹配应用此规则的文件路径,如"src/services/*.py"]
155
+ alwaysApply: [是否总是应用,通常为false]
156
+ ---
157
+
158
+ # [规则主标题]
159
+
160
+ ## 简要说明
161
+ [该规则的功能、适用场景和价值,100字以内]
162
+
163
+ ## 典型用法
164
+ ```python
165
+ # 完整的代码示例,包含:
166
+ # 1. 必要的import语句
167
+ # 2. 类/函数定义
168
+ # 3. 参数说明
169
+ # 4. 调用方式
170
+ # 5. 关键注释
171
+ ```
172
+
173
+ ## 依赖说明
174
+ - [必要的依赖库及版本]
175
+ - [环境要求]
176
+ - [初始化流程(如有)]
177
+
178
+ ## 学习来源
179
+ [从哪个提交变更的哪部分代码中提取的该功能点]
180
+ </example_rules>
426
181
  """
427
182
 
428
183
  # 获取索引文件内容
@@ -430,7 +185,9 @@ class AutoLearn:
430
185
 
431
186
  return {
432
187
  "project_root": os.path.abspath(self.args.source_dir),
433
- "index_file_content": index_file_content
188
+ "index_file_content": index_file_content,
189
+ "rules_path": os.path.join(os.path.abspath(self.args.source_dir), ".autocoderrules"),
190
+ "rules_index_path": os.path.join(os.path.abspath(self.args.source_dir), ".autocoderrules", "index.md")
434
191
  }
435
192
 
436
193
  def get_commit_changes(self, commit_id: str) -> Tuple[List[Tuple[str, List[str], Dict[str, Tuple[str, str]]]], Optional[str]]:
@@ -849,7 +849,9 @@ class AgenticEdit:
849
849
  f"Initial conversation history size: {len(conversations)}, tokens: {current_tokens}")
850
850
 
851
851
  iteration_count = 0
852
- tool_executed = False
852
+ tool_executed = False
853
+ completion_event_already_yielded = False
854
+
853
855
  while True:
854
856
  iteration_count += 1
855
857
  logger.info(f"Starting LLM interaction cycle #{iteration_count}")
@@ -857,10 +859,12 @@ class AgenticEdit:
857
859
  last_message = conversations[-1]
858
860
  if last_message["role"] == "assistant":
859
861
  logger.info(f"Last message is assistant, skipping LLM interaction cycle")
860
- yield CompletionEvent(completion=AttemptCompletionTool(
861
- result=last_message["content"],
862
- command=""
863
- ), completion_xml="")
862
+ if not completion_event_already_yielded:
863
+ yield CompletionEvent(completion=AttemptCompletionTool(
864
+ result=last_message["content"],
865
+ command=""
866
+ ), completion_xml="")
867
+ completion_event_already_yielded = True
864
868
  break
865
869
  logger.info(
866
870
  f"Starting LLM interaction cycle. History size: {len(conversations)}")
autocoder/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- __version__ = "0.1.369"
2
+ __version__ = "0.1.371"