File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,15 @@ export const generateCommitMessageByDiff = async (
168168
169169 const commitMessages = await Promise . all ( commitMessagePromises ) ;
170170
171+ // When OCO_ONE_LINE_COMMIT is enabled, combine the first line of each
172+ // split-diff message into a single line instead of joining with '\n\n'.
173+ if ( config . OCO_ONE_LINE_COMMIT ) {
174+ return commitMessages
175+ . filter ( Boolean )
176+ . map ( ( msg ) => msg ! . split ( '\n' ) [ 0 ] . trim ( ) )
177+ . join ( '; ' ) ;
178+ }
179+
171180 return commitMessages . join ( '\n\n' ) ;
172181 }
173182
Original file line number Diff line number Diff line change @@ -240,7 +240,17 @@ export const getMainCommitPrompt = async (
240240 }
241241
242242 // Replace example prompt with a prompt that's generated by OpenAI for the commitlint config.
243- const commitLintConfig = await utils . getCommitlintLLMConfig ( ) ;
243+ let commitLintConfig = await utils . getCommitlintLLMConfig ( ) ;
244+
245+ // Guard against outdated or corrupted config files that are missing the
246+ // prompts field (e.g. generated by an older version of opencommit).
247+ if ( ! Array . isArray ( commitLintConfig . prompts ) ) {
248+ note (
249+ 'Commitlint LLM config is missing prompts, regenerating...'
250+ ) ;
251+ await configureCommitlintIntegration ( true ) ;
252+ commitLintConfig = await utils . getCommitlintLLMConfig ( ) ;
253+ }
244254
245255 return [
246256 commitlintPrompts . INIT_MAIN_PROMPT (
You can’t perform that action at this time.
0 commit comments