baxter-cli 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.
@@ -0,0 +1,253 @@
1
+ Metadata-Version: 2.4
2
+ Name: baxter-cli
3
+ Version: 0.1.0
4
+ Summary: Baxter CLI - a terminal coding agent
5
+ Author: Baxter
6
+ License: Proprietary
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Environment :: Console
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: python-dotenv>=1.0.0
16
+
17
+ # Terminal Coding Agent (Baxter CLI)
18
+
19
+ ![Baxter CLI Banner](baxter.png)
20
+
21
+ A local terminal coding assistant with provider switching, tool-calling, and safety rails for file + command operations.
22
+
23
+ ## Features
24
+
25
+ - Interactive chat loop with tool chaining
26
+ - Provider support:
27
+ - `anthropic` (`/v1/messages`)
28
+ - `openai` (`/v1/responses`)
29
+ - `groq` (OpenAI-compatible `chat/completions`)
30
+ - Startup provider preference: `anthropic` -> `openai` -> `groq`
31
+ - Curated model lists per provider (with OpenAI dynamic filtering against `/v1/models`)
32
+ - Working indicator while model calls are in flight (`Baxter is working...`)
33
+ - Built-in malformed tool-call recovery (one automatic retry if JSON tool call is broken)
34
+
35
+ ## Current Model Sets
36
+
37
+ - `anthropic`
38
+ - `claude-opus-4-6`
39
+ - `claude-sonnet-4-6`
40
+ - `claude-haiku-4-5-20251001` (default)
41
+ - `openai`
42
+ - `gpt-4o-mini` (default)
43
+ - `gpt-5-mini`
44
+ - `codex-3.5`
45
+ - `groq`
46
+ - `llama-3.1-8b-instant` (default)
47
+
48
+ Notes:
49
+ - OpenAI model IDs are fetched from `/v1/models` and intersected with the allowlist above.
50
+ - You can override the OpenAI allowlist with `OPENAI_MODELS_ALLOWLIST` (comma-separated IDs).
51
+
52
+ ## Tooling
53
+
54
+ Tools available:
55
+ - `read_file`
56
+ - `write_file`
57
+ - `apply_diff`
58
+ - `list_dir`
59
+ - `make_dir`
60
+ - `delete_path`
61
+ - `run_cmd`
62
+ - `git_cmd`
63
+ - `search_code`
64
+
65
+ Key behaviors:
66
+ - File paths are restricted to the repo root (no absolute paths, no `..` escape).
67
+ - `delete_path` supports recursive directory deletion (default `recursive=true`).
68
+ - `write_file` refuses to overwrite existing files unless `overwrite=true`.
69
+ - `apply_diff` supports targeted edits using exact `find`/`replace` with optional `replace_all=true`.
70
+ - `apply_diff` returns a unified diff summary (`+/-`) and stores the full last diff for terminal viewing.
71
+
72
+ ## Confirmations
73
+
74
+ Baxter asks `y/N` confirmation before:
75
+ - `delete_path`
76
+ - `apply_diff`
77
+ - `write_file` when `overwrite=true`
78
+ - `git push`
79
+ - `git rm`
80
+
81
+ ## CLI Commands
82
+
83
+ - `/` opens interactive provider/model picker
84
+ - `/providers` (alias: `/settings`)
85
+ - `/provider <groq|openai|anthropic>`
86
+ - `/models`
87
+ - `/model <model_name>`
88
+ - `/lastdiff` (expand the last `apply_diff` unified diff)
89
+ - `/help`
90
+
91
+ ## Project Layout
92
+
93
+ ```text
94
+ .
95
+ ├─ .env.example
96
+ ├─ pyproject.toml
97
+ ├─ README.md
98
+ └─ baxter/
99
+ ├─ __init__.py
100
+ ├─ baxter_cli.py
101
+ ├─ providers.py
102
+ └─ tools/
103
+ ├─ __init__.py
104
+ ├─ registry.py
105
+ ├─ safe_path.py
106
+ ├─ read_file.py
107
+ ├─ write_file.py
108
+ ├─ apply_diff.py
109
+ ├─ list_dir.py
110
+ ├─ make_dir.py
111
+ ├─ delete_path.py
112
+ ├─ run_cmd.py
113
+ ├─ git_cmd.py
114
+ └─ search_code.py
115
+ ```
116
+
117
+ ## Requirements
118
+
119
+ - Python 3.10+
120
+ - At least one API key:
121
+ - `ANTHROPIC_API_KEY`
122
+ - `OPENAI_API_KEY`
123
+ - `GROQ_API_KEY`
124
+
125
+ ## Setup (Developer)
126
+
127
+ 1. Create and activate a virtual environment.
128
+
129
+ Windows (cmd):
130
+
131
+ ```bat
132
+ python -m venv .venv
133
+ .venv\Scripts\activate.bat
134
+ ```
135
+
136
+ Windows (PowerShell):
137
+
138
+ ```powershell
139
+ python -m venv .venv
140
+ .venv\Scripts\Activate.ps1
141
+ ```
142
+
143
+ macOS/Linux:
144
+
145
+ ```bash
146
+ python3 -m venv .venv
147
+ source .venv/bin/activate
148
+ ```
149
+
150
+ 2. Install editable:
151
+
152
+ ```bash
153
+ pip install -e .
154
+ ```
155
+
156
+ 3. Create `.env` from `.env.example` and set keys:
157
+
158
+ ```env
159
+ GROQ_API_KEY=...
160
+ OPENAI_API_KEY=...
161
+ ANTHROPIC_API_KEY=...
162
+ # optional:
163
+ # OPENAI_MODELS_ALLOWLIST=gpt-4o-mini,gpt-5-mini,codex-3.5
164
+ ```
165
+
166
+ The CLI also loads user-level keys from `~/.baxter/.env` first, then applies project `.env` as an override.
167
+
168
+ ## Setup (User install via pip)
169
+
170
+ 1. Install Baxter:
171
+
172
+ ```bash
173
+ pip install baxter-cli
174
+ ```
175
+
176
+ 2. Configure keys once per machine in:
177
+
178
+ - Windows: `%USERPROFILE%\.baxter\.env`
179
+ - macOS/Linux: `~/.baxter/.env`
180
+
181
+ Example:
182
+
183
+ ```env
184
+ GROQ_API_KEY=...
185
+ OPENAI_API_KEY=...
186
+ ANTHROPIC_API_KEY=...
187
+ # optional:
188
+ # OPENAI_MODELS_ALLOWLIST=gpt-4o-mini,gpt-5-mini,codex-3.5
189
+ ```
190
+
191
+ 3. Open any project folder and run:
192
+
193
+ ```bash
194
+ baxter
195
+ ```
196
+
197
+ ## Run
198
+
199
+ ```bash
200
+ baxter
201
+ ```
202
+
203
+ or:
204
+
205
+ ```bash
206
+ python -m baxter.baxter_cli
207
+ ```
208
+
209
+ ## Command Safety Model
210
+
211
+ `run_cmd` allowlist:
212
+ - `python`
213
+ - `python3`
214
+ - `pip`
215
+ - `pip3`
216
+ - `git`
217
+
218
+ `git_cmd` subcommand allowlist:
219
+ - `status`
220
+ - `log`
221
+ - `diff`
222
+ - `show`
223
+ - `branch`
224
+ - `switch`
225
+ - `checkout`
226
+ - `add`
227
+ - `commit`
228
+ - `push`
229
+ - `pull`
230
+ - `fetch`
231
+ - `remote`
232
+ - `rev-parse`
233
+ - `restore`
234
+ - `rm`
235
+ - `mv`
236
+ - `stash`
237
+
238
+ Additional protections:
239
+ - No shell execution for command tools
240
+ - Path traversal/root escape blocked
241
+ - Selected risky git flags blocked (`--git-dir`, `--work-tree`, `-C`, etc.)
242
+ - Per-tool timeout bounds
243
+
244
+ ## Troubleshooting
245
+
246
+ - Missing key error:
247
+ - Verify `.env` has the expected API key and restart Baxter.
248
+ - OpenAI tool-call/JSON issues:
249
+ - Baxter now does one automatic repair retry for malformed tool-call JSON.
250
+ - OpenAI model list too large:
251
+ - Set `OPENAI_MODELS_ALLOWLIST` explicitly.
252
+ - `git not found on PATH`:
253
+ - Install Git and restart terminal.
@@ -0,0 +1,237 @@
1
+ # Terminal Coding Agent (Baxter CLI)
2
+
3
+ ![Baxter CLI Banner](baxter.png)
4
+
5
+ A local terminal coding assistant with provider switching, tool-calling, and safety rails for file + command operations.
6
+
7
+ ## Features
8
+
9
+ - Interactive chat loop with tool chaining
10
+ - Provider support:
11
+ - `anthropic` (`/v1/messages`)
12
+ - `openai` (`/v1/responses`)
13
+ - `groq` (OpenAI-compatible `chat/completions`)
14
+ - Startup provider preference: `anthropic` -> `openai` -> `groq`
15
+ - Curated model lists per provider (with OpenAI dynamic filtering against `/v1/models`)
16
+ - Working indicator while model calls are in flight (`Baxter is working...`)
17
+ - Built-in malformed tool-call recovery (one automatic retry if JSON tool call is broken)
18
+
19
+ ## Current Model Sets
20
+
21
+ - `anthropic`
22
+ - `claude-opus-4-6`
23
+ - `claude-sonnet-4-6`
24
+ - `claude-haiku-4-5-20251001` (default)
25
+ - `openai`
26
+ - `gpt-4o-mini` (default)
27
+ - `gpt-5-mini`
28
+ - `codex-3.5`
29
+ - `groq`
30
+ - `llama-3.1-8b-instant` (default)
31
+
32
+ Notes:
33
+ - OpenAI model IDs are fetched from `/v1/models` and intersected with the allowlist above.
34
+ - You can override the OpenAI allowlist with `OPENAI_MODELS_ALLOWLIST` (comma-separated IDs).
35
+
36
+ ## Tooling
37
+
38
+ Tools available:
39
+ - `read_file`
40
+ - `write_file`
41
+ - `apply_diff`
42
+ - `list_dir`
43
+ - `make_dir`
44
+ - `delete_path`
45
+ - `run_cmd`
46
+ - `git_cmd`
47
+ - `search_code`
48
+
49
+ Key behaviors:
50
+ - File paths are restricted to the repo root (no absolute paths, no `..` escape).
51
+ - `delete_path` supports recursive directory deletion (default `recursive=true`).
52
+ - `write_file` refuses to overwrite existing files unless `overwrite=true`.
53
+ - `apply_diff` supports targeted edits using exact `find`/`replace` with optional `replace_all=true`.
54
+ - `apply_diff` returns a unified diff summary (`+/-`) and stores the full last diff for terminal viewing.
55
+
56
+ ## Confirmations
57
+
58
+ Baxter asks `y/N` confirmation before:
59
+ - `delete_path`
60
+ - `apply_diff`
61
+ - `write_file` when `overwrite=true`
62
+ - `git push`
63
+ - `git rm`
64
+
65
+ ## CLI Commands
66
+
67
+ - `/` opens interactive provider/model picker
68
+ - `/providers` (alias: `/settings`)
69
+ - `/provider <groq|openai|anthropic>`
70
+ - `/models`
71
+ - `/model <model_name>`
72
+ - `/lastdiff` (expand the last `apply_diff` unified diff)
73
+ - `/help`
74
+
75
+ ## Project Layout
76
+
77
+ ```text
78
+ .
79
+ ├─ .env.example
80
+ ├─ pyproject.toml
81
+ ├─ README.md
82
+ └─ baxter/
83
+ ├─ __init__.py
84
+ ├─ baxter_cli.py
85
+ ├─ providers.py
86
+ └─ tools/
87
+ ├─ __init__.py
88
+ ├─ registry.py
89
+ ├─ safe_path.py
90
+ ├─ read_file.py
91
+ ├─ write_file.py
92
+ ├─ apply_diff.py
93
+ ├─ list_dir.py
94
+ ├─ make_dir.py
95
+ ├─ delete_path.py
96
+ ├─ run_cmd.py
97
+ ├─ git_cmd.py
98
+ └─ search_code.py
99
+ ```
100
+
101
+ ## Requirements
102
+
103
+ - Python 3.10+
104
+ - At least one API key:
105
+ - `ANTHROPIC_API_KEY`
106
+ - `OPENAI_API_KEY`
107
+ - `GROQ_API_KEY`
108
+
109
+ ## Setup (Developer)
110
+
111
+ 1. Create and activate a virtual environment.
112
+
113
+ Windows (cmd):
114
+
115
+ ```bat
116
+ python -m venv .venv
117
+ .venv\Scripts\activate.bat
118
+ ```
119
+
120
+ Windows (PowerShell):
121
+
122
+ ```powershell
123
+ python -m venv .venv
124
+ .venv\Scripts\Activate.ps1
125
+ ```
126
+
127
+ macOS/Linux:
128
+
129
+ ```bash
130
+ python3 -m venv .venv
131
+ source .venv/bin/activate
132
+ ```
133
+
134
+ 2. Install editable:
135
+
136
+ ```bash
137
+ pip install -e .
138
+ ```
139
+
140
+ 3. Create `.env` from `.env.example` and set keys:
141
+
142
+ ```env
143
+ GROQ_API_KEY=...
144
+ OPENAI_API_KEY=...
145
+ ANTHROPIC_API_KEY=...
146
+ # optional:
147
+ # OPENAI_MODELS_ALLOWLIST=gpt-4o-mini,gpt-5-mini,codex-3.5
148
+ ```
149
+
150
+ The CLI also loads user-level keys from `~/.baxter/.env` first, then applies project `.env` as an override.
151
+
152
+ ## Setup (User install via pip)
153
+
154
+ 1. Install Baxter:
155
+
156
+ ```bash
157
+ pip install baxter-cli
158
+ ```
159
+
160
+ 2. Configure keys once per machine in:
161
+
162
+ - Windows: `%USERPROFILE%\.baxter\.env`
163
+ - macOS/Linux: `~/.baxter/.env`
164
+
165
+ Example:
166
+
167
+ ```env
168
+ GROQ_API_KEY=...
169
+ OPENAI_API_KEY=...
170
+ ANTHROPIC_API_KEY=...
171
+ # optional:
172
+ # OPENAI_MODELS_ALLOWLIST=gpt-4o-mini,gpt-5-mini,codex-3.5
173
+ ```
174
+
175
+ 3. Open any project folder and run:
176
+
177
+ ```bash
178
+ baxter
179
+ ```
180
+
181
+ ## Run
182
+
183
+ ```bash
184
+ baxter
185
+ ```
186
+
187
+ or:
188
+
189
+ ```bash
190
+ python -m baxter.baxter_cli
191
+ ```
192
+
193
+ ## Command Safety Model
194
+
195
+ `run_cmd` allowlist:
196
+ - `python`
197
+ - `python3`
198
+ - `pip`
199
+ - `pip3`
200
+ - `git`
201
+
202
+ `git_cmd` subcommand allowlist:
203
+ - `status`
204
+ - `log`
205
+ - `diff`
206
+ - `show`
207
+ - `branch`
208
+ - `switch`
209
+ - `checkout`
210
+ - `add`
211
+ - `commit`
212
+ - `push`
213
+ - `pull`
214
+ - `fetch`
215
+ - `remote`
216
+ - `rev-parse`
217
+ - `restore`
218
+ - `rm`
219
+ - `mv`
220
+ - `stash`
221
+
222
+ Additional protections:
223
+ - No shell execution for command tools
224
+ - Path traversal/root escape blocked
225
+ - Selected risky git flags blocked (`--git-dir`, `--work-tree`, `-C`, etc.)
226
+ - Per-tool timeout bounds
227
+
228
+ ## Troubleshooting
229
+
230
+ - Missing key error:
231
+ - Verify `.env` has the expected API key and restart Baxter.
232
+ - OpenAI tool-call/JSON issues:
233
+ - Baxter now does one automatic repair retry for malformed tool-call JSON.
234
+ - OpenAI model list too large:
235
+ - Set `OPENAI_MODELS_ALLOWLIST` explicitly.
236
+ - `git not found on PATH`:
237
+ - Install Git and restart terminal.
@@ -0,0 +1 @@
1
+ # entry point for baxter