#llm #prompt #cli #prompt-context #file-selection

app rich-prompt

A Rust CLI tool for rich prompts with file and directory selection

1 unstable release

Uses new Rust 2024

new 0.1.0 May 4, 2025

#538 in Command line utilities

Download history 85/week @ 2025-04-29

85 downloads per month

MIT license

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:

  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

~3โ€“10MB
~100K SLoC