fix: 强化卸载逻辑,强制递归删除所有目录

- 更新 uninstallWorkflows 逻辑,使用 fs.remove 强制递归删除整个目录
- 删除 ~/.claude/commands/ccg/ 及其所有内容(解决残留文件问题)
- 删除 ~/.claude/agents/ccg/
- 删除 ~/.claude/.ccg/ 配置目录(包含 prompts 和 config)
- 更新卸载确认提示文案,明确告知会强制删除所有数据
- 版本升级至 v1.7.8
This commit is contained in:
li committed 2026-01-09 11:44:18 +08:00
1 parent f01abce6a5
commit bfef6a7c4f
3 files changed
+25 -30

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ccg-workflow",
"version": "1.7.7",
"version": "1.7.8",
"description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流",
"type": "module",
"packageManager": "pnpm@10.17.1",
+2 -2
View File
@@ -152,7 +152,7 @@ const zhCN = {
},
},
uninstall: {
confirm: '确定要卸载 CCG 吗?这将移除所有已安装的命令和配置。',
confirm: '确定要卸载 CCG 吗?这将强制移除所有命令目录、配置文件和数据。',
alsoRemoveAceTool: '同时移除 ace-tool MCP 配置?',
uninstalling: '正在卸载...',
success: '卸载成功!',
@@ -313,7 +313,7 @@ const en = {
},
},
uninstall: {
confirm: 'Are you sure you want to uninstall CCG? This will remove all installed commands and configurations.',
confirm: 'Are you sure you want to uninstall CCG? This will force remove all command directories, config files and data.',
alsoRemoveAceTool: 'Also remove ace-tool MCP configuration?',
uninstalling: 'Uninstalling...',
success: 'Uninstallation successful!',
+22 -27
View File
@@ -586,26 +586,19 @@ export async function uninstallWorkflows(installDir: string): Promise<UninstallR
// Remove CCG commands directory
if (await fs.pathExists(commandsDir)) {
try {
// Get list for reporting
const files = await fs.readdir(commandsDir)
for (const file of files) {
if (file.endsWith('.md')) {
await fs.remove(join(commandsDir, file))
result.removedCommands.push(file.replace('.md', ''))
}
}
// Also remove agents subdirectory if exists
const agentsSubDir = join(commandsDir, 'agents')
if (await fs.pathExists(agentsSubDir)) {
await fs.remove(agentsSubDir)
}
// Remove the directory if empty
const remaining = await fs.readdir(commandsDir)
if (remaining.length === 0) {
await fs.remove(commandsDir)
}
// Force remove the entire directory
await fs.remove(commandsDir)
}
catch (error) {
result.errors.push(`Failed to remove commands: ${error}`)
result.errors.push(`Failed to remove commands directory: ${error}`)
result.success = false
}
}
@@ -613,15 +606,17 @@ export async function uninstallWorkflows(installDir: string): Promise<UninstallR
// Remove CCG agents directory
if (await fs.pathExists(agentsDir)) {
try {
// Get list for reporting
const files = await fs.readdir(agentsDir)
for (const file of files) {
await fs.remove(join(agentsDir, file))
result.removedAgents.push(file.replace('.md', ''))
}
// Force remove the entire directory
await fs.remove(agentsDir)
}
catch (error) {
result.errors.push(`Failed to remove agents: ${error}`)
result.errors.push(`Failed to remove agents directory: ${error}`)
result.success = false
}
}
@@ -633,6 +628,7 @@ export async function uninstallWorkflows(installDir: string): Promise<UninstallR
for (const file of files) {
result.removedSkills.push(file)
}
// Try to remove parent skills directory if it's the only skill
await fs.remove(skillsDir)
}
catch (error) {
@@ -641,17 +637,7 @@ export async function uninstallWorkflows(installDir: string): Promise<UninstallR
}
}
// Remove CCG prompts directory (in .ccg/)
if (await fs.pathExists(promptsDir)) {
try {
await fs.remove(promptsDir)
result.removedPrompts.push('codex', 'gemini')
}
catch (error) {
result.errors.push(`Failed to remove prompts: ${error}`)
result.success = false
}
}
// Remove CCG prompts directory (in .ccg/) - handled by removing .ccg dir below
// Remove codeagent-wrapper binary
if (await fs.pathExists(binDir)) {
@@ -669,8 +655,17 @@ export async function uninstallWorkflows(installDir: string): Promise<UninstallR
}
}
// Remove .ccg config directory (optional - keep config.toml for now)
// Users can manually delete ~/.claude/.ccg/ if they want
// Remove .ccg config directory (Force remove)
if (await fs.pathExists(ccgConfigDir)) {
try {
await fs.remove(ccgConfigDir)
result.removedPrompts.push('ALL_PROMPTS_AND_CONFIGS')
}
catch (error) {
result.errors.push(`Failed to remove .ccg directory: ${error}`)
// Don't mark as failure just for config, but good to know
}
}
return result
}