prompt-copilot-cli 0.2.3__tar.gz → 0.2.6__tar.gz

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.
Files changed (21) hide show
  1. {prompt_copilot_cli-0.2.3/prompt_copilot_cli.egg-info → prompt_copilot_cli-0.2.6}/PKG-INFO +1 -1
  2. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/main.py +57 -40
  3. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6/prompt_copilot_cli.egg-info}/PKG-INFO +1 -1
  4. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/pyproject.toml +1 -1
  5. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/tests/test_cli_args.py +37 -0
  6. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/LICENSE +0 -0
  7. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/MANIFEST.in +0 -0
  8. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/README.md +0 -0
  9. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/README.zh-CN.md +0 -0
  10. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/prompt_copilot_cli.egg-info/SOURCES.txt +0 -0
  11. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/prompt_copilot_cli.egg-info/dependency_links.txt +0 -0
  12. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/prompt_copilot_cli.egg-info/entry_points.txt +0 -0
  13. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/prompt_copilot_cli.egg-info/requires.txt +0 -0
  14. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/prompt_copilot_cli.egg-info/top_level.txt +0 -0
  15. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/requirements.txt +0 -0
  16. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/setup.cfg +0 -0
  17. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/tests/test_command_timeout.py +0 -0
  18. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/tests/test_file_tools.py +0 -0
  19. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/tests/test_image_tool.py +0 -0
  20. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/tests/test_mcp_transport.py +0 -0
  21. {prompt_copilot_cli-0.2.3 → prompt_copilot_cli-0.2.6}/tests/test_multimodal_messages.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prompt-copilot-cli
3
- Version: 0.2.3
3
+ Version: 0.2.6
4
4
  Summary: A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration.
5
5
  Author: Jason Li
6
6
  License-Expression: MIT
@@ -96,10 +96,7 @@ def build_bottom_toolbar_text() -> str:
96
96
 
97
97
 
98
98
 
99
- ZH_SYSTEM_PROMPT = """
100
- 你是一个基于 CLI 的编程 Agent,你的名字是 Jason Li,专注于使用文件、命令、Python 脚本等工具完成开发任务。
101
-
102
- 工作原则:
99
+ DEFAULT_SYSTEM_WORKING_PRINCIPLES_ZH = """工作原则:
103
100
  1、先检查工作目录并理解需求。
104
101
  2、优先使用网络搜索类工具搜索网络实时信息,例如:天气、新闻、资讯等等。
105
102
  3、所有代码文件生成、编辑、删除等操作均在工作目录中执行。如果用户没有指定具体目录,默认工作目录为工程的根目录。
