feat(vscode): 设置面板可配置 Claude profiles 目录并修正探测顺序

This commit is contained in:
2026-07-23 21:52:53 +08:00
parent a3e557f9ee
commit 7c67d220db
13 changed files with 335 additions and 35 deletions
+11 -11
View File
@@ -18,7 +18,8 @@ import { createWorktree, resolveWorktreePath } from '../../git/worktree'
import { logger } from '../../logging/logger'
import { getSettings } from '../../settings/store'
import { webhookCoordinator } from '../../webhook/coordinator'
import { DEFAULT_PROFILE_PATH, makeNonce } from '../KanbanPanel'
import { resolveProfilePath } from '../../cc/profiles'
import { makeNonce } from '../KanbanPanel'
export async function handleResumeSession(panel: KanbanWebviewPanel, sessionId: string, profilePath?: string, relCwd?: string, issueNumber?: number): Promise<void> {
// kind 跟着 sessionRole 提前判定(原来散落在方法中部,提到入口是为了构造
@@ -1562,9 +1563,11 @@ export async function startConflictResolution(panel: KanbanWebviewPanel, opts: {
return
}
terminal.show(false)
// 冲突解决只用全局设置 conflictResolutionProfilePath;空串 = DEFAULT_PROFILE_PATH
const effectiveProfilePath
= settings.conflictResolutionProfilePath.trim() || DEFAULT_PROFILE_PATH
// 冲突解决只用全局设置 conflictResolutionProfilePath;空串 = 默认
// 工单/设置里可能持久化了跨机绝对路径,统一走 resolveProfilePath remapping。
const effectiveProfilePath = resolveProfilePath(
settings.conflictResolutionProfilePath.trim() || undefined,
)
if (effectiveProfilePath.includes('\'')) {
logger.add({
level: 'error',
@@ -1603,17 +1606,14 @@ export async function startConflictResolution(panel: KanbanWebviewPanel, opts: {
* (handleImplement / handleResumeSession when sessionKind === 'implement')
* should launch with. Priority:
* 1. 工单级 `profilePath`(详情面板「实施配置文件」)
* 2. DEFAULT_PROFILE_PATH
* 2. getDefaultProfilePath()
*
* 冲突解决用全局 `settings.conflictResolutionProfilePath`。
* 头脑风暴用 resolveBrainstormProfilePath;测试用 resolveTestProfilePath。
* 三者互不回退。
*/
export function resolveImplementProfilePath(_panel: KanbanWebviewPanel, issueLevelProfilePath: string | undefined): string {
const issueLevel = issueLevelProfilePath?.trim()
if (issueLevel)
return issueLevel
return DEFAULT_PROFILE_PATH
return resolveProfilePath(issueLevelProfilePath?.trim() || undefined)
}
/**
@@ -1621,7 +1621,7 @@ export function resolveImplementProfilePath(_panel: KanbanWebviewPanel, issueLev
* 不回退实施 profile。
*/
export function resolveBrainstormProfilePath(_panel: KanbanWebviewPanel, brainstormProfilePath: string | undefined): string {
return brainstormProfilePath?.trim() || DEFAULT_PROFILE_PATH
return resolveProfilePath(brainstormProfilePath?.trim() || undefined)
}
/**
@@ -1629,7 +1629,7 @@ export function resolveBrainstormProfilePath(_panel: KanbanWebviewPanel, brainst
* 不回退实施 profile。
*/
export function resolveTestProfilePath(_panel: KanbanWebviewPanel, testProfilePath: string | undefined): string {
return testProfilePath?.trim() || DEFAULT_PROFILE_PATH
return resolveProfilePath(testProfilePath?.trim() || undefined)
}
/**