✨ feat(vscode): 改动说明 profile 可配置

This commit is contained in:
cruldra committed 2026-08-28 06:38:02 +08:00
1 parent 77037924ef
commit 443a8e472a
14 files changed
+137 -37

No files matched your search

+21
View File
@@ -181,6 +181,11 @@ export interface Settings {
* 空串 = 未配置 → 提交严格失败。升级时 key 缺失会 seed deepseek-v4-pro(若存在)。
*/
commitProfilePath: string
/**
* 「改动」tab 单文件说明 / 工单 PR 变更摘要使用的 Claude profile 绝对路径。
* 空串 = 未配置 → 生成失败。升级时 key 缺失会 seed deepseek-v4-pro(若存在)。
*/
prDiffSummaryProfilePath: string
/**
* codex 审查会话使用的模型(`-c model=`)。空串 = 不传,用 codex
* `config.toml` 默认。
@@ -223,6 +228,7 @@ function defaults(ctx: ExtensionContext): Settings {
youtrackCloseCommand: '',
conflictResolutionProfilePath: '',
commitProfilePath: '',
prDiffSummaryProfilePath: '',
codexModel: '',
codexReasoningEffort: '',
profilesDirectory: '',
@@ -319,6 +325,9 @@ export function getSettings(ctx: ExtensionContext): Settings {
const commitProfilePath = typeof stored.commitProfilePath === 'string'
? stored.commitProfilePath
: base.commitProfilePath
const prDiffSummaryProfilePath = typeof stored.prDiffSummaryProfilePath === 'string'
? stored.prDiffSummaryProfilePath
: base.prDiffSummaryProfilePath
// codex 模型 / 思考级别:'' 有意义(= 用 codex 默认),不强制回退。
const codexModel = typeof stored.codexModel === 'string'
? stored.codexModel
@@ -353,6 +362,7 @@ export function getSettings(ctx: ExtensionContext): Settings {
youtrackCloseCommand,
conflictResolutionProfilePath,
commitProfilePath,
prDiffSummaryProfilePath,
codexModel,
codexReasoningEffort,
profilesDirectory,
@@ -372,6 +382,17 @@ export async function getEffectiveCommitProfilePath(ctx: ExtensionContext): Prom
return seedCommitProfilePath(undefined, profiles)
}
/**
* 读取改动说明有效的 profile path。规则与提交代码相同:已有 key 原样返回,缺 key 才 seed。
*/
export async function getEffectivePrDiffSummaryProfilePath(ctx: ExtensionContext): Promise<string> {
const stored = ctx.globalState.get<Partial<Settings>>(SETTINGS_KEY) ?? {}
if (typeof stored.prDiffSummaryProfilePath === 'string')
return stored.prDiffSummaryProfilePath
const profiles = await listClaudeProfiles()
return seedCommitProfilePath(undefined, profiles)
}
export async function saveSettings(ctx: ExtensionContext, next: Partial<Settings>): Promise<void> {
const current = ctx.globalState.get<Partial<Settings>>(SETTINGS_KEY) ?? {}
const merged: Partial<Settings> = { ...current, ...next }