prompt-copilot-cli 0.1.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jason Li
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include README.zh-CN.md
3
+ include LICENSE
4
+ include requirements.txt
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: prompt-copilot-cli
3
+ Version: 0.1.1
4
+ Summary: A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration.
5
+ Author: Jason Li
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/woshiliyihang/prompt-copilot-cli
8
+ Project-URL: Repository, https://github.com/woshiliyihang/prompt-copilot-cli
9
+ Project-URL: Issues, https://github.com/woshiliyihang/prompt-copilot-cli/issues
10
+ Keywords: cli,agent,openai,mcp,coding-assistant
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Utilities
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: mcp==1.28.0
24
+ Requires-Dist: openai==1.109.1
25
+ Requires-Dist: prompt_toolkit==3.0.52
26
+ Requires-Dist: rich==15.0.0
27
+ Dynamic: license-file
28
+
29
+ # Prompt Copilot CLI
30
+
31
+ Prompt Copilot CLI is a lightweight terminal-based coding agent for local development workflows. It combines an OpenAI-compatible model with a set of practical tools for file operations, shell commands, Python execution, multimodal image handling, and MCP integrations.
32
+
33
+ It is designed for developers who want an interactive coding assistant that can inspect a workspace, edit files, run commands, and help turn multi-step conversations into a final, actionable prompt.
34
+
35
+ ## ✨ Features
36
+
37
+ - Interactive CLI experience in the terminal
38
+ - Persistent session history and conversation logs
39
+ - File-system tools for reading, writing, deleting, renaming, copying, and recursive directory listing
40
+ - Shell command execution and Python script execution
41
+ - Image support for vision-capable models via image-to-base64 conversion
42
+ - MCP tool integration for extending the agent with external tools
43
+ - Task workflow with `/task-start` and `/task-end` to generate a polished final prompt
44
+
45
+ ## 🚀 Quick Start
46
+
47
+ ### 1. Install dependencies
48
+
49
+ ```powershell
50
+ py -m pip install -r requirements.txt
51
+ ```
52
+
53
+ ### 2. Configure the model
54
+
55
+ On first launch, the project creates a configuration file at:
56
+
57
+ - Windows: `%USERPROFILE%\.prompt-copilot\config.json`
58
+ - Linux/macOS: `~/.prompt-copilot/config.json`
59
+
60
+ Example:
61
+
62
+ ```json
63
+ {
64
+ "model": "gpt-4o-mini",
65
+ "base_url": "http://127.0.0.1:11434/v1",
66
+ "api_key": "dummy",
67
+ "temperature": 0.2,
68
+ "debug": false,
69
+ "mcp": {
70
+ "enabled": true,
71
+ "servers": []
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### 3. MCP configuration (optional)
77
+
78
+ The agent can discover and use external MCP tools through the `mcp.servers` array. This is useful when you want to extend the agent with tools such as web search, filesystem helpers, or other local services.
79
+
80
+ Example configuration:
81
+
82
+ ```json
83
+ {
84
+ "mcp": {
85
+ "enabled": true,
86
+ "servers": [
87
+ {
88
+ "name": "bing",
89
+ "command": "npx",
90
+ "args": ["-y", "bing-cn-mcp"]
91
+ },
92
+ {
93
+ "name": "open-websearch-http",
94
+ "transport": "http",
95
+ "url": "http://127.0.0.1:3000/mcp"
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ ```
101
+
102
+ How it works:
103
+
104
+ - The first server uses a local stdio-based MCP server launched by `npx`.
105
+ - The second server connects to an HTTP MCP endpoint at the given URL.
106
+ - Once discovered, the tools exposed by these servers become callable by the agent during a session.
107
+ - If `enabled` is set to `false` or the server list is empty, no MCP tools will be loaded.
108
+
109
+ ### 4. Run the agent
110
+
111
+ Interactive mode:
112
+
113
+ ```powershell
114
+ py main.py
115
+ ```
116
+
117
+ One-off task mode:
118
+
119
+ ```powershell
120
+ py main.py -t "Create a simple HTML landing page" -d ./workspace -l en
121
+ ```
122
+
123
+ ## 🧭 Usage Guide
124
+
125
+ ### Interactive commands
126
+
127
+ Once the CLI starts, you can use these commands:
128
+
129
+ - `/exit` — quit the program
130
+ - `/clear` — clear local session history
131
+ - `/task-start` — start a task context for later summarization
132
+ - `/task-end` — generate a final optimized prompt and save it to `last-prompt.md`
133
+
134
+ ### Common startup options
135
+
136
+ ```powershell
137
+ py main.py -h
138
+ ```
139
+
140
+ Key options:
141
+
142
+ - `-t, --task` — one-off task content
143
+ - `-d, --workdir` — working directory
144
+ - `-l, --lang` — language (`zh` or `en`)
145
+ - `-amc, --agent-messages-count` — number of messages kept in agent history
146
+ - `-rd, --request-delay` — delay between model requests in seconds
147
+ - `-hc, --history-count` — number of rounds kept in conversation history
148
+ - `--reset-session` — reset persisted session history
149
+
150
+ ### Example workflows
151
+
152
+ #### 1. Ask the agent to inspect a project
153
+
154
+ ```powershell
155
+ py main.py -t "Inspect this repository and summarize the main structure" -d ./workspace
156
+ ```
157
+
158
+ #### 2. Ask the agent to edit files and run tests
159
+
160
+ ```powershell
161
+ py main.py -t "Update the code, then run the relevant test suite" -d ./workspace
162
+ ```
163
+
164
+ #### 3. Ask the agent to analyze an image
165
+
166
+ If your model supports vision, the agent can use the built-in image tool to read an image file and convert it to base64 for multimodal input.
167
+
168
+ Example prompt:
169
+
170
+ ```text
171
+ Please inspect the image in ./workspace/demo.png and tell me what numbers or text are visible.
172
+ ```
173
+
174
+ ## 🛠 Tool capabilities
175
+
176
+ The agent can call the following tools:
177
+
178
+ - File tools
179
+ - `read_file`
180
+ - `write_file`
181
+ - `delete_file`
182
+ - `create_directory`
183
+ - `delete_directory`
184
+ - `rename_path`
185
+ - `copy_file`
186
+ - `list_dir` (with recursive option)
187
+ - Execution tools
188
+ - `execute_command`
189
+ - `execute_python_script`
190
+ - Multimodal tools
191
+ - `read_image_as_base64`
192
+
193
+ ## 🧠 Task flow
194
+
195
+ The project supports a lightweight task-iteration workflow:
196
+
197
+ 1. Start a round with `/task-start`
198
+ 2. Continue interacting with the agent to clarify requirements or refine the task
199
+ 3. Finish with `/task-end`
200
+ 4. The agent writes the final prompt to `last-prompt.md`
201
+
202
+ This is useful when you want to turn a long back-and-forth conversation into a compact, executable prompt.
203
+
204
+ ## 📁 Project structure
205
+
206
+ ```text
207
+ .
208
+ ├── main.py
209
+ ├── requirements.txt
210
+ ├── README.md
211
+ ├── README.zh-CN.md
212
+ ├── tests/
213
+ └── workspace/
214
+ ```
215
+
216
+ ## 🤝 Contributing
217
+
218
+ Contributions are welcome. Please feel free to open an issue or submit a pull request if you have suggestions, bug reports, or new workflow ideas.
219
+
220
+ ## 📄 License
221
+
222
+ This project does not currently declare a specific license. If you plan to distribute or reuse it publicly, please add an appropriate license file.
@@ -0,0 +1,194 @@
1
+ # Prompt Copilot CLI
2
+
3
+ Prompt Copilot CLI is a lightweight terminal-based coding agent for local development workflows. It combines an OpenAI-compatible model with a set of practical tools for file operations, shell commands, Python execution, multimodal image handling, and MCP integrations.
4
+
5
+ It is designed for developers who want an interactive coding assistant that can inspect a workspace, edit files, run commands, and help turn multi-step conversations into a final, actionable prompt.
6
+
7
+ ## ✨ Features
8
+
9
+ - Interactive CLI experience in the terminal
10
+ - Persistent session history and conversation logs
11
+ - File-system tools for reading, writing, deleting, renaming, copying, and recursive directory listing
12
+ - Shell command execution and Python script execution
13
+ - Image support for vision-capable models via image-to-base64 conversion
14
+ - MCP tool integration for extending the agent with external tools
15
+ - Task workflow with `/task-start` and `/task-end` to generate a polished final prompt
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ### 1. Install dependencies
20
+
21
+ ```powershell
22
+ py -m pip install -r requirements.txt
23
+ ```
24
+
25
+ ### 2. Configure the model
26
+
27
+ On first launch, the project creates a configuration file at:
28
+
29
+ - Windows: `%USERPROFILE%\.prompt-copilot\config.json`
30
+ - Linux/macOS: `~/.prompt-copilot/config.json`
31
+
32
+ Example:
33
+
34
+ ```json
35
+ {
36
+ "model": "gpt-4o-mini",
37
+ "base_url": "http://127.0.0.1:11434/v1",
38
+ "api_key": "dummy",
39
+ "temperature": 0.2,
40
+ "debug": false,
41
+ "mcp": {
42
+ "enabled": true,
43
+ "servers": []
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### 3. MCP configuration (optional)
49
+
50
+ The agent can discover and use external MCP tools through the `mcp.servers` array. This is useful when you want to extend the agent with tools such as web search, filesystem helpers, or other local services.
51
+
52
+ Example configuration:
53
+
54
+ ```json
55
+ {
56
+ "mcp": {
57
+ "enabled": true,
58
+ "servers": [
59
+ {
60
+ "name": "bing",
61
+ "command": "npx",
62
+ "args": ["-y", "bing-cn-mcp"]
63
+ },
64
+ {
65
+ "name": "open-websearch-http",
66
+ "transport": "http",
67
+ "url": "http://127.0.0.1:3000/mcp"
68
+ }
69
+ ]
70
+ }
71
+ }
72
+ ```
73
+
74
+ How it works:
75
+
76
+ - The first server uses a local stdio-based MCP server launched by `npx`.
77
+ - The second server connects to an HTTP MCP endpoint at the given URL.
78
+ - Once discovered, the tools exposed by these servers become callable by the agent during a session.
79
+ - If `enabled` is set to `false` or the server list is empty, no MCP tools will be loaded.
80
+
81
+ ### 4. Run the agent
82
+
83
+ Interactive mode:
84
+
85
+ ```powershell
86
+ py main.py
87
+ ```
88
+
89
+ One-off task mode:
90
+
91
+ ```powershell
92
+ py main.py -t "Create a simple HTML landing page" -d ./workspace -l en
93
+ ```
94
+
95
+ ## 🧭 Usage Guide
96
+
97
+ ### Interactive commands
98
+
99
+ Once the CLI starts, you can use these commands:
100
+
101
+ - `/exit` — quit the program
102
+ - `/clear` — clear local session history
103
+ - `/task-start` — start a task context for later summarization
104
+ - `/task-end` — generate a final optimized prompt and save it to `last-prompt.md`
105
+
106
+ ### Common startup options
107
+
108
+ ```powershell
109
+ py main.py -h
110
+ ```
111
+
112
+ Key options:
113
+
114
+ - `-t, --task` — one-off task content
115
+ - `-d, --workdir` — working directory
116
+ - `-l, --lang` — language (`zh` or `en`)
117
+ - `-amc, --agent-messages-count` — number of messages kept in agent history
118
+ - `-rd, --request-delay` — delay between model requests in seconds
119
+ - `-hc, --history-count` — number of rounds kept in conversation history
120
+ - `--reset-session` — reset persisted session history
121
+
122
+ ### Example workflows
123
+
124
+ #### 1. Ask the agent to inspect a project
125
+
126
+ ```powershell
127
+ py main.py -t "Inspect this repository and summarize the main structure" -d ./workspace
128
+ ```
129
+
130
+ #### 2. Ask the agent to edit files and run tests
131
+
132
+ ```powershell
133
+ py main.py -t "Update the code, then run the relevant test suite" -d ./workspace
134
+ ```
135
+
136
+ #### 3. Ask the agent to analyze an image
137
+
138
+ If your model supports vision, the agent can use the built-in image tool to read an image file and convert it to base64 for multimodal input.
139
+
140
+ Example prompt:
141
+
142
+ ```text
143
+ Please inspect the image in ./workspace/demo.png and tell me what numbers or text are visible.
144
+ ```
145
+
146
+ ## 🛠 Tool capabilities
147
+
148
+ The agent can call the following tools:
149
+
150
+ - File tools
151
+ - `read_file`
152
+ - `write_file`
153
+ - `delete_file`
154
+ - `create_directory`
155
+ - `delete_directory`
156
+ - `rename_path`
157
+ - `copy_file`
158
+ - `list_dir` (with recursive option)
159
+ - Execution tools
160
+ - `execute_command`
161
+ - `execute_python_script`
162
+ - Multimodal tools
163
+ - `read_image_as_base64`
164
+
165
+ ## 🧠 Task flow
166
+
167
+ The project supports a lightweight task-iteration workflow:
168
+
169
+ 1. Start a round with `/task-start`
170
+ 2. Continue interacting with the agent to clarify requirements or refine the task
171
+ 3. Finish with `/task-end`
172
+ 4. The agent writes the final prompt to `last-prompt.md`
173
+
174
+ This is useful when you want to turn a long back-and-forth conversation into a compact, executable prompt.
175
+
176
+ ## 📁 Project structure
177
+
178
+ ```text
179
+ .
180
+ ├── main.py
181
+ ├── requirements.txt
182
+ ├── README.md
183
+ ├── README.zh-CN.md
184
+ ├── tests/
185
+ └── workspace/
186
+ ```
187
+
188
+ ## 🤝 Contributing
189
+
190
+ Contributions are welcome. Please feel free to open an issue or submit a pull request if you have suggestions, bug reports, or new workflow ideas.
191
+
192
+ ## 📄 License
193
+
194
+ This project does not currently declare a specific license. If you plan to distribute or reuse it publicly, please add an appropriate license file.
@@ -0,0 +1,194 @@
1
+ # Prompt Copilot CLI
2
+
3
+ Prompt Copilot CLI 是一个轻量级的终端编程 Agent,适合本地开发场景。它将 OpenAI 兼容模型与一组实用工具结合起来,包括文件操作、命令执行、Python 脚本运行、多模态图片处理以及 MCP 工具扩展。
4
+
5
+ 它适合希望在终端中进行交互式开发、查看项目结构、修改文件、运行命令,并把多轮对话整理成最终可执行提示词的开发者。
6
+
7
+ ## ✨ 功能特性
8
+
9
+ - 终端交互式 CLI
10
+ - 持久化会话历史与对话记录
11
+ - 文件系统工具:读取、写入、删除、重命名、复制、递归列出目录
12
+ - 命令执行与 Python 脚本执行
13
+ - 支持视觉模型的图片处理:将图片读取并转成 base64
14
+ - MCP 工具集成,便于扩展外部能力
15
+ - 支持 `/task-start` 和 `/task-end` 的任务流,生成最终优化提示词
16
+
17
+ ## 🚀 快速开始
18
+
19
+ ### 1. 安装依赖
20
+
21
+ ```powershell
22
+ py -m pip install -r requirements.txt
23
+ ```
24
+
25
+ ### 2. 配置模型
26
+
27
+ 首次运行时,项目会在如下位置生成配置文件:
28
+
29
+ - Windows: `%USERPROFILE%\.prompt-copilot\config.json`
30
+ - Linux/macOS: `~/.prompt-copilot/config.json`
31
+
32
+ 示例配置:
33
+
34
+ ```json
35
+ {
36
+ "model": "gpt-4o-mini",
37
+ "base_url": "http://127.0.0.1:11434/v1",
38
+ "api_key": "dummy",
39
+ "temperature": 0.2,
40
+ "debug": false,
41
+ "mcp": {
42
+ "enabled": true,
43
+ "servers": []
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### 3. MCP 配置(可选)
49
+
50
+ Agent 可以通过 `mcp.servers` 数组发现并调用外部 MCP 工具。这个能力适合接入网页搜索、外部服务、辅助工具等扩展能力。
51
+
52
+ 配置示例:
53
+
54
+ ```json
55
+ {
56
+ "mcp": {
57
+ "enabled": true,
58
+ "servers": [
59
+ {
60
+ "name": "bing",
61
+ "command": "npx",
62
+ "args": ["-y", "bing-cn-mcp"]
63
+ },
64
+ {
65
+ "name": "open-websearch-http",
66
+ "transport": "http",
67
+ "url": "http://127.0.0.1:3000/mcp"
68
+ }
69
+ ]
70
+ }
71
+ }
72
+ ```
73
+
74
+ 说明:
75
+
76
+ - 第一个示例是通过 `npx` 启动一个本地 stdio 类型的 MCP 服务。
77
+ - 第二个示例是连接到一个 HTTP 类型的 MCP 服务端点。
78
+ - 一旦这些服务被发现,Agent 就可以在会话中调用它们暴露出来的工具。
79
+ - 如果 `enabled` 设为 `false`,或者 `servers` 为空,则不会加载任何 MCP 工具。
80
+
81
+ ### 4. 启动 Agent
82
+
83
+ 交互模式:
84
+
85
+ ```powershell
86
+ py main.py
87
+ ```
88
+
89
+ 单次任务模式:
90
+
91
+ ```powershell
92
+ py main.py -t "创建一个简单的 HTML 落地页" -d ./workspace -l zh
93
+ ```
94
+
95
+ ## 🧭 使用说明
96
+
97
+ ### 交互命令
98
+
99
+ 启动后可以使用以下命令:
100
+
101
+ - `/exit`:退出程序
102
+ - `/clear`:清空本地会话历史
103
+ - `/task-start`:开始任务上下文
104
+ - `/task-end`:生成最终优化提示词并写入 `last-prompt.md`
105
+
106
+ ### 常用启动参数
107
+
108
+ ```powershell
109
+ py main.py -h
110
+ ```
111
+
112
+ 主要参数:
113
+
114
+ - `-t, --task`:一次性任务内容
115
+ - `-d, --workdir`:工作目录
116
+ - `-l, --lang`:语言(`zh` 或 `en`)
117
+ - `-amc, --agent-messages-count`:保留在 Agent 历史中的消息数量
118
+ - `-rd, --request-delay`:模型请求之间的间隔秒数
119
+ - `-hc, --history-count`:会话历史保留的轮次数量
120
+ - `--reset-session`:重置本地持久化会话记录
121
+
122
+ ### 示例场景
123
+
124
+ #### 1. 检查项目结构
125
+
126
+ ```powershell
127
+ py main.py -t "检查这个仓库并总结主要结构" -d ./workspace
128
+ ```
129
+
130
+ #### 2. 编辑文件并执行测试
131
+
132
+ ```powershell
133
+ py main.py -t "修改代码并运行相关测试" -d ./workspace
134
+ ```
135
+
136
+ #### 3. 分析图片内容
137
+
138
+ 如果你的模型支持视觉能力,Agent 可以调用图片工具读取图片并将其转换成 base64 供多模态模型分析。
139
+
140
+ 例如:
141
+
142
+ ```text
143
+ 请看一下 ./workspace/demo.png 中能看到哪些数字或文字。
144
+ ```
145
+
146
+ ## 🛠 工具能力
147
+
148
+ Agent 可以调用这些工具:
149
+
150
+ - 文件工具
151
+ - `read_file`
152
+ - `write_file`
153
+ - `delete_file`
154
+ - `create_directory`
155
+ - `delete_directory`
156
+ - `rename_path`
157
+ - `copy_file`
158
+ - `list_dir`(支持递归)
159
+ - 执行工具
160
+ - `execute_command`
161
+ - `execute_python_script`
162
+ - 多模态工具
163
+ - `read_image_as_base64`
164
+
165
+ ## 🧠 任务流
166
+
167
+ 项目支持一种轻量的任务迭代流程:
168
+
169
+ 1. 用 `/task-start` 开始一轮任务
170
+ 2. 与 Agent 连续沟通,澄清需求或修正目标
171
+ 3. 用 `/task-end` 结束任务
172
+ 4. 最终提示词被写入 `last-prompt.md`
173
+
174
+ 这对于将多轮对话整理成一条可直接执行的提示词非常有帮助。
175
+
176
+ ## 📁 项目结构
177
+
178
+ ```text
179
+ .
180
+ ├── main.py
181
+ ├── requirements.txt
182
+ ├── README.md
183
+ ├── README.zh-CN.md
184
+ ├── tests/
185
+ └── workspace/
186
+ ```
187
+
188
+ ## 🤝 参与贡献
189
+
190
+ 欢迎提交 Issue、PR 或建议。如果你有新的功能想法、错误反馈或改进建议,欢迎一起参与。
191
+
192
+ ## 📄 许可证
193
+
194
+ 当前项目尚未声明特定许可证。如果你准备公开分发或复用,请补充合适的许可证文件。