snippetbashTip
code2prompt — Generate AI-ready prompts from a codebase (extract, filter, and format code for LLMs). More informat
Viewed 0 times
commandcodebasefromclireadycode2promptpromptsgenerate
Problem
How to use the
code2prompt command: Generate AI-ready prompts from a codebase (extract, filter, and format code for LLMs). More information: <https://code2prompt.dev/docs/how_to/filter_files/>.Solution
code2prompt — Generate AI-ready prompts from a codebase (extract, filter, and format code for LLMs). More information: <https://code2prompt.dev/docs/how_to/filter_files/>.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]}} jsonUse a custom Handlebars template when generating the prompt:
code2prompt {{path/to/project}} {{[-t|--template]}} {{my_template.hbs}}Code Snippets
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]}} jsonUse a custom Handlebars template when generating the prompt
code2prompt {{path/to/project}} {{[-t|--template]}} {{my_template.hbs}}Context
tldr-pages: common/code2prompt
Revisions (0)
No revisions yet.