agentdock-cli 1.4.0 → 1.5.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 +11 -3
- package/dist/package.json +1 -1
- package/dist/src/agents/paths.js +25 -0
- package/dist/src/agents/registry.js +122 -61
- package/dist/src/agents/semantic.js +62 -11
- 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 +29 -1
- package/dist/src/scanners/sensitive.js +35 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -209,12 +209,20 @@ restore/
|
|
|
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 真实安装验证过。当前 10 款:Claude Code、Codex、Gemini CLI、Qwen Code、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,执行各自的 `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.5.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')],
|
|
@@ -111,11 +104,13 @@ exports.AGENT_ADAPTERS = [
|
|
|
111
104
|
id: 'grok-build',
|
|
112
105
|
aliases: ['cursor', 'grok', 'cursor-ide'],
|
|
113
106
|
displayName: 'Grok Build(原 Cursor)',
|
|
107
|
+
verification: 'confirmed',
|
|
108
|
+
docs: 'https://cursor.com/docs/context/mcp',
|
|
114
109
|
criticalKeys: ['mcpServers', 'model'],
|
|
115
110
|
mcpKeys: ['mcpServers'],
|
|
116
111
|
configFiles: () => [
|
|
117
112
|
json('.cursor/mcp.json'),
|
|
118
|
-
json(joinRel(vsCodeUser('Cursor'), 'settings.json')),
|
|
113
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Cursor'), 'settings.json')),
|
|
119
114
|
],
|
|
120
115
|
note: 'Cursor 已更名为 Grok Build;保留 ~/.cursor 旧目录与 Cursor 用户设置目录兼容。',
|
|
121
116
|
},
|
|
@@ -123,13 +118,15 @@ exports.AGENT_ADAPTERS = [
|
|
|
123
118
|
id: 'trae',
|
|
124
119
|
aliases: ['trae-cn', 'trae-ide'],
|
|
125
120
|
displayName: 'TRAE',
|
|
121
|
+
verification: 'confirmed',
|
|
122
|
+
docs: 'https://docs.trae.ai/ide/add-mcp-servers',
|
|
126
123
|
criticalKeys: ['model', 'mcp', 'mcpServers'],
|
|
127
124
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
128
125
|
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')),
|
|
126
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae CN'), 'settings.json')),
|
|
127
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae CN'), 'mcp.json')),
|
|
128
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae'), 'settings.json')),
|
|
129
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Trae'), 'mcp.json')),
|
|
133
130
|
],
|
|
134
131
|
note: '同时探测 Trae CN 与 Trae 两个用户数据目录。',
|
|
135
132
|
},
|
|
@@ -140,11 +137,11 @@ exports.AGENT_ADAPTERS = [
|
|
|
140
137
|
criticalKeys: ['model', 'mcpServers'],
|
|
141
138
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
142
139
|
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')),
|
|
140
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder'), 'settings.json')),
|
|
141
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder'), 'mcp.json')),
|
|
142
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder CN'), 'settings.json')),
|
|
143
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Qoder CN'), 'mcp.json')),
|
|
144
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/alibaba-cloud.tongyi-lingma/settings.json')),
|
|
148
145
|
],
|
|
149
146
|
experimental: true,
|
|
150
147
|
note: 'Qoder CN 已由通义灵码更名;同时探测 Qoder / Qoder CN 用户目录与 VS Code 的 alibaba-cloud.tongyi-lingma 扩展目录,部分路径仍待全平台实测。',
|
|
@@ -156,8 +153,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
156
153
|
criticalKeys: ['mcpServers'],
|
|
157
154
|
mcpKeys: ['mcpServers'],
|
|
158
155
|
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')),
|
|
156
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json')),
|
|
157
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json')),
|
|
161
158
|
],
|
|
162
159
|
},
|
|
163
160
|
{
|
|
@@ -172,12 +169,14 @@ exports.AGENT_ADAPTERS = [
|
|
|
172
169
|
id: 'copilot',
|
|
173
170
|
aliases: ['github-copilot', 'copilot-vscode'],
|
|
174
171
|
displayName: 'GitHub Copilot',
|
|
172
|
+
verification: 'confirmed',
|
|
173
|
+
docs: 'https://docs.github.com/en/copilot/customizing-copilot/extending-copilot-chat-with-mcp',
|
|
175
174
|
criticalKeys: ['mcp', 'mcpServers', 'github.copilot'],
|
|
176
175
|
mcpKeys: ['mcp', 'mcpServers'],
|
|
177
176
|
configFiles: () => [
|
|
178
|
-
json(joinRel(vsCodeUser('Code'), 'settings.json')),
|
|
179
|
-
json(joinRel(vsCodeUser('Code'), 'mcp.json')),
|
|
180
|
-
json(joinRel(vsCodeUser('Code - Insiders'), 'settings.json')),
|
|
177
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'settings.json')),
|
|
178
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'mcp.json')),
|
|
179
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'settings.json')),
|
|
181
180
|
json('.copilot/config.json'),
|
|
182
181
|
json('.copilot/settings.json'),
|
|
183
182
|
json('.copilot/mcp-config.json'),
|
|
@@ -191,9 +190,9 @@ exports.AGENT_ADAPTERS = [
|
|
|
191
190
|
criticalKeys: ['mcpServers'],
|
|
192
191
|
mcpKeys: ['mcpServers'],
|
|
193
192
|
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')),
|
|
193
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json')),
|
|
194
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json')),
|
|
195
|
+
yaml((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml')),
|
|
197
196
|
],
|
|
198
197
|
note: 'Cline 生态分支;项目级 .roorules 与 .roo/ 不在主目录快照内。',
|
|
199
198
|
},
|
|
@@ -204,9 +203,9 @@ exports.AGENT_ADAPTERS = [
|
|
|
204
203
|
criticalKeys: ['mcpServers'],
|
|
205
204
|
mcpKeys: ['mcpServers'],
|
|
206
205
|
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')),
|
|
206
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/kilocode.kilo-code/settings/mcp_settings.json')),
|
|
207
|
+
json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code - Insiders'), 'globalStorage/kilocode.kilo-code/settings/mcp_settings.json')),
|
|
208
|
+
yaml((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Code'), 'globalStorage/kilocode.kilo-code/settings/custom_modes.yaml')),
|
|
210
209
|
],
|
|
211
210
|
note: 'Roo / Cline 生态分支;项目级 .kilocoderules 不在主目录快照内。',
|
|
212
211
|
},
|
|
@@ -214,6 +213,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
214
213
|
id: 'continue',
|
|
215
214
|
aliases: ['continue-dev'],
|
|
216
215
|
displayName: 'Continue',
|
|
216
|
+
verification: 'confirmed',
|
|
217
|
+
docs: 'https://docs.continue.dev/customize/model-providers/more/mcp',
|
|
217
218
|
criticalKeys: ['models', 'model', 'mcpServers', 'context'],
|
|
218
219
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
219
220
|
configFiles: () => [
|
|
@@ -231,8 +232,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
231
232
|
mcpKeys: ['extensions'],
|
|
232
233
|
configFiles: () => (process.platform === 'win32'
|
|
233
234
|
? [
|
|
234
|
-
yaml(joinRel(appDataDir(), 'Block', 'goose', 'config', 'config.yaml')),
|
|
235
|
-
yaml(joinRel(appDataDir(), 'Block', 'goose', 'config', 'profiles.yaml')),
|
|
235
|
+
yaml((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Block', 'goose', 'config', 'config.yaml')),
|
|
236
|
+
yaml((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Block', 'goose', 'config', 'profiles.yaml')),
|
|
236
237
|
]
|
|
237
238
|
: [
|
|
238
239
|
yaml('.config/goose/config.yaml'),
|
|
@@ -244,6 +245,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
244
245
|
id: 'qwen',
|
|
245
246
|
aliases: ['qwen-code', 'qwen-cli'],
|
|
246
247
|
displayName: 'Qwen Code',
|
|
248
|
+
verification: 'confirmed',
|
|
249
|
+
docs: 'https://qwenlm.github.io/qwen-code-docs/en/users/features/mcp/',
|
|
247
250
|
criticalKeys: ['model', 'mcpServers', 'selectedAuthType'],
|
|
248
251
|
mcpKeys: ['mcpServers'],
|
|
249
252
|
configFiles: () => [json('.qwen/settings.json'), text('.qwen/QWEN.md')],
|
|
@@ -275,7 +278,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
275
278
|
mcpKeys: ['context_servers'],
|
|
276
279
|
configFiles: () => (process.platform === 'win32'
|
|
277
280
|
? [
|
|
278
|
-
json(joinRel(appDataDir(), 'Zed', 'settings.json')),
|
|
281
|
+
json((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Zed', 'settings.json')),
|
|
279
282
|
json('.config/zed/settings.json'),
|
|
280
283
|
]
|
|
281
284
|
: [json('.config/zed/settings.json')]),
|
|
@@ -296,7 +299,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
296
299
|
displayName: 'Claude Desktop',
|
|
297
300
|
criticalKeys: ['mcpServers'],
|
|
298
301
|
mcpKeys: ['mcpServers'],
|
|
299
|
-
configFiles: () => [json(joinRel(appDataDir(), 'Claude', 'claude_desktop_config.json'))],
|
|
302
|
+
configFiles: () => [json((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'Claude', 'claude_desktop_config.json'))],
|
|
300
303
|
note: 'MCP 宿主而非编码 CLI;常用于本机 MCP Server 备份。',
|
|
301
304
|
},
|
|
302
305
|
{
|
|
@@ -312,6 +315,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
312
315
|
id: 'codebuddy',
|
|
313
316
|
aliases: ['codebuddy-code', 'tencent-codebuddy'],
|
|
314
317
|
displayName: 'CodeBuddy(腾讯)',
|
|
318
|
+
verification: 'confirmed',
|
|
319
|
+
docs: 'https://www.codebuddy.ai/docs/zh/ide/User-guide/MCP',
|
|
315
320
|
criticalKeys: ['model', 'mcpServers', 'permissions'],
|
|
316
321
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
317
322
|
configFiles: () => [
|
|
@@ -329,11 +334,13 @@ exports.AGENT_ADAPTERS = [
|
|
|
329
334
|
criticalKeys: ['model', 'provider', 'providers'],
|
|
330
335
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
331
336
|
configFiles: () => [
|
|
337
|
+
toml('.kimi-code/config.toml'),
|
|
338
|
+
json('.kimi-code/mcp.json'),
|
|
332
339
|
toml('.kimi/config.toml'),
|
|
333
340
|
json('.kimi/config.json'),
|
|
334
|
-
json('.kimi
|
|
341
|
+
json('.kimi/mcp.json'),
|
|
335
342
|
],
|
|
336
|
-
note: '
|
|
343
|
+
note: '新版 Kimi Code CLI 使用 ~/.kimi-code/config.toml + mcp.json;旧版 kimi-cli 的 ~/.kimi 路径继续兼容。',
|
|
337
344
|
},
|
|
338
345
|
{
|
|
339
346
|
id: 'iflow',
|
|
@@ -341,8 +348,8 @@ exports.AGENT_ADAPTERS = [
|
|
|
341
348
|
displayName: 'iFlow CLI(心流)',
|
|
342
349
|
criticalKeys: ['modelName', 'apiKey', 'selectedAuthType'],
|
|
343
350
|
mcpKeys: ['mcpServers', 'mcp'],
|
|
344
|
-
configFiles: () => [json('.iflow/settings.json')],
|
|
345
|
-
note: '
|
|
351
|
+
configFiles: () => [json('.iflow/settings.json'), json('.iflow/mcp/config.json')],
|
|
352
|
+
note: '官方文档确认全局 MCP 在 ~/.iflow/mcp/config.json;~/.iflow/settings.json 继续兼容读取。',
|
|
346
353
|
},
|
|
347
354
|
{
|
|
348
355
|
id: 'junie',
|
|
@@ -370,7 +377,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
370
377
|
mcpKeys: ['amp.mcpServers'],
|
|
371
378
|
configFiles: () => (process.platform === 'win32'
|
|
372
379
|
? [
|
|
373
|
-
json(joinRel(appDataDir(), 'amp', 'settings.json')),
|
|
380
|
+
json((0, paths_1.joinRel)((0, paths_1.appDataDir)(), 'amp', 'settings.json')),
|
|
374
381
|
json('.config/amp/settings.json'),
|
|
375
382
|
jsonc('.config/amp/settings.jsonc'),
|
|
376
383
|
]
|
|
@@ -420,7 +427,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
420
427
|
displayName: 'Void',
|
|
421
428
|
criticalKeys: ['mcp', 'mcpServers'],
|
|
422
429
|
mcpKeys: ['mcp', 'mcpServers', 'context_servers'],
|
|
423
|
-
configFiles: () => [json(joinRel(vsCodeUser('Void'), 'settings.json'))],
|
|
430
|
+
configFiles: () => [json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('Void'), 'settings.json'))],
|
|
424
431
|
experimental: true,
|
|
425
432
|
note: 'VS Code 分支,按 Void/User/settings.json 探测;MCP 配置位置待实测。',
|
|
426
433
|
},
|
|
@@ -430,7 +437,7 @@ exports.AGENT_ADAPTERS = [
|
|
|
430
437
|
displayName: 'PearAI',
|
|
431
438
|
criticalKeys: ['mcp', 'mcpServers'],
|
|
432
439
|
mcpKeys: ['mcp', 'mcpServers'],
|
|
433
|
-
configFiles: () => [json(joinRel(vsCodeUser('PearAI'), 'settings.json'))],
|
|
440
|
+
configFiles: () => [json((0, paths_1.joinRel)((0, paths_1.vsCodeUser)('PearAI'), 'settings.json'))],
|
|
434
441
|
experimental: true,
|
|
435
442
|
note: 'VS Code 分支,按 PearAI/User/settings.json 探测;路径待实测。',
|
|
436
443
|
},
|
|
@@ -438,10 +445,15 @@ exports.AGENT_ADAPTERS = [
|
|
|
438
445
|
id: 'omp',
|
|
439
446
|
aliases: ['oh-my-pi', 'omp-agent'],
|
|
440
447
|
displayName: 'omp(oh-my-pi)',
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
448
|
+
docs: 'https://github.com/can1357/oh-my-pi',
|
|
449
|
+
criticalKeys: ['model', 'providers', 'mcpServers'],
|
|
450
|
+
mcpKeys: ['mcpServers', 'mcp'],
|
|
451
|
+
configFiles: () => [
|
|
452
|
+
yaml('.omp/agent/config.yml'),
|
|
453
|
+
yaml('.omp/agent/models.yml'),
|
|
454
|
+
json('.omp/agent/mcp.json'),
|
|
455
|
+
],
|
|
456
|
+
note: '用户级 MCP 在 ~/.omp/agent/mcp.json(mcpServers),设置与模型分别在 config.yml / models.yml;旧版 config.yml 内的 mcp 键仍兼容读取。',
|
|
445
457
|
},
|
|
446
458
|
{
|
|
447
459
|
id: 'deepseek-harness',
|
|
@@ -450,22 +462,67 @@ exports.AGENT_ADAPTERS = [
|
|
|
450
462
|
criticalKeys: ['model', 'providers', 'mcp'],
|
|
451
463
|
mcpKeys: ['mcp', 'mcpServers'],
|
|
452
464
|
configFiles: () => [yaml('.dsh/settings.yaml')],
|
|
453
|
-
note: 'profiles/*/cordis.patch.yml
|
|
465
|
+
note: 'profiles/*/cordis.patch.yml 自 v1.4 起按目录通配采集;profile 内的 MCP 以整文件合并迁移。',
|
|
454
466
|
},
|
|
455
467
|
{
|
|
456
468
|
id: 'pi',
|
|
457
469
|
aliases: ['pi-agent', 'pi-coding-agent'],
|
|
458
470
|
displayName: 'Pi',
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
471
|
+
verification: 'confirmed',
|
|
472
|
+
docs: 'https://docs.pi.dev/latest/configuration',
|
|
473
|
+
criticalKeys: ['model', 'mcpServers'],
|
|
474
|
+
mcpKeys: ['mcpServers'],
|
|
475
|
+
configFiles: () => [
|
|
476
|
+
json('.pi/agent/settings.json'),
|
|
477
|
+
json('.pi/agent/mcp.json'),
|
|
478
|
+
json('.pi/agent/models.json'),
|
|
479
|
+
],
|
|
480
|
+
note: '官方文档确认用户级目录 ~/.pi/agent:MCP 在 mcp.json(mcpServers),auth.json 含凭据不纳入迁移;PI_CODING_AGENT_DIR 可覆盖目录。',
|
|
464
481
|
},
|
|
465
482
|
];
|
|
483
|
+
/**
|
|
484
|
+
* `documented` 工具的官方来源。`confirmed` 工具在定义里单独声明,避免被这里覆盖。
|
|
485
|
+
* 只放稳定入口,不放容易失效的深层锚点。
|
|
486
|
+
*/
|
|
487
|
+
const AGENT_DOCS = {
|
|
488
|
+
antigravity: 'https://antigravity.google/docs',
|
|
489
|
+
opencode: 'https://opencode.ai/docs/',
|
|
490
|
+
qoder: 'https://docs.qoder.com/',
|
|
491
|
+
cline: 'https://docs.cline.bot/',
|
|
492
|
+
windsurf: 'https://docs.windsurf.com/',
|
|
493
|
+
'roo-code': 'https://docs.roocode.com/',
|
|
494
|
+
'kilo-code': 'https://kilocode.ai/docs',
|
|
495
|
+
goose: 'https://block.github.io/goose/',
|
|
496
|
+
qwen: 'https://github.com/QwenLM/qwen-code',
|
|
497
|
+
kiro: 'https://kiro.dev/docs/',
|
|
498
|
+
aider: 'https://aider.chat/docs/',
|
|
499
|
+
zed: 'https://zed.dev/docs',
|
|
500
|
+
crush: 'https://github.com/charmbracelet/crush',
|
|
501
|
+
'claude-desktop': 'https://modelcontextprotocol.io/docs/develop/connect-local-servers',
|
|
502
|
+
'lm-studio': 'https://lmstudio.ai/docs/',
|
|
503
|
+
kimi: 'https://www.kimi.com/code/docs/',
|
|
504
|
+
iflow: 'https://platform.iflow.cn/cli/configuration/settings',
|
|
505
|
+
junie: 'https://www.jetbrains.com/help/junie/',
|
|
506
|
+
'amazon-q': 'https://docs.aws.amazon.com/amazonq/',
|
|
507
|
+
amp: 'https://ampcode.com/manual',
|
|
508
|
+
'factory-droid': 'https://docs.factory.ai/',
|
|
509
|
+
warp: 'https://docs.warp.dev/',
|
|
510
|
+
comate: 'https://comate.baidu.com/',
|
|
511
|
+
gptme: 'https://gptme.org/docs/',
|
|
512
|
+
void: 'https://github.com/voideditor/void',
|
|
513
|
+
pearai: 'https://github.com/trypear/pearai-app',
|
|
514
|
+
'deepseek-harness': 'https://www.npmjs.com/package/@ai-thinker/deepseek-harness-cli',
|
|
515
|
+
};
|
|
516
|
+
for (const adapter of exports.AGENT_ADAPTERS) {
|
|
517
|
+
adapter.docs ??= AGENT_DOCS[adapter.id];
|
|
518
|
+
}
|
|
466
519
|
function listAgentAdapters() {
|
|
467
520
|
return exports.AGENT_ADAPTERS;
|
|
468
521
|
}
|
|
522
|
+
/** 路径可信度:显式声明优先,否则按 experimental 标记推导。 */
|
|
523
|
+
function agentVerification(adapter) {
|
|
524
|
+
return adapter.verification ?? (adapter.experimental === true ? 'experimental' : 'documented');
|
|
525
|
+
}
|
|
469
526
|
/** 按 id 或别名查找适配器(大小写不敏感)。 */
|
|
470
527
|
function resolveAgentAdapter(value) {
|
|
471
528
|
const needle = value.trim().toLowerCase();
|
|
@@ -525,14 +582,18 @@ function agentMcpKeys(agent) {
|
|
|
525
582
|
const adapter = resolveAgentAdapter(agent);
|
|
526
583
|
return adapter ? [...adapter.mcpKeys] : [];
|
|
527
584
|
}
|
|
528
|
-
/**
|
|
585
|
+
/** 主目录下是否存在该工具的任意配置文件 / 语义目录。 */
|
|
529
586
|
async function isAgentInstalled(root, agent) {
|
|
530
587
|
const adapter = resolveAgentAdapter(agent);
|
|
531
588
|
if (!adapter) {
|
|
532
589
|
return false;
|
|
533
590
|
}
|
|
534
|
-
|
|
535
|
-
|
|
591
|
+
const declared = new Set([
|
|
592
|
+
...adapter.configFiles().map((file) => file.relPath),
|
|
593
|
+
...(0, semantic_1.semanticPaths)((0, semantic_1.agentSemanticProfile)(adapter.id)),
|
|
594
|
+
]);
|
|
595
|
+
for (const relPath of declared) {
|
|
596
|
+
const abs = node_path_1.default.join(root, ...relPath.split('/'));
|
|
536
597
|
if (await (0, fs_1.pathExists)(abs)) {
|
|
537
598
|
return true;
|
|
538
599
|
}
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.AGENT_SEMANTICS = void 0;
|
|
23
23
|
exports.agentSemanticProfile = agentSemanticProfile;
|
|
24
|
-
|
|
24
|
+
exports.semanticPaths = semanticPaths;
|
|
25
|
+
const paths_1 = require("./paths");
|
|
25
26
|
function mcp(relPath, kind, key) {
|
|
26
27
|
return { relPath, kind, key };
|
|
27
28
|
}
|
|
@@ -29,11 +30,11 @@ 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 = {
|
|
@@ -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,60 @@ 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
|
+
],
|
|
226
|
+
ruleDirs: ['.pi/agent/prompts'],
|
|
227
|
+
skillDirs: ['.pi/agent/skills'],
|
|
204
228
|
},
|
|
205
229
|
};
|
|
206
230
|
function agentSemanticProfile(agentId) {
|
|
207
231
|
return exports.AGENT_SEMANTICS[agentId];
|
|
208
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* 语义层声明的全部文件 / 目录(相对主目录)。
|
|
235
|
+
* 用于安装检测:只有 skills/ 等目录存在时也应视为「本机有该工具」。
|
|
236
|
+
*/
|
|
237
|
+
function semanticPaths(profile) {
|
|
238
|
+
if (!profile) {
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
const paths = new Set();
|
|
242
|
+
for (const item of profile.mcp ?? [])
|
|
243
|
+
paths.add(item.relPath);
|
|
244
|
+
for (const item of profile.configs ?? [])
|
|
245
|
+
paths.add(item.relPath);
|
|
246
|
+
for (const item of profile.instructions ?? [])
|
|
247
|
+
paths.add(item.relPath);
|
|
248
|
+
for (const dir of profile.ruleDirs ?? [])
|
|
249
|
+
paths.add(dir);
|
|
250
|
+
for (const dir of profile.skillDirs ?? [])
|
|
251
|
+
paths.add(dir);
|
|
252
|
+
for (const dir of profile.agentDirs ?? [])
|
|
253
|
+
paths.add(dir);
|
|
254
|
+
for (const dir of profile.agentJsonDirs ?? [])
|
|
255
|
+
paths.add(dir);
|
|
256
|
+
for (const dir of profile.configDirs ?? [])
|
|
257
|
+
paths.add(dir);
|
|
258
|
+
return [...paths];
|
|
259
|
+
}
|
|
@@ -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}:',
|
|
@@ -173,13 +173,41 @@ async function scanAgentSemantic(root, profile, agentId) {
|
|
|
173
173
|
await addSettings(config.relPath, config.kind);
|
|
174
174
|
}
|
|
175
175
|
// --- 目录型配置(profile / 补丁) ---
|
|
176
|
+
// 除整文件迁移外,也尝试从补丁文件里提取 MCP(DeepSeek Harness 的
|
|
177
|
+
// `.dsh/profiles/*/cordis.patch.yml` 可能携带 `mcp:` 定义)。
|
|
178
|
+
const profileMcpKeys = [...new Set((profile.mcp ?? []).map((source) => source.key))];
|
|
176
179
|
for (const dirRel of profile.configDirs ?? []) {
|
|
177
180
|
const dirFull = abs(root, dirRel);
|
|
178
181
|
const files = [];
|
|
179
182
|
await collectStructuredFiles(dirFull, 2, files);
|
|
180
183
|
for (const full of files) {
|
|
181
184
|
const rel = node_path_1.default.relative(root, full).split(node_path_1.default.sep).join('/');
|
|
182
|
-
|
|
185
|
+
const kind = (0, config_format_1.kindFromPath)(full);
|
|
186
|
+
await addSettings(rel, kind);
|
|
187
|
+
if (profileMcpKeys.length === 0) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
let parsed;
|
|
191
|
+
try {
|
|
192
|
+
parsed = (0, config_format_1.parseStructured)(kind, await promises_1.default.readFile(full, 'utf8'));
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
for (const key of profileMcpKeys) {
|
|
198
|
+
const container = parsed?.[key];
|
|
199
|
+
if (!container || typeof container !== 'object' || Array.isArray(container)) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
for (const name of Object.keys(container)) {
|
|
203
|
+
domain.mcp.push({
|
|
204
|
+
id: `mcp-${name}`,
|
|
205
|
+
kind: 'mcp',
|
|
206
|
+
path: full,
|
|
207
|
+
ref: `${rel}#${key}.${name}`,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
183
211
|
}
|
|
184
212
|
}
|
|
185
213
|
// --- 全局指令 ---
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.isSecretKey = isSecretKey;
|
|
13
13
|
exports.looksLikeSecret = looksLikeSecret;
|
|
14
|
+
exports.isSensitiveEntry = isSensitiveEntry;
|
|
14
15
|
exports.findSecretLeaks = findSecretLeaks;
|
|
15
16
|
exports.maskSecret = maskSecret;
|
|
16
17
|
exports.createSecretKeyRegistry = createSecretKeyRegistry;
|
|
@@ -42,6 +43,38 @@ function looksLikeSecret(value) {
|
|
|
42
43
|
}
|
|
43
44
|
return SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(value));
|
|
44
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* 纯数字 / 布尔 / 空值:这类值来自配置项(如 `CLAUDE_CODE_MAX_CONTEXT_TOKENS=32000`),
|
|
48
|
+
* 即使键名包含 token 也不应视为机密。真实令牌几乎不会只由数字组成。
|
|
49
|
+
*/
|
|
50
|
+
function isNonSecretScalar(value) {
|
|
51
|
+
const trimmed = value.trim();
|
|
52
|
+
if (trimmed === '') {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (/^[+-]?\d+(?:\.\d+)?$/.test(trimmed)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return /^(true|false|null|none|undefined)$/i.test(trimmed);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 判定一个键值对是否应按机密处理:
|
|
62
|
+
* 1. 值本身匹配已知令牌形状 → 是;
|
|
63
|
+
* 2. 键名像凭据,且值不是纯数字 / 布尔等配置标量 → 是;
|
|
64
|
+
* 3. 其余 → 否。
|
|
65
|
+
*/
|
|
66
|
+
function isSensitiveEntry(name, value) {
|
|
67
|
+
if (looksLikeSecret(value)) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
if (!isSecretKey(name)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
return !isNonSecretScalar(value);
|
|
75
|
+
}
|
|
76
|
+
return typeof value === 'object' && value !== null;
|
|
77
|
+
}
|
|
45
78
|
/**
|
|
46
79
|
* Scan arbitrary text (e.g. a free-text skill/agent/memory file) for leaked
|
|
47
80
|
* secret tokens. Tokenizes on whitespace and common delimiters, then tests each
|
|
@@ -137,7 +170,7 @@ function collectSecrets(node, basePath, accumulator, seen = new WeakSet()) {
|
|
|
137
170
|
for (const [key, value] of Object.entries(node)) {
|
|
138
171
|
const childPath = `${basePath}.${key}`;
|
|
139
172
|
if (typeof value === 'string') {
|
|
140
|
-
if (
|
|
173
|
+
if (isSensitiveEntry(key, value)) {
|
|
141
174
|
accumulator.push({ key, value, jsonPath: childPath });
|
|
142
175
|
}
|
|
143
176
|
}
|
|
@@ -188,7 +221,7 @@ function maskSecretsInPlace(node, basePath, agent, secretsEnv, seen = new WeakSe
|
|
|
188
221
|
for (const [key, value] of Object.entries(node)) {
|
|
189
222
|
const childPath = `${basePath}.${key}`;
|
|
190
223
|
if (typeof value === 'string') {
|
|
191
|
-
if (
|
|
224
|
+
if (isSensitiveEntry(key, value)) {
|
|
192
225
|
const keyName = allocateSecretKey(registry, secretKeyName(agent, childPath), value);
|
|
193
226
|
node[key] =
|
|
194
227
|
secretsEnv && secretsEnv[keyName] !== undefined ? secretsEnv[keyName] : `{{${keyName}}}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentdock-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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",
|