A small toolkit to collect code from local directories and automatically generate ChatGPT prompts.
Project description
🤖 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
- Ensure you have Python 3.7 or higher.
- Install package:
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
.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_Storematches any file named.DS_Store). - Patterns ending with
/only match directories and their contents (.git/excludes the.gitfolder). - Wildcards (
*) match zero or more characters (.jh*matches.jhclipignore,.jhpromptconfig, etc.).
⚙️ Example .jhpromptconfig
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=valuesets simple variables (e.g.persona,project). - Multi-line templates:
KEY="""..."""allows you to define named prompt templates containing{placeholders}. - Default template: the
default_prompt_patternkey is used when you don’t specify a template name. - Named templates: any other key (e.g.
sophisticated_prompt) can be selected via the--patternoption ingen-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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jh_prompt_gen-1.0.0.tar.gz.
File metadata
- Download URL: jh_prompt_gen-1.0.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13c86d312f65fbce1c88af5ae8a867450408215001ad27d8eca964dceb94e280
|
|
| MD5 |
dcefc4507566c5bf32ef1dcf4c4ecf82
|
|
| BLAKE2b-256 |
725f2beb5534851d65a1b44de362a66ddc37d3e9449d3a3f1ed4c16c9834d4cb
|
File details
Details for the file jh_prompt_gen-1.0.0-py3-none-any.whl.
File metadata
- Download URL: jh_prompt_gen-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d26e7f533922619f28904f8028ac75f7f8ab836c5065fa7ff2bd60aaccab506e
|
|
| MD5 |
7182f78ddb44e77db56d7d8b7a380132
|
|
| BLAKE2b-256 |
8abce1833c9f10666cc5bd2be209c911337988ec4130d3ec4bf75e34439f2476
|