1 unstable release
Uses new Rust 2024
new 0.1.0 | May 4, 2025 |
---|
#538 in Command line utilities
85 downloads per month
26KB
587 lines
๐ Rich Prompt
๐ง Supercharge your LLM interactions with structured context from your codebase!
A Rust CLI tool that transforms your project files into perfectly formatted context blocks for Large Language Models. Ideal for code reviews, refactoring assistance, and technical discussions with AI.
โจ Features
- ๐ Smart File Selection - Automatically scan and select files with specific extensions
- ๐ Interactive Mode - Choose files interactively or auto-include all matched files
- ๐ซ Exclusion Patterns - Easily ignore directories like
.git
,node_modules
, etc. - ๐๏ธ Structured Output - Generate well-formatted context blocks optimized for LLMs
- ๐ฌ Custom Instructions - Include your specific prompts within the context block
- ๐ค Flexible Output - Print to console or save to file with a simple flag
๐ฆ Installation
๐ง From Source
git clone https://github.com/username/rich-prompt.git
cd rich-prompt
cargo install --path .
๐ฅ From Cargo
cargo install rich-prompt
๐ฎ Usage
๐ฐ Basic Usage
rich-prompt generate --path /path/to/project
โ๏ธ Command Line Options
Option | Description |
---|---|
--path |
๐ Root directory to scan (required) |
--ext |
๐ File extensions to include (default: .java,.js,.go,.rs,.py,.toml,.yml ) |
--exclude |
๐ซ Patterns to exclude (default: .git,.venv,target ) |
--output |
๐พ File path to save output (optional) |
--auto |
๐ค Skip interactive selection, include all files |
--prompt |
๐ฌ User prompt to include in context block |
--verbose |
๐ Increase logging verbosity (-v, -vv, -vvv) |
๐ Examples
Include all Rust files in a project:
rich-prompt generate --path ./my-project --ext .rs --exclude target --auto
Include selected JavaScript and TypeScript files:
rich-prompt generate --path ./frontend --ext .js,.ts --exclude node_modules --output output.txt
Include a custom prompt with your file context:
rich-prompt generate --path ./src --prompt "Optimize this code for performance and reduce memory usage"
๐ Output Format
The tool generates output in the following format:
<file_map>
# ๐ Directory structure representation
</file_map>
<file_contents>
File: path/to/file.ext
```ext
file content
```
</file_contents>
<user_instructions>
๐ฌ Your custom prompt goes here
</user_instructions>
๐ฏ Use Cases
- ๐ Code Reviews: Get AI feedback on your code quality and structure
- ๐ Documentation: Generate comprehensive docs with AI assistance
- ๐ ๏ธ Refactoring: Receive intelligent suggestions for code improvements
- ๐งฉ Problem Solving: Get AI help with complex coding challenges
- ๐ Learning: Analyze and understand project structure with AI explanations
๐ Workflow Integration
Perfect for integrating with:
- ๐ป CI/CD pipelines
- ๐ค AI code review bots
- ๐ Documentation generators
- ๐งช Testing frameworks
๐ฆ Logging Levels
Control verbosity with the --verbose
flag:
- Default: Only errors
-v
: Warnings and errors-vv
: Info, warnings, and errors-vvv
: All debug information
๐ ๏ธ Advanced Configuration
Create a .rich-prompt.toml
in your home directory to set default options:
default_extensions = [".rs", ".toml"]
default_excludes = [".git", "target", "node_modules"]
log_level = "info"
๐ค Contributing
Contributions are welcome! Here's how you can help:
- ๐ด Fork the repository
- ๐ Create a feature branch
- ๐ป Add your changes
- ๐งช Add tests for your changes
- ๐ค Submit a pull request
Please make sure your code follows our coding standards and includes appropriate tests.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โค๏ธ by Mohamed Abdelwahed
Dependencies
~3โ10MB
~100K SLoC