Skip to main content

TUI app that enriches prompts using Groq API and project context

Project description

Magic Prompt

PyPI version Python 3.11+ License: GPL v3

A TUI and CLI tool that enriches short, vague prompts into detailed, structured prompts using Groq API and your project's actual file structure and codebase.

Features

  • 📁 Project-Aware: Scans your project's file structure, config files, and extracts code signatures
  • 🧠 AI-Powered: Uses Groq's fast LLM API to intelligently expand prompts
  • Real-Time Streaming: Watch the enriched prompt generate in real-time
  • 🖥️ Dual Mode: Interactive TUI or headless CLI for shell scripting
  • 🗂️ Workspace Management: Save and switch between multiple project workspaces
  • 🎯 Dynamic Model Selection: Automatically fetch and select from available Groq models
  • 📊 Status Bar: Real-time display of current mode, model, and settings

Installation

From PyPI

pip install ai-magic-prompt

Or with uv:

uv tool install ai-magic-prompt

Raycast Extension

The easiest way to install the Raycast extension is using the built-in command:

# Print the script to your terminal
magic-prompt --install-raycast

# Or save it directly to your Raycast scripts folder
magic-prompt --install-raycast ~/path/to/raycast/scripts

This will generate a script that automatically uses your current magic-prompt installation.

From Source

git clone https://github.com/arterialist/magic-prompt.git
cd magic-prompt
pip install -e .

Setup

Get your Groq API key from console.groq.com/keys.

Set it as an environment variable:

export GROQ_API_KEY=gsk_...

Configuration

Magic Prompt saves your preferences in ~/.config/magic-prompt/config.json. You can configure these via the CLI:

Model Selection

Set your preferred Groq model (default: llama-3.3-70b-versatile):

magic-prompt --model llama-3.1-8b-instant

Debounce Time

Adjust the real-time enrichment delay in milliseconds (default: 800):

magic-prompt --debounce 500

Default Directory

Save your current project directory as the default:

magic-prompt --save-dir .

View Current Config

magic-prompt --show-config

Or create a .env file in your project directory:

GROQ_API_KEY=your_api_key_here

Usage

Headless CLI Mode

Run from anywhere as a shell command:

# Basic usage - enrich a prompt
magic-prompt "add user authentication"

# Pipe prompt from stdin
echo "add logging" | magic-prompt

# Specify project directory
magic-prompt -d /path/to/project "refactor the API"

# Quiet mode - only output result (good for piping)
magic-prompt -q "add tests" > enriched.md

CLI Options

Option Description
-d, --directory Project directory (default: from config or cwd)
-t, --tui Launch interactive TUI mode
-q, --quiet Only output result, no progress
--debounce MS Set debounce time for real-time mode
--save-dir DIR Save default directory for future runs
--show-config Show current configuration

Interactive TUI Mode

magic-prompt --tui
# OR just run without arguments:
magic-prompt
  1. Enter your project's root directory path
  2. Type a short prompt (e.g., "add user authentication")
  3. Watch the enriched, project-aware prompt stream in real-time
  4. Press Ctrl+Y to copy the enriched prompt

TUI Keyboard Shortcuts

Key Action
Enter Submit prompt
Ctrl+T Toggle real-time
Ctrl+Y Copy to clipboard
Ctrl+U Clear Input
Ctrl+L Clear Output
Ctrl+R Rescan project
Ctrl+S Open Settings
Ctrl+M Cycle enrichment mode
Ctrl+W Manage workspaces
Ctrl+D Cycle through workspaces
Ctrl+Q Quit

How It Works

  1. Scans your project directory structure
  2. Extracts docstrings, function signatures, and imports
  3. Sends context + your prompt to Groq's LLM
  4. Streams an enriched version that references actual files and APIs

License

GNU General Public License v3.0 - see LICENSE for details.

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

ai_magic_prompt-0.4.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

ai_magic_prompt-0.4.1-py3-none-any.whl (44.4 kB view details)

Uploaded Python 3

File details

Details for the file ai_magic_prompt-0.4.1.tar.gz.

File metadata

  • Download URL: ai_magic_prompt-0.4.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ai_magic_prompt-0.4.1.tar.gz
Algorithm Hash digest
SHA256 13ea142d7ebb970bf736c438cd51bc46e7229291d7d73d61d02100c049784d2f
MD5 0b1b610406c9b68731faad07e7746ad1
BLAKE2b-256 33185777c51db13865f079b3dca13814a46dd7339e15e48e93baafeb5d952650

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_magic_prompt-0.4.1.tar.gz:

Publisher: pypi-deploy.yml on arterialist/magic-prompt

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

File details

Details for the file ai_magic_prompt-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_magic_prompt-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae687668e6a84f4f8f2092645ef5b14ffc88de02926cfcc678a70310061d4ac
MD5 861277f696edc91a58e23cfec095c12b
BLAKE2b-256 dc138de60dbbaf0298243f57811c98be822d60fbcf6166585a337ada0d872ef6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_magic_prompt-0.4.1-py3-none-any.whl:

Publisher: pypi-deploy.yml on arterialist/magic-prompt

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