When working with an LLM, it can be incredibly useful to provide all your existing code as context.
There are many ways to do this, but one I’ve found that is working well on smaller scale projects is the following:
OSX:
find . -type f -name "*.ts" -exec echo "==== {} ====" \; -exec cat {} \; | pbcopy
Code language: PHP (php)
Ubuntu:
find . -type f -name "*.ts" -exec echo -e "\n===== {} =====\n" \; -exec cat {} \; | xclip -selection clipboard
Code language: PHP (php)
Run from the src
directory, or similar. This will recursively find any *.ts
files and output the files name, then the contents, and copy everything to your clipboard.
You can then paste directly into your LLM of choice (good with Google Gemini, particularly due to its large context size) and get better output as a result.