agentcode-cli 1.0.0__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.
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentcode-cli
3
+ Version: 1.0.0
4
+ Summary: An open, multi-model agentic coding CLI — inspired by Claude Code
5
+ Author: Vignesh Pai
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Vignesh Pai
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/vigp17/AgentCode
29
+ Project-URL: Repository, https://github.com/vigp17/AgentCode
30
+ Project-URL: Bug Tracker, https://github.com/vigp17/AgentCode/issues
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: Programming Language :: Python :: 3.11
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Environment :: Console
36
+ Classifier: Topic :: Software Development
37
+ Classifier: Topic :: Utilities
38
+ Requires-Python: >=3.11
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: litellm>=1.40.0
42
+ Requires-Dist: rich>=13.0.0
43
+ Requires-Dist: python-dotenv>=1.0.0
44
+ Requires-Dist: mcp>=1.0.0
45
+ Provides-Extra: dev
46
+ Requires-Dist: build; extra == "dev"
47
+ Requires-Dist: twine; extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # AgentCode
51
+
52
+ An open, multi-model agentic coding CLI — inspired by Claude Code.
53
+
54
+ ## Architecture
55
+
56
+ ```
57
+ ┌─────────────────────────────────────────────────┐
58
+ │ cli.py (UI) │
59
+ │ REPL loop · slash commands · Rich terminal UI │
60
+ │ AGENTCODE.md · session persistence │
61
+ └──────────────────────┬──────────────────────────┘
62
+
63
+ ┌──────────────────────▼──────────────────────────┐
64
+ │ agent.py (Brain) │
65
+ │ Agentic loop · context management · permissions│
66
+ │ Hooks · subagents · LLM-powered compaction │
67
+ │ │
68
+ │ while needs_follow_up: │
69
+ │ 1. Send messages + tools → LLM │
70
+ │ 2. If tool_calls → execute, append, loop │
71
+ │ 3. If text only → done │
72
+ │ │
73
+ │ LiteLLM ──→ Claude / GPT / Gemini │
74
+ └──────────────────────┬──────────────────────────┘
75
+
76
+ ┌────────────┴────────────┐
77
+ │ │
78
+ ┌─────────▼───────────┐ ┌─────────▼───────────┐
79
+ │ tools.py (Hands) │ │ mcp_client.py │
80
+ │ read_file │ │ Connect to MCP │
81
+ │ write_file │ │ servers and expose │
82
+ │ edit_file │ │ their tools to the │
83
+ │ run_command │ │ agent loop. │
84
+ │ list_directory │ └─────────────────────┘
85
+ │ search_files │
86
+ │ search_text │
87
+ │ git_status/diff │
88
+ │ git_log/commit │
89
+ │ git_branch/push │
90
+ │ spawn_subagents │
91
+ └─────────────────────┘
92
+ ```
93
+
94
+ ## Quick Start
95
+
96
+ ```bash
97
+ # Option A: Install from PyPI
98
+ pip install agentcode-cli
99
+
100
+ # Option B: Install from source
101
+ git clone https://github.com/vigp17/AgentCode.git
102
+ cd AgentCode
103
+ pip install -r requirements.txt
104
+ ```
105
+
106
+ ```bash
107
+ # Add your API keys to a .env file in your project directory
108
+ ANTHROPIC_API_KEY=sk-ant-...
109
+ OPENAI_API_KEY=sk-...
110
+ GEMINI_API_KEY=...
111
+ ```
112
+
113
+ ```bash
114
+ # Run
115
+ agentcode # Interactive REPL
116
+ agentcode "fix the failing tests" # One-shot mode
117
+ agentcode --model gpt-4o # Use a different model
118
+ agentcode --init-settings # Create a settings file
119
+ ```
120
+
121
+ ## Supported Models
122
+
123
+ Via [LiteLLM](https://docs.litellm.ai/docs/providers), AgentCode works with any model that supports function calling — including Claude, GPT, Gemini, and select open-source models via Ollama.
124
+
125
+ | Provider | Model String | API Key Env Var |
126
+ |------------|---------------------------------|-------------------------|
127
+ | Anthropic | `claude-sonnet-4-6` (default) | `ANTHROPIC_API_KEY` |
128
+ | OpenAI | `gpt-4o` | `OPENAI_API_KEY` |
129
+ | Google | `gemini/gemini-2.5-pro` | `GEMINI_API_KEY` |
130
+
131
+ ## Cost-Aware Routing
132
+
133
+ AgentCode automatically picks the cheapest model that can handle the task:
134
+
135
+ | Tier | Anthropic | OpenAI | Gemini |
136
+ |--------|--------------------|--------------|-------------------------|
137
+ | Light | Haiku 4.5 | GPT-4o Mini | Gemini 2.0 Flash |
138
+ | Medium | Sonnet 4.6 | GPT-4o | Gemini 2.5 Flash |
139
+ | Heavy | Opus 4.6 | GPT-5.5 | Gemini 2.5 Pro |
140
+
141
+ Simple questions go to cheap/fast models. Complex multi-file tasks go to powerful ones. Use `--no-route` to always use the specified model.
142
+
143
+ ## Tools
144
+
145
+ ### File & Shell
146
+
147
+ | Tool | Description | Permission |
148
+ |------------------|--------------------------------------|------------|
149
+ | `read_file` | Read file contents with line numbers | Auto |
150
+ | `write_file` | Create or overwrite a file | Ask |
151
+ | `edit_file` | Surgical find-and-replace edit | Ask |
152
+ | `run_command` | Execute a bash command | Ask |
153
+ | `list_directory` | Tree view of directory structure | Auto |
154
+ | `search_files` | Find files by glob pattern | Auto |
155
+ | `search_text` | Grep for text across files | Auto |
156
+
157
+ ### Git
158
+
159
+ | Tool | Description | Permission |
160
+ |---------------|------------------------------------------|------------|
161
+ | `git_status` | Show working tree status | Auto |
162
+ | `git_diff` | Show staged or unstaged changes | Auto |
163
+ | `git_log` | Show recent commit history | Auto |
164
+ | `git_commit` | Stage files and create a commit | Ask |
165
+ | `git_branch` | List, create, or switch branches | Ask |
166
+ | `git_push` | Push commits to a remote | Ask |
167
+
168
+ ### Subagents
169
+
170
+ | Tool | Description | Permission |
171
+ |-------------------|--------------------------------------------------|------------|
172
+ | `spawn_subagents` | Run multiple agents in parallel on subtasks | Auto |
173
+
174
+ **Permission model:** Read-only tools auto-approve. Write/execute tools ask before running (unless `--auto-approve` / `-y` flag is set).
175
+
176
+ ## Slash Commands
177
+
178
+ | Command | Description |
179
+ |--------------------------|--------------------------------------------------|
180
+ | `/model <name>` | Switch LLM model on the fly (disables routing) |
181
+ | `/route` | Show or toggle cost-aware routing |
182
+ | `/cost` | Show session cost breakdown |
183
+ | `/mcp` | Manage MCP server connections |
184
+ | `/mcp list` | Show connected servers and tool counts |
185
+ | `/mcp add <server>` | Connect a server (prompts for credentials) |
186
+ | `/mcp remove <server>` | Disconnect a server |
187
+ | `/clear` | Reset conversation and delete saved session |
188
+ | `/compact` | Force LLM-powered context compaction |
189
+ | `/tokens` | Show estimated token usage |
190
+ | `/init` | Create an AGENTCODE.md template |
191
+ | `/settings` | Show resolved settings and active config files |
192
+ | `/help` | Show help |
193
+ | `/exit` | Quit |
194
+
195
+ ## Session Persistence
196
+
197
+ Conversations are automatically saved to `.agentcode_session.json` in your project directory and resumed on next launch. Use `/clear` to start fresh.
198
+
199
+ ## Hooks
200
+
201
+ Run shell commands before or after any tool call. Create `.agentcode/hooks.json`:
202
+
203
+ ```json
204
+ {
205
+ "post_edit_file": "prettier --write \"$AGENTCODE_PATH\"",
206
+ "post_write_file": "prettier --write \"$AGENTCODE_PATH\"",
207
+ "pre_run_command": "echo \"Running: $AGENTCODE_COMMAND\""
208
+ }
209
+ ```
210
+
211
+ Supported keys: `pre_<toolname>`, `post_<toolname>`, `pre_tool` / `post_tool` (wildcard). Tool args are passed as `AGENTCODE_<ARG>=value` env vars. Global hooks go in `~/.agentcode/hooks.json`.
212
+
213
+ ## MCP Support
214
+
215
+ Connect to any [MCP server](https://modelcontextprotocol.io) using the `/mcp add` command — no manual config editing needed:
216
+
217
+ ```
218
+ /mcp add github # prompts for GitHub token, connects immediately
219
+ /mcp add filesystem # connects to current directory, no credentials needed
220
+ /mcp add postgres # prompts for connection string
221
+ /mcp add sqlite # prompts for database file path
222
+ /mcp list # show connected servers and tool counts
223
+ /mcp remove github # disconnect a server
224
+ ```
225
+
226
+ Servers connect live without restarting. Config is saved to `.agentcode/mcp.json` and reloaded automatically on next launch.
227
+
228
+ MCP tools are exposed as `mcp__<server>__<toolname>` (e.g. `mcp__github__create_issue`) and available to the LLM alongside built-in tools. Connected servers are shown in the banner on startup.
229
+
230
+ **Advanced:** You can also edit `.agentcode/mcp.json` directly for custom servers:
231
+
232
+ ```json
233
+ {
234
+ "mcpServers": {
235
+ "my-server": {
236
+ "command": "npx",
237
+ "args": ["-y", "@myorg/mcp-server"],
238
+ "env": {"API_KEY": "..."}
239
+ }
240
+ }
241
+ }
242
+ ```
243
+
244
+ Global config goes in `~/.agentcode/mcp.json`.
245
+
246
+ ## Subagents
247
+
248
+ AgentCode can spawn parallel agents to work on independent subtasks simultaneously. Just ask naturally:
249
+
250
+ > "Analyze agent.py, router.py, and tools.py in parallel and summarize each one"
251
+
252
+ The agent calls `spawn_subagents` internally, runs up to 5 agents in parallel, and returns combined results.
253
+
254
+ ## AGENTCODE.md
255
+
256
+ AgentCode loads project-level instructions from `AGENTCODE.md` in your project directory (and global config from `~/.agentcode/AGENTCODE.md`), injecting them into the system prompt automatically.
257
+
258
+ Run `/init` to generate a starter template, then edit it to define your project's coding standards, preferences, and constraints.
259
+
260
+ ## How to Extend
261
+
262
+ ### Add a new tool
263
+
264
+ 1. Add the function schema to `TOOL_DEFINITIONS` in `tools.py`
265
+ 2. Implement the function (e.g., `_my_tool(...)`)
266
+ 3. Register it in `TOOL_MAP`
267
+ 4. If it should require user approval, omit it from `permissions.auto_approve` in `.agentcode/settings.json`
268
+
269
+ ## Environment Variables
270
+
271
+ | Variable | Description | Default |
272
+ |----------------------------|-----------------------------------|---------------------|
273
+ | `AGENTCODE_MODEL` | Default model | `claude-sonnet-4-6` |
274
+ | `AGENTCODE_MAX_ITERATIONS` | Max tool-call iterations per turn | `25` |
275
+ | `ANTHROPIC_API_KEY` | Anthropic API key | — |
276
+ | `OPENAI_API_KEY` | OpenAI API key | — |
277
+ | `GEMINI_API_KEY` | Google Gemini API key | — |
278
+
279
+ ## Publishing to PyPI
280
+
281
+ ```bash
282
+ # 1. Install build tools
283
+ pip install build twine
284
+
285
+ # 2. Bump the version in pyproject.toml, then build
286
+ python -m build
287
+
288
+ # 3. Upload to PyPI
289
+ twine upload dist/*
290
+ ```
291
+
292
+ You'll be prompted for your PyPI credentials on first upload. Use an API token from [pypi.org/manage/account](https://pypi.org/manage/account) for security.
293
+
294
+ For test uploads before going live:
295
+
296
+ ```bash
297
+ twine upload --repository testpypi dist/*
298
+ pip install --index-url https://test.pypi.org/simple/ agentcode
299
+ ```
300
+
301
+ ## License
302
+
303
+ MIT
@@ -0,0 +1,12 @@
1
+ agent.py,sha256=zcYfTAarYhj1hdLc9DH5sWs6Qqqp1VpmrHGJfHSJZIQ,17118
2
+ cli.py,sha256=naUTUUgvL2DJRTTZzxQCOi6bjZ7rmtmpwlqaGDQ4eQk,24677
3
+ mcp_client.py,sha256=2PviTqJtXM4UC_fsYLbAOAfWJvayWy7Q8VOQIIsDiqQ,6710
4
+ router.py,sha256=kjPpF1js6mA7FN2x_NleyN-BLeVzRAy-Q0wbhjelQzM,11109
5
+ settings.py,sha256=Qjc3tiVbT1cqIrnQW6m2UG8Xsvqsxl9qXPMTueqwn50,6903
6
+ tools.py,sha256=MBYy0OeSIZjqyGOezaMvZ6AMW3WRDESU-2u48sifd0Q,24741
7
+ agentcode_cli-1.0.0.dist-info/licenses/LICENSE,sha256=BqTzyKKaSaVQoumXzhYCj1UgOSPCgvn-sxV6BIuT558,1068
8
+ agentcode_cli-1.0.0.dist-info/METADATA,sha256=gJjlU0B67K1iMGnSgYVk901xeCuaHc12RSXL5Cs6WM0,13389
9
+ agentcode_cli-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
10
+ agentcode_cli-1.0.0.dist-info/entry_points.txt,sha256=xP_zeySufuVhL5v10_EqCooKRSxGYB8QuRVNUj4_m1E,39
11
+ agentcode_cli-1.0.0.dist-info/top_level.txt,sha256=5jYoRO_eF5cWLQAvnel4HxTjCgsG0iBHpOkcTn3Gqv8,43
12
+ agentcode_cli-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agentcode = cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vignesh Pai
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,6 @@
1
+ agent
2
+ cli
3
+ mcp_client
4
+ router
5
+ settings
6
+ tools