From c2571e2a86e373199fe9660f95fa5b168c776035 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 2 Jun 2025 14:33:51 -0700 Subject: [PATCH 01/28] feat: create markdown rules in notch --- .../markdown/createMarkdownRule.test.ts | 157 ++++++++++++++++++ core/config/markdown/createMarkdownRule.ts | 75 +++++++++ core/config/markdown/index.ts | 5 + core/config/workspace/workspaceBlocks.test.ts | 141 ++++++++++++++++ core/config/workspace/workspaceBlocks.ts | 100 +++++++++-- core/tools/definitions/createRuleBlock.ts | 5 - .../implementations/createRuleBlock.test.ts | 18 +- core/tools/implementations/createRuleBlock.ts | 53 ++---- .../Lump/sections/ExploreBlocksButton.tsx | 16 +- .../mainInput/Lump/sections/RulesSection.tsx | 17 +- 10 files changed, 498 insertions(+), 89 deletions(-) create mode 100644 core/config/markdown/createMarkdownRule.test.ts create mode 100644 core/config/markdown/createMarkdownRule.ts create mode 100644 core/config/markdown/index.ts create mode 100644 core/config/workspace/workspaceBlocks.test.ts diff --git a/core/config/markdown/createMarkdownRule.test.ts b/core/config/markdown/createMarkdownRule.test.ts new file mode 100644 index 000000000..fdc6536ee --- /dev/null +++ b/core/config/markdown/createMarkdownRule.test.ts @@ -0,0 +1,157 @@ +import { + createMarkdownWithFrontmatter, + createRuleFilePath, + createRuleMarkdown, + sanitizeRuleName, +} from "./createMarkdownRule"; +import { parseMarkdownRule } from "./parseMarkdownRule"; + +describe("sanitizeRuleName", () => { + it("should sanitize rule names for filenames", () => { + expect(sanitizeRuleName("My Test Rule")).toBe("my-test-rule"); + expect(sanitizeRuleName("Rule with @#$% chars")).toBe("rule-with-chars"); + expect(sanitizeRuleName("Multiple spaces")).toBe("multiple-spaces"); + expect(sanitizeRuleName("UPPERCASE-rule")).toBe("uppercase-rule"); + expect(sanitizeRuleName("already-sanitized")).toBe("already-sanitized"); + }); + + it("should handle empty and edge case inputs", () => { + expect(sanitizeRuleName("")).toBe(""); + expect(sanitizeRuleName(" ")).toBe(""); + expect(sanitizeRuleName("123")).toBe("123"); + expect(sanitizeRuleName("rule-with-numbers-123")).toBe( + "rule-with-numbers-123", + ); + }); +}); + +describe("createRuleFilePath", () => { + it("should create correct rule file path", () => { + const result = createRuleFilePath("/workspace", "My Test Rule"); + expect(result).toBe("/workspace/.continue/rules/my-test-rule.md"); + }); + + it("should handle special characters in rule name", () => { + const result = createRuleFilePath("/home/user", "Rule with @#$% chars"); + expect(result).toBe("/home/user/.continue/rules/rule-with-chars.md"); + }); + + it("should handle edge case rule names", () => { + const result = createRuleFilePath("/test", " Multiple Spaces "); + expect(result).toBe("/test/.continue/rules/multiple-spaces.md"); + }); +}); + +describe("createMarkdownWithFrontmatter", () => { + it("should create properly formatted markdown with frontmatter", () => { + const frontmatter = { + name: "Test Rule", + description: "A test rule", + globs: "*.ts", + }; + const markdown = "# Test Rule\n\nThis is a test rule."; + + const result = createMarkdownWithFrontmatter(frontmatter, markdown); + + // The exact quote style doesn't matter as long as it parses correctly + expect(result).toContain("name: Test Rule"); + expect(result).toContain("description: A test rule"); + expect(result).toContain("globs:"); + expect(result).toContain("*.ts"); + expect(result).toContain("---\n\n# Test Rule\n\nThis is a test rule."); + }); + + it("should handle empty frontmatter", () => { + const frontmatter = {}; + const markdown = "# Simple Rule\n\nJust markdown content."; + + const result = createMarkdownWithFrontmatter(frontmatter, markdown); + + const expected = `--- +{} +--- + +# Simple Rule + +Just markdown content.`; + + expect(result).toBe(expected); + }); + + it("should create content that can be parsed back correctly", () => { + const originalFrontmatter = { + name: "Roundtrip Test", + description: "Testing roundtrip parsing", + globs: ["*.js", "*.ts"], + alwaysApply: true, + }; + const originalMarkdown = + "# Roundtrip Test\n\nThis should parse back correctly."; + + const created = createMarkdownWithFrontmatter( + originalFrontmatter, + originalMarkdown, + ); + const parsed = parseMarkdownRule(created); + + expect(parsed.frontmatter).toEqual(originalFrontmatter); + expect(parsed.markdown).toBe(originalMarkdown); + }); +}); + +describe("createRuleMarkdown", () => { + it("should create rule markdown with all options", () => { + const result = createRuleMarkdown("Test Rule", "This is the rule content", { + description: "Test description", + globs: ["*.ts", "*.js"], + alwaysApply: true, + }); + + const parsed = parseMarkdownRule(result); + + expect(parsed.frontmatter.description).toBe("Test description"); + expect(parsed.frontmatter.globs).toEqual(["*.ts", "*.js"]); + expect(parsed.frontmatter.alwaysApply).toBe(true); + expect(parsed.markdown).toBe("# Test Rule\n\nThis is the rule content"); + }); + + it("should create rule markdown with minimal options", () => { + const result = createRuleMarkdown("Simple Rule", "Simple content"); + + const parsed = parseMarkdownRule(result); + + expect(parsed.frontmatter.description).toBeUndefined(); + expect(parsed.frontmatter.globs).toBeUndefined(); + expect(parsed.frontmatter.alwaysApply).toBeUndefined(); + expect(parsed.markdown).toBe("# Simple Rule\n\nSimple content"); + }); + + it("should handle string globs", () => { + const result = createRuleMarkdown("String Glob Rule", "Content", { + globs: "*.py", + }); + + const parsed = parseMarkdownRule(result); + expect(parsed.frontmatter.globs).toBe("*.py"); + }); + + it("should trim description and globs", () => { + const result = createRuleMarkdown("Trim Test", "Content", { + description: " spaced description ", + globs: " *.ts ", + }); + + const parsed = parseMarkdownRule(result); + expect(parsed.frontmatter.description).toBe("spaced description"); + expect(parsed.frontmatter.globs).toBe("*.ts"); + }); + + it("should handle alwaysApply false explicitly", () => { + const result = createRuleMarkdown("Always Apply False", "Content", { + alwaysApply: false, + }); + + const parsed = parseMarkdownRule(result); + expect(parsed.frontmatter.alwaysApply).toBe(false); + }); +}); diff --git a/core/config/markdown/createMarkdownRule.ts b/core/config/markdown/createMarkdownRule.ts new file mode 100644 index 000000000..8d7b8efe5 --- /dev/null +++ b/core/config/markdown/createMarkdownRule.ts @@ -0,0 +1,75 @@ +import * as YAML from "yaml"; +import { joinPathsToUri } from "../../util/uri"; +import { RuleFrontmatter } from "./parseMarkdownRule"; + +export const RULE_FILE_EXTENSION = "md"; + +/** + * Sanitizes a rule name for use in filenames (removes special chars, replaces spaces with dashes) + */ +export function sanitizeRuleName(name: string): string { + return name + .toLowerCase() + .replace(/[^a-z0-9\s-]/g, "") + .replace(/\s+/g, "-") + .replace(/^-+|-+$/g, ""); // Remove leading/trailing dashes +} + +/** + * Creates the file path for a rule in the workspace .continue/rules directory + */ +export function createRuleFilePath( + workspaceDir: string, + ruleName: string, +): string { + const safeRuleName = sanitizeRuleName(ruleName); + return joinPathsToUri( + workspaceDir, + ".continue", + "rules", + `${safeRuleName}.${RULE_FILE_EXTENSION}`, + ); +} + +/** + * Creates markdown content with YAML frontmatter in the format expected by parseMarkdownRule + */ +export function createMarkdownWithFrontmatter( + frontmatter: RuleFrontmatter, + markdown: string, +): string { + const frontmatterStr = YAML.stringify(frontmatter).trim(); + return `---\n${frontmatterStr}\n---\n\n${markdown}`; +} + +/** + * Creates a rule markdown file content from rule components + */ +export function createRuleMarkdown( + name: string, + ruleContent: string, + options: { + description?: string; + globs?: string | string[]; + alwaysApply?: boolean; + } = {}, +): string { + const frontmatter: RuleFrontmatter = {}; + + if (options.globs) { + frontmatter.globs = + typeof options.globs === "string" ? options.globs.trim() : options.globs; + } + + if (options.description) { + frontmatter.description = options.description.trim(); + } + + if (options.alwaysApply !== undefined) { + frontmatter.alwaysApply = options.alwaysApply; + } + + const markdownBody = `# ${name}\n\n${ruleContent}`; + + return createMarkdownWithFrontmatter(frontmatter, markdownBody); +} diff --git a/core/config/markdown/index.ts b/core/config/markdown/index.ts new file mode 100644 index 000000000..db984b0c3 --- /dev/null +++ b/core/config/markdown/index.ts @@ -0,0 +1,5 @@ +export * from "./parseMarkdownRule"; + +export * from "./createMarkdownRule"; + +export * from "./loadMarkdownRules"; diff --git a/core/config/workspace/workspaceBlocks.test.ts b/core/config/workspace/workspaceBlocks.test.ts new file mode 100644 index 000000000..d0b891c1b --- /dev/null +++ b/core/config/workspace/workspaceBlocks.test.ts @@ -0,0 +1,141 @@ +import { BlockType } from "@continuedev/config-yaml"; +import { describe, expect, test } from "@jest/globals"; +import { RULE_FILE_EXTENSION } from "../markdown"; +import { blockTypeToSingular, findAvailableFilename } from "./workspaceBlocks"; + +describe("blockTypeToSingular", () => { + test("converts block types to singular form correctly", () => { + expect(blockTypeToSingular("models")).toBe("model"); + expect(blockTypeToSingular("context")).toBe("context"); + expect(blockTypeToSingular("rules")).toBe("rule"); + expect(blockTypeToSingular("docs")).toBe("doc"); + expect(blockTypeToSingular("prompts")).toBe("prompt"); + expect(blockTypeToSingular("mcpServers")).toBe("mcp-server"); + }); +}); + +describe("findAvailableFilename", () => { + test("returns base filename when it doesn't exist", async () => { + const mockFileExists = async (uri: string) => false; + + const result = await findAvailableFilename( + "/workspace/.continue/models", + "models", + mockFileExists, + ); + + expect(result).toBe("/workspace/.continue/models/new-model.yaml"); + }); + + test("returns filename with counter when base exists", async () => { + const mockFileExists = async (uri: string) => { + return uri === "/workspace/.continue/models/new-model.yaml"; + }; + + const result = await findAvailableFilename( + "/workspace/.continue/models", + "models", + mockFileExists, + ); + + expect(result).toBe("/workspace/.continue/models/new-model-1.yaml"); + }); + + test("increments counter until available filename is found", async () => { + const existingFiles = new Set([ + "/workspace/.continue/context/new-context.yaml", + "/workspace/.continue/context/new-context-1.yaml", + "/workspace/.continue/context/new-context-2.yaml", + ]); + + const mockFileExists = async (uri: string) => { + return existingFiles.has(uri); + }; + + const result = await findAvailableFilename( + "/workspace/.continue/context", + "context", + mockFileExists, + ); + + expect(result).toBe("/workspace/.continue/context/new-context-3.yaml"); + }); + + test("handles different block types correctly with proper extensions", async () => { + const mockFileExists = async (uri: string) => false; + + const testCases: Array<{ blockType: BlockType; expected: string }> = [ + { blockType: "models", expected: "/test/new-model.yaml" }, + { blockType: "context", expected: "/test/new-context.yaml" }, + { blockType: "rules", expected: `/test/new-rule.${RULE_FILE_EXTENSION}` }, + { blockType: "docs", expected: "/test/new-doc.yaml" }, + { blockType: "prompts", expected: "/test/new-prompt.yaml" }, + { blockType: "mcpServers", expected: "/test/new-mcp-server.yaml" }, + ]; + + for (const { blockType, expected } of testCases) { + const result = await findAvailableFilename( + "/test", + blockType, + mockFileExists, + ); + expect(result).toBe(expected); + } + }); + + test("respects custom extension parameter", async () => { + const mockFileExists = async (uri: string) => false; + + const result = await findAvailableFilename( + "/test", + "models", + mockFileExists, + "json", + ); + + expect(result).toBe("/test/new-model.json"); + }); + + test("handles rules markdown files with counter", async () => { + const existingFiles = new Set([ + `/workspace/.continue/rules/new-rule.${RULE_FILE_EXTENSION}`, + `/workspace/.continue/rules/new-rule-1.${RULE_FILE_EXTENSION}`, + ]); + + const mockFileExists = async (uri: string) => { + return existingFiles.has(uri); + }; + + const result = await findAvailableFilename( + "/workspace/.continue/rules", + "rules", + mockFileExists, + ); + + expect(result).toBe( + `/workspace/.continue/rules/new-rule-2.${RULE_FILE_EXTENSION}`, + ); + }); + + test("handles large counter values", async () => { + const existingFiles = new Set( + Array.from({ length: 100 }, (_, i) => + i === 0 + ? "/workspace/.continue/prompts/new-prompt.yaml" + : `/workspace/.continue/prompts/new-prompt-${i}.yaml`, + ), + ); + + const mockFileExists = async (uri: string) => { + return existingFiles.has(uri); + }; + + const result = await findAvailableFilename( + "/workspace/.continue/prompts", + "prompts", + mockFileExists, + ); + + expect(result).toBe("/workspace/.continue/prompts/new-prompt-100.yaml"); + }); +}); diff --git a/core/config/workspace/workspaceBlocks.ts b/core/config/workspace/workspaceBlocks.ts index 009e3cdff..46e0d13b2 100644 --- a/core/config/workspace/workspaceBlocks.ts +++ b/core/config/workspace/workspaceBlocks.ts @@ -2,10 +2,35 @@ import { BlockType, ConfigYaml } from "@continuedev/config-yaml"; import * as YAML from "yaml"; import { IDE } from "../.."; import { joinPathsToUri } from "../../util/uri"; +import { + RULE_FILE_EXTENSION, + createMarkdownWithFrontmatter, + type RuleFrontmatter, +} from "../markdown"; + +export function blockTypeToSingular(blockType: BlockType): string { + switch (blockType) { + case "context": + return "context"; + case "models": + return "model"; + case "rules": + return "rule"; + case "docs": + return "doc"; + case "prompts": + return "prompt"; + case "mcpServers": + return "mcp-server"; + default: + // Fallback to slice approach for any new block types + return blockType.slice(0, -1); + } +} function getContentsForNewBlock(blockType: BlockType): ConfigYaml { const configYaml: ConfigYaml = { - name: `New ${blockType.slice(0, -1)}`, + name: `New ${blockTypeToSingular(blockType)}`, version: "0.0.1", schema: "v1", }; @@ -64,6 +89,51 @@ function getContentsForNewBlock(blockType: BlockType): ConfigYaml { return configYaml; } +function getFileExtension(blockType: BlockType): string { + return blockType === "rules" ? RULE_FILE_EXTENSION : "yaml"; +} + +/** + * Creates a new rule markdown file content with default values + * Only used by workspace block creation + */ +function createNewRuleMarkdown( + name: string = "New rule", + description: string = "Rule description", +): string { + const frontmatter: RuleFrontmatter = { + name, + description, + }; + + const markdownBody = `# ${name}\n\nWrite your rule content here.`; + + return createMarkdownWithFrontmatter(frontmatter, markdownBody); +} + +export async function findAvailableFilename( + baseDirUri: string, + blockType: BlockType, + fileExists: (uri: string) => Promise, + extension?: string, +): Promise { + const baseFilename = `new-${blockTypeToSingular(blockType)}`; + const fileExtension = extension ?? getFileExtension(blockType); + let counter = 0; + let fileUri: string; + + do { + const suffix = counter === 0 ? "" : `-${counter}`; + fileUri = joinPathsToUri( + baseDirUri, + `${baseFilename}${suffix}.${fileExtension}`, + ); + counter++; + } while (await fileExists(fileUri)); + + return fileUri; +} + export async function createNewWorkspaceBlockFile( ide: IDE, blockType: BlockType, @@ -77,21 +147,19 @@ export async function createNewWorkspaceBlockFile( const baseDirUri = joinPathsToUri(workspaceDirs[0], `.continue/${blockType}`); - // Find the first available filename - let counter = 0; - let fileUri: string; - do { - const suffix = counter === 0 ? "" : `-${counter}`; - fileUri = joinPathsToUri( - baseDirUri, - `new-${blockType.slice(0, -1)}${suffix}.yaml`, - ); - counter++; - } while (await ide.fileExists(fileUri)); - - await ide.writeFile( - fileUri, - YAML.stringify(getContentsForNewBlock(blockType)), + const fileUri = await findAvailableFilename( + baseDirUri, + blockType, + ide.fileExists.bind(ide), ); + + let fileContent: string; + if (blockType === "rules") { + fileContent = createNewRuleMarkdown(); + } else { + fileContent = YAML.stringify(getContentsForNewBlock(blockType)); + } + + await ide.writeFile(fileUri, fileContent); await ide.openFile(fileUri); } diff --git a/core/tools/definitions/createRuleBlock.ts b/core/tools/definitions/createRuleBlock.ts index 011ab4985..ace3bc6b2 100644 --- a/core/tools/definitions/createRuleBlock.ts +++ b/core/tools/definitions/createRuleBlock.ts @@ -37,11 +37,6 @@ export const createRuleBlock: Tool = { description: "Optional file patterns to which this rule applies (e.g. ['**/*.{ts,tsx}'] or ['src/**/*.ts', 'tests/**/*.ts'])", }, - alwaysApply: { - type: "boolean", - description: - "Whether this rule should always be applied regardless of file pattern matching", - }, }, }, }, diff --git a/core/tools/implementations/createRuleBlock.test.ts b/core/tools/implementations/createRuleBlock.test.ts index 4a789143c..343eb75d4 100644 --- a/core/tools/implementations/createRuleBlock.test.ts +++ b/core/tools/implementations/createRuleBlock.test.ts @@ -1,4 +1,4 @@ -import { parseMarkdownRule } from "../../config/markdown/parseMarkdownRule"; +import { parseMarkdownRule } from "../../config/markdown"; import { createRuleBlockImpl } from "./createRuleBlock"; // Mock the extras parameter with necessary functions @@ -21,6 +21,8 @@ describe("createRuleBlockImpl", () => { const args = { name: "TypeScript Rule", rule: "Use interfaces for object shapes", + description: "Always use interfaces", + alwaysApply: true, globs: "**/*.{ts,tsx}", }; @@ -31,23 +33,27 @@ describe("createRuleBlockImpl", () => { const { frontmatter, markdown } = parseMarkdownRule(fileContent); expect(frontmatter).toEqual({ + description: "Always use interfaces", globs: "**/*.{ts,tsx}", + alwaysApply: true, }); expect(markdown).toContain("# TypeScript Rule"); expect(markdown).toContain("Use interfaces for object shapes"); }); - it("should create a filename based on sanitized rule name", async () => { + it("should create a filename based on sanitized rule name using shared path function", async () => { const args = { name: "Special Ch@racters & Spaces", rule: "Handle special characters", + description: "Test rule", + alwaysApply: false, }; await createRuleBlockImpl(args, mockExtras as any); const fileUri = mockIde.writeFile.mock.calls[0][0]; - expect(fileUri).toContain("special-chracters-spaces.md"); + expect(fileUri).toBe("/.continue/rules/special-chracters-spaces.md"); }); it("should create a rule with description pattern", async () => { @@ -55,6 +61,7 @@ describe("createRuleBlockImpl", () => { name: "Description Test", rule: "This is the rule content", description: "This is a detailed explanation of the rule", + alwaysApply: true, }; await createRuleBlockImpl(args, mockExtras as any); @@ -65,6 +72,7 @@ describe("createRuleBlockImpl", () => { expect(frontmatter).toEqual({ description: "This is a detailed explanation of the rule", + alwaysApply: true, }); expect(markdown).toContain("# Description Test"); @@ -76,6 +84,7 @@ describe("createRuleBlockImpl", () => { name: "Complete Rule", rule: "Follow this standard", description: "This rule enforces our team standards", + alwaysApply: false, globs: "**/*.js", }; @@ -88,6 +97,7 @@ describe("createRuleBlockImpl", () => { expect(frontmatter).toEqual({ description: "This rule enforces our team standards", globs: "**/*.js", + alwaysApply: false, }); expect(markdown).toContain("# Complete Rule"); @@ -98,6 +108,7 @@ describe("createRuleBlockImpl", () => { const args = { name: "Conditional Rule", rule: "This rule should not always be applied", + description: "Optional rule", alwaysApply: false, }; @@ -108,6 +119,7 @@ describe("createRuleBlockImpl", () => { const { frontmatter } = parseMarkdownRule(fileContent); expect(frontmatter).toEqual({ + description: "Optional rule", alwaysApply: false, }); }); diff --git a/core/tools/implementations/createRuleBlock.ts b/core/tools/implementations/createRuleBlock.ts index 0d2d58f68..d47d2ddfc 100644 --- a/core/tools/implementations/createRuleBlock.ts +++ b/core/tools/implementations/createRuleBlock.ts @@ -1,8 +1,6 @@ -import * as YAML from "yaml"; import { ToolImpl } from "."; import { RuleWithSource } from "../.."; -import { RuleFrontmatter } from "../../config/markdown/parseMarkdownRule"; -import { joinPathsToUri } from "../../util/uri"; +import { createRuleFilePath, createRuleMarkdown } from "../../config/markdown"; export type CreateRuleBlockArgs = Pick< Required, @@ -14,48 +12,17 @@ export const createRuleBlockImpl: ToolImpl = async ( args: CreateRuleBlockArgs, extras, ) => { - // Sanitize rule name for use in filename (remove special chars, replace spaces with dashes) - const safeRuleName = args.name - .toLowerCase() - .replace(/[^a-z0-9\s-]/g, "") - .replace(/\s+/g, "-"); + // Create markdown content using shared utility + const fileContent = createRuleMarkdown(args.name, args.rule, { + description: args.description, + globs: args.globs, + }); - const fileExtension = "md"; - - const frontmatter: RuleFrontmatter = {}; - - if (args.globs) { - frontmatter.globs = - typeof args.globs === "string" ? args.globs.trim() : args.globs; - } - - if (args.description) { - frontmatter.description = args.description.trim(); - } - - if (args.alwaysApply !== undefined) { - frontmatter.alwaysApply = args.alwaysApply; - } - - const frontmatterYaml = YAML.stringify(frontmatter).trim(); - let fileContent = `--- -${frontmatterYaml} ---- - -# ${args.name} - -${args.rule} -`; const [localContinueDir] = await extras.ide.getWorkspaceDirs(); - const rulesDirUri = joinPathsToUri( - localContinueDir, - ".continue", - "rules", - `${safeRuleName}.${fileExtension}`, - ); + const ruleFilePath = createRuleFilePath(localContinueDir, args.name); - await extras.ide.writeFile(rulesDirUri, fileContent); - await extras.ide.openFile(rulesDirUri); + await extras.ide.writeFile(ruleFilePath, fileContent); + await extras.ide.openFile(ruleFilePath); return [ { @@ -63,7 +30,7 @@ ${args.rule} description: args.description || "", uri: { type: "file", - value: rulesDirUri, + value: ruleFilePath, }, content: `Rule created successfully`, }, diff --git a/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx b/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx index 0a24e8fcf..532fc030b 100644 --- a/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx +++ b/gui/src/components/mainInput/Lump/sections/ExploreBlocksButton.tsx @@ -7,13 +7,11 @@ import { useContext } from "react"; import { GhostButton } from "../../.."; import { useAuth } from "../../../../context/Auth"; import { IdeMessengerContext } from "../../../../context/IdeMessenger"; -import { useAppDispatch } from "../../../../redux/hooks"; import { fontSize } from "../../../../util"; export function ExploreBlocksButton(props: { blockType: string }) { const { selectedProfile } = useAuth(); const ideMessenger = useContext(IdeMessengerContext); - const dispatch = useAppDispatch(); const isLocal = selectedProfile?.profileType === "local"; @@ -26,21 +24,11 @@ export function ExploreBlocksButton(props: { blockType: string }) { const handleClick = () => { if (isLocal) { - ideMessenger.request("config/addLocalWorkspaceBlock", { + void ideMessenger.request("config/addLocalWorkspaceBlock", { blockType: props.blockType as BlockType, }); - // switch (props.blockType) { - // case "docs": - // dispatch(setShowDialog(true)); - // dispatch(setDialogMessage()); - // break; - // default: - // ideMessenger.request("config/openProfile", { - // profileId: selectedProfile.id, - // }); - // } } else { - ideMessenger.request("controlPlane/openUrl", { + void ideMessenger.request("controlPlane/openUrl", { path: `new?type=block&blockType=${props.blockType}`, orgSlug: undefined, }); diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index fa9dff106..375bcde29 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -6,10 +6,10 @@ import { } from "@heroicons/react/24/outline"; import { RuleWithSource } from "core"; import { + DEFAULT_AGENT_SYSTEM_MESSAGE, + DEFAULT_AGENT_SYSTEM_MESSAGE_URL, DEFAULT_CHAT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE_URL, - DEFAULT_AGENT_SYSTEM_MESSAGE, - DEFAULT_AGENT_SYSTEM_MESSAGE_URL } from "core/llm/constructMessages"; import { useContext, useMemo } from "react"; import { defaultBorderRadius, vscCommandCenterActiveBorder } from "../../.."; @@ -35,7 +35,7 @@ const RuleCard: React.FC = ({ rule }) => { const handleOpen = async () => { if (rule.slug) { - ideMessenger.request("controlPlane/openUrl", { + void ideMessenger.request("controlPlane/openUrl", { path: `${rule.slug}/new-version`, orgSlug: undefined, }); @@ -112,7 +112,8 @@ const RuleCard: React.FC = ({ rule }) => { {" "} - {rule.source === "default-chat" || rule.source === "default-agent" ? ( + {rule.source === "default-chat" || + rule.source === "default-agent" ? ( @@ -195,24 +196,24 @@ export function RulesSection() { rules.unshift({ rule: config.selectedModelByRole.chat?.baseAgentSystemMessage, source: "model-agent-options", - }) + }); } else { rules.unshift({ rule: DEFAULT_AGENT_SYSTEM_MESSAGE, source: "default-agent", - }) + }); } } else { if (config.selectedModelByRole.chat?.baseChatSystemMessage) { rules.unshift({ rule: config.selectedModelByRole.chat?.baseChatSystemMessage, source: "model-chat-options", - }) + }); } else { rules.unshift({ rule: DEFAULT_CHAT_SYSTEM_MESSAGE, source: "default-chat", - }) + }); } } From 59620221fb8dc5b8c307394d3658efba894b4954 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 2 Jun 2025 14:43:02 -0700 Subject: [PATCH 02/28] update tests --- core/config/markdown/index.ts | 4 +- core/config/workspace/workspaceBlocks.test.ts | 60 ++++++++++++++++++- core/config/workspace/workspaceBlocks.ts | 59 +++++++++--------- 3 files changed, 90 insertions(+), 33 deletions(-) diff --git a/core/config/markdown/index.ts b/core/config/markdown/index.ts index db984b0c3..feb841e75 100644 --- a/core/config/markdown/index.ts +++ b/core/config/markdown/index.ts @@ -1,5 +1,3 @@ -export * from "./parseMarkdownRule"; - export * from "./createMarkdownRule"; - export * from "./loadMarkdownRules"; +export * from "./parseMarkdownRule"; diff --git a/core/config/workspace/workspaceBlocks.test.ts b/core/config/workspace/workspaceBlocks.test.ts index d0b891c1b..ba93bb19e 100644 --- a/core/config/workspace/workspaceBlocks.test.ts +++ b/core/config/workspace/workspaceBlocks.test.ts @@ -1,7 +1,12 @@ import { BlockType } from "@continuedev/config-yaml"; import { describe, expect, test } from "@jest/globals"; import { RULE_FILE_EXTENSION } from "../markdown"; -import { blockTypeToSingular, findAvailableFilename } from "./workspaceBlocks"; +import { + blockTypeToFilename, + blockTypeToSingular, + findAvailableFilename, + getFileContent, +} from "./workspaceBlocks"; describe("blockTypeToSingular", () => { test("converts block types to singular form correctly", () => { @@ -10,7 +15,58 @@ describe("blockTypeToSingular", () => { expect(blockTypeToSingular("rules")).toBe("rule"); expect(blockTypeToSingular("docs")).toBe("doc"); expect(blockTypeToSingular("prompts")).toBe("prompt"); - expect(blockTypeToSingular("mcpServers")).toBe("mcp-server"); + expect(blockTypeToSingular("mcpServers")).toBe("MCP server"); + }); +}); + +describe("blockTypeToFilename", () => { + test("converts block types to filename-safe singular form correctly", () => { + expect(blockTypeToFilename("models")).toBe("model"); + expect(blockTypeToFilename("context")).toBe("context"); + expect(blockTypeToFilename("rules")).toBe("rule"); + expect(blockTypeToFilename("docs")).toBe("doc"); + expect(blockTypeToFilename("prompts")).toBe("prompt"); + expect(blockTypeToFilename("mcpServers")).toBe("mcp-server"); + }); +}); + +describe("getFileContent", () => { + test("returns markdown content for rules block type", () => { + const result = getFileContent("rules"); + expect(result).toContain("# New Rule"); + expect(result).toContain("Your rule content"); + expect(result).toContain("A description of your rule"); + }); + + test("returns YAML content for non-rules block types", () => { + const result = getFileContent("models"); + expect(result).toContain("name: New model"); + expect(result).toContain("version: 0.0.1"); + expect(result).toContain("schema: v1"); + expect(result).toContain("models:"); + expect(result).toContain("provider: anthropic"); + }); + + test("generates correct YAML for different block types", () => { + const contextResult = getFileContent("context"); + expect(contextResult).toContain("name: New context"); + expect(contextResult).toContain("context:"); + expect(contextResult).toContain("provider: file"); + + const docsResult = getFileContent("docs"); + expect(docsResult).toContain("name: New doc"); + expect(docsResult).toContain("docs:"); + expect(docsResult).toContain("startUrl: https://docs.continue.dev"); + + const promptsResult = getFileContent("prompts"); + expect(promptsResult).toContain("name: New prompt"); + expect(promptsResult).toContain("prompts:"); + expect(promptsResult).toContain("thorough suite of unit tests"); + + const mcpResult = getFileContent("mcpServers"); + expect(mcpResult).toContain("name: New MCP server"); + expect(mcpResult).toContain("mcpServers:"); + expect(mcpResult).toContain("command: npx"); }); }); diff --git a/core/config/workspace/workspaceBlocks.ts b/core/config/workspace/workspaceBlocks.ts index 46e0d13b2..d54d2c823 100644 --- a/core/config/workspace/workspaceBlocks.ts +++ b/core/config/workspace/workspaceBlocks.ts @@ -2,13 +2,29 @@ import { BlockType, ConfigYaml } from "@continuedev/config-yaml"; import * as YAML from "yaml"; import { IDE } from "../.."; import { joinPathsToUri } from "../../util/uri"; -import { - RULE_FILE_EXTENSION, - createMarkdownWithFrontmatter, - type RuleFrontmatter, -} from "../markdown"; +import { RULE_FILE_EXTENSION, createRuleMarkdown } from "../markdown"; export function blockTypeToSingular(blockType: BlockType): string { + switch (blockType) { + case "context": + return "context"; + case "models": + return "model"; + case "rules": + return "rule"; + case "docs": + return "doc"; + case "prompts": + return "prompt"; + case "mcpServers": + return "MCP server"; + default: + // Fallback to slice approach for any new block types + return blockType.slice(0, -1); + } +} + +export function blockTypeToFilename(blockType: BlockType): string { switch (blockType) { case "context": return "context"; @@ -93,22 +109,14 @@ function getFileExtension(blockType: BlockType): string { return blockType === "rules" ? RULE_FILE_EXTENSION : "yaml"; } -/** - * Creates a new rule markdown file content with default values - * Only used by workspace block creation - */ -function createNewRuleMarkdown( - name: string = "New rule", - description: string = "Rule description", -): string { - const frontmatter: RuleFrontmatter = { - name, - description, - }; - - const markdownBody = `# ${name}\n\nWrite your rule content here.`; - - return createMarkdownWithFrontmatter(frontmatter, markdownBody); +export function getFileContent(blockType: BlockType): string { + if (blockType === "rules") { + return createRuleMarkdown("New Rule", "Your rule content", { + description: "A description of your rule", + }); + } else { + return YAML.stringify(getContentsForNewBlock(blockType)); + } } export async function findAvailableFilename( @@ -117,7 +125,7 @@ export async function findAvailableFilename( fileExists: (uri: string) => Promise, extension?: string, ): Promise { - const baseFilename = `new-${blockTypeToSingular(blockType)}`; + const baseFilename = `new-${blockTypeToFilename(blockType)}`; const fileExtension = extension ?? getFileExtension(blockType); let counter = 0; let fileUri: string; @@ -153,12 +161,7 @@ export async function createNewWorkspaceBlockFile( ide.fileExists.bind(ide), ); - let fileContent: string; - if (blockType === "rules") { - fileContent = createNewRuleMarkdown(); - } else { - fileContent = YAML.stringify(getContentsForNewBlock(blockType)); - } + const fileContent = getFileContent(blockType); await ide.writeFile(fileUri, fileContent); await ide.openFile(fileUri); From e5f424a73621814874a7604cefc1a35cab4a6c93 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 2 Jun 2025 14:44:58 -0700 Subject: [PATCH 03/28] Update createRuleBlock.ts --- core/tools/implementations/createRuleBlock.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/core/tools/implementations/createRuleBlock.ts b/core/tools/implementations/createRuleBlock.ts index d47d2ddfc..da0f0303b 100644 --- a/core/tools/implementations/createRuleBlock.ts +++ b/core/tools/implementations/createRuleBlock.ts @@ -12,7 +12,6 @@ export const createRuleBlockImpl: ToolImpl = async ( args: CreateRuleBlockArgs, extras, ) => { - // Create markdown content using shared utility const fileContent = createRuleMarkdown(args.name, args.rule, { description: args.description, globs: args.globs, From 9b8a333cf36ce88d6db2e7c970f34bd33dafe2f0 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 2 Jun 2025 17:12:00 -0700 Subject: [PATCH 04/28] Update createRuleBlock.test.ts --- .../implementations/createRuleBlock.test.ts | 190 +++++++++--------- 1 file changed, 94 insertions(+), 96 deletions(-) diff --git a/core/tools/implementations/createRuleBlock.test.ts b/core/tools/implementations/createRuleBlock.test.ts index 343eb75d4..ab7e16c38 100644 --- a/core/tools/implementations/createRuleBlock.test.ts +++ b/core/tools/implementations/createRuleBlock.test.ts @@ -1,126 +1,124 @@ +import { jest } from "@jest/globals"; import { parseMarkdownRule } from "../../config/markdown"; import { createRuleBlockImpl } from "./createRuleBlock"; -// Mock the extras parameter with necessary functions const mockIde = { - getWorkspaceDirs: jest.fn().mockResolvedValue(["/"]), - writeFile: jest.fn().mockResolvedValue(undefined), - openFile: jest.fn().mockResolvedValue(undefined), + getWorkspaceDirs: jest.fn<() => Promise>().mockResolvedValue(["/"]), + writeFile: jest + .fn<(path: string, content: string) => Promise>() + .mockResolvedValue(undefined), + openFile: jest + .fn<(path: string) => Promise>() + .mockResolvedValue(undefined), }; const mockExtras = { ide: mockIde, }; -describe("createRuleBlockImpl", () => { - beforeEach(() => { - jest.clearAllMocks(); +beforeEach(() => { + jest.clearAllMocks(); +}); + +test("createRuleBlockImpl should create a rule with glob pattern", async () => { + const args = { + name: "TypeScript Rule", + rule: "Use interfaces for object shapes", + description: "Always use interfaces", + alwaysApply: true, + globs: "**/*.{ts,tsx}", + }; + + await createRuleBlockImpl(args, mockExtras as any); + + const fileContent = mockIde.writeFile.mock.calls[0][1] as string; + + const { frontmatter, markdown } = parseMarkdownRule(fileContent); + + expect(frontmatter).toEqual({ + description: "Always use interfaces", + globs: "**/*.{ts,tsx}", }); - it("should create a rule with glob pattern", async () => { - const args = { - name: "TypeScript Rule", - rule: "Use interfaces for object shapes", - description: "Always use interfaces", - alwaysApply: true, - globs: "**/*.{ts,tsx}", - }; + expect(markdown).toContain("# TypeScript Rule"); + expect(markdown).toContain("Use interfaces for object shapes"); +}); - await createRuleBlockImpl(args, mockExtras as any); +test("createRuleBlockImpl should create a filename based on sanitized rule name using shared path function", async () => { + const args = { + name: "Special Ch@racters & Spaces", + rule: "Handle special characters", + description: "Test rule", + alwaysApply: false, + }; - const fileContent = mockIde.writeFile.mock.calls[0][1]; + await createRuleBlockImpl(args, mockExtras as any); - const { frontmatter, markdown } = parseMarkdownRule(fileContent); + const fileUri = mockIde.writeFile.mock.calls[0][0]; + expect(fileUri).toBe("/.continue/rules/special-chracters-spaces.md"); +}); - expect(frontmatter).toEqual({ - description: "Always use interfaces", - globs: "**/*.{ts,tsx}", - alwaysApply: true, - }); +test("createRuleBlockImpl should create a rule with description pattern", async () => { + const args = { + name: "Description Test", + rule: "This is the rule content", + description: "This is a detailed explanation of the rule", + alwaysApply: true, + }; - expect(markdown).toContain("# TypeScript Rule"); - expect(markdown).toContain("Use interfaces for object shapes"); + await createRuleBlockImpl(args, mockExtras as any); + + const fileContent = mockIde.writeFile.mock.calls[0][1] as string; + + const { frontmatter, markdown } = parseMarkdownRule(fileContent); + + expect(frontmatter).toEqual({ + description: "This is a detailed explanation of the rule", }); - it("should create a filename based on sanitized rule name using shared path function", async () => { - const args = { - name: "Special Ch@racters & Spaces", - rule: "Handle special characters", - description: "Test rule", - alwaysApply: false, - }; + expect(markdown).toContain("# Description Test"); + expect(markdown).toContain("This is the rule content"); +}); - await createRuleBlockImpl(args, mockExtras as any); +test("createRuleBlockImpl should include both globs and description in frontmatter", async () => { + const args = { + name: "Complete Rule", + rule: "Follow this standard", + description: "This rule enforces our team standards", + alwaysApply: false, + globs: "**/*.js", + }; - const fileUri = mockIde.writeFile.mock.calls[0][0]; - expect(fileUri).toBe("/.continue/rules/special-chracters-spaces.md"); + await createRuleBlockImpl(args, mockExtras as any); + + const fileContent = mockIde.writeFile.mock.calls[0][1] as string; + + const { frontmatter, markdown } = parseMarkdownRule(fileContent); + + expect(frontmatter).toEqual({ + description: "This rule enforces our team standards", + globs: "**/*.js", }); - it("should create a rule with description pattern", async () => { - const args = { - name: "Description Test", - rule: "This is the rule content", - description: "This is a detailed explanation of the rule", - alwaysApply: true, - }; + expect(markdown).toContain("# Complete Rule"); + expect(markdown).toContain("Follow this standard"); +}); - await createRuleBlockImpl(args, mockExtras as any); +test("createRuleBlockImpl should create a rule with alwaysApply set to false", async () => { + const args = { + name: "Conditional Rule", + rule: "This rule should not always be applied", + description: "Optional rule", + alwaysApply: false, + }; - const fileContent = mockIde.writeFile.mock.calls[0][1]; + await createRuleBlockImpl(args, mockExtras as any); - const { frontmatter, markdown } = parseMarkdownRule(fileContent); + const fileContent = mockIde.writeFile.mock.calls[0][1] as string; - expect(frontmatter).toEqual({ - description: "This is a detailed explanation of the rule", - alwaysApply: true, - }); + const { frontmatter } = parseMarkdownRule(fileContent); - expect(markdown).toContain("# Description Test"); - expect(markdown).toContain("This is the rule content"); - }); - - it("should include both globs and description in frontmatter", async () => { - const args = { - name: "Complete Rule", - rule: "Follow this standard", - description: "This rule enforces our team standards", - alwaysApply: false, - globs: "**/*.js", - }; - - await createRuleBlockImpl(args, mockExtras as any); - - const fileContent = mockIde.writeFile.mock.calls[0][1]; - - const { frontmatter, markdown } = parseMarkdownRule(fileContent); - - expect(frontmatter).toEqual({ - description: "This rule enforces our team standards", - globs: "**/*.js", - alwaysApply: false, - }); - - expect(markdown).toContain("# Complete Rule"); - expect(markdown).toContain("Follow this standard"); - }); - - it("should create a rule with alwaysApply set to false", async () => { - const args = { - name: "Conditional Rule", - rule: "This rule should not always be applied", - description: "Optional rule", - alwaysApply: false, - }; - - await createRuleBlockImpl(args, mockExtras as any); - - const fileContent = mockIde.writeFile.mock.calls[0][1]; - - const { frontmatter } = parseMarkdownRule(fileContent); - - expect(frontmatter).toEqual({ - description: "Optional rule", - alwaysApply: false, - }); + expect(frontmatter).toEqual({ + description: "Optional rule", }); }); From 0770b21dbfe984954605ebeeabb191ac31db15e4 Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 7 May 2025 13:45:02 -0700 Subject: [PATCH 05/28] fix(files-context)-refresh-on-new-file-and-save --- core/core.ts | 97 +++++++++++++++++++++ core/index.d.ts | 4 +- core/tools/implementations/createNewFile.ts | 4 + 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index 4fabefed3..648b1ed40 100644 --- a/core/core.ts +++ b/core/core.ts @@ -708,6 +708,7 @@ export class Core { tool, toolCallId: toolCall.id, onPartialOutput, + core: this, // Add a reference to the Core instance }); }); @@ -1008,4 +1009,100 @@ export class Core { return []; } }; + + private indexingCancellationController: AbortController | undefined; + private async sendIndexingErrorTelemetry(update: IndexingProgressUpdate) { + console.debug( + "Indexing failed with error: ", + update.desc, + update.debugInfo, + ); + void Telemetry.capture( + "indexing_error", + { + error: update.desc, + stack: update.debugInfo, + }, + false, + ); + } + + private async refreshCodebaseIndex(paths: string[]) { + if (this.indexingCancellationController) { + this.indexingCancellationController.abort(); + } + this.indexingCancellationController = new AbortController(); + try { + for await (const update of ( + await this.codebaseIndexerPromise + ).refreshDirs(paths, this.indexingCancellationController.signal)) { + let updateToSend = { ...update }; + + void this.messenger.request("indexProgress", updateToSend); + this.codebaseIndexingState = updateToSend; + + if (update.status === "failed") { + void this.sendIndexingErrorTelemetry(update); + } + } + } catch (e: any) { + console.log(`Failed refreshing codebase index directories : ${e}`); + this.handleIndexingError(e); + } + + this.messenger.send("refreshSubmenuItems", { + providers: "dependsOnIndexing", + }); + this.indexingCancellationController = undefined; + } + + private async refreshCodebaseIndexFiles(files: string[]) { + // Can be cancelled by codebase index but not vice versa + if ( + this.indexingCancellationController && + !this.indexingCancellationController.signal.aborted + ) { + return; + } + this.indexingCancellationController = new AbortController(); + try { + for await (const update of ( + await this.codebaseIndexerPromise + ).refreshFiles(files)) { + let updateToSend = { ...update }; + + void this.messenger.request("indexProgress", updateToSend); + this.codebaseIndexingState = updateToSend; + + if (update.status === "failed") { + void this.sendIndexingErrorTelemetry(update); + } + } + } catch (e: any) { + console.log(`Failed refreshing codebase index files : ${e}`); + this.handleIndexingError(e); + } + + this.messenger.send("refreshSubmenuItems", { + providers: "dependsOnIndexing", + }); + this.indexingCancellationController = undefined; + } + + // private + handleIndexingError(e: any) { + if (e instanceof LLMError) { + // Need to report this specific error to the IDE for special handling + void this.messenger.request("reportError", e); + } + // broadcast indexing error + let updateToSend: IndexingProgressUpdate = { + progress: 0, + status: "failed", + desc: e.message, + }; + void this.messenger.request("indexProgress", updateToSend); + this.codebaseIndexingState = updateToSend; + void this.sendIndexingErrorTelemetry(updateToSend); + } } diff --git a/core/index.d.ts b/core/index.d.ts index ad778d3d8..195ab6c47 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -5,6 +5,8 @@ import { } from "@continuedev/config-yaml"; import Parser from "web-tree-sitter"; import { LLMConfigurationStatuses } from "./llm/constants"; +import { GetGhTokenArgs } from "./protocol/ide"; +import { Core } from "./core"; declare global { interface Window { @@ -968,7 +970,7 @@ export interface ToolExtras { toolCallId: string; contextItems: ContextItem[]; }) => void; - config: ContinueConfig; + core?: Core; // Reference to the Core instance } export interface Tool { diff --git a/core/tools/implementations/createNewFile.ts b/core/tools/implementations/createNewFile.ts index 5a89141eb..4e211b32e 100644 --- a/core/tools/implementations/createNewFile.ts +++ b/core/tools/implementations/createNewFile.ts @@ -17,6 +17,10 @@ export const createNewFileImpl: ToolImpl = async (args, extras) => { } await extras.ide.writeFile(resolvedFileUri, args.contents); await extras.ide.openFile(resolvedFileUri); + await extras.ide.saveFile(resolvedFileUri); + if (extras.core) { + await extras.core.refreshCodebaseIndexFiles([resolvedFileUri]); + } return [ { name: getUriPathBasename(resolvedFileUri), From b27420981e976a8e98f10d63237c893c1bc8cccb Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 4 Jun 2025 17:47:48 -0700 Subject: [PATCH 06/28] refactor to using CodeBaseIndexer instead of Core --- core/core.ts | 81 +------------------------------------------------ core/index.d.ts | 3 +- 2 files changed, 3 insertions(+), 81 deletions(-) diff --git a/core/core.ts b/core/core.ts index 648b1ed40..992b930eb 100644 --- a/core/core.ts +++ b/core/core.ts @@ -708,7 +708,7 @@ export class Core { tool, toolCallId: toolCall.id, onPartialOutput, - core: this, // Add a reference to the Core instance + codeBaseIndexer: this.codeBaseIndexer, }); }); @@ -1026,83 +1026,4 @@ export class Core { false, ); } - - private async refreshCodebaseIndex(paths: string[]) { - if (this.indexingCancellationController) { - this.indexingCancellationController.abort(); - } - this.indexingCancellationController = new AbortController(); - try { - for await (const update of ( - await this.codebaseIndexerPromise - ).refreshDirs(paths, this.indexingCancellationController.signal)) { - let updateToSend = { ...update }; - - void this.messenger.request("indexProgress", updateToSend); - this.codebaseIndexingState = updateToSend; - - if (update.status === "failed") { - void this.sendIndexingErrorTelemetry(update); - } - } - } catch (e: any) { - console.log(`Failed refreshing codebase index directories : ${e}`); - this.handleIndexingError(e); - } - - this.messenger.send("refreshSubmenuItems", { - providers: "dependsOnIndexing", - }); - this.indexingCancellationController = undefined; - } - - private async refreshCodebaseIndexFiles(files: string[]) { - // Can be cancelled by codebase index but not vice versa - if ( - this.indexingCancellationController && - !this.indexingCancellationController.signal.aborted - ) { - return; - } - this.indexingCancellationController = new AbortController(); - try { - for await (const update of ( - await this.codebaseIndexerPromise - ).refreshFiles(files)) { - let updateToSend = { ...update }; - - void this.messenger.request("indexProgress", updateToSend); - this.codebaseIndexingState = updateToSend; - - if (update.status === "failed") { - void this.sendIndexingErrorTelemetry(update); - } - } - } catch (e: any) { - console.log(`Failed refreshing codebase index files : ${e}`); - this.handleIndexingError(e); - } - - this.messenger.send("refreshSubmenuItems", { - providers: "dependsOnIndexing", - }); - this.indexingCancellationController = undefined; - } - - // private - handleIndexingError(e: any) { - if (e instanceof LLMError) { - // Need to report this specific error to the IDE for special handling - void this.messenger.request("reportError", e); - } - // broadcast indexing error - let updateToSend: IndexingProgressUpdate = { - progress: 0, - status: "failed", - desc: e.message, - }; - void this.messenger.request("indexProgress", updateToSend); - this.codebaseIndexingState = updateToSend; - void this.sendIndexingErrorTelemetry(updateToSend); - } } diff --git a/core/index.d.ts b/core/index.d.ts index 195ab6c47..3613344ea 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -7,6 +7,7 @@ import Parser from "web-tree-sitter"; import { LLMConfigurationStatuses } from "./llm/constants"; import { GetGhTokenArgs } from "./protocol/ide"; import { Core } from "./core"; +import { CodebaseIndexer } from "./indexing/CodebaseIndexer"; declare global { interface Window { @@ -970,7 +971,7 @@ export interface ToolExtras { toolCallId: string; contextItems: ContextItem[]; }) => void; - core?: Core; // Reference to the Core instance + codeBaseIndexer?: CodebaseIndexer; } export interface Tool { From 41975879fd54bcdee922ef6b306ef26cee50c71c Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 4 Jun 2025 17:52:56 -0700 Subject: [PATCH 07/28] More cleanup --- core/core.ts | 17 ----------------- core/index.d.ts | 1 + 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/core/core.ts b/core/core.ts index 992b930eb..fdcf9ee58 100644 --- a/core/core.ts +++ b/core/core.ts @@ -1009,21 +1009,4 @@ export class Core { return []; } }; - - private indexingCancellationController: AbortController | undefined; - private async sendIndexingErrorTelemetry(update: IndexingProgressUpdate) { - console.debug( - "Indexing failed with error: ", - update.desc, - update.debugInfo, - ); - void Telemetry.capture( - "indexing_error", - { - error: update.desc, - stack: update.debugInfo, - }, - false, - ); - } } diff --git a/core/index.d.ts b/core/index.d.ts index 3613344ea..0226e236f 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -971,6 +971,7 @@ export interface ToolExtras { toolCallId: string; contextItems: ContextItem[]; }) => void; + config: ContinueConfig; codeBaseIndexer?: CodebaseIndexer; } From 26c3771b5aae545a9bfbe1d2c8aeb79208f2d27f Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 4 Jun 2025 17:55:34 -0700 Subject: [PATCH 08/28] more cleanup --- core/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 0226e236f..c24487a55 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -4,10 +4,8 @@ import { PromptTemplates, } from "@continuedev/config-yaml"; import Parser from "web-tree-sitter"; -import { LLMConfigurationStatuses } from "./llm/constants"; -import { GetGhTokenArgs } from "./protocol/ide"; -import { Core } from "./core"; import { CodebaseIndexer } from "./indexing/CodebaseIndexer"; +import { LLMConfigurationStatuses } from "./llm/constants"; declare global { interface Window { From f1a44194fb3d6bfdb657f79d26c343f1ea0c280d Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 4 Jun 2025 18:04:08 -0700 Subject: [PATCH 09/28] more cleanup --- core/indexing/CodebaseIndexer.test.ts | 2 +- core/indexing/CodebaseIndexer.ts | 6 ++++-- core/tools/implementations/createNewFile.ts | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/indexing/CodebaseIndexer.test.ts b/core/indexing/CodebaseIndexer.test.ts index 7ba08594d..b697520aa 100644 --- a/core/indexing/CodebaseIndexer.test.ts +++ b/core/indexing/CodebaseIndexer.test.ts @@ -278,7 +278,7 @@ describe("CodebaseIndexer", () => { expect.anything(), ); expect(mockMessenger.send).toHaveBeenCalledWith("refreshSubmenuItems", { - providers: "dependsOnIndexing", + providers: "all", }); }); diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 719c95aec..db4bdd9ca 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -596,7 +596,7 @@ export class CodebaseIndexer { // Directly refresh submenu items if (this.messenger) { this.messenger.send("refreshSubmenuItems", { - providers: "dependsOnIndexing", + providers: "all", }); } this.indexingCancellationController = undefined; @@ -626,7 +626,9 @@ export class CodebaseIndexer { // Directly refresh submenu items if (this.messenger) { - this.messenger.send("refreshSubmenuItems", { providers: "all" }); + this.messenger.send("refreshSubmenuItems", { + providers: "all", + }); } this.indexingCancellationController = undefined; } diff --git a/core/tools/implementations/createNewFile.ts b/core/tools/implementations/createNewFile.ts index 4e211b32e..2818dc4b2 100644 --- a/core/tools/implementations/createNewFile.ts +++ b/core/tools/implementations/createNewFile.ts @@ -18,8 +18,8 @@ export const createNewFileImpl: ToolImpl = async (args, extras) => { await extras.ide.writeFile(resolvedFileUri, args.contents); await extras.ide.openFile(resolvedFileUri); await extras.ide.saveFile(resolvedFileUri); - if (extras.core) { - await extras.core.refreshCodebaseIndexFiles([resolvedFileUri]); + if (extras.codeBaseIndexer) { + await extras.codeBaseIndexer?.refreshCodebaseIndexFiles([resolvedFileUri]); } return [ { From 0c7cecd53d33d28fc16afb9abd70eb2f669b52ec Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 4 Jun 2025 22:02:59 -0700 Subject: [PATCH 10/28] Updates to use codebase indexer --- core/indexing/CodebaseIndexer.ts | 2 +- core/tools/implementations/createNewFile.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index db4bdd9ca..0a0432ccf 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -552,7 +552,7 @@ export class CodebaseIndexer { private async updateProgress(update: IndexingProgressUpdate) { this.codebaseIndexingState = update; if (this.messenger) { - await this.messenger.request("indexProgress", update); + void this.messenger.request("indexProgress", update); } } diff --git a/core/tools/implementations/createNewFile.ts b/core/tools/implementations/createNewFile.ts index 2818dc4b2..5b18f03d3 100644 --- a/core/tools/implementations/createNewFile.ts +++ b/core/tools/implementations/createNewFile.ts @@ -19,7 +19,7 @@ export const createNewFileImpl: ToolImpl = async (args, extras) => { await extras.ide.openFile(resolvedFileUri); await extras.ide.saveFile(resolvedFileUri); if (extras.codeBaseIndexer) { - await extras.codeBaseIndexer?.refreshCodebaseIndexFiles([resolvedFileUri]); + void extras.codeBaseIndexer?.refreshCodebaseIndexFiles([resolvedFileUri]); } return [ { From 8b04ba6b233d72f1e61ea67fd63de51d03629282 Mon Sep 17 00:00:00 2001 From: fpagny Date: Thu, 5 Jun 2025 15:22:07 +0200 Subject: [PATCH 11/28] feat(scaleway): update supported models --- core/llm/llms/Scaleway.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/llm/llms/Scaleway.ts b/core/llm/llms/Scaleway.ts index 6efaf3afa..93fc599db 100644 --- a/core/llm/llms/Scaleway.ts +++ b/core/llm/llms/Scaleway.ts @@ -13,10 +13,10 @@ class Scaleway extends OpenAI { private static MODEL_IDS: { [name: string]: string } = { "llama3.1-8b": "llama-3.1-8b-instruct", - "llama3.1-70b": "llama-3.1-70b-instruct", - "mistral-nemo": "mistral-nemo-instruct-2407", + "llama3.3-70b": "llama-3.3-70b-instruct", + "mistral-small3.1": "mistral-small-3.1-24b-instruct-2503", + "deepseek-r1-distill-llama-70b": "deepseek-r1-distill-llama-70b", "qwen2.5-coder-32b": "qwen2.5-coder-32b-instruct", - pixtral: "pixtral-12b-2409", }; protected _convertModelName(model: string) { From e650723903c1e910ec86b9729169593bf4bc43fc Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 5 Jun 2025 17:14:53 -0700 Subject: [PATCH 12/28] better premature close error, resubmit button on error dialog --- gui/src/pages/gui/StreamError.tsx | 53 ++++++++++++++++++++++++++- packages/fetch/src/premature-close.ts | 14 +++++++ packages/fetch/src/stream.ts | 15 +++++++- 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 packages/fetch/src/premature-close.ts diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx index 7d5f652bf..580cbd3c0 100644 --- a/gui/src/pages/gui/StreamError.tsx +++ b/gui/src/pages/gui/StreamError.tsx @@ -1,4 +1,5 @@ import { + ArrowPathIcon, ArrowTopRightOnSquareIcon, ClipboardIcon, Cog6ToothIcon, @@ -7,6 +8,7 @@ import { import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants"; import { useContext, useMemo } from "react"; import { GhostButton, SecondaryButton } from "../../components"; +import { useMainEditor } from "../../components/mainInput/TipTapEditor"; import { DiscordIcon } from "../../components/svg/DiscordIcon"; import { GithubIcon } from "../../components/svg/GithubIcon"; import ToggleDiv from "../../components/ToggleDiv"; @@ -16,6 +18,7 @@ import { selectSelectedProfile } from "../../redux/"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectSelectedChatModel } from "../../redux/slices/configSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; +import { streamResponseThunk } from "../../redux/thunks"; import { isLocalProfile } from "../../util"; import { providers } from "../AddNewModel/configs/providers"; import { ModelsAddOnLimitDialog } from "./ModelsAddOnLimitDialog"; @@ -44,6 +47,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { const selectedModel = useAppSelector(selectSelectedChatModel); const selectedProfile = useAppSelector(selectSelectedProfile); const { session, refreshProfiles } = useAuth(); + const { mainEditor } = useMainEditor(); const parsedError = useMemo( () => parseErrorMessage((error as any)?.message || ""), @@ -60,6 +64,8 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { void navigator.clipboard.writeText(parsedError); }; + const history = useAppSelector((store) => store.session.history); + // Collect model information to display useful error info let modelTitle = "Chat model"; let providerName = "the model provider"; @@ -131,6 +137,48 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { ); + const resubmitButton = ( + { + let index = -1; + for (let i = history.length - 1; i >= 0; i--) { + if ( + history[i].message.role === "user" || + history[i].message.role === "tool" + ) { + index = i; + break; + } + } + + if (!mainEditor) { + console.error("Main editor not found, cannot resubmit message."); + return; + } + + const editorState = + index === -1 ? mainEditor.getJSON() : history[index].editorState; + + void dispatch( + streamResponseThunk({ + editorState, + modifiers: { + noContext: true, + useCodebase: false, + }, + index: index === -1 ? 0 : index, + }), + ); + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + }} + > + + Resubmit last message + + ); + if ( parsedError === "You have exceeded the chat limit for the Models Add-On." ) { @@ -138,7 +186,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { } let errorContent = ( -
+

There was an error handling the response from{" "} @@ -148,6 +196,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { Please try to submit your message again, and if the error persists, let us know by reporting the issue using the buttons below.

+
{resubmitButton}
); @@ -233,7 +282,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { if ( message && (message.toLowerCase().includes("overloaded") || - message.toLowerCase().includes("malformed")) + message.toLowerCase().includes("malformed json")) ) { errorContent = (
diff --git a/packages/fetch/src/premature-close.ts b/packages/fetch/src/premature-close.ts new file mode 100644 index 000000000..dd03b5a83 --- /dev/null +++ b/packages/fetch/src/premature-close.ts @@ -0,0 +1,14 @@ +export function getPrematureCloseErrorMessage(chunks: number): string { + if (chunks === 0) { + return "Connection was closed before any data was received (Premature close). Try again."; + } else { + return ( + "Stream was cancelled mid-stream. This can happen for various reasons, including:\n" + + "- Malformed chunks of data received from the server\n" + + "- The server closed the connection before sending the complete response\n" + + "- Long delays from the server during streaming\n" + + "- 'Keep alive' header being used in combination with an http agent and a set, low number of maxSockets\n" + + "The underlying node fetch error is 'Premature Close'" + ); + } +} diff --git a/packages/fetch/src/stream.ts b/packages/fetch/src/stream.ts index b1f5ab906..3310b639f 100644 --- a/packages/fetch/src/stream.ts +++ b/packages/fetch/src/stream.ts @@ -1,3 +1,5 @@ +import { getPrematureCloseErrorMessage } from "./premature-close.js"; + export async function* toAsyncIterable( nodeReadable: NodeJS.ReadableStream, ): AsyncGenerator { @@ -24,6 +26,7 @@ export async function* streamResponse( // Get the major version of Node.js const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10); + let chunks = 0; try { if (nodeMajorVersion >= 20) { @@ -33,6 +36,7 @@ export async function* streamResponse( new TextDecoderStream("utf-8"), )) { yield chunk; + chunks++; } } else { // Fallback for Node versions below 20 @@ -41,12 +45,19 @@ export async function* streamResponse( const nodeStream = response.body as unknown as NodeJS.ReadableStream; for await (const chunk of toAsyncIterable(nodeStream)) { yield decoder.decode(chunk, { stream: true }); + chunks++; } } } catch (e) { - if (e instanceof Error && e.name.startsWith("AbortError")) { - return; // In case of client-side cancellation, just return + if (e instanceof Error) { + if (e.name.startsWith("AbortError")) { + return; // In case of client-side cancellation, just return + } + if (e.message.toLowerCase().includes("premature close")) { + throw new Error(getPrematureCloseErrorMessage(chunks)); + } } + throw e; } } From 6236529fbedb668a2b66b563734ba0877fe44ba2 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 6 Jun 2025 10:45:10 -0700 Subject: [PATCH 13/28] update premature close message --- packages/fetch/src/premature-close.ts | 14 -------------- packages/fetch/src/stream.ts | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 packages/fetch/src/premature-close.ts diff --git a/packages/fetch/src/premature-close.ts b/packages/fetch/src/premature-close.ts deleted file mode 100644 index dd03b5a83..000000000 --- a/packages/fetch/src/premature-close.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function getPrematureCloseErrorMessage(chunks: number): string { - if (chunks === 0) { - return "Connection was closed before any data was received (Premature close). Try again."; - } else { - return ( - "Stream was cancelled mid-stream. This can happen for various reasons, including:\n" + - "- Malformed chunks of data received from the server\n" + - "- The server closed the connection before sending the complete response\n" + - "- Long delays from the server during streaming\n" + - "- 'Keep alive' header being used in combination with an http agent and a set, low number of maxSockets\n" + - "The underlying node fetch error is 'Premature Close'" - ); - } -} diff --git a/packages/fetch/src/stream.ts b/packages/fetch/src/stream.ts index 3310b639f..190b0166c 100644 --- a/packages/fetch/src/stream.ts +++ b/packages/fetch/src/stream.ts @@ -1,5 +1,3 @@ -import { getPrematureCloseErrorMessage } from "./premature-close.js"; - export async function* toAsyncIterable( nodeReadable: NodeJS.ReadableStream, ): AsyncGenerator { @@ -54,10 +52,22 @@ export async function* streamResponse( return; // In case of client-side cancellation, just return } if (e.message.toLowerCase().includes("premature close")) { - throw new Error(getPrematureCloseErrorMessage(chunks)); + // Premature close can happen for various reasons, including: + // - Malformed chunks of data received from the server + // - The server closed the connection before sending the complete response + // - Long delays from the server during streaming + // - 'Keep alive' header being used in combination with an http agent and a set, low number of maxSockets + if (chunks === 0) { + throw new Error( + "Stream was closed before any data was received. Try again. (Premature Close)", + ); + } else { + throw new Error( + "The response was cancelled mid-stream. Try again. (Premature Close).", + ); + } } } - throw e; } } From 74901fc4ced5e1a7cc47697835f51f1e9b12b6fb Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Sat, 7 Jun 2025 22:55:42 -0700 Subject: [PATCH 14/28] Clarify lack of JSON support for Bedrock prompt caching --- .../model-providers/top-level/bedrock.mdx | 40 ++++++++++++++++--- .../model-providers/top-level/bedrock.md | 32 +++++++++++++-- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/docs/docs/customize/model-providers/top-level/bedrock.mdx b/docs/docs/customize/model-providers/top-level/bedrock.mdx index 45cf5e5eb..eb2646d46 100644 --- a/docs/docs/customize/model-providers/top-level/bedrock.mdx +++ b/docs/docs/customize/model-providers/top-level/bedrock.mdx @@ -10,15 +10,15 @@ Amazon Bedrock is a fully managed service on AWS that provides access to foundat ## Chat model -We recommend configuring **Claude 3.5 Sonnet** as your chat model. +We recommend configuring **Claude 3.7 Sonnet** as your chat model. ```yaml title="config.yaml" models: - - name: Claude 3.5 Sonnet + - name: Claude 3.7 Sonnet provider: bedrock - model: anthropic.claude-3-5-sonnet-20240620-v1:0 + model: us.anthropic.claude-3-7-sonnet-20250219-v1:0 env: region: us-east-1 profile: bedrock @@ -31,9 +31,9 @@ We recommend configuring **Claude 3.5 Sonnet** as your chat model. { "models": [ { - "title": "Claude 3.5 Sonnet", + "title": "Claude 3.7 Sonnet", "provider": "bedrock", - "model": "anthropic.claude-3-5-sonnet-20240620-v1:0", + "model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0", "region": "us-east-1", "profile": "bedrock" } @@ -147,6 +147,36 @@ We recommend configuring `cohere.rerank-v3-5:0` as your reranking model, you may +## Prompt caching + +Bedrock allows Claude models to cache tool payloads, system messages, and chat +messages between requests. Enable this behavior by adding +`promptCaching: true` under `defaultCompletionOptions` in your model +configuration. + +Prompt caching is generally available for: + +- Claude 3.7 Sonnet +- Claude 3.5 Haiku +- Amazon Nova Micro +- Amazon Nova Lite +- Amazon Nova Pro + +Customers who were granted access to Claude 3.5 Sonnet v2 during the prompt +caching preview will retain that access, but it cannot be enabled for new users +on that model. + +```yaml title="config.yaml" +models: + - name: Claude 3.7 Sonnet + provider: bedrock + model: us.anthropic.claude-3-7-sonnet-20250219-v1:0 + defaultCompletionOptions: + promptCaching: true +``` + +Prompt caching is not supported in JSON configuration files, so use the YAML syntax above to enable it. + ## Authentication Authentication will be through temporary or long-term credentials in diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md index e13bc715d..a42c59baf 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/model-providers/top-level/bedrock.md @@ -5,15 +5,15 @@ slug: ../bedrock ## 聊天模型 -我们推荐配置 **Claude 3.5 Sonnet** 作为你的聊天模型。 +我们推荐配置 **Claude 3.7 Sonnet** 作为你的聊天模型。 ```json title="config.json" { "models": [ { - "title": "Claude 3.5 Sonnet", + "title": "Claude 3.7 Sonnet", "provider": "bedrock", - "model": "anthropic.claude-3-5-sonnet-20240620-v1:0", + "model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0", "region": "us-east-1", "profile": "bedrock" } @@ -48,6 +48,32 @@ Bedrock 当前没有任何重排序模型。 [点击这里](../../model-roles/reranking.md) 查看重排序模型提供者列表。 +## 提示词缓存 + +Bedrock 支持 Claude 模型的提示词缓存。 在 `defaultCompletionOptions` +中设置 `promptCaching: true` 即可缓存工具调用、系统消息和聊天消息。 + +提示词缓存目前适用于以下模型: + +- Claude 3.7 Sonnet +- Claude 3.5 Haiku +- Amazon Nova Micro +- Amazon Nova Lite +- Amazon Nova Pro + +在预览期间获准使用 Claude 3.5 Sonnet v2 的用户仍可继续使用提示词缓存,但该模型不会再向新的用户开放此功能。 + +```yaml title="config.yaml" +models: + - name: Claude 3.7 Sonnet + provider: bedrock + model: us.anthropic.claude-3-7-sonnet-20250219-v1:0 + defaultCompletionOptions: + promptCaching: true +``` + +提示词缓存不支持 JSON 配置文件,只能在 YAML 中启用。 + ## 认证 认证可以通过 `~/.aws/credentials` 配置属性中临时的或长期的证书,(例如 "bedrock") 。 From 955ab93efc3f488127d16673b89f3900f75c2007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20K=C4=99ska?= Date: Sun, 8 Jun 2025 15:16:35 +0200 Subject: [PATCH 15/28] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Codebase=20Indexing?= =?UTF-8?q?=20still=20not=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/indexing/CodebaseIndexer.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 719c95aec..6c68d772d 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -1,7 +1,6 @@ import * as fs from "fs/promises"; import { ConfigHandler } from "../config/ConfigHandler.js"; -import { IContinueServerClient } from "../continueServer/interface.js"; import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js"; import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; import type { IMessenger } from "../protocol/messenger"; @@ -549,10 +548,10 @@ export class CodebaseIndexer { // New methods using messenger directly - private async updateProgress(update: IndexingProgressUpdate) { + private updateProgress(update: IndexingProgressUpdate) { this.codebaseIndexingState = update; if (this.messenger) { - await this.messenger.request("indexProgress", update); + void this.messenger.request("indexProgress", update); } } @@ -582,7 +581,7 @@ export class CodebaseIndexer { paths, this.indexingCancellationController.signal, )) { - await this.updateProgress(update); + this.updateProgress(update); if (update.status === "failed") { await this.sendIndexingErrorTelemetry(update); @@ -613,7 +612,7 @@ export class CodebaseIndexer { this.indexingCancellationController = new AbortController(); try { for await (const update of this.refreshFiles(files)) { - await this.updateProgress(update); + this.updateProgress(update); if (update.status === "failed") { await this.sendIndexingErrorTelemetry(update); @@ -634,7 +633,7 @@ export class CodebaseIndexer { public async handleIndexingError(e: any) { if (e instanceof LLMError && this.messenger) { // Need to report this specific error to the IDE for special handling - await this.messenger.request("reportError", e); + void this.messenger.request("reportError", e); } // broadcast indexing error @@ -644,7 +643,7 @@ export class CodebaseIndexer { desc: e.message, }; - await this.updateProgress(updateToSend); + this.updateProgress(updateToSend); void this.sendIndexingErrorTelemetry(updateToSend); } From 640674197bbbb50cda41c0ec3c1b72465baebab8 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 9 Jun 2025 13:16:34 -0700 Subject: [PATCH 16/28] incorporate dallins feedback --- core/config/workspace/workspaceBlocks.test.ts | 29 +--------- core/config/workspace/workspaceBlocks.ts | 55 +++++-------------- 2 files changed, 15 insertions(+), 69 deletions(-) diff --git a/core/config/workspace/workspaceBlocks.test.ts b/core/config/workspace/workspaceBlocks.test.ts index ba93bb19e..75c50cabd 100644 --- a/core/config/workspace/workspaceBlocks.test.ts +++ b/core/config/workspace/workspaceBlocks.test.ts @@ -1,34 +1,7 @@ import { BlockType } from "@continuedev/config-yaml"; import { describe, expect, test } from "@jest/globals"; import { RULE_FILE_EXTENSION } from "../markdown"; -import { - blockTypeToFilename, - blockTypeToSingular, - findAvailableFilename, - getFileContent, -} from "./workspaceBlocks"; - -describe("blockTypeToSingular", () => { - test("converts block types to singular form correctly", () => { - expect(blockTypeToSingular("models")).toBe("model"); - expect(blockTypeToSingular("context")).toBe("context"); - expect(blockTypeToSingular("rules")).toBe("rule"); - expect(blockTypeToSingular("docs")).toBe("doc"); - expect(blockTypeToSingular("prompts")).toBe("prompt"); - expect(blockTypeToSingular("mcpServers")).toBe("MCP server"); - }); -}); - -describe("blockTypeToFilename", () => { - test("converts block types to filename-safe singular form correctly", () => { - expect(blockTypeToFilename("models")).toBe("model"); - expect(blockTypeToFilename("context")).toBe("context"); - expect(blockTypeToFilename("rules")).toBe("rule"); - expect(blockTypeToFilename("docs")).toBe("doc"); - expect(blockTypeToFilename("prompts")).toBe("prompt"); - expect(blockTypeToFilename("mcpServers")).toBe("mcp-server"); - }); -}); +import { findAvailableFilename, getFileContent } from "./workspaceBlocks"; describe("getFileContent", () => { test("returns markdown content for rules block type", () => { diff --git a/core/config/workspace/workspaceBlocks.ts b/core/config/workspace/workspaceBlocks.ts index d54d2c823..322d8a99e 100644 --- a/core/config/workspace/workspaceBlocks.ts +++ b/core/config/workspace/workspaceBlocks.ts @@ -4,49 +4,22 @@ import { IDE } from "../.."; import { joinPathsToUri } from "../../util/uri"; import { RULE_FILE_EXTENSION, createRuleMarkdown } from "../markdown"; -export function blockTypeToSingular(blockType: BlockType): string { - switch (blockType) { - case "context": - return "context"; - case "models": - return "model"; - case "rules": - return "rule"; - case "docs": - return "doc"; - case "prompts": - return "prompt"; - case "mcpServers": - return "MCP server"; - default: - // Fallback to slice approach for any new block types - return blockType.slice(0, -1); - } -} - -export function blockTypeToFilename(blockType: BlockType): string { - switch (blockType) { - case "context": - return "context"; - case "models": - return "model"; - case "rules": - return "rule"; - case "docs": - return "doc"; - case "prompts": - return "prompt"; - case "mcpServers": - return "mcp-server"; - default: - // Fallback to slice approach for any new block types - return blockType.slice(0, -1); - } -} +const BLOCK_TYPE_CONFIG: Record< + BlockType, + { singular: string; filename: string } +> = { + context: { singular: "context", filename: "context" }, + models: { singular: "model", filename: "model" }, + rules: { singular: "rule", filename: "rule" }, + docs: { singular: "doc", filename: "doc" }, + prompts: { singular: "prompt", filename: "prompt" }, + mcpServers: { singular: "MCP server", filename: "mcp-server" }, + data: { singular: "data", filename: "data" }, +}; function getContentsForNewBlock(blockType: BlockType): ConfigYaml { const configYaml: ConfigYaml = { - name: `New ${blockTypeToSingular(blockType)}`, + name: `New ${BLOCK_TYPE_CONFIG[blockType]?.singular}`, version: "0.0.1", schema: "v1", }; @@ -125,7 +98,7 @@ export async function findAvailableFilename( fileExists: (uri: string) => Promise, extension?: string, ): Promise { - const baseFilename = `new-${blockTypeToFilename(blockType)}`; + const baseFilename = `new-${BLOCK_TYPE_CONFIG[blockType]?.filename}`; const fileExtension = extension ?? getFileExtension(blockType); let counter = 0; let fileUri: string; From 449275cb9abf2d79b325b6ede4a54b9e3fedee2c Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 9 Jun 2025 17:13:30 -0700 Subject: [PATCH 17/28] ignore running tests inside dist directory --- packages/config-yaml/jest.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/config-yaml/jest.config.mjs b/packages/config-yaml/jest.config.mjs index 2592f3834..cef402cc8 100644 --- a/packages/config-yaml/jest.config.mjs +++ b/packages/config-yaml/jest.config.mjs @@ -17,4 +17,5 @@ export default { __dirname: path.dirname(fileURLToPath(import.meta.url)), __filename: path.resolve(fileURLToPath(import.meta.url)), }, + modulePathIgnorePatterns: ["/dist"], }; From 033ade024ed685ef66dad53e675449a47e2dc872 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 9 Jun 2025 18:15:28 -0700 Subject: [PATCH 18/28] fix: apply notch filename trunaction --- gui/src/components/AcceptRejectDiffButtons.tsx | 6 ++---- .../Lump/LumpToolbar/PendingApplyStatesToolbar.tsx | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gui/src/components/AcceptRejectDiffButtons.tsx b/gui/src/components/AcceptRejectDiffButtons.tsx index 0f3bd97ea..a19b56068 100644 --- a/gui/src/components/AcceptRejectDiffButtons.tsx +++ b/gui/src/components/AcceptRejectDiffButtons.tsx @@ -51,8 +51,7 @@ export default function AcceptRejectAllButtons({ >
- Reject - All + Reject
@@ -66,8 +65,7 @@ export default function AcceptRejectAllButtons({ >
- Accept - All + Accept
diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/PendingApplyStatesToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/PendingApplyStatesToolbar.tsx index 22d03dda1..0f303a6e0 100644 --- a/gui/src/components/mainInput/Lump/LumpToolbar/PendingApplyStatesToolbar.tsx +++ b/gui/src/components/mainInput/Lump/LumpToolbar/PendingApplyStatesToolbar.tsx @@ -28,9 +28,9 @@ export function PendingApplyStatesToolbar({ {Object.entries(applyStatesByFilepath).map(([filepath, states]) => (
{filepath && ( - + - {getUriPathBasename(filepath)} + {getUriPathBasename(filepath)} )} Date: Mon, 9 Jun 2025 18:22:14 -0700 Subject: [PATCH 19/28] fix: apply actions in toolbar --- .../StepContainerPreToolbar/ApplyActions.tsx | 6 +++--- .../StyledMarkdownPreview/StepContainerPreToolbar/index.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx index f825758eb..d84b7d421 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx @@ -32,7 +32,7 @@ export function ApplyActions(props: ApplyActionsProps) { case "done": return (
- + {`${props.applyState?.numDiffs === 1 ? "1 diff" : `${props.applyState?.numDiffs} diffs`}`} @@ -42,7 +42,7 @@ export function ApplyActions(props: ApplyActionsProps) { onClick={onClickReject} tooltipContent={`Reject all (${getMetaKeyLabel()}⇧⌫)`} > - + - +
diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx index 0fa31b585..e33c21df5 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx @@ -291,7 +291,7 @@ export function StepContainerPreToolbar({ return ( -
+
setIsExpanded(!isExpanded)} className={`text-lightgray h-3.5 w-3.5 flex-shrink-0 cursor-pointer hover:brightness-125 ${ From cce5227eba799ba25ca0650291512504ebcebca1 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 9 Jun 2025 18:23:46 -0700 Subject: [PATCH 20/28] Update ApplyActions.tsx --- .../StepContainerPreToolbar/ApplyActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx index d84b7d421..5a3f37c33 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ApplyActions.tsx @@ -31,7 +31,7 @@ export function ApplyActions(props: ApplyActionsProps) { ); case "done": return ( -
+
{`${props.applyState?.numDiffs === 1 ? "1 diff" : `${props.applyState?.numDiffs} diffs`}`} From 894a68671a331ec3ab2664e824b544978ff07dc0 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Jun 2025 14:57:02 -0700 Subject: [PATCH 21/28] rules context provider --- .../context/providers/RulesContextProvider.ts | 91 +++++++++++++++++++ core/context/providers/index.ts | 2 + 2 files changed, 93 insertions(+) create mode 100644 core/context/providers/RulesContextProvider.ts diff --git a/core/context/providers/RulesContextProvider.ts b/core/context/providers/RulesContextProvider.ts new file mode 100644 index 000000000..3a4cfbcdb --- /dev/null +++ b/core/context/providers/RulesContextProvider.ts @@ -0,0 +1,91 @@ +import { BaseContextProvider } from ".."; +import { + ContextItem, + ContextItemUri, + ContextProviderDescription, + ContextProviderExtras, + ContextSubmenuItem, + LoadSubmenuItemsArgs, + RuleWithSource, +} from "../.."; +import { getControlPlaneEnv } from "../../control-plane/env"; + +class RulesContextProvider extends BaseContextProvider { + static description: ContextProviderDescription = { + title: "rules", + displayTitle: "Rules", + description: "Mention rules files", + type: "submenu", + renderInlineAs: "", + }; + + // This is only used within this class. Worst case if there are exact duplicates is that one always calls the other, but this is an extreme edge case + // Can eventually pull in more metadata, but this is experimental + private getIdFromRule(rule: RuleWithSource): string { + return rule.ruleFile ?? rule.slug ?? rule.name ?? rule.rule; + } + + private getNameFromRule(rule: RuleWithSource): string { + return rule.name ?? rule.slug ?? rule.ruleFile ?? rule.source; + } + + private getDescriptionFromRule(rule: RuleWithSource): string { + return rule.description ?? rule.name ?? ""; + } + + private getUriFromRule( + rule: RuleWithSource, + appUrl: string, + ): ContextItemUri | undefined { + if (rule.ruleFile) { + return { + type: "file", + value: rule.ruleFile, + }; + } + + if (rule.slug) { + let url = `${appUrl}${rule.slug}`; + return { + type: "url", + value: url, + }; + } + + return undefined; + } + + async getContextItems( + query: string, + extras: ContextProviderExtras, + ): Promise { + const rule = extras.config.rules.find( + (rule) => this.getIdFromRule(rule) === query, + ); + if (!rule) { + return []; + } + + const env = await getControlPlaneEnv(extras.ide.getIdeSettings()); + return [ + { + name: this.getNameFromRule(rule), + content: rule.rule, + description: this.getDescriptionFromRule(rule), + uri: this.getUriFromRule(rule, env.APP_URL), + }, + ]; + } + + async loadSubmenuItems( + args: LoadSubmenuItemsArgs, + ): Promise { + return args.config.rules.map((rule) => ({ + id: this.getIdFromRule(rule), + description: this.getDescriptionFromRule(rule), + title: this.getNameFromRule(rule), + })); + } +} + +export default RulesContextProvider; diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index d72d0d04c..d9fa14bd3 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -25,6 +25,7 @@ import OSContextProvider from "./OSContextProvider"; import PostgresContextProvider from "./PostgresContextProvider"; import ProblemsContextProvider from "./ProblemsContextProvider"; import RepoMapContextProvider from "./RepoMapContextProvider"; +import RulesContextProvider from "./RulesContextProvider"; import SearchContextProvider from "./SearchContextProvider"; import TerminalContextProvider from "./TerminalContextProvider"; import URLContextProvider from "./URLContextProvider"; @@ -66,6 +67,7 @@ export const Providers: (typeof BaseContextProvider)[] = [ MCPContextProvider, GitCommitContextProvider, ClipboardContextProvider, + RulesContextProvider, ]; export function contextProviderClassFromName( From 91ab4d2e32da34be26391f6e6328a352a2acdd21 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Jun 2025 14:57:11 -0700 Subject: [PATCH 22/28] include rules context provider by default --- core/config/profile/doLoadConfig.ts | 34 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index dd04d1915..2d70f722b 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -14,12 +14,14 @@ import { IDE, IdeSettings, ILLMLogger, + RuleWithSource, SerializedContinueConfig, Tool, } from "../../"; import { constructMcpSlashCommand } from "../../commands/slash/mcp"; import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton"; import MCPContextProvider from "../../context/providers/MCPContextProvider"; +import RulesContextProvider from "../../context/providers/RulesContextProvider"; import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { getControlPlaneEnv } from "../../control-plane/env.js"; @@ -39,6 +41,24 @@ import { migrateJsonSharedConfig } from "../migrateSharedConfig"; import { rectifySelectedModelsFromGlobalContext } from "../selectedModels"; import { loadContinueConfigFromYaml } from "../yaml/loadYaml"; +async function loadRules(ide: IDE) { + const rules: RuleWithSource[] = []; + const errors = []; + + // Add rules from .continuerules files + const { rules: yamlRules, errors: continueRulesErrors } = + await getWorkspaceContinueRuleDotFiles(ide); + rules.unshift(...yamlRules); + errors.push(...continueRulesErrors); + + // Add rules from markdown files in .continue/rules + const { rules: markdownRules, errors: markdownRulesErrors } = + await loadMarkdownRules(ide); + rules.unshift(...markdownRules); + errors.push(...markdownRulesErrors); + + return { rules, errors }; +} export default async function doLoadConfig(options: { ide: IDE; ideSettingsPromise: Promise; @@ -125,17 +145,11 @@ export default async function doLoadConfig(options: { // Remove ability have undefined errors, just have an array errors = [...(errors ?? [])]; - // Add rules from .continuerules files - const { rules, errors: continueRulesErrors } = - await getWorkspaceContinueRuleDotFiles(ide); + // Load rules and always include the RulesContextProvider + const { rules, errors: rulesErrors } = await loadRules(ide); + errors.push(...rulesErrors); newConfig.rules.unshift(...rules); - errors.push(...continueRulesErrors); - - // Add rules from markdown files in .continue/rules - const { rules: markdownRules, errors: markdownRulesErrors } = - await loadMarkdownRules(ide); - newConfig.rules.unshift(...markdownRules); - errors.push(...markdownRulesErrors); + newConfig.contextProviders.push(new RulesContextProvider({})); // Rectify model selections for each role newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId); From abd4861b493a111397723358d9a430f643386ab4 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Jun 2025 15:17:14 -0700 Subject: [PATCH 23/28] button to create a new rule from the UI --- .../mainInput/AtMentionDropdown/index.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gui/src/components/mainInput/AtMentionDropdown/index.tsx b/gui/src/components/mainInput/AtMentionDropdown/index.tsx index b03bf3096..a4beaba29 100644 --- a/gui/src/components/mainInput/AtMentionDropdown/index.tsx +++ b/gui/src/components/mainInput/AtMentionDropdown/index.tsx @@ -292,6 +292,26 @@ const AtMentionDropdown = forwardRef((props: AtMentionDropdownProps, ref) => { }, description: "Create a new .prompt file", }); + } else if (subMenuTitle === "Mention rules files") { + items.push({ + title: "Add new rule", + type: "action", + action: () => { + void ideMessenger.request("config/addLocalWorkspaceBlock", { + blockType: "rules", + }); + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const start = text.lastIndexOf("@"); + if (start !== -1) { + props.editor.view.dispatch( + tr.delete(start, tr.selection.from).scrollIntoView(), + ); + } + props.onClose(); // Escape the mention list after creating a new rule + }, + description: "Creates a rule file", + }); } setLoadingSubmenuItem(items.find((item) => item.id === "loading")); setAllItems(items.filter((item) => item.id !== "loading")); From 036e19618b86600e4e9c5ad6e6ee5a98e55e15f1 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 10 Jun 2025 16:41:12 -0700 Subject: [PATCH 24/28] fix: handle apiType for azure w/ proxy --- core/llm/llms/stubs/ContinueProxy.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 3506dcb32..b49d00548 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -34,6 +34,10 @@ class ContinueProxy extends OpenAI { constructor(options: LLMOptions) { super(options); this.configEnv = options.env; + // This it set to `undefined` to handle the case where we are proxying requests to Azure. We pass the correct env vars + // needed to do this in `extraBodyProperties` below, but if we don't set `apiType` to `undefined`, we end up proxying to + // `/openai/deployments/` which is invalid since that URL construction happens on the proxy. + this.apiType = undefined; this.actualApiBase = options.apiBase; this.apiKeyLocation = options.apiKeyLocation; this.orgScopeId = options.orgScopeId; From 4355618079808bdfc3240022e79a0a9dd8457b02 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 10 Jun 2025 18:57:33 -0700 Subject: [PATCH 25/28] fix: make `env.apiVersion` required for azure openai --- packages/openai-adapters/package.json | 2 +- packages/openai-adapters/src/apis/Azure.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index 08c1581b6..2b5043cfb 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.36", + "version": "1.0.38", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/openai-adapters/src/apis/Azure.ts b/packages/openai-adapters/src/apis/Azure.ts index 57f48c3e0..bf9a5ae4d 100644 --- a/packages/openai-adapters/src/apis/Azure.ts +++ b/packages/openai-adapters/src/apis/Azure.ts @@ -19,9 +19,6 @@ export class AzureApi extends OpenAIApi { this.openai = new OpenAI({ apiKey: azureConfig.apiKey, baseURL: this._getAzureBaseURL(azureConfig), - defaultQuery: azureConfig.env?.apiVersion - ? { "api-version": azureConfig.env.apiVersion } - : {}, fetch: customFetch(azureConfig.requestOptions), }); } @@ -42,11 +39,17 @@ export class AzureApi extends OpenAIApi { if (this._isAzureOpenAI(config.env?.apiType)) { if (!config.env?.deployment) { throw new Error( - "Azure deployment is required if `apiType` is `azure-openai` or `azure`", + "`env.deployment` is a required configuration property for Azure OpenAI", ); } - return `${baseURL}/openai/deployments/${config.env.deployment}`; + if (!config.env?.apiVersion) { + throw new Error( + "`env.apiVersion` is a required configuration property for Azure OpenAI", + ); + } + + return `${baseURL}/openai/deployments/${config.env.deployment}?api-version=${config.env.apiVersion}`; } return baseURL; From 1bd881ffeaa11f1b46454e5726f2a26320a544e3 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Jun 2025 19:54:51 -0700 Subject: [PATCH 26/28] use pencil icon --- extensions/vscode/package-lock.json | 4 ++-- gui/src/components/mainInput/icons.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 8d4221fa2..f66fd08f3 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.45", + "version": "1.1.46", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.45", + "version": "1.1.46", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", diff --git a/gui/src/components/mainInput/icons.ts b/gui/src/components/mainInput/icons.ts index 42b80da66..d8d04cc83 100644 --- a/gui/src/components/mainInput/icons.ts +++ b/gui/src/components/mainInput/icons.ts @@ -14,6 +14,7 @@ import { GlobeAltIcon, MagnifyingGlassIcon, PaperClipIcon, + PencilIcon, PlusIcon, SparklesIcon, TrashIcon, @@ -42,6 +43,7 @@ export const NAMED_ICONS: { [key: string]: any } = { debugger: BugAntIcon, os: CpuChipIcon, tree: Bars3BottomLeftIcon, + rules: PencilIcon, "prompt-files": DocumentTextIcon, "repo-map": FolderIcon, "/clear": TrashIcon, From 99f17fba103f67ce0d6516bd9a4671b792260b3c Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Jun 2025 20:50:39 -0700 Subject: [PATCH 27/28] bump --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 6027f17bc..cafb70b6c 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.46", + "version": "1.1.47", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 2e5e37c2c0bfd3e4122a893d16fbdd58756a9baa Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Jun 2025 21:08:50 -0700 Subject: [PATCH 28/28] adjust name because the store denied us on the name "Continue" (I believe ths is a bug because our previous version allowed this) --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index cafb70b6c..b151000bf 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -18,7 +18,7 @@ "homepage": "https://continue.dev", "qna": "https://github.com/continuedev/continue/issues/new/choose", "license": "Apache-2.0", - "displayName": "Continue", + "displayName": "Continue - open-source AI code assistant", "pricing": "Free", "description": "The leading open-source AI code assistant", "publisher": "Continue",