Skip to content

Commit

Permalink
fix a nasy overlooked issue for porcelain commands and try to make AG…
Browse files Browse the repository at this point in the history
…it only give git commands no grep no sort etc
  • Loading branch information
sivang committed Oct 4, 2023
1 parent f6d9e8c commit 497e5c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions agit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@


DESTRUCTIVE_COMMANDS = {
"git push --force": "Force pushes can overwrite remote branches, potentially discarding commits.",
"git push -f": "Shortened version of 'git push --force'.",
"git branch -D": "Force deletes a branch, regardless of its merged status.",
"git branch -d": "Deletes a branch. Not generally destructive, but included for completeness.",
"git checkout -B": "Creates a new branch or resets an existing branch to a start point. Could overwrite work on existing branches.",
"git checkout -b": "Creates a new branch. Not generally destructive, but included for completeness.",
"git clean -fd": "Force deletes untracked files and directories in the working copy, potentially erasing work.",
"git clean -f": "Force deletes untracked files in the working copy, potentially erasing work.",
"push --force": "Force pushes can overwrite remote branches, potentially discarding commits.",
"push -f": "Shortened version of 'git push --force'.",
"branch -D": "Force deletes a branch, regardless of its merged status.",
"branch -d": "Deletes a branch. Not generally destructive, but included for completeness.",
"checkout -B": "Creates a new branch or resets an existing branch to a start point. Could overwrite work on existing branches.",
"checkout -b": "Creates a new branch. Not generally destructive, but included for completeness.",
"clean -fd": "Force deletes untracked files and directories in the working copy, potentially erasing work.",
"clean -f": "Force deletes untracked files in the working copy, potentially erasing work.",
"reset --hard": "Resets the index and working tree to match a specified commit. Any changes to tracked files in the working tree since the specified commit are lost.",
"reset --soft": "Moves the HEAD to a specified commit. Changes since the specified commit are kept. Can be destructive if not handled properly.",
"reset --mixed": "Resets the index but not the working tree and reports what has not been updated.",
Expand Down
5 changes: 3 additions & 2 deletions agit/openai_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ async def translate_to_git_command(natural_language, explain):
"role": "system",
"content": "You are an expert git revision control system mentor, you translate natural language to a "
"coherent git command. You will only return commands that are for the git RCS tool and refuse "
"commands to other software."
"commands to other software. You will not use ANY OTHER commands like grep or sort or anything similar -- "
"Just plain git revision control commands."
f"You will also return short description of the command to the user.",
},
{
Expand All @@ -62,7 +63,7 @@ async def translate_to_git_command(natural_language, explain):
openai.ChatCompletion.acreate(
model="gpt-3.5-turbo-16k",
messages=prompt_template,
temperature=0.2,
temperature=0.1,
)
)
with tqdm.tqdm(
Expand Down

0 comments on commit 497e5c9

Please sign in to comment.