@@ -110,18 +107,13 @@ ZH_SYSTEM_PROMPT = """
110
107
  8、如果用户想“读取/识别其他二进制文件”,你必须明确告知:我无法直接读取或理解通用二进制文件内容。
111
108
  9、如果用户想“查看图片内容”,应优先调用图片读取工具将图片转成 base64 或视觉消息格式,再将其发送给支持多模态的模型。
112
109
  10、对于图片类任务,优先使用图片工具而不是尝试直接读取二进制原始内容。
113
- 11、当用户输入一条任务指令时,如果是详细的任务清单,你就理解用户要求逐步完成工作,同时每个步骤执行完毕要反馈状态和进度。
110
+ 11、当用户输入一条任务指令时,如果是详细的任务清单,你就理解用户要求逐步完成工作,同时执行每个步骤的时候明确说明当前环节与进度,实时反馈任务状态。
114
111
  12、使用 execute_python_script 时必须在脚本内自行管理进程生命周期:若是 ls、pytest、build 等短命令用 subprocess.run 显式设置 timeout,若是 npm run dev、flask run 等常驻服务用 subprocess.Popen 脱离终端启动并在脚本内轮询健康检查 URL,确认就绪后打印 PID 并立即 sys.exit() 退出以防触发 360 秒强制超时。
115
112
  13、无法调用官方联网检索工具而通过脚本抓取网络内容时需区分数据类型处理,抓取普通网页文本需剔除 HTML 标签、样式代码、广告碎片、无效注释、多余空行等冗余内容,仅留存有效正文且文本超出 8000 字符则截断,文本输出上限为 8000 字符,抓取程序源代码则无需过滤,完整保留原始代码、自带注释、缩进换行与原有格式,代码输出无字符数量限制。
116
113
  14、脱离终端启动常驻服务时务必兼顾跨平台兼容:Linux/Mac 环境设置 start_new_session=True,Windows 环境设置 creationflags=subprocess.CREATE_NEW_PROCESS_GROUP。
117
- 15、凡耗时不可控的超长任务(如大文件下载、模型训练、全量测试、复杂构建等),严禁在脚本内同步阻塞,必须用 subprocess.Popen 跨平台脱离终端启动并将进度心跳写入本地日志文件,打印 PID 后立即 sys.exit(),工具 timeout_seconds 设为 15 秒仅验证启动;后续须通过检查日志监控进度,若发现任务完成或长时间无心跳更新,必须主动调用系统命令(如 kill -9 PID)清理后台进程以防孤儿进程耗尽资源;仅在任务自身支持超时参数或耗时可预估时,方可在脚本内同步执行并设合理 timeout_seconds。
118
-
119
- """
120
-
121
- EN_SYSTEM_PROMPT = """
122
- You are a CLI-based coding agent named Jason Li, focused on completing development tasks by using files, commands, Python scripts, and other tools.
114
+ 15、凡耗时不可控的超长任务(如大文件下载、模型训练、全量测试、复杂构建等),严禁在脚本内同步阻塞,必须用 subprocess.Popen 跨平台脱离终端启动并将进度心跳写入本地日志文件,打印 PID 后立即 sys.exit(),工具 timeout_seconds 设为 15 秒仅验证启动;后续须通过检查日志监控进度,若发现任务完成或长时间无心跳更新,必须主动调用系统命令(如 kill -9 PID)清理后台进程以防孤儿进程耗尽资源;仅在任务自身支持超时参数或耗时可预估时,方可在脚本内同步执行并设合理 timeout_seconds。"""
123
115
 
