This project contains three sets of prompts. These represent different stages of improvements to an assistant that can help developers configure githooks in their project.
prompts/
├── git_hooks_with_linguist.md
├── git_hooks.md
├── git_hooks_single_step.md
Make sure that your local Docker Desktop engine is running. Besides a running docker engine and access to Docker Hub, no other tools need to be pre-installed.
The default version of scripts use openai. To run these tests, you will need to write your OpenAI API key to the a file named $HOME/.openai-api-key
.
The second argument to each of the scripts below should be the path to the root of some git cloned project.
Start by prompting an LLM with a prompt such as:
How do I setup githooks?
The results are useful but very general and lack project context.
In the first set of prompts, we add one capability to the LLM. We give it a tool to do linguistic analysis on the project and then ask it to setup the githooks. You can try this verion of the prompts using OpenAI by running.
./prompts/run_prompts.sh "github:docker/labs-githooks?ref=main&path=prompts/git_hooks_with_linguist.md" {/absolute/path/to/your/project}
We can make the advice even more specific by augmenting the prompts with information about how we prefer to setup githooks. See this example where we describe how to setup githooks using the pre-commit tool.
Run this set of prompts using:
./prompts/run_prompts.sh "github:docker/labs-githooks?ref=main&path=prompts/git_hooks.md" {/absolute/path/to/your/project}
Finally, a set of prompts which can takes the LLM response and then calls a function that configures the githooks in the root of your project. This script will make updates to your .git/hooks folder and add an assistant authored pre-commig-config.yaml file. It can be run using:
./prompts/run_prompts.sh "github:docker/labs-githooks?ref=main&path=prompts/git_hooks_single_step.md" {/absolute/path/to/your/project}
After analyzing the project for different file types and setting up the githooks,
both the pre-commit
and
commit-msg
hooks are configured by the assistant. All tools run in containers but even the githooks themselves are containerized.
This allows us to distribute an assistant that relies only on access to trusted set of docker images.