Metadata-Version: 2.4
Name: jh-prompt-gen
Version: 1.0.0
Summary: A small toolkit to collect code from local directories and automatically generate ChatGPT prompts.
Author: Dev-CorliJoni
License-Expression: MIT
Project-URL: GitHub, https://github.com/Dev-CorliJoni/jh-prompt-gen
Project-URL: Instagram, https://www.instagram.com/dev.corlijoni/
Keywords: prompt,cli,code,chatgpt,automation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyperclip
Dynamic: license-file

# 🤖 Generate Custom Prompts

A small toolkit to collect code from local directories and automatically generate ChatGPT prompts.

---

## 📁 Contents

- **copy-jh-clipboard.py**  
  Copies files or entire directories (recursive) to the clipboard or stdout, with banner headers and indentation.

- **gen-jh-prompt.py**  
  Reads the clipboard output and builds a ChatGPT prompt based on templates defined in `.jhpromptconfig`.

---

## 🚀 Installation

1. Ensure you have Python 3.7 or higher.
2. Install package:
   ```bash
   pip install jh-prompt-gen

---
## ⚙️ Configuration & Ignore

If a `.jhpromptconfig` or `.jhclipignore` file exists in the target directory, it will be automatically applied when running the tool. To specify a different config or ignore file, use the `-c` (`--config-file`) or `-I` (`--ignore-file`) options respectively.

---

## 🔒 Privacy & Security

For security reasons, you can target only specific subdirectories; this prevents accidental exposure of root-level or sensitive files. Use ignore patterns in `.jhclipignore` to exclude sensitive files (e.g., credentials, logs, personal data) from being sent to the AI.

---


## 📝 Example `.jhclipignore`

```gitignore
.jh*
.DS_Store
.git/
frontend/node_modules/
frontend/dist/
frontend/package-lock.json
frontend/public/rootCA.pem
```

### 🔍 How `.jhclipignore` works

- Follows Git’s ignore semantics (glob patterns).  
- Lines without a trailing slash match files anywhere (`.DS_Store` matches any file named `.DS_Store`).  
- Patterns ending with `/` only match directories and their contents (`.git/` excludes the `.git` folder).  
- Wildcards (`*`) match zero or more characters (`.jh*` matches `.jhclipignore`, `.jhpromptconfig`, etc.).

---

## ⚙️ Example `.jhpromptconfig`

```ini
persona="You are a React developer."
project="My Project"

sophisticated_prompt="""
{persona}. Optimize my {project}. Please make it even better using advanced patterns.

My code:
{code}

New Feature: {feature}
"""

default_prompt_pattern="""
{persona}. Optimize my {project}.

My code:
{code}

New Feature: {feature}
"""
```

### 🔍 How `.jhpromptconfig` works

- **Single-line entries**: `KEY=value` sets simple variables (e.g. `persona`, `project`).  
- **Multi-line templates**: `KEY="""..."""` allows you to define named prompt templates containing `{placeholders}`.  
- **Default template**: the `default_prompt_pattern` key is used when you don’t specify a template name.  
- **Named templates**: any other key (e.g. `sophisticated_prompt`) can be selected via the `--pattern` option in `gen-jh-prompt.py`.  
- **Placeholders**: `{code}` inserts captured code, `{feature}` inserts your feature description, and you can add any custom placeholders and override them with `-f KEY=VALUE`.


---
## ⚡️ Usage 
### 💬 Generate Custom Prompt with project code to clipboard

#### Default prompt template: "default_prompt_pattern"
`jh-gen-prompt.py ./src "Add authentication"`

#### Named template from .jhpromptconfig
`jh-gen-prompt.py ./src "Add authentication" -p sophisticated_prompt`

### 📋 Copy only code to clipboard

#### Default ignore rules
`jh-copy-clipboard.py ./src`

#### Custom ignore patterns and explicit ignore file
`jh-copy-clipboard.py ./src -i '*.pyc' -i 'node_modules/' -I .jhclipignore`
