agentdock-cli 1.1.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -4
- package/dist/package.json +2 -2
- package/dist/src/agents/registry.js +551 -0
- package/dist/src/agents/semantic.js +208 -0
- package/dist/src/cli.js +45 -1
- package/dist/src/commands/agents.js +84 -0
- package/dist/src/commands/diff.js +73 -0
- package/dist/src/commands/doctor.js +1 -0
- package/dist/src/commands/history.js +109 -0
- package/dist/src/commands/list.js +2 -1
- package/dist/src/commands/recover.js +185 -0
- package/dist/src/commands/restore.js +103 -0
- package/dist/src/commands/snapshot.js +155 -0
- package/dist/src/commands/sync.js +5 -1
- package/dist/src/constants/command-error-codes.js +4 -0
- package/dist/src/core/doctor.js +319 -6
- package/dist/src/core/installer.js +18 -15
- package/dist/src/core/list.js +6 -0
- package/dist/src/core/report.js +29 -8
- package/dist/src/core/scan-export.js +31 -30
- package/dist/src/core/scan.js +59 -34
- package/dist/src/core/snapshot-diff.js +111 -0
- package/dist/src/core/snapshot.js +535 -0
- package/dist/src/core/uninstall.js +12 -7
- package/dist/src/i18n/index.js +112 -4
- package/dist/src/scanners/semantic-scanner.js +272 -0
- package/dist/src/utils/config-format.js +168 -0
- package/package.json +2 -2
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI 编程工具适配器注册表(v1.3)。
|
|
4
|
+
*
|
|
5
|
+
* 目标:把「文件级能力」(snapshot / diff / restore / history / recover /
|
|
6
|
+
* doctor 配置基线)从硬编码的 claude / codex 扩展为按工具注册表自动覆盖。
|
|
7
|
+
* 每个适配器只声明自己的配置文件位置与关键配置项,命令层不再判断具体工具。
|
|
8
|
+
*
|
|
9
|
+
* 路径约定:统一使用相对用户主目录的 `/` 分隔路径(Windows 的
|
|
10
|
+
* `AppData/Roaming` 与 macOS 的 `Library/Application Support` 都在主目录内),
|
|
11
|
+
* 这样快照与恢复仍受 `safeResolveWithin(root)` 保护,不会写到家目录之外。
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AGENT_ADAPTERS = void 0;
|
|
18
|
+
exports.appDataDir = appDataDir;
|
|
19
|
+
exports.vsCodeUser = vsCodeUser;
|
|
20
|
+
exports.listAgentAdapters = listAgentAdapters;
|
|
21
|
+
exports.resolveAgentAdapter = resolveAgentAdapter;
|
|
22
|
+
exports.normalizeAgentId = normalizeAgentId;
|
|
23
|
+
exports.agentConfigFiles = agentConfigFiles;
|
|
24
|
+
exports.agentCriticalKeys = agentCriticalKeys;
|
|
25
|
+
exports.agentMcpKeys = agentMcpKeys;
|
|
26
|
+
exports.isAgentInstalled = isAgentInstalled;
|
|
27
|
+
exports.detectInstalledAgents = detectInstalledAgents;
|
|
28
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
29
|
+
const fs_1 = require("../utils/fs");
|
|
30
|
+
function joinRel(...parts) {
|
|
31
|
+
return parts.join('/');
|
|
32
|
+
}
|
|
33
|
+
/** Windows 使用 AppData/Roaming,macOS 使用 Library/Application Support,Linux 使用 XDG .config。 */
|
|
34
|
+
function appDataDir() {
|
|
35
|
+
if (process.platform === 'win32')
|
|
36
|
+
return 'AppData/Roaming';
|
|
37
|
+
if (process.platform === 'darwin')
|
|
38
|
+
return 'Library/Application Support';
|
|
39
|
+
return '.config';
|
|
40
|
+
}
|
|
41
|
+
function json(relPath) {
|
|
42
|
+
return { relPath, kind: 'json' };
|
|
43
|
+
}
|
|
44
|
+
function jsonc(relPath) {
|
|
45
|
+
return { relPath, kind: 'jsonc' };
|
|
46
|
+
}
|
|
47
|
+
function yaml(relPath) {
|
|
48
|
+
return { relPath, kind: 'yaml' };
|
|
49
|
+
}
|
|
50
|
+
function toml(relPath) {
|
|
51
|
+
return { relPath, kind: 'toml' };
|
|
52
|
+
}
|
|
53
|
+
function text(relPath) {
|
|
54
|
+
return { relPath, kind: 'text' };
|
|
55
|
+
}
|
|
56
|
+
function vsCodeUser(appName) {
|
|
57
|
+
return joinRel(appDataDir(), appName, 'User');
|
|
58
|
+
}
|
|
59
|
+
exports.AGENT_ADAPTERS = [
|
|
60
|
+
{
|
|
61
|
+
id: 'claude',
|
|
62
|
+
aliases: ['claude-code', 'anthropic'],
|
|
63
|
+
displayName: 'Claude Code',
|
|
64
|
+
criticalKeys: ['model', 'modelPicker', 'mcpServers', 'env'],
|
|
65
|
+
mcpKeys: ['mcpServers'],
|
|
66
|
+
configFiles: () => [
|
|
67
|
+
json('.claude.json'),
|
|
68
|
+
json('.claude/settings.json'),
|
|
69
|
+
json('.claude/settings.local.json'),
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'codex',
|
|
74
|
+
aliases: ['openai-codex', 'codex-cli'],
|
|
75
|
+
displayName: 'OpenAI Codex',
|
|
76
|
+
criticalKeys: ['model', 'model_providers', 'mcp_servers'],
|
|
77
|
+
mcpKeys: ['mcp_servers'],
|
|
78
|
+
configFiles: () => [toml('.codex/config.toml')],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'gemini',
|
|
82
|
+
aliases: ['gemini-cli', 'google-gemini'],
|
|
83
|
+
displayName: 'Gemini CLI',
|
|
84
|
+
criticalKeys: ['model', 'mcpServers', 'selectedAuthType'],
|
|
85
|
+
mcpKeys: ['mcpServers'],
|
|
86
|
+
configFiles: () => [json('.gemini/settings.json'), text('.gemini/GEMINI.md')],
|
|
87
|
+
note: '与 Antigravity 共用 ~/.gemini;本工具只认领 settings.json 与 GEMINI.md,按文件归属避免重复快照。',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'antigravity',
|
|
91
|
+
aliases: ['antigravity-ide', 'google-antigravity'],
|
|
92
|
+
displayName: 'Antigravity',
|
|
93
|
+
criticalKeys: ['mcpServers'],
|
|
94
|
+
mcpKeys: ['mcpServers'],
|
|
95
|
+
configFiles: () => [json('.gemini/config/mcp_config.json')],
|
|
96
|
+
note: '工作区级 .agents/mcp_config.json 属于项目配置,不在主目录快照内。',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'opencode',
|
|
100
|
+
aliases: ['open-code', 'sst-opencode'],
|
|
101
|
+
displayName: 'OpenCode',
|
|
102
|
+
criticalKeys: ['model', 'provider', 'mcp', 'instructions'],
|
|
103
|
+
mcpKeys: ['mcp'],
|
|
104
|
+
configFiles: () => [
|
|
105
|
+
jsonc('.config/opencode/opencode.json'),
|
|
106
|
+
jsonc('.config/opencode/opencode.jsonc'),
|
|
107
|
+
text('.config/opencode/AGENTS.md'),
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'grok-build',
|
|
112
|
+
aliases: ['cursor', 'grok', 'cursor-ide'],
|
|
113
|
+
displayName: 'Grok Build(原 Cursor)',
|
|
114
|
+
criticalKeys: ['mcpServers', 'model'],
|
|
115
|
+
mcpKeys: ['mcpServers'],
|
|
116
|
+
configFiles: () => [
|
|
117
|
+
json('.cursor/mcp.json'),
|
|
118
|
+
json(joinRel(vsCodeUser('Cursor'), 'settings.json')),
|
|
119
|
+
],
|
|
120
|
+
note: 'Cursor 已更名为 Grok Build;保留 ~/.cursor 旧目录与 Cursor 用户设置目录兼容。',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: 'trae',
|
|
124
|
+
aliases: ['trae-cn', 'trae-ide'],
|
|
125
|
+
displayName: 'TRAE',
|
|
126
|
+
criticalKeys: ['model', 'mcp', 'mcpServers'],
|
|
127
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
128
|
+
configFiles: () => [
|
|
129
|
+
json(joinRel(vsCodeUser('Trae CN'), 'settings.json')),
|
|
130
|
+
json(joinRel(vsCodeUser('Trae CN'), 'mcp.json')),
|
|
131
|
+
json(joinRel(vsCodeUser('Trae'), 'settings.json')),
|
|
132
|
+
json(joinRel(vsCodeUser('Trae'), 'mcp.json')),
|
|
133
|
+
],
|
|
134
|
+
note: '同时探测 Trae CN 与 Trae 两个用户数据目录。',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'qoder',
|
|
138
|
+
aliases: ['qoder-ide', 'qoder-cn', 'lingma', 'tongyi-lingma'],
|
|
139
|
+
displayName: 'Qoder(含 Qoder CN / 通义灵码)',
|
|
140
|
+
criticalKeys: ['model', 'mcpServers'],
|
|
141
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
142
|
+
configFiles: () => [
|
|
143
|
+
json(joinRel(vsCodeUser('Qoder'), 'settings.json')),
|
|
144
|
+
json(joinRel(vsCodeUser('Qoder'), 'mcp.json')),
|
|
145
|
+
json(joinRel(vsCodeUser('Qoder CN'), 'settings.json')),
|
|
146
|
+
json(joinRel(vsCodeUser('Qoder CN'), 'mcp.json')),
|
|
147
|
+
json(joinRel(vsCodeUser('Code'), 'globalStorage/alibaba-cloud.tongyi-lingma/settings.json')),
|
|
148
|
+
],
|
|
149
|
+
experimental: true,
|
|
150
|
+
note: 'Qoder CN 已由通义灵码更名;同时探测 Qoder / Qoder CN 用户目录与 VS Code 的 alibaba-cloud.tongyi-lingma 扩展目录,部分路径仍待全平台实测。',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'cline',
|
|
154
|
+
aliases: ['claude-dev', 'cline-vscode'],
|
|
155
|
+
displayName: 'Cline',
|
|
156
|
+
criticalKeys: ['mcpServers'],
|
|
157
|
+
mcpKeys: ['mcpServers'],
|
|
158
|
+
configFiles: () => [
|
|
159
|
+
json(joinRel(vsCodeUser('Code'), 'globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json')),
|
|
160
|
+
json(joinRel(vsCodeUser('Code - Insiders'), 'globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json')),
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 'windsurf',
|
|
165
|
+
aliases: ['codeium-windsurf'],
|
|
166
|
+
displayName: 'Windsurf',
|
|
167
|
+
criticalKeys: ['mcpServers'],
|
|
168
|
+
mcpKeys: ['mcpServers'],
|
|
169
|
+
configFiles: () => [json('.codeium/windsurf/mcp_config.json')],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 'copilot',
|
|
173
|
+
aliases: ['github-copilot', 'copilot-vscode'],
|
|
174
|
+
displayName: 'GitHub Copilot',
|
|
175
|
+
criticalKeys: ['mcp', 'mcpServers', 'github.copilot'],
|
|
176
|
+
mcpKeys: ['mcp', 'mcpServers'],
|
|
177
|
+
configFiles: () => [
|
|
178
|
+
json(joinRel(vsCodeUser('Code'), 'settings.json')),
|
|
179
|
+
json(joinRel(vsCodeUser('Code'), 'mcp.json')),
|
|
180
|
+
json(joinRel(vsCodeUser('Code - Insiders'), 'settings.json')),
|
|
181
|
+
json('.copilot/config.json'),
|
|
182
|
+
json('.copilot/settings.json'),
|
|
183
|
+
json('.copilot/mcp-config.json'),
|
|
184
|
+
],
|
|
185
|
+
note: '同时覆盖 VS Code 扩展与 GitHub Copilot CLI(~/.copilot);仓库级 .github/copilot-instructions.md 与 .vscode/mcp.json 属于项目配置。',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: 'roo-code',
|
|
189
|
+
aliases: ['roo', 'roocode', 'roo-cline'],
|
|
190
|
+
displayName: 'Roo Code',
|
|
191
|
+
criticalKeys: ['mcpServers'],
|
|
192
|
+
mcpKeys: ['mcpServers'],
|
|
193
|
+
configFiles: () => [
|
|
194
|
+
json(joinRel(vsCodeUser('Code'), 'globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json')),
|
|
195
|
+
json(joinRel(vsCodeUser('Code - Insiders'), 'globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json')),
|
|
196
|
+
yaml(joinRel(vsCodeUser('Code'), 'globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml')),
|
|
197
|
+
],
|
|
198
|
+
note: 'Cline 生态分支;项目级 .roorules 与 .roo/ 不在主目录快照内。',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: 'kilo-code',
|
|
202
|
+
aliases: ['kilo', 'kilocode'],
|
|
203
|
+
displayName: 'Kilo Code',
|
|
204
|
+
criticalKeys: ['mcpServers'],
|
|
205
|
+
mcpKeys: ['mcpServers'],
|
|
206
|
+
configFiles: () => [
|
|
207
|
+
json(joinRel(vsCodeUser('Code'), 'globalStorage/kilocode.kilo-code/settings/mcp_settings.json')),
|
|
208
|
+
json(joinRel(vsCodeUser('Code - Insiders'), 'globalStorage/kilocode.kilo-code/settings/mcp_settings.json')),
|
|
209
|
+
yaml(joinRel(vsCodeUser('Code'), 'globalStorage/kilocode.kilo-code/settings/custom_modes.yaml')),
|
|
210
|
+
],
|
|
211
|
+
note: 'Roo / Cline 生态分支;项目级 .kilocoderules 不在主目录快照内。',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: 'continue',
|
|
215
|
+
aliases: ['continue-dev'],
|
|
216
|
+
displayName: 'Continue',
|
|
217
|
+
criticalKeys: ['models', 'model', 'mcpServers', 'context'],
|
|
218
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
219
|
+
configFiles: () => [
|
|
220
|
+
yaml('.continue/config.yaml'),
|
|
221
|
+
json('.continue/config.json'),
|
|
222
|
+
yaml('.continue/permissions.yaml'),
|
|
223
|
+
],
|
|
224
|
+
note: '新版使用 config.yaml;旧版 config.json 仍兼容读取。assistants/ 与 prompts/ 为目录,v1.4 再做语义化采集。',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: 'goose',
|
|
228
|
+
aliases: ['block-goose'],
|
|
229
|
+
displayName: 'Goose(Block)',
|
|
230
|
+
criticalKeys: ['extensions', 'provider', 'model'],
|
|
231
|
+
mcpKeys: ['extensions'],
|
|
232
|
+
configFiles: () => (process.platform === 'win32'
|
|
233
|
+
? [
|
|
234
|
+
yaml(joinRel(appDataDir(), 'Block', 'goose', 'config', 'config.yaml')),
|
|
235
|
+
yaml(joinRel(appDataDir(), 'Block', 'goose', 'config', 'profiles.yaml')),
|
|
236
|
+
]
|
|
237
|
+
: [
|
|
238
|
+
yaml('.config/goose/config.yaml'),
|
|
239
|
+
yaml('.config/goose/profiles.yaml'),
|
|
240
|
+
]),
|
|
241
|
+
note: 'extensions 即 MCP;secrets 默认在系统钥匙串,不进入快照。',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: 'qwen',
|
|
245
|
+
aliases: ['qwen-code', 'qwen-cli'],
|
|
246
|
+
displayName: 'Qwen Code',
|
|
247
|
+
criticalKeys: ['model', 'mcpServers', 'selectedAuthType'],
|
|
248
|
+
mcpKeys: ['mcpServers'],
|
|
249
|
+
configFiles: () => [json('.qwen/settings.json'), text('.qwen/QWEN.md')],
|
|
250
|
+
note: 'Gemini CLI 分支,配置结构与 Gemini CLI 基本一致。',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: 'kiro',
|
|
254
|
+
aliases: ['aws-kiro'],
|
|
255
|
+
displayName: 'Kiro(AWS)',
|
|
256
|
+
criticalKeys: ['mcpServers'],
|
|
257
|
+
mcpKeys: ['mcpServers'],
|
|
258
|
+
configFiles: () => [json('.kiro/settings/mcp.json')],
|
|
259
|
+
note: '项目级 steering 规则(.kiro/steering/*.md)不在主目录快照内。',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: 'aider',
|
|
263
|
+
aliases: ['aider-chat'],
|
|
264
|
+
displayName: 'Aider',
|
|
265
|
+
criticalKeys: ['model', 'openai-api-key', 'anthropic-api-key'],
|
|
266
|
+
mcpKeys: [],
|
|
267
|
+
configFiles: () => [yaml('.aider.conf.yml'), yaml('.aider.conf.yaml')],
|
|
268
|
+
note: '无 MCP;密钥通常放在 .env / 环境变量,快照只保留配置结构。',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'zed',
|
|
272
|
+
aliases: ['zed-ai', 'zed-editor'],
|
|
273
|
+
displayName: 'Zed',
|
|
274
|
+
criticalKeys: ['context_servers', 'language_models', 'assistant'],
|
|
275
|
+
mcpKeys: ['context_servers'],
|
|
276
|
+
configFiles: () => (process.platform === 'win32'
|
|
277
|
+
? [
|
|
278
|
+
json(joinRel(appDataDir(), 'Zed', 'settings.json')),
|
|
279
|
+
json('.config/zed/settings.json'),
|
|
280
|
+
]
|
|
281
|
+
: [json('.config/zed/settings.json')]),
|
|
282
|
+
note: 'Zed 的 MCP 配置键为 context_servers;项目级 .rules 不在主目录快照内。',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 'crush',
|
|
286
|
+
aliases: ['charm-crush'],
|
|
287
|
+
displayName: 'Crush(Charm)',
|
|
288
|
+
criticalKeys: ['models', 'providers', 'mcp'],
|
|
289
|
+
mcpKeys: ['mcp'],
|
|
290
|
+
configFiles: () => [json('.config/crush/crush.json')],
|
|
291
|
+
note: '项目级 .crush.json 不在主目录快照内;Windows 若使用自定义 XDG 目录需用 --root 指定。',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
id: 'claude-desktop',
|
|
295
|
+
aliases: ['claude-app'],
|
|
296
|
+
displayName: 'Claude Desktop',
|
|
297
|
+
criticalKeys: ['mcpServers'],
|
|
298
|
+
mcpKeys: ['mcpServers'],
|
|
299
|
+
configFiles: () => [json(joinRel(appDataDir(), 'Claude', 'claude_desktop_config.json'))],
|
|
300
|
+
note: 'MCP 宿主而非编码 CLI;常用于本机 MCP Server 备份。',
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
id: 'lm-studio',
|
|
304
|
+
aliases: ['lmstudio'],
|
|
305
|
+
displayName: 'LM Studio',
|
|
306
|
+
criticalKeys: ['mcpServers'],
|
|
307
|
+
mcpKeys: ['mcpServers'],
|
|
308
|
+
configFiles: () => [json('.lmstudio/mcp.json')],
|
|
309
|
+
note: '本地模型 + MCP 宿主;模型文件本身不在快照范围。',
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: 'codebuddy',
|
|
313
|
+
aliases: ['codebuddy-code', 'tencent-codebuddy'],
|
|
314
|
+
displayName: 'CodeBuddy(腾讯)',
|
|
315
|
+
criticalKeys: ['model', 'mcpServers', 'permissions'],
|
|
316
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
317
|
+
configFiles: () => [
|
|
318
|
+
json('.codebuddy/settings.json'),
|
|
319
|
+
json('.codebuddy/settings.local.json'),
|
|
320
|
+
json('.codebuddy/mcp.json'),
|
|
321
|
+
text('.codebuddy/CODEBUDDY.md'),
|
|
322
|
+
],
|
|
323
|
+
note: '官方文档确认 ~/.codebuddy 全局目录;agents/、rules/、skills/ 为目录,v1.4 做语义化采集。',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: 'kimi',
|
|
327
|
+
aliases: ['kimi-code', 'kimi-cli', 'moonshot-kimi'],
|
|
328
|
+
displayName: 'Kimi Code CLI',
|
|
329
|
+
criticalKeys: ['model', 'provider', 'providers'],
|
|
330
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
331
|
+
configFiles: () => [
|
|
332
|
+
toml('.kimi/config.toml'),
|
|
333
|
+
json('.kimi/config.json'),
|
|
334
|
+
json('.kimi-code/mcp.json'),
|
|
335
|
+
],
|
|
336
|
+
note: '全局设置 ~/.kimi/config.toml;MCP 单独存放在 ~/.kimi-code/mcp.json(官方文档)。',
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: 'iflow',
|
|
340
|
+
aliases: ['iflow-cli'],
|
|
341
|
+
displayName: 'iFlow CLI(心流)',
|
|
342
|
+
criticalKeys: ['modelName', 'apiKey', 'selectedAuthType'],
|
|
343
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
344
|
+
configFiles: () => [json('.iflow/settings.json')],
|
|
345
|
+
note: '官方文档确认 ~/.iflow/settings.json;MCP 是否独立文件待实测。',
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: 'junie',
|
|
349
|
+
aliases: ['jetbrains-junie', 'junie-cli'],
|
|
350
|
+
displayName: 'JetBrains Junie',
|
|
351
|
+
criticalKeys: ['mcpServers', 'model'],
|
|
352
|
+
mcpKeys: ['mcpServers'],
|
|
353
|
+
configFiles: () => [json('.junie/mcp/mcp.json'), json('.junie/config.json')],
|
|
354
|
+
note: 'Junie CLI / IDE 共用 ~/.junie/mcp/mcp.json;JetBrains AI Assistant 的 IDE 级配置不在此范围。',
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
id: 'amazon-q',
|
|
358
|
+
aliases: ['amazon-q-developer', 'q-developer', 'q-cli'],
|
|
359
|
+
displayName: 'Amazon Q Developer',
|
|
360
|
+
criticalKeys: ['mcpServers'],
|
|
361
|
+
mcpKeys: ['mcpServers'],
|
|
362
|
+
configFiles: () => [json('.aws/amazonq/agents/default.json')],
|
|
363
|
+
note: 'IDE 全局 MCP 在 ~/.aws/amazonq/agents/default.json;CLI 的 ~/.aws/amazonq/cli-agents/ 为目录,v1.4 支持通配。',
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: 'amp',
|
|
367
|
+
aliases: ['sourcegraph-amp', 'amp-cli'],
|
|
368
|
+
displayName: 'Amp(Sourcegraph)',
|
|
369
|
+
criticalKeys: ['amp.mcpServers', 'amp.model'],
|
|
370
|
+
mcpKeys: ['amp.mcpServers'],
|
|
371
|
+
configFiles: () => (process.platform === 'win32'
|
|
372
|
+
? [
|
|
373
|
+
json(joinRel(appDataDir(), 'amp', 'settings.json')),
|
|
374
|
+
json('.config/amp/settings.json'),
|
|
375
|
+
jsonc('.config/amp/settings.jsonc'),
|
|
376
|
+
]
|
|
377
|
+
: [json('.config/amp/settings.json'), jsonc('.config/amp/settings.jsonc')]),
|
|
378
|
+
note: '官方文档:macOS/Linux ~/.config/amp/settings.json(c),Windows %APPDATA%/amp/settings.json;MCP 键为 amp.mcpServers。',
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
id: 'factory-droid',
|
|
382
|
+
aliases: ['factory', 'droid', 'droid-cli'],
|
|
383
|
+
displayName: 'Factory Droid',
|
|
384
|
+
criticalKeys: ['mcpServers'],
|
|
385
|
+
mcpKeys: ['mcpServers'],
|
|
386
|
+
configFiles: () => [json('.factory/mcp.json')],
|
|
387
|
+
note: '官方文档确认用户级 MCP 在 ~/.factory/mcp.json;其他 settings 文件路径待实测。',
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
id: 'warp',
|
|
391
|
+
aliases: ['warp-terminal'],
|
|
392
|
+
displayName: 'Warp',
|
|
393
|
+
criticalKeys: ['mcpServers'],
|
|
394
|
+
mcpKeys: ['mcpServers'],
|
|
395
|
+
configFiles: () => [json('.warp/mcp.json')],
|
|
396
|
+
note: '全局 MCP 在 ~/.warp/mcp.json;settings.toml 平台路径不同,暂不纳入。',
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
id: 'comate',
|
|
400
|
+
aliases: ['baidu-comate', 'comate-ai'],
|
|
401
|
+
displayName: '百度 Comate',
|
|
402
|
+
criticalKeys: ['mcpServers'],
|
|
403
|
+
mcpKeys: ['mcpServers'],
|
|
404
|
+
configFiles: () => [json('.comate/mcp.json')],
|
|
405
|
+
experimental: true,
|
|
406
|
+
note: '公开资料以项目级 .comate/mcp.json 为主;用户级 ~/.comate 路径待实测。',
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
id: 'gptme',
|
|
410
|
+
aliases: ['gptme-cli'],
|
|
411
|
+
displayName: 'gptme',
|
|
412
|
+
criticalKeys: ['model', 'provider', 'mcp'],
|
|
413
|
+
mcpKeys: ['mcp'],
|
|
414
|
+
configFiles: () => [toml('.config/gptme/config.toml')],
|
|
415
|
+
note: '官方配置路径 ~/.config/gptme/config.toml;Windows 自定义 XDG 目录需 --root 指定。',
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
id: 'void',
|
|
419
|
+
aliases: ['void-editor'],
|
|
420
|
+
displayName: 'Void',
|
|
421
|
+
criticalKeys: ['mcp', 'mcpServers'],
|
|
422
|
+
mcpKeys: ['mcp', 'mcpServers', 'context_servers'],
|
|
423
|
+
configFiles: () => [json(joinRel(vsCodeUser('Void'), 'settings.json'))],
|
|
424
|
+
experimental: true,
|
|
425
|
+
note: 'VS Code 分支,按 Void/User/settings.json 探测;MCP 配置位置待实测。',
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: 'pearai',
|
|
429
|
+
aliases: ['pear-ai'],
|
|
430
|
+
displayName: 'PearAI',
|
|
431
|
+
criticalKeys: ['mcp', 'mcpServers'],
|
|
432
|
+
mcpKeys: ['mcp', 'mcpServers'],
|
|
433
|
+
configFiles: () => [json(joinRel(vsCodeUser('PearAI'), 'settings.json'))],
|
|
434
|
+
experimental: true,
|
|
435
|
+
note: 'VS Code 分支,按 PearAI/User/settings.json 探测;路径待实测。',
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
id: 'omp',
|
|
439
|
+
aliases: ['oh-my-pi', 'omp-agent'],
|
|
440
|
+
displayName: 'omp(oh-my-pi)',
|
|
441
|
+
criticalKeys: ['model', 'providers', 'mcp'],
|
|
442
|
+
mcpKeys: ['mcp', 'mcpServers'],
|
|
443
|
+
configFiles: () => [yaml('.omp/agent/config.yml')],
|
|
444
|
+
note: '支持 PI_CODING_AGENT_DIR 覆盖目录(v1.3 仅默认路径)。',
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
id: 'deepseek-harness',
|
|
448
|
+
aliases: ['dsh', 'deepseek'],
|
|
449
|
+
displayName: 'DeepSeek Harness',
|
|
450
|
+
criticalKeys: ['model', 'providers', 'mcp'],
|
|
451
|
+
mcpKeys: ['mcp', 'mcpServers'],
|
|
452
|
+
configFiles: () => [yaml('.dsh/settings.yaml')],
|
|
453
|
+
note: 'profiles/*/cordis.patch.yml 需要目录通配,计划在 v1.4 支持。',
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
id: 'pi',
|
|
457
|
+
aliases: ['pi-agent', 'pi-coding-agent'],
|
|
458
|
+
displayName: 'Pi',
|
|
459
|
+
criticalKeys: ['model', 'mcp'],
|
|
460
|
+
mcpKeys: ['mcp', 'mcpServers'],
|
|
461
|
+
configFiles: () => [json('.pi/agent/config.json'), json('.pi/settings.json')],
|
|
462
|
+
experimental: true,
|
|
463
|
+
note: '公开资料未完全证实路径,按 ~/.pi 探测;未找到时不影响其他工具。',
|
|
464
|
+
},
|
|
465
|
+
];
|
|
466
|
+
function listAgentAdapters() {
|
|
467
|
+
return exports.AGENT_ADAPTERS;
|
|
468
|
+
}
|
|
469
|
+
/** 按 id 或别名查找适配器(大小写不敏感)。 */
|
|
470
|
+
function resolveAgentAdapter(value) {
|
|
471
|
+
const needle = value.trim().toLowerCase();
|
|
472
|
+
return exports.AGENT_ADAPTERS.find((adapter) => adapter.id === needle || adapter.aliases.includes(needle));
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* 把 `--agent` 输入规范化为稳定 id;`all` 原样返回。
|
|
476
|
+
* 未知工具抛出 `UNKNOWN_AGENT`,由命令层转成稳定错误码。
|
|
477
|
+
*/
|
|
478
|
+
function normalizeAgentId(value, allowAll = true) {
|
|
479
|
+
const normalized = value.trim().toLowerCase();
|
|
480
|
+
if (allowAll && normalized === 'all') {
|
|
481
|
+
return 'all';
|
|
482
|
+
}
|
|
483
|
+
const adapter = resolveAgentAdapter(normalized);
|
|
484
|
+
if (!adapter) {
|
|
485
|
+
const supported = exports.AGENT_ADAPTERS.map((item) => item.id).join('、');
|
|
486
|
+
throw new Error(`UNKNOWN_AGENT: 不支持的 AI 编程工具 "${value}";可用:${supported}(运行 \`agentdock agents\` 查看详情)`);
|
|
487
|
+
}
|
|
488
|
+
return adapter.id;
|
|
489
|
+
}
|
|
490
|
+
/** 单个工具或 `all`(全部工具取并集、按路径去重)的关键配置文件。 */
|
|
491
|
+
function agentConfigFiles(agent) {
|
|
492
|
+
if (agent === 'all') {
|
|
493
|
+
const seen = new Set();
|
|
494
|
+
const files = [];
|
|
495
|
+
for (const adapter of exports.AGENT_ADAPTERS) {
|
|
496
|
+
for (const file of adapter.configFiles()) {
|
|
497
|
+
if (seen.has(file.relPath)) {
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
seen.add(file.relPath);
|
|
501
|
+
files.push(file);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return files;
|
|
505
|
+
}
|
|
506
|
+
const adapter = resolveAgentAdapter(agent);
|
|
507
|
+
if (!adapter) {
|
|
508
|
+
throw new Error(`UNKNOWN_AGENT: 不支持的 AI 编程工具 "${agent}"`);
|
|
509
|
+
}
|
|
510
|
+
return adapter.configFiles();
|
|
511
|
+
}
|
|
512
|
+
/** 关键配置项(`all` 时取并集)。 */
|
|
513
|
+
function agentCriticalKeys(agent) {
|
|
514
|
+
if (agent === 'all') {
|
|
515
|
+
return [...new Set(exports.AGENT_ADAPTERS.flatMap((adapter) => adapter.criticalKeys))];
|
|
516
|
+
}
|
|
517
|
+
const adapter = resolveAgentAdapter(agent);
|
|
518
|
+
return adapter ? [...adapter.criticalKeys] : [];
|
|
519
|
+
}
|
|
520
|
+
/** 承载 MCP 定义的键(`all` 时取并集)。 */
|
|
521
|
+
function agentMcpKeys(agent) {
|
|
522
|
+
if (agent === 'all') {
|
|
523
|
+
return [...new Set(exports.AGENT_ADAPTERS.flatMap((adapter) => adapter.mcpKeys))];
|
|
524
|
+
}
|
|
525
|
+
const adapter = resolveAgentAdapter(agent);
|
|
526
|
+
return adapter ? [...adapter.mcpKeys] : [];
|
|
527
|
+
}
|
|
528
|
+
/** 主目录下是否存在该工具的任意配置文件。 */
|
|
529
|
+
async function isAgentInstalled(root, agent) {
|
|
530
|
+
const adapter = resolveAgentAdapter(agent);
|
|
531
|
+
if (!adapter) {
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
for (const file of adapter.configFiles()) {
|
|
535
|
+
const abs = node_path_1.default.join(root, ...file.relPath.split('/'));
|
|
536
|
+
if (await (0, fs_1.pathExists)(abs)) {
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
/** 已安装的工具 id 列表(只包含检测到配置文件的工具)。 */
|
|
543
|
+
async function detectInstalledAgents(root) {
|
|
544
|
+
const installed = [];
|
|
545
|
+
for (const adapter of exports.AGENT_ADAPTERS) {
|
|
546
|
+
if (await isAgentInstalled(root, adapter.id)) {
|
|
547
|
+
installed.push(adapter.id);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return installed;
|
|
551
|
+
}
|