Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/core/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,45 @@ globs: ["**/*.ts"]

await expect(parseRuleFile(filepath)).rejects.toThrow('Invalid "targets" field');
});

it("should accept claudecode as valid target", async () => {
const ruleContent = `---
root: false
targets: ["claudecode"]
description: "Test rule for Claude Code"
globs: ["**/*.ts"]
---

# Claude Code Rule
`;

const filepath = join(testDir, "claudecode-rule.md");
writeFileSync(filepath, ruleContent);

const rule = await parseRuleFile(filepath);

expect(rule.frontmatter.targets).toEqual(["claudecode"]);
expect(rule.frontmatter.description).toBe("Test rule for Claude Code");
});

it("should accept mixed targets including claudecode", async () => {
const ruleContent = `---
root: false
targets: ["copilot", "claudecode", "cursor"]
description: "Test rule for multiple tools including Claude Code"
globs: ["**/*.ts"]
---

# Mixed Targets with Claude Code
`;

const filepath = join(testDir, "mixed-claudecode-rule.md");
writeFileSync(filepath, ruleContent);

const rule = await parseRuleFile(filepath);

expect(rule.frontmatter.targets).toEqual(["copilot", "claudecode", "cursor"]);
});
});

describe("parseRulesFromDirectory", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function validateFrontmatter(data: unknown, filepath: string): void {
);
}

const validTargets = ["copilot", "cursor", "cline", "claude", "roo", "*"];
const validTargets = ["copilot", "cursor", "cline", "claude", "claudecode", "roo", "*"];
for (const target of obj.targets) {
if (typeof target !== "string" || !validTargets.includes(target)) {
throw new Error(
Expand Down