4 releases (2 breaking)

Uses new Rust 2024

0.3.1 May 11, 2025
0.3.0 May 11, 2025
0.2.0 May 9, 2025
0.1.0 May 4, 2025

#317 in Command line utilities

MIT license

76KB
2K SLoC

๐Ÿš€ 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, save to file, or copy to clipboard with a simple flag
  • ๐Ÿ“‹ Clipboard Support - Copy generated content directly to your clipboard for easy pasting
  • ๐Ÿ”„ GitIgnore Support - Respect existing .gitignore rules when scanning files

๐Ÿ“ฆ Installation

๐Ÿ“ฅ From Cargo

For linux make sure to run following command to install X11

sudo apt-get install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev

For all operating systems run following

cargo install rich-prompt

๐Ÿ”ง From Source

git clone https://github.com/username/rich-prompt.git
cd rich-prompt
cargo install --path .

๐ŸŽฎ Usage

๐Ÿ”ฐ Basic Usage

rich-prompt generate --path /path/to/project

โš™๏ธ Command Line Options

Option Description
--path ๐Ÿ“‚ Root directory to scan (optional, by default current directory)
--ext ๐Ÿ“‘ File extensions to include (optional, include all files if not specified)
--exclude ๐Ÿšซ Patterns to exclude (optional, exclude none if not specified)
--output ๐Ÿ’พ File path to save output (optional)
--auto ๐Ÿค– Skip interactive selection, include all files
--prompt ๐Ÿ’ฌ User prompt to include in context block
--exclude-version-control-dir ๐Ÿ“‚ Version control directory to exclude (default: .git)
--apply-dot-git-ignore ๐Ÿ” Whether to apply .gitignore rules (default: true)
--clipboard-output ๐Ÿ“‹ Copy the output to the clipboard
--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"

Copy the output directly to clipboard:

rich-prompt generate --path ./src --auto --clipboard-output

๐Ÿ“‹ 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:

  1. ๐Ÿด Fork the repository
  2. ๐Ÿ”„ Create a feature branch
  3. ๐Ÿ’ป Add your changes
  4. ๐Ÿงช Add tests for your changes
  5. ๐Ÿ“ค 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

~8โ€“18MB
~252K SLoC