Skip to content

Commit 8ad24ae

Browse files
authored
Merge pull request #1264 from sheldonhull/fix/multi-root-per-target
fix: allow multiple root rules with different targets + copilot global nonRoot
2 parents f5422c9 + 9ab408a commit 8ad24ae

6 files changed

Lines changed: 458 additions & 23 deletions

File tree

docs/guide/global-mode.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,5 @@ Currently, supports rules generation for Claude Code, GitHub Copilot, and OpenCo
4848
> Currently, when in the directory enabled global mode:
4949
>
5050
> - `rulesync.jsonc` only supports `global`, `features`, `delete` and `verbose`. `Features` can be set `"rules"` and `"commands"`. Other parameters are ignored.
51-
> - `rules/*.md` only supports single file has `root: true`, and frontmatter parameters without `root` are ignored.
51+
> - Tools support only a single `root: true` file in global mode as a target, e.g. you can't have 2 root files targeting Claude.
5252
> - Only Claude Code is supported for global mode commands.
53-
> - Global mode rules are supported for Claude Code, GitHub Copilot, and OpenCode.

skills/rulesync/global-mode.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,5 @@ Currently, supports rules generation for Claude Code, GitHub Copilot, and OpenCo
4848
> Currently, when in the directory enabled global mode:
4949
>
5050
> - `rulesync.jsonc` only supports `global`, `features`, `delete` and `verbose`. `Features` can be set `"rules"` and `"commands"`. Other parameters are ignored.
51-
> - `rules/*.md` only supports single file has `root: true`, and frontmatter parameters without `root` are ignored.
51+
> - Tools support only a single `root: true` file in global mode as a target, e.g. you can't have 2 root files targeting Claude.
5252
> - Only Claude Code is supported for global mode commands.
53-
> - Global mode rules are supported for Claude Code, GitHub Copilot, and OpenCode.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ describe("CopilotRule", () => {
176176
relativeDirPath: ".copilot",
177177
relativeFilePath: "copilot-instructions.md",
178178
});
179-
expect(paths).not.toHaveProperty("nonRoot");
179+
expect(paths).toHaveProperty("nonRoot");
180+
expect(paths.nonRoot).toEqual({
181+
relativeDirPath: ".copilot/instructions",
182+
});
180183
});
181184

182185
it("should have different paths than regular getSettablePaths", () => {

src/features/rules/copilot-rule.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ export type CopilotRuleSettablePaths = Omit<ToolRuleSettablePaths, "root"> & {
4242
};
4343
};
4444

45-
export type CopilotRuleSettablePathsGlobal = ToolRuleSettablePathsGlobal;
45+
export type CopilotRuleSettablePathsGlobal = ToolRuleSettablePathsGlobal & {
46+
nonRoot: {
47+
relativeDirPath: string;
48+
};
49+
};
4650

4751
/**
4852
* Rule generator for GitHub Copilot
@@ -70,6 +74,9 @@ export class CopilotRule extends ToolRule {
7074
relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
7175
relativeFilePath: "copilot-instructions.md",
7276
},
77+
nonRoot: {
78+
relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir),
79+
},
7380
};
7481
}
7582
return {

0 commit comments

Comments
 (0)