File size: 688 Bytes
7bedc79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import type { Rule } from "../core/types.js";
import type { ConfigParser } from "./base.js";
import { nextRuleId, classifyRule, extractRuleBlocks } from "./base.js";

/**
 * Codex config parser.
 * Reads: AGENTS.md (project root)
 */
export const codexParser: ConfigParser = {
  agent: "codex",
  filePatterns: ["AGENTS.md"],

  parse(content: string, filePath: string): Rule[] {
    const blocks = extractRuleBlocks(content);
    return blocks.map((block) => ({
      id: nextRuleId(),
      category: classifyRule(block),
      content: block,
      scope: "project" as const,
      source: { agent: "codex" as const, file: filePath },
      status: "active" as const,
    }));
  },
};