hongcoding commited on
Commit
30b24ad
·
verified ·
1 Parent(s): 9a48a7d

feat: INTEGRATION.md per-app guide, VS Code panel buttons wired + one-click install button, DSH install route

Browse files
INTEGRATION.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 各软件接入指南
2
+
3
+ AgentLens 支持 7 个 AI 编程工具。每个工具的接入方式不同,下面逐个说明。
4
+
5
+ > 通用前提:如果 App 没反应,**完全退出再重开**(Mac:`Cmd+Q`,不是关窗口)。MCP 配置和 Skill 都是启动时加载的。
6
+
7
+ ---
8
+
9
+ ## 1. Claude Code
10
+
11
+ **接入方式**:MCP 工具 + Skill
12
+
13
+ **自动接入**:
14
+
15
+ ```bash
16
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target claude
17
+ ```
18
+
19
+ **接入后**:
20
+ - 配置文件:`~/.claude/settings.json` 的 `mcpServers.agentlens`
21
+ - Skill:`~/.claude/skills/agentlens/SKILL.md`
22
+
23
+ **怎么用**:
24
+ 1. 重启 Claude Code
25
+ 2. 在对话里说:「用 agentlens 扫描当前项目」,或输入 `/agentlens`
26
+ 3. Claude 会调用 `agentlens_scan` 等工具,返回结果
27
+
28
+ **验证**:输入 `/mcp` 查看 agentlens 是否已连接。
29
+
30
+ ---
31
+
32
+ ## 2. Cursor
33
+
34
+ **接入方式**:VS Code 扩展(图形面板)+ MCP 工具
35
+
36
+ **图形界面接入(推荐)**:
37
+ 1. 双击 `ext/vscode/agentlens-0.2.0.vsix` 安装
38
+ 2. 重启 Cursor
39
+ 3. `Cmd+Shift+P` 输入 `AgentLens` → 选择「打开设置面板」
40
+ 4. 面板里有按钮:扫描配置 / 迁移规则 / 检测漂移 / 体检文件 / 一键接入所有 App
41
+
42
+ **MCP 接入**:
43
+
44
+ ```bash
45
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target cursor
46
+ ```
47
+
48
+ 写入 `.cursor/mcp.json`。
49
+
50
+ **怎么用**:重启 Cursor 后,对话里直接说「用 agentlens 扫描项目」,或在面板里点按钮。
51
+
52
+ ---
53
+
54
+ ## 3. Codex
55
+
56
+ **接入方式**:MCP 工具 + Skill
57
+
58
+ ```bash
59
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target codex
60
+ ```
61
+
62
+ **接入后**:
63
+ - MCP:`.mcp.json`(项目级)
64
+ - Skill:`~/.codex/skills/agentlens/SKILL.md`
65
+
66
+ **怎么用**:重启 Codex,对话里说「用 agentlens 扫描」,或输入 `/agentlens`。
67
+
68
+ ---
69
+
70
+ ## 4. ZCode
71
+
72
+ **接入方式**:MCP 工具 + Skill
73
+
74
+ ```bash
75
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target zcode
76
+ ```
77
+
78
+ **接入后**:
79
+ - MCP:`~/.zcode/mcp.json` 的 `mcpServers.agentlens`
80
+ - Skill:`~/.zcode/skills/agentlens/SKILL.md`
81
+
82
+ **怎么用**:重启 ZCode,对话里说「用 agentlens 扫描」或输入 `/agentlens`。
83
+
84
+ ---
85
+
86
+ ## 5. WorkBuddy
87
+
88
+ **接入方式**:MCP 工具 + Skill
89
+
90
+ ```bash
91
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target workbuddy
92
+ ```
93
+
94
+ **接入后**:
95
+ - MCP:`~/.workbuddy/mcp.json` 的 `mcpServers.agentlens`
96
+ - Skill:`~/.workbuddy/skills/agentlens/SKILL.md`
97
+
98
+ **怎么用**:重启 WorkBuddy,在设置 → MCP 里能看到 agentlens;对话中说「用 agentlens 扫描」或 `/agentlens`。
99
+
100
+ ---
101
+
102
+ ## 6. MiMo Desktop
103
+
104
+ **接入方式**:MCP 工具 + Skill(该 App 未开放输入区 UI 插件接口,无法加自定义按钮)
105
+
106
+ ```bash
107
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target mimo
108
+ ```
109
+
110
+ **接入后**:
111
+ - MCP:`~/.config/mimocode/mimocode.jsonc` 的 `mcp.agentlens`
112
+ - Skill:`~/.agents/skills/agentlens/SKILL.md`
113
+
114
+ **怎么用**:
115
+ 1. 重启 MiMo Desktop
116
+ 2. 设置 → MCP 里能看到 agentlens
117
+ 3. 对话里说「用 agentlens 扫描项目」,或输入 `/agentlens`
118
+
119
+ **关于「完全访问」旁的按钮**:MiMo Desktop 的渲染层没有给第三方开放 UI 插件接口(没有 slot / ModuleLoader 机制),所以无法在「完全访问」旁加按钮。最接近的替代是 `/agentlens` 斜杠命令(输入框敲 `/` 就出现)。
120
+
121
+ ---
122
+
123
+ ## 7. DSH(DeepSeek Harness)
124
+
125
+ **接入方式**:客户端插件(输入区按钮 + 设置页面板)+ Host 工具
126
+
127
+ **接入**:
128
+ 1. 插件已复制到 `~/DSH-Plugins/agentlens/`
129
+ 2. 已注册到 `~/.dsh/profiles/desktop/package.json`(dependency + bundles)
130
+ 3. **⌘Q 完全退出 DSH,重新打开**
131
+
132
+ **接入后**:
133
+ - **输入区**:「完全访问」旁边多一个「🩺 体检」按钮 → 点击扫描当前项目,弹窗显示结果
134
+ - **设置页**:新增「AgentLens 迁移」区块 → 路径选择 + 扫描 + 源/目标 Agent 迁移 + 一键接入所有 App
135
+
136
+ **怎么用**:点「🩺 体检」按钮,或进设置页用迁移面板。
137
+
138
+ ---
139
+
140
+ ## 各 App 对比
141
+
142
+ | App | MCP | Skill | 图形按钮/面板 |
143
+ |---|---|---|---|
144
+ | Claude Code | ✅ | ✅ `/agentlens` | — |
145
+ | Cursor | ✅ | — | ✅ VS Code 扩展面板 |
146
+ | Codex | ✅ | ✅ `/agentlens` | — |
147
+ | ZCode | ✅ | ✅ `/agentlens` | — |
148
+ | WorkBuddy | ✅ | ✅ `/agentlens` | — |
149
+ | MiMo Desktop | ✅ | ✅ `/agentlens` | —(产品未开放 UI 接口) |
150
+ | DSH | ✅ | — | ✅ 输入区「体检」按钮 + 设置「迁移」面板 |
151
+
152
+ ## 不需要任何 App 的用法
153
+
154
+ ```bash
155
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js scan --path ~/项目
156
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js move --from cursor --to claude --path ~/项目
157
+ node ~/Downloads/mimo/agentlens/dist/cli/index.js check src/index.js --path ~/项目
158
+ ```
README.md CHANGED
@@ -111,6 +111,8 @@ node ~/Downloads/mimo/agentlens/dist/cli/index.js move --from cursor --to claude
111
  node ~/Downloads/mimo/agentlens/dist/cli/index.js check src/index.js --path ~/你的项目
