Skip to content

Commit 5ae99ea

Browse files
author
catlog22
committed
fix: update conflict detection logic for codex review mode in execAction
1 parent 2dee01b commit 5ae99ea

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

ccw/src/commands/cli.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -698,23 +698,22 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec
698698

699699
// Prompt is required unless resuming OR using review mode with target flags
700700
// codex review: --uncommitted, --base, --commit don't require a prompt
701-
const isReviewWithTarget = mode === 'review' && (uncommitted || base || commit);
702-
703-
// Conflict detection: prompt + review target flags are mutually exclusive
704-
// When both provided, warn user and prioritize target flag (drop prompt)
705-
if (isReviewWithTarget && finalPrompt && tool === 'codex') {
706-
const targetFlag = uncommitted ? '--uncommitted' : (base ? `--base ${base}` : `--commit ${commit}`);
707-
console.log(chalk.yellow('Warning: Prompt is ignored when review target flag is specified'));
701+
// Codex review mode: prompt is always incompatible because codex exec review
702+
// defaults to --uncommitted which conflicts with prompt/stdin input.
703+
const isCodexReview = mode === 'review' && tool === 'codex';
704+
705+
// Conflict detection: codex review mode is incompatible with prompts
706+
// codex exec review always uses a target (--uncommitted by default) which conflicts with prompt input
707+
if (isCodexReview && finalPrompt) {
708+
const targetFlag = uncommitted ? '--uncommitted' : (base ? `--base ${base}` : (commit ? `--commit ${commit}` : '--uncommitted (default)'));
709+
console.log(chalk.yellow('Warning: Prompt is ignored in codex review mode'));
708710
console.log(chalk.gray(` Using: ${targetFlag} (prompt will be dropped)`));
709-
console.log(chalk.gray(' Valid combinations:'));
710-
console.log(chalk.gray(' • ccw cli -p "..." --tool codex --mode review # prompt only'));
711-
console.log(chalk.gray(' • ccw cli --tool codex --mode review --uncommitted # target only'));
712711
console.log();
713712
// Drop prompt to avoid codex CLI argument conflict
714713
finalPrompt = undefined;
715714
}
716715

717-
if (!finalPrompt && !resume && !isReviewWithTarget) {
716+
if (!finalPrompt && !resume && !isCodexReview) {
718717
console.error(chalk.red('Error: Prompt is required'));
719718
console.error(chalk.gray('Usage: ccw cli -p "<prompt>" --tool gemini'));
720719
console.error(chalk.gray(' or: ccw cli -f prompt.txt --tool codex'));
@@ -729,7 +728,7 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec
729728
// Skip template loading when using target flags with codex review
730729
// codex review: --uncommitted, --base, --commit are all mutually exclusive with [PROMPT]
731730
// Default to universal-rigorous-style if --rule not specified
732-
const skipTemplates = mode === 'review' && (uncommitted || base || commit);
731+
const skipTemplates = isCodexReview;
733732
const effectiveRule = rule || 'universal-rigorous-style';
734733
let systemRules = ''; // Protocol content
735734
let roles = ''; // Template content

0 commit comments

Comments
 (0)