From 2fa5d14369065c7f7fdaf2ec48020f017cf87903 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sat, 31 Jan 2026 04:00:17 +0000 Subject: [PATCH] fix: resolve CI build failures --- git_commit_ai/core/prompt_builder.py | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 git_commit_ai/core/prompt_builder.py diff --git a/git_commit_ai/core/prompt_builder.py b/git_commit_ai/core/prompt_builder.py new file mode 100644 index 0000000..8e6c753 --- /dev/null +++ b/git_commit_ai/core/prompt_builder.py @@ -0,0 +1,30 @@ +CONVENTIONAL_PROMPT = """Generate a conventional commit message for these changes. +Format: (): + +Types: feat, fix, docs, style, refactor, test, chore + +Changes: +{diff} + +Recent commits for context: +{history} + +Respond with only the commit message.""" + +DEFAULT_PROMPT = """Generate a concise commit message for these changes. + +Changes: +{diff} + +Recent commits for context: +{history} + +Respond with only the commit message.""" + +def build_prompt(diff, conventional=False, history=None): + """Build prompt for commit message generation.""" + diff_text = "\n".join(diff) if isinstance(diff, list) else str(diff) + history_text = "\n".join(history) if history else "No previous commits" + + template = CONVENTIONAL_PROMPT if conventional else DEFAULT_PROMPT + return template.format(diff=diff_text, history=history_text)