feat: 9-agent migration matrix (dsh/workbuddy/zcode/mimo), 81 combinations tested, 210 tests
031fd6d verified Download tests/matrix.test.ts from hongcoding/agentlens: direct link, hf CLI and curl.
- Browser
- Download file 2.88 kB
-
https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/tests/matrix.test.ts
- Command line
-
hf download hf://datasets/hongcoding/agentlens/tests/matrix.test.ts
-
curl -L -o matrix.test.ts https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/tests/matrix.test.ts
2.88 kB
| import { describe, it, expect } from "vitest"; | |
| import { parsers } from "../src/parsers/index.js"; | |
| import { generateConfig, outputFileFor } from "../src/migrator/generate.js"; | |
| import type { Rule, AgentKind } from "../src/core/types.js"; | |
| const AGENTS = Object.keys(parsers) as AgentKind[]; | |
| /** Build one canonical rule set to migrate between every pair. */ | |
| function sampleRules(agent: AgentKind): Rule[] { | |
| return [ | |
| { id: "r1", category: "style", content: "Use TypeScript strict mode", scope: "project", source: { agent, file: "x" }, status: "active" }, | |
| { id: "r2", category: "constraint", content: "Never commit secrets to the repository", scope: "project", source: { agent, file: "x" }, status: "active" }, | |
| { id: "r3", category: "workflow", content: "Run tests before every commit", scope: "project", source: { agent, file: "x" }, status: "active" }, | |
| { id: "r4", category: "tooling", content: "Use pnpm as the package manager", scope: "project", source: { agent, file: "x" }, status: "active" }, | |
| ]; | |
| } | |
| describe("full migration matrix — every agent pair produces valid output", () => { | |
| for (const from of AGENTS) { | |
| for (const to of AGENTS) { | |
| it(`${from} → ${to}`, () => { | |
| const rules = sampleRules(from); | |
| const output = generateConfig(rules, to); | |
| // Output must be non-empty and contain every rule body. | |
| expect(output.trim().length).toBeGreaterThan(0); | |
| for (const r of rules) { | |
| expect(output).toContain(r.content); | |
| } | |
| // Every target resolves to a concrete file path. | |
| const file = outputFileFor(to); | |
| expect(file.length).toBeGreaterThan(0); | |
| }); | |
| } | |
| } | |
| }); | |
| describe("round-trip: parse(output) recovers the same rule bodies", () => { | |
| for (const from of AGENTS) { | |
| for (const to of AGENTS) { | |
| it(`${from} → ${to} → parse`, () => { | |
| const rules = sampleRules(from); | |
| const output = generateConfig(rules, to); | |
| const file = outputFileFor(to); | |
| const reparsed = parsers[to].parse(output, file); | |
| const bodies = reparsed.map((r) => r.content); | |
| for (const r of rules) { | |
| expect(bodies.some((b) => b.includes(r.content) || r.content.includes(b))).toBe(true); | |
| } | |
| }); | |
| } | |
| } | |
| }); | |
| describe("output files per agent", () => { | |
| it("shared AGENTS.md for codex/dsh/workbuddy/zcode/mimo", () => { | |
| for (const a of ["codex", "dsh", "workbuddy", "zcode", "mimo"] as AgentKind[]) { | |
| expect(outputFileFor(a)).toBe("AGENTS.md"); | |
| } | |
| }); | |
| it("distinct files for claude/cursor/windsurf/copilot", () => { | |
| expect(outputFileFor("claude")).toBe("CLAUDE.md"); | |
| expect(outputFileFor("cursor")).toBe(".cursor/rules/agentlens.mdc"); | |
| expect(outputFileFor("windsurf")).toBe(".windsurfrules"); | |
| expect(outputFileFor("copilot")).toBe(".github/copilot-instructions.md"); | |
| }); | |
| }); | |