112
  ```
113
 
 
 
114
  ### 各 App 接入后长什么样
115
 
116
  | App | 接入后你会看到什么 | 怎么触发 |
 
111
  node ~/Downloads/mimo/agentlens/dist/cli/index.js check src/index.js --path ~/你的项目
112
  ```
113
 
114
+ ### 各软件接入指南(详细版见 [INTEGRATION.md](INTEGRATION.md))
115
+
116
  ### 各 App 接入后长什么样
117
 
118
  | App | 接入后你会看到什么 | 怎么触发 |
ext/dsh-plugin/client.js CHANGED
@@ -69,6 +69,13 @@ window.__ModuleLoader__.load({
69
  return String(d.text || '');
70
  }
71
 
 
 
 
 
 
 
 
72
  async function callMigrate(path, from, to) {
73
  const r = await fetch('/agentlens/migrate', {
74
  method: 'POST',
@@ -228,6 +235,26 @@ window.__ModuleLoader__.load({
228
  'button',
229
  { type: 'button', disabled: busy !== '' || from === to, onClick: doMigrate },
230
  busy === 'migrate' ? '迁移中…' : '开始迁移'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  )
232
  ),
233
  error ? h('p', { className: 'agentlens-hint', style: { color: '#ff8a80' } }, `出错了:${error}`) : null,
 
69
  return String(d.text || '');
70
  }
71
 
72
+ async function callInstall() {
73
+ const r = await fetch('/agentlens/install', { method: 'POST', credentials: 'same-origin' });
74
+ const d = await r.json();
75
+ if (!r.ok || d.ok === false) throw new Error(d.error || `HTTP ${r.status}`);
76
+ return String(d.text || '');
77
+ }
78
+
79
  async function callMigrate(path, from, to) {
80
  const r = await fetch('/agentlens/migrate', {
81
  method: 'POST',
 
235
  'button',
236
  { type: 'button', disabled: busy !== '' || from === to, onClick: doMigrate },
237
  busy === 'migrate' ? '迁移中…' : '开始迁移'
238
+ ),
239
+ h(
240
+ 'button',
241
+ {
242
+ type: 'button',
243
+ disabled: busy !== '',
244
+ title: '把 AgentLens 接入本机所有检测到的 AI 工具(相当于跑一次 agentlens install)',
245
+ onClick: async () => {
246
+ setBusy('install');
247
+ setError('');
248
+ try {
249
+ setOut(await callInstall());
250
+ } catch (err) {
251
+ setError(String((err && err.message) || err));
252
+ } finally {
253
+ setBusy('');
254
+ }
255
+ },
256
+ },
257
+ busy === 'install' ? '接入中…' : '一键接入所有 App'
258
  )
259
  ),
260
  error ? h('p', { className: 'agentlens-hint', style: { color: '#ff8a80' } }, `出错了:${error}`) : null,
ext/dsh-plugin/index.js CHANGED
@@ -100,8 +100,21 @@ function mountRoutes(server, entry, fallbackCwd) {
100
  },
101
  };
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  const disposers = [];
104
- for (const route of [scanRoute, migrateRoute]) {
105
  try {
106
  disposers.push(server.register(route));
107
  } catch (error) {
 
100
  },
101
  };
102
 
103
+ const installRoute = {
104
+ kind: "exact",
105
+ path: "/agentlens/install",
106
+ async handler(req, res) {
107
+ try {
108
+ const text = await runAgentlens(entry, ["install", "--target", "all"], process.cwd());
109
+ json(res, 200, { ok: true, text });
110
+ } catch (error) {
111
+ json(res, 500, { ok: false, error: String((error && error.message) || error) });
112
+ }
113
+ },
114
+ };
115
+
116
  const disposers = [];
117
+ for (const route of [scanRoute, migrateRoute, installRoute]) {
118
  try {
119
  disposers.push(server.register(route));
120
  } catch (error) {
ext/vscode/agentlens-0.2.0.vsix ADDED
Binary file (33.1 kB). View file
 
ext/vscode/src/extension.ts CHANGED
@@ -1,6 +1,7 @@
1
  import * as vscode from "vscode";
2
  import { readFileSync, existsSync, readdirSync, statSync, mkdirSync, writeFileSync } from "node:fs";
3
  import { resolve, join, dirname } from "node:path";
 
4
  import {
5
  parsers,
6
  generateConfig,
@@ -268,12 +269,63 @@ export function activate(context: vscode.ExtensionContext) {
268
  );
269
  panel.onDidDispose(() => { panel = undefined; });
270
  panel.webview.html = getPanelHtml();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  const root = getWorkspaceRoot();
272
  if (root) updatePanelContent(root);
273
  }
274
  })
275
  );
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  // === Auto check on save (if enabled) ===
278
  context.subscriptions.push(
279
  vscode.workspace.onDidSaveTextDocument(async (doc) => {
@@ -324,6 +376,7 @@ function getPanelHtml(): string {
324
  <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'move'});})()">迁移规则</button>
325
  <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'drift'});})()">检测漂移</button>
