diff --git a/docs-master/Config.md b/docs-master/Config.md index 38887b3e2..92256be18 100644 --- a/docs-master/Config.md +++ b/docs-master/Config.md @@ -481,6 +481,13 @@ git: # to 40 to disable truncation. truncateCopiedCommitHashesTo: 12 + # Config for external commit message generation (e.g. AI) + commitMessageGenerator: + # Shell command to generate a commit message from staged changes. + # The command should call `git diff --cached` itself and output a + # commit message (first line = title, rest after blank line = body). + command: "" + # Periodic update checks update: # One of: 'prompt' (default) | 'background' | 'never' diff --git a/pkg/gui/controllers/helpers/commits_helper.go b/pkg/gui/controllers/helpers/commits_helper.go index f6ae4f0f4..19c86f5be 100644 --- a/pkg/gui/controllers/helpers/commits_helper.go +++ b/pkg/gui/controllers/helpers/commits_helper.go @@ -253,7 +253,7 @@ func (self *CommitsHelper) addCoAuthor(suggestionFunc func(string) []*types.Sugg func (self *CommitsHelper) generateCommitMessageAsync(command string) { origSubtitle := self.c.Views().CommitDescription.Subtitle - self.c.Views().CommitDescription.Subtitle = "Generating commit message..." + self.c.Views().CommitDescription.Subtitle = self.c.Tr.GeneratingCommitMessage // Snapshot current content so we can detect user edits origSummary := self.getCommitSummary() diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index ce87693a2..3fd07c189 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -331,6 +331,7 @@ type TranslationSet struct { CommitSummaryTitle string CommitDescriptionTitle string CommitDescriptionSubTitle string + GeneratingCommitMessage string CommitDescriptionFooter string CommitDescriptionFooterTwoBindings string CommitHooksDisabledSubTitle string @@ -1434,6 +1435,7 @@ func EnglishTranslationSet() *TranslationSet { CommitSummaryTitle: "Commit summary", CommitDescriptionTitle: "Commit description", CommitDescriptionSubTitle: "Press {{.togglePanelKeyBinding}} to toggle focus, {{.commitMenuKeybinding}} to open menu", + GeneratingCommitMessage: "Generating commit message...", CommitDescriptionFooter: "Press {{.confirmInEditorKeybinding}} to submit", CommitDescriptionFooterTwoBindings: "Press {{.confirmInEditorKeybinding1}} or {{.confirmInEditorKeybinding2}} to submit", CommitHooksDisabledSubTitle: "(hooks disabled)", diff --git a/schema-master/config.json b/schema-master/config.json index 0e880b066..ea406f941 100644 --- a/schema-master/config.json +++ b/schema-master/config.json @@ -37,6 +37,17 @@ "type": "object", "description": "Config relating to the commit length indicator" }, + "CommitMessageGeneratorConfig": { + "properties": { + "command": { + "type": "string", + "description": "Shell command to generate a commit message from staged changes.\nThe command should call `git diff --cached` itself and output a\ncommit message (first line = title, rest after blank line = body)." + } + }, + "additionalProperties": false, + "type": "object", + "description": "Config for external commit message generation (e.g. AI)" + }, "CommitPrefixConfig": { "properties": { "pattern": { @@ -446,6 +457,10 @@ "type": "integer", "description": "When copying commit hashes to the clipboard, truncate them to this length. Set to 40 to disable truncation.", "default": 12 + }, + "commitMessageGenerator": { + "$ref": "#/$defs/CommitMessageGeneratorConfig", + "description": "Config for external commit message generation (e.g. AI)" } }, "additionalProperties": false,