refactor(git,commitGenerator): add git context with stat and improve prompt structure

- introduce `getGitContext` returning both diff and name-status stat output
- update `generateForRepository` and `performGeneration` to consume new context
- prefix prompt with changed files stat block when available
- replace `commitStyle` config key with `promptVersion` using `LATEST_PROMPT_VERSION`
- fix first-commit diff logic to use else-branch instead of fallthrough checks
- update extension icon
This commit is contained in:
2026-04-24 12:22:01 -04:00
parent f5f6a2f703
commit 4471c2b2b2
5 changed files with 94 additions and 21 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
import * as vscode from "vscode"
import { SYSTEM_PROMPT, CONVENTIONAL_INSTRUCTION, SIMPLE_INSTRUCTION } from "./prompts"
import { SYSTEM_PROMPT, getPrompt } from "./prompts"
export interface AIProvider {
generateCommitMessage(diff: string, style: string, signal: AbortSignal): AsyncIterable<string>
@@ -15,7 +15,7 @@ class OpenAICompatibleProvider implements AIProvider {
) {}
async *generateCommitMessage(diff: string, style: string, signal: AbortSignal): AsyncIterable<string> {
const instruction = style === "conventional" ? CONVENTIONAL_INSTRUCTION : SIMPLE_INSTRUCTION
const instruction = getPrompt(style)
const url = `${this.baseUrl}/chat/completions`
const response = await fetch(url, {
@@ -58,7 +58,7 @@ class AnthropicProvider implements AIProvider {
) {}
async *generateCommitMessage(diff: string, style: string, signal: AbortSignal): AsyncIterable<string> {
const instruction = style === "conventional" ? CONVENTIONAL_INSTRUCTION : SIMPLE_INSTRUCTION
const instruction = getPrompt(style)
const url = `${this.baseUrl}/messages`
const response = await fetch(url, {