From 4d767da9e5dc01a7534f75683534c7e4557b9ace Mon Sep 17 00:00:00 2001 From: SOV710 Date: Sun, 5 Apr 2026 03:39:06 +0000 Subject: [PATCH] fix(prompts): make --fgm override OCO_EMOJI config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getCommitConvention gated the entire GitMoji branch on config.OCO_EMOJI, so --fgm was silently ignored unless the user had previously run `oco config set OCO_EMOJI true`. Since OCO_EMOJI defaults to false, --fgm was a no-op for most users. This violates the standard CLI convention that command-line flags should override configuration. Restructure getCommitConvention so that --fgm forces FULL_GITMOJI_SPEC regardless of OCO_EMOJI: --fgm=true → FULL_GITMOJI_SPEC --fgm=false + OCO_EMOJI=true → GITMOJI_HELP (unchanged) --fgm=false + OCO_EMOJI=false → CONVENTIONAL_COMMIT_KEYWORDS (unchanged) No other files need changes — the fgm flag was already threaded correctly through cli.ts → commit.ts → generateCommitMessageByDiff → getMainCommitPrompt → getCommitConvention. --- src/prompts.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/prompts.ts b/src/prompts.ts index 7967a58..a080804 100644 --- a/src/prompts.ts +++ b/src/prompts.ts @@ -95,11 +95,11 @@ const CONVENTIONAL_COMMIT_KEYWORDS = 'Do not preface the commit with anything, except for the conventional commit keywords: fix, feat, build, chore, ci, docs, style, refactor, perf, test.'; const getCommitConvention = (fullGitMojiSpec: boolean) => - config.OCO_EMOJI - ? fullGitMojiSpec - ? FULL_GITMOJI_SPEC - : GITMOJI_HELP - : CONVENTIONAL_COMMIT_KEYWORDS; + fullGitMojiSpec + ? FULL_GITMOJI_SPEC + : config.OCO_EMOJI + ? GITMOJI_HELP + : CONVENTIONAL_COMMIT_KEYWORDS; const getDescriptionInstruction = () => config.OCO_DESCRIPTION