♻️ refactor(vscode): claude 会话命令收口到 buildCcCommand 并移除已卸载的 serena --system-prompt

9 处手拼的 claude 启动命令(managedSessions/sessions/issues)统一改用新增的
cc/ccCommand.ts:buildCcCommand({ profilePath, effort?, resumeSessionId?, prompt? }),
去掉各处重复的 --system-prompt="$(serena prompts ...)"(serena 已卸载)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-25 00:57:29 +08:00
co-authored by Claude Opus 4.8
parent 02b0aca891
commit 7be4e38620
4 changed files with 49 additions and 15 deletions
+35
View File
@@ -0,0 +1,35 @@
/**
* Single source of truth for the `claude` (cc) terminal launch command.
*
* Every session entry point (brainstorm / implement / test / review / resume /
* managed session) shells out `claude` with the same flags; building the
* string in one place keeps those call sites from drifting apart.
*
* We deliberately pass no `--system-prompt`; cc runs with its own default
* system prompt.
*/
export interface CcCommandOpts {
/** Path passed to `--settings` (caller guarantees it contains no single quote). */
profilePath: string
/** e.g. 'high' → `--effort high`; omitted means no `--effort`. */
effort?: string
/** When set, append `--resume <id>`. Mutually exclusive with prompt; resume wins. */
resumeSessionId?: string
/** When set (and no resume), append the prompt as a positional `'<prompt>'` arg. */
prompt?: string
}
export function buildCcCommand(opts: CcCommandOpts): string {
const parts = ['claude']
if (opts.effort)
parts.push(`--effort ${opts.effort}`)
parts.push('--dangerously-skip-permissions', `--settings '${opts.profilePath}'`)
// resume and prompt are mutually exclusive; a resumed session restores its
// own conversation, so a fresh prompt would be meaningless.
if (opts.resumeSessionId)
parts.push(`--resume ${opts.resumeSessionId}`)
else if (opts.prompt)
parts.push(`'${opts.prompt}'`)
return parts.join(' ')
}