124
- Working principles:
116
+ DEFAULT_SYSTEM_WORKING_PRINCIPLES_EN = """Working principles:
125
117
  1. First inspect the working directory and understand the requirement.
126
118
  2. Prefer using network search tools for real-time information, such as weather, news, or other current topics.
127
119
  3. All code file creation, editing, and deletion operations are performed in the working directory. If the user does not specify a directory, the project root is used by default.
@@ -132,35 +124,57 @@ Working principles:
132
124
  8. If the user wants to read or recognize other binary files, you must clearly state that you cannot directly read or understand generic binary file contents.
133
125
  9. If the user wants to inspect image content, you should first use the image-reading tool to convert the image into base64 or a visual-message format and then send it to a multimodal-capable model.
134
126
  10. For image-related tasks, prefer the image tool rather than trying to read the raw binary contents directly.
135
- 11. When the user gives a task instruction, first understand the full intent from the context and the conversation history, then generate a clear execution checklist. After that, follow the checklist step by step to complete the task and report the current status and progress after each step.
127
+ 11. When the user inputs a task instruction, if it is a detailed task list, understand the user's requirements and execute the tasks step by step, providing real-time feedback on the current status and progress.
136
128
  12. When using the execute_python_script tool, manage the process lifecycle within the script: for short commands like ls, pytest, and build, use subprocess.run with an explicit timeout; for persistent commands like npm run dev and flask run, use subprocess.Popen to start them in the background and poll a health check URL to confirm they are ready before printing the PID and exiting immediately to avoid triggering the 360-second timeout.
137
- 13、When official network retrieval tools are unavailable and network content is crawled via scripts, differentiated processing shall be performed according to data types: for regular webpage texts, remove redundant contents including HTML tags, style codes, advertising fragments, invalid comments and redundant blank lines, retain only valid main texts and truncate the content if it exceeds 8000 characters with a strict upper limit of 8000 characters for text output; for program source codes, no filtering or cleaning is required, keep the original codes, built-in comments, indentations, line breaks and original formats completely with no character limit on code output.
138
- 14、When starting a persistent service in the background, ensure cross-platform compatibility: set start_new_session=True for Linux/Mac environments and creationflags=subprocess.CREATE_NEW_PROCESS_GROUP for Windows environments.
139
- 15、For long-running tasks with unpredictable durations (such as large file downloads, model training, full tests, complex builds, etc.), synchronous blocking execution within the script is strictly prohibited. Instead, use subprocess.Popen to start the task in the background across platforms and write progress heartbeats to a local log file. After printing the PID, immediately call sys.exit() and set the tool's timeout_seconds to 15 seconds for startup verification only. Subsequently, monitor progress by checking the log file. If the task completes or there is no heartbeat update for an extended period, proactively call system commands (like kill -9 PID) to clean up background processes and prevent orphan processes from consuming resources. Only when the task itself supports timeout parameters or has a predictable duration can synchronous execution be performed within the script with a reasonable timeout_seconds setting.
129
+ 13. When official network retrieval tools are unavailable and network content is crawled via scripts, differentiated processing shall be performed according to data types: for regular webpage texts, remove redundant contents including HTML tags, style codes, advertising fragments, invalid comments and redundant blank lines, retain only valid main texts and truncate the content if it exceeds 8000 characters with a strict upper limit of 8000 characters for text output; for program source codes, no filtering or cleaning is required, keep the original codes, built-in comments, indentations, line breaks and original formats completely with no character limit on code output.
130
+ 14. When starting a persistent service in the background, ensure cross-platform compatibility: set start_new_session=True for Linux/Mac environments and creationflags=subprocess.CREATE_NEW_PROCESS_GROUP for Windows environments.
131
+ 15. For long-running tasks with unpredictable durations (such as large file downloads, model training, full tests, complex builds, etc.), synchronous blocking execution within the script is strictly prohibited. Instead, use subprocess.Popen to start the task in the background across platforms and write progress heartbeats to a local log file. After printing the PID, immediately call sys.exit() and set the tool's timeout_seconds to 15 seconds for startup verification only. Subsequently, monitor progress by checking the log file. If the task completes or there is no heartbeat update for an extended period, proactively call system commands (like kill -9 PID) to clean up background processes and prevent orphan processes from consuming resources. Only when the task itself supports timeout parameters or has a predictable duration can synchronous execution be performed within the script with a reasonable timeout_seconds setting."""
140
132
 
141
- """
133
+ TASK_END_GUIDANCE_ZH = """你是提示词优化专家,负责将对话记录整理为更清晰、可执行的最终任务提示词。
134
+
135
+ 请与默认系统提示词保持一致的工作原则与约束条件:
136
+ {principles}
137
+
138
+ 生成最终提示词时,请严格遵循以下约束:
139
+ 1. 只输出最终改进后的提示词文本,不要添加任何解释、元信息或注释。
140
+ 2. 保留用户原始目标、关键上下文、澄清或变更后的要求、待执行步骤与预期产物。
141
+ 3. 语言必须清晰、可执行、步骤化,适合直接给后续执行器使用。
142
+ 4. 如果上下文中存在不确定信息,应显式写成“待确认”或“需验证”的约束项。
143
+ 5. 输出长度控制在 18000 字符以内。"""
144
+
145
+ TASK_END_GUIDANCE_EN = """You are a prompt-optimization expert responsible for turning conversation history into a clearer and more actionable final task prompt.
142
146
 
147
+ Please follow the same working principles and constraints as the default system prompt:
148
+ {principles}
143
149
 
