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
88 changes: 88 additions & 0 deletions src/features/rules/rulesync-rule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,94 @@ Subproject-specific rule body`;
expect(rule.getBody()).toBe("Subproject-specific rule body");
});

it("should handle copilot configuration in frontmatter", async () => {
const rulesDir = join(testDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
await ensureDir(rulesDir);

const ruleContent = `---
root: false
targets:
- copilot
description: Copilot rule
copilot:
excludeAgent: "code-review"
---

Copilot-specific rule body`;

const filePath = join(rulesDir, "copilot-rule.md");
await writeFileContent(filePath, ruleContent);

const rule = await RulesyncRule.fromFile({
relativeFilePath: "copilot-rule.md",
});

expect(rule.getFrontmatter().copilot).toEqual({
excludeAgent: "code-review",
});
expect(rule.getBody()).toBe("Copilot-specific rule body");
});

it("should handle claudecode configuration in frontmatter", async () => {
const rulesDir = join(testDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
await ensureDir(rulesDir);

const ruleContent = `---
root: false
targets:
- claudecode
description: Claude Code rule
claudecode:
paths:
- "src/**/*.ts"
---

Claude Code-specific rule body`;

const filePath = join(rulesDir, "claudecode-rule.md");
await writeFileContent(filePath, ruleContent);

const rule = await RulesyncRule.fromFile({
relativeFilePath: "claudecode-rule.md",
});

expect(rule.getFrontmatter().claudecode).toEqual({
paths: ["src/**/*.ts"],
});
expect(rule.getBody()).toBe("Claude Code-specific rule body");
});

it("should handle antigravity configuration in frontmatter", async () => {
const rulesDir = join(testDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
await ensureDir(rulesDir);

const ruleContent = `---
root: false
targets:
- antigravity
description: Antigravity rule
antigravity:
trigger: "glob"
globs:
- "*.md"
---

Antigravity-specific rule body`;

const filePath = join(rulesDir, "antigravity-rule.md");
await writeFileContent(filePath, ruleContent);

const rule = await RulesyncRule.fromFile({
relativeFilePath: "antigravity-rule.md",
});

expect(rule.getFrontmatter().antigravity).toEqual({
trigger: "glob",
globs: ["*.md"],
});
expect(rule.getBody()).toBe("Antigravity-specific rule body");
});

it("should load rule with localRoot field", async () => {
const rulesDir = join(testDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
await ensureDir(rulesDir);
Expand Down
3 changes: 3 additions & 0 deletions src/features/rules/rulesync-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ export class RulesyncRule extends RulesyncFile {
description: result.data.description,
globs: result.data.globs ?? [],
agentsmd: result.data.agentsmd,
claudecode: result.data.claudecode,
cursor: result.data.cursor,
copilot: result.data.copilot,
antigravity: result.data.antigravity,
Comment on lines +168 to +169

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes antigravity frontmatter being dropped, but there鈥檚 no unit test here covering antigravity loading via RulesyncRule.fromFile. Adding a focused test (similar to the new copilot/claudecode cases) would prevent regressions and directly covers issue #1259.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: ba15674

};

return new RulesyncRule({
Expand Down
Loading