auto-coder 0.1.399__py3-none-any.whl → 0.1.400__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.
- {auto_coder-0.1.399.dist-info → auto_coder-0.1.400.dist-info}/METADATA +1 -1
- {auto_coder-0.1.399.dist-info → auto_coder-0.1.400.dist-info}/RECORD +38 -19
- autocoder/auto_coder_runner.py +2 -1
- autocoder/common/ac_style_command_parser/parser.py +27 -12
- autocoder/common/auto_coder_lang.py +78 -0
- autocoder/common/command_completer_v2.py +1 -1
- autocoder/common/pull_requests/__init__.py +256 -0
- autocoder/common/pull_requests/base_provider.py +191 -0
- autocoder/common/pull_requests/config.py +66 -0
- autocoder/common/pull_requests/example.py +1 -0
- autocoder/common/pull_requests/exceptions.py +46 -0
- autocoder/common/pull_requests/manager.py +201 -0
- autocoder/common/pull_requests/models.py +164 -0
- autocoder/common/pull_requests/providers/__init__.py +23 -0
- autocoder/common/pull_requests/providers/gitcode_provider.py +19 -0
- autocoder/common/pull_requests/providers/gitee_provider.py +20 -0
- autocoder/common/pull_requests/providers/github_provider.py +214 -0
- autocoder/common/pull_requests/providers/gitlab_provider.py +29 -0
- autocoder/common/pull_requests/test_module.py +1 -0
- autocoder/common/pull_requests/utils.py +344 -0
- autocoder/common/tokens/__init__.py +62 -0
- autocoder/common/tokens/counter.py +211 -0
- autocoder/common/tokens/file_detector.py +105 -0
- autocoder/common/tokens/filters.py +111 -0
- autocoder/common/tokens/models.py +28 -0
- autocoder/common/v2/agent/agentic_edit.py +182 -68
- autocoder/common/v2/agent/agentic_edit_types.py +1 -0
- autocoder/sdk/cli/handlers.py +2 -1
- autocoder/sdk/cli/main.py +4 -2
- autocoder/sdk/cli/options.py +4 -3
- autocoder/sdk/core/auto_coder_core.py +14 -1
- autocoder/sdk/core/bridge.py +3 -0
- autocoder/sdk/models/options.py +8 -6
- autocoder/version.py +1 -1
- {auto_coder-0.1.399.dist-info → auto_coder-0.1.400.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.399.dist-info → auto_coder-0.1.400.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.399.dist-info → auto_coder-0.1.400.dist-info}/licenses/LICENSE +0 -0
- {auto_coder-0.1.399.dist-info → auto_coder-0.1.400.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
auto_coder-0.1.
|
|
1
|
+
auto_coder-0.1.400.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
2
2
|
autocoder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
autocoder/auto_coder.py,sha256=giCjH2IJhNicfvx45LxBcOakj6LnJKi7S-GAQT3QenA,46262
|
|
4
4
|
autocoder/auto_coder_rag.py,sha256=nniuWo2DCRtttAm59ef8C_9xFZzD5nKi3gSSPJMJHbM,43696
|
|
5
|
-
autocoder/auto_coder_runner.py,sha256=
|
|
5
|
+
autocoder/auto_coder_runner.py,sha256=rjzZgBYIJVY2NneCSaTdt9KnSxvri9utbWVBP1WDLK4,134995
|
|
6
6
|
autocoder/auto_coder_server.py,sha256=bLORGEclcVdbBVfM140JCI8WtdrU0jbgqdJIVVupiEU,20578
|
|
7
7
|
autocoder/benchmark.py,sha256=Ypomkdzd1T3GE6dRICY3Hj547dZ6_inqJbBJIp5QMco,4423
|
|
8
8
|
autocoder/chat_auto_coder.py,sha256=i858TLkWKKnEmHfrXH25Tl4oPkv4ywc6fd_vQoUoVNE,27087
|
|
@@ -12,7 +12,7 @@ autocoder/lang.py,sha256=PFtATuOhHRnfpqHQkXr6p4C893JvpsgwTMif3l-GEi0,14321
|
|
|
12
12
|
autocoder/models.py,sha256=pD5u6gcMKRwWaLxeVin18g25k-ERyeHOFsRpOgO_Ae0,13788
|
|
13
13
|
autocoder/rags.py,sha256=3hn8cUUdncE7FABV9RPNLxhRzLnIxC8IPcBXnEvE4g0,11955
|
|
14
14
|
autocoder/run_context.py,sha256=_IFy1OdnLasQvbDhlf1SUfQKJr4BPCaiRubldKFnVDo,1660
|
|
15
|
-
autocoder/version.py,sha256=
|
|
15
|
+
autocoder/version.py,sha256=2DCGpt_wtDWMwJr9cUbY3wT_m5uM3ZIaUgtd9-6kid0,25
|
|
16
16
|
autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
autocoder/agent/agentic_filter.py,sha256=zlInIRhawKIYTJjCiJBWqPCOV5UtMbh5VnvszfTy2vo,39824
|
|
18
18
|
autocoder/agent/auto_demand_organizer.py,sha256=URAq0gSEiHeV_W4zwhOI_83kHz0Ryfj1gcfh5jwCv_w,6501
|
|
@@ -73,7 +73,7 @@ autocoder/common/action_yml_file_manager.py,sha256=DdF5P1R_B_chCnnqoA2IgogakWLZk
|
|
|
73
73
|
autocoder/common/anything2images.py,sha256=0ILBbWzY02M-CiWB-vzuomb_J1hVdxRcenAfIrAXq9M,25283
|
|
74
74
|
autocoder/common/anything2img.py,sha256=iZQmg8srXlD7N5uGl5b_ONKJMBjYoW8kPmokkG6ISF0,10118
|
|
75
75
|
autocoder/common/audio.py,sha256=Kn9nWKQddWnUrAz0a_ZUgjcu4VUU_IcZBigT7n3N3qc,7439
|
|
76
|
-
autocoder/common/auto_coder_lang.py,sha256=
|
|
76
|
+
autocoder/common/auto_coder_lang.py,sha256=J8cGOm8qVI4uOyweb3KcF0oVYYZNQC41yYv_-06HdcY,45197
|
|
77
77
|
autocoder/common/auto_configure.py,sha256=D4N-fl9v8bKM5-Ds-uhkC2uGDmHH_ZjLJ759F8KXMKs,13129
|
|
78
78
|
autocoder/common/buildin_tokenizer.py,sha256=L7d5t39ZFvUd6EoMPXUhYK1toD0FHlRH1jtjKRGokWU,1236
|
|
79
79
|
autocoder/common/chunk_validation.py,sha256=BrR_ZWavW8IANuueEE7hS8NFAwEvm8TX34WnPx_1hs8,3030
|
|
@@ -89,7 +89,7 @@ autocoder/common/code_auto_merge_editblock.py,sha256=5PLH8Ey4GYsPNMGn36pSy_IgwgZ
|
|
|
89
89
|
autocoder/common/code_auto_merge_strict_diff.py,sha256=C35pFxhkgypsm50VDAFOBAT6YXMtzKTvIpEUH1GjZZg,13209
|
|
90
90
|
autocoder/common/code_modification_ranker.py,sha256=RwswmKhYae9ZPQHUFPUI-ZW51K5NNtwhFBdOH2I65ic,13592
|
|
91
91
|
autocoder/common/command_completer.py,sha256=MiQiJZZbtGUvREH3gUrQe9b1ElXnPTYh9uuVcUsNlTc,38659
|
|
92
|
-
autocoder/common/command_completer_v2.py,sha256=
|
|
92
|
+
autocoder/common/command_completer_v2.py,sha256=fwj8kfh6Uo0SEvgnCGATeUJKvC_WPMEn0Ss4fdkgXEM,32389
|
|
93
93
|
autocoder/common/command_generator.py,sha256=YwB_E818vx0fQDOpLD61GivsSgLnrIoxKrY22ka49JU,2797
|
|
94
94
|
autocoder/common/command_templates.py,sha256=HjI-lo7H-XeQGsHKUtEI3vnhFH1QFibW9X7fahim8oE,8259
|
|
95
95
|
autocoder/common/computer_use.py,sha256=Z5RL-DgkcbF55YDsqnJ37loXGcm_1tzTheukjTTayJM,35816
|
|
@@ -135,7 +135,7 @@ autocoder/common/types.py,sha256=Cw_4RH-rGmAgQE-Ck69maMAMqlPCDA4Yj37QmuUY0mQ,713
|
|
|
135
135
|
autocoder/common/utils_code_auto_generate.py,sha256=sqtLmVxRveRwqLwJ8UlDgwngwmh2AAo3vgl-I-ALcDQ,4597
|
|
136
136
|
autocoder/common/ac_style_command_parser/__init__.py,sha256=RljOGlR15wlsqKpXh6pVtU3BVBqv4cwJkgfZnzNw5Og,246
|
|
137
137
|
autocoder/common/ac_style_command_parser/example.py,sha256=e7Iwg901f2yzpNkUlUKimrknOAM_3Qkt_BTvIvYgiQA,168
|
|
138
|
-
autocoder/common/ac_style_command_parser/parser.py,sha256=
|
|
138
|
+
autocoder/common/ac_style_command_parser/parser.py,sha256=fefkQWtjYD_M7h7eI90wEBYaPKyNBxl9dBbuaZT5434,9892
|
|
139
139
|
autocoder/common/ac_style_command_parser/test_parser.py,sha256=pw3szwU6egQW5bzB-FpDD_EgPvgGLRw9FuTSZOo_65M,16552
|
|
140
140
|
autocoder/common/command_file_manager/__init__.py,sha256=ardiG_iuWhurfbN6RO4wij2U7Dmafnxn2vgWYYxKqDM,970
|
|
141
141
|
autocoder/common/command_file_manager/examples.py,sha256=DSpRTvkky0_1C3e3e43wDTJ85Vziii0tCce8j33XKT0,4587
|
|
@@ -187,10 +187,29 @@ autocoder/common/ignorefiles/test_ignore_file_utils.py,sha256=EydHG6E2iPsnbt-Jt8
|
|
|
187
187
|
autocoder/common/mcp_servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
188
188
|
autocoder/common/mcp_servers/mcp_server_gpt4o_mini_search.py,sha256=TApShxgoozLluobXHOK1-oAE1zm0-9jdRoPLQB1qwMI,5688
|
|
189
189
|
autocoder/common/mcp_servers/mcp_server_perplexity.py,sha256=CIC26UkfH1lYoVCjfyY5xGGYVx8h0oz0Uj1c7YJ3OPw,5560
|
|
190
|
+
autocoder/common/pull_requests/__init__.py,sha256=dfl_GPLnwRYiby0Jjt2CspfWeIQppa3YjG1ei4uQYio,8351
|
|
191
|
+
autocoder/common/pull_requests/base_provider.py,sha256=X5ynD-RLDfhzY4-RUaqhrWWyN48ZbZhoIM3_sz-rsV4,7541
|
|
192
|
+
autocoder/common/pull_requests/config.py,sha256=z9hExfs85ATN1h_OrC0rWr-siao9ct9tbpHRwBWuKGM,1617
|
|
193
|
+
autocoder/common/pull_requests/example.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
194
|
+
autocoder/common/pull_requests/exceptions.py,sha256=3Lz3zPMsQ6y_k37-7OvhLGK3X_48EOLvMoBEwIk5Dlk,1132
|
|
195
|
+
autocoder/common/pull_requests/manager.py,sha256=mUpTVe-EO8zRHnV4kCY-5DQdFdYHKzfvLKBUf3EBcvY,6887
|
|
196
|
+
autocoder/common/pull_requests/models.py,sha256=tpuXUNW34UHvW7Ck50BHt_v4RsWSEEXimctvBDIpFvY,4307
|
|
197
|
+
autocoder/common/pull_requests/test_module.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
198
|
+
autocoder/common/pull_requests/utils.py,sha256=SoOg0J4QnT5YJe6w-62Rhc7gDMhqVCVsCQnw-h7sP7s,10414
|
|
199
|
+
autocoder/common/pull_requests/providers/__init__.py,sha256=-zehjpwQRHJ-OjFZ72NQI5NbqyLvw95pn4GkXh1EOEA,492
|
|
200
|
+
autocoder/common/pull_requests/providers/gitcode_provider.py,sha256=XGccofjqfckgXp0AmaqDLqis-gBiz9QA0xWkU4qwEv4,601
|
|
201
|
+
autocoder/common/pull_requests/providers/gitee_provider.py,sha256=Juh738yX7dOJw44CYR7MoHmvyD_go6xEiMiCzrXFlBA,628
|
|
202
|
+
autocoder/common/pull_requests/providers/github_provider.py,sha256=r3XMPEXccIkIMDgFLW_Xhq70nPq6i8K8je6a7aPLBio,7599
|
|
203
|
+
autocoder/common/pull_requests/providers/gitlab_provider.py,sha256=wRkzoTzqjJbTaKaAQ3lLGzjAUI6L1fhpb0_nfrGQkfM,928
|
|
190
204
|
autocoder/common/rag_manager/__init__.py,sha256=PR2LIdyFdF3XOFewd2VYuEFNp5ZUMrwAstYn8OOJX-Y,77
|
|
191
205
|
autocoder/common/rag_manager/rag_manager.py,sha256=958DTIHgXN_tw-vMLtuUL1TnhbZbPL0pZior_gYjgR0,5990
|
|
192
206
|
autocoder/common/rulefiles/__init__.py,sha256=babSbPdFaXk1NvdHtH2zrJLb_tWd7d2ELIyS8NApY_Y,221
|
|
193
207
|
autocoder/common/rulefiles/autocoderrules_utils.py,sha256=TvzKt41wa1uPnYXHkUaJRCuxCJL9IB-Zx6FsEwdSExg,19454
|
|
208
|
+
autocoder/common/tokens/__init__.py,sha256=IC-_YUWnEqEH7Z2N1LIYd6tRbnqhHQC7fS8vPc7tvKk,1496
|
|
209
|
+
autocoder/common/tokens/counter.py,sha256=Z9e9tQ-iMFPcwW6Oe1hDglwrIdSvlMZLQIq1dwVuTv8,7102
|
|
210
|
+
autocoder/common/tokens/file_detector.py,sha256=AKMy-9kCWUl2NVeJtsXj5J7UJ4YPP-8t_bTbDWAJtVw,3483
|
|
211
|
+
autocoder/common/tokens/filters.py,sha256=g0kC6LDmiYZCZVr8RN9ing6njSpjyXzEs1GfKfsF1CE,3477
|
|
212
|
+
autocoder/common/tokens/models.py,sha256=JCuV1sRLRSwluwDv7OulDgCqqdx3LAosPCGB7NiKcmg,610
|
|
194
213
|
autocoder/common/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
195
214
|
autocoder/common/v2/code_agentic_editblock_manager.py,sha256=pAh918YMgmLenXmNKXlmDPgKyVJjOuk69901VEEQHm4,34980
|
|
196
215
|
autocoder/common/v2/code_auto_generate.py,sha256=PAySLU8ZnpdF8GelwSCiEbzv7sBbn-Vhakinf4i6udE,11646
|
|
@@ -206,8 +225,8 @@ autocoder/common/v2/code_editblock_manager.py,sha256=DMwJw-FAM6VyaBQV3p4xespHpgZ
|
|
|
206
225
|
autocoder/common/v2/code_manager.py,sha256=C403bS-f6urixwitlKHcml-J03hci-UyNwHJOqBiY6Q,9182
|
|
207
226
|
autocoder/common/v2/code_strict_diff_manager.py,sha256=Bys7tFAq4G03R1zUZuxrszBTvP4QB96jIw2y5BDLyRM,9424
|
|
208
227
|
autocoder/common/v2/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
209
|
-
autocoder/common/v2/agent/agentic_edit.py,sha256=
|
|
210
|
-
autocoder/common/v2/agent/agentic_edit_types.py,sha256=
|
|
228
|
+
autocoder/common/v2/agent/agentic_edit.py,sha256=MBASLrOYgCfkCSrzpZIcOC6iJo-yaI5qwVF02lP2ORg,141595
|
|
229
|
+
autocoder/common/v2/agent/agentic_edit_types.py,sha256=QSNxxnMfeuJr5Ob0pgTvzaOPUjilstxDcadN9mQLCwY,5353
|
|
211
230
|
autocoder/common/v2/agent/agentic_tool_display.py,sha256=-a-JTQLc4q03E_rdIILKMI0B6DHN-5gcGlrqq-mBYK4,7239
|
|
212
231
|
autocoder/common/v2/agent/agentic_edit_tools/__init__.py,sha256=5I_N3xeekdGQJtOI6TxZ4LkwwtP0CQ7stu6SBaF9UeQ,1417
|
|
213
232
|
autocoder/common/v2/agent/agentic_edit_tools/ask_followup_question_tool_resolver.py,sha256=-HFXo3RR6CH8xXjDaE2mYV4XasTLAmvXe6WutL7qbwA,3208
|
|
@@ -355,16 +374,16 @@ autocoder/sdk/cli/__init__.py,sha256=MlNo4WIkWZ5hTOpEIuHrlLt8WkO-HC7R9jpjR6MXN5w
|
|
|
355
374
|
autocoder/sdk/cli/__main__.py,sha256=nuyZUMX4eHbdbfSMqf25qZbqnBm0J-3aK8fjJiPA9pE,625
|
|
356
375
|
autocoder/sdk/cli/completion_wrapper.py,sha256=dvrY1tDvYwPXpbD6EXBxkb5ByhEdtHcm3QIBoeuR5yo,869
|
|
357
376
|
autocoder/sdk/cli/formatters.py,sha256=XsSr7lL1I5ySh9tNmOduHhJwLt3WB8LnUC0Ua5_qd0Y,6552
|
|
358
|
-
autocoder/sdk/cli/handlers.py,sha256=
|
|
377
|
+
autocoder/sdk/cli/handlers.py,sha256=YtAmrmIAeyUt1VFwbKrbChWzIkRY5hMKu-BVDG1d5LA,6095
|
|
359
378
|
autocoder/sdk/cli/install_completion.py,sha256=rjmbj5C0HCz_AqTpTe6mk5dVqCEq4O8AXD8RyC4YkVI,10741
|
|
360
|
-
autocoder/sdk/cli/main.py,sha256=
|
|
361
|
-
autocoder/sdk/cli/options.py,sha256=
|
|
379
|
+
autocoder/sdk/cli/main.py,sha256=3RfZwshtYf4j9yOBPOebWXoPAluHtaS99HCkLILgcQM,10454
|
|
380
|
+
autocoder/sdk/cli/options.py,sha256=mbShv36ytTWvxS84hHvIiH3B3lXkCWfiDWCa4ONwN0k,2970
|
|
362
381
|
autocoder/sdk/core/__init__.py,sha256=sRY7QTYLef6TVc0uvip24U6gKn8WUBv6X8ZwkSC4Vm8,254
|
|
363
|
-
autocoder/sdk/core/auto_coder_core.py,sha256=
|
|
364
|
-
autocoder/sdk/core/bridge.py,sha256=
|
|
382
|
+
autocoder/sdk/core/auto_coder_core.py,sha256=d7Rcaa9LxG5Xve9Iz0v-9bGxltWzMjG0v4VLXzOW77w,36029
|
|
383
|
+
autocoder/sdk/core/bridge.py,sha256=NyRdseW7jpsKYAQMUOK-VVcUYc6MgAG2rbO_36ZaOe4,16918
|
|
365
384
|
autocoder/sdk/models/__init__.py,sha256=5YD4iKXzberhbrF587c1i9UmUbmK8QNRWZeDGM1Ktsk,307
|
|
366
385
|
autocoder/sdk/models/messages.py,sha256=lexCQlvy4doDvOJmJpK5xw8w85LDJ4xAYvJFEiGJ068,6454
|
|
367
|
-
autocoder/sdk/models/options.py,sha256=
|
|
386
|
+
autocoder/sdk/models/options.py,sha256=aspVyCmJhDDSUVpcHthhCxKtiUVIxykj26bo0Y3kjz0,6696
|
|
368
387
|
autocoder/sdk/models/responses.py,sha256=EYenSbaXi1dg5Qkj9hHwyD5L3LK427lhHrExT_mEHRo,9612
|
|
369
388
|
autocoder/sdk/session/__init__.py,sha256=-M3XzeIF0jOdnZLL2IX0u82iatnTQnTF8agZzC4ffpk,263
|
|
370
389
|
autocoder/sdk/session/session.py,sha256=GjyiySEiJxH227wBJa-w1hopU3l_dAKVd64uOdDFGqk,2427
|
|
@@ -399,8 +418,8 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
399
418
|
autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
400
419
|
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=t902pKxQ5xM7zgIHiAOsTPLwxhE6VuvXAqPy751S7fg,14096
|
|
401
420
|
autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
402
|
-
auto_coder-0.1.
|
|
403
|
-
auto_coder-0.1.
|
|
404
|
-
auto_coder-0.1.
|
|
405
|
-
auto_coder-0.1.
|
|
406
|
-
auto_coder-0.1.
|
|
421
|
+
auto_coder-0.1.400.dist-info/METADATA,sha256=Na15y0ac7sMBJHwYsmqXXYpSxYpWRAi2Ui7uuNaheLY,7935
|
|
422
|
+
auto_coder-0.1.400.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
|
423
|
+
auto_coder-0.1.400.dist-info/entry_points.txt,sha256=8lbxiJQDA1WWkn9FHNri1V2HJhEc7oCfBzAV_EkGrZ0,430
|
|
424
|
+
auto_coder-0.1.400.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
425
|
+
auto_coder-0.1.400.dist-info/RECORD,,
|
autocoder/auto_coder_runner.py
CHANGED
|
@@ -3357,7 +3357,8 @@ def run_auto_command(query: str,
|
|
|
3357
3357
|
conversation_config.action = "command"
|
|
3358
3358
|
task_query = render_command_file_with_variables(command_infos)
|
|
3359
3359
|
|
|
3360
|
-
conversation_config.query = task_query
|
|
3360
|
+
conversation_config.query = task_query
|
|
3361
|
+
conversation_config.pull_request = pr
|
|
3361
3362
|
|
|
3362
3363
|
agent = AgenticEdit(llm=llm,args=args,files=SourceCodeList(sources=sources),
|
|
3363
3364
|
conversation_history=conversation_history,
|
|
@@ -22,8 +22,8 @@ class CommandParser:
|
|
|
22
22
|
# 匹配命令的正则表达式 - 必须是以/开头,后跟单词字符,且不能后跟/或.
|
|
23
23
|
# (?<!\S) 确保命令前是字符串开头或空白字符
|
|
24
24
|
self.command_pattern = r'(?<!\S)/(\w+)(?!/|\.)'
|
|
25
|
-
#
|
|
26
|
-
self.key_value_pattern = r'(\w+)=(
|
|
25
|
+
# 匹配键值对参数的正则表达式,支持带引号的值(包括三重引号)
|
|
26
|
+
self.key_value_pattern = r'(\w+)=(?:\'\'\'([^\']*?)\'\'\'|"""([^"]*?)"""|"([^"]*?)"|\'([^\']*?)\'|([^\s"\']*))(?:\s|$)'
|
|
27
27
|
# 匹配路径模式的正则表达式
|
|
28
28
|
self.path_pattern = r'/\w+(?:/[^/\s]+)+'
|
|
29
29
|
|
|
@@ -119,8 +119,9 @@ class CommandParser:
|
|
|
119
119
|
if key_value_pairs:
|
|
120
120
|
for match in key_value_pairs:
|
|
121
121
|
key = match[0]
|
|
122
|
-
#
|
|
123
|
-
|
|
122
|
+
# 值可能在六个捕获组中的一个,取非空的那个
|
|
123
|
+
# match[1]: 三重单引号, match[2]: 三重双引号, match[3]: 双引号, match[4]: 单引号, match[5]: 无引号
|
|
124
|
+
value = match[1] or match[2] or match[3] or match[4] or match[5]
|
|
124
125
|
kwargs[key] = value.strip()
|
|
125
126
|
|
|
126
127
|
# 替换带引号的键值对
|
|
@@ -131,15 +132,22 @@ class CommandParser:
|
|
|
131
132
|
|
|
132
133
|
# 现在 processed_params_str 中应该只剩下位置参数
|
|
133
134
|
|
|
134
|
-
#
|
|
135
|
-
quote_pattern = r'(
|
|
135
|
+
# 处理带引号的位置参数(包括三重引号)
|
|
136
|
+
quote_pattern = r'(?:\'\'\'([^\']*?)\'\'\'|"""([^"]*?)"""|"([^"]*?)"|\'([^\']*?)\')'
|
|
136
137
|
quoted_args = re.findall(quote_pattern, processed_params_str)
|
|
137
138
|
for quoted_arg in quoted_args:
|
|
138
139
|
# 取非空的那个捕获组
|
|
139
|
-
arg = quoted_arg[0] or quoted_arg[1]
|
|
140
|
+
arg = quoted_arg[0] or quoted_arg[1] or quoted_arg[2] or quoted_arg[3]
|
|
140
141
|
args.append(arg)
|
|
141
142
|
# 从参数字符串中移除这个带引号的参数
|
|
142
|
-
|
|
143
|
+
if quoted_arg[0]: # 三重单引号
|
|
144
|
+
quoted_pattern = f"'''{arg}'''"
|
|
145
|
+
elif quoted_arg[1]: # 三重双引号
|
|
146
|
+
quoted_pattern = f'"""{arg}"""'
|
|
147
|
+
elif quoted_arg[2]: # 双引号
|
|
148
|
+
quoted_pattern = f'"{arg}"'
|
|
149
|
+
else: # 单引号
|
|
150
|
+
quoted_pattern = f"'{arg}'"
|
|
143
151
|
processed_params_str = processed_params_str.replace(quoted_pattern, "", 1).strip()
|
|
144
152
|
|
|
145
153
|
# 分割剩余的位置参数(不带引号的)
|
|
@@ -148,17 +156,24 @@ class CommandParser:
|
|
|
148
156
|
else:
|
|
149
157
|
# 如果没有键值对,处理所有参数作为位置参数
|
|
150
158
|
|
|
151
|
-
#
|
|
152
|
-
quote_pattern = r'(
|
|
159
|
+
# 处理带引号的位置参数(包括三重引号)
|
|
160
|
+
quote_pattern = r'(?:\'\'\'([^\']*?)\'\'\'|"""([^"]*?)"""|"([^"]*?)"|\'([^\']*?)\')'
|
|
153
161
|
quoted_args = re.findall(quote_pattern, params_str)
|
|
154
162
|
processed_params_str = params_str
|
|
155
163
|
|
|
156
164
|
for quoted_arg in quoted_args:
|
|
157
165
|
# 取非空的那个捕获组
|
|
158
|
-
arg = quoted_arg[0] or quoted_arg[1]
|
|
166
|
+
arg = quoted_arg[0] or quoted_arg[1] or quoted_arg[2] or quoted_arg[3]
|
|
159
167
|
args.append(arg)
|
|
160
168
|
# 从参数字符串中移除这个带引号的参数
|
|
161
|
-
|
|
169
|
+
if quoted_arg[0]: # 三重单引号
|
|
170
|
+
quoted_pattern = f"'''{arg}'''"
|
|
171
|
+
elif quoted_arg[1]: # 三重双引号
|
|
172
|
+
quoted_pattern = f'"""{arg}"""'
|
|
173
|
+
elif quoted_arg[2]: # 双引号
|
|
174
|
+
quoted_pattern = f'"{arg}"'
|
|
175
|
+
else: # 单引号
|
|
176
|
+
quoted_pattern = f"'{arg}'"
|
|
162
177
|
processed_params_str = processed_params_str.replace(quoted_pattern, "", 1).strip()
|
|
163
178
|
|
|
164
179
|
# 分割剩余的位置参数(不带引号的)
|
|
@@ -849,6 +849,84 @@ MESSAGES = {
|
|
|
849
849
|
"/agent/edit/apply_changes":{
|
|
850
850
|
"en":"Commit the changes in preview steps",
|
|
851
851
|
"zh":"提交前面步骤的修改"
|
|
852
|
+
},
|
|
853
|
+
"/agent/edit/pull_request/branch_name_failed": {
|
|
854
|
+
"en": "Unable to get current branch name, skipping PR creation",
|
|
855
|
+
"zh": "无法获取当前分支名,跳过 PR 创建"
|
|
856
|
+
},
|
|
857
|
+
"/agent/edit/pull_request/title": {
|
|
858
|
+
"en": "AutoCoder: {{query}}",
|
|
859
|
+
"zh": "AutoCoder: {{query}}"
|
|
860
|
+
},
|
|
861
|
+
"/agent/edit/pull_request/default_query": {
|
|
862
|
+
"en": "Code auto generation",
|
|
863
|
+
"zh": "代码自动生成"
|
|
864
|
+
},
|
|
865
|
+
"/agent/edit/pull_request/description": {
|
|
866
|
+
"en": """## 🤖 AutoCoder Generated Pull Request
|
|
867
|
+
|
|
868
|
+
**Task Description**: {{query}}
|
|
869
|
+
|
|
870
|
+
### 📝 Change Summary
|
|
871
|
+
- Modified {{file_count}} files
|
|
872
|
+
- Commit Hash: `{{commit_hash}}`
|
|
873
|
+
|
|
874
|
+
### 📂 Changed Files List
|
|
875
|
+
{{file_list}}
|
|
876
|
+
|
|
877
|
+
### ⚙️ Generation Configuration
|
|
878
|
+
- Source Branch: `{{source_branch}}`
|
|
879
|
+
- Target Branch: `{{target_branch}}`
|
|
880
|
+
- Auto-generated Time: {{timestamp}}
|
|
881
|
+
|
|
882
|
+
### 🔍 Next Steps
|
|
883
|
+
- [ ] Code Review
|
|
884
|
+
- [ ] Test Verification
|
|
885
|
+
- [ ] Merge to Main Branch
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
*This PR was automatically created by AutoCoder*
|
|
889
|
+
""",
|
|
890
|
+
"zh": """## 🤖 AutoCoder 自动生成的 Pull Request
|
|
891
|
+
|
|
892
|
+
**任务描述**: {{query}}
|
|
893
|
+
|
|
894
|
+
### 📝 变更摘要
|
|
895
|
+
- 共修改 {{file_count}} 个文件
|
|
896
|
+
- 提交哈希: `{{commit_hash}}`
|
|
897
|
+
|
|
898
|
+
### 📂 变更文件列表
|
|
899
|
+
{{file_list}}
|
|
900
|
+
|
|
901
|
+
### ⚙️ 生成配置
|
|
902
|
+
- 源分支: `{{source_branch}}`
|
|
903
|
+
- 目标分支: `{{target_branch}}`
|
|
904
|
+
- 自动生成时间: {{timestamp}}
|
|
905
|
+
|
|
906
|
+
### 🔍 下一步
|
|
907
|
+
- [ ] 代码审查
|
|
908
|
+
- [ ] 测试验证
|
|
909
|
+
- [ ] 合并到主分支
|
|
910
|
+
|
|
911
|
+
---
|
|
912
|
+
*此 PR 由 AutoCoder 自动创建*
|
|
913
|
+
"""
|
|
914
|
+
},
|
|
915
|
+
"/agent/edit/pull_request/creating": {
|
|
916
|
+
"en": "Creating Pull Request: {{title}}",
|
|
917
|
+
"zh": "正在创建 Pull Request: {{title}}"
|
|
918
|
+
},
|
|
919
|
+
"/agent/edit/pull_request/success": {
|
|
920
|
+
"en": "✅ Pull Request created successfully",
|
|
921
|
+
"zh": "✅ Pull Request 创建成功"
|
|
922
|
+
},
|
|
923
|
+
"/agent/edit/pull_request/failed": {
|
|
924
|
+
"en": "❌ Pull Request creation failed: {{error}}",
|
|
925
|
+
"zh": "❌ Pull Request 创建失败: {{error}}"
|
|
926
|
+
},
|
|
927
|
+
"/agent/edit/pull_request/exception": {
|
|
928
|
+
"en": "❌ Exception occurred while creating Pull Request: {{error}}",
|
|
929
|
+
"zh": "❌ 创建 Pull Request 时发生异常: {{error}}"
|
|
852
930
|
}
|
|
853
931
|
}
|
|
854
932
|
|
|
@@ -22,7 +22,7 @@ COMMAND_HIERARCHY = {
|
|
|
22
22
|
"/mcp": {"/add": {}, "/remove": {}, "/list": {}, "/list_running": {}, "/refresh": {}, "/info": {}},
|
|
23
23
|
"/lib": {"/add": {}, "/remove": {}, "/list": {}, "/set-proxy": {}, "/refresh": {}, "/get": {}},
|
|
24
24
|
"/models": {"/chat": {}, "/add": {}, "/add_model": {}, "/remove": {}, "/list": {}, "/speed": {}, "/speed-test": {}, "/input_price": {}, "/output_price": {}, "/activate": {}},
|
|
25
|
-
"/auto": {"/new": {}, "/
|
|
25
|
+
"/auto": {"/new": {}, "/resume": {}, "/list": {},"/command":{}},
|
|
26
26
|
"/shell": {"/chat": {}},
|
|
27
27
|
"/active_context": {"/list": {}, "/run": {}},
|
|
28
28
|
"/index": {"/query": {}, "/build": {}, "/export": {}, "/import": {}},
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Pull Request 统一管理模块
|
|
3
|
+
|
|
4
|
+
统一的 Pull Request 创建和管理模块,支持 GitHub、GitLab、Gitee、GitCode 四大代码托管平台的 PR 操作。
|
|
5
|
+
"""
|
|
6
|
+
from typing import Optional, List, Dict, Any
|
|
7
|
+
from loguru import logger
|
|
8
|
+
|
|
9
|
+
from .models import (
|
|
10
|
+
PRConfig, PRResult, PRInfo, PRData, RepoInfo, PlatformType,
|
|
11
|
+
DEFAULT_TEMPLATES
|
|
12
|
+
)
|
|
13
|
+
from .manager import PullRequestManager, get_global_manager, set_global_config
|
|
14
|
+
from .exceptions import (
|
|
15
|
+
PRError, AuthenticationError, RepositoryNotFoundError,
|
|
16
|
+
BranchNotFoundError, NetworkError, RateLimitError,
|
|
17
|
+
ValidationError, PlatformNotSupportedError, ConfigurationError
|
|
18
|
+
)
|
|
19
|
+
from .config import get_config
|
|
20
|
+
from .utils import (
|
|
21
|
+
parse_git_url, detect_platform_from_repo, get_repo_info_from_path,
|
|
22
|
+
get_current_branch, branch_exists, is_git_repo, get_default_remote_branch,
|
|
23
|
+
ensure_branch_exists_remotely, is_main_branch, create_and_checkout_branch,
|
|
24
|
+
generate_auto_branch_name
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def create_pull_request(
|
|
29
|
+
repo_path: str,
|
|
30
|
+
title: str,
|
|
31
|
+
source_branch: Optional[str] = None,
|
|
32
|
+
target_branch: Optional[str] = None,
|
|
33
|
+
description: str = "",
|
|
34
|
+
labels: Optional[List[str]] = None,
|
|
35
|
+
assignees: Optional[List[str]] = None,
|
|
36
|
+
reviewers: Optional[List[str]] = None,
|
|
37
|
+
draft: bool = False,
|
|
38
|
+
template_type: Optional[str] = None,
|
|
39
|
+
template_vars: Optional[Dict[str, str]] = None,
|
|
40
|
+
platform: Optional[str] = None,
|
|
41
|
+
token: Optional[str] = None,
|
|
42
|
+
**kwargs
|
|
43
|
+
) -> PRResult:
|
|
44
|
+
"""
|
|
45
|
+
创建 Pull Request(主要接口函数)
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
repo_path: 仓库路径
|
|
49
|
+
title: PR标题
|
|
50
|
+
source_branch: 源分支(可选,默认为当前分支)
|
|
51
|
+
target_branch: 目标分支(可选,默认为远程默认分支或main)
|
|
52
|
+
description: PR描述
|
|
53
|
+
labels: 标签列表
|
|
54
|
+
assignees: 负责人列表
|
|
55
|
+
reviewers: 审查者列表
|
|
56
|
+
draft: 是否为草稿PR
|
|
57
|
+
template_type: 模板类型
|
|
58
|
+
template_vars: 模板变量
|
|
59
|
+
platform: 平台类型(可选,会自动检测)
|
|
60
|
+
token: 访问令牌(可选)
|
|
61
|
+
**kwargs: 其他配置参数
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
PR创建结果
|
|
65
|
+
"""
|
|
66
|
+
# 处理可选的分支参数
|
|
67
|
+
if source_branch is None:
|
|
68
|
+
source_branch = get_current_branch(repo_path)
|
|
69
|
+
if not source_branch:
|
|
70
|
+
raise ValidationError("无法获取当前分支,请指定source_branch参数")
|
|
71
|
+
|
|
72
|
+
# 从当前分支,自动创建新分支
|
|
73
|
+
auto_branch_name = generate_auto_branch_name()
|
|
74
|
+
logger.info(f"检测到当前分支 '{source_branch}' 为主分支,自动创建新分支: {auto_branch_name}")
|
|
75
|
+
|
|
76
|
+
if not create_and_checkout_branch(repo_path, auto_branch_name):
|
|
77
|
+
raise ValidationError(f"无法从主分支 '{source_branch}' 创建新分支 '{auto_branch_name}'")
|
|
78
|
+
|
|
79
|
+
source_branch = auto_branch_name
|
|
80
|
+
logger.info(f"已切换到新分支: {source_branch}")
|
|
81
|
+
|
|
82
|
+
if target_branch is None:
|
|
83
|
+
target_branch = get_default_remote_branch(repo_path)
|
|
84
|
+
if not target_branch:
|
|
85
|
+
target_branch = "main" # 默认值
|
|
86
|
+
|
|
87
|
+
# 验证仓库是否为Git仓库
|
|
88
|
+
if not is_git_repo(repo_path):
|
|
89
|
+
raise ValidationError(f"路径 {repo_path} 不是一个有效的Git仓库")
|
|
90
|
+
|
|
91
|
+
# 检查源分支和目标分支是否相同
|
|
92
|
+
if source_branch == target_branch:
|
|
93
|
+
raise ValidationError(f"源分支和目标分支不能相同: {source_branch}")
|
|
94
|
+
|
|
95
|
+
# 确保源分支存在于远程仓库,如果不存在则自动推送
|
|
96
|
+
if not ensure_branch_exists_remotely(repo_path, source_branch):
|
|
97
|
+
raise BranchNotFoundError(
|
|
98
|
+
f"源分支 '{source_branch}' 在本地不存在或推送失败。"
|
|
99
|
+
f"请检查分支是否存在或网络连接是否正常。"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
# 检查目标分支是否存在于远程仓库
|
|
103
|
+
if not branch_exists(repo_path, target_branch, remote=True):
|
|
104
|
+
raise BranchNotFoundError(
|
|
105
|
+
f"目标分支 '{target_branch}' 在远程仓库中不存在。"
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# 如果提供了token,创建临时配置
|
|
109
|
+
manager = get_global_manager()
|
|
110
|
+
|
|
111
|
+
if token:
|
|
112
|
+
# 自动检测平台或使用指定平台
|
|
113
|
+
if not platform:
|
|
114
|
+
detected_platform = detect_platform_from_repo(repo_path)
|
|
115
|
+
if detected_platform:
|
|
116
|
+
platform = detected_platform.value
|
|
117
|
+
else:
|
|
118
|
+
raise ValidationError("无法检测平台类型,请指定platform参数")
|
|
119
|
+
|
|
120
|
+
# 创建临时配置
|
|
121
|
+
temp_config = PRConfig(platform=PlatformType(platform), token=token)
|
|
122
|
+
temp_manager = PullRequestManager(temp_config)
|
|
123
|
+
|
|
124
|
+
return temp_manager.create_pull_request(
|
|
125
|
+
repo_path=repo_path,
|
|
126
|
+
source_branch=source_branch,
|
|
127
|
+
target_branch=target_branch,
|
|
128
|
+
title=title,
|
|
129
|
+
description=description,
|
|
130
|
+
labels=labels,
|
|
131
|
+
assignees=assignees,
|
|
132
|
+
reviewers=reviewers,
|
|
133
|
+
draft=draft,
|
|
134
|
+
template_type=template_type,
|
|
135
|
+
template_vars=template_vars,
|
|
136
|
+
platform=platform
|
|
137
|
+
)
|
|
138
|
+
else:
|
|
139
|
+
# 使用全局管理器
|
|
140
|
+
return manager.create_pull_request(
|
|
141
|
+
repo_path=repo_path,
|
|
142
|
+
source_branch=source_branch,
|
|
143
|
+
target_branch=target_branch,
|
|
144
|
+
title=title,
|
|
145
|
+
description=description,
|
|
146
|
+
labels=labels,
|
|
147
|
+
assignees=assignees,
|
|
148
|
+
reviewers=reviewers,
|
|
149
|
+
draft=draft,
|
|
150
|
+
template_type=template_type,
|
|
151
|
+
template_vars=template_vars,
|
|
152
|
+
platform=platform
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def get_pull_request(
|
|
157
|
+
repo_path: str,
|
|
158
|
+
pr_number: int,
|
|
159
|
+
platform: Optional[str] = None,
|
|
160
|
+
token: Optional[str] = None,
|
|
161
|
+
**kwargs
|
|
162
|
+
) -> PRResult:
|
|
163
|
+
"""获取 Pull Request 信息"""
|
|
164
|
+
manager = get_global_manager()
|
|
165
|
+
|
|
166
|
+
if token:
|
|
167
|
+
if not platform:
|
|
168
|
+
detected_platform = detect_platform_from_repo(repo_path)
|
|
169
|
+
if detected_platform:
|
|
170
|
+
platform = detected_platform.value
|
|
171
|
+
else:
|
|
172
|
+
raise ValidationError("无法检测平台类型,请指定platform参数")
|
|
173
|
+
|
|
174
|
+
config_data = {"token": token}
|
|
175
|
+
config_data.update(kwargs)
|
|
176
|
+
temp_config = PRConfig(platform=platform, **config_data)
|
|
177
|
+
temp_manager = PullRequestManager(temp_config)
|
|
178
|
+
|
|
179
|
+
return temp_manager.get_pull_request(repo_path, pr_number, platform)
|
|
180
|
+
else:
|
|
181
|
+
return manager.get_pull_request(repo_path, pr_number, platform)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def list_pull_requests(
|
|
185
|
+
repo_path: str,
|
|
186
|
+
state: str = "open",
|
|
187
|
+
per_page: int = 30,
|
|
188
|
+
page: int = 1,
|
|
189
|
+
platform: Optional[str] = None,
|
|
190
|
+
token: Optional[str] = None,
|
|
191
|
+
**kwargs
|
|
192
|
+
) -> List[PRInfo]:
|
|
193
|
+
"""列出 Pull Requests"""
|
|
194
|
+
manager = get_global_manager()
|
|
195
|
+
|
|
196
|
+
if token:
|
|
197
|
+
if not platform:
|
|
198
|
+
detected_platform = detect_platform_from_repo(repo_path)
|
|
199
|
+
if detected_platform:
|
|
200
|
+
platform = detected_platform.value
|
|
201
|
+
else:
|
|
202
|
+
raise ValidationError("无法检测平台类型,请指定platform参数")
|
|
203
|
+
|
|
204
|
+
config_data = {"token": token}
|
|
205
|
+
config_data.update(kwargs)
|
|
206
|
+
temp_config = PRConfig(platform=platform, **config_data)
|
|
207
|
+
temp_manager = PullRequestManager(temp_config)
|
|
208
|
+
|
|
209
|
+
return temp_manager.list_pull_requests(repo_path, state, per_page, page, platform)
|
|
210
|
+
else:
|
|
211
|
+
return manager.list_pull_requests(repo_path, state, per_page, page, platform)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# 导出所有公共接口
|
|
215
|
+
__all__ = [
|
|
216
|
+
# 主要函数
|
|
217
|
+
'create_pull_request',
|
|
218
|
+
'get_pull_request',
|
|
219
|
+
'list_pull_requests',
|
|
220
|
+
|
|
221
|
+
# 类和模型
|
|
222
|
+
'PullRequestManager',
|
|
223
|
+
'PRConfig',
|
|
224
|
+
'PRResult',
|
|
225
|
+
'PRInfo',
|
|
226
|
+
'PRData',
|
|
227
|
+
'RepoInfo',
|
|
228
|
+
'PlatformType',
|
|
229
|
+
|
|
230
|
+
# 异常
|
|
231
|
+
'PRError',
|
|
232
|
+
'AuthenticationError',
|
|
233
|
+
'RepositoryNotFoundError',
|
|
234
|
+
'BranchNotFoundError',
|
|
235
|
+
'NetworkError',
|
|
236
|
+
'RateLimitError',
|
|
237
|
+
'ValidationError',
|
|
238
|
+
'PlatformNotSupportedError',
|
|
239
|
+
'ConfigurationError',
|
|
240
|
+
|
|
241
|
+
# 工具函数
|
|
242
|
+
'parse_git_url',
|
|
243
|
+
'detect_platform_from_repo',
|
|
244
|
+
'get_repo_info_from_path',
|
|
245
|
+
'get_current_branch',
|
|
246
|
+
'branch_exists',
|
|
247
|
+
'is_git_repo',
|
|
248
|
+
|
|
249
|
+
# 配置函数
|
|
250
|
+
'get_config',
|
|
251
|
+
'set_global_config',
|
|
252
|
+
'get_global_manager',
|
|
253
|
+
|
|
254
|
+
# 模板
|
|
255
|
+
'DEFAULT_TEMPLATES'
|
|
256
|
+
]
|