Skip to main content

A CLI tool to capture code and automatically generate ChatGPT prompts for your projects.

Project description

📦 Prompt Generator Toolkit

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 dependency:
    pip install pyperclip
    
  3. Make scripts executable:
    chmod +x copy-jh-clipboard.py gen-jh-prompt.py
    

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 Examples

1. Copy code using default ignore rules

copy-jh-clipboard.py ./src

2. Copy code with custom ignore patterns and explicit ignore file

copy-jh-clipboard.py ./src -i '*.pyc' -i 'node_modules/' -I .jhclipignore

3. Generate a prompt using the default template

gen-jh-prompt.py ./src "Add authentication"

4. Generate a prompt using a named template from .jhpromptconfig

gen-jh-prompt.py ./src "Add authentication" -p sophisticated_prompt

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-0.1.0.tar.gz (7.1 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-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jh_prompt_gen-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 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-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fab6eb2d0caa334bc06255b6b9cd77f9f3928009ef73e5daeb82fe65c2ef8bf0
MD5 56b71ee6d29fcc122bcf67788be47dd4
BLAKE2b-256 dbba9049042e4e15ee0601b9ff7540423a286688653cd280eec2ebedcf147360

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jh_prompt_gen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d2a7018c6b15565cfdb139f6d7ee66c1314c808b73f5041d8f108e7b46388c2
MD5 178c58d892223dfab22e367072d4f467
BLAKE2b-256 8914a416e4636324c9379f1e4b1329b2a9a403fc930d956c010fa0b8abedff89

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