agentdock-cli 1.4.1 → 1.6.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 +14 -6
- package/dist/package.json +1 -1
- package/dist/src/agents/paths.js +25 -0
- package/dist/src/agents/registry.js +127 -62
- package/dist/src/agents/semantic.js +68 -15
- package/dist/src/commands/agents.js +33 -1
- package/dist/src/core/uninstall.js +6 -0
- package/dist/src/i18n/index.js +22 -2
- package/dist/src/scanners/semantic-scanner.js +39 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -198,23 +198,31 @@ restore/
|
|
|
198
198
|
| `claude-desktop` | Claude Desktop | `claude_desktop_config.json`(MCP 宿主) |
|
|
199
199
|
| `lm-studio` | LM Studio | `.lmstudio/mcp.json`(MCP 宿主) |
|
|
200
200
|
| `codebuddy` | CodeBuddy(腾讯) | `.codebuddy/settings.json`、`settings.local.json`、`mcp.json`、`CODEBUDDY.md` |
|
|
201
|
-
| `kimi` | Kimi Code CLI | `.kimi/config.toml`、`.kimi-code/mcp.json
|
|
202
|
-
| `iflow` | iFlow CLI(心流) | `.iflow/settings.json` |
|
|
201
|
+
| `kimi` | Kimi Code CLI | `.kimi-code/config.toml`、`.kimi-code/mcp.json`(兼容 `.kimi/`) |
|
|
202
|
+
| `iflow` | iFlow CLI(心流) | `.iflow/mcp/config.json`、`.iflow/settings.json`、`IFLOW.md` |
|
|
203
203
|
| `junie` | JetBrains Junie | `.junie/mcp/mcp.json`、`.junie/config.json` |
|
|
204
204
|
| `amazon-q` | Amazon Q Developer | `.aws/amazonq/agents/default.json` |
|
|
205
205
|
| `amp` | Amp(Sourcegraph) | `.config/amp/settings.json(c)`、Windows `%APPDATA%/amp/` |
|
|
206
|
-
| `factory-droid` | Factory Droid | `.factory/mcp.json
|
|
206
|
+
| `factory-droid` | Factory Droid | `.factory/mcp.json`、`.factory/skills/` |
|
|
207
207
|
| `warp` | Warp | `.warp/mcp.json` |
|
|
208
208
|
| `comate` | 百度 Comate | `.comate/mcp.json`(用户级路径待实测) |
|
|
209
209
|
| `gptme` | gptme | `.config/gptme/config.toml` |
|
|
210
210
|
| `void` | Void | `Void/User/settings.json`(实验性) |
|
|
211
211
|
| `pearai` | PearAI | `PearAI/User/settings.json`(实验性) |
|
|
212
|
-
| `omp` | omp(oh-my-pi) |
|
|
212
|
+
| `omp` | omp(oh-my-pi) | `~/.omp/agent/config.yml`、`models.yml`、`mcp.json` |
|
|
213
213
|
| `deepseek-harness` | DeepSeek Harness | `.dsh/settings.yaml` |
|
|
214
|
-
| `pi` | Pi |
|
|
214
|
+
| `pi` | Pi | `~/.pi/agent/settings.json`、`mcp.json`、`models.json` |
|
|
215
215
|
|
|
216
216
|
`agentdock agents` 可查看本机实际检测到的工具与配置文件。
|
|
217
217
|
|
|
218
|
+
**路径验证状态**:`agentdock agents` 为每款工具标注可信度:
|
|
219
|
+
|
|
220
|
+
- `confirmed`:官方文档 + 本机或 CI 真实安装验证过。当前 12 款:Claude Code、Codex、Gemini CLI、Qwen Code、OpenCode、Factory Droid、Grok Build、TRAE、Copilot、Continue、CodeBuddy、Pi。
|
|
221
|
+
- `documented`:按官方文档实现,尚未在真实安装上复验。
|
|
222
|
+
- `experimental`:路径仍为推断,需要实测确认。
|
|
223
|
+
|
|
224
|
+
CI 的 `path-probe` 会在 Ubuntu / macOS / Windows 的隔离 HOME 中真实安装 Pi、Gemini CLI、Codex、Qwen Code、OpenCode、Factory Droid,执行各自的 `mcp add` 并断言落盘路径;其余工具不会为了“覆盖率”假装已验证。探针的隔离方式、新增步骤与静态审计流程见 [docs/verification.md](docs/verification.md)。
|
|
225
|
+
|
|
218
226
|
**语义化迁移(v1.4)**:`scan` / `export` / `pack` / `sync` 与文件级能力一样覆盖全部 37 款工具——`--agent` 接受任意工具 id 或 `all`。每个工具按自身格式读取 MCP、全局指令、规则与技能:
|
|
219
227
|
|
|
220
228
|
- **MCP**:按工具声明的配置文件与容器键提取(`mcpServers` / `mcp` / `context_servers` / `extensions` / `amp.mcpServers`),支持 JSON、JSONC、YAML、TOML。
|
|
@@ -224,7 +232,7 @@ restore/
|
|
|
224
232
|
|
|
225
233
|
安装采用**整文件深合并**:目标机已有的配置键与 MCP 会保留,包内同名键覆盖;全新目标机则完整还原。Claude 仍只合并 `.claude.json` 的 `mcpServers`,Codex 仍只合并 `config.toml` 的 `mcp_servers`,行为与此前一致。
|
|
226
234
|
|
|
227
|
-
**已知限制**:系统钥匙串 / VS Code SecretStorage 中的密钥不会被扫描;账号云同步的配置可能只落盘部分内容;Qoder CN、Comate、Void、PearAI
|
|
235
|
+
**已知限制**:系统钥匙串 / VS Code SecretStorage 中的密钥不会被扫描;账号云同步的配置可能只落盘部分内容;Qoder CN、Comate、Void、PearAI 的部分路径仍属实验性;JSONC 注释在导出后不保留(内容仍有效);没有 MCP 的工具(如 Aider)只迁移配置文件。CodeGeeX、CodeArts Snap、Augment Code、Sourcegraph Cody、OpenHands、Plandex 等仍未加入,需先实测路径。
|
|
228
236
|
|
|
229
237
|
**Codex 配置合并(与 Claude 同权)**:`config.toml` 以 `merge` 方式安装——目标机若已存在 `config.toml`,只深度合并包内的 `mcp_servers`,**保留其原有的 `model` / `provider` 等设置**,绝不整体覆盖;全新目标机则整文件还原。卸载时同样只精确摘回包贡献的 `mcp_servers`,不动用户既有配置。这与 Claude `.claude.json` 仅合并 `mcpServers` 的语义完全对齐。
|
|
230
238
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentdock-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Diagnose, migrate, and back up your AI coding environment — Claude Code, Codex, Gemini CLI, TRAE, Cursor/Grok Build, Cline, Windsurf, Copilot, OpenCode and more — with config snapshots, restore, and secret isolation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 注册表与语义层共用的路径辅助函数。
|
|
4
|
+
*
|
|
5
|
+
* 单独成文件是为了避免 `registry.ts ↔ semantic.ts` 的运行时循环依赖:
|
|
6
|
+
* 语义注册表需要平台路径,注册表的安装检测又需要语义目录。
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.appDataDir = appDataDir;
|
|
10
|
+
exports.joinRel = joinRel;
|
|
11
|
+
exports.vsCodeUser = vsCodeUser;
|
|
12
|
+
/** Windows 使用 AppData/Roaming,macOS 使用 Library/Application Support,Linux 使用 XDG .config。 */
|
|
13
|
+
function appDataDir() {
|
|
14
|
+
if (process.platform === 'win32')
|
|
15
|
+
return 'AppData/Roaming';
|
|
16
|
+
if (process.platform === 'darwin')
|
|
17
|
+
return 'Library/Application Support';
|
|
18
|
+
return '.config';
|
|
19
|
+
}
|
|
20
|
+
function joinRel(...parts) {
|
|
21
|
+
return parts.join('/');
|
|
22
|
+
}
|
|
23
|
+
function vsCodeUser(appName) {
|
|
24
|
+
return joinRel(appDataDir(), appName, 'User');
|
|
25
|
+
}
|
|
@@ -15,9 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.AGENT_ADAPTERS = void 0;
|
|
18
|
-
exports.appDataDir = appDataDir;
|
|
19
|
-
exports.vsCodeUser = vsCodeUser;
|
|
20
18
|
exports.listAgentAdapters = listAgentAdapters;
|
|
19
|
+
exports.agentVerification = agentVerification;
|
|
21
20
|
exports.resolveAgentAdapter = resolveAgentAdapter;
|
|
22
21
|
exports.normalizeAgentId = normalizeAgentId;
|
|
23
22
|
exports.agentConfigFiles = agentConfigFiles;
|
|
@@ -27,17 +26,8 @@ exports.isAgentInstalled = isAgentInstalled;
|
|
|
27
26
|
exports.detectInstalledAgents = detectInstalledAgents;
|
|
28
27
|
const node_path_1 = __importDefault(require("node:path"));
|
|
29
28
|
const fs_1 = require("../utils/fs");
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
}
|
|
29
|
+
const paths_1 = require("./paths");
|
|
30
|
+
const semantic_1 = require("./semantic");
|
|
41
31
|
function json(relPath) {
|
|
42
32
|
return { relPath, kind: 'json' };
|
|
43
33
|
}
|
|
@@ -53,14 +43,13 @@ function toml(relPath) {
|
|
|
53
43
|
function text(relPath) {
|
|
54
44
|
return { relPath, kind: 'text' };
|
|
55
45
|
}
|
|
56
|
-
function vsCodeUser(appName) {
|
|
57
|
-
return joinRel(appDataDir(), appName, 'User');
|
|
58
|
-
}
|
|
59
46
|
exports.AGENT_ADAPTERS = [
|
|
60
47
|
{
|
|
61
48
|
id: 'claude',
|
|
62
49
|
aliases: ['claude-code', 'anthropic'],
|
|
63
50
|
displayName: 'Claude Code',
|
|
51
|
+
verification: 'confirmed',
|
|
52
|
+
docs: 'https://docs.claude.com/en/docs/claude-code/settings',
|
|
64
53
|
criticalKeys: ['model', 'modelPicker', 'mcpServers', 'env'],
|
|
65
54
|
mcpKeys: ['mcpServers'],
|
|
66
55
|
configFiles: () => [
|
|
@@ -73,6 +62,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
73
62
|
id: 'codex',
|
|
74
63
|
aliases: ['openai-codex', 'codex-cli'],
|
|
75
64
|
displayName: 'OpenAI Codex',
|
|
65
|
+
verification: 'confirmed',
|
|
66
|
+
docs: 'https://github.com/openai/codex',
|
|
76
67
|
criticalKeys: ['model', 'model_providers', 'mcp_servers'],
|
|
77
68
|
mcpKeys: ['mcp_servers'],
|
|
78
69
|
configFiles: () => [toml('.codex/config.toml')],
|
|
@@ -81,6 +72,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
81
72
|
id: 'gemini',
|
|
82
73
|
aliases: ['gemini-cli', 'google-gemini'],
|
|
83
74
|
displayName: 'Gemini CLI',
|
|
75
|
+
verification: 'confirmed',
|
|
76
|
+
docs: 'https://geminicli.com/docs/get-started/configuration/',
|
|
84
77
|
criticalKeys: ['model', 'mcpServers', 'selectedAuthType'],
|
|
85
78
|
mcpKeys: ['mcpServers'],
|
|
86
79
|
configFiles: () => [json('.gemini/settings.json'), text('.gemini/GEMINI.md')],
|
|
@@ -99,6 +92,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
99
92
|
id: 'opencode',
|
|
100
93
|
aliases: ['open-code', 'sst-opencode'],
|
|
101
94
|
displayName: 'OpenCode',
|
|
95
|
+
verification: 'confirmed',
|
|
96
|
+
docs: 'https://opencode.ai/docs/mcp-servers/',
|
|
102
97
|
criticalKeys: ['model', 'provider', 'mcp', 'instructions'],
|
|
103
98
|
mcpKeys: ['mcp'],
|
|
104
99
|
configFiles: () => [
|
|
@@ -111,11 +106,13 @@ exports.AGENT_ADAPTERS = [
|
|
|
111
106
|
id: 'grok-build',
|
|
112
107
|
aliases: ['cursor', 'grok', 'cursor-ide'],
|
|
113
108
|
displayName: 'Grok Build(原 Cursor)',
|
|
109
|
+
verification: 'confirmed',
|
|
110
|
+
docs: 'https://cursor.com/docs/context/mcp',
|
|
114
111
|
criticalKeys: ['mcpServers', 'model'],
|
|
115
112
|
mcpKeys: ['mcpServers'],
|
|
116
113
|
configFiles: () => [
|
|
117
114
|
json('.cursor/mcp.json'),
|
|
118
|
-
json(joinRel(vsCodeUser('Cursor'), 'settings.json')),
|
|
115
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Cursor'), 'settings.json')),
|
|
119
116
|
],
|
|
120
117
|
note: 'Cursor 已更名为 Grok Build;保留 ~/.cursor 旧目录与 Cursor 用户设置目录兼容。',
|
|
121
118
|
},
|
|
@@ -123,13 +120,15 @@ exports.AGENT_ADAPTERS = [
|
|
|
123
120
|
id: 'trae',
|
|
124
121
|
aliases: ['trae-cn', 'trae-ide'],
|
|
125
122
|
displayName: 'TRAE',
|
|
123
|
+
verification: 'confirmed',
|
|
124
|
+
docs: 'https://docs.trae.ai/ide/add-mcp-servers',
|
|
126
125
|
criticalKeys: ['model', 'mcp', 'mcpServers'],
|
|
127
126
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
128
127
|
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')),
|
|
128
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae CN'), 'settings.json')),
|
|
129
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae CN'), 'mcp.json')),
|
|
130
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae'), 'settings.json')),
|
|
131
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae'), 'mcp.json')),
|
|
133
132
|
],
|
|
134
133
|
note: '同时探测 Trae CN 与 Trae 两个用户数据目录。',
|
|
135
134
|
},
|
|
@@ -140,11 +139,11 @@ exports.AGENT_ADAPTERS = [
|
|
|
140
139
|
criticalKeys: ['model', 'mcpServers'],
|
|
141
140
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
142
141
|
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')),
|
|
142
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder'), 'settings.json')),
|
|
143
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder'), 'mcp.json')),
|
|
144
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder CN'), 'settings.json')),
|
|
145
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder CN'), 'mcp.json')),
|
|
146
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/alibaba-cloud.tongyi-lingma/settings.json')),
|
|
148
147
|
],
|
|
149
148
|
experimental: true,
|
|
150
149
|
note: 'Qoder CN 已由通义灵码更名;同时探测 Qoder / Qoder CN 用户目录与 VS Code 的 alibaba-cloud.tongyi-lingma 扩展目录,部分路径仍待全平台实测。',
|
|
@@ -156,8 +155,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
156
155
|
criticalKeys: ['mcpServers'],
|
|
157
156
|
mcpKeys: ['mcpServers'],
|
|
158
157
|
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')),
|
|
158
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json')),
|
|
159
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json')),
|
|
161
160
|
],
|
|
162
161
|
},
|
|
163
162
|
{
|
|
@@ -172,12 +171,14 @@ exports.AGENT_ADAPTERS = [
|
|
|
172
171
|
id: 'copilot',
|
|
173
172
|
aliases: ['github-copilot', 'copilot-vscode'],
|
|
174
173
|
displayName: 'GitHub Copilot',
|
|
174
|
+
verification: 'confirmed',
|
|
175
|
+
docs: 'https://docs.github.com/en/copilot/customizing-copilot/extending-copilot-chat-with-mcp',
|
|
175
176
|
criticalKeys: ['mcp', 'mcpServers', 'github.copilot'],
|
|
176
177
|
mcpKeys: ['mcp', 'mcpServers'],
|
|
177
178
|
configFiles: () => [
|
|
178
|
-
json(joinRel(vsCodeUser('Code'), 'settings.json')),
|
|
179
|
-
json(joinRel(vsCodeUser('Code'), 'mcp.json')),
|
|
180
|
-
json(joinRel(vsCodeUser('Code - Insiders'), 'settings.json')),
|
|
179
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'settings.json')),
|
|
180
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'mcp.json')),
|
|
181
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'settings.json')),
|
|
181
182
|
json('.copilot/config.json'),
|
|
182
183
|
json('.copilot/settings.json'),
|
|
183
184
|
json('.copilot/mcp-config.json'),
|
|
@@ -191,9 +192,9 @@ exports.AGENT_ADAPTERS = [
|
|
|
191
192
|
criticalKeys: ['mcpServers'],
|
|
192
193
|
mcpKeys: ['mcpServers'],
|
|
193
194
|
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')),
|
|
195
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json')),
|
|
196
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json')),
|
|
197
|
+
yaml((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml')),
|
|
197
198
|
],
|
|
198
199
|
note: 'Cline 生态分支;项目级 .roorules 与 .roo/ 不在主目录快照内。',
|
|
199
200
|
},
|
|
@@ -204,9 +205,9 @@ exports.AGENT_ADAPTERS = [
|
|
|
204
205
|
criticalKeys: ['mcpServers'],
|
|
205
206
|
mcpKeys: ['mcpServers'],
|
|
206
207
|
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')),
|
|
208
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/kilocode.kilo-code/settings/mcp_settings.json')),
|
|
209
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'globalStorage/kilocode.kilo-code/settings/mcp_settings.json')),
|
|
210
|
+
yaml((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/kilocode.kilo-code/settings/custom_modes.yaml')),
|
|
210
211
|
],
|
|
211
212
|
note: 'Roo / Cline 生态分支;项目级 .kilocoderules 不在主目录快照内。',
|
|
212
213
|
},
|
|
@@ -214,6 +215,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
214
215
|
id: 'continue',
|
|
215
216
|
aliases: ['continue-dev'],
|
|
216
217
|
displayName: 'Continue',
|
|
218
|
+
verification: 'confirmed',
|
|
219
|
+
docs: 'https://docs.continue.dev/customize/deep-dives/mcp',
|
|
217
220
|
criticalKeys: ['models', 'model', 'mcpServers', 'context'],
|
|
218
221
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
219
222
|
configFiles: () => [
|
|
@@ -231,8 +234,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
231
234
|
mcpKeys: ['extensions'],
|
|
232
235
|
configFiles: () => (process.platform === 'win32'
|
|
233
236
|
? [
|
|
234
|
-
yaml(joinRel(appDataDir(), 'Block', 'goose', 'config', 'config.yaml')),
|
|
235
|
-
yaml(joinRel(appDataDir(), 'Block', 'goose', 'config', 'profiles.yaml')),
|
|
237
|
+
yaml((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Block', 'goose', 'config', 'config.yaml')),
|
|
238
|
+
yaml((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Block', 'goose', 'config', 'profiles.yaml')),
|
|
236
239
|
]
|
|
237
240
|
: [
|
|
238
241
|
yaml('.config/goose/config.yaml'),
|
|
@@ -244,6 +247,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
244
247
|
id: 'qwen',
|
|
245
248
|
aliases: ['qwen-code', 'qwen-cli'],
|
|
246
249
|
displayName: 'Qwen Code',
|
|
250
|
+
verification: 'confirmed',
|
|
251
|
+
docs: 'https://qwenlm.github.io/qwen-code-docs/en/users/features/mcp/',
|
|
247
252
|
criticalKeys: ['model', 'mcpServers', 'selectedAuthType'],
|
|
248
253
|
mcpKeys: ['mcpServers'],
|
|
249
254
|
configFiles: () => [json('.qwen/settings.json'), text('.qwen/QWEN.md')],
|
|
@@ -275,7 +280,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
275
280
|
mcpKeys: ['context_servers'],
|
|
276
281
|
configFiles: () => (process.platform === 'win32'
|
|
277
282
|
? [
|
|
278
|
-
json(joinRel(appDataDir(), 'Zed', 'settings.json')),
|
|
283
|
+
json((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Zed', 'settings.json')),
|
|
279
284
|
json('.config/zed/settings.json'),
|
|
280
285
|
]
|
|
281
286
|
: [json('.config/zed/settings.json')]),
|
|
@@ -296,7 +301,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
296
301
|
displayName: 'Claude Desktop',
|
|
297
302
|
criticalKeys: ['mcpServers'],
|
|
298
303
|
mcpKeys: ['mcpServers'],
|
|
299
|
-
configFiles: () => [json(joinRel(appDataDir(), 'Claude', 'claude_desktop_config.json'))],
|
|
304
|
+
configFiles: () => [json((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Claude', 'claude_desktop_config.json'))],
|
|
300
305
|
note: 'MCP 宿主而非编码 CLI;常用于本机 MCP Server 备份。',
|
|
301
306
|
},
|
|
302
307
|
{
|
|
@@ -312,6 +317,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
312
317
|
id: 'codebuddy',
|
|
313
318
|
aliases: ['codebuddy-code', 'tencent-codebuddy'],
|
|
314
319
|
displayName: 'CodeBuddy(腾讯)',
|
|
320
|
+
verification: 'confirmed',
|
|
321
|
+
docs: 'https://www.codebuddy.ai/docs/zh/ide/User-guide/MCP',
|
|
315
322
|
criticalKeys: ['model', 'mcpServers', 'permissions'],
|
|
316
323
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
317
324
|
configFiles: () => [
|
|
@@ -329,11 +336,13 @@ exports.AGENT_ADAPTERS = [
|
|
|
329
336
|
criticalKeys: ['model', 'provider', 'providers'],
|
|
330
337
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
331
338
|
configFiles: () => [
|
|
339
|
+
toml('.kimi-code/config.toml'),
|
|
340
|
+
json('.kimi-code/mcp.json'),
|
|
332
341
|
toml('.kimi/config.toml'),
|
|
333
342
|
json('.kimi/config.json'),
|
|
334
|
-
json('.kimi
|
|
343
|
+
json('.kimi/mcp.json'),
|
|
335
344
|
],
|
|
336
|
-
note: '
|
|
345
|
+
note: '新版 Kimi Code CLI 使用 ~/.kimi-code/config.toml + mcp.json;旧版 kimi-cli 的 ~/.kimi 路径继续兼容。',
|
|
337
346
|
},
|
|
338
347
|
{
|
|
339
348
|
id: 'iflow',
|
|
@@ -341,8 +350,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
341
350
|
displayName: 'iFlow CLI(心流)',
|
|
342
351
|
criticalKeys: ['modelName', 'apiKey', 'selectedAuthType'],
|
|
343
352
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
344
|
-
configFiles: () => [json('.iflow/settings.json')],
|
|
345
|
-
note: '
|
|
353
|
+
configFiles: () => [json('.iflow/settings.json'), json('.iflow/mcp/config.json')],
|
|
354
|
+
note: '官方文档确认全局 MCP 在 ~/.iflow/mcp/config.json;~/.iflow/settings.json 继续兼容读取。',
|
|
346
355
|
},
|
|
347
356
|
{
|
|
348
357
|
id: 'junie',
|
|
@@ -370,7 +379,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
370
379
|
mcpKeys: ['amp.mcpServers'],
|
|
371
380
|
configFiles: () => (process.platform === 'win32'
|
|
372
381
|
? [
|
|
373
|
-
json(joinRel(appDataDir(), 'amp', 'settings.json')),
|
|
382
|
+
json((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'amp', 'settings.json')),
|
|
374
383
|
json('.config/amp/settings.json'),
|
|
375
384
|
jsonc('.config/amp/settings.jsonc'),
|
|
376
385
|
]
|
|
@@ -381,10 +390,12 @@ exports.AGENT_ADAPTERS = [
|
|
|
381
390
|
id: 'factory-droid',
|
|
382
391
|
aliases: ['factory', 'droid', 'droid-cli'],
|
|
383
392
|
displayName: 'Factory Droid',
|
|
393
|
+
verification: 'confirmed',
|
|
384
394
|
criticalKeys: ['mcpServers'],
|
|
385
395
|
mcpKeys: ['mcpServers'],
|
|
396
|
+
docs: 'https://docs.factory.com/harness/mcp',
|
|
386
397
|
configFiles: () => [json('.factory/mcp.json')],
|
|
387
|
-
note: '官方文档确认用户级 MCP 在 ~/.factory/mcp.json
|
|
398
|
+
note: '官方文档确认用户级 MCP 在 ~/.factory/mcp.json,droid mcp add 直接写入该文件。',
|
|
388
399
|
},
|
|
389
400
|
{
|
|
390
401
|
id: 'warp',
|
|
@@ -420,7 +431,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
420
431
|
displayName: 'Void',
|
|
421
432
|
criticalKeys: ['mcp', 'mcpServers'],
|
|
422
433
|
mcpKeys: ['mcp', 'mcpServers', 'context_servers'],
|
|
423
|
-
configFiles: () => [json(joinRel(vsCodeUser('Void'), 'settings.json'))],
|
|
434
|
+
configFiles: () => [json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Void'), 'settings.json'))],
|
|
424
435
|
experimental: true,
|
|
425
436
|
note: 'VS Code 分支,按 Void/User/settings.json 探测;MCP 配置位置待实测。',
|
|
426
437
|
},
|
|
@@ -430,7 +441,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
430
441
|
displayName: 'PearAI',
|
|
431
442
|
criticalKeys: ['mcp', 'mcpServers'],
|
|
432
443
|
mcpKeys: ['mcp', 'mcpServers'],
|
|
433
|
-
configFiles: () => [json(joinRel(vsCodeUser('PearAI'), 'settings.json'))],
|
|
444
|
+
configFiles: () => [json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('PearAI'), 'settings.json'))],
|
|
434
445
|
experimental: true,
|
|
435
446
|
note: 'VS Code 分支,按 PearAI/User/settings.json 探测;路径待实测。',
|
|
436
447
|
},
|
|
@@ -438,10 +449,15 @@ exports.AGENT_ADAPTERS = [
|
|
|
438
449
|
id: 'omp',
|
|
439
450
|
aliases: ['oh-my-pi', 'omp-agent'],
|
|
440
451
|
displayName: 'omp(oh-my-pi)',
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
452
|
+
docs: 'https://github.com/can1357/oh-my-pi',
|
|
453
|
+
criticalKeys: ['model', 'providers', 'mcpServers'],
|
|
454
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
455
|
+
configFiles: () => [
|
|
456
|
+
yaml('.omp/agent/config.yml'),
|
|
457
|
+
yaml('.omp/agent/models.yml'),
|
|
458
|
+
json('.omp/agent/mcp.json'),
|
|
459
|
+
],
|
|
460
|
+
note: '用户级 MCP 在 ~/.omp/agent/mcp.json(mcpServers),设置与模型分别在 config.yml / models.yml;旧版 config.yml 内的 mcp 键仍兼容读取。',
|
|
445
461
|
},
|
|
446
462
|
{
|
|
447
463
|
id: 'deepseek-harness',
|
|
@@ -450,22 +466,67 @@ exports.AGENT_ADAPTERS = [
|
|
|
450
466
|
criticalKeys: ['model', 'providers', 'mcp'],
|
|
451
467
|
mcpKeys: ['mcp', 'mcpServers'],
|
|
452
468
|
configFiles: () => [yaml('.dsh/settings.yaml')],
|
|
453
|
-
note: 'profiles/*/cordis.patch.yml
|
|
469
|
+
note: 'profiles/*/cordis.patch.yml 自 v1.4 起按目录通配采集;profile 内的 MCP 以整文件合并迁移。',
|
|
454
470
|
},
|
|
455
471
|
{
|
|
456
472
|
id: 'pi',
|
|
457
473
|
aliases: ['pi-agent', 'pi-coding-agent'],
|
|
458
474
|
displayName: 'Pi',
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
475
|
+
verification: 'confirmed',
|
|
476
|
+
docs: 'https://docs.pi.dev/latest/configuration',
|
|
477
|
+
criticalKeys: ['model', 'mcpServers'],
|
|
478
|
+
mcpKeys: ['mcpServers'],
|
|
479
|
+
configFiles: () => [
|
|
480
|
+
json('.pi/agent/settings.json'),
|
|
481
|
+
json('.pi/agent/mcp.json'),
|
|
482
|
+
json('.pi/agent/models.json'),
|
|
483
|
+
],
|
|
484
|
+
note: '官方文档确认用户级目录 ~/.pi/agent:MCP 在 mcp.json(mcpServers),auth.json 含凭据不纳入迁移;PI_CODING_AGENT_DIR 可覆盖目录。',
|
|
464
485
|
},
|
|
465
486
|
];
|
|
487
|
+
/**
|
|
488
|
+
* `documented` 工具的官方来源。`confirmed` 工具在定义里单独声明,避免被这里覆盖。
|
|
489
|
+
* 只放稳定入口,不放容易失效的深层锚点。
|
|
490
|
+
*/
|
|
491
|
+
const AGENT_DOCS = {
|
|
492
|
+
antigravity: 'https://antigravity.google/docs',
|
|
493
|
+
opencode: 'https://opencode.ai/docs/mcp-servers/',
|
|
494
|
+
qoder: 'https://docs.qoder.com/',
|
|
495
|
+
cline: 'https://docs.cline.bot/',
|
|
496
|
+
windsurf: 'https://docs.windsurf.com/',
|
|
497
|
+
'roo-code': 'https://docs.roocode.com/',
|
|
498
|
+
'kilo-code': 'https://kilocode.ai/docs',
|
|
499
|
+
goose: 'https://block.github.io/goose/',
|
|
500
|
+
qwen: 'https://github.com/QwenLM/qwen-code',
|
|
501
|
+
kiro: 'https://kiro.dev/docs/',
|
|
502
|
+
aider: 'https://aider.chat/docs/',
|
|
503
|
+
zed: 'https://zed.dev/docs',
|
|
504
|
+
crush: 'https://github.com/charmbracelet/crush',
|
|
505
|
+
'claude-desktop': 'https://modelcontextprotocol.io/docs/develop/connect-local-servers',
|
|
506
|
+
'lm-studio': 'https://lmstudio.ai/docs/',
|
|
507
|
+
kimi: 'https://www.kimi.com/code/docs/',
|
|
508
|
+
iflow: 'https://platform.iflow.cn/cli/configuration/settings',
|
|
509
|
+
junie: 'https://www.jetbrains.com/help/junie/',
|
|
510
|
+
'amazon-q': 'https://docs.aws.amazon.com/amazonq/',
|
|
511
|
+
amp: 'https://ampcode.com/manual',
|
|
512
|
+
'factory-droid': 'https://docs.factory.com/harness/mcp',
|
|
513
|
+
warp: 'https://docs.warp.dev/',
|
|
514
|
+
comate: 'https://comate.baidu.com/',
|
|
515
|
+
gptme: 'https://gptme.org/docs/',
|
|
516
|
+
void: 'https://github.com/voideditor/void',
|
|
517
|
+
pearai: 'https://github.com/trypear/pearai-app',
|
|
518
|
+
'deepseek-harness': 'https://www.npmjs.com/package/@ai-thinker/deepseek-harness-cli',
|
|
519
|
+
};
|
|
520
|
+
for (const adapter of exports.AGENT_ADAPTERS) {
|
|
521
|
+
adapter.docs ??= AGENT_DOCS[adapter.id];
|
|
522
|
+
}
|
|
466
523
|
function listAgentAdapters() {
|
|
467
524
|
return exports.AGENT_ADAPTERS;
|
|
468
525
|
}
|
|
526
|
+
/** 路径可信度:显式声明优先,否则按 experimental 标记推导。 */
|
|
527
|
+
function agentVerification(adapter) {
|
|
528
|
+
return adapter.verification ?? (adapter.experimental === true ? 'experimental' : 'documented');
|
|
529
|
+
}
|
|
469
530
|
/** 按 id 或别名查找适配器(大小写不敏感)。 */
|
|
470
531
|
function resolveAgentAdapter(value) {
|
|
471
532
|
const needle = value.trim().toLowerCase();
|
|
@@ -525,14 +586,18 @@ function agentMcpKeys(agent) {
|
|
|
525
586
|
const adapter = resolveAgentAdapter(agent);
|
|
526
587
|
return adapter ? [...adapter.mcpKeys] : [];
|
|
527
588
|
}
|
|
528
|
-
/**
|
|
589
|
+
/** 主目录下是否存在该工具的任意配置文件 / 语义目录。 */
|
|
529
590
|
async function isAgentInstalled(root, agent) {
|
|
530
591
|
const adapter = resolveAgentAdapter(agent);
|
|
531
592
|
if (!adapter) {
|
|
532
593
|
return false;
|
|
533
594
|
}
|
|
534
|
-
|
|
535
|
-
|
|
595
|
+
const declared = new Set([
|
|
596
|
+
...adapter.configFiles().map((file) => file.relPath),
|
|
597
|
+
...(0, semantic_1.semanticPaths)((0, semantic_1.agentSemanticProfile)(adapter.id)),
|
|
598
|
+
]);
|
|
599
|
+
for (const relPath of declared) {
|
|
600
|
+
const abs = node_path_1.default.join(root, ...relPath.split('/'));
|
|
536
601
|
if (await (0, fs_1.pathExists)(abs)) {
|
|
537
602
|
return true;
|
|
538
603
|
}
|
|
@@ -21,19 +21,20 @@
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.AGENT_SEMANTICS = void 0;
|
|
23
23
|
exports.agentSemanticProfile = agentSemanticProfile;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
exports.semanticPaths = semanticPaths;
|
|
25
|
+
const paths_1 = require("./paths");
|
|
26
|
+
function mcp(relPath, kind, key, serversKey) {
|
|
27
|
+
return { relPath, kind, key, ...(serversKey ? { serversKey } : {}) };
|
|
27
28
|
}
|
|
28
29
|
function file(relPath, kind) {
|
|
29
30
|
return { relPath, kind };
|
|
30
31
|
}
|
|
31
32
|
function user(appName, rel) {
|
|
32
|
-
return `${(0,
|
|
33
|
+
return `${(0, paths_1.vsCodeUser)(appName)}/${rel}`;
|
|
33
34
|
}
|
|
34
35
|
function gooseDir() {
|
|
35
36
|
return process.platform === 'win32'
|
|
36
|
-
? `${(0,
|
|
37
|
+
? `${(0, paths_1.appDataDir)()}/Block/goose/config`
|
|
37
38
|
: '.config/goose';
|
|
38
39
|
}
|
|
39
40
|
exports.AGENT_SEMANTICS = {
|
|
@@ -46,8 +47,8 @@ exports.AGENT_SEMANTICS = {
|
|
|
46
47
|
},
|
|
47
48
|
opencode: {
|
|
48
49
|
mcp: [
|
|
49
|
-
mcp('.config/opencode/opencode.json', 'jsonc', 'mcp'),
|
|
50
|
-
mcp('.config/opencode/opencode.jsonc', 'jsonc', 'mcp'),
|
|
50
|
+
mcp('.config/opencode/opencode.json', 'jsonc', 'mcp', 'servers'),
|
|
51
|
+
mcp('.config/opencode/opencode.jsonc', 'jsonc', 'mcp', 'servers'),
|
|
51
52
|
],
|
|
52
53
|
instructions: [file('.config/opencode/AGENTS.md', 'text')],
|
|
53
54
|
},
|
|
@@ -123,7 +124,7 @@ exports.AGENT_SEMANTICS = {
|
|
|
123
124
|
},
|
|
124
125
|
zed: {
|
|
125
126
|
mcp: [
|
|
126
|
-
mcp(process.platform === 'win32' ? `${(0,
|
|
127
|
+
mcp(process.platform === 'win32' ? `${(0, paths_1.appDataDir)()}/Zed/settings.json` : '.config/zed/settings.json', 'json', 'context_servers'),
|
|
127
128
|
mcp('.config/zed/settings.json', 'json', 'context_servers'),
|
|
128
129
|
],
|
|
129
130
|
},
|
|
@@ -131,7 +132,7 @@ exports.AGENT_SEMANTICS = {
|
|
|
131
132
|
mcp: [mcp('.config/crush/crush.json', 'json', 'mcp')],
|
|
132
133
|
},
|
|
133
134
|
'claude-desktop': {
|
|
134
|
-
mcp: [mcp(`${(0,
|
|
135
|
+
mcp: [mcp(`${(0, paths_1.appDataDir)()}/Claude/claude_desktop_config.json`, 'json', 'mcpServers')],
|
|
135
136
|
},
|
|
136
137
|
'lm-studio': {
|
|
137
138
|
mcp: [mcp('.lmstudio/mcp.json', 'json', 'mcpServers')],
|
|
@@ -148,14 +149,21 @@ exports.AGENT_SEMANTICS = {
|
|
|
148
149
|
agentDirs: ['.codebuddy/agents'],
|
|
149
150
|
},
|
|
150
151
|
kimi: {
|
|
151
|
-
mcp: [
|
|
152
|
+
mcp: [
|
|
153
|
+
mcp('.kimi-code/mcp.json', 'json', 'mcpServers'),
|
|
154
|
+
mcp('.kimi/mcp.json', 'json', 'mcpServers'),
|
|
155
|
+
],
|
|
152
156
|
configs: [
|
|
157
|
+
file('.kimi-code/config.toml', 'toml'),
|
|
153
158
|
file('.kimi/config.toml', 'toml'),
|
|
154
159
|
file('.kimi/config.json', 'json'),
|
|
155
160
|
],
|
|
156
161
|
},
|
|
157
162
|
iflow: {
|
|
158
|
-
mcp: [
|
|
163
|
+
mcp: [
|
|
164
|
+
mcp('.iflow/mcp/config.json', 'json', 'mcpServers'),
|
|
165
|
+
mcp('.iflow/settings.json', 'json', 'mcpServers'),
|
|
166
|
+
],
|
|
159
167
|
instructions: [file('.iflow/IFLOW.md', 'text')],
|
|
160
168
|
},
|
|
161
169
|
junie: {
|
|
@@ -168,7 +176,7 @@ exports.AGENT_SEMANTICS = {
|
|
|
168
176
|
},
|
|
169
177
|
amp: {
|
|
170
178
|
mcp: [
|
|
171
|
-
mcp(process.platform === 'win32' ? `${(0,
|
|
179
|
+
mcp(process.platform === 'win32' ? `${(0, paths_1.appDataDir)()}/amp/settings.json` : '.config/amp/settings.json', 'json', 'amp.mcpServers'),
|
|
172
180
|
mcp('.config/amp/settings.jsonc', 'jsonc', 'amp.mcpServers'),
|
|
173
181
|
],
|
|
174
182
|
},
|
|
@@ -192,17 +200,62 @@ exports.AGENT_SEMANTICS = {
|
|
|
192
200
|
mcp: [mcp(user('PearAI', 'settings.json'), 'json', 'mcp')],
|
|
193
201
|
},
|
|
194
202
|
omp: {
|
|
195
|
-
mcp: [
|
|
203
|
+
mcp: [
|
|
204
|
+
mcp('.omp/agent/mcp.json', 'json', 'mcpServers'),
|
|
205
|
+
mcp('.omp/agent/config.yml', 'yaml', 'mcp'),
|
|
206
|
+
],
|
|
207
|
+
configs: [
|
|
208
|
+
file('.omp/agent/config.yml', 'yaml'),
|
|
209
|
+
file('.omp/agent/models.yml', 'yaml'),
|
|
210
|
+
],
|
|
196
211
|
},
|
|
197
212
|
'deepseek-harness': {
|
|
198
213
|
mcp: [mcp('.dsh/settings.yaml', 'yaml', 'mcp')],
|
|
199
214
|
configDirs: ['.dsh/profiles'],
|
|
200
215
|
},
|
|
201
216
|
pi: {
|
|
202
|
-
mcp: [mcp('.pi/agent/
|
|
203
|
-
configs: [
|
|
217
|
+
mcp: [mcp('.pi/agent/mcp.json', 'json', 'mcpServers')],
|
|
218
|
+
configs: [
|
|
219
|
+
file('.pi/agent/settings.json', 'json'),
|
|
220
|
+
file('.pi/agent/models.json', 'json'),
|
|
221
|
+
],
|
|
222
|
+
instructions: [
|
|
223
|
+
file('.pi/agent/AGENTS.md', 'text'),
|
|
224
|
+
file('.pi/agent/CLAUDE.md', 'text'),
|
|
225
|
+
file('.pi/agent/SYSTEM.md', 'text'),
|
|
226
|
+
file('.pi/agent/APPEND_SYSTEM.md', 'text'),
|
|
227
|
+
],
|
|
228
|
+
ruleDirs: ['.pi/agent/prompts'],
|
|
229
|
+
skillDirs: ['.pi/agent/skills'],
|
|
204
230
|
},
|
|
205
231
|
};
|
|
206
232
|
function agentSemanticProfile(agentId) {
|
|
207
233
|
return exports.AGENT_SEMANTICS[agentId];
|
|
208
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* 语义层声明的全部文件 / 目录(相对主目录)。
|
|
237
|
+
* 用于安装检测:只有 skills/ 等目录存在时也应视为「本机有该工具」。
|
|
238
|
+
*/
|
|
239
|
+
function semanticPaths(profile) {
|
|
240
|
+
if (!profile) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
const paths = new Set();
|
|
244
|
+
for (const item of profile.mcp ?? [])
|
|
245
|
+
paths.add(item.relPath);
|
|
246
|
+
for (const item of profile.configs ?? [])
|
|
247
|
+
paths.add(item.relPath);
|
|
248
|
+
for (const item of profile.instructions ?? [])
|
|
249
|
+
paths.add(item.relPath);
|
|
250
|
+
for (const dir of profile.ruleDirs ?? [])
|
|
251
|
+
paths.add(dir);
|
|
252
|
+
for (const dir of profile.skillDirs ?? [])
|
|
253
|
+
paths.add(dir);
|
|
254
|
+
for (const dir of profile.agentDirs ?? [])
|
|
255
|
+
paths.add(dir);
|
|
256
|
+
for (const dir of profile.agentJsonDirs ?? [])
|
|
257
|
+
paths.add(dir);
|
|
258
|
+
for (const dir of profile.configDirs ?? [])
|
|
259
|
+
paths.add(dir);
|
|
260
|
+
return [...paths];
|
|
261
|
+
}
|
|
@@ -7,10 +7,28 @@ exports.runAgentsCommand = runAgentsCommand;
|
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const scan_1 = require("../core/scan");
|
|
9
9
|
const registry_1 = require("../agents/registry");
|
|
10
|
+
const semantic_1 = require("../agents/semantic");
|
|
10
11
|
const fs_1 = require("../utils/fs");
|
|
11
12
|
const command_json_1 = require("../utils/command-json");
|
|
12
13
|
const command_error_codes_1 = require("../constants/command-error-codes");
|
|
13
14
|
const i18n_1 = require("../i18n");
|
|
15
|
+
/** Claude / Codex 走专用扫描器,没有语义 profile,需要单独声明能力。 */
|
|
16
|
+
const CAPABILITY_OVERRIDES = {
|
|
17
|
+
claude: { instructions: true, rules: false, skills: true, agents: true },
|
|
18
|
+
codex: { instructions: true, rules: false, skills: false, agents: false },
|
|
19
|
+
};
|
|
20
|
+
function agentCapabilities(adapter) {
|
|
21
|
+
const profile = (0, semantic_1.agentSemanticProfile)(adapter.id);
|
|
22
|
+
return {
|
|
23
|
+
mcp: adapter.mcpKeys.length > 0,
|
|
24
|
+
instructions: (profile?.instructions?.length ?? 0) > 0,
|
|
25
|
+
rules: (profile?.ruleDirs?.length ?? 0) > 0,
|
|
26
|
+
skills: (profile?.skillDirs?.length ?? 0) > 0,
|
|
27
|
+
agents: (profile?.agentDirs?.length ?? 0) + (profile?.agentJsonDirs?.length ?? 0) > 0,
|
|
28
|
+
configs: adapter.configFiles().length > 0,
|
|
29
|
+
...CAPABILITY_OVERRIDES[adapter.id],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
14
32
|
/**
|
|
15
33
|
* `agentdock agents`:列出注册表支持的全部 AI 编程工具与检测结果。
|
|
16
34
|
* 用于确认「自动支持」覆盖到哪些工具,以及本机实际存在哪些配置。
|
|
@@ -20,7 +38,10 @@ async function runAgentsCommand(options = {}) {
|
|
|
20
38
|
try {
|
|
21
39
|
const agents = [];
|
|
22
40
|
for (const adapter of (0, registry_1.listAgentAdapters)()) {
|
|
23
|
-
const declared =
|
|
41
|
+
const declared = [...new Set([
|
|
42
|
+
...adapter.configFiles().map((file) => file.relPath),
|
|
43
|
+
...(0, semantic_1.semanticPaths)((0, semantic_1.agentSemanticProfile)(adapter.id)),
|
|
44
|
+
])];
|
|
24
45
|
const existing = [];
|
|
25
46
|
const missing = [];
|
|
26
47
|
for (const relPath of declared) {
|
|
@@ -38,6 +59,9 @@ async function runAgentsCommand(options = {}) {
|
|
|
38
59
|
aliases: adapter.aliases,
|
|
39
60
|
installed: existing.length > 0,
|
|
40
61
|
experimental: adapter.experimental === true,
|
|
62
|
+
verification: (0, registry_1.agentVerification)(adapter),
|
|
63
|
+
...(adapter.docs ? { docs: adapter.docs } : {}),
|
|
64
|
+
capabilities: agentCapabilities(adapter),
|
|
41
65
|
configFiles: existing,
|
|
42
66
|
missingFiles: missing,
|
|
43
67
|
...(adapter.note ? { note: adapter.note } : {}),
|
|
@@ -58,8 +82,16 @@ async function runAgentsCommand(options = {}) {
|
|
|
58
82
|
id: agent.id,
|
|
59
83
|
name: agent.displayName,
|
|
60
84
|
status: agent.installed ? (0, i18n_1.t)('agents.installed') : (0, i18n_1.t)('agents.notInstalled'),
|
|
85
|
+
level: (0, i18n_1.t)(`agents.verification.${agent.verification}`),
|
|
61
86
|
files: agent.configFiles.length,
|
|
62
87
|
}));
|
|
88
|
+
const caps = Object.keys(agent.capabilities)
|
|
89
|
+
.filter((key) => agent.capabilities[key])
|
|
90
|
+
.map((key) => (0, i18n_1.t)(`agents.capability.${key}`))
|
|
91
|
+
.join(', ');
|
|
92
|
+
if (caps) {
|
|
93
|
+
lines.push((0, i18n_1.t)('agents.capabilities', { caps }));
|
|
94
|
+
}
|
|
63
95
|
if (agent.experimental) {
|
|
64
96
|
lines.push((0, i18n_1.t)('agents.note', { note: (0, i18n_1.t)('agents.experimental') }));
|
|
65
97
|
}
|
|
@@ -83,8 +83,14 @@ async function unmergeDataFile(sourcePath, toPath, mergeKeys) {
|
|
|
83
83
|
removed.push(`${mcpKey}.${server}`);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
// 容器里的 server 全部移除后,不留下空的 `mcpServers: {}`。
|
|
87
|
+
if (Object.keys(targetServers).length === 0 && mcpKey in target) {
|
|
88
|
+
delete target[mcpKey];
|
|
89
|
+
}
|
|
86
90
|
}
|
|
87
91
|
if (removed.length > 0) {
|
|
92
|
+
// 保守策略:即使撤销后对象为空,也保留配置文件本身(写回 `{}`),
|
|
93
|
+
// 避免误删用户/工具依赖的配置文件路径。空的 MCP 容器已在上面清理。
|
|
88
94
|
const kind = (0, config_format_1.kindFromPath)(toPath);
|
|
89
95
|
if (kind === 'json' || kind === 'text') {
|
|
90
96
|
await (0, fs_1.writeJsonFile)(toPath, target);
|
package/dist/src/i18n/index.js
CHANGED
|
@@ -67,10 +67,20 @@ const DICTIONARIES = {
|
|
|
67
67
|
'history.usage': 'Usage: agentdock history [--agent <id|all>] [--root <dir>]',
|
|
68
68
|
'agents.usage': 'Usage: agentdock agents [--root <dir>] [--json]',
|
|
69
69
|
'agents.header': 'Supported AI coding tools: {supported}; detected on this machine: {installed} (root: {root})',
|
|
70
|
-
'agents.item': ' {id} {name} {status} {files} config file(s)',
|
|
70
|
+
'agents.item': ' {id} {name} {status} [{level}] {files} config file(s)',
|
|
71
71
|
'agents.installed': '[installed]',
|
|
72
72
|
'agents.notInstalled': '[not found]',
|
|
73
73
|
'agents.experimental': 'experimental path — may need verification',
|
|
74
|
+
'agents.verification.confirmed': 'confirmed',
|
|
75
|
+
'agents.verification.documented': 'documented',
|
|
76
|
+
'agents.verification.experimental': 'experimental',
|
|
77
|
+
'agents.capabilities': ' capabilities: {caps}',
|
|
78
|
+
'agents.capability.mcp': 'MCP',
|
|
79
|
+
'agents.capability.instructions': 'instructions',
|
|
80
|
+
'agents.capability.rules': 'rules',
|
|
81
|
+
'agents.capability.skills': 'skills',
|
|
82
|
+
'agents.capability.agents': 'subagents',
|
|
83
|
+
'agents.capability.configs': 'configs',
|
|
74
84
|
'agents.note': ' {note}',
|
|
75
85
|
'agents.hint': 'Use `agentdock snapshot --agent <id>` / `agentdock doctor --agent <id>` for any tool above.',
|
|
76
86
|
'history.header': 'Snapshot history ({count}) in {dir}:',
|
|
@@ -178,10 +188,20 @@ const DICTIONARIES = {
|
|
|
178
188
|
'history.usage': '用法:agentdock history [--agent <工具id|all>] [--root <目录>]',
|
|
179
189
|
'agents.usage': '用法:agentdock agents [--root <目录>] [--json]',
|
|
180
190
|
'agents.header': '支持 {supported} 个 AI 编程工具;本机检测到 {installed} 个(root:{root})',
|
|
181
|
-
'agents.item': ' {id} {name} {status} {files} 个配置文件',
|
|
191
|
+
'agents.item': ' {id} {name} {status} [{level}] {files} 个配置文件',
|
|
182
192
|
'agents.installed': '[已安装]',
|
|
183
193
|
'agents.notInstalled': '[未找到]',
|
|
184
194
|
'agents.experimental': '实验性路径 —— 可能需实测确认',
|
|
195
|
+
'agents.verification.confirmed': '已实测',
|
|
196
|
+
'agents.verification.documented': '文档确认',
|
|
197
|
+
'agents.verification.experimental': '实验性',
|
|
198
|
+
'agents.capabilities': ' 能力:{caps}',
|
|
199
|
+
'agents.capability.mcp': 'MCP',
|
|
200
|
+
'agents.capability.instructions': '指令',
|
|
201
|
+
'agents.capability.rules': '规则',
|
|
202
|
+
'agents.capability.skills': '技能',
|
|
203
|
+
'agents.capability.agents': '子代理',
|
|
204
|
+
'agents.capability.configs': '配置',
|
|
185
205
|
'agents.note': ' {note}',
|
|
186
206
|
'agents.hint': '对以上任意工具可用 `agentdock snapshot --agent <工具id>` / `agentdock doctor --agent <工具id>`。',
|
|
187
207
|
'history.header': '快照时间线({count})位于 {dir}:',
|
|
@@ -151,7 +151,15 @@ async function scanAgentSemantic(root, profile, agentId) {
|
|
|
151
151
|
notes.push(`${source.relPath} 解析失败,跳过 MCP 提取`);
|
|
152
152
|
continue;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
let container = parsed?.[source.key];
|
|
155
|
+
let containerRef = source.key;
|
|
156
|
+
if (source.serversKey) {
|
|
157
|
+
const nested = container?.[source.serversKey];
|
|
158
|
+
if (nested && typeof nested === 'object' && !Array.isArray(nested)) {
|
|
159
|
+
container = nested;
|
|
160
|
+
containerRef = `${source.key}.${source.serversKey}`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
155
163
|
if (!container || typeof container !== 'object' || Array.isArray(container)) {
|
|
156
164
|
continue;
|
|
157
165
|
}
|
|
@@ -160,7 +168,7 @@ async function scanAgentSemantic(root, profile, agentId) {
|
|
|
160
168
|
id: `mcp-${name}`,
|
|
161
169
|
kind: 'mcp',
|
|
162
170
|
path: full,
|
|
163
|
-
ref: `${source.relPath}#${
|
|
171
|
+
ref: `${source.relPath}#${containerRef}.${name}`,
|
|
164
172
|
});
|
|
165
173
|
}
|
|
166
174
|
const count = Object.keys(container).length;
|
|
@@ -173,13 +181,41 @@ async function scanAgentSemantic(root, profile, agentId) {
|
|
|
173
181
|
await addSettings(config.relPath, config.kind);
|
|
174
182
|
}
|
|
175
183
|
// --- 目录型配置(profile / 补丁) ---
|
|
184
|
+
// 除整文件迁移外,也尝试从补丁文件里提取 MCP(DeepSeek Harness 的
|
|
185
|
+
// `.dsh/profiles/*/cordis.patch.yml` 可能携带 `mcp:` 定义)。
|
|
186
|
+
const profileMcpKeys = [...new Set((profile.mcp ?? []).map((source) => source.key))];
|
|
176
187
|
for (const dirRel of profile.configDirs ?? []) {
|
|
177
188
|
const dirFull = abs(root, dirRel);
|
|
178
189
|
const files = [];
|
|
179
190
|
await collectStructuredFiles(dirFull, 2, files);
|
|
180
191
|
for (const full of files) {
|
|
181
192
|
const rel = node_path_1.default.relative(root, full).split(node_path_1.default.sep).join('/');
|
|
182
|
-
|
|
193
|
+
const kind = (0, config_format_1.kindFromPath)(full);
|
|
194
|
+
await addSettings(rel, kind);
|
|
195
|
+
if (profileMcpKeys.length === 0) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
let parsed;
|
|
199
|
+
try {
|
|
200
|
+
parsed = (0, config_format_1.parseStructured)(kind, await promises_1.default.readFile(full, 'utf8'));
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
for (const key of profileMcpKeys) {
|
|
206
|
+
const container = parsed?.[key];
|
|
207
|
+
if (!container || typeof container !== 'object' || Array.isArray(container)) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
for (const name of Object.keys(container)) {
|
|
211
|
+
domain.mcp.push({
|
|
212
|
+
id: `mcp-${name}`,
|
|
213
|
+
kind: 'mcp',
|
|
214
|
+
path: full,
|
|
215
|
+
ref: `${rel}#${key}.${name}`,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
183
219
|
}
|
|
184
220
|
}
|
|
185
221
|
// --- 全局指令 ---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentdock-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Diagnose, migrate, and back up your AI coding environment — Claude Code, Codex, Gemini CLI, TRAE, Cursor/Grok Build, Cline, Windsurf, Copilot, OpenCode and more — with config snapshots, restore, and secret isolation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|