Elffuss BraidHub

kikocis/continue public

fix: rule colocation uri logic (#7164)

* fix: rule colocation uri logic

* rename to `fileUri`

* fix: type errors

* fix test mocks

* Update slugs.test.ts
Changeset101210a0f0637500fba8367d6d89b0957af9405f7e73871e72f7aa01fddedf37
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-08-15 10:00 -07:00
CommitterGitHub <noreply@github.com> · 2025-08-15 10:00 -07:00
Parents4603ee65612c

Browse the files at this changeset

29 files changed

added .continue/rules/bigger-picture-description-rules.md +19 −0
@@ -0,0 +1,19 @@
1+---
2+name: Bigger Picture Description Rules
3+description: Guidelines for explaining how code works in context
4+alwaysApply: false
5+---
6+
7+When a user asks how a certain part of the code works:
8+
9+## 1. Describe what the code does in isolation
10+
11+Explain the functionality of the code without considering its interactions with other parts of the codebase.
12+
13+## 2. Describe interactions with other parts of the codebase
14+
15+If the code interacts with other parts of the codebase, describe how the code is imported and used in other parts of the codebase.
16+
17+## 3. Include parent function for clarity
18+
19+When describing each use-case, include the parent function for clarity.
deleted .continue/rules/bigger-picture-description-rules.yaml +0 −13
@@ -1,13 +0,0 @@
1-name: bigger-picture-description-rules
2-version: 0.0.1
3-schema: v1
4-rules:
5- - name: bigger-picture-description-rules
6- rule: >-
7- When a user asks how a certain part of the code works:
8-
9- 1. Describe what the code does in isolation.
10-
11- 2. If the code interacts with other parts of the codebase, describe how the code is imported and used in other parts of the codebase.
12-
13- 3. When describing each use-case, include the parent function for clarity.
added .continue/rules/colors.md +63 −0
@@ -0,0 +1,63 @@
1+---
2+name: Extension Color Themes
3+description: Guidelines for using theme colors in GUI components
4+alwaysApply: false
5+globs: "gui/**/*.tsx"
6+---
7+
8+When adding colors to components, use tailwind color classes.
9+Do NOT use explicit colors like text-gray-400. Instead, use theme colors.
10+
11+## Available theme colors
12+
13+### Normal text
14+
15+- `foreground`, `description`, `description-muted`
16+
17+### Other text, icons, etc
18+
19+- `success`, `warning`, `error`, `accent`, `link`
20+
21+### General components
22+
23+- `background`, `border`, `border-focus`
24+
25+### Specific components
26+
27+#### Button
28+
29+- `primary`, `primary-foreground`, `primary-hover`
30+- `secondary`, `secondary-foreground`, `secondary-hover`
31+
32+#### Input
33+
34+- `input`, `input-foreground`, `input-border`, `input-placeholder`
35+
36+#### Badge
37+
38+- `badge`, `badge-foreground`
39+
40+#### List/Dropdown items
41+
42+- `list-hover`, `list-active`, `list-active-foreground`
43+
44+#### Code Editor
45+
46+- `editor`, `editor-foreground`
47+
48+## Usage examples
49+
50+Any of these colors can be used in tailwind classes:
51+
52+- `bg-primary`
53+- `text-success`
54+- `border-error`
55+- `hover:bg-list-hover`
56+
57+## Excluded colors
58+
59+The following less-used colors are excluded from this guide:
60+
61+- Command (only used by tip-tap): `command`, `command-foreground`, `command-border`, `command-border-focus`
62+- Find widget colors: `find-match`, `find-match-selected`
63+- `table-oddRow`
deleted .continue/rules/colors.yaml +0 −27
@@ -1,27 +0,0 @@
1-name: GUI
2-version: 0.0.1
3-schema: v1
4-rules:
5- - name: Extension Color Themes
6- rule: |
7- When adding colors to components, use tailwind color classes.
8- Do NOT use explicit colors like text-gray-400. Instead, use theme colors.
9-
10- The common available theme colors are:
11- - For normal text: foreground, description, description-muted
12- - For other text, icons, etc: success, warning, error, accent, link
13- - For general components background, border, border-focus
14- - For specific components:
15- - Button: primary, primary-foreground, primary-hover, secondary, secondary-foreground, secondary-hover
16- - Input: input, input-foreground, input-border, input-placeholder
17- - Badge: badge, badge-foreground
18- - List/Dropdown items: list-hover, list-active, list-active-foreground
19- - Code Editor: editor, editor-foreground
20-
21- Any of these colors can be used in tailwind e.g. bg-primary, text-success, border-error, hover:bg-list-hover, etc.
22- globs: "gui/**/*.tsx"
23-# Excluding the following less-used colors:
24-# Command (only used by tip-tap): command, command-foreground, command-border, command-border-focus
25-# Find widget colors: find-match, find-match-selected
26-# table-oddRow
27-
deleted .continue/rules/edit-aggregator-singleton-rule.md +0 −8
@@ -1,8 +0,0 @@
1----
2-patterns: ["EditAggregator", "processEdit"]
3-glob: "**/*.tsx"
4-name: "Enforce EditAggregator Singleton"
5-description: "Ensure that EditAggregator is used as a singleton in the codebase."
6----
7-
8-When you encounter usage of EditAggregator, be sure that this is compatible with the singleton nature of the EditAggregator class. If you are creating a new instance of EditAggregator, you should instead use the existing singleton. Refer to the `aggregateEdits.ts` to examine how the singleton pattern is used. Do not create a new instance of EditAggregator.
added .continue/rules/intellij-plugin-test-execution.md +20 −0
@@ -0,0 +1,20 @@
1+---
2+name: IntelliJ Plugin Test Execution
3+description: Guidelines for running IntelliJ plugin tests with Gradle
4+alwaysApply: false
5+globs: extensions/intellij/**/*Test.kt
6+---
7+
8+Run IntelliJ plugin tests using Gradle with the fully qualified test class or method name:
9+
10+## Run test class
11+
12+```bash
13+./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest"
14+```
15+
16+## Run specific test method
17+
18+```bash
19+./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest.should*"
20+```
deleted .continue/rules/intellij-plugin-test-execution.yaml +0 −15
@@ -1,15 +0,0 @@
1-name: IntelliJ Plugin Test Execution
2-version: 0.0.1
3-schema: v1
4-rules:
5- - name: IntelliJ Plugin Test Execution
6- rule: |-
7- Run IntelliJ plugin tests using Gradle with the fully qualified test class or method name:
8- ```bash
9- # Run test class
10- ./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest"
11-
12- # Run specific test method
13- ./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest.should*"
14- ```
15- globs: extensions/intellij/**/*Test.kt
added .continue/rules/intellij-test-standards.md +20 −0
@@ -0,0 +1,20 @@
1+---
2+name: IntelliJ Test Standards
3+description: Standards for writing tests in the IntelliJ plugin
4+alwaysApply: false
5+globs: "**/test/**/*.kt"
6+---
7+
8+When writing tests for the IntelliJ plugin:
9+
10+## Use mockk library for mocking
11+
12+Prefer mockk's idiomatic syntax for creating and verifying mocks.
13+
14+## Structure tests with clear patterns
15+
16+Always structure tests with clear Arrange-Act-Assert patterns.
17+
18+## Use descriptive test names
19+
20+Use descriptive test names that indicate the scenario being tested.
deleted .continue/rules/intellij-test-standards.yaml +0 −10
@@ -1,10 +0,0 @@
1-name: IntelliJ Test Standards
2-version: 0.0.1
3-schema: v1
4-rules:
5- - name: IntelliJ Test Standards
6- rule: When writing tests for the IntelliJ plugin, use the mockk library for
7- mocking. Prefer mockk's idiomatic syntax for creating and verifying mocks.
8- Always structure tests with clear Arrange-Act-Assert patterns and use
9- descriptive test names that indicate the scenario being tested.
10- globs: "**/test/**/*.kt"
modified .continue/rules/new-protocol-message.md +1 −0
@@ -1,6 +1,7 @@
11 ---
22 name: New protocol message
33 description: Create a new protocol message from core/gui/ide to core/gui/ide
4+alwaysApply: false
45 ---
56
67 Create a new protocol message by taking the following steps:
added .continue/rules/unit-testing-rules.md +37 −0
@@ -0,0 +1,37 @@
1+---
2+name: Unit Testing Rules
3+description: Guidelines for unit testing in this project
4+alwaysApply: false
5+---
6+
7+For unit testing in this project:
8+
9+## 1. Testing frameworks
10+
11+The project uses Vitest and Jest for testing. Prefer Vitest.
12+
13+## 2. Test execution location
14+
15+Run tests from within the specific package directory (e.g., `cd core && ..`).
16+
17+## 3. Vitest tests
18+
19+- Test files follow the pattern `*.vitest.ts`
20+- Run tests using `vitest` from within the specific package/module directory:
21+ ```bash
22+ cd [directory] && vitest -- [test file path]
23+ ```
24+
25+## 4. Jest tests
26+
27+- Test files follow the pattern `*.test.ts`
28+- Run tests using `npm test` from within the specific package/module directory:
29+ ```bash
30+ cd [directory] && npm test -- [test file path]
31+ ```
32+- The test script uses experimental VM modules via NODE_OPTIONS flag
33+
34+## 5. Test structure
35+
36+- Write tests as top-level `test()` functions - DO NOT use `describe()` blocks
37+- Include the function name being tested in the test description for clarity
deleted .continue/rules/unit-testing-rules.yaml +0 −28
@@ -1,28 +0,0 @@
1-name: unit-testing-rules
2-version: 0.0.1
3-schema: v1
4-rules:
5- - name: unit-testing-rules
6- rule: >-
7- For unit testing in this project:
8-
9- 1. The project uses Vitest and Jest for testing. Prefer Vitest
10-
11- 2. Run tests from within the specific package directory (e.g., `cd core && ..`
12-
13- 3. For vitest tests,
14- - Test files follow the pattern `*.vitest.ts`
15- - Run tests using `vitest` from within the specific package/module
16- directory: `cd [directory] && vitest -- [test file path]`
17-
18- 4. For jest tests,
19- - Test files follow the pattern `*.test.ts`
20- - Run tests using `npm test` from within the specific package/module
21- directory: `cd [directory] && npm test -- [test file path]`
22- - The test script uses experimental VM modules via NODE_OPTIONS flag
23-
24- 5. For both
25- - Write tests as top-level `test()` functions - DO NOT use `describe()`
26- blocks
27- - Include the function name being tested in the test description for
28- clarity
modified core/config/markdown/loadCodebaseRules.ts +17 −3
@@ -5,7 +5,7 @@
55 import { IDE, RuleWithSource } from "../..";
66 import { walkDirs } from "../../indexing/walkDir";
77 import { RULES_MARKDOWN_FILENAME } from "../../llm/rules/constants";
8-import { getUriPathBasename } from "../../util/uri";
8+import { findUriInDirs, getUriPathBasename } from "../../util/uri";
99
1010 export class CodebaseRulesCache {
1111 private static instance: CodebaseRulesCache | null = null;
@@ -26,7 +26,14 @@
2626 }
2727 async update(ide: IDE, uri: string) {
2828 const content = await ide.readFile(uri);
29- const rule = markdownToRule(content, { uriType: "file", filePath: uri });
29+ const { relativePathOrBasename } = findUriInDirs(
30+ uri,
31+ await ide.getWorkspaceDirs(),
32+ );
33+ const rule = markdownToRule(content, {
34+ uriType: "file",
35+ fileUri: relativePathOrBasename,
36+ });
3037 const ruleWithSource: RuleWithSource = {
3138 ...rule,
3239 source: "colocated-markdown",
@@ -68,7 +75,14 @@
6875 for (const filePath of rulesMdFiles) {
6976 try {
7077 const content = await ide.readFile(filePath);
71- const rule = markdownToRule(content, { uriType: "file", filePath });
78+ const { relativePathOrBasename } = findUriInDirs(
79+ filePath,
80+ await ide.getWorkspaceDirs(),
81+ );
82+ const rule = markdownToRule(content, {
83+ uriType: "file",
84+ fileUri: relativePathOrBasename,
85+ });
7286
7387 rules.push({
7488 ...rule,
modified core/config/markdown/loadCodebaseRules.vitest.ts +23 −1
@@ -2,6 +2,7 @@
22 import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
33 import { IDE } from "../..";
44 import { walkDirs } from "../../indexing/walkDir";
5+import { findUriInDirs, getUriPathBasename } from "../../util/uri";
56 import { loadCodebaseRules } from "./loadCodebaseRules";
67
78 // Mock dependencies
@@ -13,12 +14,20 @@
1314 markdownToRule: vi.fn(),
1415 }));
1516
17+vi.mock("../../util/uri", () => ({
18+ findUriInDirs: vi.fn(),
19+ getUriPathBasename: vi.fn(),
20+}));
21+
1622 describe("loadCodebaseRules", () => {
1723 // Mock IDE with properly typed mock functions
1824 const mockIde = {
1925 readFile: vi.fn() as unknown as IDE["readFile"] & {
2026 mockImplementation: Function;
2127 },
28+ getWorkspaceDirs: vi.fn() as unknown as IDE["getWorkspaceDirs"] & {
29+ mockImplementation: Function;
30+ },
2231 } as unknown as IDE;
2332
2433 // Setup test files
@@ -77,6 +86,19 @@
7786 // Mock walkDirs to return our test files
7887 (walkDirs as any).mockResolvedValue(mockFiles);
7988
89+ // Mock getWorkspaceDirs to return a workspace directory
90+ (mockIde.getWorkspaceDirs as any).mockResolvedValue(["/workspace"]);
91+
92+ // Mock getUriPathBasename to return just the filename
93+ (getUriPathBasename as any).mockImplementation((path: string) => {
94+ return path.split("/").pop() || "";
95+ });
96+
97+ // Mock findUriInDirs to return relative path
98+ (findUriInDirs as any).mockImplementation((uri: string) => {
99+ return { relativePathOrBasename: uri };
100+ });
101+
80102 // Mock readFile to return content based on path
81103 (mockIde.readFile as any).mockImplementation((path: string) => {
82104 return Promise.resolve(mockRuleContent[path] || "");
@@ -85,7 +107,7 @@
85107 // Mock markdownToRule to return converted rules
86108 (markdownToRule as any).mockImplementation(
87109 (content: string, options: any) => {
88- return mockConvertedRules[options.filePath];
110+ return mockConvertedRules[options.fileUri];
89111 },
90112 );
91113 });
modified core/config/markdown/loadMarkdownRules.ts +6 −1
@@ -3,6 +3,7 @@
33 markdownToRule,
44 } from "@continuedev/config-yaml";
55 import { IDE, RuleWithSource } from "../..";
6+import { findUriInDirs } from "../../util/uri";
67 import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants";
78
89 /**
@@ -29,9 +30,13 @@
2930 // Process each markdown file
3031 for (const file of mdFiles) {
3132 try {
33+ const { relativePathOrBasename } = findUriInDirs(
34+ file.path,
35+ await ide.getWorkspaceDirs(),
36+ );
3237 const rule = markdownToRule(file.content, {
3338 uriType: "file",
34- filePath: file.path,
39+ fileUri: relativePathOrBasename,
3540 });
3641 rules.push({ ...rule, source: "rules-block", ruleFile: file.path });
3742 } catch (e) {
modified core/config/profile/LocalProfileLoader.ts +1 −2
@@ -65,8 +65,7 @@
6565 orgScopeId: null,
6666 packageIdentifier: {
6767 uriType: "file",
68- filePath:
69- this.overrideAssistantFile?.path ?? getPrimaryConfigFilePath(),
68+ fileUri: this.overrideAssistantFile?.path ?? getPrimaryConfigFilePath(),
7069 },
7170 });
7271
modified core/config/profile/doLoadConfig.ts +5 −5
@@ -62,6 +62,11 @@
6262 rules.unshift(...markdownRules);
6363 errors.push(...markdownRulesErrors);
6464
65+ // Add colocated rules from CodebaseRulesCache
66+ const codebaseRulesCache = CodebaseRulesCache.getInstance();
67+ rules.unshift(...codebaseRulesCache.rules);
68+ errors.push(...codebaseRulesCache.errors);
69+
6570 return { rules, errors };
6671 }
6772 export default async function doLoadConfig(options: {
@@ -182,11 +187,6 @@
182187 }
183188 });
184189
185- // Add rules from colocated rules.md files in the codebase
186- const codebaseRulesCache = CodebaseRulesCache.getInstance();
187- newConfig.rules.unshift(...codebaseRulesCache.rules);
188- errors.push(...codebaseRulesCache.errors);
189-
190190 // Rectify model selections for each role
191191 newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId);
192192
modified core/config/yaml/loadLocalYamlBlocks.ts +1 −1
@@ -23,7 +23,7 @@
2323 const unrollResult = await unrollAssistantFromContent(
2424 {
2525 uriType: "file",
26- filePath: "",
26+ fileUri: "",
2727 },
2828 "name: FILLER\nschema: v1\nversion: 0.0.1",
2929 registryClient,
modified core/config/yaml/loadYaml.ts +2 −2
@@ -72,7 +72,7 @@
7272 );
7373 return localBlocks.map((b) => ({
7474 uriType: "file" as const,
75- filePath: b.path,
75+ fileUri: b.path,
7676 }));
7777 });
7878 const localPackageIdentifiers: PackageIdentifier[] = (
@@ -87,7 +87,7 @@
8787 const getRegistryClient = async () => {
8888 const rootPath =
8989 packageIdentifier.uriType === "file"
90- ? dirname(getCleanUriPath(packageIdentifier.filePath))
90+ ? dirname(getCleanUriPath(packageIdentifier.fileUri))
9191 : undefined;
9292 return new RegistryClient({
9393 accessToken: await controlPlaneClient.getAccessToken(),
modified packages/config-yaml/src/__tests__/index.test.ts +6 −6
@@ -96,7 +96,7 @@
9696 const filePath =
9797 id.uriType === "slug"
9898 ? `./src/__tests__/packages/${slug}.yaml`
99- : id.filePath;
99+ : id.fileUri;
100100 return fs.readFileSync(filePath).toString();
101101 },
102102 };
@@ -244,7 +244,7 @@
244244 },
245245 {
246246 uriType: "file",
247- filePath: "./src/__tests__/local-files/rules.yaml",
247+ fileUri: "./src/__tests__/local-files/rules.yaml",
248248 },
249249 ],
250250 },
@@ -276,7 +276,7 @@
276276 const unrolledConfig = await unrollAssistant(
277277 {
278278 uriType: "file",
279- filePath: "./src/__tests__/local-files/duplicate-test-assistant.yaml",
279+ fileUri: "./src/__tests__/local-files/duplicate-test-assistant.yaml",
280280 },
281281 registry,
282282 {
@@ -289,15 +289,15 @@
289289 injectBlocks: [
290290 {
291291 uriType: "file",
292- filePath: "./src/__tests__/local-files/rules.yaml",
292+ fileUri: "./src/__tests__/local-files/rules.yaml",
293293 },
294294 {
295295 uriType: "file",
296- filePath: "./src/__tests__/local-files/mcpServer.yaml",
296+ fileUri: "./src/__tests__/local-files/mcpServer.yaml",
297297 },
298298 {
299299 uriType: "file",
300- filePath: "./src/__tests__/local-files/prompt.yaml",
300+ fileUri: "./src/__tests__/local-files/prompt.yaml",
301301 },
302302 ],
303303 },
modified packages/config-yaml/src/interfaces/slugs.test.ts +3 −3
@@ -117,7 +117,7 @@
117117 it("should encode/decode file-based package identifier with relative path", () => {
118118 const testIdentifier = {
119119 uriType: "file" as const,
120- filePath: "./path/to/package.yaml",
120+ fileUri: "./path/to/package.yaml",
121121 };
122122 const encoded = encodePackageIdentifier(testIdentifier);
123123 expect(encoded).toBe("./path/to/package.yaml");
@@ -129,7 +129,7 @@
129129 it("should encode/decode file-based package identifier with absolute path", () => {
130130 const testIdentifier = {
131131 uriType: "file" as const,
132- filePath: "/absolute/path/to/package.yaml",
132+ fileUri: "/absolute/path/to/package.yaml",
133133 };
134134 const encoded = encodePackageIdentifier(testIdentifier);
135135 expect(encoded).toBe("/absolute/path/to/package.yaml");
@@ -144,7 +144,7 @@
144144
145145 expect(decoded).toEqual({
146146 uriType: "file" as const,
147- filePath: "/path/to/package.yaml",
147+ fileUri: "/path/to/package.yaml",
148148 });
149149 });
150150
modified packages/config-yaml/src/interfaces/slugs.ts +5 −5
@@ -20,7 +20,7 @@
2020
2121 interface FileIdentifier extends BasePackageIdentifier {
2222 uriType: "file";
23- filePath: string;
23+ fileUri: string;
2424 }
2525
2626 export type PackageIdentifier = FullSlugIdentifier | FileIdentifier;
@@ -28,7 +28,7 @@
2828 export function packageIdentifierToDisplayName(id: PackageIdentifier): string {
2929 switch (id.uriType) {
3030 case "file":
31- return id.filePath;
31+ return id.fileUri;
3232 case "slug":
3333 return id.fullSlug.packageSlug;
3434 }
@@ -40,7 +40,7 @@
4040 return encodeFullSlug(identifier.fullSlug);
4141 case "file":
4242 // For file paths, just return the path directly without a prefix
43- return identifier.filePath;
43+ return identifier.fileUri;
4444 default:
4545 throw new Error(`Unknown URI type: ${(identifier as any).uriType}`);
4646 }
@@ -51,14 +51,14 @@
5151 if (identifier.startsWith(".") || identifier.startsWith("/")) {
5252 return {
5353 uriType: "file",
54- filePath: identifier,
54+ fileUri: identifier,
5555 };
5656 }
5757 // Keep support for explicit file:// protocol
5858 else if (identifier.startsWith("file://")) {
5959 return {
6060 uriType: "file",
61- filePath: identifier.substring(7),
61+ fileUri: identifier.substring(7),
6262 };
6363 }
6464 // Otherwise, it's a slug
modified packages/config-yaml/src/load/unroll.test.ts +4 −4
@@ -5,7 +5,7 @@
55 it("parses valid YAML content as AssistantUnrolled", () => {
66 const mockId: PackageIdentifier = {
77 uriType: "file",
8- filePath: "./foo/bar.yaml",
8+ fileUri: "./foo/bar.yaml",
99 };
1010 const yamlContent = `
1111 name: Test Assistant
@@ -26,7 +26,7 @@
2626 it("parses markdown rule content as AssistantUnrolled", () => {
2727 const mockId: PackageIdentifier = {
2828 uriType: "file",
29- filePath: "./foo/bar.md",
29+ fileUri: "./foo/bar.md",
3030 };
3131 const markdownContent = `
3232 ---
@@ -55,7 +55,7 @@
5555 it("throws error for invalid content in yaml file", () => {
5656 const mockId: PackageIdentifier = {
5757 uriType: "file",
58- filePath: "./foo/bar.yaml",
58+ fileUri: "./foo/bar.yaml",
5959 };
6060 const invalidContent = `
6161 name: Test Assistant
@@ -74,7 +74,7 @@
7474 it("Every non-YAML file is a rule", () => {
7575 const mockId: PackageIdentifier = {
7676 uriType: "file",
77- filePath: "./foo/bar",
77+ fileUri: "./foo/bar",
7878 };
7979 const dubiousContent = `This is not \nproper #YAML#`;
8080 const result = parseMarkdownRuleOrAssistantUnrolled(dubiousContent, mockId);
modified packages/config-yaml/src/load/unroll.ts +3 −3
@@ -465,14 +465,14 @@
465465 resolvedBlock,
466466 source:
467467 injectBlock.uriType === "file"
468- ? injectBlock.filePath
468+ ? injectBlock.fileUri
469469 : undefined,
470470 error: null,
471471 };
472472 } catch (err) {
473473 let msg = "";
474474 if (injectBlock.uriType === "file") {
475- msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`;
475+ msg = `${(err as Error).message}.\n> ${injectBlock.fileUri}`;
476476 } else {
477477 msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`;
478478 }
@@ -669,7 +669,7 @@
669669 } catch (yamlError) {
670670 if (
671671 id.uriType === "file" &&
672- [".yaml", ".yml"].some((ext) => id.filePath.endsWith(ext))
672+ [".yaml", ".yml"].some((ext) => id.fileUri.endsWith(ext))
673673 ) {
674674 throw yamlError;
675675 }
modified packages/config-yaml/src/markdown/createMarkdownRule.test.ts +1 −1
@@ -9,7 +9,7 @@
99 // Mock package identifier for testing
1010 const mockPackageId: PackageIdentifier = {
1111 uriType: "file",
12- filePath: "/path/to/folder",
12+ fileUri: "/path/to/folder",
1313 };
1414
1515 describe("sanitizeRuleName", () => {
modified packages/config-yaml/src/markdown/markdownToRule.test.ts +11 −11
@@ -5,7 +5,7 @@
55 // Use a mock PackageIdentifier for testing
66 const mockId: PackageIdentifier = {
77 uriType: "file",
8- filePath: "/path/to/file",
8+ fileUri: "/path/to/file",
99 };
1010
1111 it("should convert markdown with frontmatter to a rule", () => {
@@ -115,7 +115,7 @@
115115
116116 const result = markdownToRule(content, {
117117 uriType: "file",
118- filePath: "/",
118+ fileUri: "/",
119119 });
120120 expect(result.globs).toBe("/**/src/**/Dockerfile");
121121 });
@@ -151,7 +151,7 @@
151151
152152 const result = markdownToRule(content, {
153153 uriType: "file",
154- filePath: "/Documents/myproject/.continue/rules/rule1.md",
154+ fileUri: "/Documents/myproject/.continue/rules/rule1.md",
155155 });
156156 expect(result.globs).toBe(".git");
157157 });
@@ -268,7 +268,7 @@
268268 const frontmatter = { name: "Custom Rule Name" };
269269 const id: PackageIdentifier = {
270270 uriType: "file",
271- filePath: "/path/to/my-rule.md",
271+ fileUri: "/path/to/my-rule.md",
272272 };
273273
274274 const result = getRuleName(frontmatter, id);
@@ -279,7 +279,7 @@
279279 const frontmatter = {};
280280 const id: PackageIdentifier = {
281281 uriType: "file",
282- filePath: "/long/path/to/rules/my-rule.md",
282+ fileUri: "/long/path/to/rules/my-rule.md",
283283 };
284284
285285 const result = getRuleName(frontmatter, id);
@@ -290,7 +290,7 @@
290290 const frontmatter = {};
291291 const id: PackageIdentifier = {
292292 uriType: "file",
293- filePath: "C:\\long\\path\\to\\rules\\my-rule.md",
293+ fileUri: "C:\\long\\path\\to\\rules\\my-rule.md",
294294 };
295295
296296 const result = getRuleName(frontmatter, id);
@@ -301,7 +301,7 @@
301301 const frontmatter = {};
302302 const id: PackageIdentifier = {
303303 uriType: "file",
304- filePath: "/path/to\\rules/my-rule.md",
304+ fileUri: "/path/to\\rules/my-rule.md",
305305 };
306306
307307 const result = getRuleName(frontmatter, id);
@@ -312,7 +312,7 @@
312312 const frontmatter = {};
313313 const id: PackageIdentifier = {
314314 uriType: "file",
315- filePath: "my-rule.md",
315+ fileUri: "my-rule.md",
316316 };
317317
318318 const result = getRuleName(frontmatter, id);
@@ -323,7 +323,7 @@
323323 const frontmatter = {};
324324 const id: PackageIdentifier = {
325325 uriType: "file",
326- filePath: "rules/my-rule.md",
326+ fileUri: "rules/my-rule.md",
327327 };
328328
329329 const result = getRuleName(frontmatter, id);
@@ -349,7 +349,7 @@
349349 const frontmatter = { name: "Override Name" };
350350 const id: PackageIdentifier = {
351351 uriType: "file",
352- filePath: "/very/long/path/to/rules/original-name.md",
352+ fileUri: "/very/long/path/to/rules/original-name.md",
353353 };
354354
355355 const result = getRuleName(frontmatter, id);
@@ -360,7 +360,7 @@
360360 const frontmatter = { name: "" };
361361 const id: PackageIdentifier = {
362362 uriType: "file",
363- filePath: "/path/to/rules/my-rule.md",
363+ fileUri: "/path/to/rules/my-rule.md",
364364 };
365365
366366 const result = getRuleName(frontmatter, id);
modified packages/config-yaml/src/markdown/markdownToRule.ts +5 −2
@@ -77,7 +77,10 @@
7777 if (id.uriType !== "file") {
7878 return globs;
7979 }
80- let dir = path.dirname(id.filePath);
80+ let dir = path.dirname(id.fileUri);
81+
82+ // TODO: This is likely causing bugs for Windows users.
83+ // We can't access `core/util/uri.ts` from this package though.
8184 if (dir.includes(".continue")) {
8285 return globs;
8386 }
@@ -112,6 +115,6 @@
112115 regex: frontmatter.regex,
113116 description: frontmatter.description,
114117 alwaysApply: frontmatter.alwaysApply,
115- sourceFile: id.uriType === "file" ? id.filePath : undefined,
118+ sourceFile: id.uriType === "file" ? id.fileUri : undefined,
116119 };
117120 }
modified packages/config-yaml/src/registryClient.test.ts +1 −1
@@ -95,7 +95,7 @@
9595
9696 const id: PackageIdentifier = {
9797 uriType: "file",
98- filePath: testFilePath,
98+ fileUri: testFilePath,
9999 };
100100
101101 const result = await client.getContent(id);
modified packages/config-yaml/src/registryClient.ts +1 −1
@@ -26,7 +26,7 @@
2626 async getContent(id: PackageIdentifier): Promise<string> {
2727 switch (id.uriType) {
2828 case "file":
29- return this.getContentFromFilePath(id.filePath);
29+ return this.getContentFromFilePath(id.fileUri);
3030 case "slug":
3131 return this.getContentFromSlug(id.fullSlug);
3232 default: