✨ feat(vscode): 提交代码按钮可配置 Claude profile
This commit is contained in:
1 parent
e9543d37ce
commit
84a5cda8d2
11 files changed
+269
-9
No files matched your search
@@ -1,12 +1,15 @@
|
||||
import type { Uri } from 'vscode'
|
||||
import type { KanbanWebviewPanel } from '../KanbanPanel'
|
||||
import { accessSync, constants } from 'node:fs'
|
||||
import * as path from 'node:path'
|
||||
import { extensions, workspace } from 'vscode'
|
||||
import { listClaudeProfiles } from '../../cc/profiles'
|
||||
import { resolveCommitProfileForRun } from '../../cc/commitProfile'
|
||||
import { resolveProfilePath } from '../../cc/profiles'
|
||||
import { spawnClaude } from '../../cc/spawnClaude'
|
||||
import { findEnvFiles, lockEnvFiles, unlockEnvFiles } from '../../files/envLock'
|
||||
import { checkBranchSync, runBranchSync } from '../../git/branchSync'
|
||||
import { logger } from '../../logging/logger'
|
||||
import { getSettings } from '../../settings/store'
|
||||
import { getEffectiveCommitProfilePath, getSettings } from '../../settings/store'
|
||||
import { makeNonce } from '../KanbanPanel'
|
||||
|
||||
/**
|
||||
@@ -54,14 +57,30 @@ export async function handleCommitRun(panel: KanbanWebviewPanel): Promise<void>
|
||||
return
|
||||
}
|
||||
|
||||
const profiles = await listClaudeProfiles()
|
||||
const deepseek = profiles.find(p => p.name === 'deepseek-v4-pro')
|
||||
if (!deepseek) {
|
||||
// ① 读有效 path(含升级 seed)→ ② 严格校验 → ③ 才标记 running
|
||||
const raw = await getEffectiveCommitProfilePath(panel.context)
|
||||
const resolution = resolveCommitProfileForRun(
|
||||
raw,
|
||||
resolveProfilePath,
|
||||
(p) => {
|
||||
try {
|
||||
accessSync(p, constants.R_OK)
|
||||
return true
|
||||
}
|
||||
catch {
|
||||
return false
|
||||
}
|
||||
},
|
||||
)
|
||||
if (!resolution.ok) {
|
||||
const message = resolution.reason === 'empty'
|
||||
? '未配置提交代码 profile,请在设置中选择'
|
||||
: `提交 profile 不可用:${path.basename(resolution.profilePath)}(路径:${resolution.profilePath})`
|
||||
panel.postMessage({
|
||||
type: 'toast/show',
|
||||
id: makeNonce(),
|
||||
level: 'error',
|
||||
message: '未找到 deepseek profile(deepseek-v4-pro / deepseek),请在 Claude profiles 目录下创建对应 .json',
|
||||
message,
|
||||
dismissOnTimer: 8000,
|
||||
})
|
||||
return
|
||||
@@ -76,7 +95,7 @@ export async function handleCommitRun(panel: KanbanWebviewPanel): Promise<void>
|
||||
await spawnClaude({
|
||||
prompt: '提交下代码',
|
||||
cwd: workspaceRoot,
|
||||
profilePath: deepseek.path,
|
||||
profilePath: resolution.profilePath,
|
||||
timeoutMs: 30 * 60 * 1000,
|
||||
bare: true,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user