326
  <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'check'});})()">体检文件</button>
 
327
  </div>
328
  <div id="results"><p class="empty">点击「扫描配置」开始</p></div>
329
  <script>
 
1
  import * as vscode from "vscode";
2
  import { readFileSync, existsSync, readdirSync, statSync, mkdirSync, writeFileSync } from "node:fs";
3
  import { resolve, join, dirname } from "node:path";
4
+ import { homedir } from "node:os";
5
  import {
6
  parsers,
7
  generateConfig,
 
269
  );
270
  panel.onDidDispose(() => { panel = undefined; });
271
  panel.webview.html = getPanelHtml();
272
+
273
+ // Wire the panel buttons to real commands — without this the buttons do nothing.
274
+ panel.webview.onDidReceiveMessage(async (msg) => {
275
+ switch (msg?.command) {
276
+ case "scan":
277
+ await vscode.commands.executeCommand("agentlens.scan");
278
+ break;
279
+ case "move":
280
+ await vscode.commands.executeCommand("agentlens.move");
281
+ break;
282
+ case "drift":
283
+ await vscode.commands.executeCommand("agentlens.drift");
284
+ break;
285
+ case "check":
286
+ await vscode.commands.executeCommand("agentlens.checkFile");
287
+ break;
288
+ case "install":
289
+ await vscode.commands.executeCommand("agentlens.installAll");
290
+ break;
291
+ default:
292
+ break;
293
+ }
294
+ });
295
+
296
  const root = getWorkspaceRoot();
