claude-dev-cli 0.8.0__tar.gz → 0.8.2__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.8.0/src/claude_dev_cli.egg-info → claude_dev_cli-0.8.2}/PKG-INFO +28 -6
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/README.md +27 -5
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/pyproject.toml +1 -1
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/__init__.py +1 -1
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/cli.py +161 -9
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/config.py +25 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/context.py +262 -23
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2/src/claude_dev_cli.egg-info}/PKG-INFO +28 -6
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli.egg-info/SOURCES.txt +1 -0
- claude_dev_cli-0.8.2/tests/test_context.py +791 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/LICENSE +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/MANIFEST.in +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/setup.cfg +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/commands.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/core.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/history.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/plugins/__init__.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/plugins/base.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/plugins/diff_editor/__init__.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/plugins/diff_editor/plugin.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/plugins/diff_editor/viewer.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/secure_storage.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/template_manager.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/templates.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/toon_utils.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/usage.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/warp_integration.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli/workflows.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli.egg-info/dependency_links.txt +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli.egg-info/entry_points.txt +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli.egg-info/requires.txt +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/src/claude_dev_cli.egg-info/top_level.txt +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_cli.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_commands.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_config.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_core.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_diff_editor.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_secure_storage.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_template_manager.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_toon_utils.py +0 -0
- {claude_dev_cli-0.8.0 → claude_dev_cli-0.8.2}/tests/test_usage.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: claude-dev-cli
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.2
|
|
4
4
|
Summary: A powerful CLI tool for developers using Claude AI with multi-API routing, test generation, code review, and usage tracking
|
|
5
5
|
Author-email: Julio <thinmanj@users.noreply.github.com>
|
|
6
6
|
License: MIT
|
|
@@ -79,12 +79,17 @@ A powerful command-line tool for developers using Claude AI with multi-API routi
|
|
|
79
79
|
- **Variable Substitution**: Use {{variable}} placeholders for dynamic content
|
|
80
80
|
- **Categories**: Organize templates by category (review, testing, debugging, etc.)
|
|
81
81
|
|
|
82
|
-
### 🧠 Context Intelligence (
|
|
83
|
-
- **Auto-Context**: `--auto-context` flag for intelligent context gathering
|
|
82
|
+
### 🧠 Context Intelligence (v0.8.0+)
|
|
83
|
+
- **Auto-Context**: `--auto-context` flag on 7 commands for intelligent context gathering
|
|
84
|
+
- `ask`, `review`, `debug`, `refactor` (v0.8.0)
|
|
85
|
+
- `git commit`, `generate tests`, `generate docs` (v0.8.1)
|
|
84
86
|
- **Git Integration**: Automatically include branch, commits, modified files
|
|
85
87
|
- **Dependency Analysis**: Parse imports and include related files
|
|
86
|
-
- **Error Parsing
|
|
88
|
+
- **Multi-Language Error Parsing** (v0.8.2): Python, JavaScript/TypeScript, Go, Rust, Java
|
|
89
|
+
- **Context Summary** (v0.8.2): Preview context before API calls with `cdc context summary`
|
|
90
|
+
- **Smart Truncation**: Prevent token limits with configurable file size limits
|
|
87
91
|
- **Project Memory**: Remember preferences per project
|
|
92
|
+
- **Global Config**: Set context defaults in `~/.claude-dev-cli/config.json`
|
|
88
93
|
|
|
89
94
|
### 🎒 TOON Format Support (Optional)
|
|
90
95
|
- **Token Reduction**: 30-60% fewer tokens than JSON
|
|
@@ -156,6 +161,9 @@ cdc generate tests mymodule.py -o tests/test_mymodule.py
|
|
|
156
161
|
# Generate tests with interactive refinement
|
|
157
162
|
cdc generate tests mymodule.py --interactive
|
|
158
163
|
|
|
164
|
+
# Generate tests with context (includes dependencies, related files) - NEW in v0.8.1
|
|
165
|
+
cdc generate tests mymodule.py --auto-context
|
|
166
|
+
|
|
159
167
|
# Code review
|
|
160
168
|
cdc review mymodule.py
|
|
161
169
|
|
|
@@ -174,6 +182,9 @@ cdc generate docs mymodule.py
|
|
|
174
182
|
# Generate docs with interactive refinement
|
|
175
183
|
cdc generate docs mymodule.py --interactive
|
|
176
184
|
|
|
185
|
+
# Generate docs with context (includes dependencies) - NEW in v0.8.1
|
|
186
|
+
cdc generate docs mymodule.py --auto-context
|
|
187
|
+
|
|
177
188
|
# Refactor with context (includes related files)
|
|
178
189
|
cdc refactor legacy_code.py --auto-context
|
|
179
190
|
|
|
@@ -183,9 +194,13 @@ cdc refactor legacy_code.py --interactive
|
|
|
183
194
|
# Git commit message
|
|
184
195
|
git add .
|
|
185
196
|
cdc git commit
|
|
197
|
+
|
|
198
|
+
# Git commit message with context (includes history, branch) - NEW in v0.8.1
|
|
199
|
+
git add .
|
|
200
|
+
cdc git commit --auto-context
|
|
186
201
|
```
|
|
187
202
|
|
|
188
|
-
### 4. Context-Aware Operations (
|
|
203
|
+
### 4. Context-Aware Operations (v0.8.0+)
|
|
189
204
|
|
|
190
205
|
```bash
|
|
191
206
|
# Auto-context includes: git info, dependencies, related files
|
|
@@ -194,9 +209,16 @@ cdc git commit
|
|
|
194
209
|
cdc review mymodule.py --auto-context
|
|
195
210
|
# ✓ Context gathered (git, dependencies, tests)
|
|
196
211
|
|
|
197
|
-
# Debug with parsed error details
|
|
212
|
+
# Debug with parsed error details (multi-language support)
|
|
198
213
|
python broken.py 2>&1 | cdc debug -f broken.py --auto-context
|
|
214
|
+
node app.js 2>&1 | cdc debug --auto-context # JavaScript/TypeScript
|
|
215
|
+
go run main.go 2>&1 | cdc debug --auto-context # Go
|
|
199
216
|
# ✓ Context gathered (error details, git context)
|
|
217
|
+
# Supports: Python, JavaScript, TypeScript, Go, Rust, Java
|
|
218
|
+
|
|
219
|
+
# Preview context before making API calls - NEW in v0.8.2
|
|
220
|
+
cdc context summary mymodule.py
|
|
221
|
+
# Shows: files, sizes, lines, estimated tokens, truncation warnings
|
|
200
222
|
|
|
201
223
|
# Ask questions with file context
|
|
202
224
|
cdc ask -f mycode.py --auto-context "how can I improve this?"
|
|
@@ -35,12 +35,17 @@ A powerful command-line tool for developers using Claude AI with multi-API routi
|
|
|
35
35
|
- **Variable Substitution**: Use {{variable}} placeholders for dynamic content
|
|
36
36
|
- **Categories**: Organize templates by category (review, testing, debugging, etc.)
|
|
37
37
|
|
|
38
|
-
### 🧠 Context Intelligence (
|
|
39
|
-
- **Auto-Context**: `--auto-context` flag for intelligent context gathering
|
|
38
|
+
### 🧠 Context Intelligence (v0.8.0+)
|
|
39
|
+
- **Auto-Context**: `--auto-context` flag on 7 commands for intelligent context gathering
|
|
40
|
+
- `ask`, `review`, `debug`, `refactor` (v0.8.0)
|
|
41
|
+
- `git commit`, `generate tests`, `generate docs` (v0.8.1)
|
|
40
42
|
- **Git Integration**: Automatically include branch, commits, modified files
|
|
41
43
|
- **Dependency Analysis**: Parse imports and include related files
|
|
42
|
-
- **Error Parsing
|
|
44
|
+
- **Multi-Language Error Parsing** (v0.8.2): Python, JavaScript/TypeScript, Go, Rust, Java
|
|
45
|
+
- **Context Summary** (v0.8.2): Preview context before API calls with `cdc context summary`
|
|
46
|
+
- **Smart Truncation**: Prevent token limits with configurable file size limits
|
|
43
47
|
- **Project Memory**: Remember preferences per project
|
|
48
|
+
- **Global Config**: Set context defaults in `~/.claude-dev-cli/config.json`
|
|
44
49
|
|
|
45
50
|
### 🎒 TOON Format Support (Optional)
|
|
46
51
|
- **Token Reduction**: 30-60% fewer tokens than JSON
|
|
@@ -112,6 +117,9 @@ cdc generate tests mymodule.py -o tests/test_mymodule.py
|
|
|
112
117
|
# Generate tests with interactive refinement
|
|
113
118
|
cdc generate tests mymodule.py --interactive
|
|
114
119
|
|
|
120
|
+
# Generate tests with context (includes dependencies, related files) - NEW in v0.8.1
|
|
121
|
+
cdc generate tests mymodule.py --auto-context
|
|
122
|
+
|
|
115
123
|
# Code review
|
|
116
124
|
cdc review mymodule.py
|
|
117
125
|
|
|
@@ -130,6 +138,9 @@ cdc generate docs mymodule.py
|
|
|
130
138
|
# Generate docs with interactive refinement
|
|
131
139
|
cdc generate docs mymodule.py --interactive
|
|
132
140
|
|
|
141
|
+
# Generate docs with context (includes dependencies) - NEW in v0.8.1
|
|
142
|
+
cdc generate docs mymodule.py --auto-context
|
|
143
|
+
|
|
133
144
|
# Refactor with context (includes related files)
|
|
134
145
|
cdc refactor legacy_code.py --auto-context
|
|
135
146
|
|
|
@@ -139,9 +150,13 @@ cdc refactor legacy_code.py --interactive
|
|
|
139
150
|
# Git commit message
|
|
140
151
|
git add .
|
|
141
152
|
cdc git commit
|
|
153
|
+
|
|
154
|
+
# Git commit message with context (includes history, branch) - NEW in v0.8.1
|
|
155
|
+
git add .
|
|
156
|
+
cdc git commit --auto-context
|
|
142
157
|
```
|
|
143
158
|
|
|
144
|
-
### 4. Context-Aware Operations (
|
|
159
|
+
### 4. Context-Aware Operations (v0.8.0+)
|
|
145
160
|
|
|
146
161
|
```bash
|
|
147
162
|
# Auto-context includes: git info, dependencies, related files
|
|
@@ -150,9 +165,16 @@ cdc git commit
|
|
|
150
165
|
cdc review mymodule.py --auto-context
|
|
151
166
|
# ✓ Context gathered (git, dependencies, tests)
|
|
152
167
|
|
|
153
|
-
# Debug with parsed error details
|
|
168
|
+
# Debug with parsed error details (multi-language support)
|
|
154
169
|
python broken.py 2>&1 | cdc debug -f broken.py --auto-context
|
|
170
|
+
node app.js 2>&1 | cdc debug --auto-context # JavaScript/TypeScript
|
|
171
|
+
go run main.go 2>&1 | cdc debug --auto-context # Go
|
|
155
172
|
# ✓ Context gathered (error details, git context)
|
|
173
|
+
# Supports: Python, JavaScript, TypeScript, Go, Rust, Java
|
|
174
|
+
|
|
175
|
+
# Preview context before making API calls - NEW in v0.8.2
|
|
176
|
+
cdc context summary mymodule.py
|
|
177
|
+
# Shows: files, sizes, lines, estimated tokens, truncation warnings
|
|
156
178
|
|
|
157
179
|
# Ask questions with file context
|
|
158
180
|
cdc ask -f mycode.py --auto-context "how can I improve this?"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "claude-dev-cli"
|
|
7
|
-
version = "0.8.
|
|
7
|
+
version = "0.8.2"
|
|
8
8
|
description = "A powerful CLI tool for developers using Claude AI with multi-API routing, test generation, code review, and usage tracking"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -461,20 +461,37 @@ def generate() -> None:
|
|
|
461
461
|
@click.option('-o', '--output', type=click.Path(), help='Output file path')
|
|
462
462
|
@click.option('-a', '--api', help='API config to use')
|
|
463
463
|
@click.option('-i', '--interactive', is_flag=True, help='Interactive refinement mode')
|
|
464
|
+
@click.option('--auto-context', is_flag=True, help='Include dependencies and related files')
|
|
464
465
|
@click.pass_context
|
|
465
466
|
def gen_tests(
|
|
466
467
|
ctx: click.Context,
|
|
467
468
|
file_path: str,
|
|
468
469
|
output: Optional[str],
|
|
469
470
|
api: Optional[str],
|
|
470
|
-
interactive: bool
|
|
471
|
+
interactive: bool,
|
|
472
|
+
auto_context: bool
|
|
471
473
|
) -> None:
|
|
472
474
|
"""Generate pytest tests for a Python file."""
|
|
473
475
|
console = ctx.obj['console']
|
|
474
476
|
|
|
475
477
|
try:
|
|
476
|
-
|
|
477
|
-
|
|
478
|
+
if auto_context:
|
|
479
|
+
from claude_dev_cli.context import ContextGatherer
|
|
480
|
+
|
|
481
|
+
with console.status("[bold blue]Gathering context..."):
|
|
482
|
+
gatherer = ContextGatherer()
|
|
483
|
+
context = gatherer.gather_for_file(Path(file_path), include_git=False)
|
|
484
|
+
context_info = context.format_for_prompt()
|
|
485
|
+
|
|
486
|
+
console.print("[dim]✓ Context gathered (dependencies, related files)[/dim]")
|
|
487
|
+
|
|
488
|
+
# Use context-aware test generation
|
|
489
|
+
client = ClaudeClient(api_config_name=api)
|
|
490
|
+
enhanced_prompt = f"{context_info}\n\nPlease generate comprehensive pytest tests for the main file, including fixtures, edge cases, and proper mocking where needed."
|
|
491
|
+
result = client.call(enhanced_prompt)
|
|
492
|
+
else:
|
|
493
|
+
with console.status("[bold blue]Generating tests..."):
|
|
494
|
+
result = generate_tests(file_path, api_config_name=api)
|
|
478
495
|
|
|
479
496
|
if interactive:
|
|
480
497
|
# Show initial result
|
|
@@ -530,20 +547,37 @@ def gen_tests(
|
|
|
530
547
|
@click.option('-o', '--output', type=click.Path(), help='Output file path')
|
|
531
548
|
@click.option('-a', '--api', help='API config to use')
|
|
532
549
|
@click.option('-i', '--interactive', is_flag=True, help='Interactive refinement mode')
|
|
550
|
+
@click.option('--auto-context', is_flag=True, help='Include dependencies and related files')
|
|
533
551
|
@click.pass_context
|
|
534
552
|
def gen_docs(
|
|
535
553
|
ctx: click.Context,
|
|
536
554
|
file_path: str,
|
|
537
555
|
output: Optional[str],
|
|
538
556
|
api: Optional[str],
|
|
539
|
-
interactive: bool
|
|
557
|
+
interactive: bool,
|
|
558
|
+
auto_context: bool
|
|
540
559
|
) -> None:
|
|
541
560
|
"""Generate documentation for a Python file."""
|
|
542
561
|
console = ctx.obj['console']
|
|
543
562
|
|
|
544
563
|
try:
|
|
545
|
-
|
|
546
|
-
|
|
564
|
+
if auto_context:
|
|
565
|
+
from claude_dev_cli.context import ContextGatherer
|
|
566
|
+
|
|
567
|
+
with console.status("[bold blue]Gathering context..."):
|
|
568
|
+
gatherer = ContextGatherer()
|
|
569
|
+
context = gatherer.gather_for_file(Path(file_path), include_git=False)
|
|
570
|
+
context_info = context.format_for_prompt()
|
|
571
|
+
|
|
572
|
+
console.print("[dim]✓ Context gathered (dependencies, related files)[/dim]")
|
|
573
|
+
|
|
574
|
+
# Use context-aware documentation generation
|
|
575
|
+
client = ClaudeClient(api_config_name=api)
|
|
576
|
+
enhanced_prompt = f"{context_info}\n\nPlease generate comprehensive documentation for the main file, including API reference, usage examples, and integration notes."
|
|
577
|
+
result = client.call(enhanced_prompt)
|
|
578
|
+
else:
|
|
579
|
+
with console.status("[bold blue]Generating documentation..."):
|
|
580
|
+
result = generate_docs(file_path, api_config_name=api)
|
|
547
581
|
|
|
548
582
|
if interactive:
|
|
549
583
|
console.print("\n[bold]Initial Documentation:[/bold]\n")
|
|
@@ -816,14 +850,31 @@ def git() -> None:
|
|
|
816
850
|
|
|
817
851
|
@git.command('commit')
|
|
818
852
|
@click.option('-a', '--api', help='API config to use')
|
|
853
|
+
@click.option('--auto-context', is_flag=True, help='Include git history and branch context')
|
|
819
854
|
@click.pass_context
|
|
820
|
-
def git_commit(ctx: click.Context, api: Optional[str]) -> None:
|
|
855
|
+
def git_commit(ctx: click.Context, api: Optional[str], auto_context: bool) -> None:
|
|
821
856
|
"""Generate commit message from staged changes."""
|
|
822
857
|
console = ctx.obj['console']
|
|
823
858
|
|
|
824
859
|
try:
|
|
825
|
-
|
|
826
|
-
|
|
860
|
+
if auto_context:
|
|
861
|
+
from claude_dev_cli.context import ContextGatherer
|
|
862
|
+
|
|
863
|
+
with console.status("[bold blue]Gathering context..."):
|
|
864
|
+
gatherer = ContextGatherer()
|
|
865
|
+
# Get git context with recent commits and branch info
|
|
866
|
+
git_context = gatherer.git.gather(include_diff=True)
|
|
867
|
+
context_info = git_context.format_for_prompt()
|
|
868
|
+
|
|
869
|
+
console.print("[dim]✓ Context gathered (branch, commits, diff)[/dim]")
|
|
870
|
+
|
|
871
|
+
# Use context-aware commit message generation
|
|
872
|
+
client = ClaudeClient(api_config_name=api)
|
|
873
|
+
enhanced_prompt = f"{context_info}\n\nPlease generate a concise, conventional commit message for the staged changes. Follow best practices: imperative mood, clear scope, explain what and why."
|
|
874
|
+
result = client.call(enhanced_prompt)
|
|
875
|
+
else:
|
|
876
|
+
with console.status("[bold blue]Analyzing changes..."):
|
|
877
|
+
result = git_commit_message(api_config_name=api)
|
|
827
878
|
|
|
828
879
|
console.print("\n[bold green]Suggested commit message:[/bold green]")
|
|
829
880
|
console.print(Panel(result, border_style="green"))
|
|
@@ -833,6 +884,107 @@ def git_commit(ctx: click.Context, api: Optional[str]) -> None:
|
|
|
833
884
|
sys.exit(1)
|
|
834
885
|
|
|
835
886
|
|
|
887
|
+
@main.group()
|
|
888
|
+
def context() -> None:
|
|
889
|
+
"""Context gathering tools and information."""
|
|
890
|
+
pass
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
@context.command('summary')
|
|
894
|
+
@click.argument('file_path', type=click.Path(exists=True))
|
|
895
|
+
@click.option('--include-git/--no-git', default=True, help='Include git context')
|
|
896
|
+
@click.option('--include-deps/--no-deps', default=True, help='Include dependencies')
|
|
897
|
+
@click.option('--include-tests/--no-tests', default=True, help='Include test files')
|
|
898
|
+
@click.pass_context
|
|
899
|
+
def context_summary(
|
|
900
|
+
ctx: click.Context,
|
|
901
|
+
file_path: str,
|
|
902
|
+
include_git: bool,
|
|
903
|
+
include_deps: bool,
|
|
904
|
+
include_tests: bool
|
|
905
|
+
) -> None:
|
|
906
|
+
"""Show what context would be gathered for a file."""
|
|
907
|
+
from claude_dev_cli.context import ContextGatherer
|
|
908
|
+
from rich.table import Table
|
|
909
|
+
|
|
910
|
+
console = ctx.obj['console']
|
|
911
|
+
|
|
912
|
+
try:
|
|
913
|
+
file_path_obj = Path(file_path)
|
|
914
|
+
gatherer = ContextGatherer()
|
|
915
|
+
|
|
916
|
+
# Gather context
|
|
917
|
+
with console.status("[bold blue]Analyzing context..."):
|
|
918
|
+
context = gatherer.gather_for_review(
|
|
919
|
+
file_path_obj,
|
|
920
|
+
include_git=include_git,
|
|
921
|
+
include_tests=include_tests
|
|
922
|
+
)
|
|
923
|
+
|
|
924
|
+
# Display summary
|
|
925
|
+
console.print(f"\n[bold cyan]Context Summary for:[/bold cyan] {file_path}\n")
|
|
926
|
+
|
|
927
|
+
table = Table(show_header=True, header_style="bold magenta")
|
|
928
|
+
table.add_column("Type", style="cyan")
|
|
929
|
+
table.add_column("Content", style="white")
|
|
930
|
+
table.add_column("Size", justify="right", style="yellow")
|
|
931
|
+
table.add_column("Lines", justify="right", style="green")
|
|
932
|
+
table.add_column("Truncated", justify="center", style="red")
|
|
933
|
+
|
|
934
|
+
total_chars = 0
|
|
935
|
+
total_lines = 0
|
|
936
|
+
|
|
937
|
+
for item in context.items:
|
|
938
|
+
lines = len(item.content.split('\n'))
|
|
939
|
+
chars = len(item.content)
|
|
940
|
+
truncated = "✓" if item.metadata.get('truncated') else ""
|
|
941
|
+
|
|
942
|
+
# Format content preview
|
|
943
|
+
if item.type == 'file':
|
|
944
|
+
content = item.metadata.get('path', 'unknown')
|
|
945
|
+
if item.metadata.get('is_test'):
|
|
946
|
+
content += " [TEST]"
|
|
947
|
+
elif item.type == 'git':
|
|
948
|
+
branch = item.metadata.get('branch', 'unknown')
|
|
949
|
+
modified = item.metadata.get('modified_count', 0)
|
|
950
|
+
content = f"Branch: {branch}, {modified} modified files"
|
|
951
|
+
elif item.type == 'dependency':
|
|
952
|
+
dep_files = item.metadata.get('dependency_files', [])
|
|
953
|
+
content = f"{len(dep_files)} dependency files"
|
|
954
|
+
else:
|
|
955
|
+
content = item.type
|
|
956
|
+
|
|
957
|
+
table.add_row(
|
|
958
|
+
item.type.title(),
|
|
959
|
+
content[:60] + "..." if len(content) > 60 else content,
|
|
960
|
+
f"{chars:,}",
|
|
961
|
+
f"{lines:,}",
|
|
962
|
+
truncated
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
total_chars += chars
|
|
966
|
+
total_lines += lines
|
|
967
|
+
|
|
968
|
+
console.print(table)
|
|
969
|
+
|
|
970
|
+
# Show totals
|
|
971
|
+
console.print(f"\n[bold]Total:[/bold]")
|
|
972
|
+
console.print(f" Characters: [yellow]{total_chars:,}[/yellow]")
|
|
973
|
+
console.print(f" Lines: [green]{total_lines:,}[/green]")
|
|
974
|
+
console.print(f" Estimated tokens: [cyan]~{total_chars // 4:,}[/cyan] (rough estimate)")
|
|
975
|
+
|
|
976
|
+
# Show any truncation warnings
|
|
977
|
+
truncated_items = [item for item in context.items if item.metadata.get('truncated')]
|
|
978
|
+
if truncated_items:
|
|
979
|
+
console.print(f"\n[yellow]⚠ {len(truncated_items)} item(s) truncated to fit size limits[/yellow]")
|
|
980
|
+
|
|
981
|
+
console.print(f"\n[dim]Use --auto-context with commands to include this context[/dim]")
|
|
982
|
+
|
|
983
|
+
except Exception as e:
|
|
984
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
985
|
+
sys.exit(1)
|
|
986
|
+
|
|
987
|
+
|
|
836
988
|
@main.command('usage')
|
|
837
989
|
@click.option('--days', type=int, help='Filter by days')
|
|
838
990
|
@click.option('--api', help='Filter by API config')
|
|
@@ -9,6 +9,18 @@ from pydantic import BaseModel, Field
|
|
|
9
9
|
from claude_dev_cli.secure_storage import SecureStorage
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
class ContextConfig(BaseModel):
|
|
13
|
+
"""Global context gathering configuration."""
|
|
14
|
+
|
|
15
|
+
auto_context_default: bool = False # Default for --auto-context flag
|
|
16
|
+
max_file_lines: int = 1000 # Maximum lines per file in context
|
|
17
|
+
max_related_files: int = 5 # Maximum related files to include
|
|
18
|
+
max_diff_lines: int = 200 # Maximum lines of diff to include
|
|
19
|
+
include_git: bool = True # Include git context by default
|
|
20
|
+
include_dependencies: bool = True # Include dependencies by default
|
|
21
|
+
include_tests: bool = True # Include test files by default
|
|
22
|
+
|
|
23
|
+
|
|
12
24
|
class APIConfig(BaseModel):
|
|
13
25
|
"""Configuration for a Claude API key."""
|
|
14
26
|
|
|
@@ -31,6 +43,13 @@ class ProjectProfile(BaseModel):
|
|
|
31
43
|
coding_style: Optional[str] = None # Preferred coding style
|
|
32
44
|
test_framework: Optional[str] = None # Preferred test framework
|
|
33
45
|
preferences: Dict[str, str] = Field(default_factory=dict) # Custom preferences
|
|
46
|
+
|
|
47
|
+
# Context gathering configuration
|
|
48
|
+
max_context_files: int = 5 # Maximum number of related files to include
|
|
49
|
+
max_diff_lines: int = 200 # Maximum lines of diff to include
|
|
50
|
+
max_file_lines: int = 1000 # Maximum lines per file in context
|
|
51
|
+
include_tests_by_default: bool = True # Include test files in review context
|
|
52
|
+
context_depth: int = 2 # How deep to search for related modules
|
|
34
53
|
|
|
35
54
|
|
|
36
55
|
class Config:
|
|
@@ -67,6 +86,7 @@ class Config:
|
|
|
67
86
|
"project_profiles": [],
|
|
68
87
|
"default_model": "claude-3-5-sonnet-20241022",
|
|
69
88
|
"max_tokens": 4096,
|
|
89
|
+
"context": ContextConfig().model_dump(),
|
|
70
90
|
}
|
|
71
91
|
self._save_config(default_config)
|
|
72
92
|
return default_config
|
|
@@ -238,3 +258,8 @@ class Config:
|
|
|
238
258
|
def get_max_tokens(self) -> int:
|
|
239
259
|
"""Get default max tokens."""
|
|
240
260
|
return self._data.get("max_tokens", 4096)
|
|
261
|
+
|
|
262
|
+
def get_context_config(self) -> ContextConfig:
|
|
263
|
+
"""Get context gathering configuration."""
|
|
264
|
+
context_data = self._data.get("context", {})
|
|
265
|
+
return ContextConfig(**context_data) if context_data else ContextConfig()
|