♻️ 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
+5 -7
View File
@@ -1,6 +1,7 @@
import type { KanbanWebviewPanel } from '../KanbanPanel'
import { promises as fsp } from 'node:fs'
import { window, workspace } from 'vscode'
import { buildCcCommand } from '../../cc/ccCommand'
import { pollForNewSession, projectsDirFor } from '../../cc/sessionWatcher'
import { logger } from '../../logging/logger'
import { readManagedSessions, writeManagedSessions } from '../../sessions/managedStore'
@@ -53,9 +54,8 @@ export async function handleManagedSessionsGet(panel: KanbanWebviewPanel): Promi
/**
* 从会话管理 tab 创建一个新的 cc 会话:
* - cwd 用项目根(workspaceRoot,非 worktree)。
* - 启动命令照搬头脑风暴风格claude --dangerously-skip-permissions --settings
* '<profilePath>' --system-prompt="$(serena prompts ...)"),prompt 非空时
* 再追加 ' <prompt>'。
* - 启动命令统一由 buildCcCommand 构建claude --dangerously-skip-permissions
* --settings '<profilePath>'),prompt 非空时作为位置参数传入。
* - 用 pollForNewSession 捕获新 sessionId(共享 projects 目录用轮询更可靠),
* 落进 .spx/session-names.json 后推全量列表。
*/
@@ -121,9 +121,7 @@ export async function handleManagedSessionsCreate(panel: KanbanWebviewPanel, pro
message: `已创建终端 "${terminal.name}"`,
})
let cmd = `claude --dangerously-skip-permissions --settings '${effectiveProfilePath}' --system-prompt="$(serena prompts print-cc-system-prompt-override)"`
if (effectivePrompt)
cmd += ` '${effectivePrompt}'`
const cmd = buildCcCommand({ profilePath: effectiveProfilePath, prompt: effectivePrompt || undefined })
terminal.sendText(cmd)
logger.add({
level: 'info',
@@ -243,7 +241,7 @@ export async function handleManagedSessionsResume(panel: KanbanWebviewPanel, ses
message: `已创建终端 "${terminal.name}" (resume ${sessionId})`,
})
const cmd = `claude --dangerously-skip-permissions --settings '${effectiveProfilePath}' --system-prompt="$(serena prompts print-cc-system-prompt-override)" --resume ${sessionId}`
const cmd = buildCcCommand({ profilePath: effectiveProfilePath, resumeSessionId: sessionId })
terminal.sendText(cmd)
// 登记终端并推 show,让列表的 tabOpen 立即为 true。