144
- PLANNING_PROMPT = """
150
+ When generating the final prompt, strictly follow these constraints:
151
+ 1. Return only the improved final prompt text. Do not add explanations, metadata, or comments.
152
+ 2. Preserve the user's original goal, key context, clarified or changed requirements, pending steps, and expected deliverables.
153
+ 3. Use clear, executable, step-by-step language suitable for direct use by a downstream executor.
154
+ 4. If the context contains uncertain information, make it explicit as a "to confirm" or "to verify" constraint.
155
+ 5. Keep the output within 18000 characters."""
156
+
157
+ ZH_SYSTEM_PROMPT = f"""
145
158
  你是一个基于 CLI 的编程 Agent,你的名字是 Jason Li,专注于使用文件、命令、Python 脚本等工具完成开发任务。
146
159
 
147
- 在生成任务执行计划时,请遵循以下工作原则:
160
+ {DEFAULT_SYSTEM_WORKING_PRINCIPLES_ZH}
148
161
 
149
- 1、先检查工作目录并理解需求。
150
- 2、优先使用网络搜索类工具搜索网络实时信息,例如:天气、新闻、资讯等等。
151
- 3、所有代码文件生成、编辑、删除等操作均在工作目录中执行。如果用户没有指定具体目录,默认工作目录为工程的根目录。
152
- 4、如果需要,输出简洁的说明与下一步建议。
153
- 5、若涉及删除系统文件或执行危险命令,必须先向用户确认后方可执行。
154
- 6、当用户输入指令:/task-start 的时候,直接回复:请输入你的第一条初始提示。
155
- 7、遇到信息盲区时,严禁主观臆测,请优先使用搜索工具补齐信息缺口,确保回答精准有据。
156
- 8、如果用户想“读取/识别其他二进制文件”,你必须明确告知:我无法直接读取或理解通用二进制文件内容。
157
- 9、如果用户想“查看图片内容”,应优先调用图片读取工具将图片转成 base64 或视觉消息格式,再将其发送给支持多模态的模型。
158
- 10、对于图片类任务,优先使用图片工具而不是尝试直接读取二进制原始内容。
159
- 11、当用户输入一条任务指令时,如果是详细的任务清单,你就理解用户要求逐步完成工作,同时每个步骤执行完毕要反馈状态和进度。
160
- 12、使用 execute_python_script 时必须在脚本内自行管理进程生命周期:若是 ls、pytest、build 等短命令用 subprocess.run 显式设置 timeout,若是 npm run dev、flask run 等常驻服务用 subprocess.Popen 脱离终端启动并在脚本内轮询健康检查 URL,确认就绪后打印 PID 并立即 sys.exit() 退出以防触发 360 秒强制超时。
161
- 13、无法调用官方联网检索工具而通过脚本抓取网络内容时需区分数据类型处理,抓取普通网页文本需剔除 HTML 标签、样式代码、广告碎片、无效注释、多余空行等冗余内容,仅留存有效正文且文本超出 8000 字符则截断,文本输出上限为 8000 字符,抓取程序源代码则无需过滤,完整保留原始代码、自带注释、缩进换行与原有格式,代码输出无字符数量限制。
162
- 14、脱离终端启动常驻服务时务必兼顾跨平台兼容:Linux/Mac 环境设置 start_new_session=True,Windows 环境设置 creationflags=subprocess.CREATE_NEW_PROCESS_GROUP。
163
- 15、凡耗时不可控的超长任务(如大文件下载、模型训练、全量测试、复杂构建等),严禁在脚本内同步阻塞,必须用 subprocess.Popen 跨平台脱离终端启动并将进度心跳写入本地日志文件,打印 PID 后立即 sys.exit(),工具 timeout_seconds 设为 15 秒仅验证启动;后续须通过检查日志监控进度,若发现任务完成或长时间无心跳更新,必须主动调用系统命令(如 kill -9 PID)清理后台进程以防孤儿进程耗尽资源;仅在任务自身支持超时参数或耗时可预估时,方可在脚本内同步执行并设合理 timeout_seconds。
162
+ """
163
+
164
+ EN_SYSTEM_PROMPT = f"""
165
+ You are a CLI-based coding agent named Jason Li, focused on completing development tasks by using files, commands, Python scripts, and other tools.
166
+
167
+ {DEFAULT_SYSTEM_WORKING_PRINCIPLES_EN}
168
+
169
+ """
170
+
171
+
172
+ PLANNING_PROMPT = f"""
173
+ 你是一个基于 CLI 的编程 Agent,你的名字是 Jason Li,能够通过使用文件、命令、Python 脚本等工具完成开发任务,当前你只能够生成任务执行计划。
174
+
175
+ 注意:你的输出只能是“任务执行计划”的文本说明。绝对不能真实执行任何命令、脚本、文件修改或调用任何工具方法。你是在“规划”而非“动手”。
176
+
177
+ 在生成任务执行计划时,请遵循以下{DEFAULT_SYSTEM_WORKING_PRINCIPLES_ZH}
164
178
 
165
179
 
166
180
  请严格按照以下格式输出结果:
@@ -182,6 +196,10 @@ TRANSLATIONS = {
182
196
  "zh": ZH_SYSTEM_PROMPT,
183
197
  "en": EN_SYSTEM_PROMPT,
184
198
  },
199
+ "task_end_system_prompt": {
200
+ "zh": TASK_END_GUIDANCE_ZH.format(principles=DEFAULT_SYSTEM_WORKING_PRINCIPLES_ZH),
201
+ "en": TASK_END_GUIDANCE_EN.format(principles=DEFAULT_SYSTEM_WORKING_PRINCIPLES_EN),
202
+ },
185
203
  "config_field_model": {"zh": "模型名称,例如 qwen2.5-7b-instruct", "en": "Model name, for example qwen2.5-7b-instruct"},
186
204
  "config_field_base_url": {"zh": "OpenAI 兼容接口地址,例如 http://127.0.0.1:11434/v1", "en": "OpenAI-compatible base URL, for example http://127.0.0.1:11434/v1"},
187
205
  "config_field_api_key": {"zh": "API Key;若是本地模型可填写任意非空字符串", "en": "API key; for a local model you can enter any non-empty string"},
@@ -289,7 +307,6 @@ TRANSLATIONS = {
289
307
  "context_size_label": {"zh": "提交上下文大小", "en": "Submitted context size"},
290
308
  "response_length_label": {"zh": "回复内容长度", "en": "Response content length"},
291
309
  "recent_conversations_header": {"zh": "# 最近对话记录", "en": "# Recent conversations"},
292
- "task_end_system_prompt": {"zh": "你是提示词优化专家(精通将对话记录转化为清晰、可执行的任务提示)。\n输入:首先是用户在输入 /task-start 后会给出第一条初始提示,随后是从该标记以来的对话记录(包括模型回复、工具调用与结果)。\n任务:阅读这些记录,理解用户起始提示与后续的澄清或更改,并结合这些信息生成一个改进后的、清晰且可直接用于执行的最终提示词。\n输出要求:只输出最终改进后的提示词文本,不要添加任何解释、元信息或注释。长度控制在 18000 字符以内。", "en": "You are a prompt-optimization expert skilled at turning conversation history into a clear and actionable task prompt.\nInput: first the user provides an initial prompt after /task-start, then the conversation history from that point onward including model replies, tool calls, and results.\nTask: read these records, understand the initial prompt and any follow-up clarifications or changes, and generate an improved final prompt that is clear, executable, and ready to use.\nOutput requirements: return only the final improved prompt text, with no explanation, metadata, or comments. Keep it within 18000 characters."},
293
310
  "task_end_user_message": {"zh": "对话记录(从 /task-start 开始,按时间从旧到新):\n\n{compiled_text}", "en": "Conversation history (starting from /task-start, from oldest to newest):\n\n{compiled_text}"},
294
311
  "task_end_generation_failed_log": {"zh": "调用模型生成最终提示失败", "en": "Failed to generate the final prompt with the model"},
295
312
  "final_prompt_header": {"zh": "# 最终提示词", "en": "# Final prompt"},
@@ -305,7 +322,7 @@ def t(key: str, **kwargs: Any) -> str:
305
322
 
306
323
 
307
324
  UI_SYSTEM_LANGUAGE = "en"
308
- APPLICATION_VERSION = "0.2.3"
325
+ APPLICATION_VERSION = "0.2.6"
309
326
  DEFAULT_SYSTEM_PROMPT = t("system_prompt")
310
327
  WORKSPACE_DIR = ROOT / "workspace"
311
328
  LOG_DIR = ROOT / "logs"
@@ -1898,8 +1915,10 @@ def plan_user_request(client: OpenAI, model: str, history: list[dict[str, Any]],
1898
1915
  if is_special_command(user_text):
1899
1916
  return user_text
1900
1917
 
1918
+ planning_prompt = PLANNING_PROMPT
1919
+
1901
1920
  planning_messages = [
1902
- {"role": "system", "content": PLANNING_PROMPT},
1921
+ {"role": "system", "content": planning_prompt},
1903
1922
  {"role": "user", "content": user_text},
1904
1923
  ]
1905
1924
  if history:
@@ -2082,9 +2101,7 @@ def handle_task_end_command(md_path: Path, client: OpenAI, model: str, system_pr
2082
2101
  compiled_text = "\n\n".join(["## Round " + r for r in selected])
2083
2102
 
2084
2103
  # Build messages for the model
2085
- sys_prompt = (
2086
- t("task_end_system_prompt")
2087
- )
2104
+ sys_prompt = t("task_end_system_prompt")
2088
2105
 
2089
2106
  user_msg = (
2090
2107
  t("task_end_user_message", compiled_text=compiled_text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prompt-copilot-cli
3
- Version: 0.2.3
3
+ Version: 0.2.6
4
4
  Summary: A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration.
5
5
  Author: Jason Li
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "prompt-copilot-cli"
7
- version = "0.2.3"
7
+ version = "0.2.6"
8
8
  description = "A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,6 +1,7 @@
1
1
  import contextlib
2
2
  import io
3
3
  import sys
4
+ import tempfile
4
5
  import types
5
6
  import unittest
6
7
  from pathlib import Path
@@ -102,6 +103,42 @@ class CLITests(unittest.TestCase):
102
103
  self.assertEqual(captured["messages"][0]["role"], "system")
103
104
  self.assertEqual(captured["messages"][-1]["content"], "帮我修复这个 bug")
104
105
 
106
+ def test_task_end_command_uses_aligned_working_principles(self) -> None:
107
+ captured: dict[str, object] = {}
108
+
109
+ def fake_chat_once(client, model, messages, temperature, debug_enabled=False):
110
+ captured["messages"] = messages
111
+ return types.SimpleNamespace(content="final prompt")
112
+
113
+ original_chat_once = main.chat_once
114
+ original_lang = main.UI_SYSTEM_LANGUAGE
115
+ main.UI_SYSTEM_LANGUAGE = "zh"
116
+ main.chat_once = fake_chat_once
117
+ try:
118
+ with tempfile.TemporaryDirectory() as temp_dir:
119
+ md_path = Path(temp_dir) / "recent_conversations.md"
120
+ md_path.write_text(
121
+ "# Recent conversations\n\n## Round 1\n\n**User:** /task-start\n\nhello\n\n**Assistant:** hi",
122
+ encoding="utf-8",
123
+ )
124
+ main.handle_task_end_command(
125
+ md_path=md_path,
126
+ client=object(),
127
+ model="gpt-4o-mini",
128
+ system_prompt="ignored",
129
+ workdir=Path(temp_dir),
130
+ debug_enabled=False,
131
+ )
132
+ finally:
133
+ main.UI_SYSTEM_LANGUAGE = original_lang
134
+ main.chat_once = original_chat_once
135
+
136
+ self.assertIn("messages", captured)
137
+ system_prompt = captured["messages"][0]["content"]
138
+ self.assertIn("先检查工作目录并理解需求", system_prompt)
139
+ self.assertIn("生成最终提示词时,请严格遵循以下约束", system_prompt)
140
+ self.assertIn("\n\n", system_prompt)
141
+
105
142
  def test_version_flag_prints_application_version_and_exits(self) -> None:
106
143
  parser = main.build_cli_parser()
107
144
  output = io.StringIO()