Changesets · Branches · Tags · Compare
| Changeset | 101210a0f0637500fba8367d6d89b0957af9405f7e73871e72f7aa01fddedf37 |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-08-15 10:00 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-08-15 10:00 -07:00 |
| Parents | 4603ee65612c |
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 @@ | ||
| 1 | 1 | --- |
| 2 | 2 | name: New protocol message |
| 3 | 3 | description: Create a new protocol message from core/gui/ide to core/gui/ide |
| 4 | +alwaysApply: false | |
| 4 | 5 | --- |
| 5 | 6 | |
| 6 | 7 | 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 @@ | ||
| 5 | 5 | import { IDE, RuleWithSource } from "../.."; |
| 6 | 6 | import { walkDirs } from "../../indexing/walkDir"; |
| 7 | 7 | import { RULES_MARKDOWN_FILENAME } from "../../llm/rules/constants"; |
| 8 | -import { getUriPathBasename } from "../../util/uri"; | |
| 8 | +import { findUriInDirs, getUriPathBasename } from "../../util/uri"; | |
| 9 | 9 | |
| 10 | 10 | export class CodebaseRulesCache { |
| 11 | 11 | private static instance: CodebaseRulesCache | null = null; |
| @@ -26,7 +26,14 @@ | ||
| 26 | 26 | } |
| 27 | 27 | async update(ide: IDE, uri: string) { |
| 28 | 28 | 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 | + }); | |
| 30 | 37 | const ruleWithSource: RuleWithSource = { |
| 31 | 38 | ...rule, |
| 32 | 39 | source: "colocated-markdown", |
| @@ -68,7 +75,14 @@ | ||
| 68 | 75 | for (const filePath of rulesMdFiles) { |
| 69 | 76 | try { |
| 70 | 77 | 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 | + }); | |
| 72 | 86 | |
| 73 | 87 | rules.push({ |
| 74 | 88 | ...rule, |
modified core/config/markdown/loadCodebaseRules.vitest.ts +23 −1
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
| 3 | 3 | import { IDE } from "../.."; |
| 4 | 4 | import { walkDirs } from "../../indexing/walkDir"; |
| 5 | +import { findUriInDirs, getUriPathBasename } from "../../util/uri"; | |
| 5 | 6 | import { loadCodebaseRules } from "./loadCodebaseRules"; |
| 6 | 7 | |
| 7 | 8 | // Mock dependencies |
| @@ -13,12 +14,20 @@ | ||
| 13 | 14 | markdownToRule: vi.fn(), |
| 14 | 15 | })); |
| 15 | 16 | |
| 17 | +vi.mock("../../util/uri", () => ({ | |
| 18 | + findUriInDirs: vi.fn(), | |
| 19 | + getUriPathBasename: vi.fn(), | |
| 20 | +})); | |
| 21 | + | |
| 16 | 22 | describe("loadCodebaseRules", () => { |
| 17 | 23 | // Mock IDE with properly typed mock functions |
| 18 | 24 | const mockIde = { |
| 19 | 25 | readFile: vi.fn() as unknown as IDE["readFile"] & { |
| 20 | 26 | mockImplementation: Function; |
| 21 | 27 | }, |
| 28 | + getWorkspaceDirs: vi.fn() as unknown as IDE["getWorkspaceDirs"] & { | |
| 29 | + mockImplementation: Function; | |
| 30 | + }, | |
| 22 | 31 | } as unknown as IDE; |
| 23 | 32 | |
| 24 | 33 | // Setup test files |
| @@ -77,6 +86,19 @@ | ||
| 77 | 86 | // Mock walkDirs to return our test files |
| 78 | 87 | (walkDirs as any).mockResolvedValue(mockFiles); |
| 79 | 88 | |
| 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 | + | |
| 80 | 102 | // Mock readFile to return content based on path |
| 81 | 103 | (mockIde.readFile as any).mockImplementation((path: string) => { |
| 82 | 104 | return Promise.resolve(mockRuleContent[path] || ""); |
| @@ -85,7 +107,7 @@ | ||
| 85 | 107 | // Mock markdownToRule to return converted rules |
| 86 | 108 | (markdownToRule as any).mockImplementation( |
| 87 | 109 | (content: string, options: any) => { |
| 88 | - return mockConvertedRules[options.filePath]; | |
| 110 | + return mockConvertedRules[options.fileUri]; | |
| 89 | 111 | }, |
| 90 | 112 | ); |
| 91 | 113 | }); |
modified core/config/markdown/loadMarkdownRules.ts +6 −1
| @@ -3,6 +3,7 @@ | ||
| 3 | 3 | markdownToRule, |
| 4 | 4 | } from "@continuedev/config-yaml"; |
| 5 | 5 | import { IDE, RuleWithSource } from "../.."; |
| 6 | +import { findUriInDirs } from "../../util/uri"; | |
| 6 | 7 | import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants"; |
| 7 | 8 | |
| 8 | 9 | /** |
| @@ -29,9 +30,13 @@ | ||
| 29 | 30 | // Process each markdown file |
| 30 | 31 | for (const file of mdFiles) { |
| 31 | 32 | try { |
| 33 | + const { relativePathOrBasename } = findUriInDirs( | |
| 34 | + file.path, | |
| 35 | + await ide.getWorkspaceDirs(), | |
| 36 | + ); | |
| 32 | 37 | const rule = markdownToRule(file.content, { |
| 33 | 38 | uriType: "file", |
| 34 | - filePath: file.path, | |
| 39 | + fileUri: relativePathOrBasename, | |
| 35 | 40 | }); |
| 36 | 41 | rules.push({ ...rule, source: "rules-block", ruleFile: file.path }); |
| 37 | 42 | } catch (e) { |
modified core/config/profile/LocalProfileLoader.ts +1 −2
| @@ -65,8 +65,7 @@ | ||
| 65 | 65 | orgScopeId: null, |
| 66 | 66 | packageIdentifier: { |
| 67 | 67 | uriType: "file", |
| 68 | - filePath: | |
| 69 | - this.overrideAssistantFile?.path ?? getPrimaryConfigFilePath(), | |
| 68 | + fileUri: this.overrideAssistantFile?.path ?? getPrimaryConfigFilePath(), | |
| 70 | 69 | }, |
| 71 | 70 | }); |
| 72 | 71 |
modified core/config/profile/doLoadConfig.ts +5 −5
| @@ -62,6 +62,11 @@ | ||
| 62 | 62 | rules.unshift(...markdownRules); |
| 63 | 63 | errors.push(...markdownRulesErrors); |
| 64 | 64 | |
| 65 | + // Add colocated rules from CodebaseRulesCache | |
| 66 | + const codebaseRulesCache = CodebaseRulesCache.getInstance(); | |
| 67 | + rules.unshift(...codebaseRulesCache.rules); | |
| 68 | + errors.push(...codebaseRulesCache.errors); | |
| 69 | + | |
| 65 | 70 | return { rules, errors }; |
| 66 | 71 | } |
| 67 | 72 | export default async function doLoadConfig(options: { |
| @@ -182,11 +187,6 @@ | ||
| 182 | 187 | } |
| 183 | 188 | }); |
| 184 | 189 | |
| 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 | - | |
| 190 | 190 | // Rectify model selections for each role |
| 191 | 191 | newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId); |
| 192 | 192 |
modified core/config/yaml/loadLocalYamlBlocks.ts +1 −1
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | const unrollResult = await unrollAssistantFromContent( |
| 24 | 24 | { |
| 25 | 25 | uriType: "file", |
| 26 | - filePath: "", | |
| 26 | + fileUri: "", | |
| 27 | 27 | }, |
| 28 | 28 | "name: FILLER\nschema: v1\nversion: 0.0.1", |
| 29 | 29 | registryClient, |
modified core/config/yaml/loadYaml.ts +2 −2
| @@ -72,7 +72,7 @@ | ||
| 72 | 72 | ); |
| 73 | 73 | return localBlocks.map((b) => ({ |
| 74 | 74 | uriType: "file" as const, |
| 75 | - filePath: b.path, | |
| 75 | + fileUri: b.path, | |
| 76 | 76 | })); |
| 77 | 77 | }); |
| 78 | 78 | const localPackageIdentifiers: PackageIdentifier[] = ( |
| @@ -87,7 +87,7 @@ | ||
| 87 | 87 | const getRegistryClient = async () => { |
| 88 | 88 | const rootPath = |
| 89 | 89 | packageIdentifier.uriType === "file" |
| 90 | - ? dirname(getCleanUriPath(packageIdentifier.filePath)) | |
| 90 | + ? dirname(getCleanUriPath(packageIdentifier.fileUri)) | |
| 91 | 91 | : undefined; |
| 92 | 92 | return new RegistryClient({ |
| 93 | 93 | accessToken: await controlPlaneClient.getAccessToken(), |
modified packages/config-yaml/src/__tests__/index.test.ts +6 −6
| @@ -96,7 +96,7 @@ | ||
| 96 | 96 | const filePath = |
| 97 | 97 | id.uriType === "slug" |
| 98 | 98 | ? `./src/__tests__/packages/${slug}.yaml` |
| 99 | - : id.filePath; | |
| 99 | + : id.fileUri; | |
| 100 | 100 | return fs.readFileSync(filePath).toString(); |
| 101 | 101 | }, |
| 102 | 102 | }; |
| @@ -244,7 +244,7 @@ | ||
| 244 | 244 | }, |
| 245 | 245 | { |
| 246 | 246 | uriType: "file", |
| 247 | - filePath: "./src/__tests__/local-files/rules.yaml", | |
| 247 | + fileUri: "./src/__tests__/local-files/rules.yaml", | |
| 248 | 248 | }, |
| 249 | 249 | ], |
| 250 | 250 | }, |
| @@ -276,7 +276,7 @@ | ||
| 276 | 276 | const unrolledConfig = await unrollAssistant( |
| 277 | 277 | { |
| 278 | 278 | uriType: "file", |
| 279 | - filePath: "./src/__tests__/local-files/duplicate-test-assistant.yaml", | |
| 279 | + fileUri: "./src/__tests__/local-files/duplicate-test-assistant.yaml", | |
| 280 | 280 | }, |
| 281 | 281 | registry, |
| 282 | 282 | { |
| @@ -289,15 +289,15 @@ | ||
| 289 | 289 | injectBlocks: [ |
| 290 | 290 | { |
| 291 | 291 | uriType: "file", |
| 292 | - filePath: "./src/__tests__/local-files/rules.yaml", | |
| 292 | + fileUri: "./src/__tests__/local-files/rules.yaml", | |
| 293 | 293 | }, |
| 294 | 294 | { |
| 295 | 295 | uriType: "file", |
| 296 | - filePath: "./src/__tests__/local-files/mcpServer.yaml", | |
| 296 | + fileUri: "./src/__tests__/local-files/mcpServer.yaml", | |
| 297 | 297 | }, |
| 298 | 298 | { |
| 299 | 299 | uriType: "file", |
| 300 | - filePath: "./src/__tests__/local-files/prompt.yaml", | |
| 300 | + fileUri: "./src/__tests__/local-files/prompt.yaml", | |
| 301 | 301 | }, |
| 302 | 302 | ], |
| 303 | 303 | }, |
modified packages/config-yaml/src/interfaces/slugs.test.ts +3 −3
| @@ -117,7 +117,7 @@ | ||
| 117 | 117 | it("should encode/decode file-based package identifier with relative path", () => { |
| 118 | 118 | const testIdentifier = { |
| 119 | 119 | uriType: "file" as const, |
| 120 | - filePath: "./path/to/package.yaml", | |
| 120 | + fileUri: "./path/to/package.yaml", | |
| 121 | 121 | }; |
| 122 | 122 | const encoded = encodePackageIdentifier(testIdentifier); |
| 123 | 123 | expect(encoded).toBe("./path/to/package.yaml"); |
| @@ -129,7 +129,7 @@ | ||
| 129 | 129 | it("should encode/decode file-based package identifier with absolute path", () => { |
| 130 | 130 | const testIdentifier = { |
| 131 | 131 | uriType: "file" as const, |
| 132 | - filePath: "/absolute/path/to/package.yaml", | |
| 132 | + fileUri: "/absolute/path/to/package.yaml", | |
| 133 | 133 | }; |
| 134 | 134 | const encoded = encodePackageIdentifier(testIdentifier); |
| 135 | 135 | expect(encoded).toBe("/absolute/path/to/package.yaml"); |
| @@ -144,7 +144,7 @@ | ||
| 144 | 144 | |
| 145 | 145 | expect(decoded).toEqual({ |
| 146 | 146 | uriType: "file" as const, |
| 147 | - filePath: "/path/to/package.yaml", | |
| 147 | + fileUri: "/path/to/package.yaml", | |
| 148 | 148 | }); |
| 149 | 149 | }); |
| 150 | 150 |
modified packages/config-yaml/src/interfaces/slugs.ts +5 −5
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | |
| 21 | 21 | interface FileIdentifier extends BasePackageIdentifier { |
| 22 | 22 | uriType: "file"; |
| 23 | - filePath: string; | |
| 23 | + fileUri: string; | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | export type PackageIdentifier = FullSlugIdentifier | FileIdentifier; |
| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | export function packageIdentifierToDisplayName(id: PackageIdentifier): string { |
| 29 | 29 | switch (id.uriType) { |
| 30 | 30 | case "file": |
| 31 | - return id.filePath; | |
| 31 | + return id.fileUri; | |
| 32 | 32 | case "slug": |
| 33 | 33 | return id.fullSlug.packageSlug; |
| 34 | 34 | } |
| @@ -40,7 +40,7 @@ | ||
| 40 | 40 | return encodeFullSlug(identifier.fullSlug); |
| 41 | 41 | case "file": |
| 42 | 42 | // For file paths, just return the path directly without a prefix |
| 43 | - return identifier.filePath; | |
| 43 | + return identifier.fileUri; | |
| 44 | 44 | default: |
| 45 | 45 | throw new Error(`Unknown URI type: ${(identifier as any).uriType}`); |
| 46 | 46 | } |
| @@ -51,14 +51,14 @@ | ||
| 51 | 51 | if (identifier.startsWith(".") || identifier.startsWith("/")) { |
| 52 | 52 | return { |
| 53 | 53 | uriType: "file", |
| 54 | - filePath: identifier, | |
| 54 | + fileUri: identifier, | |
| 55 | 55 | }; |
| 56 | 56 | } |
| 57 | 57 | // Keep support for explicit file:// protocol |
| 58 | 58 | else if (identifier.startsWith("file://")) { |
| 59 | 59 | return { |
| 60 | 60 | uriType: "file", |
| 61 | - filePath: identifier.substring(7), | |
| 61 | + fileUri: identifier.substring(7), | |
| 62 | 62 | }; |
| 63 | 63 | } |
| 64 | 64 | // Otherwise, it's a slug |
modified packages/config-yaml/src/load/unroll.test.ts +4 −4
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | it("parses valid YAML content as AssistantUnrolled", () => { |
| 6 | 6 | const mockId: PackageIdentifier = { |
| 7 | 7 | uriType: "file", |
| 8 | - filePath: "./foo/bar.yaml", | |
| 8 | + fileUri: "./foo/bar.yaml", | |
| 9 | 9 | }; |
| 10 | 10 | const yamlContent = ` |
| 11 | 11 | name: Test Assistant |
| @@ -26,7 +26,7 @@ | ||
| 26 | 26 | it("parses markdown rule content as AssistantUnrolled", () => { |
| 27 | 27 | const mockId: PackageIdentifier = { |
| 28 | 28 | uriType: "file", |
| 29 | - filePath: "./foo/bar.md", | |
| 29 | + fileUri: "./foo/bar.md", | |
| 30 | 30 | }; |
| 31 | 31 | const markdownContent = ` |
| 32 | 32 | --- |
| @@ -55,7 +55,7 @@ | ||
| 55 | 55 | it("throws error for invalid content in yaml file", () => { |
| 56 | 56 | const mockId: PackageIdentifier = { |
| 57 | 57 | uriType: "file", |
| 58 | - filePath: "./foo/bar.yaml", | |
| 58 | + fileUri: "./foo/bar.yaml", | |
| 59 | 59 | }; |
| 60 | 60 | const invalidContent = ` |
| 61 | 61 | name: Test Assistant |
| @@ -74,7 +74,7 @@ | ||
| 74 | 74 | it("Every non-YAML file is a rule", () => { |
| 75 | 75 | const mockId: PackageIdentifier = { |
| 76 | 76 | uriType: "file", |
| 77 | - filePath: "./foo/bar", | |
| 77 | + fileUri: "./foo/bar", | |
| 78 | 78 | }; |
| 79 | 79 | const dubiousContent = `This is not \nproper #YAML#`; |
| 80 | 80 | const result = parseMarkdownRuleOrAssistantUnrolled(dubiousContent, mockId); |
modified packages/config-yaml/src/load/unroll.ts +3 −3
| @@ -465,14 +465,14 @@ | ||
| 465 | 465 | resolvedBlock, |
| 466 | 466 | source: |
| 467 | 467 | injectBlock.uriType === "file" |
| 468 | - ? injectBlock.filePath | |
| 468 | + ? injectBlock.fileUri | |
| 469 | 469 | : undefined, |
| 470 | 470 | error: null, |
| 471 | 471 | }; |
| 472 | 472 | } catch (err) { |
| 473 | 473 | let msg = ""; |
| 474 | 474 | if (injectBlock.uriType === "file") { |
| 475 | - msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`; | |
| 475 | + msg = `${(err as Error).message}.\n> ${injectBlock.fileUri}`; | |
| 476 | 476 | } else { |
| 477 | 477 | msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`; |
| 478 | 478 | } |
| @@ -669,7 +669,7 @@ | ||
| 669 | 669 | } catch (yamlError) { |
| 670 | 670 | if ( |
| 671 | 671 | id.uriType === "file" && |
| 672 | - [".yaml", ".yml"].some((ext) => id.filePath.endsWith(ext)) | |
| 672 | + [".yaml", ".yml"].some((ext) => id.fileUri.endsWith(ext)) | |
| 673 | 673 | ) { |
| 674 | 674 | throw yamlError; |
| 675 | 675 | } |
modified packages/config-yaml/src/markdown/createMarkdownRule.test.ts +1 −1
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | // Mock package identifier for testing |
| 10 | 10 | const mockPackageId: PackageIdentifier = { |
| 11 | 11 | uriType: "file", |
| 12 | - filePath: "/path/to/folder", | |
| 12 | + fileUri: "/path/to/folder", | |
| 13 | 13 | }; |
| 14 | 14 | |
| 15 | 15 | describe("sanitizeRuleName", () => { |
modified packages/config-yaml/src/markdown/markdownToRule.test.ts +11 −11
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | // Use a mock PackageIdentifier for testing |
| 6 | 6 | const mockId: PackageIdentifier = { |
| 7 | 7 | uriType: "file", |
| 8 | - filePath: "/path/to/file", | |
| 8 | + fileUri: "/path/to/file", | |
| 9 | 9 | }; |
| 10 | 10 | |
| 11 | 11 | it("should convert markdown with frontmatter to a rule", () => { |
| @@ -115,7 +115,7 @@ | ||
| 115 | 115 | |
| 116 | 116 | const result = markdownToRule(content, { |
| 117 | 117 | uriType: "file", |
| 118 | - filePath: "/", | |
| 118 | + fileUri: "/", | |
| 119 | 119 | }); |
| 120 | 120 | expect(result.globs).toBe("/**/src/**/Dockerfile"); |
| 121 | 121 | }); |
| @@ -151,7 +151,7 @@ | ||
| 151 | 151 | |
| 152 | 152 | const result = markdownToRule(content, { |
| 153 | 153 | uriType: "file", |
| 154 | - filePath: "/Documents/myproject/.continue/rules/rule1.md", | |
| 154 | + fileUri: "/Documents/myproject/.continue/rules/rule1.md", | |
| 155 | 155 | }); |
| 156 | 156 | expect(result.globs).toBe(".git"); |
| 157 | 157 | }); |
| @@ -268,7 +268,7 @@ | ||
| 268 | 268 | const frontmatter = { name: "Custom Rule Name" }; |
| 269 | 269 | const id: PackageIdentifier = { |
| 270 | 270 | uriType: "file", |
| 271 | - filePath: "/path/to/my-rule.md", | |
| 271 | + fileUri: "/path/to/my-rule.md", | |
| 272 | 272 | }; |
| 273 | 273 | |
| 274 | 274 | const result = getRuleName(frontmatter, id); |
| @@ -279,7 +279,7 @@ | ||
| 279 | 279 | const frontmatter = {}; |
| 280 | 280 | const id: PackageIdentifier = { |
| 281 | 281 | uriType: "file", |
| 282 | - filePath: "/long/path/to/rules/my-rule.md", | |
| 282 | + fileUri: "/long/path/to/rules/my-rule.md", | |
| 283 | 283 | }; |
| 284 | 284 | |
| 285 | 285 | const result = getRuleName(frontmatter, id); |
| @@ -290,7 +290,7 @@ | ||
| 290 | 290 | const frontmatter = {}; |
| 291 | 291 | const id: PackageIdentifier = { |
| 292 | 292 | uriType: "file", |
| 293 | - filePath: "C:\\long\\path\\to\\rules\\my-rule.md", | |
| 293 | + fileUri: "C:\\long\\path\\to\\rules\\my-rule.md", | |
| 294 | 294 | }; |
| 295 | 295 | |
| 296 | 296 | const result = getRuleName(frontmatter, id); |
| @@ -301,7 +301,7 @@ | ||
| 301 | 301 | const frontmatter = {}; |
| 302 | 302 | const id: PackageIdentifier = { |
| 303 | 303 | uriType: "file", |
| 304 | - filePath: "/path/to\\rules/my-rule.md", | |
| 304 | + fileUri: "/path/to\\rules/my-rule.md", | |
| 305 | 305 | }; |
| 306 | 306 | |
| 307 | 307 | const result = getRuleName(frontmatter, id); |
| @@ -312,7 +312,7 @@ | ||
| 312 | 312 | const frontmatter = {}; |
| 313 | 313 | const id: PackageIdentifier = { |
| 314 | 314 | uriType: "file", |
| 315 | - filePath: "my-rule.md", | |
| 315 | + fileUri: "my-rule.md", | |
| 316 | 316 | }; |
| 317 | 317 | |
| 318 | 318 | const result = getRuleName(frontmatter, id); |
| @@ -323,7 +323,7 @@ | ||
| 323 | 323 | const frontmatter = {}; |
| 324 | 324 | const id: PackageIdentifier = { |
| 325 | 325 | uriType: "file", |
| 326 | - filePath: "rules/my-rule.md", | |
| 326 | + fileUri: "rules/my-rule.md", | |
| 327 | 327 | }; |
| 328 | 328 | |
| 329 | 329 | const result = getRuleName(frontmatter, id); |
| @@ -349,7 +349,7 @@ | ||
| 349 | 349 | const frontmatter = { name: "Override Name" }; |
| 350 | 350 | const id: PackageIdentifier = { |
| 351 | 351 | uriType: "file", |
| 352 | - filePath: "/very/long/path/to/rules/original-name.md", | |
| 352 | + fileUri: "/very/long/path/to/rules/original-name.md", | |
| 353 | 353 | }; |
| 354 | 354 | |
| 355 | 355 | const result = getRuleName(frontmatter, id); |
| @@ -360,7 +360,7 @@ | ||
| 360 | 360 | const frontmatter = { name: "" }; |
| 361 | 361 | const id: PackageIdentifier = { |
| 362 | 362 | uriType: "file", |
| 363 | - filePath: "/path/to/rules/my-rule.md", | |
| 363 | + fileUri: "/path/to/rules/my-rule.md", | |
| 364 | 364 | }; |
| 365 | 365 | |
| 366 | 366 | const result = getRuleName(frontmatter, id); |
modified packages/config-yaml/src/markdown/markdownToRule.ts +5 −2
| @@ -77,7 +77,10 @@ | ||
| 77 | 77 | if (id.uriType !== "file") { |
| 78 | 78 | return globs; |
| 79 | 79 | } |
| 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. | |
| 81 | 84 | if (dir.includes(".continue")) { |
| 82 | 85 | return globs; |
| 83 | 86 | } |
| @@ -112,6 +115,6 @@ | ||
| 112 | 115 | regex: frontmatter.regex, |
| 113 | 116 | description: frontmatter.description, |
| 114 | 117 | alwaysApply: frontmatter.alwaysApply, |
| 115 | - sourceFile: id.uriType === "file" ? id.filePath : undefined, | |
| 118 | + sourceFile: id.uriType === "file" ? id.fileUri : undefined, | |
| 116 | 119 | }; |
| 117 | 120 | } |
modified packages/config-yaml/src/registryClient.test.ts +1 −1
| @@ -95,7 +95,7 @@ | ||
| 95 | 95 | |
| 96 | 96 | const id: PackageIdentifier = { |
| 97 | 97 | uriType: "file", |
| 98 | - filePath: testFilePath, | |
| 98 | + fileUri: testFilePath, | |
| 99 | 99 | }; |
| 100 | 100 | |
| 101 | 101 | const result = await client.getContent(id); |
modified packages/config-yaml/src/registryClient.ts +1 −1
| @@ -26,7 +26,7 @@ | ||
| 26 | 26 | async getContent(id: PackageIdentifier): Promise<string> { |
| 27 | 27 | switch (id.uriType) { |
| 28 | 28 | case "file": |
| 29 | - return this.getContentFromFilePath(id.filePath); | |
| 29 | + return this.getContentFromFilePath(id.fileUri); | |
| 30 | 30 | case "slug": |
| 31 | 31 | return this.getContentFromSlug(id.fullSlug); |
| 32 | 32 | default: |