From 4056bfa5472c899be26c5ca17aaa0df2784c1f0d Mon Sep 17 00:00:00 2001 From: SOV710 Date: Sun, 5 Apr 2026 03:36:30 +0000 Subject: [PATCH] fix(cli): strip -y/--fgm from extraArgs to prevent git commit conflict Same class of bug as the -c/--context fix: these flags could leak into extraArgs and be forwarded to the internal `git commit` call, causing unexpected behavior. Extend the extraArgs sanitization to also strip -y, --yes, --fgm, and their values. --- src/cli.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index b01ea00..80b1e22 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -23,7 +23,8 @@ const config = getConfig(); setupProxy(config.OCO_PROXY); const OCO_FLAGS_WITH_VALUE = new Set(['-c', '--context']); -const OCO_EQUALS_PREFIXES = ['-c=', '--context=']; +const OCO_BOOLEAN_FLAGS = new Set(['-y', '--yes', '--fgm']); +const OCO_EQUALS_PREFIXES = ['-c=', '--context=', '-y=', '--yes=', '--fgm=']; const stripOcoFlags = (argv: string[]): string[] => { const out: string[] = []; @@ -34,7 +35,11 @@ const stripOcoFlags = (argv: string[]): string[] => { i++; // skip the value token too continue; } - // Equals form: -c=…, --context=… + // Boolean flags: -y, --yes, --fgm + if (OCO_BOOLEAN_FLAGS.has(a)) { + continue; + } + // Equals form: -c=…, --context=…, -y=…, --yes=…, --fgm=… if (OCO_EQUALS_PREFIXES.some((prefix) => a.startsWith(prefix))) { continue; }