code2prompt icon indicating copy to clipboard operation
code2prompt copied to clipboard

Filter source_tree for changed files when using --git-diff-branch

Open ViktorJT opened this issue 5 months ago • 2 comments

Right now the entire source_tree is generated unless files are explicitly excluded, would be great if only diffed files would show up in the source tree to avoid consuming so many tokens?

Thanks a lot for this project, it's super helpful :)

ViktorJT avatar Jul 10 '25 18:07 ViktorJT

Hi @ViktorJT,

It sounds to be an interesting idea. We could only gather the context from diffed files.

Therefore, it won't be in the tree AND not in the actual codebase content. Or do you want to include only diffed files in the tree and include the whole codebase in the content ?

Do I understand your idea properly ?

ODAncona avatar Jul 17 '25 05:07 ODAncona

Ah great!

I was thinking more how --include already works: where both the source tree and codebase content are filtered by a pattern unless the full directory flag is passed?

The problem I'm trying to solve is that my source tree output is quite large and takes up too many tokens :)

ViktorJT avatar Jul 24 '25 19:07 ViktorJT