From 690597bae89939683d782d1679542a16757e3036 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Sun, 1 Feb 2026 23:51:58 +0800 Subject: [PATCH] fix(cli): fix codex review command argument handling - Fix prompt incorrectly passed to codex review with target flags (--uncommitted/--base/--commit) - Remove unsupported --skip-git-repo-check flag from codex review command - Fix TypeScript type error in codex-lens.ts (missing 'installed' property) Codex CLI constraint: --uncommitted/--base/--commit and [PROMPT] are mutually exclusive. --- ccw/src/commands/cli.ts | 4 +++- ccw/src/tools/cli-executor-utils.ts | 3 +-- ccw/src/tools/codex-lens.ts | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ccw/src/commands/cli.ts b/ccw/src/commands/cli.ts index 0b70309e..72497f4f 100644 --- a/ccw/src/commands/cli.ts +++ b/ccw/src/commands/cli.ts @@ -702,7 +702,9 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec // Handle cache option: pack @patterns and/or content let cacheSessionId: string | undefined; - let actualPrompt = prompt_to_use; + // When skipTemplates is true (review mode with target flags), don't pass prompt to codex CLI + // because --uncommitted/--base/--commit and [PROMPT] are mutually exclusive + let actualPrompt = skipTemplates ? '' : prompt_to_use; if (cache) { const { handler: contextCacheHandler } = await import('../tools/context-cache.js'); diff --git a/ccw/src/tools/cli-executor-utils.ts b/ccw/src/tools/cli-executor-utils.ts index 90e765ed..4de729d2 100644 --- a/ccw/src/tools/cli-executor-utils.ts +++ b/ccw/src/tools/cli-executor-utils.ts @@ -254,8 +254,7 @@ export function buildCommand(params: { // codex review uses -c key=value for config override, not -m args.push('-c', `model=${model}`); } - // Skip git repo check by default for codex (allows non-git directories) - args.push('--skip-git-repo-check'); + // Note: --skip-git-repo-check is NOT supported by codex review command // codex review uses positional prompt argument, not stdin useStdin = false; if (prompt) { diff --git a/ccw/src/tools/codex-lens.ts b/ccw/src/tools/codex-lens.ts index 594cc4e1..600c0e0a 100644 --- a/ccw/src/tools/codex-lens.ts +++ b/ccw/src/tools/codex-lens.ts @@ -1028,7 +1028,7 @@ async function bootstrapVenv(): Promise { async function ensureReady(): Promise { // Use cached result if already checked if (bootstrapChecked && bootstrapReady) { - return { ready: true }; + return { ready: true, installed: true }; } // Check current status @@ -1036,13 +1036,13 @@ async function ensureReady(): Promise { if (status.ready) { bootstrapChecked = true; bootstrapReady = true; - return { ready: true, version: status.version }; + return { ready: true, installed: true, version: status.version }; } // Attempt bootstrap const bootstrap = await bootstrapVenv(); if (!bootstrap.success) { - return { ready: false, error: bootstrap.error }; + return { ready: false, installed: false, error: bootstrap.error }; } // Verify after bootstrap @@ -1050,7 +1050,7 @@ async function ensureReady(): Promise { bootstrapChecked = true; bootstrapReady = recheck.ready; - return recheck; + return { ...recheck, installed: recheck.ready }; } /**