Skip to main content

A CLI tool to generate prompts with project structure and file contents

Project description

kopipasta

Version Downloads

A CLI tool for taking full, transparent control of your LLM context. No black boxes.

kopipasta
  • An LLM told me that "kopi" means Coffee in some languages... and a Diffusion model then made this delicious soup.

The Philosophy: You Control the Context

Many AI coding assistants use Retrieval-Augmented Generation (RAG) to automatically find what they think is relevant context. This is a black box. When the LLM gives a bad answer, you can't debug it because you don't know what context it was actually given.

kopipasta is the opposite. I built it for myself on the principle of explicit context control. You are in the driver's seat. You decide exactly what files, functions, and snippets go into the prompt. This transparency is the key to getting reliable, debuggable results from an LLM.

It's a "smart copy" command for your project, not a magic wand.

How It Works

The workflow is dead simple:

  1. Gather: Run kopipasta and point it at the files, directories, and URLs that matter for your task.
  2. Select: The tool interactively helps you choose what to include. For large files, you can send just a snippet or even hand-pick individual functions.
  3. Define: Your default editor ($EDITOR) opens for you to write your instructions to the LLM.
  4. Paste: The final, comprehensive prompt is now on your clipboard, ready to be pasted into ChatGPT, Gemini, Claude, or your LLM of choice.

Installation

# Using pipx (recommended for CLI tools)
pipx install kopipasta

# Or using standard pip
pip install kopipasta

Usage

kopipasta [options] [files_or_directories_or_urls...]

Arguments:

  • [files_or_directories_or_urls...]: One or more paths to files, directories, or web URLs to use as the starting point for your context.

Options:

  • -t TASK, --task TASK: Provide the task description directly on the command line, skipping the editor.

Key Features

  • Total Context Control: Interactively select files, directories, snippets, or even individual functions. You see everything that goes into the prompt.
  • Transparent & Explicit: No hidden RAG. You know exactly what's in the prompt because you built it. This makes debugging LLM failures possible.
  • Web-Aware: Pulls in content directly from URLs—perfect for API documentation.
  • Safety First:
    • Automatically respects your .gitignore rules.
    • Detects if you're about to include secrets from a .env file and asks what to do.
  • Context-Aware: Keeps a running total of the prompt size (in characters and estimated tokens) so you don't overload the LLM's context window.
  • Developer-Friendly:
    • Uses your familiar $EDITOR for writing task descriptions.
    • Copies the final prompt directly to your clipboard.
    • Provides syntax highlighting during chunk selection.

A Real-World Example

I had a bug where my setup.py didn't include all the dependencies from requirements.txt.

  1. I ran kopipasta -t "Update setup.py to read dependencies dynamically from requirements.txt" setup.py requirements.txt.
  2. The tool confirmed the inclusion of both files and copied the complete prompt to my clipboard.
  3. I pasted the prompt into my LLM chat window.
  4. I copied the LLM's suggested code back into my local setup.py.
  5. I tested the changes and committed.

No manual file reading, no clumsy copy-pasting, just a clean, context-rich prompt that I had full control over.

Configuration

Set your preferred command-line editor via the EDITOR environment variable.

export EDITOR=nvim  # or vim, nano, code --wait, etc.

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

kopipasta-0.35.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

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

kopipasta-0.35.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file kopipasta-0.35.0.tar.gz.

File metadata

  • Download URL: kopipasta-0.35.0.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for kopipasta-0.35.0.tar.gz
Algorithm Hash digest
SHA256 7d929bde92379f5efc386b6d02a84bd65fadedcb1a472522a94196c6bfc6dc5d
MD5 b84c41f2b26f7e43a7aa83803e2845c3
BLAKE2b-256 c156fa6e7ae0aa7ccd9bc7129b6d0e824f25dd919c26ad4eb5ec7e5e03f1b7d6

See more details on using hashes here.

File details

Details for the file kopipasta-0.35.0-py3-none-any.whl.

File metadata

  • Download URL: kopipasta-0.35.0-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for kopipasta-0.35.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7688181a13818591a739edbfe3c510b98e1061bcb2d1188ef99f17ba35d19e3d
MD5 e1de0890d677b89c859fdd362aa78a31
BLAKE2b-256 27284f63204fcb48d5428a332d3e16bf05fdf8ea4862513da6fa4d0e65a9ec1d

See more details on using hashes here.

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