This commit is contained in:
2026-07-24 14:26:56 +08:00
parent dc522064ce
commit 8d00676bba
6 changed files with 96 additions and 45 deletions
@@ -8,6 +8,27 @@ import { isIssueLocked } from '../lib/dependencies'
import type { PropertyGroup } from './property-grid'
import { PropertyGrid } from './property-grid'
/** 跨机绝对路径只比 basename(同名 .json)映射到本机 profiles 列表。 */
function matchProfileOption(
current: string | undefined,
profiles: ClaudeProfile[],
): string {
const raw = current?.trim()
if (!raw)
return ''
if (profiles.some(p => p.path === raw))
return raw
const base = raw.split(/[/\\]/).pop() ?? ''
if (!base)
return raw
const byFile = profiles.find(p => p.path.split(/[/\\]/).pop() === base)
if (byFile)
return byFile.path
const name = base.endsWith('.json') ? base.slice(0, -'.json'.length) : base
const byName = profiles.find(p => p.name === name)
return byName?.path ?? raw
}
interface IssueDetailPanelProps {
issue: Issue | null
/** 当前所有 issues,用于解析前置依赖锁定态。 */
@@ -331,8 +352,9 @@ export function IssueDetailPanel({
// 占位项:value='' 对应「未设置」。原生 select 在 value 不匹配任何
// option 时会假显示第一项且 selectedIndex=0,导致点第一项不触发
// onChange、永远存不进去;占位项让未设置态有真实匹配项。
// 跨机绝对路径按 basename 对齐本机 profiles,避免「自定义:/Users/...」。
const opts = [{ label: '(默认)', value: '' }, ...profiles.map(p => ({ label: p.name, value: p.path }))]
const current = issue?.brainstormProfilePath
const current = matchProfileOption(issue?.brainstormProfilePath, profiles)
if (current && !opts.some(o => o.value === current))
opts.push({ label: `自定义:${current}`, value: current })
return opts
@@ -345,7 +367,7 @@ export function IssueDetailPanel({
type: 'select',
options: (() => {
const opts = [{ label: '(默认)', value: '' }, ...profiles.map(p => ({ label: p.name, value: p.path }))]
const current = issue?.profilePath
const current = matchProfileOption(issue?.profilePath, profiles)
if (current && !opts.some(o => o.value === current))
opts.push({ label: `自定义:${current}`, value: current })
return opts
@@ -358,7 +380,7 @@ export function IssueDetailPanel({
type: 'select',
options: (() => {
const opts = [{ label: '(默认)', value: '' }, ...profiles.map(p => ({ label: p.name, value: p.path }))]
const current = issue?.testProfilePath
const current = matchProfileOption(issue?.testProfilePath, profiles)
if (current && !opts.some(o => o.value === current))
opts.push({ label: `自定义:${current}`, value: current })
return opts
@@ -485,9 +507,10 @@ export function IssueDetailPanel({
testSessionId: issue.testSessionId ?? null,
autoReview: issue.autoReview ?? globalAutoReview,
color: issue.color ?? null,
brainstormProfilePath: issue.brainstormProfilePath ?? null,
profilePath: issue.profilePath ?? null,
testProfilePath: issue.testProfilePath ?? null,
// 展示/选中值按 basename 映射到本机 profiles,避免跨机绝对路径变成「自定义」项。
brainstormProfilePath: matchProfileOption(issue.brainstormProfilePath, profiles) || null,
profilePath: matchProfileOption(issue.profilePath, profiles) || null,
testProfilePath: matchProfileOption(issue.testProfilePath, profiles) || null,
specFile: issue.specFile ?? null,
planFile: issue.planFile ?? null,
prDiffFile: issue.prDiffFile ?? null,