Show HN: c2p – Code to Prompt

  • Hi HN,

    c2p is a lightweight utility binary that allows you to quickly pattern match files in your repo and turn them into a single prompt that you can copy into your clipboard and paste into LLM tools including ChatGPT. I built c2p because I found usage of ChatGPT becomes unwieldy once I want to use it for multiple file projects.

    The way it works is under the hood c2p turns your list of patterns/globs/etc into a list of files. It then constructs a prompt that looks as follows:

    File: {filepath}

    {contents}

    for every file that matches your inputted pattern.

    As an example I ran

    `c2p src/.rs migrations/*/.sql | pbcopy`

    In a small rust webserver side repository, prefixed the prompt with some instructions directing ChatGPT to add a new feature, and bam ChatGPT took in the context of the entire repository and gave me the exact changes I needed to make to ship my feature: https://chat.openai.com/share/3c674621-e526-45b7-bce8-10c38e...

    I thought this was super mind-blowing so I wanted to share it with HN to see if it would be useful to others.