297
  if (root) updatePanelContent(root);
298
  }
299
  })
300
  );
301
 
302
+ // === One-click install into every detected AI app ===
303
+ context.subscriptions.push(
304
+ vscode.commands.registerCommand("agentlens.installAll", async () => {
305
+ const { execFile } = await import("node:child_process");
306
+ const { promisify } = await import("node:util");
307
+ const execFileAsync = promisify(execFile);
308
+ const entry = (context as any).extensionPath
309
+ ? resolve((context as any).extensionPath, "agentlens-cli", "index.js")
310
+ : undefined;
311
+ const cli = entry && existsSync(entry) ? entry : join(homedir(), "Downloads", "mimo", "agentlens", "dist", "cli", "index.js");
312
+ if (!existsSync(cli)) {
313
+ vscode.window.showWarningMessage("AgentLens: 找不到安装器入口(需要先构建 agentlens 项目)");
314
+ return;
315
+ }
316
+ try {
317
+ const { stdout, stderr } = await execFileAsync(process.execPath, [cli, "install", "--target", "all"], { timeout: 120_000 });
318
+ outputChannel.clear();
319
+ outputChannel.appendLine(stdout || "");
320
+ if (stderr) outputChannel.appendLine(stderr);
321
+ outputChannel.show();
322
+ vscode.window.showInformationMessage("AgentLens: 已接入所有检测到的 AI 工具(重启对应 App 生效)");
323
+ } catch (err: any) {
324
+ vscode.window.showErrorMessage(`AgentLens 接入失败: ${err?.message ?? err}`);
325
+ }
326
+ })
327
+ );
328
+
329
  // === Auto check on save (if enabled) ===
330
  context.subscriptions.push(
331
  vscode.workspace.onDidSaveTextDocument(async (doc) => {
 
376
  <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'move'});})()">迁移规则</button>
377
  <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'drift'});})()">检测漂移</button>
378
  <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'check'});})()">体检文件</button>
379
+ <button class="btn" onclick="(function(){const v=acquireVsCodeApi();v.postMessage({command:'install'});})()">一键接入所有 App</button>
380
  </div>
381
  <div id="results"><p class="empty">点击「扫描配置」开始</p></div>
382
  <script>