Feeding files into an LLM
Source: https://news.ycombinator.com/item?id=43048831
Basic approach
find . -print -exec cat {} \; -exec echo \;
This returns the filename and content for each file, which you can pipe to pbcopy to paste into an LLM.
Improved version
find . \
-type d \( -path ./bin -o -path ./debug -o -path ./obj \) -prune -o \
-type f \( -name "*.cs" -o -name "*.md" \) \
! \( -name "Program.cs" -o -name "*Temp*.cs" \) \
-exec echo -n $'```\n// ' \; \
-print -exec cat {} \; \
-exec echo $'```\n' \; | pbcopy
Breakdown
find .- Start from current directory-type d \( -path ./bin -o -path ./debug -o -path ./obj \) -prune -o- Skip specified directories (build artifacts)-type f \( -name "*.cs" -o -name "*.md" \)- Include only specific file types! \( -name "Program.cs" -o -name "*Temp*.cs" \)- Exclude specific files-exec echo -n $'```\n// ' \;- Start code block with comment prefix-print- Print filename-exec cat {} \;- Print file contents-exec echo $'```\n' \;- End code block| pbcopy- Copy it all to the clipboard