Metadata-Version: 2.4
Name: promptpump
Version: 0.1.0
Summary: Deterministic context-engineering engine and prompt compiler powered by a local Ollama model.
Author: Ritesh Nipane
License: MIT
Project-URL: Homepage, https://github.com/RiteshNipane/PromptPump
Project-URL: Issues, https://github.com/RiteshNipane/PromptPump/issues
Keywords: prompt-engineering,ollama,llm,cli,context-engineering
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12
Requires-Dist: rich>=13.0
Requires-Dist: requests>=2.31
Requires-Dist: pyperclip>=1.8
Requires-Dist: pathspec>=0.11
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Dynamic: license-file

# PromptPump

A local CLI tool and Python library that turns a short shorthand prompt into a
high-density, production-ready **master prompt**. It scans your project (file tree,
README/config snippets, Python AST outlines), merges that with a strict structural
schema, and compiles it with a local model (Ollama + Qwen2.5-Coder). Nothing leaves
your machine.

## Install

Requires Python 3.10+ and [Ollama](https://ollama.com) (Windows, macOS, Linux).

```bash
ollama pull qwen2.5-coder:7b          # or qwen2.5-coder:14b for better quality
pip install pipx && pipx ensurepath   # once; then reopen your terminal
pipx install promptpump               # works in PowerShell, cmd, bash, zsh
promptpump doctor                     # verify Ollama + model
```

Plain `pip install promptpump` also works. On Linux, clipboard support needs `xclip` or `xsel`.

Develop from source: `pip install -e ".[dev]"`.

## Usage

```bash
promptpump doctor                                   # verify Ollama + model
promptpump stacks                                   # list stack profiles
promptpump run "add jwt auth to the api" --stack fastapi --copy
promptpump run "add a pause menu" --stack pygame --stack python --path ../mygame
promptpump run "refactor db layer" --dry-run        # inspect the payload, no model call
promptpump run "add caching" --no-copy > prompt.md  # progress goes to stderr, prompt to stdout
```

| Option | Description |
| --- | --- |
| `--stack/-s` | Inject stack rules (repeatable): python, fastapi, django, react, nextjs, node, pygame, pytorch |
| `--copy/--no-copy` | Copy to clipboard (default: on) |
| `--path/-p` | Project directory to scan (default: `.`) |
| `--model/-m` | Ollama model (env `PROMPTPUMP_MODEL`) |
| `--host` | Ollama URL (env `PROMPTPUMP_HOST`) |
| `--max-context-tokens` | Workspace context budget (default 3000) |
| `--ground/--no-ground` | Replace the model's `<codebase_context>` with deterministic scan facts (default: on) |
| `--dry-run` | Print the system/user payload and exit |

## Library use

```python
from promptpump import OllamaClient, PromptCompiler, scan_workspace

ctx = scan_workspace(".")
result = PromptCompiler(OllamaClient()).compile("add rate limiting", ctx, ["fastapi"])
print(result.prompt)
```

## How it stays deterministic

- Fixed system prompt and stack rules (`templates.py`); temperature 0.2 and fixed seed.
- Output validated against the seven required tags, with one automatic repair retry.
- Conversational filler and code fences stripped; `<codebase_context>` overwritten with real scan data so the model cannot hallucinate files.
- Secrets (`.env`, keys), binaries, and `.gitignore`d paths are never read.

## Tests

```bash
pytest
```

## Limitations

Only the root `.gitignore` is parsed; nested ignore files are not.
