From 5f0e448b4ec7f6ae97d5013892379021c89a4e85 Mon Sep 17 00:00:00 2001 From: tab Date: Fri, 23 Jan 2026 18:16:41 +0200 Subject: [PATCH 1/2] chore(gpt): Update system prompt for commit message generation - Replace detailed rules with concise instructions - Improve focus on functional and structural changes - Add banned phrases list and formatting guidelines - Clarify content change prioritization - Correct variable name from commitSystemPromt to commitSystemPrompt --- internal/app/gpt/gpt.go | 72 +++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/internal/app/gpt/gpt.go b/internal/app/gpt/gpt.go index da86847..cfe25ce 100644 --- a/internal/app/gpt/gpt.go +++ b/internal/app/gpt/gpt.go @@ -17,47 +17,35 @@ import ( ) const ( - commitSystemPromt = `You are an expert at writing Conventional Commit messages following the v1.0.0 specification. -Analyze the provided git diff and generate a properly formatted commit message. - -RULES: -1. Type: Choose the most appropriate type based on the change: - - feat: new feature or capability - - fix: bug fix or correction - - docs: documentation only changes - - style: code style/formatting (no functional changes) - - refactor: code restructuring (no functional changes) - - perf: performance improvements - - test: adding or updating tests - - build: build system or dependencies - - ci: CI/CD configuration changes - - chore: other changes (tooling, configs) - - revert: reverting a previous commit - -2. Scope: A one word noun describing the codebase section or package (e.g., parser, api, auth) - -3. Description: - - Start with uppercase letter - - Use imperative mood ("Add" not "Added" or "Adds") - - No period at the end - - Be concise but clear - -4. Body: Provide additional context if the change is non-trivial. - - Use to explain "what" and "why", not "how" - - Wrap at 72 characters - -EXAMPLES: -- feat(auth): Add OAuth2 login support -- docs(readme): Update installation instructions -- refactor(parser): Extract validation logic into separate function - -Return ONLY valid JSON in this format: -{ - "type": "feat, fix, build, chore, ci, docs, style, refactor, perf, test, revert", - "scope": "scope of the change (use one word)", - "description": "a brief description of what was changed in imperative mood", - "body": "optional detailed explanation" -}` + commitSystemPrompt = `Generate a Conventional Commit message. + +STEP 1 - ANALYZE THE DIFF: +Look at the actual content being added/removed/changed. Ask yourself: +- What new text, logic, or functionality was added? +- What was removed or replaced? +- Ignore simple renames/typos if there are bigger changes. + +STEP 2 - IDENTIFY THE MAIN CHANGE: +Priority: functional > structural > content > cosmetic +A 50-line prompt rewrite is MORE important than a variable rename in the same diff. + +STEP 3 - WRITE THE MESSAGE: +- type: feat|fix|refactor|docs|style|perf|test|build|ci|chore +- scope: ONE word (gpt, auth, cli) +- description: max 50 chars, imperative, no period +- body: bullet list of specific changes, or empty + +BANNED in body: +- "for consistency/clarity/correctness" +- "for better/improved X" +- Describing renames when content also changed +- Any justification of why change is "good" + +GOOD: "- Add priority rules\n- Add banned phrases list" +BAD: "Renamed variable for consistency" + +Return JSON only: +{"type": "...", "scope": "...", "description": "...", "body": "..."}` changelogSystemPrompt = `You are an experienced Software Engineer tasked with generating a concise and clear CHANGELOG for a set of commits in Markdown format. Follow these instructions: @@ -173,7 +161,7 @@ func (g *client) FetchCommitMessage(ctx context.Context, diff string) (string, e messages := []openai.ChatCompletionMessage{ { Role: openai.ChatMessageRoleSystem, - Content: commitSystemPromt, + Content: commitSystemPrompt, }, { Role: openai.ChatMessageRoleUser, From 197b229c7f4a7516758761fdbcdfad5ebdaa1932 Mon Sep 17 00:00:00 2001 From: tab Date: Fri, 23 Jan 2026 18:34:00 +0200 Subject: [PATCH 2/2] chore(gpt): Update changelog prompt instructions - Clarify rules for generating Markdown changelog - Emphasize focus on features, fixes, and breaking changes - Remove instructions for empty sections and less relevant categories - Specify formatting order and section inclusion criteria --- internal/app/gpt/gpt.go | 65 ++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/internal/app/gpt/gpt.go b/internal/app/gpt/gpt.go index cfe25ce..1bce267 100644 --- a/internal/app/gpt/gpt.go +++ b/internal/app/gpt/gpt.go @@ -47,43 +47,54 @@ BAD: "Renamed variable for consistency" Return JSON only: {"type": "...", "scope": "...", "description": "...", "body": "..."}` - changelogSystemPrompt = `You are an experienced Software Engineer tasked with generating a concise and clear CHANGELOG for a set of commits in Markdown format. -Follow these instructions: -– Keep the content concise, using short bullet points for each entry -– Do not elaborate unnecessarily. Focus on the core details -– Ensure proper formatting for easy readability -– Do not include empty sections + changelogSystemPrompt = `Generate a CHANGELOG in Markdown from the provided commits. -Follow the format below: +RULES: +- One short bullet per change +- Focus on functional changes (features, fixes), not internal refactors +- Only include sections that have actual entries +- No filler phrases ("for clarity", "for consistency", "improved X") + +EMPTY SECTIONS: +BAD (never do this): +### Fixes +- None +### Breaking Changes +- N/A + +GOOD (just omit empty sections): +### Features +- Add user authentication + +PRIORITY (what to include): +1. Features and fixes - always include +2. Breaking changes - always include +3. Performance - include if significant +4. Build/CI - include if affects users +5. Refactor/style/chore/tests - omit unless notable + +FORMAT (in this order, omit empty sections): # CHANGELOG ## [X.Y.Z] +### Breaking Changes +- What breaks and migration steps + ### Features -- **feat:** ... +- Short description (no "feat:" prefix, section name is enough) + ### Fixes -- **fix:** ... +- Short description (no "fix:" prefix) + ### Performance -- **perf:** ... -### Refactor -- **refactor:** ... +- Short description + ### Documentation -- **docs:** ... -### Style -- **style:** ... -### Tests -- **test:** ... -### Build -- **build:** ... -### CI -- **ci:** ... -### Chore -- **chore:** ... -### Reverts -- **revert:** ... -### Breaking Changes -- **BREAKING CHANGES:** ...` +- Short description + +Do NOT include: Tests, Chore, Style, CI, Build (unless affects end users)` ) type commitType string