feat: full 6-app integration — DSH client UI (composer chip + settings panel), skills for Claude Code/Codex/ZCode/WorkBuddy/MiMo, updated installer
Browse filesFiles changed (6)
- README.md+11-12
- ext/dsh-plugin/client.jsAdded+268
- ext/dsh-plugin/index.js+113-23
- ext/dsh-plugin/package.json+9-3
- ext/skill/SKILL.mdAdded+47
- src/cli/commands/install.ts+33-1
52 unmodified lines53545556575859606162636465666768697052 unmodified lines### 支持矩阵| Agent | 配置文件 ||---|---|| Claude Code | `CLAUDE.md`、`.claude/rules/*.md`、`~/.claude/settings.json` (MCP) || Cursor | `.cursor/rules/*.mdc`、`.cursor/mcp.json` (MCP) || Codex | `AGENTS.md`、`.mcp.json` (MCP) || ZCode | `~/.zcode/mcp.json` (MCP) || WorkBuddy | `~/.workbuddy/mcp.json` (MCP) || MiMo Desktop | `~/.config/mimocode/mimocode.jsonc` (mcp 配置) || Windsurf | `.windsurfrules` || GitHub Copilot | `.github/copilot-instructions.md` |另有 VS Code / Cursor 扩展(`.vsix`)和 DSH 插件(cordis),见仓库 `ext/` 目录。## 安装52 unmodified lines535455565758596061626364656667686952 unmodified lines### 支持矩阵| Agent | 集成方式 | MCP 配置 | Skill ||---|---|---|---|| Claude Code | MCP + Skill | `~/.claude/settings.json` | `~/.claude/skills/agentlens` || Cursor | VS Code 扩展 (.vsix) + MCP | `.cursor/mcp.json` | — || Codex | MCP + Skill | `.mcp.json` | `~/.codex/skills/agentlens` || ZCode | MCP + Skill | `~/.zcode/mcp.json` | `~/.zcode/skills/agentlens` || WorkBuddy | MCP + Skill | `~/.workbuddy/mcp.json` | `~/.workbuddy/skills/agentlens` || MiMo Desktop | MCP + Skill | `~/.config/mimocode/mimocode.jsonc` | `~/.agents/skills/agentlens` || DSH | 客户端插件(输入区「体检」按钮 + 设置页「AgentLens 迁移」面板)+ Host 工具 | `~/.dsh/profiles/desktop/package.json` | — || Windsurf | 规则文件 | `.windsurfrules` | — || GitHub Copilot | 规则文件 | `.github/copilot-instructions.md` | — |## 安装
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268/** * @local/agentlens — Client half. * * Two surfaces: * 1. A compact "体检" chip in the composer tool row * (`conversation.input.left` list slot — rendered right after the * permission control 完全访问 and the plan seat). Clicking it scans the * current project and shows the agent-config summary in a small popover. * 2. An "AgentLens 迁移" section in Settings (`settings.section` slot) with * a path picker, a scan shortcut, and one-click rule migration between * agent formats (claude / cursor / codex / windsurf / copilot). * * All data flows through the host's local HTTP routes (/agentlens/*), which * shell out to the AgentLens CLI. Nothing leaves the machine. */window.__ModuleLoader__.load({ id: '@local/agentlens', factory(require) { const React = require('react'); const h = React.createElement; const { useCallback, useEffect, useRef, useState } = React;
const STYLE_ID = 'agentlens-client-style'; const STYLE_TEXT = `.agentlens-chip{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:14px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);color:inherit;font:inherit;font-size:12px;line-height:1;cursor:pointer;white-space:nowrap;transition:background .15s ease,border-color .15s ease}.agentlens-chip:hover{background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.24)}.agentlens-chip:disabled{opacity:.5;cursor:default}.agentlens-pop{position:absolute;bottom:calc(100% + 8px);left:0;z-index:60;width:min(560px,80vw);max-height:50vh;overflow:auto;padding:12px 14px;border-radius:12px;border:1px solid rgba(255,255,255,.16);background:rgba(24,27,34,.98);color:#e8eaf0;font:12px/1.55 ui-monospace,Menlo,Consolas,monospace;white-space:pre-wrap;box-shadow:0 12px 40px rgba(0,0,0,.45)}.agentlens-pop-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-family:-apple-system,'PingFang SC',sans-serif;font-weight:600}.agentlens-pop-close{border:0;background:transparent;color:#9aa3b2;cursor:pointer;font-size:14px;padding:2px 6px;border-radius:6px}.agentlens-pop-close:hover{background:rgba(255,255,255,.1);color:#fff}.agentlens-anchor{position:relative;display:inline-flex}.agentlens-panel{display:grid;gap:14px;max-width:720px}.agentlens-panel h3{margin:0;font-size:15px}.agentlens-panel .row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.agentlens-panel input,.agentlens-panel select{padding:6px 9px;border-radius:8px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.06);color:inherit;font:inherit;font-size:13px}.agentlens-panel input[type=text]{flex:1 1 260px}.agentlens-panel button{padding:6px 14px;border-radius:8px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.08);color:inherit;font:inherit;font-size:13px;cursor:pointer}.agentlens-panel button:hover{background:rgba(255,255,255,.14)}.agentlens-panel button:disabled{opacity:.5;cursor:default}.agentlens-out{margin:0;padding:10px 12px;border-radius:10px;background:rgba(0,0,0,.35);border:1px solid rgba(255,255,255,.1);font:12px/1.55 ui-monospace,Menlo,Consolas,monospace;white-space:pre-wrap;max-height:320px;overflow:auto}.agentlens-hint{margin:0;font-size:12px;opacity:.65}`;
const AGENTS = ['claude', 'cursor', 'codex', 'windsurf', 'copilot'];
function rememberedPath() { try { return localStorage.getItem('agentlens.path') || ''; } catch { return ''; } }
function rememberPath(value) { try { if (value) localStorage.setItem('agentlens.path', value); else localStorage.removeItem('agentlens.path'); } catch { /* ignore */ } }
async function callScan(path) { const query = path ? `?path=${encodeURIComponent(path)}` : ''; const r = await fetch(`/agentlens/scan${query}`, { credentials: 'same-origin' }); const d = await r.json(); if (!r.ok || d.ok === false) throw new Error(d.error || `HTTP ${r.status}`); return String(d.text || ''); }
async function callMigrate(path, from, to) { const r = await fetch('/agentlens/migrate', { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ path, from, to }), }); const d = await r.json(); if (!r.ok || d.ok === false) throw new Error(d.error || `HTTP ${r.status}`); return String(d.text || ''); }
// ------------------------------------------------------------ scan chip
function ScanChip() { const [busy, setBusy] = useState(false); const [open, setOpen] = useState(false); const [text, setText] = useState(''); const [error, setError] = useState('');
const run = useCallback(async () => { setBusy(true); setError(''); setText(''); try { const result = await callScan(rememberedPath()); setText(result); setOpen(true); } catch (err) { setError(String((err && err.message) || err)); setOpen(true); } finally { setBusy(false); } }, []);
return h( 'span', { className: 'agentlens-anchor' }, h( 'button', { type: 'button', className: 'agentlens-chip', title: '扫描当前项目的 AI Agent 配置(agentlens)', disabled: busy, onClick: run, }, h('span', null, '🩺'), h('span', null, busy ? '扫描中…' : '体检') ), open ? h( 'div', { className: 'agentlens-pop' }, h( 'div', { className: 'agentlens-pop-head' }, h('span', null, 'AgentLens 扫描结果'), h( 'button', { type: 'button', className: 'agentlens-pop-close', onClick: () => setOpen(false), title: '关闭', }, '✕' ) ), error ? `扫描失败:${error}` : text ) : null ); }
// ------------------------------------------------------ settings panel
function MigratePanel() { const [path, setPath] = useState(rememberedPath()); const [from, setFrom] = useState('claude'); const [to, setTo] = useState('cursor'); const [busy, setBusy] = useState(''); const [out, setOut] = useState(''); const [error, setError] = useState('');
const savePath = useCallback((value) => { setPath(value); rememberPath(value); }, []);
const doScan = useCallback(async () => { setBusy('scan'); setError(''); try { setOut(await callScan(path)); } catch (err) { setError(String((err && err.message) || err)); setOut(''); } finally { setBusy(''); } }, [path]);
const doMigrate = useCallback(async () => { setBusy('migrate'); setError(''); try { setOut(await callMigrate(path, from, to)); } catch (err) { setError(String((err && err.message) || err)); } finally { setBusy(''); } }, [path, from, to]);
return h( 'div', { className: 'agentlens-panel' }, h('h3', null, 'AgentLens 迁移'), h( 'p', { className: 'agentlens-hint' }, '把 AI Agent 的规则配置在 Claude Code / Cursor / Codex / Windsurf / Copilot 之间一键迁移;也可以先扫描项目里现有的配置。所有操作都在本机完成。' ), h( 'div', { className: 'row' }, h('input', { type: 'text', placeholder: '项目路径(留空扫描默认目录)', value: path, onChange: (e) => savePath(e.target.value), }), h( 'button', { type: 'button', disabled: busy !== '', onClick: doScan }, busy === 'scan' ? '扫描中…' : '扫描' ) ), h( 'div', { className: 'row' }, h('span', { style: { opacity: 0.75 } }, '迁移规则:'), h( 'select', { value: from, onChange: (e) => setFrom(e.target.value) }, AGENTS.map((a) => h('option', { key: a, value: a }, a)) ), h('span', { style: { opacity: 0.75 } }, '→'), h( 'select', { value: to, onChange: (e) => setTo(e.target.value) }, AGENTS.map((a) => h('option', { key: a, value: a }, a)) ), h( 'button', { type: 'button', disabled: busy !== '' || from === to, onClick: doMigrate }, busy === 'migrate' ? '迁移中…' : '开始迁移' ) ), error ? h('p', { className: 'agentlens-hint', style: { color: '#ff8a80' } }, `出错了:${error}`) : null, out ? h('pre', { className: 'agentlens-out' }, out) : null ); }
// ----------------------------------------------------------------- apply
return { inject: ['slots'], apply(ctx) { if (typeof document !== 'undefined' && !document.getElementById(STYLE_ID)) { const tag = document.createElement('style'); tag.id = STYLE_ID; tag.textContent = STYLE_TEXT; document.head.appendChild(tag); }
// Composer tool row: the permission seat (完全访问) is a `single` slot, // so the nearest injectable list slot rendered right after it is // `conversation.input.left`. No explicit order → appended after any // existing items (偏移一位 by design). ctx.slots.inject('conversation.input.left', () => ctx.slots.register({ name: 'conversation.input.left' }, () => h(ScanChip)) );
// Settings page section for migration. ctx.slots.inject('settings.section', () => ctx.slots.register( { name: 'settings.section', id: 'agentlens', order: 43, label: () => 'AgentLens 迁移' }, MigratePanel ) ); }, }; },});1234567891011121314151617181920212223242526272829303132333435363738394041424344454610 unmodified lines57585960616263646510 unmodified lines767778798081828384857 unmodified lines939495969798991001018 unmodified lines110111112113114115116117118119/*** @local/agentlens — AgentLens host plugin for DSH.** Registers four model-facing tools that shell out to the AgentLens CLI:* agentlens_scan — scan agent configs in the workspace* agentlens_move — migrate rules between agent formats* agentlens_drift — detect config drift across agents* agentlens_check — adversarial code QA on a file or git diff** All work happens locally via `npx agentlens`; nothing leaves the machine.*/import { execFile } from "node:child_process";import { promisify } from "node:util";const execFileAsync = promisify(execFile);export const inject = ["tools"];function text(value) {return [{ type: "text", text: String(value) }];}/** Run the agentlens CLI and return its combined output. */async function runAgentlens(args, cwd) {try {const { stdout, stderr } = await execFileAsync("npx", ["-y", "agentlens", ...args], {cwd,timeout: 120_000,maxBuffer: 4 * 1024 * 1024,});return (stdout || "") + (stderr ? `\n${stderr}` : "");} catch (err) {return `AgentLens 执行失败: ${err?.message ?? String(err)}`;}}/*** @param ctx - owning Host context.* @param config - bundle config (currently unused).*/export function apply(ctx, config = {}) {void config;ctx.effect(() => {const tools = ctx.get("tools");if (tools === void 0) return;10 unmodified lines},additionalProperties: false,},async execute(args) {const path = typeof args?.path === "string" ? args.path : process.cwd();return text(await runAgentlens(["scan", "--path", path], path));},}),tools.register({10 unmodified linesrequired: ["from", "to"],additionalProperties: false,},async execute(args) {const path = typeof args?.path === "string" ? args.path : process.cwd();const cmd = ["move", "--from", String(args.from), "--to", String(args.to), "--path", path];return text(await runAgentlens(cmd, path));},}),tools.register({7 unmodified lines},additionalProperties: false,},async execute(args) {const path = typeof args?.path === "string" ? args.path : process.cwd();return text(await runAgentlens(["drift", "--path", path], path));},}),tools.register({8 unmodified lines},additionalProperties: false,},async execute(args) {const path = typeof args?.path === "string" ? args.path : process.cwd();const target = typeof args?.target === "string" ? args.target : "HEAD~1..HEAD";return text(await runAgentlens(["check", target, "--path", path], path));},}),];12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113210 unmodified lines14314414514614714814915015115210 unmodified lines1631641651661671681691701711721737 unmodified lines1811821831841851861871881891908 unmodified lines199200201202203204205206207208209/*** @local/agentlens — Host half.** Registers four model-facing tools plus two local HTTP routes that back the* client UI (composer chip + Settings panel):** tools: agentlens_scan / agentlens_move / agentlens_drift / agentlens_check* routes: GET /agentlens/scan?path=…* POST /agentlens/migrate {path, from, to}** Everything shells out to the AgentLens CLI on this machine; nothing leaves it.*/import { execFile } from "node:child_process";import { promisify } from "node:util";import { existsSync, readFileSync } from "node:fs";const execFileAsync = promisify(execFile);export const inject = ["tools", "webServer"];const DEFAULT_ENTRY = '/Users/apple/Downloads/mimo/agentlens/dist/cli/index.js';function resolveEntry(config) {return config?.entry || process.env.AGENTLENS_ENTRY || DEFAULT_ENTRY;}/** Run the agentlens CLI and return its combined output. */async function runAgentlens(entry, args, cwd) {try {const { stdout, stderr } = await execFileAsync(process.execPath, [entry, ...args], {cwd,timeout: 120_000,maxBuffer: 4 * 1024 * 1024,});return (stdout || "") + (stderr ? `\n${stderr}` : "");} catch (err) {throw new Error(`AgentLens 执行失败: ${err?.message ?? String(err)}`);}}/** Shared output contract: tools return { text } and render it as text content. */const TEXT_OUTPUT = {schema: { type: "object", properties: { text: { type: "string" } }, required: ["text"], additionalProperties: false },render: (_args, value) => text(value?.text ?? ""),};/** Wrap a runAgentlens result into the { text } output shape. */async function runTool(entry, args, cwd) {return { text: await runAgentlens(entry, args, cwd) };}/** Exact-path route that never throws past registration. */function mountRoutes(server, entry, fallbackCwd) {const json = (res, status, body) => {res.writeHead(status, { "content-type": "application/json; charset=utf-8", "cache-control": "no-store" });res.end(JSON.stringify(body));};const scanRoute = {kind: "exact",path: "/agentlens/scan",async handler(req, res) {try {const url = new URL(req.url ?? "/agentlens/scan", "http://127.0.0.1");const path = url.searchParams.get("path") || fallbackCwd;const text = await runAgentlens(entry, ["scan", "--path", path], path);json(res, 200, { ok: true, text });} catch (error) {json(res, 500, { ok: false, error: String((error && error.message) || error) });}},};const migrateRoute = {kind: "exact",path: "/agentlens/migrate",async handler(req, res) {try {const body = await new Promise((resolve) => {let raw = "";req.on("data", (chunk) => {raw += chunk;});req.on("end", () => resolve(raw));});const payload = body ? JSON.parse(body) : {};const path = String(payload.path || fallbackCwd);const from = String(payload.from || "");const to = String(payload.to || "");if (!from || !to) {json(res, 400, { ok: false, error: "缺少 from / to 参数" });return;}const text = await runAgentlens(entry, ["move", "--from", from, "--to", to, "--path", path], path);json(res, 200, { ok: true, text });} catch (error) {json(res, 500, { ok: false, error: String((error && error.message) || error) });}},};const disposers = [];for (const route of [scanRoute, migrateRoute]) {try {disposers.push(server.register(route));} catch (error) {console.warn?.("agentlens: route %s was not registered: %s", route.path, error?.message ?? error);}}return () => disposers.forEach((dispose) => dispose?.());}/*** @param ctx - owning Host context.* @param config - { entry?: string } optional CLI entry override.*/export function apply(ctx, config = {}) {const entry = resolveEntry(config);const fallbackCwd = process.cwd();// --- Local HTTP routes for the client UI ---ctx.effect(() => {const server = ctx.get("webServer");if (!server) return;return mountRoutes(server, entry, fallbackCwd);}, "agentlens: local routes");// --- Model-facing tools ---ctx.effect(() => {const tools = ctx.get("tools");if (tools === void 0) return;10 unmodified lines},additionalProperties: false,},output: TEXT_OUTPUT,async execute(args) {const path = typeof args?.path === "string" ? args.path : fallbackCwd;return runTool(entry, ["scan", "--path", path], path);},}),tools.register({10 unmodified linesrequired: ["from", "to"],additionalProperties: false,},output: TEXT_OUTPUT,async execute(args) {const path = typeof args?.path === "string" ? args.path : fallbackCwd;const cmd = ["move", "--from", String(args.from), "--to", String(args.to), "--path", path];return runTool(entry, cmd, path);},}),tools.register({7 unmodified lines},additionalProperties: false,},output: TEXT_OUTPUT,async execute(args) {const path = typeof args?.path === "string" ? args.path : fallbackCwd;return runTool(entry, ["drift", "--path", path], path);},}),tools.register({8 unmodified lines},additionalProperties: false,},output: TEXT_OUTPUT,async execute(args) {const path = typeof args?.path === "string" ? args.path : fallbackCwd;const target = typeof args?.target === "string" ? args.target : "HEAD~1..HEAD";return runTool(entry, ["check", target, "--path", path], path);},}),];
12345678910111213141516171819{"name": "@local/agentlens","version": "1.0.0","private": true,"type": "module","description": "AgentLens for DSH: cross-agent config migration + adversarial code QA tools","exports": {".": "./index.js"},"files": ["index.js","cordis.patch.yml"],"dsh": {"bundle": {"patch": "./cordis.patch.yml"}}}12345678910111213141516171819202122232425{"name": "@local/agentlens","version": "1.1.0","private": true,"type": "module","description": "AgentLens for DSH: composer scan chip + Settings migration panel + model-facing tools","exports": {".": "./index.js","./client": "./client.js"},"files": ["index.js","client.js","cordis.patch.yml"],"dsh": {"bundle": {"patch": "./cordis.patch.yml"},"client": {"platform": "web","immediately": true}}}
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647---name: agentlensdescription: AI 编程 Agent 配置迁移与代码体检。扫描项目里的 Agent 规则文件(CLAUDE.md / .cursor/rules / AGENTS.md / .windsurfrules / copilot-instructions),在 Claude Code / Cursor / Codex / Windsurf / Copilot 之间一键迁移规则,检测配置漂移,并对 AI 写的代码做对抗式体检(安全漏洞、正确性 bug、风格问题)。当用户提到 AgentLens、扫描 Agent 配置、迁移规则、配置漂移、代码体检、检查 AI 生成的代码时使用。---
# AgentLens
本机已安装 AgentLens(CLI + MCP Server + DSH 插件)。MiMo Desktop 中优先使用已注册的 MCP 工具;工具不可用时回退到本地 CLI。
## 工具选择
优先调用 MCP 工具(本会话已连接):
| 工具名 | 用途 ||---|---|| `agentlens_agentlens_scan` | 扫描项目的 Agent 配置,返回各 Agent 的规则数量和类别统计 || `agentlens_agentlens_move` | 迁移规则:`from` → `to`(claude / cursor / codex / windsurf / copilot) || `agentlens_agentlens_drift` | 检测配置漂移(措辞不一致的规则、缺失的类别) || `agentlens_agentlens_check` | 体检代码:传 `code` + `filename`,返回安全/正确性/风格问题 |
MCP 工具不可用时,回退到 CLI:
```bashnode /Users/apple/Downloads/mimo/agentlens/dist/cli/index.js scan --path <项目路径>node /Users/apple/Downloads/mimo/agentlens/dist/cli/index.js move --from <源> --to <目标> --path <项目路径>node /Users/apple/Downloads/mimo/agentlens/dist/cli/index.js drift --path <项目路径>node /Users/apple/Downloads/mimo/agentlens/dist/cli/index.js check <文件或 git diff 范围> --path <项目路径>```
## 使用流程
1. **扫描**:用户问"项目里有哪些 Agent 配置"→ 调 `agentlens_scan`,用 path 指定项目根目录(默认当前目录)。2. **迁移**:用户说"把 Cursor 的规则搬到 Claude Code"→ 调 `agentlens_move`,from=cursor, to=claude。迁移前可先 scan 确认源规则存在。3. **漂移**:用户问"我的配置有没有不一致"→ 调 `agentlens_drift`。4. **体检**:用户贴了一段代码或问"这段代码有没有问题"→ 调 `agentlens_check`,把代码原文放入 `code`,文件名放入 `filename`(用于语言识别)。
## 结果解读
- 体检严重级别:🔴 critical(安全漏洞,必须修)、🟡 warning(正确性问题,建议修)、⚪ info(风格/提示)。- 扫描结果中每个 Agent 显示规则数和类别分布(context/tooling/workflow/constraint/style)。- 迁移会写入目标 Agent 的标准配置文件(CLAUDE.md / .cursor/rules/agentlens.mdc / AGENTS.md / .windsurfrules / .github/copilot-instructions.md)。
## 注意
- 所有操作纯本地,不上传任何代码。- 迁移是语义级转换(统一 IR 再生成),不是字符串复制;源文件不会被删除。- 体检基于规则库(命令注入、SQL 注入、硬编码密钥、XSS、空 catch、宽松比较等),不是全量静态分析,报告是建议性质。21 unmodified lines2223242526276 unmodified lines3435363738398 unmodified lines4849505152531 unmodified line5556575859601 unmodified line6263646566671 unmodified line69707172737459 unmodified lines1341351361371381396 unmodified lines14614714814915015115221 unmodified linesconfigPath: string;detectDirs: string[];format: "mcpServers" | "mimocode";}export function detectAgents(): Detection[] {6 unmodified linesconfigPath: join(home, ".claude", "settings.json"),detectDirs: [join(home, ".claude")],format: "mcpServers",},{key: "cursor",8 unmodified linesconfigPath: join(cwd, ".mcp.json"),detectDirs: [cwd],format: "mcpServers",},{key: "zcode",1 unmodified lineconfigPath: join(home, ".zcode", "mcp.json"),detectDirs: [join(home, ".zcode")],format: "mcpServers",},{key: "workbuddy",1 unmodified lineconfigPath: join(home, ".workbuddy", "mcp.json"),detectDirs: [join(home, ".workbuddy"), join(home, ".workbuddy-ai")],format: "mcpServers",},{key: "mimo",1 unmodified lineconfigPath: join(home, ".config", "mimocode", "mimocode.jsonc"),detectDirs: [join(home, ".config", "mimocode"), join(home, "Library", "Application Support", "Xiaomi MiMo")],format: "mimocode",},];}59 unmodified lineswriteFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");}export async function installTo(target: string): Promise<void> {console.log("AgentLens 安装器\n");6 unmodified lines} else {writeMcpServersConfig(d.configPath);}console.log(` ✅ ${d.label} → ${d.configPath}`);return true;} catch (err: any) {console.log(` ❌ ${d.label}: ${err.message}`);21 unmodified lines22232425262728296 unmodified lines363738394041428 unmodified lines515253545556571 unmodified line596061626364651 unmodified line676869707172731 unmodified line7576777879808159 unmodified lines1411421431441451461471481491501511521531541551561571581591601611621631641651661671681691706 unmodified lines17717817918018118218318421 unmodified linesconfigPath: string;detectDirs: string[];format: "mcpServers" | "mimocode";/** Where the AgentLens skill (SKILL.md) is installed, if the app supports skills. */skillsDir?: string;}export function detectAgents(): Detection[] {6 unmodified linesconfigPath: join(home, ".claude", "settings.json"),detectDirs: [join(home, ".claude")],format: "mcpServers",skillsDir: join(home, ".claude", "skills"),},{key: "cursor",8 unmodified linesconfigPath: join(cwd, ".mcp.json"),detectDirs: [cwd],format: "mcpServers",skillsDir: join(home, ".codex", "skills"),},{key: "zcode",1 unmodified lineconfigPath: join(home, ".zcode", "mcp.json"),detectDirs: [join(home, ".zcode")],format: "mcpServers",skillsDir: join(home, ".zcode", "skills"),},{key: "workbuddy",1 unmodified lineconfigPath: join(home, ".workbuddy", "mcp.json"),detectDirs: [join(home, ".workbuddy"), join(home, ".workbuddy-ai")],format: "mcpServers",skillsDir: join(home, ".workbuddy", "skills"),},{key: "mimo",1 unmodified lineconfigPath: join(home, ".config", "mimocode", "mimocode.jsonc"),detectDirs: [join(home, ".config", "mimocode"), join(home, "Library", "Application Support", "Xiaomi MiMo")],format: "mimocode",skillsDir: join(home, ".agents", "skills"),},];}59 unmodified lineswriteFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");}/** Locate the bundled SKILL.md (repo ext/skill or installed copy). */function bundledSkillPath(): string | undefined {const here = dirname(new URL(import.meta.url).pathname);const candidates = [resolve(here, "../../../ext/skill/SKILL.md"),resolve(here, "../../../../ext/skill/SKILL.md"),];for (const p of candidates) {if (existsSync(p)) return p;}return undefined;}/** Install the AgentLens skill into an app's skills root. */function installSkill(d: Detection): string | undefined {if (!d.skillsDir) return undefined;const src = bundledSkillPath();if (!src) return undefined;const dest = join(d.skillsDir, "agentlens", "SKILL.md");mkdirSync(dirname(dest), { recursive: true });writeFileSync(dest, readFileSync(src, "utf-8"), "utf-8");return dest;}export async function installTo(target: string): Promise<void> {console.log("AgentLens 安装器\n");6 unmodified lines} else {writeMcpServersConfig(d.configPath);}const skillPath = installSkill(d);console.log(` ✅ ${d.label} → ${d.configPath}${skillPath ? ` (+skill: ${skillPath})` : ""}`);return true;} catch (err: any) {console.log(` ❌ ${d.label}: ${err.message}`);
README.md+11-12
ext/dsh-plugin/client.jsAdded+268
ext/dsh-plugin/index.js+113-23
ext/dsh-plugin/package.json+9-3
ext/skill/SKILL.mdAdded+47
src/cli/commands/install.ts+33-1