Load GitHub repository contents as fragments
Install this plugin in the same environment as LLM.
llm install llm-fragments-github
Use -f github:user/repo
to include every text file from the specified GitHub repo as a fragment. For example:
llm -f github:simonw/files-to-prompt 'suggest new features for this tool'
Ue -f issue:user/repo/number
to include the combined Markdown text of a specific issue. For example:
llm -f https://raw.githubusercontent.com/simonw/llm-fragments-github/refs/tags/0.1/llm_fragments_github.py \
-f issue:simonw/llm-fragments-github/3 \
'Propose an implementation for this issue'
The issue:
prefix can also accept a URL to a GitHub issue, for example:
llm -f issue:https://github.com/simonw/llm-fragments-github/issues/3 \
'muse on this a bit'
Set an API token in the environment variable GITHUB_TOKEN
to access private repositories or increase your rate limit.
Use -f pr:user/repo/number
to load the Markdown text and diff for a specified pull request. This also accepts a URL to a pull request.
llm -f pr:simonw/llm-fragments-github/9 'code review'
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-fragments-github
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
llm install -e '.[test]'
To run the tests:
python -m pytest