@agentguardx/helper 0.3.90 → 0.3.91
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/lib/wizard.cjs +16 -8
- package/package.json +7 -7
package/lib/wizard.cjs
CHANGED
|
@@ -91,19 +91,22 @@ function config(server) {
|
|
|
91
91
|
request.on('timeout', () => request.destroy()); request.on('error', () => reject(new Error('server_config_unavailable')));
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function supportedTools() {
|
|
95
95
|
const home = os.homedir(), windows = process.platform === 'win32';
|
|
96
96
|
const command = name => (process.env.PATH || '').split(path.delimiter).some(dir => (windows ? ['', '.exe', '.cmd', '.bat'] : ['']).some(ext => {
|
|
97
97
|
try { const file = path.join(dir, name + ext); return fs.statSync(file).isFile() && (windows || (fs.accessSync(file, fs.constants.X_OK), true)); } catch { return false; }
|
|
98
98
|
}));
|
|
99
99
|
const apps = (mac, win) => process.platform === 'darwin' ? ['/Applications', path.join(home, 'Applications')].some(dir => fs.existsSync(path.join(dir, mac))) : windows && !!process.env.LOCALAPPDATA && fs.existsSync(path.join(process.env.LOCALAPPDATA, win));
|
|
100
100
|
return [
|
|
101
|
-
{ label: 'OpenCode(模型与远程 MCP)', value: 'opencode', present: command('opencode') },
|
|
102
|
-
{ label: 'OpenClaw(模型)', value: 'openclaw', present: command('openclaw') },
|
|
103
|
-
{ label: 'Cursor(远程 MCP)', value: 'cursor', present: command('cursor') || apps('Cursor.app', 'Programs/Cursor/Cursor.exe') },
|
|
104
|
-
{ label: 'Claude Desktop(MCP 桥接)', value: 'claude-desktop', present: command('claude-desktop') || apps('Claude.app', 'AnthropicClaude/Claude.exe') },
|
|
105
|
-
{ label: 'Cherry Studio(手动填写说明)', value: 'cherry-studio', present: apps('Cherry Studio.app', 'Programs/Cherry Studio/Cherry Studio.exe') },
|
|
106
|
-
]
|
|
101
|
+
{ label: 'OpenCode(模型与远程 MCP)', value: 'opencode', present: command('opencode'), install: 'npm i -g opencode-ai' },
|
|
102
|
+
{ label: 'OpenClaw(模型)', value: 'openclaw', present: command('openclaw'), install: '按 OpenClaw 官方说明安装' },
|
|
103
|
+
{ label: 'Cursor(远程 MCP)', value: 'cursor', present: command('cursor') || apps('Cursor.app', 'Programs/Cursor/Cursor.exe'), install: '从 cursor.com 下载安装' },
|
|
104
|
+
{ label: 'Claude Desktop(MCP 桥接)', value: 'claude-desktop', present: command('claude-desktop') || apps('Claude.app', 'AnthropicClaude/Claude.exe'), install: '从 claude.ai/download 下载安装' },
|
|
105
|
+
{ label: 'Cherry Studio(手动填写说明)', value: 'cherry-studio', present: apps('Cherry Studio.app', 'Programs/Cherry Studio/Cherry Studio.exe'), install: '从 cherry-ai.com 下载安装' },
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
function detectedTools() {
|
|
109
|
+
return supportedTools().filter(item => item.present);
|
|
107
110
|
}
|
|
108
111
|
async function currentServer(runtime, prefix, flagServer) {
|
|
109
112
|
// Priority --server > AGENTGUARD_SERVER > saved configuration is resolved by the Go core.
|
|
@@ -194,7 +197,12 @@ async function init(runtime, args) {
|
|
|
194
197
|
} else code = await run(runtime, [...prefix, 'login', '--server', server, ...httpFlags, '--defer-notice'], '');
|
|
195
198
|
if (code) { process.exitCode = code; return; }
|
|
196
199
|
const tools = detectedTools();
|
|
197
|
-
|
|
200
|
+
const missing = supportedTools().filter(item => !item.present);
|
|
201
|
+
if (missing.length) {
|
|
202
|
+
process.stdout.write('以下支持的工具在本机未检测到,安装后运行 npx @agentguardx/helper connect <工具名> 接入:\n');
|
|
203
|
+
for (const item of missing) process.stdout.write(` - ${item.label}:${item.install}(工具名 ${item.value})\n`);
|
|
204
|
+
}
|
|
205
|
+
if (!tools.length) process.stdout.write('本机暂未检测到支持的工具。\n');
|
|
198
206
|
else {
|
|
199
207
|
const selected = await choose(ask, '选择要接入的已检测工具', tools, true);
|
|
200
208
|
for (const tool of selected) { code = await run(runtime, [...prefix, 'connect', tool], ''); if (code) { process.exitCode = code; return; } }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentguardx/helper",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.91",
|
|
4
4
|
"description": "AgentGuard \u5458\u5de5\u63a5\u5165\u52a9\u624b",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"engines": {
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"preuninstall": "node lib/preuninstall.cjs"
|
|
20
20
|
},
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@agentguardx/helper-darwin-x64": "0.3.
|
|
23
|
-
"@agentguardx/helper-darwin-arm64": "0.3.
|
|
24
|
-
"@agentguardx/helper-linux-x64": "0.3.
|
|
25
|
-
"@agentguardx/helper-linux-arm64": "0.3.
|
|
26
|
-
"@agentguardx/helper-win32-x64": "0.3.
|
|
27
|
-
"@agentguardx/helper-win32-arm64": "0.3.
|
|
22
|
+
"@agentguardx/helper-darwin-x64": "0.3.91",
|
|
23
|
+
"@agentguardx/helper-darwin-arm64": "0.3.91",
|
|
24
|
+
"@agentguardx/helper-linux-x64": "0.3.91",
|
|
25
|
+
"@agentguardx/helper-linux-arm64": "0.3.91",
|
|
26
|
+
"@agentguardx/helper-win32-x64": "0.3.91",
|
|
27
|
+
"@agentguardx/helper-win32-arm64": "0.3.91"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|