Skip to main content

A CLI tool for building and running magical LLM prompts

Project description

🧙‍♂️ Wizard Prompt CLI

Summon the power of Claude AI to transform your code with a wave of your terminal wand!

PyPI version Python Versions License: MIT

Wizard Prompt CLI is a magical command-line interface that conjures Claude AI to analyze, enhance, and transform your project files. Ask questions about your code in natural language, and watch as the AI wizard works its spells to provide insights and implement changes.

⚠️ Important: API Key Required

This tool requires an Anthropic API key to function. You must set the ANTHROPIC_API_KEY environment variable before using any commands. See the API Key Setup section below for details.

Without this environment variable set, no commands will work!

# Set this before using any wiz commands
export ANTHROPIC_API_KEY=your_api_key_here

✨ Magical Features

  • 🔮 Automatically scans your project's grimoire of files, carefully avoiding binary artifacts
  • 📜 Respects ancient incantations like .gitignore rules
  • 🌊 Streams Claude's mystical thinking process as it crafts responses
  • 🪄 Magically applies code changes with a single command
  • 🧪 Powerful file filtering to focus the AI's attention on specific scrolls of code
  • 📚 Handles file output with proper directory creation spells
  • 📥 Supports reading enchantments from stdin

🧙 Installation

Summon the Wizard to your environment:

pip install wizard-prompt-cli

Or conjure it from source:

git clone https://github.com/ddrscott/wizard-prompt-cli.git
cd wizard-prompt-cli
pip install -e .

🔑 API Key Setup

Before casting spells, you need to obtain your magical key:

  1. Create an account at Anthropic if you don't have one
  2. Generate an API key from your Anthropic dashboard
  3. Set the environment variable with your secret key:
# For Linux/macOS
export ANTHROPIC_API_KEY=your_api_key_here

# For Windows (Command Prompt)
set ANTHROPIC_API_KEY=your_api_key_here

# For Windows (PowerShell)
$env:ANTHROPIC_API_KEY="your_api_key_here"

For permanent enchantment, add this to your shell profile (.bashrc, .zshrc, etc.).

🔴 Note: The ANTHROPIC_API_KEY environment variable is required. The tool will not function without it properly set. If you encounter errors about unauthorized access or missing API keys, please verify this variable is correctly set.

🪄 Usage

Wizard Prompt CLI offers two main incantations:

📝 Prompt Command

Invoke Claude with your questions and project files:

wiz prompt "How can I improve this code?"

Include specific scrolls:

wiz prompt -f main.py -f utils.py "How can I make these files more efficient?"

Options:

  • -f, --file: Specify files to include (can be used multiple times)
  • -o, --output: Location to write response (default: .response.md)

The wizard's response will be saved to .response.md by default, and a copy of the full messages including system prompt will be saved to .messages.md.

✨ Apply Command

Cast the spell to implement the suggested changes:

wiz apply

Or specify a different spell book:

wiz apply custom_response.md

You can also channel content directly to the apply command:

cat response.md | wiz apply -

📚 How It Works

  1. The prompt command channels your question and file contents to Claude
  2. Claude weaves a spell over your files and provides a response with suggested changes
  3. Changes are formatted with [FILE path]...[/FILE] magical markers
  4. The apply command interprets these markers and transforms your files

🌟 Examples

Ask the wizard to refactor a specific function:

wiz prompt -f src/utils.py "Refactor the parse_data function to be more efficient"

Conjure a new feature:

wiz prompt "Add a progress bar to the file processing function"

Then cast the spell to apply the changes:

wiz apply

Or do it all in one and see the output at the same time:

wiz prompt "Fix bugs" | tee -a /dev/tty | wiz apply -

🔄 Git Integration Best Practices

When using Wizard Prompt CLI to modify your code, it's essential to integrate with Git or your preferred version control system to keep track of changes and maintain safety.

Before Casting Spells

  1. Commit your current changes to create a restore point:

    git add .
    git commit -m "Save state before wizard modifications"
    
  2. Alternatively, create a new branch for experimental wizard changes:

    git checkout -b wizard-experiment
    

After Applying Changes

  1. Review all modifications with Git before committing:

    git diff
    
  2. For a more detailed review, use a visual diff tool:

    git difftool
    
  3. For a file-by-file review:

    git add -p
    
  4. If you're satisfied with the changes:

    git add .
    git commit -m "Applied AI-suggested improvements to X"
    
  5. If the wizard's spells went awry, revert the changes:

    git reset --hard HEAD~1  # If you committed before using wiz
    # or
    git checkout -- .        # If you haven't committed the wizard's changes
    

Always review changes carefully before committing them to your repository. The AI is powerful but not infallible - your expertise is the final arbiter of which magical transformations to keep!

🔧 Troubleshooting

If you encounter errors like "API key not found" or "Unauthorized", check that:

  1. You have set the ANTHROPIC_API_KEY environment variable correctly
  2. The API key is valid and active in your Anthropic account
  3. You've correctly formatted the environment variable without extra spaces

You can verify your environment variable is set correctly with:

# Linux/macOS
echo $ANTHROPIC_API_KEY

# Windows PowerShell
echo $env:ANTHROPIC_API_KEY

📜 License

MIT License


Star History

Star History Chart

✨ If this magical tool helped you, consider giving it a star! ✨

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wizard_prompt_cli-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wizard_prompt_cli-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file wizard_prompt_cli-0.1.1.tar.gz.

File metadata

  • Download URL: wizard_prompt_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wizard_prompt_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 01f9f30ebef5238fc745b063579b1495637c0f540f1606671972e744a0f346e5
MD5 505a956eccb5a735118cdf2809d2a2fa
BLAKE2b-256 91bf32ae44de16816bb37fa537df8c835a364c8bc5026541ea72696b88fc1a61

See more details on using hashes here.

Provenance

The following attestation bundles were made for wizard_prompt_cli-0.1.1.tar.gz:

Publisher: python-publish.yml on ddrscott/wiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wizard_prompt_cli-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wizard_prompt_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e75172b18f4edddca0e3c85002f070d0acbddad5c68c2de2354a1d8f3d8ce82
MD5 7d38de38aafbee83b09b2c9f687b17ab
BLAKE2b-256 2f0ad07e9fe1148f4f7431562a2886f81d7d566692ea433457aa296c692db126

See more details on using hashes here.

Provenance

The following attestation bundles were made for wizard_prompt_cli-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on ddrscott/wiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page