refac prompt out

This commit is contained in:
Paul Gauthier 2024-12-11 19:42:01 -08:00
parent 9a278bed21
commit df300e89a2
2 changed files with 19 additions and 14 deletions

View file

@ -0,0 +1,16 @@
history_prompt = """
Update the history with changes shown in the diffs.
Describe actual user-facing changes, not every single commit that was made implementing them.
Only add new items not already listed.
Do NOT edit or update existing history entries.
Do NOT add duplicate entries for changes that have existing history entries.
End each bullet with a period.
Be sure to attribute changes to the proper .x version.
Changes in the .x-dev version should be listed under a "### main branch" heading
Also, add this as the last bullet under the "### main branch" section:
{aider_line}
""" # noqa

View file

@ -5,6 +5,8 @@ import re
import subprocess import subprocess
import tempfile import tempfile
from history_prompts import history_prompt
from aider import __version__ from aider import __version__
@ -76,20 +78,7 @@ def main():
aider_line = blame_result.stdout.strip().split("\n")[-1] # Get last line with percentage aider_line = blame_result.stdout.strip().split("\n")[-1] # Get last line with percentage
# Construct and run the aider command # Construct and run the aider command
message = f""" message = history_prompt.format(aider_line=aider_line)
Update the history with changes shown in the diffs.
Describe actual user-facing changes, not every single commit that was made implementing them.
Only add new items not already listed.
Do NOT edit or update existing history entries.
Do NOT add duplicate entries for changes that have existing history entries.
Be sure to attribute changes to the proper .x version.
Changes in the .x-dev version should be listed under a "### main branch" heading
Also, add this as the last bullet under the "### main branch" section:
{aider_line}
""" # noqa
cmd = ["aider", hist_path, "--read", diff_path, "--msg", message, "--no-auto-commit"] cmd = ["aider", hist_path, "--read", diff_path, "--msg", message, "--no-auto-commit"]
subprocess.run(cmd) subprocess.run(cmd)