feat: 9-agent migration matrix (dsh/workbuddy/zcode/mimo), 81 combinations tested, 210 tests
Browse files- INTEGRATION.md +13 -9
- README.md +13 -11
- README_HF.md +185 -0
- ext/dsh-plugin/client.js +1 -1
- ext/dsh-plugin/index.js +1 -1
- ext/skill/SKILL.md +4 -4
- ext/vscode/agentlens-0.3.0.vsix +0 -0
- src/cli/commands/drift.ts +3 -1
- src/cli/commands/scan.ts +4 -1
- src/core/types.ts +4 -0
- src/mcp/server.ts +5 -3
- src/migrator/generate.ts +25 -0
- src/parsers/agents-md.ts +31 -0
- src/parsers/base.ts +1 -3
- src/parsers/index.ts +21 -1
- tests/matrix.test.ts +66 -0
- tests/parsers-extra.test.ts +4 -2
- tests/parsers.test.ts +4 -3
INTEGRATION.md
CHANGED
|
@@ -170,15 +170,19 @@ node ~/Downloads/mimo/agentlens/dist/cli/index.js install --target mimo
|
|
| 170 |
---
|
| 171 |
## 各 App 对比
|
| 172 |
|
| 173 |
-
| App | MCP | Skill | 图形按钮/面板 |
|
| 174 |
-
|---|---|---|---|
|
| 175 |
-
| Claude Code | ✅ | ✅ `/agentlens` | — |
|
| 176 |
-
| Cursor | ✅ | — | ✅ VS Code 扩展面板 |
|
| 177 |
-
| Codex | ✅ | ✅ `/agentlens` | — |
|
| 178 |
-
| ZCode | ✅ | ✅ `/agentlens` | — |
|
| 179 |
-
| WorkBuddy | ✅ | ✅ `/agentlens` | — |
|
| 180 |
-
| MiMo Desktop | ✅ | ✅ `/agentlens` | —(产品未开放 UI 接口) |
|
| 181 |
-
| DSH | ✅ | — | ✅ 输入区「体检」按钮 + 设置「迁移」面板 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
## 不需要任何 App 的用法
|
| 184 |
|
|
|
|
| 170 |
---
|
| 171 |
## 各 App 对比
|
| 172 |
|
| 173 |
+
| App | MCP | Skill | 图形按钮/面板 | 规则文件(迁移用) |
|
| 174 |
+
|---|---|---|---|---|
|
| 175 |
+
| Claude Code | ✅ | ✅ `/agentlens` | — | `CLAUDE.md` |
|
| 176 |
+
| Cursor | ✅ | — | ✅ VS Code 扩展面板 | `.cursor/rules/*.mdc` |
|
| 177 |
+
| Codex | ✅ | ✅ `/agentlens` | — | `AGENTS.md` |
|
| 178 |
+
| ZCode | ✅ | ✅ `/agentlens` | — | `AGENTS.md` |
|
| 179 |
+
| WorkBuddy | ✅ | ✅ `/agentlens` | — | `AGENTS.md` |
|
| 180 |
+
| MiMo Desktop | ✅ | ✅ `/agentlens` | —(产品未开放 UI 接口) | `AGENTS.md` |
|
| 181 |
+
| DSH | ✅ | — | ✅ 输入区「体检」按钮 + 设置「迁移」面板 | `AGENTS.md` |
|
| 182 |
+
| Windsurf | — | — | — | `.windsurfrules` |
|
| 183 |
+
| GitHub Copilot | — | — | — | `.github/copilot-instructions.md` |
|
| 184 |
+
|
| 185 |
+
**迁移组合**:9 个 Agent 两两互通,9 × 9 = 81 种组合全部已验证(含往返解析测试)。Codex / DSH / WorkBuddy / ZCode / MiMo Desktop 共用 `AGENTS.md`,相互迁移是幂等的。
|
| 186 |
|
| 187 |
## 不需要任何 App 的用法
|
| 188 |
|
README.md
CHANGED
|
@@ -53,17 +53,19 @@ agentlens install
|
|
| 53 |
|
| 54 |
### 支持矩阵
|
| 55 |
|
| 56 |
-
| Agent | 集成方式 | MCP 配置 | Skill |
|
| 57 |
-
|---|---|---|---|
|
| 58 |
-
| Claude Code | MCP + Skill | `~/.claude/settings.json` | `~/.claude/skills/agentlens` |
|
| 59 |
-
| Cursor | VS Code 扩展 (.vsix) + MCP | `.cursor/mcp.json` | — |
|
| 60 |
-
| Codex | MCP + Skill | `.mcp.json` | `~/.codex/skills/agentlens` |
|
| 61 |
-
| ZCode | MCP + Skill | `~/.zcode/mcp.json` | `~/.zcode/skills/agentlens` |
|
| 62 |
-
| WorkBuddy | MCP + Skill | `~/.workbuddy/mcp.json` | `~/.workbuddy/skills/agentlens` |
|
| 63 |
-
| MiMo Desktop | MCP + Skill | `~/.config/mimocode/mimocode.jsonc` | `~/.agents/skills/agentlens` |
|
| 64 |
-
| DSH | 客户端插件(输入区「体检」按钮 + 设置页「AgentLens 迁移」面板)+ Host 工具 | `~/.dsh/profiles/desktop/package.json` | — |
|
| 65 |
-
| Windsurf | 规则文件 | `.windsurfrules` | — |
|
| 66 |
-
| GitHub Copilot | 规则文件 | `.github/copilot-instructions.md` | — |
|
|
|
|
|
|
|
| 67 |
|
| 68 |
## 安装(给不懂 Agent 插件的人看)
|
| 69 |
|
|
|
|
| 53 |
|
| 54 |
### 支持矩阵
|
| 55 |
|
| 56 |
+
| Agent | 集成方式 | MCP 配置 | Skill | 规则文件(迁移用) |
|
| 57 |
+
|---|---|---|---|---|
|
| 58 |
+
| Claude Code | MCP + Skill | `~/.claude/settings.json` | `~/.claude/skills/agentlens` | `CLAUDE.md` |
|
| 59 |
+
| Cursor | VS Code 扩展 (.vsix) + MCP | `.cursor/mcp.json` | — | `.cursor/rules/*.mdc` |
|
| 60 |
+
| Codex | MCP + Skill | `.mcp.json` | `~/.codex/skills/agentlens` | `AGENTS.md` |
|
| 61 |
+
| ZCode | MCP + Skill | `~/.zcode/mcp.json` | `~/.zcode/skills/agentlens` | `AGENTS.md` |
|
| 62 |
+
| WorkBuddy | MCP + Skill | `~/.workbuddy/mcp.json` | `~/.workbuddy/skills/agentlens` | `AGENTS.md` |
|
| 63 |
+
| MiMo Desktop | MCP + Skill | `~/.config/mimocode/mimocode.jsonc` | `~/.agents/skills/agentlens` | `AGENTS.md` |
|
| 64 |
+
| DSH | 客户端插件(输入区「体检」按钮 + 设置页「AgentLens 迁移」面板)+ Host 工具 | `~/.dsh/profiles/desktop/package.json` | — | `AGENTS.md` |
|
| 65 |
+
| Windsurf | 规则文件 | `.windsurfrules` | — | `.windsurfrules` |
|
| 66 |
+
| GitHub Copilot | 规则文件 | `.github/copilot-instructions.md` | — | `.github/copilot-instructions.md` |
|
| 67 |
+
|
| 68 |
+
**迁移组合:以上 9 个 Agent 两两互通(9 × 9 = 81 种组合全部已验证)。** Codex / DSH / WorkBuddy / ZCode / MiMo Desktop 共用 `AGENTS.md` 标准,它们之间"迁移"是幂等的(原地整理,不膨胀)。
|
| 69 |
|
| 70 |
## 安装(给不懂 Agent 插件的人看)
|
| 71 |
|
README_HF.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: AgentLens
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- ai-coding-agent
|
| 6 |
+
- developer-tools
|
| 7 |
+
- mcp
|
| 8 |
+
- config-migration
|
| 9 |
+
- code-review
|
| 10 |
+
- claude-code
|
| 11 |
+
- cursor
|
| 12 |
+
- codex
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# AgentLens
|
| 16 |
+
|
| 17 |
+
**Cross-agent config migration & adversarial code QA for AI coding agents.**
|
| 18 |
+
|
| 19 |
+
一个 CLI + MCP Server:把你积累的 AI Agent 规则习惯(CLAUDE.md / .cursor/rules / AGENTS.md / .windsurfrules / copilot-instructions)在 Claude Code、Cursor、Codex、Windsurf、ZCode、WorkBuddy、MiMo Desktop 之间一键搬家,并对 AI 写的代码做对抗式体检。全部本地运行,代码不出机器。
|
| 20 |
+
|
| 21 |
+
## 为什么做这个
|
| 22 |
+
|
| 23 |
+
- 每个 AI 编程 Agent 有自己的配置格式,换工具就要重写一遍规则
|
| 24 |
+
- 规则散落 N 个位置,改了这里忘了那里——"一模一样的烂规则副本还是烂规则"
|
| 25 |
+
- 46% 开发者不信任 AI 输出,66% 最大挫败是"几乎正确但不完全对",但没人把对抗式审查做成产品
|
| 26 |
+
|
| 27 |
+
## 功能
|
| 28 |
+
|
| 29 |
+
### 一键迁移
|
| 30 |
+
```bash
|
| 31 |
+
agentlens move --from claude --to cursor
|
| 32 |
+
```
|
| 33 |
+
所有 Agent 配置解析为统一中间表示(IR),语义级转换为目标格式。
|
| 34 |
+
|
| 35 |
+
### 配置漂移检测
|
| 36 |
+
```bash
|
| 37 |
+
agentlens drift
|
| 38 |
+
```
|
| 39 |
+
发现不同 Agent 配置里"意思相近但措辞不同"的规则,以及某个 Agent 缺失的规则类别。
|
| 40 |
+
|
| 41 |
+
### 对抗式代码体检
|
| 42 |
+
```bash
|
| 43 |
+
agentlens check src/index.ts # 单文件
|
| 44 |
+
agentlens check HEAD~1..HEAD # git diff
|
| 45 |
+
```
|
| 46 |
+
检查维度:安全(命令注入、SQL 注入、硬编码密钥、XSS、不安全连接)、正确性(空指针隐患、空 catch、宽松比较、TODO 残留)、风格、性能。
|
| 47 |
+
|
| 48 |
+
### 一键装进所有 Agent
|
| 49 |
+
```bash
|
| 50 |
+
agentlens install
|
| 51 |
+
```
|
| 52 |
+
自动检测本机已安装的 AI 工具(Claude Code、Cursor、Codex、ZCode、WorkBuddy、MiMo Desktop),写入各自的 MCP 配置。重启应用后在 MCP/工具设置里即可看到 4 个工具。
|
| 53 |
+
|
| 54 |
+
### 支持矩阵
|
| 55 |
+
|
| 56 |
+
| Agent | 集成方式 | MCP 配置 | Skill | 规则文件(迁移用) |
|
| 57 |
+
|---|---|---|---|---|
|
| 58 |
+
| Claude Code | MCP + Skill | `~/.claude/settings.json` | `~/.claude/skills/agentlens` | `CLAUDE.md` |
|
| 59 |
+
| Cursor | VS Code 扩展 (.vsix) + MCP | `.cursor/mcp.json` | — | `.cursor/rules/*.mdc` |
|
| 60 |
+
| Codex | MCP + Skill | `.mcp.json` | `~/.codex/skills/agentlens` | `AGENTS.md` |
|
| 61 |
+
| ZCode | MCP + Skill | `~/.zcode/mcp.json` | `~/.zcode/skills/agentlens` | `AGENTS.md` |
|
| 62 |
+
| WorkBuddy | MCP + Skill | `~/.workbuddy/mcp.json` | `~/.workbuddy/skills/agentlens` | `AGENTS.md` |
|
| 63 |
+
| MiMo Desktop | MCP + Skill | `~/.config/mimocode/mimocode.jsonc` | `~/.agents/skills/agentlens` | `AGENTS.md` |
|
| 64 |
+
| DSH | 客户端插件(输入区「体检」按钮 + 设置页「AgentLens 迁移」面板)+ Host 工具 | `~/.dsh/profiles/desktop/package.json` | — | `AGENTS.md` |
|
| 65 |
+
| Windsurf | 规则文件 | `.windsurfrules` | — | `.windsurfrules` |
|
| 66 |
+
| GitHub Copilot | 规则文件 | `.github/copilot-instructions.md` | — | `.github/copilot-instructions.md` |
|
| 67 |
+
|
| 68 |
+
**迁移组合:以上 9 个 Agent 两两互通(9 × 9 = 81 种组合全部已验证)。** Codex / DSH / WorkBuddy / ZCode / MiMo Desktop 共用 `AGENTS.md` 标准,它们之间"迁移"是幂等的(原地整理,不膨胀)。
|
| 69 |
+
|
| 70 |
+
## 安装(给不懂 Agent 插件的人看)
|
| 71 |
+
|
| 72 |
+
### 先说人话:这是什么?
|
| 73 |
+
|
| 74 |
+
你平时用 Claude Code、Cursor 这些「AI 编程助手」写代码。每个助手都有自己的"规矩文件"(告诉 AI 该怎么干活),格式还不一样。AgentLens 做两件事:
|
| 75 |
+
|
| 76 |
+
1. **搬规矩**:把你在 Cursor 里调教好的规矩,一键搬到 Claude Code,不用重写
|
| 77 |
+
2. **查代码**:AI 写的代码它帮你体检,揪出安全漏洞和低级错误
|
| 78 |
+
|
| 79 |
+
### 三种用法,选一个就行
|
| 80 |
+
|
| 81 |
+
**用法一:什么都不装,直接问 AI(最简单)**
|
| 82 |
+
|
| 83 |
+
如果你已经在用任何一个 AI 编程助手,把这句话发给它:
|
| 84 |
+
|
| 85 |
+
> 我装了 AgentLens,帮我扫描一下当前项目的 Agent 配置
|
| 86 |
+
|
| 87 |
+
如果它回复"没找到 AgentLens 工具",说明你还没接入,看下面「用法二」。
|
| 88 |
+
|
| 89 |
+
**用法二:一键接入(推荐)**
|
| 90 |
+
|
| 91 |
+
打开终端(Mac 按 `Cmd+空格` 输入"终端"),粘贴这一行,回车:
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
node ~/Downloads/mimo/agentlens/dist/cli/index.js install
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
它会自动检测你电脑上装了哪些 AI 工具(Claude Code、Cursor、Codex、ZCode、WorkBuddy、MiMo Desktop),把 AgentLens 装进它们的设置里。
|
| 98 |
+
|
| 99 |
+
**装完重启对应 App**(完全退出再打开,Mac 按 `Cmd+Q`),就能在对话里直接问 AI 使用了。
|
| 100 |
+
|
| 101 |
+
**用法三:单独用(不需要任何 AI 助手)**
|
| 102 |
+
|
| 103 |
+
终端里直接用:
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
# 扫描项目里有哪些 Agent 配置
|
| 107 |
+
node ~/Downloads/mimo/agentlens/dist/cli/index.js scan --path ~/你的项目
|
| 108 |
+
|
| 109 |
+
# 把 Cursor 的规矩搬到 Claude Code
|
| 110 |
+
node ~/Downloads/mimo/agentlens/dist/cli/index.js move --from cursor --to claude --path ~/你的项目
|
| 111 |
+
|
| 112 |
+
# 给代码做体检
|
| 113 |
+
node ~/Downloads/mimo/agentlens/dist/cli/index.js check src/index.js --path ~/你的项目
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
### ⚠️ 关于「设置页按钮」的支持边界(���要)
|
| 118 |
+
|
| 119 |
+
**能加自定义 UI 按钮/面板的只有两个 App:**
|
| 120 |
+
|
| 121 |
+
- **DSH**:设置页「AgentLens 迁移」面板 + 输入区「🩺 体检」按钮
|
| 122 |
+
- **Cursor / VS Code**:扩展设置面板(扫描/迁移/漂移/体检/一键接入)
|
| 123 |
+
|
| 124 |
+
**Claude Code / Codex / ZCode / WorkBuddy / MiMo Desktop 不开放自定义 UI 插件接口**,无法在它们的设置页里加面板、也无法在输入区加按钮(它们的插件系统只承载 Skill、MCP 连接器等内容,不承载 UI 组件)。
|
| 125 |
+
|
| 126 |
+
这五个 App 统一用 **`/agentlens` Skill** 替代:输入框敲 `/agentlens`,或在对话里说「用 agentlens 扫描项目」。
|
| 127 |
+
|
| 128 |
+
### 各软件接入指南(详细版见 [INTEGRATION.md](INTEGRATION.md))
|
| 129 |
+
|
| 130 |
+
### 各 App 接入后长什么样
|
| 131 |
+
|
| 132 |
+
| App | 接入后你会看到什么 | 怎么触发 |
|
| 133 |
+
|---|---|---|
|
| 134 |
+
| **Claude Code** | 设置 → MCP 里有 `agentlens`;输入框敲 `/agentlens` 也能用 | 直接说"用 agentlens 扫描项目" |
|
| 135 |
+
| **Cursor** | 设置 → MCP 里有 `agentlens`;装 `.vsix` 后左侧多一个 AgentLens 面板 | 命令面板 `Cmd+Shift+P` 输入 AgentLens |
|
| 136 |
+
| **Codex** | 启动后工具列表里有 agentlens;敲 `/agentlens` | 直接说"用 agentlens 扫描" |
|
| 137 |
+
| **ZCode** | 设置 → MCP 里有 `agentlens`;敲 `/agentlens` | 同上 |
|
| 138 |
+
| **WorkBuddy** | 设置 → MCP 里有 `agentlens`;敲 `/agentlens` | 同上 |
|
| 139 |
+
| **MiMo Desktop** | 设置 → MCP 里有 `agentlens`;敲 `/agentlens` | 同上 |
|
| 140 |
+
| **DSH(DeepSeek Harness)** | 输入框「完全访问」旁边多一个「🩺 体检」按钮;设置页多一个「AgentLens 迁移」面板 | 点按钮 |
|
| 141 |
+
|
| 142 |
+
### 常见问题
|
| 143 |
+
|
| 144 |
+
**Q:装完没反应?**
|
| 145 |
+
完全退出 App 再重开(不是关窗口,是退出进程:Mac 按 `Cmd+Q`)。MCP 配置是启动时加载的。
|
| 146 |
+
|
| 147 |
+
**Q:提示找不到 npx / node?**
|
| 148 |
+
说明你的电脑没装 Node.js。去 https://nodejs.org 下载安装(选 LTS 版本),装完重开终端再试。
|
| 149 |
+
|
| 150 |
+
**Q:会不会上传我的代码?**
|
| 151 |
+
不会。AgentLens 完全在你电脑本地运行,不联网、无账号、无遥测。
|
| 152 |
+
|
| 153 |
+
**Q:迁移会删掉原来的规矩文件吗?**
|
| 154 |
+
不会。只往目标 Agent 写新文件,源文件原样保留。
|
| 155 |
+
|
| 156 |
+
**Q:体检结果里的 🔴 是什么?**
|
| 157 |
+
🔴 高危(安全漏洞,必须修)、🟡 警告(可能有 bug,建议修)、⚪ 提示(风格问题)。
|
| 158 |
+
|
| 159 |
+
## 设计原则
|
| 160 |
+
|
| 161 |
+
- **纯本地**:无服务器、无账号、无遥测,代码永远不出你的机器
|
| 162 |
+
- **统一 IR**:所有 Agent 格式解析为同一套规则模型,迁移是语义级转换而非字符串复制
|
| 163 |
+
- **对抗视角**:体检引擎针对 AI 生成代码的典型缺陷设计("看着对,其实有坑")
|
| 164 |
+
|
| 165 |
+
## 项目结构
|
| 166 |
+
|
| 167 |
+
```
|
| 168 |
+
src/
|
| 169 |
+
├── core/ # IR 模型
|
| 170 |
+
├── parsers/ # 各 Agent 配置解析器(claude/cursor/codex/windsurf/copilot)
|
| 171 |
+
├── migrator/ # IR → 目标格式生成器
|
| 172 |
+
├── drift/ # 漂移检测引擎
|
| 173 |
+
├── checker/ # 对抗式体检引擎
|
| 174 |
+
├── mcp/ # MCP Server
|
| 175 |
+
├── install/ # 一键安装器
|
| 176 |
+
└── cli/ # CLI 入口
|
| 177 |
+
ext/
|
| 178 |
+
├── vscode/ # VS Code / Cursor 扩展(.vsix)
|
| 179 |
+
└── dsh-plugin/ # DSH cordis 插件
|
| 180 |
+
tests/ # 46 个测试
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
## License
|
| 184 |
+
|
| 185 |
+
MIT
|
ext/dsh-plugin/client.js
CHANGED
|
@@ -42,7 +42,7 @@ window.__ModuleLoader__.load({
|
|
| 42 |
.agentlens-hint{margin:0;font-size:12px;opacity:.65}
|
| 43 |
`;
|
| 44 |
|
| 45 |
-
const AGENTS = ['claude', 'cursor', 'codex', 'windsurf', 'copilot'];
|
| 46 |
|
| 47 |
function rememberedPath() {
|
| 48 |
try {
|
|
|
|
| 42 |
.agentlens-hint{margin:0;font-size:12px;opacity:.65}
|
| 43 |
`;
|
| 44 |
|
| 45 |
+
const AGENTS = ['claude', 'cursor', 'codex', 'windsurf', 'copilot', 'dsh', 'workbuddy', 'zcode', 'mimo'];
|
| 46 |
|
| 47 |
function rememberedPath() {
|
| 48 |
try {
|
ext/dsh-plugin/index.js
CHANGED
|
@@ -18,7 +18,7 @@ const execFileAsync = promisify(execFile);
|
|
| 18 |
|
| 19 |
export const inject = ["tools", "webServer"];
|
| 20 |
|
| 21 |
-
const DEFAULT_ENTRY = '/Users/apple/
|
| 22 |
|
| 23 |
/**
|
| 24 |
* Resolve a real Node.js binary. Inside the Electron host `process.execPath`
|
|
|
|
| 18 |
|
| 19 |
export const inject = ["tools", "webServer"];
|
| 20 |
|
| 21 |
+
const DEFAULT_ENTRY = '/Users/apple/agentlens/dist/cli/index.js';
|
| 22 |
|
| 23 |
/**
|
| 24 |
* Resolve a real Node.js binary. Inside the Electron host `process.execPath`
|
ext/skill/SKILL.md
CHANGED
|
@@ -21,10 +21,10 @@ description: AI 编程 Agent 配置迁移与代码体检。扫描项目里的 Ag
|
|
| 21 |
MCP 工具不可用时,回退到 CLI:
|
| 22 |
|
| 23 |
```bash
|
| 24 |
-
node /Users/apple/
|
| 25 |
-
node /Users/apple/
|
| 26 |
-
node /Users/apple/
|
| 27 |
-
node /Users/apple/
|
| 28 |
```
|
| 29 |
|
| 30 |
## 使用流程
|
|
|
|
| 21 |
MCP 工具不可用时,回退到 CLI:
|
| 22 |
|
| 23 |
```bash
|
| 24 |
+
node /Users/apple/agentlens/dist/cli/index.js scan --path <项目路径>
|
| 25 |
+
node /Users/apple/agentlens/dist/cli/index.js move --from <源> --to <目标> --path <项目路径>
|
| 26 |
+
node /Users/apple/agentlens/dist/cli/index.js drift --path <项目路径>
|
| 27 |
+
node /Users/apple/agentlens/dist/cli/index.js check <文件或 git diff 范围> --path <项目路径>
|
| 28 |
```
|
| 29 |
|
| 30 |
## 使用流程
|
ext/vscode/agentlens-0.3.0.vsix
ADDED
|
Binary file (34.1 kB). View file
|
|
|
src/cli/commands/drift.ts
CHANGED
|
@@ -34,9 +34,11 @@ export async function detectDrift(root: string): Promise<void> {
|
|
| 34 |
|
| 35 |
// Collect all rules per agent
|
| 36 |
const perAgent = new Map<string, Rule[]>();
|
|
|
|
| 37 |
for (const [agentName, parser] of Object.entries(parsers)) {
|
| 38 |
-
const files = findAgentFiles(absRoot, agentName);
|
| 39 |
if (files.length === 0) continue;
|
|
|
|
| 40 |
const rules: Rule[] = [];
|
| 41 |
for (const file of files) {
|
| 42 |
const content = readFileSync(file, "utf-8");
|
|
|
|
| 34 |
|
| 35 |
// Collect all rules per agent
|
| 36 |
const perAgent = new Map<string, Rule[]>();
|
| 37 |
+
const seenFiles = new Set<string>();
|
| 38 |
for (const [agentName, parser] of Object.entries(parsers)) {
|
| 39 |
+
const files = findAgentFiles(absRoot, agentName).filter((f) => !seenFiles.has(f));
|
| 40 |
if (files.length === 0) continue;
|
| 41 |
+
files.forEach((f) => seenFiles.add(f));
|
| 42 |
const rules: Rule[] = [];
|
| 43 |
for (const file of files) {
|
| 44 |
const content = readFileSync(file, "utf-8");
|
src/cli/commands/scan.ts
CHANGED
|
@@ -33,10 +33,13 @@ export async function scanProject(root: string): Promise<void> {
|
|
| 33 |
console.log(`Scanning ${absRoot} for AI agent configs...\n`);
|
| 34 |
|
| 35 |
let foundAny = false;
|
|
|
|
| 36 |
|
| 37 |
for (const [agentName, parser] of Object.entries(parsers)) {
|
| 38 |
-
|
|
|
|
| 39 |
if (files.length === 0) continue;
|
|
|
|
| 40 |
foundAny = true;
|
| 41 |
|
| 42 |
const allRules: Rule[] = [];
|
|
|
|
| 33 |
console.log(`Scanning ${absRoot} for AI agent configs...\n`);
|
| 34 |
|
| 35 |
let foundAny = false;
|
| 36 |
+
const seenFiles = new Set<string>();
|
| 37 |
|
| 38 |
for (const [agentName, parser] of Object.entries(parsers)) {
|
| 39 |
+
// AGENTS.md is shared by several agents — attribute it once (first match wins).
|
| 40 |
+
const files = findAgentFiles(absRoot, agentName).filter((f) => !seenFiles.has(f));
|
| 41 |
if (files.length === 0) continue;
|
| 42 |
+
files.forEach((f) => seenFiles.add(f));
|
| 43 |
foundAny = true;
|
| 44 |
|
| 45 |
const allRules: Rule[] = [];
|
src/core/types.ts
CHANGED
|
@@ -15,6 +15,10 @@ export type AgentKind =
|
|
| 15 |
| "codex"
|
| 16 |
| "windsurf"
|
| 17 |
| "copilot"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
| "generic";
|
| 19 |
|
| 20 |
export interface RuleSource {
|
|
|
|
| 15 |
| "codex"
|
| 16 |
| "windsurf"
|
| 17 |
| "copilot"
|
| 18 |
+
| "dsh"
|
| 19 |
+
| "workbuddy"
|
| 20 |
+
| "zcode"
|
| 21 |
+
| "mimo"
|
| 22 |
| "generic";
|
| 23 |
|
| 24 |
export interface RuleSource {
|
src/mcp/server.ts
CHANGED
|
@@ -35,9 +35,11 @@ function findAgentFiles(root: string, agent: string): string[] {
|
|
| 35 |
|
| 36 |
function collectRules(root: string): Array<{ agent: string; rules: Rule[]; files: string[] }> {
|
| 37 |
const results: Array<{ agent: string; rules: Rule[]; files: string[] }> = [];
|
|
|
|
| 38 |
for (const [agentName, parser] of Object.entries(parsers)) {
|
| 39 |
-
const files = findAgentFiles(root, agentName);
|
| 40 |
if (files.length === 0) continue;
|
|
|
|
| 41 |
const rules: Rule[] = [];
|
| 42 |
for (const file of files) {
|
| 43 |
rules.push(...parser.parse(readFileSync(file, "utf-8"), file));
|
|
@@ -87,8 +89,8 @@ export function createMcpServer(): McpServer {
|
|
| 87 |
"agentlens_move",
|
| 88 |
"Migrate agent config rules from one format to another (e.g., CLAUDE.md → .cursor/rules/)",
|
| 89 |
{
|
| 90 |
-
from: z.enum(["claude", "cursor", "codex", "windsurf", "copilot"]).describe("Source agent format"),
|
| 91 |
-
to: z.enum(["claude", "cursor", "codex", "windsurf", "copilot"]).describe("Target agent format"),
|
| 92 |
path: z.string().optional().describe("Project root path"),
|
| 93 |
output: z.string().optional().describe("Custom output file path"),
|
| 94 |
},
|
|
|
|
| 35 |
|
| 36 |
function collectRules(root: string): Array<{ agent: string; rules: Rule[]; files: string[] }> {
|
| 37 |
const results: Array<{ agent: string; rules: Rule[]; files: string[] }> = [];
|
| 38 |
+
const seenFiles = new Set<string>();
|
| 39 |
for (const [agentName, parser] of Object.entries(parsers)) {
|
| 40 |
+
const files = findAgentFiles(root, agentName).filter((f) => !seenFiles.has(f));
|
| 41 |
if (files.length === 0) continue;
|
| 42 |
+
files.forEach((f) => seenFiles.add(f));
|
| 43 |
const rules: Rule[] = [];
|
| 44 |
for (const file of files) {
|
| 45 |
rules.push(...parser.parse(readFileSync(file, "utf-8"), file));
|
|
|
|
| 89 |
"agentlens_move",
|
| 90 |
"Migrate agent config rules from one format to another (e.g., CLAUDE.md → .cursor/rules/)",
|
| 91 |
{
|
| 92 |
+
from: z.enum(["claude", "cursor", "codex", "windsurf", "copilot", "dsh", "workbuddy", "zcode", "mimo"]).describe("Source agent format"),
|
| 93 |
+
to: z.enum(["claude", "cursor", "codex", "windsurf", "copilot", "dsh", "workbuddy", "zcode", "mimo"]).describe("Target agent format"),
|
| 94 |
path: z.string().optional().describe("Project root path"),
|
| 95 |
output: z.string().optional().describe("Custom output file path"),
|
| 96 |
},
|
src/migrator/generate.ts
CHANGED
|
@@ -15,6 +15,12 @@ export function generateConfig(rules: Rule[], target: AgentKind): string {
|
|
| 15 |
return generateWindsurf(rules);
|
| 16 |
case "copilot":
|
| 17 |
return generateCopilot(rules);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
default:
|
| 19 |
return generateGeneric(rules);
|
| 20 |
}
|
|
@@ -71,6 +77,20 @@ function generateCursor(rules: Rule[]): string {
|
|
| 71 |
return lines.join("\n");
|
| 72 |
}
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
function generateCodex(rules: Rule[]): string {
|
| 75 |
const groups = groupByCategory(rules);
|
| 76 |
const lines: string[] = ["# Agent Instructions\n"];
|
|
@@ -108,6 +128,11 @@ export function outputFileFor(target: AgentKind): string {
|
|
| 108 |
case "codex": return "AGENTS.md";
|
| 109 |
case "windsurf": return ".windsurfrules";
|
| 110 |
case "copilot": return ".github/copilot-instructions.md";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
default: return "agentlens-rules.md";
|
| 112 |
}
|
| 113 |
}
|
|
|
|
| 15 |
return generateWindsurf(rules);
|
| 16 |
case "copilot":
|
| 17 |
return generateCopilot(rules);
|
| 18 |
+
case "dsh":
|
| 19 |
+
case "workbuddy":
|
| 20 |
+
case "zcode":
|
| 21 |
+
case "mimo":
|
| 22 |
+
// These agents all read the AGENTS.md standard (markdown instructions).
|
| 23 |
+
return generateAgentsMd(rules);
|
| 24 |
default:
|
| 25 |
return generateGeneric(rules);
|
| 26 |
}
|
|
|
|
| 77 |
return lines.join("\n");
|
| 78 |
}
|
| 79 |
|
| 80 |
+
/** AGENTS.md standard — shared by Codex / DSH / WorkBuddy / ZCode / MiMo Desktop. */
|
| 81 |
+
function generateAgentsMd(rules: Rule[]): string {
|
| 82 |
+
const groups = groupByCategory(rules);
|
| 83 |
+
const lines: string[] = ["# Agent Instructions\n"];
|
| 84 |
+
for (const [cat, items] of groups) {
|
| 85 |
+
lines.push(`## ${CATEGORY_TITLES[cat] ?? cat}\n`);
|
| 86 |
+
for (const r of items) {
|
| 87 |
+
lines.push(`- ${r.content}`);
|
| 88 |
+
}
|
| 89 |
+
lines.push("");
|
| 90 |
+
}
|
| 91 |
+
return lines.join("\n");
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
function generateCodex(rules: Rule[]): string {
|
| 95 |
const groups = groupByCategory(rules);
|
| 96 |
const lines: string[] = ["# Agent Instructions\n"];
|
|
|
|
| 128 |
case "codex": return "AGENTS.md";
|
| 129 |
case "windsurf": return ".windsurfrules";
|
| 130 |
case "copilot": return ".github/copilot-instructions.md";
|
| 131 |
+
case "dsh":
|
| 132 |
+
case "workbuddy":
|
| 133 |
+
case "zcode":
|
| 134 |
+
case "mimo":
|
| 135 |
+
return "AGENTS.md";
|
| 136 |
default: return "agentlens-rules.md";
|
| 137 |
}
|
| 138 |
}
|
src/parsers/agents-md.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Rule } from "../core/types.js";
|
| 2 |
+
import type { ConfigParser } from "./base.js";
|
| 3 |
+
import { nextRuleId, classifyRule, extractRuleBlocks } from "./base.js";
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* AGENTS.md parser — the shared instruction standard read by Codex, DSH,
|
| 7 |
+
* WorkBuddy, ZCode and MiMo Desktop.
|
| 8 |
+
*/
|
| 9 |
+
function makeAgentsMdParser(agent: "dsh" | "workbuddy" | "zcode" | "mimo"): ConfigParser {
|
| 10 |
+
return {
|
| 11 |
+
agent,
|
| 12 |
+
filePatterns: ["AGENTS.md"],
|
| 13 |
+
|
| 14 |
+
parse(content: string, filePath: string): Rule[] {
|
| 15 |
+
const blocks = extractRuleBlocks(content);
|
| 16 |
+
return blocks.map((block) => ({
|
| 17 |
+
id: nextRuleId(),
|
| 18 |
+
category: classifyRule(block),
|
| 19 |
+
content: block,
|
| 20 |
+
scope: "project" as const,
|
| 21 |
+
source: { agent, file: filePath },
|
| 22 |
+
status: "active" as const,
|
| 23 |
+
}));
|
| 24 |
+
},
|
| 25 |
+
};
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
export const dshParser = makeAgentsMdParser("dsh");
|
| 29 |
+
export const workbuddyParser = makeAgentsMdParser("workbuddy");
|
| 30 |
+
export const zcodeParser = makeAgentsMdParser("zcode");
|
| 31 |
+
export const mimoParser = makeAgentsMdParser("mimo");
|
src/parsers/base.ts
CHANGED
|
@@ -56,11 +56,9 @@ export function extractRuleBlocks(content: string): string[] {
|
|
| 56 |
continue;
|
| 57 |
}
|
| 58 |
|
| 59 |
-
//
|
| 60 |
if (/^#{1,6}\s/.test(trimmed)) {
|
| 61 |
flushParagraph();
|
| 62 |
-
const headingText = trimmed.replace(/^#{1,6}\s*/, "").trim();
|
| 63 |
-
if (headingText.length > 3) blocks.push(headingText);
|
| 64 |
continue;
|
| 65 |
}
|
| 66 |
|
|
|
|
| 56 |
continue;
|
| 57 |
}
|
| 58 |
|
| 59 |
+
// Headings are section labels, not rules: flush the paragraph and skip.
|
| 60 |
if (/^#{1,6}\s/.test(trimmed)) {
|
| 61 |
flushParagraph();
|
|
|
|
|
|
|
| 62 |
continue;
|
| 63 |
}
|
| 64 |
|
src/parsers/index.ts
CHANGED
|
@@ -4,17 +4,37 @@ import { cursorParser } from "./cursor.js";
|
|
| 4 |
import { codexParser } from "./codex.js";
|
| 5 |
import { windsurfParser } from "./windsurf.js";
|
| 6 |
import { copilotParser } from "./copilot.js";
|
|
|
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
export const parsers: Record<string, ConfigParser> = {
|
| 9 |
claude: claudeParser,
|
| 10 |
cursor: cursorParser,
|
| 11 |
codex: codexParser,
|
| 12 |
windsurf: windsurfParser,
|
| 13 |
copilot: copilotParser,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
};
|
| 15 |
|
| 16 |
export function getParser(agent: string): ConfigParser | undefined {
|
| 17 |
return parsers[agent];
|
| 18 |
}
|
| 19 |
|
| 20 |
-
export {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import { codexParser } from "./codex.js";
|
| 5 |
import { windsurfParser } from "./windsurf.js";
|
| 6 |
import { copilotParser } from "./copilot.js";
|
| 7 |
+
import { dshParser, workbuddyParser, zcodeParser, mimoParser } from "./agents-md.js";
|
| 8 |
|
| 9 |
+
/**
|
| 10 |
+
* Registration order matters for scanning: AGENTS.md is shared by codex, dsh,
|
| 11 |
+
* workbuddy, zcode and mimo, so codex is registered first and scan dedupes by
|
| 12 |
+
* file path (the file is attributed once, to the first matching agent).
|
| 13 |
+
*/
|
| 14 |
export const parsers: Record<string, ConfigParser> = {
|
| 15 |
claude: claudeParser,
|
| 16 |
cursor: cursorParser,
|
| 17 |
codex: codexParser,
|
| 18 |
windsurf: windsurfParser,
|
| 19 |
copilot: copilotParser,
|
| 20 |
+
dsh: dshParser,
|
| 21 |
+
workbuddy: workbuddyParser,
|
| 22 |
+
zcode: zcodeParser,
|
| 23 |
+
mimo: mimoParser,
|
| 24 |
};
|
| 25 |
|
| 26 |
export function getParser(agent: string): ConfigParser | undefined {
|
| 27 |
return parsers[agent];
|
| 28 |
}
|
| 29 |
|
| 30 |
+
export {
|
| 31 |
+
claudeParser,
|
| 32 |
+
cursorParser,
|
| 33 |
+
codexParser,
|
| 34 |
+
windsurfParser,
|
| 35 |
+
copilotParser,
|
| 36 |
+
dshParser,
|
| 37 |
+
workbuddyParser,
|
| 38 |
+
zcodeParser,
|
| 39 |
+
mimoParser,
|
| 40 |
+
};
|
tests/matrix.test.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, it, expect } from "vitest";
|
| 2 |
+
import { parsers } from "../src/parsers/index.js";
|
| 3 |
+
import { generateConfig, outputFileFor } from "../src/migrator/generate.js";
|
| 4 |
+
import type { Rule, AgentKind } from "../src/core/types.js";
|
| 5 |
+
|
| 6 |
+
const AGENTS = Object.keys(parsers) as AgentKind[];
|
| 7 |
+
|
| 8 |
+
/** Build one canonical rule set to migrate between every pair. */
|
| 9 |
+
function sampleRules(agent: AgentKind): Rule[] {
|
| 10 |
+
return [
|
| 11 |
+
{ id: "r1", category: "style", content: "Use TypeScript strict mode", scope: "project", source: { agent, file: "x" }, status: "active" },
|
| 12 |
+
{ id: "r2", category: "constraint", content: "Never commit secrets to the repository", scope: "project", source: { agent, file: "x" }, status: "active" },
|
| 13 |
+
{ id: "r3", category: "workflow", content: "Run tests before every commit", scope: "project", source: { agent, file: "x" }, status: "active" },
|
| 14 |
+
{ id: "r4", category: "tooling", content: "Use pnpm as the package manager", scope: "project", source: { agent, file: "x" }, status: "active" },
|
| 15 |
+
];
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
describe("full migration matrix — every agent pair produces valid output", () => {
|
| 19 |
+
for (const from of AGENTS) {
|
| 20 |
+
for (const to of AGENTS) {
|
| 21 |
+
it(`${from} → ${to}`, () => {
|
| 22 |
+
const rules = sampleRules(from);
|
| 23 |
+
const output = generateConfig(rules, to);
|
| 24 |
+
// Output must be non-empty and contain every rule body.
|
| 25 |
+
expect(output.trim().length).toBeGreaterThan(0);
|
| 26 |
+
for (const r of rules) {
|
| 27 |
+
expect(output).toContain(r.content);
|
| 28 |
+
}
|
| 29 |
+
// Every target resolves to a concrete file path.
|
| 30 |
+
const file = outputFileFor(to);
|
| 31 |
+
expect(file.length).toBeGreaterThan(0);
|
| 32 |
+
});
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
});
|
| 36 |
+
|
| 37 |
+
describe("round-trip: parse(output) recovers the same rule bodies", () => {
|
| 38 |
+
for (const from of AGENTS) {
|
| 39 |
+
for (const to of AGENTS) {
|
| 40 |
+
it(`${from} → ${to} → parse`, () => {
|
| 41 |
+
const rules = sampleRules(from);
|
| 42 |
+
const output = generateConfig(rules, to);
|
| 43 |
+
const file = outputFileFor(to);
|
| 44 |
+
const reparsed = parsers[to].parse(output, file);
|
| 45 |
+
const bodies = reparsed.map((r) => r.content);
|
| 46 |
+
for (const r of rules) {
|
| 47 |
+
expect(bodies.some((b) => b.includes(r.content) || r.content.includes(b))).toBe(true);
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
});
|
| 53 |
+
|
| 54 |
+
describe("output files per agent", () => {
|
| 55 |
+
it("shared AGENTS.md for codex/dsh/workbuddy/zcode/mimo", () => {
|
| 56 |
+
for (const a of ["codex", "dsh", "workbuddy", "zcode", "mimo"] as AgentKind[]) {
|
| 57 |
+
expect(outputFileFor(a)).toBe("AGENTS.md");
|
| 58 |
+
}
|
| 59 |
+
});
|
| 60 |
+
it("distinct files for claude/cursor/windsurf/copilot", () => {
|
| 61 |
+
expect(outputFileFor("claude")).toBe("CLAUDE.md");
|
| 62 |
+
expect(outputFileFor("cursor")).toBe(".cursor/rules/agentlens.mdc");
|
| 63 |
+
expect(outputFileFor("windsurf")).toBe(".windsurfrules");
|
| 64 |
+
expect(outputFileFor("copilot")).toBe(".github/copilot-instructions.md");
|
| 65 |
+
});
|
| 66 |
+
});
|
tests/parsers-extra.test.ts
CHANGED
|
@@ -38,8 +38,10 @@ describe("copilotParser", () => {
|
|
| 38 |
});
|
| 39 |
|
| 40 |
describe("parsers index", () => {
|
| 41 |
-
it("exposes all
|
| 42 |
const { parsers } = await import("../src/parsers/index.js");
|
| 43 |
-
expect(Object.keys(parsers)).toEqual([
|
|
|
|
|
|
|
| 44 |
});
|
| 45 |
});
|
|
|
|
| 38 |
});
|
| 39 |
|
| 40 |
describe("parsers index", () => {
|
| 41 |
+
it("exposes all nine parsers", async () => {
|
| 42 |
const { parsers } = await import("../src/parsers/index.js");
|
| 43 |
+
expect(Object.keys(parsers)).toEqual([
|
| 44 |
+
"claude", "cursor", "codex", "windsurf", "copilot", "dsh", "workbuddy", "zcode", "mimo",
|
| 45 |
+
]);
|
| 46 |
});
|
| 47 |
});
|
tests/parsers.test.ts
CHANGED
|
@@ -15,12 +15,13 @@ describe("extractRuleBlocks", () => {
|
|
| 15 |
expect(blocks[1]).toBe("Never commit directly to main");
|
| 16 |
});
|
| 17 |
|
| 18 |
-
it("
|
| 19 |
const content = `## Code Style\n\nSome content here.\n\n## Testing\n\nMore content.`;
|
| 20 |
const blocks = extractRuleBlocks(content);
|
| 21 |
-
expect(blocks).toContain("Code Style");
|
| 22 |
-
expect(blocks).toContain("Testing");
|
| 23 |
expect(blocks).toContain("Some content here.");
|
|
|
|
| 24 |
});
|
| 25 |
|
| 26 |
it("handles numbered lists", () => {
|
|
|
|
| 15 |
expect(blocks[1]).toBe("Never commit directly to main");
|
| 16 |
});
|
| 17 |
|
| 18 |
+
it("treats headings as labels, not rules", () => {
|
| 19 |
const content = `## Code Style\n\nSome content here.\n\n## Testing\n\nMore content.`;
|
| 20 |
const blocks = extractRuleBlocks(content);
|
| 21 |
+
expect(blocks).not.toContain("Code Style");
|
| 22 |
+
expect(blocks).not.toContain("Testing");
|
| 23 |
expect(blocks).toContain("Some content here.");
|
| 24 |
+
expect(blocks).toContain("More content.");
|
| 25 |
});
|
| 26 |
|
| 27 |
it("handles numbered lists", () => {
|