🐛 fix(vscode): 会话终端直接拉起 claude/codex,不再往 shell 里打命令,启动命令不再污染 zsh 历史

新建工单、实施、审查、测试、原型、续聊、冲突解决、会话管理和各种恢复会话,
都改成开终端时直接指定要跑的程序(用户默认 shell 以 -ilc 'exec "$@"' 拉起),
环境变量照常加载,参数原样传入。程序退出时标签页随之关闭。
提示词和配置文件路径里带单引号也不再拒绝执行,相关的转义和拦截全部删掉。
This commit is contained in:
chehongweo committed 2026-09-29 04:40:35 +08:00
1 parent 21000d48e9
commit 3621729367
16 files changed
+232 -330

No files matched your search

+4 -33
View File
@@ -10,11 +10,12 @@ import * as os from 'node:os'
import * as path from 'node:path'
import { commands, env, ThemeColor, Uri, window, workspace } from 'vscode'
import { getToken } from '../../auth/secrets'
import { buildCcCommand } from '../../cc/ccCommand'
import { buildCcArgv } from '../../cc/ccCommand'
import { resolveCommitProfileForRun } from '../../cc/commitProfile'
import { resolveProfilePath } from '../../cc/profiles'
import { renderBrainstormPrompt } from '../../cc/prompts'
import { claudeProjectsRoot, installClaudeSession } from '../../cc/sessionBundle'
import { sessionLaunch } from '../../cc/sessionTerminal'
import { projectsDirFor, watchForNewSession } from '../../cc/sessionWatcher'
import { spawnClaude } from '../../cc/spawnClaude'
import { gitFetch, resolveFeatureBranch } from '../../git/branches'
@@ -1440,37 +1441,9 @@ export async function handleIssueCreate(
nonce,
imagePaths: imagePaths.length > 0 ? imagePaths : undefined,
})
if (prompt.includes('\'')) {
panel.postMessage({
type: 'toast/show',
id: makeNonce(),
level: 'error',
message: '创建失败:prompt 含单引号,拒绝执行',
dismissOnTimer: 8000,
})
try {
await fsp.rm(inboxDir, { recursive: true, force: true })
}
catch {}
return
}
// 新建工单弹窗里选的 profile > 设置里的「头脑风暴默认配置文件」> DEFAULT。
const effectiveProfilePath = sessions.resolveBrainstormProfilePath(panel, brainstormProfilePath)
if (effectiveProfilePath.includes('\'')) {
panel.postMessage({
type: 'toast/show',
id: makeNonce(),
level: 'error',
message: `创建失败:brainstormProfilePath 含单引号,拒绝执行 (${effectiveProfilePath})`,
dismissOnTimer: 8000,
})
try {
await fsp.rm(inboxDir, { recursive: true, force: true })
}
catch {}
return
}
// Ensure the claude projects subdir exists *before* spawning the
// terminal so the watcher can't miss the create event.
@@ -1492,6 +1465,7 @@ export async function handleIssueCreate(
location: panel.resolveTerminalLocation(false),
iconPath: iconUri,
color: themeColor,
...sessionLaunch(buildCcArgv({ profilePath: effectiveProfilePath, prompt })),
})
terminal.show(false)
logger.add({
@@ -1513,13 +1487,10 @@ export async function handleIssueCreate(
terminal,
createdAt: Date.now(),
})
const cmd = buildCcCommand({ profilePath: effectiveProfilePath, prompt })
terminal.sendText(cmd)
logger.add({
level: 'info',
source: 'panel',
message: `已发送新建工单 prompt nonce=${shortNonce}`,
message: `已启动新建工单会话 nonce=${shortNonce}`,
})
panel.postMessage({