feat(vscode): 头脑风暴 profile 独立 + codex 命令统一组装收尾

- 头脑风暴/实施/测试会话 profile 彻底独立,互不回退,各自空值回落默认
- 新建工单弹窗的 profile 选择改为头脑风暴专用 brainstormProfilePath
- 详情面板新增「头脑风暴配置文件」下拉
- 删除从未接线的死代码 reviewFlow.ts(runReview 全仓库无调用方)
- codexCommand 精简为仅 resume/interactive 两种终端命令形态
- 版本号 0.2.55 → 0.2.60
This commit is contained in:
2026-07-13 07:50:39 +08:00
parent 5188c23765
commit b585016cd7
22 changed files with 258 additions and 366 deletions
+10 -41
View File
@@ -1,9 +1,8 @@
/**
* Single source of truth for assembling `codex` invocations.
*
* The review flow shells codex three different ways — headless
* `codex exec review` (spawned as an arg array), `codex resume <id>` and the
* interactive `codex '<prompt>'` TUI (both sent to a terminal). Building the
* The review flow shells codex two ways — `codex resume <id>` and the
* interactive `codex '<prompt>'` TUI — both sent to a terminal. Building the
* flags in one place keeps `--dangerously-bypass-approvals-and-sandbox` and the
* optional model / reasoning-effort `-c` overrides from drifting apart.
*
@@ -12,18 +11,16 @@
*/
export interface CodexCommandOpts {
/** 'exec-review' = `codex exec review ...`'resume' = `codex resume <id>`'interactive' = `codex '<prompt>'` */
mode: 'exec-review' | 'resume' | 'interactive'
/** 'resume' = `codex resume <id>`'interactive' = `codex '<prompt>'` */
mode: 'resume' | 'interactive'
/** resume 模式必填:codex thread id */
sessionId?: string
/** interactive / exec-review 模式的 promptpositional)。调用方保证 interactive 模式下不含单引号。 */
/** interactive 模式的 promptpositional)。调用方保证不含单引号。 */
prompt?: string
/** 空 = 不传 `-c model=`,用 codex 默认 */
model?: string
/** 空 = 不传 `-c model_reasoning_effort=`,用 codex 默认。合法值 minimal/low/medium/high/xhigh */
reasoningEffort?: string
/** exec-review 模式:追加 --json */
json?: boolean
}
const BYPASS_FLAG = '--dangerously-bypass-approvals-and-sandbox'
@@ -43,39 +40,11 @@ function configOverrides(opts: CodexCommandOpts): string[] {
return parts
}
/**
* Shared assembly for both output shapes. `quotePrompt` wraps the positional
* prompt in single quotes for the shell-string form; the spawn-array form
* passes it raw (no shell, so no quoting).
*/
function buildParts(opts: CodexCommandOpts, quotePrompt: boolean): string[] {
const overrides = configOverrides(opts)
const prompt = opts.prompt
? (quotePrompt ? `'${opts.prompt}'` : opts.prompt)
: undefined
switch (opts.mode) {
case 'exec-review':
return [
'exec',
'review',
...overrides,
BYPASS_FLAG,
...(opts.json ? ['--json'] : []),
...(prompt !== undefined ? [prompt] : []),
]
case 'resume':
return ['resume', ...overrides, BYPASS_FLAG, ...(opts.sessionId ? [opts.sessionId] : [])]
case 'interactive':
return [...overrides, BYPASS_FLAG, ...(prompt !== undefined ? [prompt] : [])]
}
}
/** Argument array (without the leading `codex`) for `spawn('codex', args)`. */
export function buildCodexArgs(opts: CodexCommandOpts): string[] {
return buildParts(opts, false)
}
/** Full shell command string (with `codex` prefix) for `terminal.sendText`. */
export function buildCodexCommandString(opts: CodexCommandOpts): string {
return ['codex', ...buildParts(opts, true)].join(' ')
const overrides = configOverrides(opts)
const parts = opts.mode === 'resume'
? ['resume', ...overrides, BYPASS_FLAG, ...(opts.sessionId ? [opts.sessionId] : [])]
: [...overrides, BYPASS_FLAG, ...(opts.prompt ? [`'${opts.prompt}'`] : [])]
return ['codex', ...parts].join(' ')
}