feat: add full directory support and smart file handling

Major improvements to file handling capabilities:

- Add directory traversal support to all file-processing tools
- Tools now accept both individual files and entire directories
- Automatically expand directories and discover code files recursively
- Smart filtering: skip hidden files, __pycache__, and non-code files
- Progressive token loading: read as many files as possible within limits
- Clear file separation markers with full paths for Gemini

Key changes:
- Rewrite file_utils.py with expand_paths() and improved read_files()
- Update all tool descriptions to indicate directory support
- Add comprehensive tests for directory handling and token limits
- Document tool parameters and examples in README
- Bump version to 2.4.2

All tools (analyze, review_code, debug_issue, think_deeper) now support:
- Single files: "analyze main.py"
- Directories: "review src/"
- Mixed paths: "analyze config.py, src/, tests/"

This enables analyzing entire projects or specific subsystems efficiently
while respecting token limits and providing clear file boundaries.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Fahad
2025-06-09 06:00:25 +04:00
parent 024fdd48c9
commit 545338ca23
9 changed files with 384 additions and 46 deletions

View File

@@ -257,6 +257,68 @@ Just ask Claude naturally:
"Get gemini to show server configuration"
```
## Tool Parameters
All tools that work with files now support **both individual files and entire directories**. The server automatically expands directories, filters for relevant code files, and manages token limits.
### File-Processing Tools
**`analyze`** - Analyze files or directories
- `files`: List of file paths or directories (required)
- `question`: What to analyze (required)
- `analysis_type`: architecture|performance|security|quality|general
- `output_format`: summary|detailed|actionable
```
"Use gemini to analyze the src/ directory for architectural patterns"
"Get gemini to analyze main.py and tests/ to understand test coverage"
```
**`review_code`** - Review code files or directories
- `files`: List of file paths or directories (required)
- `review_type`: full|security|performance|quick
- `focus_on`: Specific aspects to focus on
- `standards`: Coding standards to enforce
- `severity_filter`: critical|high|medium|all
```
"Use gemini to review the entire api/ directory for security issues"
"Get gemini to review src/ with focus on performance, only show critical issues"
```
**`debug_issue`** - Debug with file context
- `error_description`: Description of the issue (required)
- `error_context`: Stack trace or logs
- `relevant_files`: Files or directories related to the issue
- `runtime_info`: Environment details
- `previous_attempts`: What you've tried
```
"Use gemini to debug this error with context from the entire backend/ directory"
```
**`think_deeper`** - Extended analysis with file context
- `current_analysis`: Your current thinking (required)
- `problem_context`: Additional context
- `focus_areas`: Specific aspects to focus on
- `reference_files`: Files or directories for context
```
"Use gemini to think deeper about my design with reference to the src/models/ directory"
```
### Directory Support Features
- **Automatic Expansion**: Directories are recursively scanned for code files
- **Smart Filtering**: Hidden files, caches, and non-code files are automatically excluded
- **Token Management**: Loads as many files as possible within token limits
- **Clear Markers**: Each file is marked with full path for Gemini to distinguish
Example with mixed paths:
```
"Use gemini to analyze config.py, src/, and tests/unit/ to understand the testing strategy"
```
## Collaborative Workflows
### Design → Review → Implement