Skip to content

Commit bc6e586

Browse files
committed
fix: drop root frontmatter when building CopilotRule
1 parent ec9ee7c commit bc6e586

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/features/rules/copilot-rule.test.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,15 @@ describe("CopilotRule", () => {
304304
rulesyncRule: original,
305305
});
306306

307-
// Root Copilot file must have no applyTo when the rulesync rule had no globs.
308-
expect(copilotRule.getFrontmatter().applyTo).toBeUndefined();
307+
// Root Copilot file must have no frontmatter.
308+
expect(copilotRule.getFrontmatter()).toEqual({});
309309

310310
const reimported = copilotRule.toRulesyncRule();
311311
const rf = reimported.getFrontmatter();
312312

313313
expect(rf.root).toBe(true);
314314
expect(rf.globs).toBeUndefined();
315-
expect(rf.description).toBe("Project overview");
315+
expect(rf.description).toBeUndefined();
316316
expect(reimported.getBody()).toBe("Overview content");
317317
});
318318

@@ -407,10 +407,7 @@ describe("CopilotRule", () => {
407407
validate: true,
408408
});
409409

410-
expect(copilotRule.getFrontmatter()).toEqual({
411-
description: "Root rule from rulesync",
412-
applyTo: "**/*",
413-
});
410+
expect(copilotRule.getFrontmatter()).toEqual({});
414411
expect(copilotRule.getBody()).toBe("Root rulesync rule content");
415412
expect(copilotRule.getRelativeDirPath()).toBe(".github");
416413
expect(copilotRule.getRelativeFilePath()).toBe("copilot-instructions.md");
@@ -494,7 +491,7 @@ describe("CopilotRule", () => {
494491
validate: true,
495492
});
496493

497-
expect(copilotRule.getFrontmatter().excludeAgent).toBe("coding-agent");
494+
expect(copilotRule.getFrontmatter()).toEqual({});
498495
});
499496

500497
it("should use default baseDir when not provided", () => {

src/features/rules/copilot-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export class CopilotRule extends ToolRule {
171171
// Root file: .github/copilot-instructions.md (no frontmatter for root file)
172172
return new CopilotRule({
173173
baseDir: baseDir,
174-
frontmatter: copilotFrontmatter,
174+
frontmatter: {},
175175
body,
176176
relativeDirPath: paths.root.relativeDirPath,
177177
relativeFilePath: paths.root.relativeFilePath,

0 commit comments

Comments
 (0)