Skip to main content

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

  1. Ensure you have Python 3.7 or higher.
  2. 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_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

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

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

jh_prompt_gen-1.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

jh_prompt_gen-1.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file jh_prompt_gen-1.0.1.tar.gz.

File metadata

  • Download URL: jh_prompt_gen-1.0.1.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

Hashes for jh_prompt_gen-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5177848f0bd179cd551e428083c5e979c6104235a8333f6888d35d71775f800a
MD5 ee5deadea38d27ccf820d3a9f69b0ea1
BLAKE2b-256 e49b2127d6c08f93f1dfc15292fddf0f02400161845ee25eed121a14e4247e2a

See more details on using hashes here.

File details

Details for the file jh_prompt_gen-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: jh_prompt_gen-1.0.1-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

Hashes for jh_prompt_gen-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 890ffcdbf9460750a82d38ad7ee117ac3101c81d01ed3354e5d22c23350524d5
MD5 78113ea928fc655109d1d2eaf48afd4d
BLAKE2b-256 9699a3dd56f173aac95434376ad3e894bcee632b45c5eaa7a84f7a9a9cbb6995

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