feat(vscode): 冲突解决会话 profile 可在设置面板配置

This commit is contained in:
2026-07-09 08:41:58 +08:00
parent 38f15a6fe1
commit 7b4f737ce5
10 changed files with 85 additions and 17 deletions
+7 -3
View File
@@ -854,6 +854,7 @@ export class KanbanWebviewPanel {
worktreePreRemoveScript: s.worktreePreRemoveScript,
implTabPreCreateScript: s.implTabPreCreateScript,
implTabPostCloseScript: s.implTabPostCloseScript,
conflictResolutionProfilePath: s.conflictResolutionProfilePath,
})
return
}
@@ -916,6 +917,7 @@ export class KanbanWebviewPanel {
worktreePreRemoveScript: s.worktreePreRemoveScript,
implTabPreCreateScript: s.implTabPreCreateScript,
implTabPostCloseScript: s.implTabPostCloseScript,
conflictResolutionProfilePath: s.conflictResolutionProfilePath,
})
return
}
@@ -926,13 +928,15 @@ export class KanbanWebviewPanel {
}
/**
* Pick the profile.json that the *implement-class* cc sessions
* (handleImplement / handleResumeSession when sessionKind === 'implement' /
* startConflictResolution) should launch with. Priority:
* Pick the profile.json that implement-class cc sessions
* (handleImplement / handleResumeSession when sessionKind === 'implement')
* should launch with. Priority:
* 1. The per-issue `profilePath` recorded in state JSON (preserves the
* brainstorm-time choice, overridable from the issue detail panel).
* 2. The hard-coded `DEFAULT_PROFILE_PATH` fallback.
*
* Conflict-resolution sessions use the global
* `settings.conflictResolutionProfilePath` instead of this helper.
* Brainstorm sessions deliberately don't go through this helper — they
* keep the legacy `profilePath || DEFAULT_PROFILE_PATH` so creators can
* still pick a profile per issue at brainstorm time.
-4
View File
@@ -107,7 +107,6 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
let implementSessionId: string | undefined
let testSessionId: string | undefined
let featureBranch: string | undefined
let profilePath: string | undefined
try {
const comments = await listIssueComments({
host: remote.host,
@@ -139,8 +138,6 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
testSessionId = obj.testSessionId
if (typeof obj.branch === 'string' && obj.branch.length > 0)
featureBranch = obj.branch
if (typeof obj.profilePath === 'string' && obj.profilePath.length > 0)
profilePath = obj.profilePath
}
}
catch {
@@ -340,7 +337,6 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
workspaceRoot,
featureBranch,
worktreePath,
profilePath,
})
}
else {
+11 -10
View File
@@ -67,8 +67,8 @@ export async function handleResumeSession(panel: KanbanWebviewPanel, sessionId:
existing.show(false)
return
}
// 实施 resume 走工单级 profilePath > 默认 的优先级(同 handleImplement /
// startConflictResolution);头脑风暴 resume 保持现状,只看工单级 + 默认。
// 实施 resume 走工单级 profilePath > 默认 的优先级(同 handleImplement);
// 头脑风暴 resume 保持现状,只看工单级 + 默认。
const effectiveProfilePath
= sessionKind === 'implement'
? panel.resolveImplementProfilePath(profilePath)
@@ -1396,9 +1396,8 @@ export async function startConflictResolution(panel: KanbanWebviewPanel, opts: {
workspaceRoot: string
featureBranch: string
worktreePath: string
profilePath?: string
}): Promise<void> {
const { issueNumber, prIndex, workspaceRoot, featureBranch, worktreePath, profilePath } = opts
const { issueNumber, prIndex, workspaceRoot, featureBranch, worktreePath } = opts
const settings = getSettings(panel.context)
const devBranch = settings.devBranch || 'main'
@@ -1553,9 +1552,9 @@ export async function startConflictResolution(panel: KanbanWebviewPanel, opts: {
return
}
terminal.show(false)
// 与 handleImplement 保持一致:走工单级 profilePath > 默认 fallback 的优先级,
// 让冲突解决会话和实施会话用同一份 profile。
const effectiveProfilePath = panel.resolveImplementProfilePath(profilePath)
// 冲突解决只用全局设置 conflictResolutionProfilePath;空串 = DEFAULT_PROFILE_PATH。
const effectiveProfilePath
= settings.conflictResolutionProfilePath.trim() || DEFAULT_PROFILE_PATH
if (effectiveProfilePath.includes('\'')) {
logger.add({
level: 'error',
@@ -1590,13 +1589,15 @@ export async function startConflictResolution(panel: KanbanWebviewPanel, opts: {
}
/**
* Pick the profile.json that the *implement-class* cc sessions
* (handleImplement / handleResumeSession when sessionKind === 'implement' /
* startConflictResolution) should launch with. Priority:
* Pick the profile.json that implement-class cc sessions
* (handleImplement / handleResumeSession when sessionKind === 'implement')
* should launch with. Priority:
* 1. The per-issue `profilePath` recorded in state JSON (preserves the
* brainstorm-time choice, overridable from the issue detail panel).
* 2. The hard-coded `DEFAULT_PROFILE_PATH` fallback.
*
* Conflict-resolution sessions use the global
* `settings.conflictResolutionProfilePath` instead of this helper.
* Brainstorm sessions deliberately don't go through this helper — they
* keep the legacy `profilePath || DEFAULT_PROFILE_PATH` so creators can
* still pick a profile per issue at brainstorm time.
+6
View File
@@ -32,6 +32,7 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
worktreePreRemoveScript: string
implTabPreCreateScript: string
implTabPostCloseScript: string
conflictResolutionProfilePath: string
youtrackBaseUrl: string
youtrackProjectShortName: string
youtrackCloseCommand: string
@@ -58,6 +59,8 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
const trimmedPreRemove = payload.worktreePreRemoveScript.trim()
const trimmedImplPre = payload.implTabPreCreateScript.trim()
const trimmedImplPost = payload.implTabPostCloseScript.trim()
// conflict-resolution profile: '' is meaningful (= DEFAULT_PROFILE_PATH).
const trimmedConflictProfile = payload.conflictResolutionProfilePath.trim()
const prev = getSettings(panel.context)
// Capture the previous token *for this host* before overwriting it, so
// we can decide below whether the kanban needs a re-fetch. (Only host
@@ -87,6 +90,7 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
worktreePreRemoveScript: trimmedPreRemove,
implTabPreCreateScript: trimmedImplPre,
implTabPostCloseScript: trimmedImplPost,
conflictResolutionProfilePath: trimmedConflictProfile,
})
return
}
@@ -108,6 +112,7 @@ export async function handleSettingsSave(panel: KanbanWebviewPanel, payload: {
worktreePreRemoveScript: trimmedPreRemove,
implTabPreCreateScript: trimmedImplPre,
implTabPostCloseScript: trimmedImplPost,
conflictResolutionProfilePath: trimmedConflictProfile,
youtrackBaseUrl: trimmedYtBase,
youtrackProjectShortName: trimmedYtProject,
youtrackCloseCommand: trimmedYtClose,
@@ -190,6 +195,7 @@ export async function handleEditSettingsRequest(panel: KanbanWebviewPanel): Prom
worktreePreRemoveScript: s.worktreePreRemoveScript,
implTabPreCreateScript: s.implTabPreCreateScript,
implTabPostCloseScript: s.implTabPostCloseScript,
conflictResolutionProfilePath: s.conflictResolutionProfilePath,
youtrackBaseUrl: s.youtrackBaseUrl,
youtrackProjectShortName: s.youtrackProjectShortName,
youtrackCloseCommand: s.youtrackCloseCommand,
+2
View File
@@ -66,6 +66,7 @@ export type ExtensionToWebview
worktreePreRemoveScript: string
implTabPreCreateScript: string
implTabPostCloseScript: string
conflictResolutionProfilePath: string
youtrackBaseUrl?: string
youtrackProjectShortName?: string
youtrackCloseCommand?: string
@@ -127,6 +128,7 @@ export type WebviewToExtension
worktreePreRemoveScript: string
implTabPreCreateScript: string
implTabPostCloseScript: string
conflictResolutionProfilePath: string
youtrackBaseUrl: string
youtrackProjectShortName: string
youtrackCloseCommand: string