mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
Refactor CLI command usage from ccw cli exec to ccw cli -p for improved prompt handling
- Updated command patterns across documentation and templates to reflect the new CLI syntax. - Enhanced CLI tool implementation to support reading prompts from files and multi-line inputs. - Modified core components and views to ensure compatibility with the new command structure. - Adjusted help messages and internationalization strings to align with the updated command format. - Improved error handling and user notifications in the CLI execution flow.
This commit is contained in:
@@ -319,8 +319,9 @@ function buildCommand(params: {
|
||||
break;
|
||||
|
||||
case 'codex':
|
||||
// Codex does NOT support stdin - prompt must be passed as command line argument
|
||||
useStdin = false;
|
||||
// Codex supports stdin when using `-` as prompt argument
|
||||
// Using stdin avoids Windows command line escaping issues with multi-line/special char prompts
|
||||
useStdin = true;
|
||||
// Native resume: codex resume <uuid> [prompt] or --last
|
||||
if (nativeResume?.enabled) {
|
||||
args.push('resume');
|
||||
@@ -333,8 +334,13 @@ function buildCommand(params: {
|
||||
if (dir) {
|
||||
args.push('-C', dir);
|
||||
}
|
||||
// Permission configuration based on mode:
|
||||
// - analysis: --full-auto (read-only sandbox, no prompts) - safer for read operations
|
||||
// - write/auto: --dangerously-bypass-approvals-and-sandbox (full access for modifications)
|
||||
if (mode === 'write' || mode === 'auto') {
|
||||
args.push('--skip-git-repo-check', '-s', 'danger-full-access');
|
||||
args.push('--dangerously-bypass-approvals-and-sandbox');
|
||||
} else {
|
||||
args.push('--full-auto');
|
||||
}
|
||||
if (model) {
|
||||
args.push('-m', model);
|
||||
@@ -345,19 +351,21 @@ function buildCommand(params: {
|
||||
args.push('--add-dir', addDir);
|
||||
}
|
||||
}
|
||||
// Add prompt as positional argument for resume
|
||||
if (prompt) {
|
||||
args.push(prompt);
|
||||
}
|
||||
// Use `-` to indicate reading prompt from stdin
|
||||
args.push('-');
|
||||
} else {
|
||||
// Standard exec mode
|
||||
args.push('exec');
|
||||
if (dir) {
|
||||
args.push('-C', dir);
|
||||
}
|
||||
args.push('--full-auto');
|
||||
// Permission configuration based on mode:
|
||||
// - analysis: --full-auto (read-only sandbox, no prompts) - safer for read operations
|
||||
// - write/auto: --dangerously-bypass-approvals-and-sandbox (full access for modifications)
|
||||
if (mode === 'write' || mode === 'auto') {
|
||||
args.push('--skip-git-repo-check', '-s', 'danger-full-access');
|
||||
args.push('--dangerously-bypass-approvals-and-sandbox');
|
||||
} else {
|
||||
args.push('--full-auto');
|
||||
}
|
||||
if (model) {
|
||||
args.push('-m', model);
|
||||
@@ -368,10 +376,8 @@ function buildCommand(params: {
|
||||
args.push('--add-dir', addDir);
|
||||
}
|
||||
}
|
||||
// Add prompt as positional argument (codex exec "prompt")
|
||||
if (prompt) {
|
||||
args.push(prompt);
|
||||
}
|
||||
// Use `-` to indicate reading prompt from stdin (avoids Windows escaping issues)
|
||||
args.push('-');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -734,8 +740,8 @@ async function executeCliTool(
|
||||
}
|
||||
}
|
||||
|
||||
// Only pass model if explicitly provided - let CLI tools use their own defaults
|
||||
const effectiveModel = model;
|
||||
// Use configured primary model if no explicit model provided
|
||||
const effectiveModel = model || getPrimaryModel(workingDir, tool);
|
||||
|
||||
// Build command
|
||||
const { command, args, useStdin } = buildCommand({
|
||||
|
||||
Reference in New Issue
Block a user