diff --git a/core/config/markdown/utils.ts b/core/config/markdown/utils.ts index 5fbade09b..df64a75be 100644 --- a/core/config/markdown/utils.ts +++ b/core/config/markdown/utils.ts @@ -4,6 +4,15 @@ import { } from "@continuedev/config-yaml"; import { joinPathsToUri } from "../../util/uri"; +function createRelativeRuleFilePathParts(ruleName: string): string[] { + const safeRuleName = sanitizeRuleName(ruleName); + return [".continue", "rules", `${safeRuleName}.${RULE_FILE_EXTENSION}`]; +} + +export function createRelativeRuleFilePath(ruleName: string): string { + return createRelativeRuleFilePathParts(ruleName).join("/"); +} + /** * Creates the file path for a rule in the workspace .continue/rules directory */ @@ -11,11 +20,8 @@ export function createRuleFilePath( workspaceDir: string, ruleName: string, ): string { - const safeRuleName = sanitizeRuleName(ruleName); return joinPathsToUri( workspaceDir, - ".continue", - "rules", - `${safeRuleName}.${RULE_FILE_EXTENSION}`, + ...createRelativeRuleFilePathParts(ruleName), ); } diff --git a/core/llm/index.ts b/core/llm/index.ts index a634fc5d6..ecb43bfca 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -213,7 +213,7 @@ export abstract class BaseLLM implements ILLM { this.providerName === "continue-proxy" ? this.model?.split("/").pop() || this.model : this.model; - const llmInfo = findLlmInfo(modelSearchString); + const llmInfo = findLlmInfo(modelSearchString, this.underlyingProviderName); const templateType = options.template ?? autodetectTemplateType(options.model); diff --git a/core/package-lock.json b/core/package-lock.json index 109605f18..974572995 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -202,7 +202,7 @@ }, "../packages/llm-info": { "name": "@continuedev/llm-info", - "version": "1.0.9", + "version": "1.0.10", "license": "Apache-2.0", "devDependencies": { "@semantic-release/changelog": "^6.0.3", @@ -16364,9 +16364,9 @@ } }, "node_modules/prebuild-install/node_modules/tar-fs": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.3.tgz", - "integrity": "sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", "license": "MIT", "dependencies": { "chownr": "^1.1.1", @@ -18323,9 +18323,9 @@ } }, "node_modules/tar-fs": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.9.tgz", - "integrity": "sha512-XF4w9Xp+ZQgifKakjZYmFdkLoSWd34VGKcsTCwlNWM7QG3ZbaxnTsaBwnjFZqHRf/rROxaR8rXnbtwdvaDI+lA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz", + "integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==", "license": "MIT", "dependencies": { "pump": "^3.0.0", diff --git a/extensions/cli/src/commands/init.ts b/extensions/cli/src/commands/init.ts index f4c31e614..ad50333ef 100644 --- a/extensions/cli/src/commands/init.ts +++ b/extensions/cli/src/commands/init.ts @@ -1,9 +1,11 @@ import { type AssistantConfig } from "@continuedev/sdk"; +import { createRelativeRuleFilePath } from "core/config/markdown/utils.js"; import { SlashCommandResult } from "../ui/hooks/useChat.types.js"; function createInitPrompt(): string { - return `Please analyze this repository and create a comprehensive AGENTS.md file. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup. + const relativeRuleFilepath = createRelativeRuleFilePath("review"); + return `Please analyze this repository and create a comprehensive AGENTS.md file, along with a custom slash command. Use your available tools to understand the project structure, read important files like README.md, package.json, requirements.txt, and other configuration files to understand the technology stack and setup. Create an AGENTS.md file with the following structure: @@ -30,7 +32,23 @@ Create an AGENTS.md file with the following structure: - Development environment setup - Lint and format commands -Please create the AGENTS.md file using the Write tool after analyzing the repository. Focus on providing actionable information that would help both AI agents and human developers understand and work effectively with this codebase. Keep the file concise but informational.`; +Additionally, create a slash command file at ${relativeRuleFilepath} with the following structure: + +\`\`\`md +--- +invokable: true +--- + +Review this code for potential issues, including: + + + +Provide specific, actionable feedback for improvements. +\`\`\` + +This slash command will be invokable using /review and will provide instructions for code review tasks common to this repository. + +Please create both the AGENTS.md file and the .continue/rules/review.md file using the Write tool after analyzing the repository. Focus on providing actionable information that would help both AI agents and human developers understand and work effectively with this codebase. Keep the files concise but informational.`; } export async function handleInit( diff --git a/extensions/cli/src/ui/components/ChecklistDisplay.test.tsx b/extensions/cli/src/ui/components/ChecklistDisplay.test.tsx new file mode 100644 index 000000000..dbbe0245c --- /dev/null +++ b/extensions/cli/src/ui/components/ChecklistDisplay.test.tsx @@ -0,0 +1,63 @@ +import { render } from "ink-testing-library"; +import React from "react"; + +import { ChecklistDisplay } from "./ChecklistDisplay.js"; + +describe("ChecklistDisplay", () => { + it("should highlight the first incomplete item", () => { + const content = `Task list status: +- [x] Completed task +- [ ] First incomplete task +- [ ] Second incomplete task`; + + const { lastFrame } = render(); + const output = lastFrame(); + + // The output should contain the checkbox symbols and text + expect(output).toContain("✓"); + expect(output).toContain("○"); + expect(output).toContain("Completed task"); + expect(output).toContain("First incomplete task"); + expect(output).toContain("Second incomplete task"); + }); + + it("should handle empty checklist", () => { + const content = "Task list status:"; + + const { lastFrame } = render(); + const output = lastFrame(); + + expect(output).toBeDefined(); + }); + + it("should handle all completed tasks", () => { + const content = `Task list status: +- [x] Completed task 1 +- [x] Completed task 2`; + + const { lastFrame } = render(); + const output = lastFrame(); + + expect(output).toContain("✓"); + expect(output).toContain("Completed task 1"); + expect(output).toContain("Completed task 2"); + }); + + it("should handle mixed content with headers", () => { + const content = `Task list status: +## Important Tasks +- [x] Done task +- [ ] Todo task + +## Other Tasks +- [ ] Another todo`; + + const { lastFrame } = render(); + const output = lastFrame(); + + expect(output).toContain("Important Tasks"); + expect(output).toContain("Other Tasks"); + expect(output).toContain("✓"); + expect(output).toContain("○"); + }); +}); diff --git a/extensions/cli/src/ui/components/ChecklistDisplay.tsx b/extensions/cli/src/ui/components/ChecklistDisplay.tsx index 926a4193f..458e3a7cb 100644 --- a/extensions/cli/src/ui/components/ChecklistDisplay.tsx +++ b/extensions/cli/src/ui/components/ChecklistDisplay.tsx @@ -13,6 +13,17 @@ export const ChecklistDisplay: React.FC = ({ }) => { const lines = content.split("\n"); + // Find the index of the first incomplete checkbox item + let firstIncompleteIndex = -1; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + const checkboxMatch = line.match(/^(\s*)-\s*\[([ x])\]\s*(.*)$/); + if (checkboxMatch && checkboxMatch[2] === " ") { + firstIncompleteIndex = i; + break; + } + } + return ( {lines.map((line, index) => { @@ -25,6 +36,7 @@ export const ChecklistDisplay: React.FC = ({ if (checkboxMatch) { const [, indent, status, taskText] = checkboxMatch; const isCompleted = status === "x"; + const isFirstIncomplete = index === firstIncompleteIndex; return ( @@ -34,8 +46,11 @@ export const ChecklistDisplay: React.FC = ({ {taskText} diff --git a/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx b/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx index 09334a9ec..b842cda77 100644 --- a/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx +++ b/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx @@ -48,9 +48,7 @@ export function SelectedAssistantButton({ ) : ( <> - + diff --git a/gui/src/components/AssistantAndOrgListbox/index.tsx b/gui/src/components/AssistantAndOrgListbox/index.tsx index 55db674be..4bc002c2e 100644 --- a/gui/src/components/AssistantAndOrgListbox/index.tsx +++ b/gui/src/components/AssistantAndOrgListbox/index.tsx @@ -150,7 +150,7 @@ export function AssistantAndOrgListbox({ />
diff --git a/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx b/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx index 9deea5872..b11c69a03 100644 --- a/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx +++ b/gui/src/components/StyledMarkdownPreview/MermaidBlock.tsx @@ -141,7 +141,7 @@ export default function MermaidDiagram({ code }: { code: string }) { {!!error ? (
{error}
) : ( -
+
code) { font-family: var(--vscode-editor-font-family); } diff --git a/gui/src/components/StyledMarkdownPreview/markdown.css b/gui/src/components/StyledMarkdownPreview/markdown.css index afb57b9fa..d9dfcfa2d 100644 --- a/gui/src/components/StyledMarkdownPreview/markdown.css +++ b/gui/src/components/StyledMarkdownPreview/markdown.css @@ -1038,3 +1038,6 @@ body[data-color-mode*="light"] { .token.entity { cursor: help; } +.mermaid foreignObject { + width: 100%; +} diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 25355a7bd..87cf5344f 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -56,7 +56,6 @@ function InputToolbar(props: InputToolbarProps) { const hasReasoningEnabled = useAppSelector( (store) => store.session.hasReasoningEnabled, ); - const isEnterDisabled = props.disabled || (isInEdit && codeToEdit.length === 0); diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx index cc83b9c46..5cca2cdc1 100644 --- a/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx @@ -105,7 +105,7 @@ export function BlockSettingsTopToolbar() { }; return ( -
+
{shouldShowError && ( diff --git a/gui/src/components/ui/Button.tsx b/gui/src/components/ui/Button.tsx index 690a72bb3..e4cf466e3 100644 --- a/gui/src/components/ui/Button.tsx +++ b/gui/src/components/ui/Button.tsx @@ -40,7 +40,7 @@ const Button = React.forwardRef( className={cn( "cursor-pointer transition-all duration-200", "hover:enabled:cursor-pointer", - "disabled:text-description-muted disabled:pointer-events-none disabled:opacity-50", + "disabled:cursor-not-allowed disabled:opacity-50", buttonVariants[variant], isIcon ? iconButtonSizes[size] diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx index bbb75b141..f9a60daf2 100644 --- a/gui/src/pages/gui/StreamError.tsx +++ b/gui/src/pages/gui/StreamError.tsx @@ -290,10 +290,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { { - ideMessenger.post("controlPlane/openUrl", { - path: GITHUB_LINK, - orgSlug: undefined, - }); + ideMessenger.post("openUrl", GITHUB_LINK); }} > @@ -302,10 +299,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => { { - ideMessenger.post("controlPlane/openUrl", { - path: DISCORD_LINK, - orgSlug: undefined, - }); + ideMessenger.post("openUrl", DISCORD_LINK); }} > diff --git a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx index b9fa4777d..d875af8f0 100644 --- a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +++ b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx @@ -7,6 +7,7 @@ import { import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { ToggleWithIcon } from "./ToggleWithIcon"; import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; +import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon"; import { toolCallStateToContextItems } from "./utils"; interface SimpleToolCallUIProps { @@ -61,6 +62,10 @@ export function SimpleToolCallUI({ />
+ + {!!toolCallState.output?.length && ( + + )}
{isToggleable && ( diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx index 82497ef15..afc832591 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx @@ -4,6 +4,7 @@ import { openContextItem } from "../../../components/mainInput/belowMainInput/Co import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; import { toolCallStateToContextItems } from "./utils"; +import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon"; interface ToolCallDisplayProps { children: React.ReactNode; @@ -36,7 +37,7 @@ export function ToolCallDisplay({ return (
-
+
+ {!!toolCallState.output?.length && ( + + )}
{children}
diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx index 4a88fd7cb..c633b0514 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx @@ -53,7 +53,7 @@ export function ToolCallStatusMessage({ return (
{`Continue ${intro} ${message}`} diff --git a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx index d28cd9328..dc5c2a03b 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolTruncateHistoryIcon.tsx @@ -21,7 +21,8 @@ export function ToolTruncateHistoryIcon({ const { mainEditor } = useMainEditor(); if (historyIndex === lastMessageIndex) { - return null; + // filler so doesn't jump in + return
; } return ( diff --git a/packages/llm-info/src/index.ts b/packages/llm-info/src/index.ts index 35b88abf6..c1aaa6643 100644 --- a/packages/llm-info/src/index.ts +++ b/packages/llm-info/src/index.ts @@ -10,7 +10,7 @@ import { OpenAi } from "./providers/openai.js"; import { Vllm } from "./providers/vllm.js"; import { Voyage } from "./providers/voyage.js"; import { xAI } from "./providers/xAI.js"; -import { LlmInfo, ModelProvider, UseCase } from "./types.js"; +import { LlmInfoWithProvider, ModelProvider, UseCase } from "./types.js"; export const allModelProviders: ModelProvider[] = [ OpenAi, @@ -27,16 +27,32 @@ export const allModelProviders: ModelProvider[] = [ xAI, ]; -export const allLlms: LlmInfo[] = allModelProviders.flatMap((provider) => - provider.models.map((model) => ({ ...model, provider: provider.id })), +export const allLlms: LlmInfoWithProvider[] = allModelProviders.flatMap( + (provider) => + provider.models.map((model) => ({ ...model, provider: provider.id })), ); -export function findLlmInfo(model: string): LlmInfo | undefined { +export function findLlmInfo( + model: string, + preferProviderId?: string, +): LlmInfoWithProvider | undefined { + if (preferProviderId) { + const provider = allModelProviders.find((p) => p.id === preferProviderId); + const info = provider?.models.find((llm) => + llm.regex ? llm.regex.test(model) : llm.model === model, + ); + if (info) { + return { + ...info, + provider: preferProviderId, + }; + } + } return allLlms.find((llm) => llm.regex ? llm.regex.test(model) : llm.model === model, ); } -export function getAllRecommendedFor(useCase: UseCase): LlmInfo[] { +export function getAllRecommendedFor(useCase: UseCase): LlmInfoWithProvider[] { return allLlms.filter((llm) => llm.recommendedFor?.includes(useCase)); }