-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from docker/cm/git-basics
Add prompts for basic git actions
- Loading branch information
Showing
6 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
You are an expert for managing git branches in a project. | ||
|
||
The only commands you deal with are `branch`, `checkout` or `merge`. | ||
|
||
`rebase` can rewrite history and therefore should not be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The user wants to complete the following task related to git branches: | ||
|
||
{{task}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
model: gpt-4 | ||
stream: true | ||
functions: | ||
- name: git | ||
description: Run git branch-related commands against a project | ||
parameters: | ||
type: object | ||
properties: | ||
command: | ||
type: string | ||
description: The branch command. Either `branch`, `checkout` or `merge`. `rebase` can rewrite history and therefore should not be used. | ||
args: | ||
type: array | ||
description: The arguments to pass into the git command | ||
items: | ||
type: string | ||
description: An argument to the git command | ||
container: | ||
image: alpine/git:latest | ||
--- | ||
|
||
# Background | ||
|
||
Branch management is a common use case of git, so this tool is used to execute branch and related commands (git checkout, git branch, git merge) | ||
|
||
## Running the tool | ||
|
||
```sh | ||
DIR=$PWD | ||
docker run --rm -it \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
--mount type=volume,source=docker-prompts,target=/prompts \ | ||
--mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \ | ||
--mount type=bind,source=/Users/slim/docker/labs-make-runbook/prompts,target=/my-prompts \ | ||
--workdir /my-prompts \ | ||
vonwig/prompts:latest run \ | ||
$DIR \ | ||
$USER \ | ||
"$(uname -o)" \ | ||
git_branches | ||
# "github:docker/labs-make-runbook?ref=main&path=prompts/git_branches" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
You are an expert for managing files in a git project. | ||
|
||
Either `rm`, `add` or `mv`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The user wants to complete the following task related to git files: | ||
|
||
{{task}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
model: gpt-4 | ||
stream: true | ||
functions: | ||
- name: git | ||
description: Run git file-related commands against a project | ||
parameters: | ||
type: object | ||
properties: | ||
command: | ||
type: string | ||
description: The branch command. Either `rm`, `mv` or `add`. | ||
args: | ||
type: array | ||
description: The arguments to pass into the git command | ||
items: | ||
type: string | ||
description: An argument to the git command | ||
container: | ||
image: alpine/git:latest | ||
--- | ||
|
||
# Background | ||
|
||
File management is a common use case of git, so this tool is used to execute commands to manage the staged files in a git repo (git rm, git add, git mv) | ||
|
||
## Running the tool | ||
|
||
```sh | ||
DIR=$PWD | ||
docker run --rm -it \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
--mount type=volume,source=docker-prompts,target=/prompts \ | ||
--mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \ | ||
--mount type=bind,source=/Users/slim/docker/labs-make-runbook/prompts,target=/my-prompts \ | ||
--workdir /my-prompts \ | ||
vonwig/prompts:latest run \ | ||
$DIR \ | ||
$USER \ | ||
"$(uname -o)" \ | ||
git_files | ||
# "github:docker/labs-make-runbook?ref=main&path=prompts/git_files" | ||
``` |