Skip to content

nmarley/gptfeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

gptfeed - Output files in a specific format for LLM consumption

A command-line utility that formats files for easy consumption by Large Language Models (LLMs). It wraps file contents in customizable container tags with appropriate comment syntax for different file types.

Usage

gptfeed [OPTIONS] [FILES]...

If no files are provided, or if "-" is specified as a filename, the tool will read from stdin.

Options

  • -c, --container <CONTAINER>: Specify the container tag (default: "code")
  • -m, --comment-prefix <COMMENT_PREFIX>: Set a custom comment prefix (default: auto-detect based on file extension)

Sample Output

The filename in the output makes it easy for LLMs to differentiate where one file ends and another begins.

<code>
// main.ts
const greet = () => {
    console.log("Hello world!");
};

# script.py
def hello():
    print("Hello world!")
</code>

By default, the comment style is automatically determined based on the file extension (// for JavaScript, # for Python, etc.).

This can be overridden with the --comment-prefix option, which will be applied for all files passed to the command.

The <code> XML tag is used as a container for the file contents. This can be customized with the --container option, e.g.:

gptfeed --container hello --comment-prefix '#' main.ts

<hello>
# main.ts
const greet = () => {
  console.log("Hello, world!");
};
</hello>

Examples

Reading from stdin

You can pipe content directly to gptfeed:

cat file.js | gptfeed

Or:

echo "console.log('Hello');" | gptfeed

You can also use the "-" placeholder to mix stdin with files:

cat file.js | gptfeed - other_file.py

Pipe to Clipboard on macOS

You can easily pipe the output of gptfeed directly to your clipboard using pbcopy:

gptfeed path/to/your/file.js | pbcopy

This copies the formatted file content to your clipboard, ready to be pasted into your LLM interface.

Processing Multiple Files

Process multiple files at once and pipe to clipboard:

gptfeed main.js script.py | pbcopy

License

This project is licensed under either of

About

No description, website, or topics provided.

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
ISC
LICENSE-ISC
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages