repopilot-agent 0.1.0__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 (72) hide show
  1. repopilot_agent-0.1.0/LICENSE +21 -0
  2. repopilot_agent-0.1.0/PKG-INFO +272 -0
  3. repopilot_agent-0.1.0/README.md +226 -0
  4. repopilot_agent-0.1.0/pyproject.toml +74 -0
  5. repopilot_agent-0.1.0/repopilot/__init__.py +3 -0
  6. repopilot_agent-0.1.0/repopilot/__main__.py +3 -0
  7. repopilot_agent-0.1.0/repopilot/agent/__init__.py +0 -0
  8. repopilot_agent-0.1.0/repopilot/agent/compact.py +192 -0
  9. repopilot_agent-0.1.0/repopilot/agent/context.py +236 -0
  10. repopilot_agent-0.1.0/repopilot/agent/cost.py +119 -0
  11. repopilot_agent-0.1.0/repopilot/agent/loop.py +387 -0
  12. repopilot_agent-0.1.0/repopilot/agent/parser.py +152 -0
  13. repopilot_agent-0.1.0/repopilot/cli.py +396 -0
  14. repopilot_agent-0.1.0/repopilot/code_index/__init__.py +8 -0
  15. repopilot_agent-0.1.0/repopilot/code_index/ignore.py +121 -0
  16. repopilot_agent-0.1.0/repopilot/code_index/repo_map.py +81 -0
  17. repopilot_agent-0.1.0/repopilot/code_index/symbol_index.py +177 -0
  18. repopilot_agent-0.1.0/repopilot/config.py +235 -0
  19. repopilot_agent-0.1.0/repopilot/hooks/__init__.py +9 -0
  20. repopilot_agent-0.1.0/repopilot/hooks/builtin.py +57 -0
  21. repopilot_agent-0.1.0/repopilot/hooks/manager.py +102 -0
  22. repopilot_agent-0.1.0/repopilot/llm/__init__.py +10 -0
  23. repopilot_agent-0.1.0/repopilot/llm/circuit_breaker.py +76 -0
  24. repopilot_agent-0.1.0/repopilot/llm/service.py +224 -0
  25. repopilot_agent-0.1.0/repopilot/llm/stream_handler.py +54 -0
  26. repopilot_agent-0.1.0/repopilot/logging_setup.py +49 -0
  27. repopilot_agent-0.1.0/repopilot/memory/__init__.py +131 -0
  28. repopilot_agent-0.1.0/repopilot/permission/__init__.py +21 -0
  29. repopilot_agent-0.1.0/repopilot/permission/approver.py +108 -0
  30. repopilot_agent-0.1.0/repopilot/permission/engine.py +201 -0
  31. repopilot_agent-0.1.0/repopilot/permission/patterns.py +325 -0
  32. repopilot_agent-0.1.0/repopilot/repl.py +522 -0
  33. repopilot_agent-0.1.0/repopilot/sandbox/__init__.py +6 -0
  34. repopilot_agent-0.1.0/repopilot/sandbox/base.py +158 -0
  35. repopilot_agent-0.1.0/repopilot/sandbox/docker_sandbox.py +389 -0
  36. repopilot_agent-0.1.0/repopilot/sandbox/local_sandbox.py +278 -0
  37. repopilot_agent-0.1.0/repopilot/session/__init__.py +3 -0
  38. repopilot_agent-0.1.0/repopilot/session/store.py +292 -0
  39. repopilot_agent-0.1.0/repopilot/tools/__init__.py +34 -0
  40. repopilot_agent-0.1.0/repopilot/tools/base.py +69 -0
  41. repopilot_agent-0.1.0/repopilot/tools/exec_tools.py +193 -0
  42. repopilot_agent-0.1.0/repopilot/tools/file_tools.py +170 -0
  43. repopilot_agent-0.1.0/repopilot/tools/meta_tools.py +41 -0
  44. repopilot_agent-0.1.0/repopilot/tools/registry.py +104 -0
  45. repopilot_agent-0.1.0/repopilot/tools/result.py +61 -0
  46. repopilot_agent-0.1.0/repopilot/tools/search_tools.py +221 -0
  47. repopilot_agent-0.1.0/repopilot_agent.egg-info/PKG-INFO +272 -0
  48. repopilot_agent-0.1.0/repopilot_agent.egg-info/SOURCES.txt +70 -0
  49. repopilot_agent-0.1.0/repopilot_agent.egg-info/dependency_links.txt +1 -0
  50. repopilot_agent-0.1.0/repopilot_agent.egg-info/entry_points.txt +2 -0
  51. repopilot_agent-0.1.0/repopilot_agent.egg-info/requires.txt +24 -0
  52. repopilot_agent-0.1.0/repopilot_agent.egg-info/top_level.txt +1 -0
  53. repopilot_agent-0.1.0/setup.cfg +4 -0
  54. repopilot_agent-0.1.0/tests/test_circuit_breaker.py +65 -0
  55. repopilot_agent-0.1.0/tests/test_cli.py +45 -0
  56. repopilot_agent-0.1.0/tests/test_config.py +169 -0
  57. repopilot_agent-0.1.0/tests/test_context.py +295 -0
  58. repopilot_agent-0.1.0/tests/test_cost.py +88 -0
  59. repopilot_agent-0.1.0/tests/test_docker_sandbox.py +91 -0
  60. repopilot_agent-0.1.0/tests/test_exec_tools.py +152 -0
  61. repopilot_agent-0.1.0/tests/test_file_tools.py +135 -0
  62. repopilot_agent-0.1.0/tests/test_hooks.py +96 -0
  63. repopilot_agent-0.1.0/tests/test_llm.py +164 -0
  64. repopilot_agent-0.1.0/tests/test_local_sandbox.py +169 -0
  65. repopilot_agent-0.1.0/tests/test_loop_mock.py +316 -0
  66. repopilot_agent-0.1.0/tests/test_permission.py +346 -0
  67. repopilot_agent-0.1.0/tests/test_repo_map.py +175 -0
  68. repopilot_agent-0.1.0/tests/test_search_tools.py +162 -0
  69. repopilot_agent-0.1.0/tests/test_security_fixes.py +108 -0
  70. repopilot_agent-0.1.0/tests/test_session.py +265 -0
  71. repopilot_agent-0.1.0/tests/test_tools.py +218 -0
  72. repopilot_agent-0.1.0/tests/test_tools_edge.py +325 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZhangYang2297
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,272 @@
1
+ Metadata-Version: 2.4
2
+ Name: repopilot-agent
3
+ Version: 0.1.0
4
+ Summary: Local-first AI code agent in your terminal. Inspired by Claude Code and Codex CLI.
5
+ Author: ZhangYang2297
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ZhangYang2297/repopilot
8
+ Project-URL: Repository, https://github.com/ZhangYang2297/repopilot
9
+ Project-URL: Issues, https://github.com/ZhangYang2297/repopilot/issues
10
+ Keywords: ai,code-agent,cli,coding-assistant,llm,developer-tools
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Code Generators
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: typer>=0.12
25
+ Requires-Dist: rich>=13
26
+ Requires-Dist: prompt-toolkit>=3.0
27
+ Requires-Dist: litellm>=1.40
28
+ Requires-Dist: openai>=1.30
29
+ Requires-Dist: docker>=7.0
30
+ Requires-Dist: tree-sitter<0.22,>=0.21
31
+ Requires-Dist: tree-sitter-python<0.22,>=0.21
32
+ Requires-Dist: pathspec>=0.12
33
+ Requires-Dist: structlog>=24.0
34
+ Requires-Dist: pyyaml>=6.0
35
+ Requires-Dist: jinja2>=3.1
36
+ Requires-Dist: httpx>=0.27
37
+ Requires-Dist: diskcache>=5.6
38
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=8.0; extra == "dev"
41
+ Requires-Dist: pytest-timeout; extra == "dev"
42
+ Requires-Dist: pytest-cov; extra == "dev"
43
+ Requires-Dist: ruff>=0.5; extra == "dev"
44
+ Requires-Dist: ipython; extra == "dev"
45
+ Dynamic: license-file
46
+
47
+ <div align="center">
48
+
49
+ # RepoPilot
50
+
51
+ **Local-first AI code agent in your terminal.**
52
+
53
+ [English](README.md) | [中文](README.zh-CN.md)
54
+
55
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org)
56
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
57
+ [![PyPI version](https://img.shields.io/pypi/v/repopilot-agent.svg)](https://pypi.org/project/repopilot-agent/)
58
+
59
+ </div>
60
+
61
+ ## What is RepoPilot?
62
+
63
+ RepoPilot is a CLI coding agent inspired by Claude Code and Codex CLI. Navigate to any project, run `repopilot`, and describe what you want done in natural language — RepoPilot reads, searches, edits, runs tests, and fixes bugs autonomously in a sandboxed environment.
64
+
65
+ ```
66
+ $ cd your-project
67
+ $ repopilot
68
+
69
+ ────────────────────────────── RepoPilot ──────────────────────────────
70
+ Directory: /your-project
71
+ Model: doubao-seed-evolving
72
+ Sandbox: local
73
+ Approval: auto
74
+
75
+ Type /help for commands, /exit to quit.
76
+
77
+ repopilot> fix the failing test in test_auth.py
78
+ > read_file(path=test_auth.py)
79
+ > bash(command=python -m pytest test_auth.py -v)
80
+ > edit_file(path=auth.py, ...)
81
+ > bash(command=python -m pytest test_auth.py -v)
82
+
83
+ All tests pass. Fixed the token validation bug in auth.py line 42.
84
+ ```
85
+
86
+ ## Features
87
+
88
+ - **Claude Code / Codex CLI style REPL** — `cd project && repopilot`, start chatting immediately
89
+ - **Pure ReAct agent loop** — single model does all thinking, no multi-agent overhead
90
+ - **Persistent multi-turn conversation** with automatic context compaction
91
+ - **Layered memory system** — global + project `REPOPILOT.md` files (like CLAUDE.md)
92
+ - **Cross-session resume** — `/resume` to continue where you left off
93
+ - **Docker sandbox** with CPU/memory limits and optional network isolation
94
+ - **4 approval modes**: auto / confirm / edit-only / deny
95
+ - **Dangerous command blacklist** (path traversal, `rm -rf /`, `curl|sh`, force push, credential theft)
96
+ - **10 built-in tools**: read/write/edit/grep/glob/list_dir/bash/run_python/repo_tree/finish
97
+ - **tree-sitter repo map** — code structure overview without reading every file
98
+ - **Circuit breaker + exponential backoff** for reliable LLM calls
99
+ - **Cross-platform** — Windows / Linux / macOS with automatic Unix→Windows command translation
100
+ - **Any OpenAI-compatible LLM** — use your own API key (Doubao, DeepSeek, OpenAI, vLLM, local models, etc.)
101
+ - **No RAG / no vector database** — deterministic grep/glob/tree-sitter retrieval is faster and more accurate for code
102
+
103
+ ## Installation
104
+
105
+ ```bash
106
+ pip install repopilot-agent
107
+ ```
108
+
109
+ Or install the latest version directly from GitHub:
110
+
111
+ ```bash
112
+ pip install git+https://github.com/ZhangYang2297/repopilot.git
113
+ ```
114
+
115
+ For an isolated install (recommended for CLI tools):
116
+
117
+ ```bash
118
+ pipx install repopilot-agent
119
+ ```
120
+
121
+ **Requirements**: Python 3.10+
122
+
123
+ ### First Run
124
+
125
+ On first run you will be prompted for your LLM configuration:
126
+
127
+ 1. **Model name** (e.g. `openai/doubao-seed-evolving`, `openai/gpt-4o`, `openai/deepseek-chat`)
128
+ 2. **API key** (sk-...)
129
+ 3. **Base URL** (for providers other than OpenAI, e.g. `https://ark.cn-beijing.volces.com/api/v3`)
130
+
131
+ You can also configure via environment variables:
132
+
133
+ ```bash
134
+ export REPOPILOT_MODEL=openai/doubao-seed-evolving
135
+ export REPOPILOT_API_KEY=sk-your-key
136
+ export REPOPILOT_BASE_URL=https://ark.cn-beijing.volces.com/api/v3
137
+ ```
138
+
139
+ ## Usage
140
+
141
+ ### Interactive Mode (Recommended)
142
+
143
+ ```bash
144
+ cd your-project
145
+ repopilot # current directory, local sandbox, auto approval
146
+ repopilot -r ../other-proj # specify a different project directory
147
+ repopilot --sandbox docker # run inside a Docker container
148
+ repopilot --approval-mode confirm # confirm before writes/executions
149
+ repopilot -m openai/gpt-4o # override model
150
+ ```
151
+
152
+ ### One-shot Task Mode
153
+
154
+ ```bash
155
+ repopilot chat "fix the bug in auth.py"
156
+ repopilot chat "add --verbose flag to cli.py" -r ./myproj
157
+ ```
158
+
159
+ ### Slash Commands
160
+
161
+ | Command | Description |
162
+ |---------|-------------|
163
+ | `/exit`, `/quit` | Exit (Ctrl+C / Ctrl+D also supported) |
164
+ | `/help` | Show help |
165
+ | `/model [name]` | Show or switch model |
166
+ | `/approval [mode]` | Switch approval mode |
167
+ | `/compact` | Trigger context compaction |
168
+ | `/clear` | Start fresh conversation |
169
+ | `/cd [path]` | Switch working directory |
170
+ | `/memory [note]` | Show or add memory notes |
171
+ | `/resume [id]` | Resume a previous session |
172
+ | `/sessions` | List recent sessions |
173
+ | `/cost` | Show token usage/cost |
174
+ | `/status` | Show current configuration |
175
+
176
+ ### Project Memory (REPOPILOT.md)
177
+
178
+ Create a `REPOPILOT.md` in your project root to give RepoPilot persistent instructions:
179
+
180
+ ```markdown
181
+ # Project Memory
182
+
183
+ ## Build/Test
184
+ - Test: python -m pytest tests/ -v
185
+ - Lint: ruff check .
186
+
187
+ ## Conventions
188
+ - Use type hints on all functions
189
+ - Never modify files in migrations/
190
+ ```
191
+
192
+ Global memory lives at `~/.repopilot/REPOPILOT.md` and applies across all projects.
193
+
194
+ ## Configuration
195
+
196
+ Config file: `~/.repopilot/config.toml`
197
+
198
+ ```toml
199
+ [core]
200
+ model = "openai/doubao-seed-evolving"
201
+ api_key = "sk-..."
202
+ base_url = "https://ark.cn-beijing.volces.com/api/v3"
203
+ sandbox_type = "local"
204
+ approval_mode = "auto"
205
+ max_steps = 200
206
+ budget_tokens = 500000
207
+ tool_timeout = 120
208
+ ```
209
+
210
+ Manage config via CLI:
211
+
212
+ ```bash
213
+ repopilot config show
214
+ repopilot config set model openai/gpt-4o
215
+ repopilot config init # re-run setup wizard
216
+ repopilot models # list recommended models
217
+ ```
218
+
219
+ ## Architecture
220
+
221
+ ```
222
+ ┌─────────────────────────────────┐
223
+ │ CLI (Typer + Rich) REPL │
224
+ ├─────────────────────────────────┤
225
+ │ Agent Loop (ReAct) │
226
+ ├─────────────────────────────────┤
227
+ │ Context Manager L0-L5 memory │
228
+ ├─────────────────────────────────┤
229
+ │ Tool Registry + Permission │
230
+ ├─────────────────────────────────┤
231
+ │ Sandbox (Local / Docker) │
232
+ ├─────────────────────────────────┤
233
+ │ LLM Service (LiteLLM) │
234
+ └─────────────────────────────────┘
235
+ ```
236
+
237
+ ## Built-in Tools
238
+
239
+ | Tool | Description |
240
+ |------|-------------|
241
+ | `read_file` | Read a file (with optional line range and offset limit) |
242
+ | `write_file` | Write content to a file (creates or overwrites) |
243
+ | `edit_file` | Find-and-replace edit (string replacement) |
244
+ | `grep_search` | Search file contents with regex |
245
+ | `glob` | Find files by glob pattern |
246
+ | `list_dir` | List directory contents |
247
+ | `repo_tree` | Show tree-sitter generated repository map |
248
+ | `bash` | Execute a shell command (sandboxed) |
249
+ | `run_python` | Execute Python code in an isolated temp file |
250
+ | `finish` | Signal task completion and return to user |
251
+
252
+ ## Supported LLM Providers
253
+
254
+ Any OpenAI-compatible endpoint works out of the box via [LiteLLM](https://docs.litellm.ai/):
255
+
256
+ - **Volcengine ARK (Doubao)** — recommended, tested extensively
257
+ - **OpenAI** (GPT-4o, GPT-4, o1, etc.)
258
+ - **DeepSeek** (deepseek-chat, deepseek-reasoner)
259
+ - **Alibaba Qwen** (qwen2.5-coder series)
260
+ - **Zhipu GLM** (glm-4, glm-5 series)
261
+ - **Local models** via vLLM / Ollama / llama.cpp (any OpenAI-compatible server)
262
+ - **Anthropic Claude** (via LiteLLM)
263
+
264
+ ## License
265
+
266
+ MIT — see [LICENSE](LICENSE) for details.
267
+
268
+ ## Acknowledgements
269
+
270
+ Built after studying Claude Code (Anthropic), Codex CLI (OpenAI), and the SWE-bench / SWE-agent research.
271
+
272
+
@@ -0,0 +1,226 @@
1
+ <div align="center">
2
+
3
+ # RepoPilot
4
+
5
+ **Local-first AI code agent in your terminal.**
6
+
7
+ [English](README.md) | [中文](README.zh-CN.md)
8
+
9
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org)
10
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
11
+ [![PyPI version](https://img.shields.io/pypi/v/repopilot-agent.svg)](https://pypi.org/project/repopilot-agent/)
12
+
13
+ </div>
14
+
15
+ ## What is RepoPilot?
16
+
17
+ RepoPilot is a CLI coding agent inspired by Claude Code and Codex CLI. Navigate to any project, run `repopilot`, and describe what you want done in natural language — RepoPilot reads, searches, edits, runs tests, and fixes bugs autonomously in a sandboxed environment.
18
+
19
+ ```
20
+ $ cd your-project
21
+ $ repopilot
22
+
23
+ ────────────────────────────── RepoPilot ──────────────────────────────
24
+ Directory: /your-project
25
+ Model: doubao-seed-evolving
26
+ Sandbox: local
27
+ Approval: auto
28
+
29
+ Type /help for commands, /exit to quit.
30
+
31
+ repopilot> fix the failing test in test_auth.py
32
+ > read_file(path=test_auth.py)
33
+ > bash(command=python -m pytest test_auth.py -v)
34
+ > edit_file(path=auth.py, ...)
35
+ > bash(command=python -m pytest test_auth.py -v)
36
+
37
+ All tests pass. Fixed the token validation bug in auth.py line 42.
38
+ ```
39
+
40
+ ## Features
41
+
42
+ - **Claude Code / Codex CLI style REPL** — `cd project && repopilot`, start chatting immediately
43
+ - **Pure ReAct agent loop** — single model does all thinking, no multi-agent overhead
44
+ - **Persistent multi-turn conversation** with automatic context compaction
45
+ - **Layered memory system** — global + project `REPOPILOT.md` files (like CLAUDE.md)
46
+ - **Cross-session resume** — `/resume` to continue where you left off
47
+ - **Docker sandbox** with CPU/memory limits and optional network isolation
48
+ - **4 approval modes**: auto / confirm / edit-only / deny
49
+ - **Dangerous command blacklist** (path traversal, `rm -rf /`, `curl|sh`, force push, credential theft)
50
+ - **10 built-in tools**: read/write/edit/grep/glob/list_dir/bash/run_python/repo_tree/finish
51
+ - **tree-sitter repo map** — code structure overview without reading every file
52
+ - **Circuit breaker + exponential backoff** for reliable LLM calls
53
+ - **Cross-platform** — Windows / Linux / macOS with automatic Unix→Windows command translation
54
+ - **Any OpenAI-compatible LLM** — use your own API key (Doubao, DeepSeek, OpenAI, vLLM, local models, etc.)
55
+ - **No RAG / no vector database** — deterministic grep/glob/tree-sitter retrieval is faster and more accurate for code
56
+
57
+ ## Installation
58
+
59
+ ```bash
60
+ pip install repopilot-agent
61
+ ```
62
+
63
+ Or install the latest version directly from GitHub:
64
+
65
+ ```bash
66
+ pip install git+https://github.com/ZhangYang2297/repopilot.git
67
+ ```
68
+
69
+ For an isolated install (recommended for CLI tools):
70
+
71
+ ```bash
72
+ pipx install repopilot-agent
73
+ ```
74
+
75
+ **Requirements**: Python 3.10+
76
+
77
+ ### First Run
78
+
79
+ On first run you will be prompted for your LLM configuration:
80
+
81
+ 1. **Model name** (e.g. `openai/doubao-seed-evolving`, `openai/gpt-4o`, `openai/deepseek-chat`)
82
+ 2. **API key** (sk-...)
83
+ 3. **Base URL** (for providers other than OpenAI, e.g. `https://ark.cn-beijing.volces.com/api/v3`)
84
+
85
+ You can also configure via environment variables:
86
+
87
+ ```bash
88
+ export REPOPILOT_MODEL=openai/doubao-seed-evolving
89
+ export REPOPILOT_API_KEY=sk-your-key
90
+ export REPOPILOT_BASE_URL=https://ark.cn-beijing.volces.com/api/v3
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ ### Interactive Mode (Recommended)
96
+
97
+ ```bash
98
+ cd your-project
99
+ repopilot # current directory, local sandbox, auto approval
100
+ repopilot -r ../other-proj # specify a different project directory
101
+ repopilot --sandbox docker # run inside a Docker container
102
+ repopilot --approval-mode confirm # confirm before writes/executions
103
+ repopilot -m openai/gpt-4o # override model
104
+ ```
105
+
106
+ ### One-shot Task Mode
107
+
108
+ ```bash
109
+ repopilot chat "fix the bug in auth.py"
110
+ repopilot chat "add --verbose flag to cli.py" -r ./myproj
111
+ ```
112
+
113
+ ### Slash Commands
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `/exit`, `/quit` | Exit (Ctrl+C / Ctrl+D also supported) |
118
+ | `/help` | Show help |
119
+ | `/model [name]` | Show or switch model |
120
+ | `/approval [mode]` | Switch approval mode |
121
+ | `/compact` | Trigger context compaction |
122
+ | `/clear` | Start fresh conversation |
123
+ | `/cd [path]` | Switch working directory |
124
+ | `/memory [note]` | Show or add memory notes |
125
+ | `/resume [id]` | Resume a previous session |
126
+ | `/sessions` | List recent sessions |
127
+ | `/cost` | Show token usage/cost |
128
+ | `/status` | Show current configuration |
129
+
130
+ ### Project Memory (REPOPILOT.md)
131
+
132
+ Create a `REPOPILOT.md` in your project root to give RepoPilot persistent instructions:
133
+
134
+ ```markdown
135
+ # Project Memory
136
+
137
+ ## Build/Test
138
+ - Test: python -m pytest tests/ -v
139
+ - Lint: ruff check .
140
+
141
+ ## Conventions
142
+ - Use type hints on all functions
143
+ - Never modify files in migrations/
144
+ ```
145
+
146
+ Global memory lives at `~/.repopilot/REPOPILOT.md` and applies across all projects.
147
+
148
+ ## Configuration
149
+
150
+ Config file: `~/.repopilot/config.toml`
151
+
152
+ ```toml
153
+ [core]
154
+ model = "openai/doubao-seed-evolving"
155
+ api_key = "sk-..."
156
+ base_url = "https://ark.cn-beijing.volces.com/api/v3"
157
+ sandbox_type = "local"
158
+ approval_mode = "auto"
159
+ max_steps = 200
160
+ budget_tokens = 500000
161
+ tool_timeout = 120
162
+ ```
163
+
164
+ Manage config via CLI:
165
+
166
+ ```bash
167
+ repopilot config show
168
+ repopilot config set model openai/gpt-4o
169
+ repopilot config init # re-run setup wizard
170
+ repopilot models # list recommended models
171
+ ```
172
+
173
+ ## Architecture
174
+
175
+ ```
176
+ ┌─────────────────────────────────┐
177
+ │ CLI (Typer + Rich) REPL │
178
+ ├─────────────────────────────────┤
179
+ │ Agent Loop (ReAct) │
180
+ ├─────────────────────────────────┤
181
+ │ Context Manager L0-L5 memory │
182
+ ├─────────────────────────────────┤
183
+ │ Tool Registry + Permission │
184
+ ├─────────────────────────────────┤
185
+ │ Sandbox (Local / Docker) │
186
+ ├─────────────────────────────────┤
187
+ │ LLM Service (LiteLLM) │
188
+ └─────────────────────────────────┘
189
+ ```
190
+
191
+ ## Built-in Tools
192
+
193
+ | Tool | Description |
194
+ |------|-------------|
195
+ | `read_file` | Read a file (with optional line range and offset limit) |
196
+ | `write_file` | Write content to a file (creates or overwrites) |
197
+ | `edit_file` | Find-and-replace edit (string replacement) |
198
+ | `grep_search` | Search file contents with regex |
199
+ | `glob` | Find files by glob pattern |
200
+ | `list_dir` | List directory contents |
201
+ | `repo_tree` | Show tree-sitter generated repository map |
202
+ | `bash` | Execute a shell command (sandboxed) |
203
+ | `run_python` | Execute Python code in an isolated temp file |
204
+ | `finish` | Signal task completion and return to user |
205
+
206
+ ## Supported LLM Providers
207
+
208
+ Any OpenAI-compatible endpoint works out of the box via [LiteLLM](https://docs.litellm.ai/):
209
+
210
+ - **Volcengine ARK (Doubao)** — recommended, tested extensively
211
+ - **OpenAI** (GPT-4o, GPT-4, o1, etc.)
212
+ - **DeepSeek** (deepseek-chat, deepseek-reasoner)
213
+ - **Alibaba Qwen** (qwen2.5-coder series)
214
+ - **Zhipu GLM** (glm-4, glm-5 series)
215
+ - **Local models** via vLLM / Ollama / llama.cpp (any OpenAI-compatible server)
216
+ - **Anthropic Claude** (via LiteLLM)
217
+
218
+ ## License
219
+
220
+ MIT — see [LICENSE](LICENSE) for details.
221
+
222
+ ## Acknowledgements
223
+
224
+ Built after studying Claude Code (Anthropic), Codex CLI (OpenAI), and the SWE-bench / SWE-agent research.
225
+
226
+
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "repopilot-agent"
7
+ version = "0.1.0"
8
+ description = "Local-first AI code agent in your terminal. Inspired by Claude Code and Codex CLI."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ keywords = ["ai", "code-agent", "cli", "coding-assistant", "llm", "developer-tools"]
13
+ authors = [
14
+ {name = "ZhangYang2297"},
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Topic :: Software Development :: Code Generators",
26
+ "Topic :: Software Development :: Quality Assurance",
27
+ ]
28
+ dependencies = [
29
+ "typer>=0.12",
30
+ "rich>=13",
31
+ "prompt-toolkit>=3.0",
32
+ "litellm>=1.40",
33
+ "openai>=1.30",
34
+ "docker>=7.0",
35
+ "tree-sitter>=0.21,<0.22",
36
+ "tree-sitter-python>=0.21,<0.22",
37
+ "pathspec>=0.12",
38
+ "structlog>=24.0",
39
+ "pyyaml>=6.0",
40
+ "jinja2>=3.1",
41
+ "httpx>=0.27",
42
+ "diskcache>=5.6",
43
+ "tomli>=2.0;python_version<\"3.11\"",
44
+ ]
45
+
46
+ [project.optional-dependencies]
47
+ dev = [
48
+ "pytest>=8.0",
49
+ "pytest-timeout",
50
+ "pytest-cov",
51
+ "ruff>=0.5",
52
+ "ipython",
53
+ ]
54
+
55
+ [project.scripts]
56
+ repopilot = "repopilot.cli:app"
57
+
58
+ [project.urls]
59
+ Homepage = "https://github.com/ZhangYang2297/repopilot"
60
+ Repository = "https://github.com/ZhangYang2297/repopilot"
61
+ Issues = "https://github.com/ZhangYang2297/repopilot/issues"
62
+
63
+ [tool.setuptools.packages.find]
64
+ include = ["repopilot*"]
65
+ exclude = ["tests*", "eval*", "docs*"]
66
+
67
+ [tool.ruff]
68
+ line-length = 100
69
+ target-version = "py310"
70
+
71
+ [tool.ruff.lint]
72
+ select = ["E", "F", "I", "UP", "B"]
73
+
74
+
@@ -0,0 +1,3 @@
1
+ """RepoPilot — Local-first code agent."""
2
+ from __future__ import annotations
3
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ """Allow running RepoPilot with: python -m repopilot"""
2
+ from repopilot.cli import app
3
+ app()
File without changes