raphaelmansuy / code2prompt

Code2Prompt is a powerful command-line tool that simplifies the process of providing context to Large Language Models (LLMs) by generating a comprehensive Markdown file containing the content of your codebase. ⭐ If you find Code2Prompt useful, consider giving us a star on GitHub! It helps us reach more developers and improve the tool. ⭐
MIT License
570 stars 29 forks source link

Assistant for --filter #9

Closed centminmod closed 4 months ago

centminmod commented 4 months ago

Is your feature request related to a problem? Please describe. For large code bases there maybe many extension file types so might be helpful to have a --analyse option that just gives a summary of all file extension formats found in flat or tree like format and in comma separated format list that can be copy and pasted and modified and fed into --filter option

raphaelmansuy commented 4 months ago

❤️ Thank you it is good feature. I will include this in the roadme.

raphaelmansuy commented 4 months ago

Delivered with version 0.6.13

try pipx install code2prompt --force

centminmod commented 4 months ago

Thanks 👍

pipx install code2prompt --force
Installing to existing venv 'code2prompt'
  installed package code2prompt 0.6.13, installed using Python 3.8.17
  These apps are now globally available
    - code2prompt
done! ✨ 🌟 ✨
code2prompt --help | grep analyze
  'model',         'output_tokens', 'analyze', and 'format'.
  --analyze                       Analyze the codebase and provide a summary

with --analyze maybe add --tokens support too?

code2prompt --path $projectdir --analyze --gitignore $gitignoredir --suppress-comments --tokens --encoding $encoding --case-sensitive --output project_summary_analyze.md

.00beta01: 4 files
.bbcode: 1 file
.cnf: 15 files
.conf: 57 files
.conf-fullcomments: 2 files
.default: 1 file
.html: 13 files
.idx: 1 file
.inc: 153 files
.ini: 12 files
.jpg: 2 files
.mc: 1 file
.md: 8 files
.pack: 1 file
.patch: 340 files
.php: 5 files
.png: 2 files
.py: 2 files
.rev: 1 file
.sample: 14 files
.service: 1 file
.sh: 133 files
.sysconfig: 1 file
.txt: 17 files
.yml: 66 files
.zip: 5 files
.zone: 1 file

Comma-separated list of extensions:
.00beta01,.bbcode,.cnf,.conf,.conf-fullcomments,.default,.html,.idx,.inc,.ini,.jpg,.mc,.md,.pack,.patch,.php,.png,.py,.rev,.sample,.service,.sh,.sysconfig,.txt,.yml,.zip,.zone
code2prompt --path $projectdir --gitignore $gitignoredir --filter "**.inc,**.sh,**.conf,**.md" --suppress-comments --tokens --encoding $encoding --case-sensitive --output project_summary_filtered.md

 INFO: 🔢 Token count: 4045305
✨ INFO: 📁 Output file created: project_summary_filtered.md
⚠️ WARNING: 📋 Failed to copy content to clipboard