import { describe, it, expect } from 'vitest'; import { isAgentRegistryMarkdown, parseAgentsMd } from '../agents.js'; describe('isAgentRegistryMarkdown', () => { it('rejects Cursor navigation AGENTS.md at repo root', () => { expect( isAgentRegistryMarkdown('# Agent navigation\n\n## Doc map\n'), ).toBe(false); }); it('accepts the global data/AGENTS.md registry shape', () => { expect(isAgentRegistryMarkdown('# Agents\n\n## Code Reviewer\n---\n')).toBe(true); }); }); describe('parseAgentsMd', () => { it('does not emit errors for navigation sections when file is skipped upstream', () => { // When isAgentRegistryMarkdown returns false, getAgentsForProject never calls this. // Sanity: a nav-shaped file would produce six "missing fence" errors if parsed. const nav = `# Agent navigation ## Doc map | Need | Read | |------|------| ## Task routing Start here `; const r = parseAgentsMd(nav); expect(r.agents).toHaveLength(0); expect(r.errors.length).toBeGreaterThan(0); }); });