claude-dev-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.
Potentially problematic release.
This version of claude-dev-cli might be problematic. Click here for more details.
- claude_dev_cli-0.1.0/LICENSE +21 -0
- claude_dev_cli-0.1.0/MANIFEST.in +4 -0
- claude_dev_cli-0.1.0/PKG-INFO +392 -0
- claude_dev_cli-0.1.0/README.md +357 -0
- claude_dev_cli-0.1.0/pyproject.toml +72 -0
- claude_dev_cli-0.1.0/setup.cfg +4 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/__init__.py +19 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/cli.py +398 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/commands.py +133 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/config.py +174 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/core.py +132 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/templates.py +104 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli/usage.py +202 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli.egg-info/PKG-INFO +392 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli.egg-info/SOURCES.txt +17 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli.egg-info/dependency_links.txt +1 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli.egg-info/entry_points.txt +3 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli.egg-info/requires.txt +10 -0
- claude_dev_cli-0.1.0/src/claude_dev_cli.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Julio
|
|
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,392 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-dev-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A powerful CLI tool for developers using Claude AI with multi-API routing, test generation, code review, and usage tracking
|
|
5
|
+
Author-email: Julio <thinmanj@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/thinmanj/claude-dev-cli
|
|
8
|
+
Project-URL: Repository, https://github.com/thinmanj/claude-dev-cli
|
|
9
|
+
Project-URL: Issues, https://github.com/thinmanj/claude-dev-cli/issues
|
|
10
|
+
Keywords: claude,ai,cli,development,testing,code-review,anthropic
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
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
|
|
20
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: anthropic>=0.18.0
|
|
26
|
+
Requires-Dist: click>=8.1.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Requires-Dist: pydantic>=2.0.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# Claude Dev CLI
|
|
37
|
+
|
|
38
|
+
A powerful command-line tool for developers using Claude AI with multi-API routing, test generation, code review, and comprehensive usage tracking.
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
### ๐ Multi-API Key Management
|
|
43
|
+
- Route tasks to different Claude API keys (personal, client, enterprise)
|
|
44
|
+
- Automatic API selection based on project configuration
|
|
45
|
+
- Environment variable support for secure key management
|
|
46
|
+
|
|
47
|
+
### ๐งช Developer Tools
|
|
48
|
+
- **Test Generation**: Automatic pytest test generation for Python code
|
|
49
|
+
- **Code Review**: Comprehensive code reviews with security, performance, and best practice checks
|
|
50
|
+
- **Debug Assistant**: Analyze errors and get fixes with explanations
|
|
51
|
+
- **Documentation**: Generate docstrings and README documentation
|
|
52
|
+
- **Refactoring**: Get suggestions for code improvements
|
|
53
|
+
- **Git Integration**: Generate conventional commit messages from diffs
|
|
54
|
+
|
|
55
|
+
### ๐ Usage Tracking
|
|
56
|
+
- Track token usage per API key
|
|
57
|
+
- Cost estimation based on current pricing
|
|
58
|
+
- Filter by date range and API config
|
|
59
|
+
- Detailed breakdowns by model, date, and API
|
|
60
|
+
|
|
61
|
+
### ๐ฌ Interaction Modes
|
|
62
|
+
- **Single-shot**: Quick questions with piping support
|
|
63
|
+
- **Interactive**: Chat mode with conversation history
|
|
64
|
+
- **Streaming**: Real-time responses
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install claude-dev-cli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
### 1. Set Up API Keys
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Add your personal API key
|
|
78
|
+
export PERSONAL_ANTHROPIC_API_KEY="sk-ant-..."
|
|
79
|
+
cdc config add personal --default --description "My personal API key"
|
|
80
|
+
|
|
81
|
+
# Add client's API key
|
|
82
|
+
export CLIENT_ANTHROPIC_API_KEY="sk-ant-..."
|
|
83
|
+
cdc config add client --description "Client's Enterprise API"
|
|
84
|
+
|
|
85
|
+
# List configured APIs
|
|
86
|
+
cdc config list
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 2. Basic Usage
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Ask a question
|
|
93
|
+
cdc ask "explain asyncio in Python"
|
|
94
|
+
|
|
95
|
+
# With file context
|
|
96
|
+
cdc ask -f mycode.py "review this code"
|
|
97
|
+
|
|
98
|
+
# Pipe input
|
|
99
|
+
cat error.log | cdc ask "what's causing this error?"
|
|
100
|
+
|
|
101
|
+
# Interactive mode
|
|
102
|
+
cdc interactive
|
|
103
|
+
|
|
104
|
+
# Use specific API
|
|
105
|
+
cdc ask -a client "generate tests for this function"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 3. Developer Commands
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Generate tests
|
|
112
|
+
cdc generate tests mymodule.py -o tests/test_mymodule.py
|
|
113
|
+
|
|
114
|
+
# Code review
|
|
115
|
+
cdc review mymodule.py
|
|
116
|
+
|
|
117
|
+
# Debug errors
|
|
118
|
+
python script.py 2>&1 | cdc debug
|
|
119
|
+
|
|
120
|
+
# Generate documentation
|
|
121
|
+
cdc generate docs mymodule.py
|
|
122
|
+
|
|
123
|
+
# Refactor suggestions
|
|
124
|
+
cdc refactor legacy_code.py
|
|
125
|
+
|
|
126
|
+
# Git commit message
|
|
127
|
+
git add .
|
|
128
|
+
cdc git commit
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 4. Usage Tracking
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# View all usage
|
|
135
|
+
cdc usage
|
|
136
|
+
|
|
137
|
+
# Last 7 days
|
|
138
|
+
cdc usage --days 7
|
|
139
|
+
|
|
140
|
+
# Filter by API
|
|
141
|
+
cdc usage --api client
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Configuration
|
|
145
|
+
|
|
146
|
+
### Global Configuration
|
|
147
|
+
|
|
148
|
+
Configuration is stored in `~/.claude-dev-cli/config.json`:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"api_configs": [
|
|
153
|
+
{
|
|
154
|
+
"name": "personal",
|
|
155
|
+
"api_key": "sk-ant-...",
|
|
156
|
+
"description": "My personal API key",
|
|
157
|
+
"default": true
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "client",
|
|
161
|
+
"api_key": "sk-ant-...",
|
|
162
|
+
"description": "Client's Enterprise API",
|
|
163
|
+
"default": false
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"default_model": "claude-3-5-sonnet-20241022",
|
|
167
|
+
"max_tokens": 4096
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Project-Specific Configuration
|
|
172
|
+
|
|
173
|
+
Create `.claude-dev-cli` in your project root:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"name": "My Project",
|
|
178
|
+
"api_config": "client",
|
|
179
|
+
"system_prompt": "You are a Python expert focused on data science.",
|
|
180
|
+
"allowed_commands": ["all"]
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The tool will automatically use the client's API when you run commands in that project!
|
|
185
|
+
|
|
186
|
+
## API Routing Strategy
|
|
187
|
+
|
|
188
|
+
### Scenario: Client Work with Enterprise API
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# 1. Set up client's API
|
|
192
|
+
export CLIENT_ANTHROPIC_API_KEY="sk-ant-..."
|
|
193
|
+
cdc config add client --description "Client Enterprise API"
|
|
194
|
+
|
|
195
|
+
# 2. Create project config
|
|
196
|
+
cd /path/to/client/project
|
|
197
|
+
cat > .claude-dev-cli << 'EOF'
|
|
198
|
+
{
|
|
199
|
+
"name": "Client Project",
|
|
200
|
+
"api_config": "client",
|
|
201
|
+
"system_prompt": "You are a senior Python developer."
|
|
202
|
+
}
|
|
203
|
+
EOF
|
|
204
|
+
|
|
205
|
+
# 3. All commands in this directory now use client's API
|
|
206
|
+
cdc generate tests app.py # Uses client's API
|
|
207
|
+
cdc review code.py # Uses client's API
|
|
208
|
+
|
|
209
|
+
# 4. Your personal projects use your API
|
|
210
|
+
cd ~/my-personal-project
|
|
211
|
+
cdc generate tests app.py # Uses your personal API
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## What the Client Can See
|
|
215
|
+
|
|
216
|
+
When using a client's Enterprise API:
|
|
217
|
+
|
|
218
|
+
โ
**They CAN see:**
|
|
219
|
+
- Total API calls and token usage
|
|
220
|
+
- Costs associated with the API key
|
|
221
|
+
- Potentially conversation history (if enabled by admin)
|
|
222
|
+
|
|
223
|
+
โ **They CANNOT see:**
|
|
224
|
+
- Which machine you used
|
|
225
|
+
- Your other API keys or projects
|
|
226
|
+
- Local files unless you sent the content
|
|
227
|
+
|
|
228
|
+
## Command Reference
|
|
229
|
+
|
|
230
|
+
### Core Commands
|
|
231
|
+
|
|
232
|
+
| Command | Description |
|
|
233
|
+
|---------|-------------|
|
|
234
|
+
| `cdc ask <prompt>` | Ask Claude a question |
|
|
235
|
+
| `cdc interactive` | Start interactive chat |
|
|
236
|
+
| `cdc usage` | Show usage statistics |
|
|
237
|
+
|
|
238
|
+
### Configuration
|
|
239
|
+
|
|
240
|
+
| Command | Description |
|
|
241
|
+
|---------|-------------|
|
|
242
|
+
| `cdc config add <name>` | Add API configuration |
|
|
243
|
+
| `cdc config list` | List all API configs |
|
|
244
|
+
|
|
245
|
+
### Code Generation
|
|
246
|
+
|
|
247
|
+
| Command | Description |
|
|
248
|
+
|---------|-------------|
|
|
249
|
+
| `cdc generate tests <file>` | Generate pytest tests |
|
|
250
|
+
| `cdc generate docs <file>` | Generate documentation |
|
|
251
|
+
|
|
252
|
+
### Code Analysis
|
|
253
|
+
|
|
254
|
+
| Command | Description |
|
|
255
|
+
|---------|-------------|
|
|
256
|
+
| `cdc review <file>` | Review code |
|
|
257
|
+
| `cdc debug -f <file> -e <error>` | Debug code |
|
|
258
|
+
| `cdc refactor <file>` | Refactoring suggestions |
|
|
259
|
+
|
|
260
|
+
### Git Helpers
|
|
261
|
+
|
|
262
|
+
| Command | Description |
|
|
263
|
+
|---------|-------------|
|
|
264
|
+
| `cdc git commit` | Generate commit message |
|
|
265
|
+
|
|
266
|
+
## Options
|
|
267
|
+
|
|
268
|
+
### Common Options
|
|
269
|
+
|
|
270
|
+
- `-a, --api <name>`: Use specific API config
|
|
271
|
+
- `-m, --model <name>`: Use specific Claude model
|
|
272
|
+
- `-s, --system <prompt>`: Set system prompt
|
|
273
|
+
- `-f, --file <path>`: Include file in prompt
|
|
274
|
+
- `-o, --output <path>`: Save output to file
|
|
275
|
+
|
|
276
|
+
### Models
|
|
277
|
+
|
|
278
|
+
- `claude-3-5-sonnet-20241022` (default)
|
|
279
|
+
- `claude-3-opus-20240229`
|
|
280
|
+
- `claude-3-haiku-20240307`
|
|
281
|
+
|
|
282
|
+
## Examples
|
|
283
|
+
|
|
284
|
+
### Test Generation
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Generate tests for a module
|
|
288
|
+
cdc generate tests src/calculator.py -o tests/test_calculator.py
|
|
289
|
+
|
|
290
|
+
# Review the tests
|
|
291
|
+
cdc review tests/test_calculator.py
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Code Review Workflow
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Review before committing
|
|
298
|
+
cdc review mycode.py
|
|
299
|
+
|
|
300
|
+
# Fix issues, then generate commit message
|
|
301
|
+
git add mycode.py
|
|
302
|
+
cdc git commit
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Debugging
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Run script and analyze errors
|
|
309
|
+
python buggy_script.py 2>&1 | cdc debug
|
|
310
|
+
|
|
311
|
+
# Or debug a specific file
|
|
312
|
+
cdc debug -f buggy_script.py -e "NameError: name 'x' is not defined"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Using Multiple APIs
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
# Personal work
|
|
319
|
+
cdc ask "explain decorators" -a personal
|
|
320
|
+
|
|
321
|
+
# Client work
|
|
322
|
+
cdc generate tests client_code.py -a client
|
|
323
|
+
|
|
324
|
+
# Check usage per API
|
|
325
|
+
cdc usage --api personal
|
|
326
|
+
cdc usage --api client
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Environment Variables
|
|
330
|
+
|
|
331
|
+
| Variable | Description |
|
|
332
|
+
|----------|-------------|
|
|
333
|
+
| `{NAME}_ANTHROPIC_API_KEY` | API key for config named "name" |
|
|
334
|
+
| `ANTHROPIC_API_KEY` | Default API key |
|
|
335
|
+
|
|
336
|
+
## Usage Log Format
|
|
337
|
+
|
|
338
|
+
Usage logs are stored in `~/.claude-dev-cli/usage.jsonl`:
|
|
339
|
+
|
|
340
|
+
```json
|
|
341
|
+
{
|
|
342
|
+
"timestamp": "2024-12-28T03:00:00.000000",
|
|
343
|
+
"api_config": "client",
|
|
344
|
+
"model": "claude-3-5-sonnet-20241022",
|
|
345
|
+
"prompt_preview": "Generate tests for...",
|
|
346
|
+
"input_tokens": 1523,
|
|
347
|
+
"output_tokens": 2847,
|
|
348
|
+
"duration_ms": 3421
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Development
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# Clone the repository
|
|
356
|
+
git clone https://github.com/thinmanj/claude-dev-cli
|
|
357
|
+
cd claude-dev-cli
|
|
358
|
+
|
|
359
|
+
# Install in development mode
|
|
360
|
+
pip install -e ".[dev]"
|
|
361
|
+
|
|
362
|
+
# Run tests
|
|
363
|
+
pytest
|
|
364
|
+
|
|
365
|
+
# Format code
|
|
366
|
+
black src/
|
|
367
|
+
ruff check src/
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Contributing
|
|
371
|
+
|
|
372
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
373
|
+
|
|
374
|
+
## License
|
|
375
|
+
|
|
376
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
377
|
+
|
|
378
|
+
## Author
|
|
379
|
+
|
|
380
|
+
Julio ([@thinmanj](https://github.com/thinmanj))
|
|
381
|
+
|
|
382
|
+
## Acknowledgments
|
|
383
|
+
|
|
384
|
+
- Built with [Anthropic's Claude API](https://www.anthropic.com/)
|
|
385
|
+
- CLI powered by [Click](https://click.palletsprojects.com/)
|
|
386
|
+
- Beautiful terminal output with [Rich](https://rich.readthedocs.io/)
|
|
387
|
+
|
|
388
|
+
## Support
|
|
389
|
+
|
|
390
|
+
- ๐ [Report bugs](https://github.com/thinmanj/claude-dev-cli/issues)
|
|
391
|
+
- ๐ก [Request features](https://github.com/thinmanj/claude-dev-cli/issues)
|
|
392
|
+
- ๐ [Documentation](https://github.com/thinmanj/claude-dev-cli)
|