commands.sh

code2prompt

all

Generate AI-ready prompts from a codebase (extract, filter, and format code for LLMs).

More info →

Options (5)

-i, --includeboolean

Include only specific files and exclude a directory

Example: code2prompt {{path/to/project}} {{[-i|--include]}} "{{**/*.rs}}" {{[-e|--exclude]}} "{{tests/**}}"
-e, --excludeboolean

Include only specific files and exclude a directory

Example: code2prompt {{path/to/project}} {{[-i|--include]}} "{{**/*.rs}}" {{[-e|--exclude]}} "{{tests/**}}"
-O, --output-fileboolean

Write the prompt to a file instead of the clipboard

Example: code2prompt {{path/to/project}} {{[-O|--output-file]}} {{my_prompt.txt}}
-F, --output-formatboolean

Produce structured JSON output

Example: code2prompt {{path/to/project}} {{[-F|--output-format]}} json
-t, --templateboolean

Use a custom Handlebars template when generating the prompt

Example: code2prompt {{path/to/project}} {{[-t|--template]}} {{my_template.hbs}}

Examples (5)

Generate a prompt for the current project and copy it to the clipboard (default behavior)

code2prompt path/to/project

Include only specific files and exclude a directory

code2prompt path/to/project [-i|--include] "**/*.rs" [-e|--exclude] "tests/**"

Write the prompt to a file instead of the clipboard

code2prompt path/to/project [-O|--output-file] my_prompt.txt

Produce structured JSON output

code2prompt path/to/project [-F|--output-format] json

Use a custom Handlebars template when generating the prompt

code2prompt path/to/project [-t|--template] my_template.hbs
made by @shridhargupta | data from tldr-pages