From df300e89a21c35a78ed91da5ab3860e47c7fd93d Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 11 Dec 2024 19:42:01 -0800 Subject: [PATCH] refac prompt out --- scripts/history_prompts.py | 16 ++++++++++++++++ scripts/update-history.py | 17 +++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 scripts/history_prompts.py diff --git a/scripts/history_prompts.py b/scripts/history_prompts.py new file mode 100644 index 000000000..4b01bd1bc --- /dev/null +++ b/scripts/history_prompts.py @@ -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 diff --git a/scripts/update-history.py b/scripts/update-history.py index d8b373a56..52ac5e1b9 100755 --- a/scripts/update-history.py +++ b/scripts/update-history.py @@ -5,6 +5,8 @@ import re import subprocess import tempfile +from history_prompts import history_prompt + from aider import __version__ @@ -76,20 +78,7 @@ def main(): aider_line = blame_result.stdout.strip().split("\n")[-1] # Get last line with percentage # Construct and run the aider command - message = f""" -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 + message = history_prompt.format(aider_line=aider_line) cmd = ["aider", hist_path, "--read", diff_path, "--msg", message, "--no-auto-commit"] subprocess.run(cmd)