From e7d3625b73c85f98d5582860dd4f180dccc51e3f Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:09:55 +0530 Subject: [PATCH 001/174] fix: case when reranker returns invalid scores array --- core/context/providers/DocsContextProvider.ts | 10 +++++++--- core/llm/llms/Voyage.ts | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index 0f87a3f61..5c8e0af1b 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -43,9 +43,13 @@ class DocsContextProvider extends BaseContextProvider { try { const scores = await reranker.rerank(fullInput, chunksCopy); - chunksCopy.sort( - (a, b) => scores[chunksCopy.indexOf(b)] - scores[chunksCopy.indexOf(a)], - ); + if (Array.isArray(scores)) { + // reranker model has returned a valid array + chunksCopy.sort( + (a, b) => + scores[chunksCopy.indexOf(b)] - scores[chunksCopy.indexOf(a)], + ); + } chunksCopy = chunksCopy.splice( 0, diff --git a/core/llm/llms/Voyage.ts b/core/llm/llms/Voyage.ts index fe08d8b1d..94c344a56 100644 --- a/core/llm/llms/Voyage.ts +++ b/core/llm/llms/Voyage.ts @@ -1,7 +1,21 @@ -import { Chunk, LLMOptions } from "../../index.js"; +import { z } from "zod"; +import { Chunk, LLMOptions } from "../../index.js"; import OpenAI from "./OpenAI.js"; +/**used to check a valid response from voyage is received + * reference: https://docs.voyageai.com/reference/reranker-api + */ +const VoyageRerankSuccessResponseSchema = z.object({ + data: z.array( + z.object({ + index: z.number(), + relevance_score: z.number(), + document: z.string(), + }), + ), +}); + class Voyage extends OpenAI { static providerName = "voyage"; static defaultOptions: Partial | undefined = { @@ -36,6 +50,9 @@ class Voyage extends OpenAI { const data = (await resp.json()) as { data: Array<{ index: number; relevance_score: number }>; }; + + VoyageRerankSuccessResponseSchema.parse(data); + const results = data.data.sort((a, b) => a.index - b.index); return results.map((result) => result.relevance_score); } From 2473a3993f0e2cac1740061146e3d0246668bf74 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 25 Jul 2025 19:11:55 +0530 Subject: [PATCH 002/174] handle mcp authenticated token - spin up a local server to handle redirects - create an MCPOauth class to handle oauths --- core/config/yaml/loadYaml.ts | 1 + core/context/mcp/MCPConnection.ts | 21 +++- core/context/mcp/MCPManagerSingleton.ts | 10 +- core/context/mcp/MCPOauth.ts | 119 ++++++++++++++++++ .../vscode/src/extension/VsCodeExtension.ts | 6 + 5 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 core/context/mcp/MCPOauth.ts diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 4f1a1632f..e7e6bb0c3 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -440,6 +440,7 @@ async function configYamlToContinueConfig(options: { timeout: server.connectionTimeout, })), false, + { ide }, ); return { config: continueConfig, errors: localErrors }; diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 3d39a0c7c..71d1d1e62 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -7,6 +7,7 @@ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/ import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js"; import { + IDE, MCPConnectionStatus, MCPOptions, MCPPrompt, @@ -16,6 +17,7 @@ import { MCPTool, } from "../.."; import { getEnvPathFromUserShell } from "../../util/shellPath"; +import { performAuth } from "./MCPOauth"; const DEFAULT_MCP_TIMEOUT = 20_000; // 20 seconds @@ -30,6 +32,10 @@ const WINDOWS_BATCH_COMMANDS = [ "bunx", ]; +export type MCPExtras = { + ide: IDE; +}; + class MCPConnection { public client: Client; public abortController: AbortController; @@ -46,7 +52,10 @@ class MCPConnection { stderr: "", }; - constructor(public options: MCPOptions) { + constructor( + public options: MCPOptions, + public extras?: MCPExtras, + ) { // Don't construct transport in constructor to avoid blocking this.transport = {} as Transport; // Will be set in connectClient @@ -106,6 +115,16 @@ class MCPConnection { this.abortController.abort(); this.abortController = new AbortController(); + if (this.options.transport.type === "sse") { + // currently support oauth for sse transports only + console.log("debug1 extras", this.extras); + performAuth(this.options.transport.url, this.extras?.ide!).then( + (result) => { + console.log("debug1 result", result); + }, + ); + } + this.connectionPromise = Promise.race([ // If aborted by a refresh or other, cancel and don't do anything new Promise((resolve) => { diff --git a/core/context/mcp/MCPManagerSingleton.ts b/core/context/mcp/MCPManagerSingleton.ts index 7eafa1564..515fdecc7 100644 --- a/core/context/mcp/MCPManagerSingleton.ts +++ b/core/context/mcp/MCPManagerSingleton.ts @@ -6,7 +6,7 @@ import { StdioOptions, TransportOptions, } from "../.."; -import MCPConnection from "./MCPConnection"; +import MCPConnection, { MCPExtras } from "./MCPConnection"; export class MCPManagerSingleton { private static instance: MCPManagerSingleton; @@ -48,7 +48,11 @@ export class MCPManagerSingleton { this.connections.delete(id); } - setConnections(servers: MCPOptions[], forceRefresh: boolean) { + setConnections( + servers: MCPOptions[], + forceRefresh: boolean, + extras?: MCPExtras, + ) { let refresh = false; // Remove any connections that are no longer in config @@ -75,7 +79,7 @@ export class MCPManagerSingleton { servers.forEach((server) => { if (!this.connections.has(server.id)) { refresh = true; - this.connections.set(server.id, new MCPConnection(server)); + this.connections.set(server.id, new MCPConnection(server, extras)); } else { const conn = this.connections.get(server.id); if (conn) { diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts new file mode 100644 index 000000000..1a961feb2 --- /dev/null +++ b/core/context/mcp/MCPOauth.ts @@ -0,0 +1,119 @@ +import { + OAuthClientProvider, + auth, +} from "@modelcontextprotocol/sdk/client/auth.js"; +import { + OAuthClientInformationFull, + OAuthTokens, +} from "@modelcontextprotocol/sdk/shared/auth.js"; +import { IDE } from "../.."; + +import http from "http"; +import url from "url"; + +const PORT = 3000; + +const server = http.createServer((req, res) => { + // TODO: instead of sending bad requests for each case, try catch handle the bad request at the end of the function + if (!req.url) { + res.writeHead(400, { "Content-Type": "text/plain" }); + res.end("Bad Request"); + return; + } + const parsedUrl = url.parse(req.url, true); + + if (parsedUrl.pathname === "/") { + const query = new URLSearchParams( + parsedUrl.query as Record, + ).toString(); + if (!query) { + console.error("no query params found!"); + } + const redirectUrl = `vscode://continue.Continue${query ? "?" + query : ""}`; + + res.writeHead(302, { + Location: redirectUrl, + }); + res.end(); + } else { + res.writeHead(404, { "Content-Type": "text/plain" }); + res.end("Not Found"); + } +}); + +server.listen(PORT, () => { + console.log(`Server running at http://localhost:${PORT}/`); +}); + +class MCPConnectionOauthProvider implements OAuthClientProvider { + constructor( + public oauthServerUrl: string, + private ide: IDE, + ) {} + + get redirectUrl() { + return "http://localhost:3000"; // TODO: this has to be a hub url or should we spin up a server? + } + + get clientMetadata() { + return { + redirect_uris: [this.redirectUrl], + token_endpoint_auth_method: "none", + grant_types: ["authorization_code", "refresh_token"], + response_types: ["code"], + client_name: "Continue Dev, Inc", // get this from package.json? + client_uri: "https://continue.dev", // get this from package.json? + }; + } + + saveClientInformation(clientInformation: OAuthClientInformationFull) {} + + async clientInformation() { + return undefined; + } + + async tokens() { + return undefined; + } + + saveTokens(tokens: OAuthTokens) {} + + codeVerifier(): string | Promise { + return ""; + } + + saveCodeVerifier(codeVerifier: string) {} + + clear() {} + + async redirectToAuthorization(authorizationUrl: URL) { + console.log("debug1 redirecting to url", authorizationUrl); + // TODO here the url needs to be sent to the extension + this.ide.openUrl(authorizationUrl.toString()); + } +} + +export async function performAuth(mcpServerUrl: string, ide: IDE) { + const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); + await auth(authProvider, { serverUrl: mcpServerUrl }); + + // full uri is of the format "https://localhost:3000/?code=712020%253Abed80c83-1041-49e0-99b5-5d4f9f8aa538%3ACSlICEGG3rzCQhla%3AHA0oJYDjijnNE8nCoADpZsSp8jr7cCSZ" + // const input = await ide.showInput({ + // prompt: "Paste the auth code here", + // }); + // const result = await auth(authProvider, { + // serverUrl: mcpServerUrl, + // authorizationCode: input, + // }); + // if (result === "AUTHORIZED") { + // void ide.showToast( + // "info", + // `Authenticated with ${new URL(mcpServerUrl).hostname} MCP server`, + // ); + // } else { + // void ide.showToast( + // "error", + // `Failed to authenticate with ${new URL(mcpServerUrl).hostname} MCP server`, + // ); + // } +} diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index f0137bd0c..fe624179a 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -72,6 +72,12 @@ export class VsCodeExtension { constructor(context: vscode.ExtensionContext) { // Register auth provider this.workOsAuthProvider = new WorkOsAuthProvider(context, this.uriHandler); + + // TODO: this should practically only start listening when user has started an mcp oauth flow. how to do this? + this.uriHandler.event((uri) => { + console.log("debug1 uri was", uri); + }); + void this.workOsAuthProvider.refreshSessions(); context.subscriptions.push(this.workOsAuthProvider); From 35a58c0c9d5933d044208f397ff24936f3c9ab4b Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 28 Jul 2025 12:26:03 +0530 Subject: [PATCH 003/174] handle authentication callback - add storage to store tokens - in mcp connection, add headers --- core/context/mcp/MCPConnection.ts | 18 +- core/context/mcp/MCPOauth.ts | 180 +++++++++++++----- core/core.ts | 5 + core/protocol/core.ts | 6 + core/protocol/passThrough.ts | 1 + core/protocol/webview.ts | 5 + core/util/GlobalContext.ts | 13 ++ .../vscode/src/extension/VsCodeExtension.ts | 13 +- 8 files changed, 187 insertions(+), 54 deletions(-) diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 71d1d1e62..71412d476 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -17,7 +17,7 @@ import { MCPTool, } from "../.."; import { getEnvPathFromUserShell } from "../../util/shellPath"; -import { performAuth } from "./MCPOauth"; +import { getOauthToken } from "./MCPOauth"; const DEFAULT_MCP_TIMEOUT = 20_000; // 20 seconds @@ -118,11 +118,19 @@ class MCPConnection { if (this.options.transport.type === "sse") { // currently support oauth for sse transports only console.log("debug1 extras", this.extras); - performAuth(this.options.transport.url, this.extras?.ide!).then( - (result) => { - console.log("debug1 result", result); - }, + if (!this.options.transport.requestOptions) { + this.options.transport.requestOptions = { + headers: {}, + }; + } + const accessToken = await getOauthToken( + this.options.transport.url, + this.extras?.ide!, ); + this.options.transport.requestOptions.headers = { + ...this.options.transport.requestOptions.headers, + Authorization: `Bearer ${accessToken}`, + }; } this.connectionPromise = Promise.race([ diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts index 1a961feb2..6e1544533 100644 --- a/core/context/mcp/MCPOauth.ts +++ b/core/context/mcp/MCPOauth.ts @@ -4,55 +4,77 @@ import { } from "@modelcontextprotocol/sdk/client/auth.js"; import { OAuthClientInformationFull, + OAuthClientInformationSchema, OAuthTokens, + OAuthTokensSchema, } from "@modelcontextprotocol/sdk/shared/auth.js"; import { IDE } from "../.."; import http from "http"; import url from "url"; +import { FromCoreProtocol, ToCoreProtocol } from "../../protocol"; +import { IMessenger } from "../../protocol/messenger"; +import { GlobalContext, GlobalContextType } from "../../util/GlobalContext"; + +export type MCPOauthState = "login" | "authenticating" | "disconnect"; const PORT = 3000; const server = http.createServer((req, res) => { - // TODO: instead of sending bad requests for each case, try catch handle the bad request at the end of the function - if (!req.url) { - res.writeHead(400, { "Content-Type": "text/plain" }); - res.end("Bad Request"); - return; - } - const parsedUrl = url.parse(req.url, true); + try { + if (!req.url) { + throw new Error("no url found"); + } + const parsedUrl = url.parse(req.url, true); + if (parsedUrl.pathname !== "/") { + throw new Error("path is not index"); + } - if (parsedUrl.pathname === "/") { const query = new URLSearchParams( parsedUrl.query as Record, ).toString(); if (!query) { - console.error("no query params found!"); + throw new Error("no query params found"); } - const redirectUrl = `vscode://continue.Continue${query ? "?" + query : ""}`; + + const redirectUrl = `vscode://continue.Continue?${query}`; res.writeHead(302, { Location: redirectUrl, }); res.end(); - } else { - res.writeHead(404, { "Content-Type": "text/plain" }); - res.end("Not Found"); + } catch (error) { + res.writeHead(400, { "Content-Type": "text/plain" }); + res.end(`Unexpected redirect error: ${(error as Error).message}`); } }); +// TODO: start the server only when mcp oauth process starts and kill when done server.listen(PORT, () => { - console.log(`Server running at http://localhost:${PORT}/`); + console.log( + `Server running for MCP Oauth process at http://localhost:${PORT}/`, + ); }); +type MCPOauthStorage = GlobalContextType["mcpOauthStorage"][string]; +type MCPOauthStorageKey = keyof MCPOauthStorage; + class MCPConnectionOauthProvider implements OAuthClientProvider { + private globalContext: GlobalContext; + constructor( public oauthServerUrl: string, private ide: IDE, - ) {} + ) { + this.globalContext = new GlobalContext(); + console.log( + "debug1 mcp oauth storage", + this.globalContext.get("mcpOauthStorage"), + ); + } get redirectUrl() { - return "http://localhost:3000"; // TODO: this has to be a hub url or should we spin up a server? + return `http://localhost:${PORT}`; // TODO: this has to be a hub url or should we spin up a server? } get clientMetadata() { @@ -66,25 +88,76 @@ class MCPConnectionOauthProvider implements OAuthClientProvider { }; } - saveClientInformation(clientInformation: OAuthClientInformationFull) {} + private _getOauthStorage(key: K) { + return this.globalContext.get("mcpOauthStorage")?.[this.oauthServerUrl]?.[ + key + ]; + } + + private _updateOauthStorage( + key: K, + value: MCPOauthStorage[K], + ) { + const existingStorage = this.globalContext.get("mcpOauthStorage") ?? {}; + const existingServerStorage = existingStorage[this.oauthServerUrl] ?? {}; + + this.globalContext.update("mcpOauthStorage", { + ...existingStorage, + [this.oauthServerUrl]: { + ...existingServerStorage, + [key]: value, + }, + }); + } + + private _clearOauthStorage() { + const existingStorage = this.globalContext.get("mcpOauthStorage") ?? {}; + delete existingStorage[this.oauthServerUrl]; + this.globalContext.update("mcpOauthStorage", existingStorage); + } + + saveClientInformation(clientInformation: OAuthClientInformationFull) { + this._updateOauthStorage("clientInformation", clientInformation); + } async clientInformation() { - return undefined; + const existingClientInformation = + this._getOauthStorage("clientInformation"); + if (!existingClientInformation) { + return undefined; + } + return await OAuthClientInformationSchema.parseAsync( + existingClientInformation, + ); } async tokens() { - return undefined; + const existingTokens = this._getOauthStorage("tokens"); + if (!existingTokens) { + return undefined; + } + return await OAuthTokensSchema.parseAsync(existingTokens); } - saveTokens(tokens: OAuthTokens) {} + saveTokens(tokens: OAuthTokens) { + this._updateOauthStorage("tokens", tokens); + } codeVerifier(): string | Promise { - return ""; + const existingCodeVerifier = this._getOauthStorage("codeVerifier"); + if (!existingCodeVerifier) { + return ""; + } + return existingCodeVerifier; } - saveCodeVerifier(codeVerifier: string) {} + saveCodeVerifier(codeVerifier: string) { + this._updateOauthStorage("codeVerifier", codeVerifier); + } - clear() {} + clear() { + this._clearOauthStorage(); + } async redirectToAuthorization(authorizationUrl: URL) { console.log("debug1 redirecting to url", authorizationUrl); @@ -93,27 +166,46 @@ class MCPConnectionOauthProvider implements OAuthClientProvider { } } +// TODO: first fetch can fail - need to refresh from gui +export async function getOauthToken(mcpServerUrl: string, ide: IDE) { + const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); + const tokens = await authProvider.tokens(); + return tokens?.access_token; +} + +// TODO: this needs to be called from an authenticate button in gui export async function performAuth(mcpServerUrl: string, ide: IDE) { const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); - await auth(authProvider, { serverUrl: mcpServerUrl }); - - // full uri is of the format "https://localhost:3000/?code=712020%253Abed80c83-1041-49e0-99b5-5d4f9f8aa538%3ACSlICEGG3rzCQhla%3AHA0oJYDjijnNE8nCoADpZsSp8jr7cCSZ" - // const input = await ide.showInput({ - // prompt: "Paste the auth code here", - // }); - // const result = await auth(authProvider, { - // serverUrl: mcpServerUrl, - // authorizationCode: input, - // }); - // if (result === "AUTHORIZED") { - // void ide.showToast( - // "info", - // `Authenticated with ${new URL(mcpServerUrl).hostname} MCP server`, - // ); - // } else { - // void ide.showToast( - // "error", - // `Failed to authenticate with ${new URL(mcpServerUrl).hostname} MCP server`, - // ); - // } + const result = await auth(authProvider, { + serverUrl: mcpServerUrl, + }); + console.log("debug1 first result", result); +} + +export async function handleMCPOauthCode( + authorizationCode: string, + ide: IDE, + messenger: IMessenger, +) { + // const { serverUrl, authState } = await messenger.request( + // "getMCPOauthState", // remove this if not needed including the protocols - we can store the state in current file itself (also easier to kill the server) + // undefined, + // ); + const serverUrl = "https://mcp.asana.com/sse"; + if (!authorizationCode) { + ide.showToast("error", `No MCP authorization code found for ${serverUrl}`); + } + + console.log("debug1 authenticating ", { + serverUrl, + authorizationCode, + }); + const authProvider = new MCPConnectionOauthProvider(serverUrl, ide); + console.log("debug1 starting auth"); + const result = await auth(authProvider, { + serverUrl, + authorizationCode, + }); + + console.log("debug1 after auth result", result); } diff --git a/core/core.ts b/core/core.ts index d8275b8ff..74702f80c 100644 --- a/core/core.ts +++ b/core/core.ts @@ -61,6 +61,7 @@ import { } from "./config/onboarding"; import { createNewWorkspaceBlockFile } from "./config/workspace/workspaceBlocks"; import { MCPManagerSingleton } from "./context/mcp/MCPManagerSingleton"; +import { handleMCPOauthCode } from "./context/mcp/MCPOauth"; import { setMdmLicenseKey } from "./control-plane/mdm/mdm"; import { ApplyAbortManager } from "./edit/applyAbortManager"; import { streamDiffLines } from "./edit/streamDiffLines"; @@ -433,6 +434,10 @@ export class Core { description: prompt.description, }; }); + on("mcp/sendOauthCode", async (msg) => { + await handleMCPOauthCode(msg.data.code, this.ide, this.messenger); + }); + // Context providers on("context/addDocs", async (msg) => { void this.docsService.indexAndAdd(msg.data); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 743556d15..5f1aa7ad9 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -142,6 +142,12 @@ export type ToCoreFromIdeOrWebviewProtocol = { description: string | undefined; }, ]; + "mcp/sendOauthCode": [ + { + code: string; + }, + void, + ]; "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap]; "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]]; "autocomplete/complete": [AutocompleteInput, string[]]; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 6e25e5f54..482ec37f6 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -92,4 +92,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "didCloseFiles", "toolCallPartialOutput", "freeTrialExceeded", + "getMCPOauthState", ]; diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index 1a8d40313..cc963982f 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -1,5 +1,6 @@ import { ConfigResult } from "@continuedev/config-yaml"; import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager.js"; +import { MCPOauthState } from "../context/mcp/MCPOauth.js"; import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes.js"; import type { BrowserSerializedContinueConfig, @@ -44,4 +45,8 @@ export type ToWebviewFromIdeOrCoreProtocol = { sessionUpdate: [{ sessionInfo: ControlPlaneSessionInfo | undefined }, void]; toolCallPartialOutput: [{ toolCallId: string; contextItems: any[] }, void]; freeTrialExceeded: [undefined, void]; + getMCPOauthState: [ + undefined, + { serverUrl: string; authState: MCPOauthState }, + ]; }; diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index 6885edde2..ddf9f6f44 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -9,6 +9,10 @@ import { SharedConfigSchema, } from "../config/sharedConfig"; +import { + OAuthClientInformationFull, + OAuthTokens, +} from "@modelcontextprotocol/sdk/shared/auth.js"; import { getGlobalContextFilePath } from "./paths"; export type GlobalContextModelSelections = Partial< @@ -39,6 +43,15 @@ export type GlobalContextType = { isSupportedLanceDbCpuTargetForLinux: boolean; sharedConfig: SharedConfigSchema; failedDocs: SiteIndexingConfig[]; + + mcpOauthStorage: Record< + string, + { + clientInformation?: OAuthClientInformationFull; + tokens?: OAuthTokens; + codeVerifier?: string; + } + >; }; /** diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index fe624179a..463b2ba42 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -73,11 +73,6 @@ export class VsCodeExtension { // Register auth provider this.workOsAuthProvider = new WorkOsAuthProvider(context, this.uriHandler); - // TODO: this should practically only start listening when user has started an mcp oauth flow. how to do this? - this.uriHandler.event((uri) => { - console.log("debug1 uri was", uri); - }); - void this.workOsAuthProvider.refreshSessions(); context.subscriptions.push(this.workOsAuthProvider); @@ -445,6 +440,14 @@ export class VsCodeExtension { void this.core.invoke("config/ideSettingsUpdate", settings); } }); + + // TODO: this should practically only start listening when user has started an mcp oauth flow. how to do this? + this.uriHandler.event((uri) => { + console.log("debug1 uri->", uri); + this.core.invoke("mcp/sendOauthCode", { + code: new URLSearchParams(uri.query).get("code") ?? "", + }); + }); } static continueVirtualDocumentScheme = EXTENSION_NAME; From a062f26559ff289bea3b20f1e9bda66734d88dd4 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:51:47 +0530 Subject: [PATCH 004/174] add authenticate button in gui - added a startAuthentication protocol --- core/context/mcp/MCPConnection.ts | 1 - core/context/mcp/MCPOauth.ts | 14 ++---- core/core.ts | 17 ++++++- core/protocol/core.ts | 2 + core/protocol/passThrough.ts | 1 + .../Lump/sections/mcp/MCPSection.tsx | 46 +++++++++++++++++-- 6 files changed, 65 insertions(+), 16 deletions(-) diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 71412d476..7b1d0b615 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -117,7 +117,6 @@ class MCPConnection { if (this.options.transport.type === "sse") { // currently support oauth for sse transports only - console.log("debug1 extras", this.extras); if (!this.options.transport.requestOptions) { this.options.transport.requestOptions = { headers: {}, diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts index 6e1544533..043117251 100644 --- a/core/context/mcp/MCPOauth.ts +++ b/core/context/mcp/MCPOauth.ts @@ -8,7 +8,7 @@ import { OAuthTokens, OAuthTokensSchema, } from "@modelcontextprotocol/sdk/shared/auth.js"; -import { IDE } from "../.."; +import { IDE, MCPServerStatus, SSEOptions } from "../.."; import http from "http"; import url from "url"; @@ -173,13 +173,12 @@ export async function getOauthToken(mcpServerUrl: string, ide: IDE) { return tokens?.access_token; } -// TODO: this needs to be called from an authenticate button in gui -export async function performAuth(mcpServerUrl: string, ide: IDE) { +export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) { + const mcpServerUrl = (mcpServer.transport as SSEOptions).url; const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); - const result = await auth(authProvider, { + return await auth(authProvider, { serverUrl: mcpServerUrl, }); - console.log("debug1 first result", result); } export async function handleMCPOauthCode( @@ -201,11 +200,8 @@ export async function handleMCPOauthCode( authorizationCode, }); const authProvider = new MCPConnectionOauthProvider(serverUrl, ide); - console.log("debug1 starting auth"); - const result = await auth(authProvider, { + return await auth(authProvider, { serverUrl, authorizationCode, }); - - console.log("debug1 after auth result", result); } diff --git a/core/core.ts b/core/core.ts index 74702f80c..c72503af0 100644 --- a/core/core.ts +++ b/core/core.ts @@ -61,7 +61,7 @@ import { } from "./config/onboarding"; import { createNewWorkspaceBlockFile } from "./config/workspace/workspaceBlocks"; import { MCPManagerSingleton } from "./context/mcp/MCPManagerSingleton"; -import { handleMCPOauthCode } from "./context/mcp/MCPOauth"; +import { handleMCPOauthCode, performAuth } from "./context/mcp/MCPOauth"; import { setMdmLicenseKey } from "./control-plane/mdm/mdm"; import { ApplyAbortManager } from "./edit/applyAbortManager"; import { streamDiffLines } from "./edit/streamDiffLines"; @@ -434,8 +434,21 @@ export class Core { description: prompt.description, }; }); + on("mcp/startAuthentication", async (msg) => { + const status = await performAuth(msg.data, this.ide); + if (status === "AUTHORIZED") { + await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); + } + }); on("mcp/sendOauthCode", async (msg) => { - await handleMCPOauthCode(msg.data.code, this.ide, this.messenger); + const status = await handleMCPOauthCode( + msg.data.code, + this.ide, + this.messenger, + ); + if (status === "AUTHORIZED") { + // await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); + } }); // Context providers diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 5f1aa7ad9..517dd34fd 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -26,6 +26,7 @@ import { FileSymbolMap, IdeSettings, LLMFullCompletionOptions, + MCPServerStatus, MessageOption, ModelDescription, PromptLog, @@ -142,6 +143,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { description: string | undefined; }, ]; + "mcp/startAuthentication": [MCPServerStatus, void]; "mcp/sendOauthCode": [ { code: string; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 482ec37f6..96858f29d 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -28,6 +28,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "config/updateSelectedModel", "mcp/reloadServer", "mcp/getPrompt", + "mcp/startAuthentication", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index 76fb338e9..73b890fd2 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -1,13 +1,16 @@ import { ConfigYaml, parseConfigYaml } from "@continuedev/config-yaml"; import { + ArrowLeftCircleIcon, ArrowPathIcon, CircleStackIcon, CommandLineIcon, + GlobeAltIcon, InformationCircleIcon, + UserCircleIcon, WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; import { MCPServerStatus } from "core"; -import { useContext, useMemo } from "react"; +import { useContext, useMemo, useState } from "react"; import { useAuth } from "../../../../../context/Auth"; import { IdeMessengerContext } from "../../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; @@ -17,6 +20,10 @@ import { ToolTip } from "../../../../gui/Tooltip"; import EditBlockButton from "../../EditBlockButton"; import { ExploreBlocksButton } from "../ExploreBlocksButton"; +function has401Error(errors: string[]) { + return !!errors.find((error) => error.includes("401")); +} + interface MCPServerStatusProps { server: MCPServerStatus; serverFromYaml?: NonNullable[number]; @@ -30,7 +37,17 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const resourcesTooltipId = `${server.id}-resources`; const errorsTooltipId = `${server.id}-errors`; - async function onRefresh() { + const [mcpAuthStatus, setMcpAuthStatus] = useState< + "unauthenticated" | "authenticated" | "authenticating" + >("unauthenticated"); + + const onAuthenticate = async () => { + setMcpAuthStatus("authenticating"); // TODO: move this updateConfig later with "authenticated" and "authenticating" status + await ideMessenger.request("mcp/startAuthentication", server); + setMcpAuthStatus("authenticated"); + }; + + const onRefresh = async () => { // optimistic config update dispatch( updateConfig({ @@ -48,7 +65,13 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { ideMessenger.post("mcp/reloadServer", { id: server.id, }); - } + }; + + // useEffect(() => { + // if (hasConnectionResetError(server.errors)) { + // onRefresh(); + // } + // }, [server.errors]); return (
- {/* Refresh button */}
+ {has401Error(server.errors) && ( + <> +
+ {mcpAuthStatus === "authenticating" ? ( + + ) : mcpAuthStatus === "authenticated" ? ( + + ) : ( + + )} +
+ + )} Date: Mon, 28 Jul 2025 22:33:43 +0530 Subject: [PATCH 005/174] remove getmcpauthstate --- core/protocol/passThrough.ts | 1 - core/protocol/webview.ts | 5 ----- 2 files changed, 6 deletions(-) diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 96858f29d..1f79d9867 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -93,5 +93,4 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "didCloseFiles", "toolCallPartialOutput", "freeTrialExceeded", - "getMCPOauthState", ]; diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index cc963982f..1a8d40313 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -1,6 +1,5 @@ import { ConfigResult } from "@continuedev/config-yaml"; import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager.js"; -import { MCPOauthState } from "../context/mcp/MCPOauth.js"; import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes.js"; import type { BrowserSerializedContinueConfig, @@ -45,8 +44,4 @@ export type ToWebviewFromIdeOrCoreProtocol = { sessionUpdate: [{ sessionInfo: ControlPlaneSessionInfo | undefined }, void]; toolCallPartialOutput: [{ toolCallId: string; contextItems: any[] }, void]; freeTrialExceeded: [undefined, void]; - getMCPOauthState: [ - undefined, - { serverUrl: string; authState: MCPOauthState }, - ]; }; From ab66938a661b4604afef8e25833c02acc933eb44 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 28 Jul 2025 22:42:47 +0530 Subject: [PATCH 006/174] added mcp remove authentication - add protectedresource key to mcp server status - shift mcp server auth status handling to core --- core/context/mcp/MCPConnection.ts | 32 ++++++++++--- core/context/mcp/MCPOauth.ts | 24 +++++----- core/core.ts | 16 ++++--- core/index.d.ts | 1 + core/protocol/core.ts | 3 ++ core/protocol/passThrough.ts | 1 + core/tools/mcpToolName.vitest.ts | 1 + .../Lump/sections/mcp/MCPSection.tsx | 48 ++++++++++++------- 8 files changed, 84 insertions(+), 42 deletions(-) diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 7b1d0b615..c5a975473 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -1,7 +1,10 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; -import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; +import { + SSEClientTransport, + SseError, +} from "@modelcontextprotocol/sdk/client/sse.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js"; @@ -32,6 +35,14 @@ const WINDOWS_BATCH_COMMANDS = [ "bunx", ]; +function is401Error(error: unknown) { + return ( + (error instanceof SseError && error.code === 401) || + (error instanceof Error && error.message.includes("401")) || + (error instanceof Error && error.message.includes("Unauthorized")) + ); +} + export type MCPExtras = { ide: IDE; }; @@ -40,6 +51,7 @@ class MCPConnection { public client: Client; public abortController: AbortController; public status: MCPConnectionStatus = "not-connected"; + public isProtectedResource = false; public errors: string[] = []; public prompts: MCPPrompt[] = []; public tools: MCPTool[] = []; @@ -87,6 +99,7 @@ class MCPConnection { resourceTemplates: this.resourceTemplates, tools: this.tools, status: this.status, + isProtectedResource: this.isProtectedResource, }; } @@ -115,8 +128,8 @@ class MCPConnection { this.abortController.abort(); this.abortController = new AbortController(); + // currently support oauth for sse transports only if (this.options.transport.type === "sse") { - // currently support oauth for sse transports only if (!this.options.transport.requestOptions) { this.options.transport.requestOptions = { headers: {}, @@ -126,10 +139,13 @@ class MCPConnection { this.options.transport.url, this.extras?.ide!, ); - this.options.transport.requestOptions.headers = { - ...this.options.transport.requestOptions.headers, - Authorization: `Bearer ${accessToken}`, - }; + if (accessToken) { + this.isProtectedResource = true; + this.options.transport.requestOptions.headers = { + ...this.options.transport.requestOptions.headers, + Authorization: `Bearer ${accessToken}`, + }; + } } this.connectionPromise = Promise.race([ @@ -270,6 +286,10 @@ class MCPConnection { } } + if (is401Error(error)) { + this.isProtectedResource = true; + } + // Include stdio output if available for stdio transport if ( this.options.transport.type === "stdio" && diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts index 043117251..f76b62fba 100644 --- a/core/context/mcp/MCPOauth.ts +++ b/core/context/mcp/MCPOauth.ts @@ -12,11 +12,9 @@ import { IDE, MCPServerStatus, SSEOptions } from "../.."; import http from "http"; import url from "url"; -import { FromCoreProtocol, ToCoreProtocol } from "../../protocol"; -import { IMessenger } from "../../protocol/messenger"; import { GlobalContext, GlobalContextType } from "../../util/GlobalContext"; -export type MCPOauthState = "login" | "authenticating" | "disconnect"; +let currentMCPAuthServerUrl = ""; const PORT = 3000; @@ -157,6 +155,10 @@ class MCPConnectionOauthProvider implements OAuthClientProvider { clear() { this._clearOauthStorage(); + console.log( + "debug1 after clearing mcp oauth storage", + this.globalContext.get("mcpOauthStorage"), + ); } async redirectToAuthorization(authorizationUrl: URL) { @@ -181,15 +183,7 @@ export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) { }); } -export async function handleMCPOauthCode( - authorizationCode: string, - ide: IDE, - messenger: IMessenger, -) { - // const { serverUrl, authState } = await messenger.request( - // "getMCPOauthState", // remove this if not needed including the protocols - we can store the state in current file itself (also easier to kill the server) - // undefined, - // ); +export async function handleMCPOauthCode(authorizationCode: string, ide: IDE) { const serverUrl = "https://mcp.asana.com/sse"; if (!authorizationCode) { ide.showToast("error", `No MCP authorization code found for ${serverUrl}`); @@ -205,3 +199,9 @@ export async function handleMCPOauthCode( authorizationCode, }); } + +export function removeMCPAuth(mcpServer: MCPServerStatus, ide: IDE) { + const mcpServerUrl = (mcpServer.transport as SSEOptions).url; + const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); + authProvider.clear(); +} diff --git a/core/core.ts b/core/core.ts index c72503af0..cb846c7ad 100644 --- a/core/core.ts +++ b/core/core.ts @@ -61,7 +61,11 @@ import { } from "./config/onboarding"; import { createNewWorkspaceBlockFile } from "./config/workspace/workspaceBlocks"; import { MCPManagerSingleton } from "./context/mcp/MCPManagerSingleton"; -import { handleMCPOauthCode, performAuth } from "./context/mcp/MCPOauth"; +import { + handleMCPOauthCode, + performAuth, + removeMCPAuth, +} from "./context/mcp/MCPOauth"; import { setMdmLicenseKey } from "./control-plane/mdm/mdm"; import { ApplyAbortManager } from "./edit/applyAbortManager"; import { streamDiffLines } from "./edit/streamDiffLines"; @@ -441,15 +445,15 @@ export class Core { } }); on("mcp/sendOauthCode", async (msg) => { - const status = await handleMCPOauthCode( - msg.data.code, - this.ide, - this.messenger, - ); + const status = await handleMCPOauthCode(msg.data.code, this.ide); if (status === "AUTHORIZED") { // await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); } }); + on("mcp/removeAuthentication", async (msg) => { + removeMCPAuth(msg.data, this.ide); + await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); + }); // Context providers on("context/addDocs", async (msg) => { diff --git a/core/index.d.ts b/core/index.d.ts index 13e231b87..90b978a63 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1310,6 +1310,7 @@ export interface MCPTool { export interface MCPServerStatus extends MCPOptions { status: MCPConnectionStatus; errors: string[]; + isProtectedResource: boolean; prompts: MCPPrompt[]; tools: MCPTool[]; diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 517dd34fd..daacaa4f1 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -126,6 +126,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { }, ContextItemWithId[], ]; + "mcp/reloadServer": [ { id: string; @@ -150,6 +151,8 @@ export type ToCoreFromIdeOrWebviewProtocol = { }, void, ]; + "mcp/removeAuthentication": [MCPServerStatus, void]; + "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap]; "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]]; "autocomplete/complete": [AutocompleteInput, string[]]; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 1f79d9867..4575a2b53 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -29,6 +29,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "mcp/reloadServer", "mcp/getPrompt", "mcp/startAuthentication", + "mcp/removeAuthentication", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", diff --git a/core/tools/mcpToolName.vitest.ts b/core/tools/mcpToolName.vitest.ts index 8c20f630a..ff60d5200 100644 --- a/core/tools/mcpToolName.vitest.ts +++ b/core/tools/mcpToolName.vitest.ts @@ -15,6 +15,7 @@ const createMcpServer = (name: string): MCPServerStatus => ({ type: "sse", url: "", }, + isProtectedResource: false, }); const createMCPTool = (name: string): MCPTool => ({ diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index 73b890fd2..ede04c013 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -1,22 +1,22 @@ import { ConfigYaml, parseConfigYaml } from "@continuedev/config-yaml"; import { - ArrowLeftCircleIcon, ArrowPathIcon, CircleStackIcon, CommandLineIcon, - GlobeAltIcon, InformationCircleIcon, - UserCircleIcon, + ShieldCheckIcon, + ShieldExclamationIcon, WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; import { MCPServerStatus } from "core"; -import { useContext, useMemo, useState } from "react"; +import { useContext, useMemo } from "react"; import { useAuth } from "../../../../../context/Auth"; import { IdeMessengerContext } from "../../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; import { updateConfig } from "../../../../../redux/slices/configSlice"; import { fontSize } from "../../../../../util"; import { ToolTip } from "../../../../gui/Tooltip"; +import { Button } from "../../../../ui"; import EditBlockButton from "../../EditBlockButton"; import { ExploreBlocksButton } from "../ExploreBlocksButton"; @@ -36,15 +36,14 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const promptsTooltipId = `${server.id}-prompts`; const resourcesTooltipId = `${server.id}-resources`; const errorsTooltipId = `${server.id}-errors`; - - const [mcpAuthStatus, setMcpAuthStatus] = useState< - "unauthenticated" | "authenticated" | "authenticating" - >("unauthenticated"); + const mcpAuthTooltipId = `${server.id}-auth`; const onAuthenticate = async () => { - setMcpAuthStatus("authenticating"); // TODO: move this updateConfig later with "authenticated" and "authenticating" status await ideMessenger.request("mcp/startAuthentication", server); - setMcpAuthStatus("authenticated"); + }; + + const onRemoveAuth = async () => { + await ideMessenger.request("mcp/removeAuthentication", server); }; const onRefresh = async () => { @@ -154,20 +153,33 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
- {has401Error(server.errors) && ( + {server.isProtectedResource && ( <>
- {mcpAuthStatus === "authenticating" ? ( - - ) : mcpAuthStatus === "authenticated" ? ( - - ) : ( - + {server.status === "error" ? ( + + ) : server.status === "connecting" ? null : ( + )}
+ +
+ +
+
)} Date: Mon, 28 Jul 2025 23:03:01 +0530 Subject: [PATCH 007/174] handle mcp oauth callback --- core/context/mcp/MCPOauth.ts | 31 ++++++++++++++----- core/core.ts | 11 +++++-- .../Lump/sections/mcp/MCPSection.tsx | 14 ++++----- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts index f76b62fba..34e79368d 100644 --- a/core/context/mcp/MCPOauth.ts +++ b/core/context/mcp/MCPOauth.ts @@ -14,7 +14,8 @@ import http from "http"; import url from "url"; import { GlobalContext, GlobalContextType } from "../../util/GlobalContext"; -let currentMCPAuthServerUrl = ""; +/**in memory storage variable for the server that is currently being authenticated */ +let authenticatingMCPServer: MCPServerStatus | null = null; const PORT = 3000; @@ -162,29 +163,40 @@ class MCPConnectionOauthProvider implements OAuthClientProvider { } async redirectToAuthorization(authorizationUrl: URL) { - console.log("debug1 redirecting to url", authorizationUrl); - // TODO here the url needs to be sent to the extension this.ide.openUrl(authorizationUrl.toString()); } } -// TODO: first fetch can fail - need to refresh from gui export async function getOauthToken(mcpServerUrl: string, ide: IDE) { const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); const tokens = await authProvider.tokens(); return tokens?.access_token; } +/** + * checks if the authentication is already done for the current server + * if not, starts the authentication process by opening a webpage url + */ export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) { const mcpServerUrl = (mcpServer.transport as SSEOptions).url; const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); - return await auth(authProvider, { + const authStatus = await auth(authProvider, { serverUrl: mcpServerUrl, }); + if (authStatus === "REDIRECT") { + authenticatingMCPServer = mcpServer; + } + return authStatus; } +/** + * handle the authentication code received from the oauth redirect + */ export async function handleMCPOauthCode(authorizationCode: string, ide: IDE) { - const serverUrl = "https://mcp.asana.com/sse"; + const serverUrl = (authenticatingMCPServer?.transport as SSEOptions).url; + if (!serverUrl) { + ide.showToast("error", "No MCP server url found for authentication"); + } if (!authorizationCode) { ide.showToast("error", `No MCP authorization code found for ${serverUrl}`); } @@ -194,10 +206,15 @@ export async function handleMCPOauthCode(authorizationCode: string, ide: IDE) { authorizationCode, }); const authProvider = new MCPConnectionOauthProvider(serverUrl, ide); - return await auth(authProvider, { + const authStatus = await auth(authProvider, { serverUrl, authorizationCode, }); + + const prevAuthenticatingMCPServer = authenticatingMCPServer!; + authenticatingMCPServer = null; + + return { authStatus, authenticatingMCPServer: prevAuthenticatingMCPServer }; } export function removeMCPAuth(mcpServer: MCPServerStatus, ide: IDE) { diff --git a/core/core.ts b/core/core.ts index cb846c7ad..41663acca 100644 --- a/core/core.ts +++ b/core/core.ts @@ -445,9 +445,14 @@ export class Core { } }); on("mcp/sendOauthCode", async (msg) => { - const status = await handleMCPOauthCode(msg.data.code, this.ide); - if (status === "AUTHORIZED") { - // await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); + const { authStatus, authenticatingMCPServer } = await handleMCPOauthCode( + msg.data.code, + this.ide, + ); + if (authStatus === "AUTHORIZED") { + await MCPManagerSingleton.getInstance().refreshConnection( + authenticatingMCPServer.id, + ); } }); on("mcp/removeAuthentication", async (msg) => { diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index ede04c013..4363df837 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -9,7 +9,7 @@ import { WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; import { MCPServerStatus } from "core"; -import { useContext, useMemo } from "react"; +import { useContext, useMemo, useState } from "react"; import { useAuth } from "../../../../../context/Auth"; import { IdeMessengerContext } from "../../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; @@ -30,6 +30,8 @@ interface MCPServerStatusProps { } function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const ideMessenger = useContext(IdeMessengerContext); + // TODO: refactor this to mcp state - also easier to remove the in memory storage + const [isMcpAuthenticating, setIsMcpAuthenticating] = useState(false); const config = useAppSelector((store) => store.config.config); const dispatch = useAppDispatch(); const toolsTooltipId = `${server.id}-tools`; @@ -39,7 +41,9 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const mcpAuthTooltipId = `${server.id}-auth`; const onAuthenticate = async () => { + setIsMcpAuthenticating(true); await ideMessenger.request("mcp/startAuthentication", server); + setIsMcpAuthenticating(false); }; const onRemoveAuth = async () => { @@ -66,12 +70,6 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { }); }; - // useEffect(() => { - // if (hasConnectionResetError(server.errors)) { - // onRefresh(); - // } - // }, [server.errors]); - return (
- {server.isProtectedResource && ( + {server.isProtectedResource && !isMcpAuthenticating && ( <>
Date: Mon, 28 Jul 2025 23:21:45 +0530 Subject: [PATCH 008/174] store mcp authenticating server as connection status --- core/context/mcp/MCPOauth.ts | 30 ++++++----------- core/core.ts | 11 +++++-- core/index.d.ts | 1 + .../Lump/sections/mcp/MCPSection.tsx | 33 ++++++++++--------- 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts index 34e79368d..58f55b34c 100644 --- a/core/context/mcp/MCPOauth.ts +++ b/core/context/mcp/MCPOauth.ts @@ -14,9 +14,6 @@ import http from "http"; import url from "url"; import { GlobalContext, GlobalContextType } from "../../util/GlobalContext"; -/**in memory storage variable for the server that is currently being authenticated */ -let authenticatingMCPServer: MCPServerStatus | null = null; - const PORT = 3000; const server = http.createServer((req, res) => { @@ -180,41 +177,34 @@ export async function getOauthToken(mcpServerUrl: string, ide: IDE) { export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) { const mcpServerUrl = (mcpServer.transport as SSEOptions).url; const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); - const authStatus = await auth(authProvider, { + return await auth(authProvider, { serverUrl: mcpServerUrl, }); - if (authStatus === "REDIRECT") { - authenticatingMCPServer = mcpServer; - } - return authStatus; } /** * handle the authentication code received from the oauth redirect */ -export async function handleMCPOauthCode(authorizationCode: string, ide: IDE) { - const serverUrl = (authenticatingMCPServer?.transport as SSEOptions).url; +export async function handleMCPOauthCode( + authorizationCode: string, + ide: IDE, + authenticatingServer: MCPServerStatus | undefined, +) { + const serverUrl = (authenticatingServer?.transport as SSEOptions).url; if (!serverUrl) { ide.showToast("error", "No MCP server url found for authentication"); + return; } if (!authorizationCode) { ide.showToast("error", `No MCP authorization code found for ${serverUrl}`); + return; } - console.log("debug1 authenticating ", { - serverUrl, - authorizationCode, - }); const authProvider = new MCPConnectionOauthProvider(serverUrl, ide); - const authStatus = await auth(authProvider, { + return await auth(authProvider, { serverUrl, authorizationCode, }); - - const prevAuthenticatingMCPServer = authenticatingMCPServer!; - authenticatingMCPServer = null; - - return { authStatus, authenticatingMCPServer: prevAuthenticatingMCPServer }; } export function removeMCPAuth(mcpServer: MCPServerStatus, ide: IDE) { diff --git a/core/core.ts b/core/core.ts index 41663acca..bac3744c6 100644 --- a/core/core.ts +++ b/core/core.ts @@ -439,19 +439,24 @@ export class Core { }; }); on("mcp/startAuthentication", async (msg) => { + await new Promise((resolve) => setTimeout(resolve, 5000)); const status = await performAuth(msg.data, this.ide); if (status === "AUTHORIZED") { await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); } }); on("mcp/sendOauthCode", async (msg) => { - const { authStatus, authenticatingMCPServer } = await handleMCPOauthCode( + const authenticatingServer = MCPManagerSingleton.getInstance() + .getStatuses() + .find((s) => s.status === "authenticating"); + const authStatus = await handleMCPOauthCode( msg.data.code, this.ide, + authenticatingServer, ); - if (authStatus === "AUTHORIZED") { + if (authStatus === "AUTHORIZED" && authenticatingServer) { await MCPManagerSingleton.getInstance().refreshConnection( - authenticatingMCPServer.id, + authenticatingServer.id, ); } }); diff --git a/core/index.d.ts b/core/index.d.ts index 90b978a63..f71b200bb 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1262,6 +1262,7 @@ export interface MCPOptions { } export type MCPConnectionStatus = + | "authenticating" | "connecting" | "connected" | "error" diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index 4363df837..51e3368da 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -9,7 +9,7 @@ import { WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; import { MCPServerStatus } from "core"; -import { useContext, useMemo, useState } from "react"; +import { useContext, useMemo } from "react"; import { useAuth } from "../../../../../context/Auth"; import { IdeMessengerContext } from "../../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks"; @@ -30,8 +30,6 @@ interface MCPServerStatusProps { } function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const ideMessenger = useContext(IdeMessengerContext); - // TODO: refactor this to mcp state - also easier to remove the in memory storage - const [isMcpAuthenticating, setIsMcpAuthenticating] = useState(false); const config = useAppSelector((store) => store.config.config); const dispatch = useAppDispatch(); const toolsTooltipId = `${server.id}-tools`; @@ -40,17 +38,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { const errorsTooltipId = `${server.id}-errors`; const mcpAuthTooltipId = `${server.id}-auth`; - const onAuthenticate = async () => { - setIsMcpAuthenticating(true); - await ideMessenger.request("mcp/startAuthentication", server); - setIsMcpAuthenticating(false); - }; - - const onRemoveAuth = async () => { - await ideMessenger.request("mcp/removeAuthentication", server); - }; - - const onRefresh = async () => { + const updateMCPServerStatus = (status: MCPServerStatus["status"]) => { // optimistic config update dispatch( updateConfig({ @@ -59,12 +47,25 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { s.id === server.id ? { ...s, - status: "connecting", + status, } : s, ), }), ); + }; + + const onAuthenticate = async () => { + updateMCPServerStatus("authenticating"); + await ideMessenger.request("mcp/startAuthentication", server); + }; + + const onRemoveAuth = async () => { + await ideMessenger.request("mcp/removeAuthentication", server); + }; + + const onRefresh = async () => { + updateMCPServerStatus("connecting"); ideMessenger.post("mcp/reloadServer", { id: server.id, }); @@ -151,7 +152,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
- {server.isProtectedResource && !isMcpAuthenticating && ( + {server.isProtectedResource && server.status !== "authenticating" && ( <>
Date: Tue, 29 Jul 2025 11:53:28 +0530 Subject: [PATCH 009/174] fix find authenticating server --- core/context/mcp/MCPManagerSingleton.ts | 4 ++++ core/core.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/core/context/mcp/MCPManagerSingleton.ts b/core/context/mcp/MCPManagerSingleton.ts index 515fdecc7..4a704f427 100644 --- a/core/context/mcp/MCPManagerSingleton.ts +++ b/core/context/mcp/MCPManagerSingleton.ts @@ -166,6 +166,10 @@ export class MCPManagerSingleton { })); } + setStatus(server: MCPServerStatus, status: MCPServerStatus["status"]) { + this.connections.get(server.id)!.status = status; + } + async getPrompt( serverName: string, promptName: string, diff --git a/core/core.ts b/core/core.ts index bac3744c6..abe73b2be 100644 --- a/core/core.ts +++ b/core/core.ts @@ -440,6 +440,7 @@ export class Core { }); on("mcp/startAuthentication", async (msg) => { await new Promise((resolve) => setTimeout(resolve, 5000)); + MCPManagerSingleton.getInstance().setStatus(msg.data, "authenticating"); const status = await performAuth(msg.data, this.ide); if (status === "AUTHORIZED") { await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); From 64702333a768c15fe2fb86a0d17154fbd59e69ed Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:24:27 +0530 Subject: [PATCH 010/174] remove vscode redirect after authentication --- core/context/mcp/MCPOauth.ts | 56 ++++++++++++++++++++++++------------ core/core.ts | 37 +++++++++++------------- 2 files changed, 54 insertions(+), 39 deletions(-) diff --git a/core/context/mcp/MCPOauth.ts b/core/context/mcp/MCPOauth.ts index 58f55b34c..b746286bb 100644 --- a/core/context/mcp/MCPOauth.ts +++ b/core/context/mcp/MCPOauth.ts @@ -14,6 +14,11 @@ import http from "http"; import url from "url"; import { GlobalContext, GlobalContextType } from "../../util/GlobalContext"; +let authenticatingMCPContext = null as { + authenticatingServer: MCPServerStatus; + ide: IDE; +} | null; + const PORT = 3000; const server = http.createServer((req, res) => { @@ -21,24 +26,25 @@ const server = http.createServer((req, res) => { if (!req.url) { throw new Error("no url found"); } - const parsedUrl = url.parse(req.url, true); - if (parsedUrl.pathname !== "/") { - throw new Error("path is not index"); - } - const query = new URLSearchParams( - parsedUrl.query as Record, - ).toString(); - if (!query) { + const parsedUrl = url.parse(req.url, true); + if (!parsedUrl.query["code"]) { throw new Error("no query params found"); } - const redirectUrl = `vscode://continue.Continue?${query}`; + handleMCPOauthCode(parsedUrl.query["code"] as string); - res.writeHead(302, { - Location: redirectUrl, + const html = ` + + +Authentication Complete +Authentication Complete. You can close this page now. +`; + + res.writeHead(200, { + "Content-Type": "text/html", }); - res.end(); + res.end(html); } catch (error) { res.writeHead(400, { "Content-Type": "text/plain" }); res.end(`Unexpected redirect error: ${(error as Error).message}`); @@ -177,6 +183,10 @@ export async function getOauthToken(mcpServerUrl: string, ide: IDE) { export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) { const mcpServerUrl = (mcpServer.transport as SSEOptions).url; const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide); + authenticatingMCPContext = { + authenticatingServer: mcpServer, + ide, + }; return await auth(authProvider, { serverUrl: mcpServerUrl, }); @@ -185,12 +195,13 @@ export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) { /** * handle the authentication code received from the oauth redirect */ -export async function handleMCPOauthCode( - authorizationCode: string, - ide: IDE, - authenticatingServer: MCPServerStatus | undefined, -) { - const serverUrl = (authenticatingServer?.transport as SSEOptions).url; +export async function handleMCPOauthCode(authorizationCode: string) { + if (!authenticatingMCPContext) { + return; + } + const { ide, authenticatingServer } = authenticatingMCPContext; + const serverUrl = (authenticatingServer.transport as SSEOptions).url; + if (!serverUrl) { ide.showToast("error", "No MCP server url found for authentication"); return; @@ -201,10 +212,17 @@ export async function handleMCPOauthCode( } const authProvider = new MCPConnectionOauthProvider(serverUrl, ide); - return await auth(authProvider, { + const authStatus = await auth(authProvider, { serverUrl, authorizationCode, }); + if (authStatus === "AUTHORIZED") { + const { MCPManagerSingleton } = await import("./MCPManagerSingleton"); // put dynamic import to avoid cyclic imports + await MCPManagerSingleton.getInstance().refreshConnection( + authenticatingServer.id, + ); + } + authenticatingMCPContext = null; } export function removeMCPAuth(mcpServer: MCPServerStatus, ide: IDE) { diff --git a/core/core.ts b/core/core.ts index abe73b2be..c1c36c37c 100644 --- a/core/core.ts +++ b/core/core.ts @@ -61,11 +61,7 @@ import { } from "./config/onboarding"; import { createNewWorkspaceBlockFile } from "./config/workspace/workspaceBlocks"; import { MCPManagerSingleton } from "./context/mcp/MCPManagerSingleton"; -import { - handleMCPOauthCode, - performAuth, - removeMCPAuth, -} from "./context/mcp/MCPOauth"; +import { performAuth, removeMCPAuth } from "./context/mcp/MCPOauth"; import { setMdmLicenseKey } from "./control-plane/mdm/mdm"; import { ApplyAbortManager } from "./edit/applyAbortManager"; import { streamDiffLines } from "./edit/streamDiffLines"; @@ -446,21 +442,22 @@ export class Core { await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); } }); - on("mcp/sendOauthCode", async (msg) => { - const authenticatingServer = MCPManagerSingleton.getInstance() - .getStatuses() - .find((s) => s.status === "authenticating"); - const authStatus = await handleMCPOauthCode( - msg.data.code, - this.ide, - authenticatingServer, - ); - if (authStatus === "AUTHORIZED" && authenticatingServer) { - await MCPManagerSingleton.getInstance().refreshConnection( - authenticatingServer.id, - ); - } - }); + // TODO: remove this protocol altogher along with vscode counterpart + // on("mcp/sendOauthCode", async (msg) => { + // const authenticatingServer = MCPManagerSingleton.getInstance() + // .getStatuses() + // .find((s) => s.status === "authenticating"); + // const authStatus = await handleMCPOauthCode( + // msg.data.code, + // this.ide, + // authenticatingServer, + // ); + // if (authStatus === "AUTHORIZED" && authenticatingServer) { + // await MCPManagerSingleton.getInstance().refreshConnection( + // authenticatingServer.id, + // ); + // } + // }); on("mcp/removeAuthentication", async (msg) => { removeMCPAuth(msg.data, this.ide); await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); From 2bc7f158640be5ba9fb0f46eff48af4af4af631d Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:25:56 +0530 Subject: [PATCH 011/174] remove mcp/sendOauthCode protocol --- core/core.ts | 16 ---------------- core/protocol/core.ts | 6 ------ .../vscode/src/extension/VsCodeExtension.ts | 8 -------- 3 files changed, 30 deletions(-) diff --git a/core/core.ts b/core/core.ts index c1c36c37c..4e406fa3f 100644 --- a/core/core.ts +++ b/core/core.ts @@ -442,22 +442,6 @@ export class Core { await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); } }); - // TODO: remove this protocol altogher along with vscode counterpart - // on("mcp/sendOauthCode", async (msg) => { - // const authenticatingServer = MCPManagerSingleton.getInstance() - // .getStatuses() - // .find((s) => s.status === "authenticating"); - // const authStatus = await handleMCPOauthCode( - // msg.data.code, - // this.ide, - // authenticatingServer, - // ); - // if (authStatus === "AUTHORIZED" && authenticatingServer) { - // await MCPManagerSingleton.getInstance().refreshConnection( - // authenticatingServer.id, - // ); - // } - // }); on("mcp/removeAuthentication", async (msg) => { removeMCPAuth(msg.data, this.ide); await MCPManagerSingleton.getInstance().refreshConnection(msg.data.id); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index daacaa4f1..086ba2104 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -145,12 +145,6 @@ export type ToCoreFromIdeOrWebviewProtocol = { }, ]; "mcp/startAuthentication": [MCPServerStatus, void]; - "mcp/sendOauthCode": [ - { - code: string; - }, - void, - ]; "mcp/removeAuthentication": [MCPServerStatus, void]; "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap]; diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 463b2ba42..32154e19a 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -440,14 +440,6 @@ export class VsCodeExtension { void this.core.invoke("config/ideSettingsUpdate", settings); } }); - - // TODO: this should practically only start listening when user has started an mcp oauth flow. how to do this? - this.uriHandler.event((uri) => { - console.log("debug1 uri->", uri); - this.core.invoke("mcp/sendOauthCode", { - code: new URLSearchParams(uri.query).get("code") ?? "", - }); - }); } static continueVirtualDocumentScheme = EXTENSION_NAME; From c401c2cda4eb79a0ec689a1391417aa5269f4c15 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:46:20 +0530 Subject: [PATCH 012/174] put a spinner to show authentication progress --- core/index.d.ts | 2 +- .../Lump/sections/mcp/MCPSection.tsx | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index f71b200bb..f9e85f72d 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1262,10 +1262,10 @@ export interface MCPOptions { } export type MCPConnectionStatus = - | "authenticating" | "connecting" | "connected" | "error" + | "authenticating" | "not-connected"; export type MCPPromptArgs = { diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index 51e3368da..d771aad4a 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -3,6 +3,7 @@ import { ArrowPathIcon, CircleStackIcon, CommandLineIcon, + GlobeAltIcon, InformationCircleIcon, ShieldCheckIcon, ShieldExclamationIcon, @@ -20,10 +21,6 @@ import { Button } from "../../../../ui"; import EditBlockButton from "../../EditBlockButton"; import { ExploreBlocksButton } from "../ExploreBlocksButton"; -function has401Error(errors: string[]) { - return !!errors.find((error) => error.includes("401")); -} - interface MCPServerStatusProps { server: MCPServerStatus; serverFromYaml?: NonNullable[number]; @@ -61,6 +58,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { }; const onRemoveAuth = async () => { + updateMCPServerStatus("authenticating"); await ideMessenger.request("mcp/removeAuthentication", server); }; @@ -76,7 +74,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { style={{ fontSize: fontSize(-2), }} - className="flex flex-row items-center justify-between gap-3" + className={`flex flex-row items-center justify-between gap-3 ${server.status === "authenticating" ? "my-0.5" : ""}`} >
{/* Name and Status */} @@ -152,7 +150,7 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
- {server.isProtectedResource && server.status !== "authenticating" && ( + {server.isProtectedResource && ( <>
{server.status === "error" ? ( - ) : server.status === "connecting" ? null : ( + ) : server.status === "authenticating" ? ( + + ) : ( )}
- + + {server.status !== "authenticating" && ( + + {server.status === "error" ? "Authenticate" : "Logout"} + + )} )} Date: Thu, 7 Aug 2025 15:40:14 -0700 Subject: [PATCH 022/174] feat: add utils for model-specific logic --- core/nextEdit/templating/model1.ts | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 core/nextEdit/templating/model1.ts diff --git a/core/nextEdit/templating/model1.ts b/core/nextEdit/templating/model1.ts new file mode 100644 index 000000000..84a754efd --- /dev/null +++ b/core/nextEdit/templating/model1.ts @@ -0,0 +1,88 @@ +import { Position, Range } from "../.."; +import { + MODEL_1_CONTEXT_FILE_TOKEN, + MODEL_1_EDITABLE_REGION_END_TOKEN, + MODEL_1_EDITABLE_REGION_START_TOKEN, + MODEL_1_SNIPPET_TOKEN, + MODEL_1_USER_CURSOR_IS_HERE_TOKEN, +} from "../constants"; +import { extractMetadataFromUnifiedDiff } from "../context/diffFormatting"; +import { insertCursorToken } from "./utils"; + +export function recentlyViewedCodeSnippetsBlock( + recentlyViewedCodeSnippets: { filepath: string; content: string }[], +) { + return recentlyViewedCodeSnippets.reduce((acc, snippet, i) => { + const block = [ + `${MODEL_1_CONTEXT_FILE_TOKEN}: ${snippet.filepath}`, + `${MODEL_1_SNIPPET_TOKEN}\n${snippet.content}`, + ].join("\n"); + + return ( + acc + block + (i === recentlyViewedCodeSnippets.length - 1 ? "" : "\n") + ); + }, ""); +} + +export function currentFileContentBlock( + currentFileContent: string, + editableRegionStartLine: number, + editableRegionEndLine: number, + cursorPosition: Position, +) { + const currentFileContentLines = currentFileContent.split("\n"); + + const insertedCursorLines = insertCursorToken( + currentFileContentLines, + cursorPosition, + MODEL_1_USER_CURSOR_IS_HERE_TOKEN, + ); + + const instrumentedLines = [ + ...insertedCursorLines.slice(0, editableRegionStartLine), + MODEL_1_EDITABLE_REGION_START_TOKEN, + ...insertedCursorLines.slice( + editableRegionStartLine, + editableRegionEndLine + 1, + ), + MODEL_1_EDITABLE_REGION_END_TOKEN, + ...insertedCursorLines.slice(editableRegionEndLine + 1), + ]; + + return instrumentedLines.join("\n"); +} + +export function editHistoryBlock( + editDiffHistories: string[], // list of unified diffs +) { + // diffHistory is made from createDiff. + // This uses createPatch from npm diff library, which includes an index line and a separator. + // We get rid of these first two lines. + const block: string[] = []; + + editDiffHistories.forEach((diff) => { + const metadata = extractMetadataFromUnifiedDiff(diff); + block.push( + [ + `User edited file \"${metadata.oldFilename}\"`, + "", + "```diff", + `${diff.split("\n").slice(2).join("\n")}`, + "```", + ].join("\n"), + ); + }); + + return block.join("\n"); +} + +function mercuryNextEditTemplateBuilder( + recentlyViewedCodeSnippets: { filepath: string; code: string }[], + currentFileContent: string, + codeToEdit: string, + codeToEditRange: Range, + cursorPosition: Position, + editDiffHistory: string, // could be a singe large unified diff +): string { + return ""; +} From 326785f0226ff7fc338d9b2d98d957ac288052d5 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Thu, 7 Aug 2025 15:40:24 -0700 Subject: [PATCH 023/174] feat: add tokens --- core/nextEdit/constants.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/nextEdit/constants.ts b/core/nextEdit/constants.ts index 153563d11..1c94db662 100644 --- a/core/nextEdit/constants.ts +++ b/core/nextEdit/constants.ts @@ -6,6 +6,8 @@ export const NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN = 5; export const MODEL_1_USER_CURSOR_IS_HERE_TOKEN = "<|user_cursor_is_here|>"; export const MODEL_1_EDITABLE_REGION_START_TOKEN = "<|editable_region_start|>"; export const MODEL_1_EDITABLE_REGION_END_TOKEN = "<|editable_region_end|>"; +export const MODEL_1_CONTEXT_FILE_TOKEN = "<|context_file|>"; +export const MODEL_1_SNIPPET_TOKEN = "<|snippet|>"; // Mercury Coder Next Edit-specific tokens. export const MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN = From eae28a87c1e8adc073eab88eb9b28d1d5fa167a2 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Thu, 7 Aug 2025 15:40:34 -0700 Subject: [PATCH 024/174] feat: add more to context --- core/nextEdit/NextEditProvider.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 0b97c4491..825515225 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -545,9 +545,17 @@ export class NextEditProvider { }; } else if (modelName.includes("model-1")) { ctx = { - userEdits: historyDiff ?? this.diffContext, + recentlyViewedCodeSnippets: + snippetPayload.recentlyVisitedRangesSnippets.map((snip) => ({ + filepath: snip.filepath, + content: snip.content, + })) ?? [], + currentFileContent: helper.fileContents, + editableRegionStartLine, + editableRegionEndLine, + editDiffHistory: this.diffContext, + currentFilePath: helper.filepath, languageShorthand: helper.lang.name, - userExcerpts: helper.fileContents, }; } else { ctx = {}; From a736bcce0eabc5c2595dea1564260e2eb1805ec8 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Thu, 7 Aug 2025 15:40:48 -0700 Subject: [PATCH 025/174] feat: add more fields to template --- core/nextEdit/types.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/nextEdit/types.ts b/core/nextEdit/types.ts index 49a4c0862..2b9d3162c 100644 --- a/core/nextEdit/types.ts +++ b/core/nextEdit/types.ts @@ -91,9 +91,11 @@ export interface NextEditTemplate { export interface TemplateVars {} export interface Model1TemplateVars extends TemplateVars { - userEdits: string; + recentlyViewedCodeSnippets: string; + currentFileContent: string; + editDiffHistory: string; // could be a singe large unified diff + currentFilePath: string; languageShorthand: string; - userExcerpts: string; } export interface MercuryTemplateVars extends TemplateVars { From 55f081c2061f37122425a7e79abda53413adc377 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Thu, 7 Aug 2025 15:41:17 -0700 Subject: [PATCH 026/174] feat: edit template --- core/nextEdit/templating/NextEditPromptEngine.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index 24f16e681..2c9235eb0 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -44,7 +44,7 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { }, "model-1": { template: - "### User Edits:\n\n{{{userEdits}}}\n\n### User Excerpts:\n\n```{{{languageShorthand}}}\n{{{userExcerpts}}}```", + "### User Edits:\n\n{{{editDiffHistory}}}\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n### User Excerpts:\n\n```{{{languageShorthand}}}\n{{{currentFileContent}}}```\n### Response:", }, "this field is not used": { template: "NEXT_EDIT", @@ -142,9 +142,18 @@ export async function renderPrompt( ); const model1Ctx: Model1TemplateVars = { - userEdits: ctx.userEdits, + recentlyViewedCodeSnippets: recentlyViewedCodeSnippetsBlock( + ctx.recentlyViewedCodeSnippets, + ), + currentFileContent: currentFileContentBlock( + ctx.currentFileContent, + ctx.editableRegionStartLine, + ctx.editableRegionEndLine, + helper.pos, + ), + editDiffHistory: editHistoryBlock(ctx.editDiffHistory), + currentFilePath: ctx.currentFilePath, languageShorthand: ctx.languageShorthand, - userExcerpts: ctx.userExcerpts, }; tv = model1Ctx; From 4dea1af5e907b3092b300514ba846d35677f49ba Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 8 Aug 2025 10:52:59 +0530 Subject: [PATCH 027/174] remove schema parser --- core/llm/llms/Voyage.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/core/llm/llms/Voyage.ts b/core/llm/llms/Voyage.ts index 94c344a56..6a3a3dd1f 100644 --- a/core/llm/llms/Voyage.ts +++ b/core/llm/llms/Voyage.ts @@ -1,21 +1,6 @@ -import { z } from "zod"; - import { Chunk, LLMOptions } from "../../index.js"; import OpenAI from "./OpenAI.js"; -/**used to check a valid response from voyage is received - * reference: https://docs.voyageai.com/reference/reranker-api - */ -const VoyageRerankSuccessResponseSchema = z.object({ - data: z.array( - z.object({ - index: z.number(), - relevance_score: z.number(), - document: z.string(), - }), - ), -}); - class Voyage extends OpenAI { static providerName = "voyage"; static defaultOptions: Partial | undefined = { @@ -51,8 +36,6 @@ class Voyage extends OpenAI { data: Array<{ index: number; relevance_score: number }>; }; - VoyageRerankSuccessResponseSchema.parse(data); - const results = data.data.sort((a, b) => a.index - b.index); return results.map((result) => result.relevance_score); } From 6e66c0e694139dd3df762ca624bb3e1d2f4400be Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 8 Aug 2025 11:42:06 +0530 Subject: [PATCH 028/174] fix: remove add model system message --- core/config/util.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/core/config/util.ts b/core/config/util.ts index a53027a76..08bf8949b 100644 --- a/core/config/util.ts +++ b/core/config/util.ts @@ -10,7 +10,6 @@ import { JSONModelDescription, PromptTemplate, } from "../"; -import { DEFAULT_CHAT_SYSTEM_MESSAGE } from "../llm/defaultSystemMessages"; import { GlobalContext } from "../util/GlobalContext"; import { editConfigFile } from "../util/paths"; @@ -80,12 +79,6 @@ export function addModel( maxStopWords: model.maxStopWords, defaultCompletionOptions: model.completionOptions, }; - if (model.systemMessage) { - desc.chatOptions = { - baseSystemMessage: - DEFAULT_CHAT_SYSTEM_MESSAGE + "\n\n" + model.systemMessage, - }; - } config.models.push(desc); return config; }, From 5b9feccc69efa8631258c499b461f9ed7a25df09 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 8 Aug 2025 12:42:08 +0530 Subject: [PATCH 029/174] fix: abort controller before clearing --- core/indexing/CodebaseIndexer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 6e1dab530..b28ece8da 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -735,6 +735,7 @@ export class CodebaseIndexer { }); } if (this.indexingCancellationController === localController) { + this.indexingCancellationController.abort(); // abort before clearing to prevent race condition (multiple starts) this.indexingCancellationController = undefined; } } From 1c41a7fd7027a42f4205aa974a0009928081513d Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 10:28:18 -0700 Subject: [PATCH 030/174] feat: keep track of autocomplete context --- core/nextEdit/NextEditProvider.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 825515225..78690f200 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -59,6 +59,8 @@ import { PromptMetadata, RecentlyEditedRange, } from "./types.js"; +import { getAutocompleteContext } from "./context/autocompleteContextFetching.js"; +import { EditAggregator } from "./context/aggregateEdits.js"; const autocompleteCache = AutocompleteLruCache.get(); @@ -82,6 +84,7 @@ export class NextEditProvider { private contextRetrievalService: ContextRetrievalService; private endpointType: "default" | "fineTuned"; private diffContext: string = ""; + private autocompleteContext: string = ""; private promptMetadata: PromptMetadata | null = null; private currentEditChainId: string | null = null; private previousRequest: AutocompleteInput | null = null; @@ -136,6 +139,10 @@ export class NextEditProvider { this.diffContext = diff; } + public addAutocompleteContext(ctx: string): void { + this.autocompleteContext = ctx; + } + private async _prepareLlm(): Promise { const llm = await this._injectedGetLlm(); @@ -545,11 +552,7 @@ export class NextEditProvider { }; } else if (modelName.includes("model-1")) { ctx = { - recentlyViewedCodeSnippets: - snippetPayload.recentlyVisitedRangesSnippets.map((snip) => ({ - filepath: snip.filepath, - content: snip.content, - })) ?? [], + contextSnippets: this.autocompleteContext, currentFileContent: helper.fileContents, editableRegionStartLine, editableRegionEndLine, From 92f60e2d15b7a0c5a1855a0d153db067f9ab7107 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 10:29:05 -0700 Subject: [PATCH 031/174] feat: add to autocomplete context on small edit --- core/nextEdit/context/processNextEditData.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/nextEdit/context/processNextEditData.ts b/core/nextEdit/context/processNextEditData.ts index aaa89d33a..0cecfe33e 100644 --- a/core/nextEdit/context/processNextEditData.ts +++ b/core/nextEdit/context/processNextEditData.ts @@ -3,6 +3,7 @@ import { AutocompleteCodeSnippet } from "../../autocomplete/snippets/types"; import { GetLspDefinitionsFunction } from "../../autocomplete/types"; import { ConfigHandler } from "../../config/ConfigHandler"; import { DataLogger } from "../../data/log"; +import { NextEditProvider } from "../NextEditProvider"; import { RecentlyEditedRange } from "../types"; import { getAutocompleteContext } from "./autocompleteContextFetching"; import { createDiff, DiffFormatType } from "./diffFormatting"; @@ -75,6 +76,8 @@ export const processNextEditData = async ({ modelName, ); + NextEditProvider.getInstance().addAutocompleteContext(autocompleteContext); + // console.log( // createDiff(beforeContent, afterContent, filePath, DiffFormatType.Unified), // ); From db87e89126882f7df5d60214b9ed01ad4d950655 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 10:30:01 -0700 Subject: [PATCH 032/174] feat: use contextSnippets instead of recentlyViewedCodeSnippets --- core/nextEdit/templating/NextEditPromptEngine.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index 2c9235eb0..00e573646 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -30,6 +30,7 @@ import { insertCursorToken, insertEditableRegionTokensWithStaticRange, } from "./utils"; +import { contextSnippetsBlock } from "./model1"; type TemplateRenderer = (vars: TemplateVars) => string; @@ -142,9 +143,7 @@ export async function renderPrompt( ); const model1Ctx: Model1TemplateVars = { - recentlyViewedCodeSnippets: recentlyViewedCodeSnippetsBlock( - ctx.recentlyViewedCodeSnippets, - ), + contextSnippets: contextSnippetsBlock(ctx.contextSnippets), currentFileContent: currentFileContentBlock( ctx.currentFileContent, ctx.editableRegionStartLine, From b4c7df46cdff342bda5dcfcb0b7f865fd0511ff9 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 10:30:30 -0700 Subject: [PATCH 033/174] feat: replace field --- core/nextEdit/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/nextEdit/types.ts b/core/nextEdit/types.ts index 2b9d3162c..4c50e0291 100644 --- a/core/nextEdit/types.ts +++ b/core/nextEdit/types.ts @@ -91,7 +91,7 @@ export interface NextEditTemplate { export interface TemplateVars {} export interface Model1TemplateVars extends TemplateVars { - recentlyViewedCodeSnippets: string; + contextSnippets: string; currentFileContent: string; editDiffHistory: string; // could be a singe large unified diff currentFilePath: string; From 534e4531848f94518bbe9b0ea8cff10de8bdb781 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 10:31:28 -0700 Subject: [PATCH 034/174] feat: add a helper function to parse contextSnippets --- core/nextEdit/templating/model1.ts | 49 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/core/nextEdit/templating/model1.ts b/core/nextEdit/templating/model1.ts index 84a754efd..3248d6a05 100644 --- a/core/nextEdit/templating/model1.ts +++ b/core/nextEdit/templating/model1.ts @@ -9,19 +9,33 @@ import { import { extractMetadataFromUnifiedDiff } from "../context/diffFormatting"; import { insertCursorToken } from "./utils"; -export function recentlyViewedCodeSnippetsBlock( - recentlyViewedCodeSnippets: { filepath: string; content: string }[], -) { - return recentlyViewedCodeSnippets.reduce((acc, snippet, i) => { - const block = [ - `${MODEL_1_CONTEXT_FILE_TOKEN}: ${snippet.filepath}`, - `${MODEL_1_SNIPPET_TOKEN}\n${snippet.content}`, - ].join("\n"); +/** + * @param contextSnippets Codestral style snippet with +++++ filename\ncontent or an empty string. + */ +export function contextSnippetsBlock(contextSnippets: string) { + const headerRegex = /^(\+\+\+\+\+ )(.*)/g; + const lines = contextSnippets.split("\n"); - return ( - acc + block + (i === recentlyViewedCodeSnippets.length - 1 ? "" : "\n") - ); - }, ""); + return lines + .reduce((acc, line) => { + const matches = line.match(headerRegex); + if (matches) { + acc.push("\n"); + const filename = matches[2]; + acc.push(`${MODEL_1_CONTEXT_FILE_TOKEN}: ${filename}`); + } else { + if ( + acc.length > 0 && + acc[acc.length - 1].match(headerRegex) // if header was added just before + ) { + acc.push(`${MODEL_1_SNIPPET_TOKEN}`); + } + acc.push(line); + } + + return acc; + }, []) + .join("\n"); } export function currentFileContentBlock( @@ -75,14 +89,3 @@ export function editHistoryBlock( return block.join("\n"); } - -function mercuryNextEditTemplateBuilder( - recentlyViewedCodeSnippets: { filepath: string; code: string }[], - currentFileContent: string, - codeToEdit: string, - codeToEditRange: Range, - cursorPosition: Position, - editDiffHistory: string, // could be a singe large unified diff -): string { - return ""; -} From faa6c0f6c52f36f9fb4b99193d91a0c69d479bee Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:04:56 -0700 Subject: [PATCH 035/174] test: add vitest for helper functions --- core/nextEdit/templating/model1.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/nextEdit/templating/model1.ts b/core/nextEdit/templating/model1.ts index 3248d6a05..3a7a617c0 100644 --- a/core/nextEdit/templating/model1.ts +++ b/core/nextEdit/templating/model1.ts @@ -1,4 +1,4 @@ -import { Position, Range } from "../.."; +import { Position } from "../.."; import { MODEL_1_CONTEXT_FILE_TOKEN, MODEL_1_EDITABLE_REGION_END_TOKEN, @@ -13,20 +13,19 @@ import { insertCursorToken } from "./utils"; * @param contextSnippets Codestral style snippet with +++++ filename\ncontent or an empty string. */ export function contextSnippetsBlock(contextSnippets: string) { - const headerRegex = /^(\+\+\+\+\+ )(.*)/g; + const headerRegex = /^(\+\+\+\+\+ )(.*)/; const lines = contextSnippets.split("\n"); return lines .reduce((acc, line) => { const matches = line.match(headerRegex); if (matches) { - acc.push("\n"); const filename = matches[2]; acc.push(`${MODEL_1_CONTEXT_FILE_TOKEN}: ${filename}`); } else { if ( acc.length > 0 && - acc[acc.length - 1].match(headerRegex) // if header was added just before + acc[acc.length - 1].startsWith(MODEL_1_CONTEXT_FILE_TOKEN) // if header was added just before ) { acc.push(`${MODEL_1_SNIPPET_TOKEN}`); } @@ -75,13 +74,14 @@ export function editHistoryBlock( const block: string[] = []; editDiffHistories.forEach((diff) => { - const metadata = extractMetadataFromUnifiedDiff(diff); + const diffWithoutHeader = diff.split("\n").slice(2).join("\n"); + const metadata = extractMetadataFromUnifiedDiff(diffWithoutHeader); block.push( [ `User edited file \"${metadata.oldFilename}\"`, "", "```diff", - `${diff.split("\n").slice(2).join("\n")}`, + `${diffWithoutHeader}`, "```", ].join("\n"), ); From 9652276380fd79a2109c558c48ef4db8523e79f3 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:05:13 -0700 Subject: [PATCH 036/174] feat: add helper for diffFormatting --- .continue/rules/comment-periods.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .continue/rules/comment-periods.md diff --git a/.continue/rules/comment-periods.md b/.continue/rules/comment-periods.md new file mode 100644 index 000000000..bfbcc0ae1 --- /dev/null +++ b/.continue/rules/comment-periods.md @@ -0,0 +1,5 @@ +--- +alwaysApply: true +--- + +End your comments with a period. From 5e38626a3419d4bcb38df5504f53a2558d0ba287 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:05:26 -0700 Subject: [PATCH 037/174] test: add vitest for templating --- core/nextEdit/templating/model1.vitest.ts | 402 ++++++++++++++++++++++ 1 file changed, 402 insertions(+) create mode 100644 core/nextEdit/templating/model1.vitest.ts diff --git a/core/nextEdit/templating/model1.vitest.ts b/core/nextEdit/templating/model1.vitest.ts new file mode 100644 index 000000000..3facc6f6d --- /dev/null +++ b/core/nextEdit/templating/model1.vitest.ts @@ -0,0 +1,402 @@ +import { describe, expect, test } from "vitest"; +import { Position } from "../.."; +import { + contextSnippetsBlock, + currentFileContentBlock, + editHistoryBlock, +} from "./model1"; + +describe("contextSnippetsBlock", () => { + test("should format empty context snippets", () => { + const result = contextSnippetsBlock(""); + expect(result).toBe(""); + }); + + test("should format single context snippet with codestral style header", () => { + const input = `+++++ src/utils.ts +function helper() { + return "test"; +}`; + + const expected = `<|context_file|>: src/utils.ts +<|snippet|> +function helper() { + return "test"; +}`; + + const result = contextSnippetsBlock(input); + expect(result).toBe(expected); + }); + + test("should format multiple context snippets", () => { + const input = `+++++ src/file1.ts +const var1 = "value1"; + ++++++ src/file2.ts +const var2 = "value2"; +function test() {}`; + + const expected = `<|context_file|>: src/file1.ts +<|snippet|> +const var1 = "value1"; + +<|context_file|>: src/file2.ts +<|snippet|> +const var2 = "value2"; +function test() {}`; + + const result = contextSnippetsBlock(input); + expect(result).toBe(expected); + }); + + test("should handle context snippet without content", () => { + const input = "+++++ src/empty.ts"; + + const expected = `<|context_file|>: src/empty.ts`; + + const result = contextSnippetsBlock(input); + expect(result).toBe(expected); + }); + + test("should handle malformed headers gracefully", () => { + const input = `not a header ++++++ src/valid.ts +valid content`; + + const expected = `not a header +<|context_file|>: src/valid.ts +<|snippet|> +valid content`; + + const result = contextSnippetsBlock(input); + expect(result).toBe(expected); + }); + + test("should handle multiple consecutive headers", () => { + const input = `+++++ src/file1.ts ++++++ src/file2.ts +content after headers`; + + const expected = `<|context_file|>: src/file1.ts +<|context_file|>: src/file2.ts +<|snippet|> +content after headers`; + + const result = contextSnippetsBlock(input); + expect(result).toBe(expected); + }); +}); + +describe("currentFileContentBlock", () => { + test("should insert cursor and editable region tokens correctly", () => { + const content = `line 0 +line 1 +line 2 +line 3 +line 4`; + const cursorPosition: Position = { line: 2, character: 4 }; + const editableRegionStartLine = 1; + const editableRegionEndLine = 3; + + const result = currentFileContentBlock( + content, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `line 0 +<|editable_region_start|> +line 1 +line<|user_cursor_is_here|> 2 +line 3 +<|editable_region_end|> +line 4`; + + expect(result).toBe(expected); + }); + + test("should handle cursor at beginning of line", () => { + const content = `line 0 +line 1 +line 2`; + const cursorPosition: Position = { line: 1, character: 0 }; + const editableRegionStartLine = 0; + const editableRegionEndLine = 2; + + const result = currentFileContentBlock( + content, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `<|editable_region_start|> +line 0 +<|user_cursor_is_here|>line 1 +line 2 +<|editable_region_end|>`; + + expect(result).toBe(expected); + }); + + test("should handle cursor at end of line", () => { + const content = `line 0 +line 1 +line 2`; + const cursorPosition: Position = { line: 1, character: 6 }; // end of "line 1" + const editableRegionStartLine = 0; + const editableRegionEndLine = 2; + + const result = currentFileContentBlock( + content, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `<|editable_region_start|> +line 0 +line 1<|user_cursor_is_here|> +line 2 +<|editable_region_end|>`; + + expect(result).toBe(expected); + }); + + test("should handle single line editable region", () => { + const content = `line 0 +line 1 +line 2`; + const cursorPosition: Position = { line: 1, character: 2 }; + const editableRegionStartLine = 1; + const editableRegionEndLine = 1; + + const result = currentFileContentBlock( + content, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `line 0 +<|editable_region_start|> +li<|user_cursor_is_here|>ne 1 +<|editable_region_end|> +line 2`; + + expect(result).toBe(expected); + }); + + test("should handle cursor outside bounds gracefully", () => { + const content = `line 0 +line 1`; + const cursorPosition: Position = { line: 10, character: 0 }; // out of bounds + const editableRegionStartLine = 0; + const editableRegionEndLine = 1; + + const result = currentFileContentBlock( + content, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `<|editable_region_start|> +line 0 +line 1 +<|editable_region_end|>`; + + expect(result).toBe(expected); + }); + + test("should handle editable region covering entire file", () => { + const content = `line 0 +line 1 +line 2`; + const cursorPosition: Position = { line: 1, character: 0 }; + const editableRegionStartLine = 0; + const editableRegionEndLine = 2; + + const result = currentFileContentBlock( + content, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `<|editable_region_start|> +line 0 +<|user_cursor_is_here|>line 1 +line 2 +<|editable_region_end|>`; + + expect(result).toBe(expected); + }); +}); + +describe("editHistoryBlock", () => { + test("should format empty edit history", () => { + const result = editHistoryBlock([]); + expect(result).toBe(""); + }); + + test("should format single diff history entry", () => { + const diff = `Index: test.js +=================================================================== +--- a/test.js 2023-01-01 10:00:00.000000000 +0000 ++++ b/test.js 2023-01-01 10:01:00.000000000 +0000 +@@ -1,3 +1,3 @@ + function test() { +- console.log("old"); ++ console.log("new"); + }`; + + const result = editHistoryBlock([diff]); + const expected = `User edited file "test.js" + +\`\`\`diff +--- a/test.js 2023-01-01 10:00:00.000000000 +0000 ++++ b/test.js 2023-01-01 10:01:00.000000000 +0000 +@@ -1,3 +1,3 @@ + function test() { +- console.log("old"); ++ console.log("new"); + } +\`\`\``; + + expect(result).toBe(expected); + }); + + test("should format multiple diff history entries", () => { + const diff1 = `Index: file1.js +=================================================================== +--- a/file1.js 2023-01-01 10:00:00.000000000 +0000 ++++ b/file1.js 2023-01-01 10:01:00.000000000 +0000 +@@ -1 +1 @@ +-const old = 1; ++const new = 1;`; + + const diff2 = `Index: file2.js +=================================================================== +--- a/file2.js 2023-01-01 10:02:00.000000000 +0000 ++++ b/file2.js 2023-01-01 10:03:00.000000000 +0000 +@@ -1 +1 @@ +-let x = "old"; ++let x = "new";`; + + const result = editHistoryBlock([diff1, diff2]); + const expected = `User edited file "file1.js" + +\`\`\`diff +--- a/file1.js 2023-01-01 10:00:00.000000000 +0000 ++++ b/file1.js 2023-01-01 10:01:00.000000000 +0000 +@@ -1 +1 @@ +-const old = 1; ++const new = 1; +\`\`\` +User edited file "file2.js" + +\`\`\`diff +--- a/file2.js 2023-01-01 10:02:00.000000000 +0000 ++++ b/file2.js 2023-01-01 10:03:00.000000000 +0000 +@@ -1 +1 @@ +-let x = "old"; ++let x = "new"; +\`\`\``; + + expect(result).toBe(expected); + }); + + test("should handle diff with complex filename paths", () => { + const diff = `Index: src/components/Button/Button.tsx +=================================================================== +--- a/src/components/Button/Button.tsx 2023-01-01 10:00:00.000000000 +0000 ++++ b/src/components/Button/Button.tsx 2023-01-01 10:01:00.000000000 +0000 +@@ -1,2 +1,2 @@ +-export const Button = () => ; ++export const Button = () => ;`; + + const result = editHistoryBlock([diff]); + const expected = `User edited file "src/components/Button/Button.tsx" + +\`\`\`diff +--- a/src/components/Button/Button.tsx 2023-01-01 10:00:00.000000000 +0000 ++++ b/src/components/Button/Button.tsx 2023-01-01 10:01:00.000000000 +0000 +@@ -1,2 +1,2 @@ +-export const Button = () => ; ++export const Button = () => ; +\`\`\``; + + expect(result).toBe(expected); + }); + + test("should handle diff with new file creation", () => { + const diff = `Index: newfile.js +=================================================================== +--- /dev/null 2023-01-01 10:00:00.000000000 +0000 ++++ b/newfile.js 2023-01-01 10:01:00.000000000 +0000 +@@ -0,0 +1,3 @@ ++function newFunction() { ++ return "hello world"; ++}`; + + const result = editHistoryBlock([diff]); + const expected = `User edited file "/dev/null" + +\`\`\`diff +--- /dev/null 2023-01-01 10:00:00.000000000 +0000 ++++ b/newfile.js 2023-01-01 10:01:00.000000000 +0000 +@@ -0,0 +1,3 @@ ++function newFunction() { ++ return "hello world"; ++} +\`\`\``; + + expect(result).toBe(expected); + }); + + test("should handle diff with file deletion", () => { + const diff = `Index: deletedfile.js +=================================================================== +--- a/deletedfile.js 2023-01-01 10:00:00.000000000 +0000 ++++ /dev/null 2023-01-01 10:01:00.000000000 +0000 +@@ -1,3 +0,0 @@ +-function deletedFunction() { +- return "goodbye"; +-}`; + + const result = editHistoryBlock([diff]); + const expected = `User edited file "deletedfile.js" + +\`\`\`diff +--- a/deletedfile.js 2023-01-01 10:00:00.000000000 +0000 ++++ /dev/null 2023-01-01 10:01:00.000000000 +0000 +@@ -1,3 +0,0 @@ +-function deletedFunction() { +- return "goodbye"; +-} +\`\`\``; + + expect(result).toBe(expected); + }); + + test("should handle minimal diff format", () => { + const diff = `Index: simple.txt +=================================================================== +@@ -1 +1 @@ +-old text ++new text`; + + const result = editHistoryBlock([diff]); + const expected = `User edited file "undefined" + +\`\`\`diff +@@ -1 +1 @@ +-old text ++new text +\`\`\``; + + expect(result).toBe(expected); + }); +}); From 109ef6e70d05ce117f48d5966b9d420417378fcf Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:05:44 -0700 Subject: [PATCH 038/174] feat: add helper to get metadata from unified diff --- core/nextEdit/context/diffFormatting.ts | 95 +++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/core/nextEdit/context/diffFormatting.ts b/core/nextEdit/context/diffFormatting.ts index 465a7106f..7103db88c 100644 --- a/core/nextEdit/context/diffFormatting.ts +++ b/core/nextEdit/context/diffFormatting.ts @@ -95,3 +95,98 @@ const createTokenLineDiff = ( // TODO: Implement token line diff return ""; }; + +export interface DiffMetadata { + oldFilename?: string; // Filename in the original version + newFilename?: string; // Filename in the modified version + oldTimestamp?: string; // Timestamp of the original file + newTimestamp?: string; // Timestamp of the modified file + hunks?: Array<{ + // Information about each change hunk + oldStart: number; // Starting line in original file + oldCount: number; // Number of lines in original file + newStart: number; // Starting line in modified file + newCount: number; // Number of lines in modified file + header?: string; // Optional section header + }>; + isBinary?: boolean; // Whether this is a binary file diff + isNew?: boolean; // Whether this is a new file + isDeleted?: boolean; // Whether this file was deleted + isRename?: boolean; // Whether this file was renamed +} + +export function extractMetadataFromUnifiedDiff( + unifiedDiff: string, +): DiffMetadata { + const metadata: DiffMetadata = {}; + const lines = unifiedDiff.split("\n"); + + // Parse the header lines (first two lines) + if (lines.length >= 2) { + // Parse original file info (--- line) + const oldFileMatch = lines[0].match( + /^--- (a\/)?([^\t\s]+)(?:[\t\s]+(.+))?$/, + ); + if (oldFileMatch) { + metadata.oldFilename = oldFileMatch[2]; + metadata.oldTimestamp = oldFileMatch[3]; + + // Check if this is a new file + if (metadata.oldFilename === "/dev/null") { + metadata.isNew = true; + } + } + + // Parse modified file info (+++ line) + const newFileMatch = lines[1].match( + /^\+\+\+ (b\/)?([^\t\s]+)(?:[\t\s]+(.+))?$/, + ); + if (newFileMatch) { + metadata.newFilename = newFileMatch[2]; + metadata.newTimestamp = newFileMatch[3]; + + // Check if this file was deleted + if (metadata.newFilename === "/dev/null") { + metadata.isDeleted = true; + } + } + + // Check if this is a rename (different old and new names) + if ( + metadata.oldFilename && + metadata.newFilename && + metadata.oldFilename !== "/dev/null" && + metadata.newFilename !== "/dev/null" && + metadata.oldFilename !== metadata.newFilename + ) { + metadata.isRename = true; + } + } + + // Parse hunk headers + metadata.hunks = []; + const hunkHeaderRegex = + /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?:\s(.*))?$/; + + for (let i = 2; i < lines.length; i++) { + const line = lines[i]; + const hunkMatch = line.match(hunkHeaderRegex); + + if (hunkMatch) { + metadata.hunks.push({ + oldStart: parseInt(hunkMatch[1], 10), + oldCount: hunkMatch[2] ? parseInt(hunkMatch[2], 10) : 1, + newStart: parseInt(hunkMatch[3], 10), + newCount: hunkMatch[4] ? parseInt(hunkMatch[4], 10) : 1, + header: hunkMatch[5], + }); + } + + // Check for binary file marker + if (line.includes("Binary files") || line.includes("GIT binary patch")) { + metadata.isBinary = true; + } + } + + return metadata; +} From 5918041cc086d38743efc1f24e7e674c97541430 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:10:22 -0700 Subject: [PATCH 039/174] test: add vitest for diffFormatting --- .../nextEdit/context/diffFormatting.vitest.ts | 397 ++++++++++++++++++ 1 file changed, 397 insertions(+) create mode 100644 core/nextEdit/context/diffFormatting.vitest.ts diff --git a/core/nextEdit/context/diffFormatting.vitest.ts b/core/nextEdit/context/diffFormatting.vitest.ts new file mode 100644 index 000000000..05561d52b --- /dev/null +++ b/core/nextEdit/context/diffFormatting.vitest.ts @@ -0,0 +1,397 @@ +import { describe, expect, it } from "vitest"; +import { + BeforeAfterDiff, + createBeforeAfterDiff, + createDiff, + CreateDiffArgs, + DiffFormatType, + DiffMetadata, + extractMetadataFromUnifiedDiff, +} from "./diffFormatting"; + +describe("diffFormatting", () => { + const sampleFilePath = "test/sample.js"; + const beforeContent = "const a = 1;\nconst b = 2;"; + const afterContent = "const a = 1;\nconst b = 3;\nconst c = 4;"; + + describe("createDiff", () => { + it("should create unified diff when specified", () => { + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: sampleFilePath, + diffType: DiffFormatType.Unified, + contextLines: 3, + }; + + const result = createDiff(args); + + expect(result).toContain("---"); + expect(result).toContain("+++"); + expect(result).toContain("@@"); + expect(result).toContain("-const b = 2;"); + expect(result).toContain("+const b = 3;"); + expect(result).toContain("+const c = 4;"); + }); + + it("should create token line diff when specified", () => { + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: sampleFilePath, + diffType: DiffFormatType.TokenLineDiff, + contextLines: 3, + }; + + const result = createDiff(args); + + // Currently returns empty string as TODO + expect(result).toBe(""); + }); + + it("should return empty string for unsupported diff types", () => { + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: sampleFilePath, + diffType: DiffFormatType.RawBeforeAfter, + contextLines: 3, + }; + + const result = createDiff(args); + + expect(result).toBe(""); + }); + + it("should handle empty content", () => { + const args: CreateDiffArgs = { + beforeContent: "", + afterContent: "new content", + filePath: sampleFilePath, + diffType: DiffFormatType.Unified, + contextLines: 3, + }; + + const result = createDiff(args); + + expect(result).toContain("+++"); + expect(result).toContain("+new content"); + }); + + it("should handle deletion", () => { + const args: CreateDiffArgs = { + beforeContent: "old content", + afterContent: "", + filePath: sampleFilePath, + diffType: DiffFormatType.Unified, + contextLines: 3, + }; + + const result = createDiff(args); + + expect(result).toContain("---"); + expect(result).toContain("-old content"); + }); + + it("should handle content without newlines", () => { + const args: CreateDiffArgs = { + beforeContent: "line1", + afterContent: "line2", + filePath: sampleFilePath, + diffType: DiffFormatType.Unified, + contextLines: 3, + }; + + const result = createDiff(args); + + expect(result).toContain("-line1"); + expect(result).toContain("+line2"); + }); + + it("should respect contextLines parameter", () => { + const multiLineContent = Array(10) + .fill("line") + .map((l, i) => `${l}${i}`) + .join("\n"); + const modifiedContent = multiLineContent.replace("line5", "modified5"); + + const args: CreateDiffArgs = { + beforeContent: multiLineContent, + afterContent: modifiedContent, + filePath: sampleFilePath, + diffType: DiffFormatType.Unified, + contextLines: 2, + }; + + const result = createDiff(args); + + expect(result).toContain("@@ -4,5 +4,5 @@"); + }); + }); + + describe("createBeforeAfterDiff", () => { + it("should return BeforeAfterDiff with normalized content", () => { + const result: BeforeAfterDiff = createBeforeAfterDiff( + beforeContent, + afterContent, + sampleFilePath, + ); + + expect(result).toEqual({ + filePath: sampleFilePath, + beforeContent: beforeContent + "\n", + afterContent: afterContent + "\n", + }); + }); + + it("should not add extra newline if content already ends with one", () => { + const contentWithNewline = "const a = 1;\n"; + const result: BeforeAfterDiff = createBeforeAfterDiff( + contentWithNewline, + contentWithNewline, + sampleFilePath, + ); + + expect(result.beforeContent).toBe(contentWithNewline); + expect(result.afterContent).toBe(contentWithNewline); + }); + + it("should handle empty content", () => { + const result: BeforeAfterDiff = createBeforeAfterDiff( + "", + "", + sampleFilePath, + ); + + expect(result).toEqual({ + filePath: sampleFilePath, + beforeContent: "\n", + afterContent: "\n", + }); + }); + + it("should handle mixed newline scenarios", () => { + const beforeWithNewline = "line1\n"; + const afterWithoutNewline = "line2"; + const result: BeforeAfterDiff = createBeforeAfterDiff( + beforeWithNewline, + afterWithoutNewline, + sampleFilePath, + ); + + expect(result.beforeContent).toBe("line1\n"); + expect(result.afterContent).toBe("line2\n"); + }); + }); + + describe("extractMetadataFromUnifiedDiff", () => { + it("should extract basic file information", () => { + const unifiedDiff = `--- a/old.js\ttimestamp1 ++++ b/new.js\ttimestamp2 +@@ -1,3 +1,3 @@ + line1 +-line2 ++modified2 + line3`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.oldFilename).toBe("old.js"); + expect(metadata.newFilename).toBe("new.js"); + expect(metadata.oldTimestamp).toBe("timestamp1"); + expect(metadata.newTimestamp).toBe("timestamp2"); + expect(metadata.isNew).toBeFalsy(); + expect(metadata.isDeleted).toBeFalsy(); + expect(metadata.isRename).toBeTruthy(); + }); + + it("should detect new files", () => { + const unifiedDiff = `--- /dev/null ++++ b/new.js +@@ -0,0 +1,2 @@ ++line1 ++line2`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.oldFilename).toBe("/dev/null"); + expect(metadata.newFilename).toBe("new.js"); + expect(metadata.isNew).toBeTruthy(); + expect(metadata.isDeleted).toBeFalsy(); + expect(metadata.isRename).toBeFalsy(); + }); + + it("should detect deleted files", () => { + const unifiedDiff = `--- a/old.js ++++ /dev/null +@@ -1,2 +0,0 @@ +-line1 +-line2`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.oldFilename).toBe("old.js"); + expect(metadata.newFilename).toBe("/dev/null"); + expect(metadata.isNew).toBeFalsy(); + expect(metadata.isDeleted).toBeTruthy(); + expect(metadata.isRename).toBeFalsy(); + }); + + it("should parse hunk information", () => { + const unifiedDiff = `--- a/file.js ++++ b/file.js +@@ -1,5 +1,6 @@ function header + line1 +-line2 ++modified2 ++newline + line3 +@@ -10,3 +11,3 @@ + line10 +-line11 ++modified11 + line12`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.hunks).toHaveLength(2); + expect(metadata.hunks![0]).toEqual({ + oldStart: 1, + oldCount: 5, + newStart: 1, + newCount: 6, + header: "function header", + }); + expect(metadata.hunks![1]).toEqual({ + oldStart: 10, + oldCount: 3, + newStart: 11, + newCount: 3, + header: undefined, + }); + }); + + it("should handle single line hunks", () => { + const unifiedDiff = `--- a/file.js ++++ b/file.js +@@ -1 +1 @@ +-old ++new`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.hunks).toHaveLength(1); + expect(metadata.hunks![0]).toEqual({ + oldStart: 1, + oldCount: 1, + newStart: 1, + newCount: 1, + header: undefined, + }); + }); + + it("should detect binary files", () => { + const unifiedDiff = `--- a/image.png ++++ b/image.png +Binary files a/image.png and b/image.png differ`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.isBinary).toBeTruthy(); + }); + + it("should detect git binary patches", () => { + const unifiedDiff = `--- a/file.bin ++++ b/file.bin +GIT binary patch +delta 123 +...`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.isBinary).toBeTruthy(); + }); + + it("should handle files without a/ b/ prefixes", () => { + const unifiedDiff = `--- old.js ++++ new.js +@@ -1,2 +1,2 @@ +-line1 ++modified1 + line2`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.oldFilename).toBe("old.js"); + expect(metadata.newFilename).toBe("new.js"); + }); + + it("should handle empty diff", () => { + const metadata: DiffMetadata = extractMetadataFromUnifiedDiff(""); + + expect(metadata.oldFilename).toBeUndefined(); + expect(metadata.newFilename).toBeUndefined(); + expect(metadata.hunks).toEqual([]); + expect(metadata.isBinary).toBeFalsy(); + }); + + it("should handle malformed diff gracefully", () => { + const malformedDiff = `not a diff +random text`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(malformedDiff); + + expect(metadata.oldFilename).toBeUndefined(); + expect(metadata.newFilename).toBeUndefined(); + expect(metadata.hunks).toEqual([]); + }); + + it("should not consider same filenames as rename", () => { + const unifiedDiff = `--- a/file.js ++++ b/file.js +@@ -1,2 +1,2 @@ +-line1 ++modified1 + line2`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.isRename).toBeFalsy(); + }); + + it("should handle files with spaces in names", () => { + const unifiedDiff = `--- a/my file.js\t2023-01-01 00:00:00 ++++ b/my new file.js\t2023-01-01 00:01:00 +@@ -1,1 +1,1 @@ +-content ++new content`; + + const metadata: DiffMetadata = + extractMetadataFromUnifiedDiff(unifiedDiff); + + expect(metadata.oldFilename).toBe("my file.js"); + expect(metadata.newFilename).toBe("my new file.js"); + expect(metadata.oldTimestamp).toBe("2023-01-01 00:00:00"); + expect(metadata.newTimestamp).toBe("2023-01-01 00:01:00"); + expect(metadata.isRename).toBeTruthy(); + }); + }); + + describe("DiffFormatType enum", () => { + it("should have correct enum values", () => { + expect(DiffFormatType.Unified).toBe("unified"); + expect(DiffFormatType.RawBeforeAfter).toBe("beforeAfter"); + expect(DiffFormatType.TokenLineDiff).toBe("linediff"); + }); + }); +}); From 59a37c95404dc86c9c01853a9d41e8f96cb6e173 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:10:39 -0700 Subject: [PATCH 040/174] fix: handle cases where filename includes spaces --- core/nextEdit/context/diffFormatting.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/nextEdit/context/diffFormatting.ts b/core/nextEdit/context/diffFormatting.ts index 7103db88c..c9c0ffa41 100644 --- a/core/nextEdit/context/diffFormatting.ts +++ b/core/nextEdit/context/diffFormatting.ts @@ -124,9 +124,7 @@ export function extractMetadataFromUnifiedDiff( // Parse the header lines (first two lines) if (lines.length >= 2) { // Parse original file info (--- line) - const oldFileMatch = lines[0].match( - /^--- (a\/)?([^\t\s]+)(?:[\t\s]+(.+))?$/, - ); + const oldFileMatch = lines[0].match(/^--- (a\/)?(.+?)(?:\t(.+))?$/); if (oldFileMatch) { metadata.oldFilename = oldFileMatch[2]; metadata.oldTimestamp = oldFileMatch[3]; @@ -138,9 +136,7 @@ export function extractMetadataFromUnifiedDiff( } // Parse modified file info (+++ line) - const newFileMatch = lines[1].match( - /^\+\+\+ (b\/)?([^\t\s]+)(?:[\t\s]+(.+))?$/, - ); + const newFileMatch = lines[1].match(/^\+\+\+ (b\/)?(.+?)(?:\t(.+))?$/); if (newFileMatch) { metadata.newFilename = newFileMatch[2]; metadata.newTimestamp = newFileMatch[3]; From 65cd7d47aa92ff7e40cf5d5fa0559a6f97ad5c1e Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 11:17:05 -0700 Subject: [PATCH 041/174] fix: recover from bad merge --- core/nextEdit/templating/NextEditPromptEngine.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index 94f80775c..6bd9c21d8 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -41,7 +41,7 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { }, "model-1": { template: - "### User Edits:\n\n{{{userEdits}}}\n\n### User Excerpts:\n\n```{{{languageShorthand}}}\n{{{userExcerpts}}}```", + "### User Edits:\n\n{{{editDiffHistory}}}\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n### User Excerpts:\n\n```{{{languageShorthand}}}\n{{{currentFileContent}}}```\n### Response:", }, }; From 4a6fe51fe21e346668629ca5ab58a99203611f9a Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 12:10:44 -0700 Subject: [PATCH 042/174] feat: enrich model request with system and user prompt prefix --- core/nextEdit/NextEditProvider.ts | 7 +++--- core/nextEdit/constants.ts | 25 +++++++++++++++++++ .../templating/NextEditPromptEngine.ts | 4 +-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index ca5c23eaa..8f9f55527 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -37,6 +37,7 @@ import { replaceEscapedCharacters } from "../util/text.js"; import { MERCURY_CODE_TO_EDIT_OPEN, MERCURY_SYSTEM_PROMPT, + MODEL_1_SYSTEM_PROMPT, NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, } from "./constants.js"; @@ -60,8 +61,6 @@ import { PromptMetadata, RecentlyEditedRange, } from "./types.js"; -import { getAutocompleteContext } from "./context/autocompleteContextFetching.js"; -import { EditAggregator } from "./context/aggregateEdits.js"; const autocompleteCache = AutocompleteLruCache.get(); @@ -578,7 +577,9 @@ export class NextEditProvider { const systemPrompt: Prompt = { role: "system", - content: MERCURY_SYSTEM_PROMPT, + content: modelName.includes("mercury-coder-nextedit") + ? MERCURY_SYSTEM_PROMPT + : MODEL_1_SYSTEM_PROMPT, }; return [systemPrompt, promptMetadata.prompt]; diff --git a/core/nextEdit/constants.ts b/core/nextEdit/constants.ts index 1c94db662..21e249b96 100644 --- a/core/nextEdit/constants.ts +++ b/core/nextEdit/constants.ts @@ -8,6 +8,31 @@ export const MODEL_1_EDITABLE_REGION_START_TOKEN = "<|editable_region_start|>"; export const MODEL_1_EDITABLE_REGION_END_TOKEN = "<|editable_region_end|>"; export const MODEL_1_CONTEXT_FILE_TOKEN = "<|context_file|>"; export const MODEL_1_SNIPPET_TOKEN = "<|snippet|>"; +export const MODEL_1_SYSTEM_PROMPT = `You are Instinct, an intelligent next-edit predictor developed by Continue.dev. Your role as an AI assistant is to help developers complete their code tasks by predicting the next edit that they will make within the section of code marked by <|editable_region_start|> and <|editable_region_end|> tags. + +You have access to the following information to help you make informed suggestions: + +- Context: In the section marked "### Context", there are context items from potentially relevant files in the developer's codebase. Each context item consists of a <|context_file|> marker, the filepath, a <|snippet|> marker, and then some content from that file, in that order. Keep in mind that not all of the context information may be relevant to the task, so use your judgement to determine which parts to consider. +- User Edits: In the section marked "### User Edits:", there is a record of the most recent changes made to the code, helping you understand the evolution of the code and the developer's intentions. These changes are listed from most recent to least recent. It's possible that some of the edit diff history is entirely irrelevant to the developer's change. The changes are provided in a unified line-diff format, i.e. with pluses and minuses for additions and deletions to the code. +- User Excerpt: In the section marked "### User Excerpt:", there is a filepath to the developer's current file, and then an excerpt from that file. The <|editable_region_start|> and <|editable_region_end|> markers are within this excerpt. Your job is to rewrite only this editable region, not the whole excerpt. The excerpt provides additional context on the surroundings of the developer's edit. +- Cursor Position: Within the user excerpt's editable region, the <|user_cursor_is_here|> flag indicates where the developer's cursor is currently located, which can be crucial for understanding what part of the code they are focusing on. Do not produce this marker in your output; simply take it into account. + +Your task is to predict and complete the changes the developer would have made next in the editable region. The developer may have stopped in the middle of typing. Your goal is to keep the developer on the path that you think they're following. Some examples include further implementing a class, method, or variable, or improving the quality of the code. Make sure the developer doesn't get distracted by ensuring your suggestion is relevant. Consider what changes need to be made next, if any. If you think changes should be made, ask yourself if this is truly what needs to happen. If you are confident about it, then proceed with the changes. + +# Steps + +1. **Review Context**: Analyze the context from the resources provided, such as recently viewed snippets, edit history, surrounding code, and cursor location. +2. **Evaluate Current Code**: Determine if the current code within the tags requires any corrections or enhancements. +3. **Suggest Edits**: If changes are required, ensure they align with the developer's patterns and improve code quality. +4. **Maintain Consistency**: Ensure indentation and formatting follow the existing code style. + +# Output Format + +- Provide only the revised code within the tags. Do not include the tags in your output. +- Ensure that you do not output duplicate code that exists outside of these tags. +- Avoid undoing or reverting the developer's last change unless there are obvious typos or errors.`; +export const MODEL_1_USER_PROMPT_PREFIX = + "Reference the user excerpt, user edits, and the snippets to understand the developer's intent. Update the editable region of the user excerpt by predicting and completing the changes they would have made next. This may be a deletion, addition, or modification of code."; // Mercury Coder Next Edit-specific tokens. export const MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN = diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index 6bd9c21d8..deb1b60c6 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -12,6 +12,7 @@ import { MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE, MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN, MODEL_1_USER_CURSOR_IS_HERE_TOKEN, + MODEL_1_USER_PROMPT_PREFIX, } from "../constants"; import { MercuryTemplateVars, @@ -40,8 +41,7 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { template: `${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN}\n{{{recentlyViewedCodeSnippets}}}\n${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE}\n\n${MERCURY_CURRENT_FILE_CONTENT_OPEN}\n{{{currentFileContent}}}\n${MERCURY_CURRENT_FILE_CONTENT_CLOSE}\n\n${MERCURY_EDIT_DIFF_HISTORY_OPEN}\n{{{editDiffHistory}}}\n${MERCURY_EDIT_DIFF_HISTORY_CLOSE}\n\nThe developer was working on a section of code within the tags \`<|code_to_edit|>\` in the file located at {{{currentFilePath}}}.\nUsing the given \`recently_viewed_code_snippets\`, \`current_file_content\`, \`edit_diff_history\`, and the cursor position marked as \`<|cursor|>\`, please continue the developer's work. Update the \`code_to_edit\` section by predicting and completing the changes they would have made next. Provide the revised code that was between the \`<|code_to_edit|>\` and \`<|/code_to_edit|>\` tags, including the tags themselves.`, }, "model-1": { - template: - "### User Edits:\n\n{{{editDiffHistory}}}\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n### User Excerpts:\n\n```{{{languageShorthand}}}\n{{{currentFileContent}}}```\n### Response:", + template: `${MODEL_1_USER_PROMPT_PREFIX}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{currentFileContent}}}\`\`\`\n### Response:`, }, }; From 345e90eb28fae30999647a5e6b2afc7cf7161796 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 12:15:45 -0700 Subject: [PATCH 043/174] fix: use proper import aliases --- core/nextEdit/templating/NextEditPromptEngine.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index deb1b60c6..7d4eb5b80 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -28,7 +28,11 @@ import { editHistoryBlock, recentlyViewedCodeSnippetsBlock, } from "./mercuryCoderNextEdit"; -import { contextSnippetsBlock } from "./model1"; +import { + contextSnippetsBlock, + currentFileContentBlock as model1CurrentFileContentBlock, + editHistoryBlock as model1EditHistoryBlock, +} from "./model1"; import { insertCursorToken, insertEditableRegionTokensWithStaticRange, @@ -41,7 +45,7 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { template: `${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN}\n{{{recentlyViewedCodeSnippets}}}\n${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE}\n\n${MERCURY_CURRENT_FILE_CONTENT_OPEN}\n{{{currentFileContent}}}\n${MERCURY_CURRENT_FILE_CONTENT_CLOSE}\n\n${MERCURY_EDIT_DIFF_HISTORY_OPEN}\n{{{editDiffHistory}}}\n${MERCURY_EDIT_DIFF_HISTORY_CLOSE}\n\nThe developer was working on a section of code within the tags \`<|code_to_edit|>\` in the file located at {{{currentFilePath}}}.\nUsing the given \`recently_viewed_code_snippets\`, \`current_file_content\`, \`edit_diff_history\`, and the cursor position marked as \`<|cursor|>\`, please continue the developer's work. Update the \`code_to_edit\` section by predicting and completing the changes they would have made next. Provide the revised code that was between the \`<|code_to_edit|>\` and \`<|/code_to_edit|>\` tags, including the tags themselves.`, }, "model-1": { - template: `${MODEL_1_USER_PROMPT_PREFIX}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{currentFileContent}}}\`\`\`\n### Response:`, + template: `${MODEL_1_USER_PROMPT_PREFIX}\n\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{currentFileContent}}}\`\`\`\n### Response:`, }, }; @@ -126,13 +130,13 @@ export async function renderPrompt( const model1Ctx: Model1TemplateVars = { contextSnippets: contextSnippetsBlock(ctx.contextSnippets), - currentFileContent: currentFileContentBlock( + currentFileContent: model1CurrentFileContentBlock( ctx.currentFileContent, ctx.editableRegionStartLine, ctx.editableRegionEndLine, helper.pos, ), - editDiffHistory: editHistoryBlock(ctx.editDiffHistory), + editDiffHistory: model1EditHistoryBlock(ctx.editDiffHistory), currentFilePath: ctx.currentFilePath, languageShorthand: ctx.languageShorthand, }; From 7106c9dd15f3c84452d7f1b63e0546aba1bd137f Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 12:15:59 -0700 Subject: [PATCH 044/174] feat: use 5 lines as context --- core/nextEdit/context/processSmallEdit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/nextEdit/context/processSmallEdit.ts b/core/nextEdit/context/processSmallEdit.ts index 5824191b3..a98233cfe 100644 --- a/core/nextEdit/context/processSmallEdit.ts +++ b/core/nextEdit/context/processSmallEdit.ts @@ -20,7 +20,7 @@ export const processSmallEdit = async ( afterContent: beforeAfterdiff.afterContent, filePath: beforeAfterdiff.filePath, diffType: DiffFormatType.Unified, - contextLines: 3, // NOTE: This can change depending on experiments! + contextLines: 5, // NOTE: This can change depending on experiments! }), ); From fc08da2c29ed58dd683be6fbae572d8212eecd3e Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 12:29:37 -0700 Subject: [PATCH 045/174] refactor: pass window range as well --- core/nextEdit/NextEditProvider.ts | 23 +++++++++++++++++-- .../templating/NextEditPromptEngine.ts | 2 ++ core/nextEdit/templating/model1.ts | 6 +++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 8f9f55527..67f7d1cf0 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -559,11 +559,30 @@ export class NextEditProvider { currentFilePath: helper.filepath, }; } else if (modelName.includes("model-1")) { + // Calculate the window around the cursor position (25 lines above and below). + const windowStart = Math.max(0, helper.pos.line - 25); + const windowEnd = Math.min( + helper.fileLines.length - 1, + helper.pos.line + 25, + ); + + // The editable region is defined as: cursor line - 1 to cursor line + 5 (inclusive). + const actualEditableStart = Math.max(0, helper.pos.line - 1); + const actualEditableEnd = Math.min( + helper.fileLines.length - 1, + helper.pos.line + 5, + ); + + // Ensure editable region boundaries are within the window. + const adjustedEditableStart = Math.max(windowStart, actualEditableStart); + const adjustedEditableEnd = Math.min(windowEnd, actualEditableEnd); ctx = { contextSnippets: this.autocompleteContext, currentFileContent: helper.fileContents, - editableRegionStartLine, - editableRegionEndLine, + windowStart, + windowEnd, + adjustedEditableStart, + adjustedEditableEnd, editDiffHistory: this.diffContext, currentFilePath: helper.filepath, languageShorthand: helper.lang.name, diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index 7d4eb5b80..cf7748c17 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -132,6 +132,8 @@ export async function renderPrompt( contextSnippets: contextSnippetsBlock(ctx.contextSnippets), currentFileContent: model1CurrentFileContentBlock( ctx.currentFileContent, + ctx.windowStart, + ctx.windowEnd, ctx.editableRegionStartLine, ctx.editableRegionEndLine, helper.pos, diff --git a/core/nextEdit/templating/model1.ts b/core/nextEdit/templating/model1.ts index 3a7a617c0..ad547b549 100644 --- a/core/nextEdit/templating/model1.ts +++ b/core/nextEdit/templating/model1.ts @@ -39,6 +39,8 @@ export function contextSnippetsBlock(contextSnippets: string) { export function currentFileContentBlock( currentFileContent: string, + windowStart: number, + windowEnd: number, editableRegionStartLine: number, editableRegionEndLine: number, cursorPosition: Position, @@ -52,14 +54,14 @@ export function currentFileContentBlock( ); const instrumentedLines = [ - ...insertedCursorLines.slice(0, editableRegionStartLine), + ...insertedCursorLines.slice(windowStart, editableRegionStartLine), MODEL_1_EDITABLE_REGION_START_TOKEN, ...insertedCursorLines.slice( editableRegionStartLine, editableRegionEndLine + 1, ), MODEL_1_EDITABLE_REGION_END_TOKEN, - ...insertedCursorLines.slice(editableRegionEndLine + 1), + ...insertedCursorLines.slice(editableRegionEndLine + 1, windowEnd + 1), ]; return instrumentedLines.join("\n"); From 5314fcbe25ae55980a0a745caa2117300eab62d1 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 12:30:02 -0700 Subject: [PATCH 046/174] test: update test --- core/nextEdit/templating/model1.vitest.ts | 56 ++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/core/nextEdit/templating/model1.vitest.ts b/core/nextEdit/templating/model1.vitest.ts index 3facc6f6d..c2e603da0 100644 --- a/core/nextEdit/templating/model1.vitest.ts +++ b/core/nextEdit/templating/model1.vitest.ts @@ -94,12 +94,16 @@ line 1 line 2 line 3 line 4`; + const windowStart = 0; + const windowEnd = 4; const cursorPosition: Position = { line: 2, character: 4 }; const editableRegionStartLine = 1; const editableRegionEndLine = 3; const result = currentFileContentBlock( content, + windowStart, + windowEnd, editableRegionStartLine, editableRegionEndLine, cursorPosition, @@ -120,12 +124,16 @@ line 4`; const content = `line 0 line 1 line 2`; + const windowStart = 0; + const windowEnd = 2; const cursorPosition: Position = { line: 1, character: 0 }; const editableRegionStartLine = 0; const editableRegionEndLine = 2; const result = currentFileContentBlock( content, + windowStart, + windowEnd, editableRegionStartLine, editableRegionEndLine, cursorPosition, @@ -144,12 +152,16 @@ line 2 const content = `line 0 line 1 line 2`; + const windowStart = 0; + const windowEnd = 2; const cursorPosition: Position = { line: 1, character: 6 }; // end of "line 1" const editableRegionStartLine = 0; const editableRegionEndLine = 2; const result = currentFileContentBlock( content, + windowStart, + windowEnd, editableRegionStartLine, editableRegionEndLine, cursorPosition, @@ -168,12 +180,16 @@ line 2 const content = `line 0 line 1 line 2`; + const windowStart = 0; + const windowEnd = 2; const cursorPosition: Position = { line: 1, character: 2 }; const editableRegionStartLine = 1; const editableRegionEndLine = 1; const result = currentFileContentBlock( content, + windowStart, + windowEnd, editableRegionStartLine, editableRegionEndLine, cursorPosition, @@ -188,15 +204,19 @@ line 2`; expect(result).toBe(expected); }); - test("should handle cursor outside bounds gracefully", () => { + test("should handle cursor outside bounds gracefully (this shouldn't happen)", () => { const content = `line 0 line 1`; + const windowStart = 0; + const windowEnd = 1; const cursorPosition: Position = { line: 10, character: 0 }; // out of bounds const editableRegionStartLine = 0; const editableRegionEndLine = 1; const result = currentFileContentBlock( content, + windowStart, + windowEnd, editableRegionStartLine, editableRegionEndLine, cursorPosition, @@ -214,12 +234,16 @@ line 1 const content = `line 0 line 1 line 2`; + const windowStart = 0; + const windowEnd = 2; const cursorPosition: Position = { line: 1, character: 0 }; const editableRegionStartLine = 0; const editableRegionEndLine = 2; const result = currentFileContentBlock( content, + windowStart, + windowEnd, editableRegionStartLine, editableRegionEndLine, cursorPosition, @@ -233,6 +257,36 @@ line 2 expect(result).toBe(expected); }); + + test("should handle windowing - content outside window not included", () => { + const content = `line 0 +line 1 +line 2 +line 3 +line 4`; + const windowStart = 1; + const windowEnd = 3; + const cursorPosition: Position = { line: 2, character: 2 }; + const editableRegionStartLine = 2; + const editableRegionEndLine = 2; + + const result = currentFileContentBlock( + content, + windowStart, + windowEnd, + editableRegionStartLine, + editableRegionEndLine, + cursorPosition, + ); + + const expected = `line 1 +<|editable_region_start|> +li<|user_cursor_is_here|>ne 2 +<|editable_region_end|> +line 3`; + + expect(result).toBe(expected); + }); }); describe("editHistoryBlock", () => { From 9937209bb7bfa8037e5ea8a2a24c9d54e25393f5 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 15:13:48 -0700 Subject: [PATCH 047/174] feat: add hunk details to metadata --- core/nextEdit/context/diffFormatting.ts | 61 +++++++++++++++++++++---- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/core/nextEdit/context/diffFormatting.ts b/core/nextEdit/context/diffFormatting.ts index c9c0ffa41..38a76b051 100644 --- a/core/nextEdit/context/diffFormatting.ts +++ b/core/nextEdit/context/diffFormatting.ts @@ -108,6 +108,12 @@ export interface DiffMetadata { newStart: number; // Starting line in modified file newCount: number; // Number of lines in modified file header?: string; // Optional section header + lines: Array<{ + type: "context" | "addition" | "deletion"; + content: string; + oldLineNumber?: number; + newLineNumber?: number; + }>; }>; isBinary?: boolean; // Whether this is a binary file diff isNew?: boolean; // Whether this is a new file @@ -159,23 +165,62 @@ export function extractMetadataFromUnifiedDiff( } } - // Parse hunk headers + // Parse hunk headers and content metadata.hunks = []; const hunkHeaderRegex = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?:\s(.*))?$/; + let currentHunk: NonNullable[0] | null = null; + let oldLineNumber = 0; + let newLineNumber = 0; + for (let i = 2; i < lines.length; i++) { const line = lines[i]; const hunkMatch = line.match(hunkHeaderRegex); if (hunkMatch) { - metadata.hunks.push({ - oldStart: parseInt(hunkMatch[1], 10), - oldCount: hunkMatch[2] ? parseInt(hunkMatch[2], 10) : 1, - newStart: parseInt(hunkMatch[3], 10), - newCount: hunkMatch[4] ? parseInt(hunkMatch[4], 10) : 1, - header: hunkMatch[5], - }); + currentHunk = { + oldStart: parseInt(hunkMatch[1], 10), // line number where changes start in original file + oldCount: hunkMatch[2] ? parseInt(hunkMatch[2], 10) : 1, // number of changed lines in original file, default to 1 if not specified + newStart: parseInt(hunkMatch[3], 10), // line number where changes start in modified file + newCount: hunkMatch[4] ? parseInt(hunkMatch[4], 10) : 1, // number of changed lines in modified file, default to 1 if not specified + header: hunkMatch[5], // the line starting with @@ + lines: [], // the actual line changes + }; + + oldLineNumber = currentHunk.oldStart; + newLineNumber = currentHunk.newStart; + + metadata.hunks.push(currentHunk); + } else if ( + currentHunk && + (line.startsWith(" ") || line.startsWith("+") || line.startsWith("-")) + ) { + // Process hunk content lines. + const lineType = line[0]; + const content = line.slice(1); + + if (lineType === " ") { + // Context line (unchanged). + currentHunk.lines.push({ + type: "context", + content, + oldLineNumber: oldLineNumber++, + newLineNumber: newLineNumber++, + }); + } else if (lineType === "+") { + currentHunk.lines.push({ + type: "addition", + content, + newLineNumber: newLineNumber++, + }); + } else if (lineType === "-") { + currentHunk.lines.push({ + type: "deletion", + content, + oldLineNumber: oldLineNumber++, + }); + } } // Check for binary file marker From 4cfe12f5e05cb5c4a2877f7da595882d98cf8a36 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 15:13:56 -0700 Subject: [PATCH 048/174] test: update test --- .../nextEdit/context/diffFormatting.vitest.ts | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/core/nextEdit/context/diffFormatting.vitest.ts b/core/nextEdit/context/diffFormatting.vitest.ts index 05561d52b..b010f7837 100644 --- a/core/nextEdit/context/diffFormatting.vitest.ts +++ b/core/nextEdit/context/diffFormatting.vitest.ts @@ -265,6 +265,35 @@ describe("diffFormatting", () => { newStart: 1, newCount: 6, header: "function header", + lines: [ + { + content: "line1", + newLineNumber: 1, + oldLineNumber: 1, + type: "context", + }, + { + content: "line2", + oldLineNumber: 2, + type: "deletion", + }, + { + content: "modified2", + newLineNumber: 2, + type: "addition", + }, + { + content: "newline", + newLineNumber: 3, + type: "addition", + }, + { + content: "line3", + newLineNumber: 4, + oldLineNumber: 3, + type: "context", + }, + ], }); expect(metadata.hunks![1]).toEqual({ oldStart: 10, @@ -272,6 +301,30 @@ describe("diffFormatting", () => { newStart: 11, newCount: 3, header: undefined, + lines: [ + { + content: "line10", + newLineNumber: 11, + oldLineNumber: 10, + type: "context", + }, + { + content: "line11", + oldLineNumber: 11, + type: "deletion", + }, + { + content: "modified11", + newLineNumber: 12, + type: "addition", + }, + { + content: "line12", + newLineNumber: 13, + oldLineNumber: 12, + type: "context", + }, + ], }); }); @@ -292,6 +345,18 @@ describe("diffFormatting", () => { newStart: 1, newCount: 1, header: undefined, + lines: [ + { + content: "old", + oldLineNumber: 1, + type: "deletion", + }, + { + content: "new", + newLineNumber: 1, + type: "addition", + }, + ], }); }); From 3c5d91aaaa6d18e8216476f28dd142394e718644 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 15:16:09 -0700 Subject: [PATCH 049/174] feat: add hunk to prompt --- core/nextEdit/templating/model1.ts | 68 +++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/core/nextEdit/templating/model1.ts b/core/nextEdit/templating/model1.ts index ad547b549..821d46d3b 100644 --- a/core/nextEdit/templating/model1.ts +++ b/core/nextEdit/templating/model1.ts @@ -6,7 +6,6 @@ import { MODEL_1_SNIPPET_TOKEN, MODEL_1_USER_CURSOR_IS_HERE_TOKEN, } from "../constants"; -import { extractMetadataFromUnifiedDiff } from "../context/diffFormatting"; import { insertCursorToken } from "./utils"; /** @@ -68,26 +67,57 @@ export function currentFileContentBlock( } export function editHistoryBlock( - editDiffHistories: string[], // list of unified diffs + editDiffHistories: string, // unified diffs with Index headers ) { - // diffHistory is made from createDiff. - // This uses createPatch from npm diff library, which includes an index line and a separator. - // We get rid of these first two lines. - const block: string[] = []; + if (!editDiffHistories.trim()) { + return ""; + } - editDiffHistories.forEach((diff) => { - const diffWithoutHeader = diff.split("\n").slice(2).join("\n"); - const metadata = extractMetadataFromUnifiedDiff(diffWithoutHeader); - block.push( - [ - `User edited file \"${metadata.oldFilename}\"`, - "", - "```diff", - `${diffWithoutHeader}`, - "```", - ].join("\n"), + const blocks: string[] = []; + + // Split on Index: lines to get the unified diff. + const diffSections = editDiffHistories + .split(/^Index: /m) + .filter((section) => section.trim()); + + for (const section of diffSections) { + const lines = section.split("\n"); + + // Extract filename from the first line (after "Index: " was split off). + const filename = lines[0]; + + // Find the start of the actual diff content (skip ---, +++, and === lines). + const diffLines = lines + .filter( + (line) => + !line.startsWith("---") && + !line.startsWith("+++") && + !line.startsWith("===") && + line.trim() !== "", // remove empty lines from header section + ) + .slice(1); // remove the filename line + + // Only include lines that are actual diff content (@@, +, -, or context lines). + const actualDiffContent = diffLines.filter( + (line) => + line.startsWith("@@") || + line.startsWith("+") || + line.startsWith("-") || + line.startsWith(" "), // context lines ); - }); - return block.join("\n"); + if (actualDiffContent.length === 0) continue; + + const diffBlock = [ + `User edited file "${filename}"`, + "", + "```diff", + actualDiffContent.join("\n"), + "```", + ].join("\n"); + + blocks.push(diffBlock); + } + + return blocks.join("\n"); } From 15a78628f094da80f1d5f2c7111d209cd17fb267 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 15:16:16 -0700 Subject: [PATCH 050/174] test: update test --- core/nextEdit/templating/model1.vitest.ts | 41 +++++++++-------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/core/nextEdit/templating/model1.vitest.ts b/core/nextEdit/templating/model1.vitest.ts index c2e603da0..b1020f040 100644 --- a/core/nextEdit/templating/model1.vitest.ts +++ b/core/nextEdit/templating/model1.vitest.ts @@ -291,7 +291,7 @@ line 3`; describe("editHistoryBlock", () => { test("should format empty edit history", () => { - const result = editHistoryBlock([]); + const result = editHistoryBlock(""); expect(result).toBe(""); }); @@ -306,12 +306,10 @@ describe("editHistoryBlock", () => { + console.log("new"); }`; - const result = editHistoryBlock([diff]); + const result = editHistoryBlock(diff); const expected = `User edited file "test.js" \`\`\`diff ---- a/test.js 2023-01-01 10:00:00.000000000 +0000 -+++ b/test.js 2023-01-01 10:01:00.000000000 +0000 @@ -1,3 +1,3 @@ function test() { - console.log("old"); @@ -322,16 +320,16 @@ describe("editHistoryBlock", () => { expect(result).toBe(expected); }); - test("should format multiple diff history entries", () => { - const diff1 = `Index: file1.js + test("should format multiple diff history entries in unified format", () => { + // Multiple diffs should be concatenated into a single string + const unifiedDiff = `Index: file1.js =================================================================== --- a/file1.js 2023-01-01 10:00:00.000000000 +0000 +++ b/file1.js 2023-01-01 10:01:00.000000000 +0000 @@ -1 +1 @@ -const old = 1; -+const new = 1;`; - - const diff2 = `Index: file2.js ++const new = 1; +Index: file2.js =================================================================== --- a/file2.js 2023-01-01 10:02:00.000000000 +0000 +++ b/file2.js 2023-01-01 10:03:00.000000000 +0000 @@ -339,12 +337,10 @@ describe("editHistoryBlock", () => { -let x = "old"; +let x = "new";`; - const result = editHistoryBlock([diff1, diff2]); + const result = editHistoryBlock(unifiedDiff); const expected = `User edited file "file1.js" \`\`\`diff ---- a/file1.js 2023-01-01 10:00:00.000000000 +0000 -+++ b/file1.js 2023-01-01 10:01:00.000000000 +0000 @@ -1 +1 @@ -const old = 1; +const new = 1; @@ -352,8 +348,6 @@ describe("editHistoryBlock", () => { User edited file "file2.js" \`\`\`diff ---- a/file2.js 2023-01-01 10:02:00.000000000 +0000 -+++ b/file2.js 2023-01-01 10:03:00.000000000 +0000 @@ -1 +1 @@ -let x = "old"; +let x = "new"; @@ -362,6 +356,7 @@ User edited file "file2.js" expect(result).toBe(expected); }); + // Fix remaining tests to pass strings instead of arrays test("should handle diff with complex filename paths", () => { const diff = `Index: src/components/Button/Button.tsx =================================================================== @@ -371,12 +366,10 @@ User edited file "file2.js" -export const Button = () => ; +export const Button = () => ;`; - const result = editHistoryBlock([diff]); + const result = editHistoryBlock(diff); const expected = `User edited file "src/components/Button/Button.tsx" \`\`\`diff ---- a/src/components/Button/Button.tsx 2023-01-01 10:00:00.000000000 +0000 -+++ b/src/components/Button/Button.tsx 2023-01-01 10:01:00.000000000 +0000 @@ -1,2 +1,2 @@ -export const Button = () => ; +export const Button = () => ; @@ -395,12 +388,10 @@ User edited file "file2.js" + return "hello world"; +}`; - const result = editHistoryBlock([diff]); - const expected = `User edited file "/dev/null" + const result = editHistoryBlock(diff); + const expected = `User edited file "newfile.js" \`\`\`diff ---- /dev/null 2023-01-01 10:00:00.000000000 +0000 -+++ b/newfile.js 2023-01-01 10:01:00.000000000 +0000 @@ -0,0 +1,3 @@ +function newFunction() { + return "hello world"; @@ -420,12 +411,10 @@ User edited file "file2.js" - return "goodbye"; -}`; - const result = editHistoryBlock([diff]); + const result = editHistoryBlock(diff); const expected = `User edited file "deletedfile.js" \`\`\`diff ---- a/deletedfile.js 2023-01-01 10:00:00.000000000 +0000 -+++ /dev/null 2023-01-01 10:01:00.000000000 +0000 @@ -1,3 +0,0 @@ -function deletedFunction() { - return "goodbye"; @@ -442,8 +431,8 @@ User edited file "file2.js" -old text +new text`; - const result = editHistoryBlock([diff]); - const expected = `User edited file "undefined" + const result = editHistoryBlock(diff); + const expected = `User edited file "simple.txt" \`\`\`diff @@ -1 +1 @@ From 43dd4f622e9147260eb27384db6ca9adb761a8cb Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 15:16:38 -0700 Subject: [PATCH 051/174] fix: prompt and userEdits --- core/nextEdit/templating/NextEditPromptEngine.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index cf7748c17..326ac4d84 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -45,7 +45,7 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { template: `${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN}\n{{{recentlyViewedCodeSnippets}}}\n${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE}\n\n${MERCURY_CURRENT_FILE_CONTENT_OPEN}\n{{{currentFileContent}}}\n${MERCURY_CURRENT_FILE_CONTENT_CLOSE}\n\n${MERCURY_EDIT_DIFF_HISTORY_OPEN}\n{{{editDiffHistory}}}\n${MERCURY_EDIT_DIFF_HISTORY_CLOSE}\n\nThe developer was working on a section of code within the tags \`<|code_to_edit|>\` in the file located at {{{currentFilePath}}}.\nUsing the given \`recently_viewed_code_snippets\`, \`current_file_content\`, \`edit_diff_history\`, and the cursor position marked as \`<|cursor|>\`, please continue the developer's work. Update the \`code_to_edit\` section by predicting and completing the changes they would have made next. Provide the revised code that was between the \`<|code_to_edit|>\` and \`<|/code_to_edit|>\` tags, including the tags themselves.`, }, "model-1": { - template: `${MODEL_1_USER_PROMPT_PREFIX}\n\n### Context:\n{{{recentlyViewedCodeSnippets}}}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{currentFileContent}}}\`\`\`\n### Response:`, + template: `${MODEL_1_USER_PROMPT_PREFIX}\n\n### Context:\n{{{contextSnippets}}}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{currentFileContent}}}\`\`\`\n### Response:`, }, }; @@ -120,7 +120,7 @@ export async function renderPrompt( break; } case "model-1": { - userEdits = ctx.userEdits; + userEdits = ctx.editDiffHistory; editedCodeWithTokens = insertTokens( helper.fileContents.split("\n"), From ea02b4b4469b99741f66599811aae361bf02a1b5 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 8 Aug 2025 15:16:45 -0700 Subject: [PATCH 052/174] test: update test --- .../templating/NextEditPromptEngine.vitest.ts | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.vitest.ts b/core/nextEdit/templating/NextEditPromptEngine.vitest.ts index 785dd79cc..23ae1d7cb 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.vitest.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.vitest.ts @@ -3,6 +3,7 @@ import { Position } from "../.."; import { SnippetPayload } from "../../autocomplete/snippets"; import { AutocompleteSnippetType } from "../../autocomplete/snippets/types"; import { HelperVars } from "../../autocomplete/util/HelperVars"; +import { NEXT_EDIT_MODELS } from "../../llm/constants"; import { MERCURY_CURRENT_FILE_CONTENT_CLOSE, MERCURY_CURRENT_FILE_CONTENT_OPEN, @@ -12,13 +13,13 @@ import { MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE, MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN, MODEL_1_USER_CURSOR_IS_HERE_TOKEN, + MODEL_1_USER_PROMPT_PREFIX, } from "../constants"; import { renderDefaultSystemPrompt, renderDefaultUserPrompt, renderPrompt, } from "./NextEditPromptEngine"; -import { NEXT_EDIT_MODELS } from "../../llm/constants"; describe("NextEditPromptEngine", () => { describe("renderPrompt", () => { @@ -81,15 +82,33 @@ describe("NextEditPromptEngine", () => { }); it("should render model-1 prompt correctly", async () => { - const result = await renderPrompt(model1Helper, ctx); + // Create proper model-1 context structure matching NextEditProvider.ts + const model1Ctx = { + contextSnippets: + "+++++ /path/to/context.ts\nconst contextVar = 'test';", + currentFileContent: model1Helper.fileContents, + windowStart: 0, // Math.max(0, helper.pos.line - 25) + windowEnd: 3, // Math.min(helper.fileLines.length - 1, helper.pos.line + 25) + adjustedEditableStart: 0, // Math.max(0, helper.pos.line - 1) within window + adjustedEditableEnd: 2, // Math.min(helper.pos.line + 5) within window + editDiffHistory: + "diff --git a/file.ts b/file.ts\nindex 123..456 789\n--- a/file.ts\n+++ b/file.ts\n@@ -1,3 +1,4 @@\n function test() {\n+ const a = 1;\n return a;\n }", // unified diff + currentFilePath: "/path/to/file.ts", + languageShorthand: "ts", + }; + + const result = await renderPrompt(model1Helper, model1Ctx); + console.log(result); expect(result).toHaveProperty("prompt"); expect(result.prompt.role).toBe("user"); + expect(result.prompt.content).toContain(MODEL_1_USER_PROMPT_PREFIX); + expect(result.prompt.content).toContain("### Context:"); expect(result.prompt.content).toContain("### User Edits:"); expect(result.prompt.content).toContain("### User Excerpts:"); expect(result.prompt.content).toContain("```ts"); - expect(result.userEdits).toBe(ctx.userEdits); + expect(result.userEdits).toBe(model1Ctx.editDiffHistory); expect(result.userExcerpts).toContain(MODEL_1_USER_CURSOR_IS_HERE_TOKEN); }); From 85314e54130c9c0c9af4ee282d357b08d5362e3b Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 8 Aug 2025 15:55:16 -0700 Subject: [PATCH 053/174] Delete .continue/rules/comment-periods.md --- .continue/rules/comment-periods.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .continue/rules/comment-periods.md diff --git a/.continue/rules/comment-periods.md b/.continue/rules/comment-periods.md deleted file mode 100644 index bfbcc0ae1..000000000 --- a/.continue/rules/comment-periods.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -alwaysApply: true ---- - -End your comments with a period. From 8d54cfcefbb19851cd3cef2e54599df01af238f0 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:19:31 +0530 Subject: [PATCH 054/174] remove system message from models.ts --- gui/src/pages/AddNewModel/configs/models.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index b5c4bbae5..4e032ca7d 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -653,7 +653,6 @@ export const models: { [key: string]: ModelPackage } = { model: "granite-code", contextLength: 20_000, title: "Granite Code", - systemMessage: `You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.`, }, providerOptions: ["ollama", "lmstudio", "llama.cpp", "replicate"], icon: "ibm.png", @@ -1128,8 +1127,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-4o", contextLength: 128_000, title: "GPT-4o", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", }, providerOptions: ["openai", "askSage"], icon: "openai.png", @@ -1143,8 +1140,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-4o-mini", contextLength: 128_000, title: "GPT-4o mini", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", }, providerOptions: ["openai", "askSage"], icon: "openai.png", @@ -1398,8 +1393,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt4-gov", contextLength: 128_000, title: "GPT-4 gov", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", // Need to set this on the Ask Sage side or just configure it in here to be discussed }, providerOptions: ["askSage"], icon: "openai.png", @@ -1413,8 +1406,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-4o-gov", contextLength: 128_000, title: "GPT-4o-gov", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", // Need to set this on the Ask Sage side or just configure it in here to be discussed }, providerOptions: ["askSage"], icon: "openai.png", @@ -1427,8 +1418,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-gov", contextLength: 8096, title: "GPT-3.5-Turbo gov", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", // Need to set this on the Ask Sage side or just configure it in here to be discussed }, providerOptions: ["askSage"], icon: "openai.png", @@ -1442,8 +1431,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-4o-mini-gov", contextLength: 128_000, title: "GPT-4o-mini gov", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", // Need to set this on the Ask Sage side or just configure it in here to be discussed }, providerOptions: ["askSage"], icon: "openai.png", @@ -1483,8 +1470,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-o1", contextLength: 128_000, title: "GPT-o1", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", }, providerOptions: ["askSage"], icon: "openai.png", @@ -1498,8 +1483,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-o1-mini", contextLength: 128_000, title: "GPT-o1-mini", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", }, providerOptions: ["askSage"], icon: "openai.png", @@ -1513,8 +1496,6 @@ export const models: { [key: string]: ModelPackage } = { model: "gpt-o3-mini", contextLength: 200_000, title: "GPT-o3-mini", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", }, providerOptions: ["askSage"], icon: "openai.png", @@ -1528,8 +1509,6 @@ export const models: { [key: string]: ModelPackage } = { model: "aws-bedrock-claude-35-sonnet-gov", contextLength: 200_000, title: "Claude 3.5 Sonnet gov", - systemMessage: - "You are an expert software developer. You give helpful and concise responses.", }, providerOptions: ["askSage"], icon: "anthropic.png", From 4ea64921775d5c86e7220f01c6dbace44b0d0a01 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:23:08 +0530 Subject: [PATCH 055/174] Revert "remove schema parser" This reverts commit 4dea1af5e907b3092b300514ba846d35677f49ba. --- core/llm/llms/Voyage.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/llm/llms/Voyage.ts b/core/llm/llms/Voyage.ts index 6a3a3dd1f..94c344a56 100644 --- a/core/llm/llms/Voyage.ts +++ b/core/llm/llms/Voyage.ts @@ -1,6 +1,21 @@ +import { z } from "zod"; + import { Chunk, LLMOptions } from "../../index.js"; import OpenAI from "./OpenAI.js"; +/**used to check a valid response from voyage is received + * reference: https://docs.voyageai.com/reference/reranker-api + */ +const VoyageRerankSuccessResponseSchema = z.object({ + data: z.array( + z.object({ + index: z.number(), + relevance_score: z.number(), + document: z.string(), + }), + ), +}); + class Voyage extends OpenAI { static providerName = "voyage"; static defaultOptions: Partial | undefined = { @@ -36,6 +51,8 @@ class Voyage extends OpenAI { data: Array<{ index: number; relevance_score: number }>; }; + VoyageRerankSuccessResponseSchema.parse(data); + const results = data.data.sort((a, b) => a.index - b.index); return results.map((result) => result.relevance_score); } From 4e181804f69eeac186a07b319732b03db28aa8ae Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 12 Aug 2025 00:47:34 +0530 Subject: [PATCH 056/174] use safe parsed schema --- core/llm/llms/Voyage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/llm/llms/Voyage.ts b/core/llm/llms/Voyage.ts index 94c344a56..9ba43554e 100644 --- a/core/llm/llms/Voyage.ts +++ b/core/llm/llms/Voyage.ts @@ -51,9 +51,9 @@ class Voyage extends OpenAI { data: Array<{ index: number; relevance_score: number }>; }; - VoyageRerankSuccessResponseSchema.parse(data); + const parsedData = VoyageRerankSuccessResponseSchema.parse(data); - const results = data.data.sort((a, b) => a.index - b.index); + const results = parsedData.data.sort((a, b) => a.index - b.index); return results.map((result) => result.relevance_score); } } From d1f06da04e9e62120ec93f6663611d6c644e4194 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 17:44:11 -0700 Subject: [PATCH 057/174] refactor: rename model 1 to instinct --- core/llm/autodetect.ts | 2 +- core/llm/autodetect.vitest.ts | 12 ++++---- core/llm/constants.ts | 2 +- core/nextEdit/constants.ts | 27 ++++++++++++----- .../templating/NextEditPromptEngine.vitest.ts | 30 +++++++++---------- .../templating/{model1.ts => instinct.ts} | 22 +++++++------- .../{model1.vitest.ts => instinct.vitest.ts} | 2 +- core/nextEdit/templating/utils.ts | 8 ++--- core/nextEdit/templating/utils.vitest.ts | 12 ++++---- core/nextEdit/types.ts | 2 +- 10 files changed, 67 insertions(+), 52 deletions(-) rename core/nextEdit/templating/{model1.ts => instinct.ts} (84%) rename core/nextEdit/templating/{model1.vitest.ts => instinct.vitest.ts} (99%) diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index b2943e316..f167d02f9 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -178,7 +178,7 @@ function isProviderHandlesTemplatingOrNoTemplateTypeRequired( // update core/nextEdit/templating/NextEditPromptEngine.ts as well. const MODEL_SUPPORTS_NEXT_EDIT: string[] = [ NEXT_EDIT_MODELS.MERCURY_CODER_NEXTEDIT, - NEXT_EDIT_MODELS.MODEL_1, + NEXT_EDIT_MODELS.INSTINCT, ]; function modelSupportsNextEdit( diff --git a/core/llm/autodetect.vitest.ts b/core/llm/autodetect.vitest.ts index 01d48aacc..4e250f1ad 100644 --- a/core/llm/autodetect.vitest.ts +++ b/core/llm/autodetect.vitest.ts @@ -245,8 +245,10 @@ describe("modelSupportsNextEdit", () => { ).toBe(true); }); - it("should return true for model-1", () => { - expect(modelSupportsNextEdit(undefined, "model-1", undefined)).toBe(true); + it("should return true for instinct", () => { + expect(modelSupportsNextEdit(undefined, "instinct", undefined)).toBe( + true, + ); }); it("should return true when model contains supported model name as substring", () => { @@ -269,9 +271,9 @@ describe("modelSupportsNextEdit", () => { ).toBe(true); }); - it("should return true when title contains model-1", () => { + it("should return true when title contains instinct", () => { expect( - modelSupportsNextEdit(undefined, "some-model", "model-1 deployment"), + modelSupportsNextEdit(undefined, "some-model", "instinct deployment"), ).toBe(true); }); @@ -317,7 +319,7 @@ describe("modelSupportsNextEdit", () => { it("should handle case sensitivity correctly", () => { expect( - modelSupportsNextEdit(undefined, "MERCURY-CODER-NEXTEDIT", "MODEL-1"), + modelSupportsNextEdit(undefined, "MERCURY-CODER-NEXTEDIT", "instinct"), ).toBe(true); }); diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 5b93048e9..704931af5 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -21,7 +21,7 @@ export enum LLMConfigurationStatuses { export enum NEXT_EDIT_MODELS { MERCURY_CODER_NEXTEDIT = "mercury-coder-nextedit", - MODEL_1 = "model-1", + INSTINCT = "instinct", } export { diff --git a/core/nextEdit/constants.ts b/core/nextEdit/constants.ts index 21e249b96..27a743dcc 100644 --- a/core/nextEdit/constants.ts +++ b/core/nextEdit/constants.ts @@ -1,14 +1,27 @@ +import { NEXT_EDIT_MODELS } from "../llm/constants"; + export const IS_NEXT_EDIT_ACTIVE = false; export const NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN = 0; export const NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN = 5; +export const MODEL_WINDOW_SIZES: Record< + NEXT_EDIT_MODELS, + { topMargin: number; bottomMargin: number } +> = { + "mercury-coder-nextedit": { + topMargin: 0, + bottomMargin: 5, + }, // mercury coder nextedit uses full file diff, so this should be unnecessary + instinct: { topMargin: 1, bottomMargin: 5 }, +}; + // Model 1-specific tokens. -export const MODEL_1_USER_CURSOR_IS_HERE_TOKEN = "<|user_cursor_is_here|>"; -export const MODEL_1_EDITABLE_REGION_START_TOKEN = "<|editable_region_start|>"; -export const MODEL_1_EDITABLE_REGION_END_TOKEN = "<|editable_region_end|>"; -export const MODEL_1_CONTEXT_FILE_TOKEN = "<|context_file|>"; -export const MODEL_1_SNIPPET_TOKEN = "<|snippet|>"; -export const MODEL_1_SYSTEM_PROMPT = `You are Instinct, an intelligent next-edit predictor developed by Continue.dev. Your role as an AI assistant is to help developers complete their code tasks by predicting the next edit that they will make within the section of code marked by <|editable_region_start|> and <|editable_region_end|> tags. +export const INSTINCT_USER_CURSOR_IS_HERE_TOKEN = "<|user_cursor_is_here|>"; +export const INSTINCT_EDITABLE_REGION_START_TOKEN = "<|editable_region_start|>"; +export const INSTINCT_EDITABLE_REGION_END_TOKEN = "<|editable_region_end|>"; +export const INSTINCT_CONTEXT_FILE_TOKEN = "<|context_file|>"; +export const INSTINCT_SNIPPET_TOKEN = "<|snippet|>"; +export const INSTINCT_SYSTEM_PROMPT = `You are Instinct, an intelligent next-edit predictor developed by Continue.dev. Your role as an AI assistant is to help developers complete their code tasks by predicting the next edit that they will make within the section of code marked by <|editable_region_start|> and <|editable_region_end|> tags. You have access to the following information to help you make informed suggestions: @@ -31,7 +44,7 @@ Your task is to predict and complete the changes the developer would have made n - Provide only the revised code within the tags. Do not include the tags in your output. - Ensure that you do not output duplicate code that exists outside of these tags. - Avoid undoing or reverting the developer's last change unless there are obvious typos or errors.`; -export const MODEL_1_USER_PROMPT_PREFIX = +export const INSTINCT_USER_PROMPT_PREFIX = "Reference the user excerpt, user edits, and the snippets to understand the developer's intent. Update the editable region of the user excerpt by predicting and completing the changes they would have made next. This may be a deletion, addition, or modification of code."; // Mercury Coder Next Edit-specific tokens. diff --git a/core/nextEdit/templating/NextEditPromptEngine.vitest.ts b/core/nextEdit/templating/NextEditPromptEngine.vitest.ts index 23ae1d7cb..3df88e9f3 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.vitest.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.vitest.ts @@ -5,6 +5,8 @@ import { AutocompleteSnippetType } from "../../autocomplete/snippets/types"; import { HelperVars } from "../../autocomplete/util/HelperVars"; import { NEXT_EDIT_MODELS } from "../../llm/constants"; import { + INSTINCT_USER_CURSOR_IS_HERE_TOKEN, + INSTINCT_USER_PROMPT_PREFIX, MERCURY_CURRENT_FILE_CONTENT_CLOSE, MERCURY_CURRENT_FILE_CONTENT_OPEN, MERCURY_CURSOR, @@ -12,8 +14,6 @@ import { MERCURY_EDIT_DIFF_HISTORY_OPEN, MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE, MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN, - MODEL_1_USER_CURSOR_IS_HERE_TOKEN, - MODEL_1_USER_PROMPT_PREFIX, } from "../constants"; import { renderDefaultSystemPrompt, @@ -24,7 +24,7 @@ import { describe("NextEditPromptEngine", () => { describe("renderPrompt", () => { let mercuryHelper: HelperVars; - let model1Helper: HelperVars; + let instinctHelper: HelperVars; let testHelper: HelperVars; let unsupportedHelper: HelperVars; let ctx: any; @@ -36,8 +36,8 @@ describe("NextEditPromptEngine", () => { pos: { line: 1, character: 12 } as Position, lang: { name: "typescript" }, } as HelperVars; - model1Helper = { - modelName: "continuedev/model-1" as NEXT_EDIT_MODELS, + instinctHelper = { + modelName: "continuedev/instinct" as NEXT_EDIT_MODELS, fileContents: "function test() {\n const a = 1;\n return a;\n}", pos: { line: 1, character: 12 } as Position, lang: { name: "typescript" }, @@ -81,35 +81,35 @@ describe("NextEditPromptEngine", () => { expect(result.userExcerpts).toContain(MERCURY_CURSOR); }); - it("should render model-1 prompt correctly", async () => { - // Create proper model-1 context structure matching NextEditProvider.ts - const model1Ctx = { + it("should render instinct prompt correctly", async () => { + // Create proper instinct context structure matching NextEditProvider.ts + const instinctCtx = { contextSnippets: "+++++ /path/to/context.ts\nconst contextVar = 'test';", - currentFileContent: model1Helper.fileContents, + currentFileContent: instinctHelper.fileContents, windowStart: 0, // Math.max(0, helper.pos.line - 25) windowEnd: 3, // Math.min(helper.fileLines.length - 1, helper.pos.line + 25) - adjustedEditableStart: 0, // Math.max(0, helper.pos.line - 1) within window - adjustedEditableEnd: 2, // Math.min(helper.pos.line + 5) within window + editableRegionStartLine: 0, // Math.max(0, helper.pos.line - 1) within window + editableRegionEndLine: 2, // Math.min(helper.pos.line + 5) within window editDiffHistory: "diff --git a/file.ts b/file.ts\nindex 123..456 789\n--- a/file.ts\n+++ b/file.ts\n@@ -1,3 +1,4 @@\n function test() {\n+ const a = 1;\n return a;\n }", // unified diff currentFilePath: "/path/to/file.ts", languageShorthand: "ts", }; - const result = await renderPrompt(model1Helper, model1Ctx); + const result = await renderPrompt(instinctHelper, instinctCtx); console.log(result); expect(result).toHaveProperty("prompt"); expect(result.prompt.role).toBe("user"); - expect(result.prompt.content).toContain(MODEL_1_USER_PROMPT_PREFIX); + expect(result.prompt.content).toContain(INSTINCT_USER_PROMPT_PREFIX); expect(result.prompt.content).toContain("### Context:"); expect(result.prompt.content).toContain("### User Edits:"); expect(result.prompt.content).toContain("### User Excerpts:"); expect(result.prompt.content).toContain("```ts"); - expect(result.userEdits).toBe(model1Ctx.editDiffHistory); - expect(result.userExcerpts).toContain(MODEL_1_USER_CURSOR_IS_HERE_TOKEN); + expect(result.userEdits).toBe(instinctCtx.editDiffHistory); + expect(result.userExcerpts).toContain(INSTINCT_USER_CURSOR_IS_HERE_TOKEN); }); it("should throw error for unsupported model name", async () => { diff --git a/core/nextEdit/templating/model1.ts b/core/nextEdit/templating/instinct.ts similarity index 84% rename from core/nextEdit/templating/model1.ts rename to core/nextEdit/templating/instinct.ts index 821d46d3b..b7e14f165 100644 --- a/core/nextEdit/templating/model1.ts +++ b/core/nextEdit/templating/instinct.ts @@ -1,10 +1,10 @@ import { Position } from "../.."; import { - MODEL_1_CONTEXT_FILE_TOKEN, - MODEL_1_EDITABLE_REGION_END_TOKEN, - MODEL_1_EDITABLE_REGION_START_TOKEN, - MODEL_1_SNIPPET_TOKEN, - MODEL_1_USER_CURSOR_IS_HERE_TOKEN, + INSTINCT_CONTEXT_FILE_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, + INSTINCT_SNIPPET_TOKEN, + INSTINCT_USER_CURSOR_IS_HERE_TOKEN, } from "../constants"; import { insertCursorToken } from "./utils"; @@ -20,13 +20,13 @@ export function contextSnippetsBlock(contextSnippets: string) { const matches = line.match(headerRegex); if (matches) { const filename = matches[2]; - acc.push(`${MODEL_1_CONTEXT_FILE_TOKEN}: ${filename}`); + acc.push(`${INSTINCT_CONTEXT_FILE_TOKEN}: ${filename}`); } else { if ( acc.length > 0 && - acc[acc.length - 1].startsWith(MODEL_1_CONTEXT_FILE_TOKEN) // if header was added just before + acc[acc.length - 1].startsWith(INSTINCT_CONTEXT_FILE_TOKEN) // if header was added just before ) { - acc.push(`${MODEL_1_SNIPPET_TOKEN}`); + acc.push(`${INSTINCT_SNIPPET_TOKEN}`); } acc.push(line); } @@ -49,17 +49,17 @@ export function currentFileContentBlock( const insertedCursorLines = insertCursorToken( currentFileContentLines, cursorPosition, - MODEL_1_USER_CURSOR_IS_HERE_TOKEN, + INSTINCT_USER_CURSOR_IS_HERE_TOKEN, ); const instrumentedLines = [ ...insertedCursorLines.slice(windowStart, editableRegionStartLine), - MODEL_1_EDITABLE_REGION_START_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, ...insertedCursorLines.slice( editableRegionStartLine, editableRegionEndLine + 1, ), - MODEL_1_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, ...insertedCursorLines.slice(editableRegionEndLine + 1, windowEnd + 1), ]; diff --git a/core/nextEdit/templating/model1.vitest.ts b/core/nextEdit/templating/instinct.vitest.ts similarity index 99% rename from core/nextEdit/templating/model1.vitest.ts rename to core/nextEdit/templating/instinct.vitest.ts index b1020f040..aa15c2fcd 100644 --- a/core/nextEdit/templating/model1.vitest.ts +++ b/core/nextEdit/templating/instinct.vitest.ts @@ -4,7 +4,7 @@ import { contextSnippetsBlock, currentFileContentBlock, editHistoryBlock, -} from "./model1"; +} from "./instinct"; describe("contextSnippetsBlock", () => { test("should format empty context snippets", () => { diff --git a/core/nextEdit/templating/utils.ts b/core/nextEdit/templating/utils.ts index 586fd1795..89d0f6791 100644 --- a/core/nextEdit/templating/utils.ts +++ b/core/nextEdit/templating/utils.ts @@ -1,7 +1,7 @@ import { Position } from "../.."; import { - MODEL_1_EDITABLE_REGION_END_TOKEN, - MODEL_1_EDITABLE_REGION_START_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, } from "../constants"; @@ -53,9 +53,9 @@ export function insertEditableRegionTokensWithStaticRange( const instrumentedLines = [ ...lines.slice(0, editableRegionStart), - MODEL_1_EDITABLE_REGION_START_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, ...lines.slice(editableRegionStart, editableRegionEnd + 1), - MODEL_1_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, ...lines.slice(editableRegionEnd + 1), ]; diff --git a/core/nextEdit/templating/utils.vitest.ts b/core/nextEdit/templating/utils.vitest.ts index f60a26d7d..92bd98c3d 100644 --- a/core/nextEdit/templating/utils.vitest.ts +++ b/core/nextEdit/templating/utils.vitest.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; import { Position } from "../.."; import { - MODEL_1_EDITABLE_REGION_END_TOKEN, - MODEL_1_EDITABLE_REGION_START_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, } from "../constants"; @@ -88,9 +88,9 @@ describe("insertEditableRegionTokensWithStaticRange", () => { const expected = [ ...lines.slice(0, expectedStart), - MODEL_1_EDITABLE_REGION_START_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, ...lines.slice(expectedStart, expectedEnd + 1), - MODEL_1_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, ...lines.slice(expectedEnd + 1), ]; @@ -112,11 +112,11 @@ describe("insertEditableRegionTokensWithStaticRange", () => { const expected = [ "line 0", - MODEL_1_EDITABLE_REGION_START_TOKEN, + INSTINCT_EDITABLE_REGION_START_TOKEN, "line 1", "line 2", "line 3", - MODEL_1_EDITABLE_REGION_END_TOKEN, + INSTINCT_EDITABLE_REGION_END_TOKEN, "line 4", ]; diff --git a/core/nextEdit/types.ts b/core/nextEdit/types.ts index 4c50e0291..d30d803e0 100644 --- a/core/nextEdit/types.ts +++ b/core/nextEdit/types.ts @@ -90,7 +90,7 @@ export interface NextEditTemplate { export interface TemplateVars {} -export interface Model1TemplateVars extends TemplateVars { +export interface InstinctTemplateVars extends TemplateVars { contextSnippets: string; currentFileContent: string; editDiffHistory: string; // could be a singe large unified diff From ffa1d64a554ab470f38be75e14da303e7786155c Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 17:44:51 -0700 Subject: [PATCH 058/174] fix: accepting next edit does not count as typing --- extensions/vscode/src/extension/VsCodeExtension.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 3861edcb7..4b1d8e6ee 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -113,7 +113,8 @@ export class VsCodeExtension { Date.now() - state.lastDocumentChangeTime; if ( state.isTypingSession && - timeSinceLastDocChange < this.ARBITRARY_TYPING_DELAY + timeSinceLastDocChange < this.ARBITRARY_TYPING_DELAY && + !NextEditWindowManager.getInstance().hasAccepted() ) { console.log("VsCodeExtension: typing in progress, preserving chain"); return true; From 10d4d4cda0c252a36bac96178593d13b1ea6f2d6 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 17:45:27 -0700 Subject: [PATCH 059/174] fix: editedCodeWithTokens uses the processed context block --- .../templating/NextEditPromptEngine.ts | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index 326ac4d84..98e23e45b 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -4,35 +4,33 @@ import { SnippetPayload } from "../../autocomplete/snippets"; import { HelperVars } from "../../autocomplete/util/HelperVars"; import { NEXT_EDIT_MODELS } from "../../llm/constants"; import { + INSTINCT_USER_PROMPT_PREFIX, MERCURY_CURRENT_FILE_CONTENT_CLOSE, MERCURY_CURRENT_FILE_CONTENT_OPEN, - MERCURY_CURSOR, MERCURY_EDIT_DIFF_HISTORY_CLOSE, MERCURY_EDIT_DIFF_HISTORY_OPEN, MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE, MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN, - MODEL_1_USER_CURSOR_IS_HERE_TOKEN, - MODEL_1_USER_PROMPT_PREFIX, } from "../constants"; import { + InstinctTemplateVars, MercuryTemplateVars, - Model1TemplateVars, NextEditTemplate, PromptMetadata, SystemPrompt, TemplateVars, UserPrompt, } from "../types"; +import { + contextSnippetsBlock, + currentFileContentBlock as instinctCurrentFileContentBlock, + editHistoryBlock as instinctEditHistoryBlock, +} from "./instinct"; import { currentFileContentBlock, editHistoryBlock, recentlyViewedCodeSnippetsBlock, } from "./mercuryCoderNextEdit"; -import { - contextSnippetsBlock, - currentFileContentBlock as model1CurrentFileContentBlock, - editHistoryBlock as model1EditHistoryBlock, -} from "./model1"; import { insertCursorToken, insertEditableRegionTokensWithStaticRange, @@ -44,8 +42,8 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { "mercury-coder-nextedit": { template: `${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_OPEN}\n{{{recentlyViewedCodeSnippets}}}\n${MERCURY_RECENTLY_VIEWED_CODE_SNIPPETS_CLOSE}\n\n${MERCURY_CURRENT_FILE_CONTENT_OPEN}\n{{{currentFileContent}}}\n${MERCURY_CURRENT_FILE_CONTENT_CLOSE}\n\n${MERCURY_EDIT_DIFF_HISTORY_OPEN}\n{{{editDiffHistory}}}\n${MERCURY_EDIT_DIFF_HISTORY_CLOSE}\n\nThe developer was working on a section of code within the tags \`<|code_to_edit|>\` in the file located at {{{currentFilePath}}}.\nUsing the given \`recently_viewed_code_snippets\`, \`current_file_content\`, \`edit_diff_history\`, and the cursor position marked as \`<|cursor|>\`, please continue the developer's work. Update the \`code_to_edit\` section by predicting and completing the changes they would have made next. Provide the revised code that was between the \`<|code_to_edit|>\` and \`<|/code_to_edit|>\` tags, including the tags themselves.`, }, - "model-1": { - template: `${MODEL_1_USER_PROMPT_PREFIX}\n\n### Context:\n{{{contextSnippets}}}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{currentFileContent}}}\`\`\`\n### Response:`, + instinct: { + template: `${INSTINCT_USER_PROMPT_PREFIX}\n\n### Context:\n{{{contextSnippets}}}\n\n### User Edits:\n\n{{{editDiffHistory}}}\n\n### User Excerpts:\n{{{currentFilePath}}}\n\n{{{currentFileContent}}}\`\`\`\n### Response:`, }, }; @@ -95,11 +93,11 @@ export async function renderPrompt( case "mercury-coder-nextedit": { userEdits = ctx.editDiffHistory; - editedCodeWithTokens = insertTokens( - helper.fileContents.split("\n"), - helper.pos, - MERCURY_CURSOR, - ); + // editedCodeWithTokens = insertTokens( + // helper.fileContents.split("\n"), + // helper.pos, + // MERCURY_CURSOR, + // ); const mercuryCtx: MercuryTemplateVars = { recentlyViewedCodeSnippets: recentlyViewedCodeSnippetsBlock( @@ -117,20 +115,22 @@ export async function renderPrompt( tv = mercuryCtx; + editedCodeWithTokens = mercuryCtx.currentFileContent; + break; } - case "model-1": { + case "instinct": { userEdits = ctx.editDiffHistory; - editedCodeWithTokens = insertTokens( - helper.fileContents.split("\n"), - helper.pos, - MODEL_1_USER_CURSOR_IS_HERE_TOKEN, - ); + // editedCodeWithTokens = insertTokens( + // helper.fileContents.split("\n"), + // helper.pos, + // INSTINCT_USER_CURSOR_IS_HERE_TOKEN, + // ); - const model1Ctx: Model1TemplateVars = { + const instinctCtx: InstinctTemplateVars = { contextSnippets: contextSnippetsBlock(ctx.contextSnippets), - currentFileContent: model1CurrentFileContentBlock( + currentFileContent: instinctCurrentFileContentBlock( ctx.currentFileContent, ctx.windowStart, ctx.windowEnd, @@ -138,12 +138,14 @@ export async function renderPrompt( ctx.editableRegionEndLine, helper.pos, ), - editDiffHistory: model1EditHistoryBlock(ctx.editDiffHistory), + editDiffHistory: instinctEditHistoryBlock(ctx.editDiffHistory), currentFilePath: ctx.currentFilePath, languageShorthand: ctx.languageShorthand, }; - tv = model1Ctx; + tv = instinctCtx; + + editedCodeWithTokens = instinctCtx.currentFileContent; break; } From 3b878986c587faaa4f4c75358030d9592b73599e Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 17:45:57 -0700 Subject: [PATCH 060/174] feat: sliding jump starts at the cursor line and expands outwards --- .../NextEditEditableRegionCalculator.ts | 101 +++++++++++++----- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/core/nextEdit/NextEditEditableRegionCalculator.ts b/core/nextEdit/NextEditEditableRegionCalculator.ts index 7ced3b435..ad6a1afa2 100644 --- a/core/nextEdit/NextEditEditableRegionCalculator.ts +++ b/core/nextEdit/NextEditEditableRegionCalculator.ts @@ -1,11 +1,9 @@ import Parser from "web-tree-sitter"; import { Chunk, IDE, ILLM, Position, Range, RangeInFile } from ".."; import { getAst } from "../autocomplete/util/ast"; +import { NEXT_EDIT_MODELS } from "../llm/constants"; import { DocumentHistoryTracker } from "./DocumentHistoryTracker"; -import { - NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, -} from "./constants"; +import { MODEL_WINDOW_SIZES } from "./constants"; export enum EditableRegionStrategy { Naive = "naive", @@ -60,16 +58,16 @@ function naiveJump(ctx: any): RangeInFile[] | null { // Sliding splits the file using into sliding window. function slidingJump(ctx: any): RangeInFile[] | null { - const { fileLines, filepath } = ctx; - if (!fileLines || !filepath) { - console.warn("Missing required context for naive jump"); + const { fileLines, filepath, modelName, currentCursorPos } = ctx; + if (!fileLines || !filepath || !modelName || !currentCursorPos) { + console.warn("Missing required context for sliding jump"); return null; } - const windowSize = - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN + - NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN + - 1; // 1 for current line; + const topMargin = MODEL_WINDOW_SIZES[modelName as NEXT_EDIT_MODELS].topMargin; + const bottomMargin = + MODEL_WINDOW_SIZES[modelName as NEXT_EDIT_MODELS].bottomMargin; + const windowSize = topMargin + bottomMargin + 1; // 1 for current line if (fileLines.length <= windowSize) { return [ @@ -86,29 +84,74 @@ function slidingJump(ctx: any): RangeInFile[] | null { ]; } - const slidingStep = Math.max(1, Math.floor(windowSize / 2)); const ranges: RangeInFile[] = []; + const cursorLine = currentCursorPos.line; - for ( - let startLine = 0; - startLine < fileLines.length; - startLine += slidingStep - ) { - const endLine = Math.min(startLine + windowSize - 1, fileLines.length - 1); + // Create the first window centered around the cursor position + const firstWindowStart = Math.max(0, cursorLine - topMargin); + const firstWindowEnd = Math.min( + fileLines.length - 1, + cursorLine + bottomMargin, + ); - ranges.push({ - filepath, - range: { - start: { line: startLine, character: 0 }, - end: { - line: endLine, - character: fileLines[endLine].length, - }, + ranges.push({ + filepath, + range: { + start: { line: firstWindowStart, character: 0 }, + end: { + line: firstWindowEnd, + character: fileLines[firstWindowEnd].length, }, - }); + }, + }); - if (endLine >= fileLines.length - 1) { - break; + // Alternating pattern: down once, up once, repeat + const slidingStep = Math.max(1, Math.floor(windowSize / 2)); + let currentStartDown = firstWindowEnd + 1; + let currentStartUp = firstWindowStart - slidingStep; + while (currentStartDown < fileLines.length || currentStartUp >= 0) { + // Go down once + if (currentStartDown < fileLines.length) { + const windowStart = currentStartDown; + const windowEnd = Math.min( + windowStart + windowSize - 1, + fileLines.length - 1, + ); + + ranges.push({ + filepath, + range: { + start: { line: windowStart, character: 0 }, + end: { + line: windowEnd, + character: fileLines[windowEnd].length, + }, + }, + }); + + currentStartDown += slidingStep; + } + + // Go up once + if (currentStartUp >= 0) { + const windowStart = Math.max(0, currentStartUp); + const windowEnd = Math.min( + windowStart + windowSize - 1, + fileLines.length - 1, + ); + + ranges.push({ + filepath, + range: { + start: { line: windowStart, character: 0 }, + end: { + line: windowEnd, + character: fileLines[windowEnd].length, + }, + }, + }); + + currentStartUp -= slidingStep; } } From c34b1d82b161402b84581552b2cddf57219d8230 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 18:19:35 -0700 Subject: [PATCH 061/174] feat: diffContext is now an array --- core/nextEdit/NextEditProvider.ts | 50 ++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 67f7d1cf0..bd396cf7c 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -35,11 +35,10 @@ import { countTokens } from "../llm/countTokens.js"; import { localPathOrUriToPath } from "../util/pathToUri.js"; import { replaceEscapedCharacters } from "../util/text.js"; import { + INSTINCT_SYSTEM_PROMPT, MERCURY_CODE_TO_EDIT_OPEN, MERCURY_SYSTEM_PROMPT, - MODEL_1_SYSTEM_PROMPT, - NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, + MODEL_WINDOW_SIZES, } from "./constants.js"; import { createDiff, DiffFormatType } from "./context/diffFormatting.js"; import { @@ -83,7 +82,7 @@ export class NextEditProvider { private loggingService: NextEditLoggingService; private contextRetrievalService: ContextRetrievalService; private endpointType: "default" | "fineTuned"; - private diffContext: string = ""; + private diffContext: string[] = []; private autocompleteContext: string = ""; private promptMetadata: PromptMetadata | null = null; private currentEditChainId: string | null = null; @@ -136,7 +135,10 @@ export class NextEditProvider { } public addDiffToContext(diff: string): void { - this.diffContext = diff; + this.diffContext.push(diff); + if (this.diffContext.length > 5) { + this.diffContext.shift(); + } } public addAutocompleteContext(ctx: string): void { @@ -390,16 +392,20 @@ export class NextEditProvider { this.ide.getWorkspaceDirs(), ]); + const modelName = helper.modelName.includes("mercury-coder-nextedit") + ? "mercury-coder-nextedit" + : "instinct"; + const { editableRegionStartLine, editableRegionEndLine } = opts?.usingFullFileDiff ? this._calculateOptimalEditableRegion(helper, "tokenizer") : { editableRegionStartLine: Math.max( - helper.pos.line - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, + helper.pos.line - MODEL_WINDOW_SIZES[modelName].topMargin, 0, ), editableRegionEndLine: Math.min( - helper.pos.line + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, + helper.pos.line + MODEL_WINDOW_SIZES[modelName].bottomMargin, helper.fileLines.length - 1, ), }; @@ -558,7 +564,7 @@ export class NextEditProvider { editDiffHistory: this.diffContext, currentFilePath: helper.filepath, }; - } else if (modelName.includes("model-1")) { + } else if (modelName.includes("instinct")) { // Calculate the window around the cursor position (25 lines above and below). const windowStart = Math.max(0, helper.pos.line - 25); const windowEnd = Math.min( @@ -567,10 +573,13 @@ export class NextEditProvider { ); // The editable region is defined as: cursor line - 1 to cursor line + 5 (inclusive). - const actualEditableStart = Math.max(0, helper.pos.line - 1); + const actualEditableStart = Math.max( + 0, + helper.pos.line - MODEL_WINDOW_SIZES["instinct"].topMargin, + ); const actualEditableEnd = Math.min( helper.fileLines.length - 1, - helper.pos.line + 5, + helper.pos.line + MODEL_WINDOW_SIZES["instinct"].bottomMargin, ); // Ensure editable region boundaries are within the window. @@ -581,8 +590,8 @@ export class NextEditProvider { currentFileContent: helper.fileContents, windowStart, windowEnd, - adjustedEditableStart, - adjustedEditableEnd, + editableRegionStartLine: adjustedEditableStart, + editableRegionEndLine: adjustedEditableEnd, editDiffHistory: this.diffContext, currentFilePath: helper.filepath, languageShorthand: helper.lang.name, @@ -598,7 +607,7 @@ export class NextEditProvider { role: "system", content: modelName.includes("mercury-coder-nextedit") ? MERCURY_SYSTEM_PROMPT - : MODEL_1_SYSTEM_PROMPT, + : INSTINCT_SYSTEM_PROMPT, }; return [systemPrompt, promptMetadata.prompt]; @@ -666,6 +675,8 @@ export class NextEditProvider { if (!llm) return undefined; const msg: ChatMessage = await llm.chat(prompts, token); + console.log("message"); + console.log(msg.content); if (typeof msg.content !== "string") { return undefined; @@ -677,16 +688,17 @@ export class NextEditProvider { ? replaceEscapedCharacters( msg.content.split(`${MERCURY_CODE_TO_EDIT_OPEN}\n`)[1], ).replace(/\n$/, "") - : ""; + : replaceEscapedCharacters(msg.content); if (opts?.usingFullFileDiff === false || !opts?.usingFullFileDiff) { return await this._handlePartialFileDiff( + // we could use fillFileDiff helper, + editableRegionStartLine, + editableRegionEndLine, startTime, llm, nextCompletion, - editableRegionStartLine, - editableRegionEndLine, ); } else { return await this._handleFullFileDiff( @@ -702,11 +714,11 @@ export class NextEditProvider { private async _handlePartialFileDiff( helper: HelperVars, + editableRegionStartLine: number, + editableRegionEndLine: number, startTime: number, llm: ILLM, nextCompletion: string, - editableRegionStartLine: number, - editableRegionEndLine: number, ): Promise { const oldEditRangeSlice = helper.fileContents .split("\n") @@ -1016,6 +1028,7 @@ export class NextEditProvider { try { const previousOutcome = this.getPreviousCompletion(); if (!previousOutcome) { + console.log("previousOutcome is undefined"); return undefined; } @@ -1026,6 +1039,7 @@ export class NextEditProvider { ctx, ); if (!input) { + console.log("input is undefined"); return undefined; } From 72399ca5ccad459c32d800a732f4ba3ead6a0217 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 18:20:05 -0700 Subject: [PATCH 062/174] feat: use a list of diffContexts instead of a single one --- core/nextEdit/templating/instinct.ts | 80 ++++++++++--------- core/nextEdit/templating/instinct.vitest.ts | 52 ++++++++++-- .../templating/mercuryCoderNextEdit.ts | 7 +- .../templating/mercuryCoderNextEdit.vitest.ts | 4 +- 4 files changed, 95 insertions(+), 48 deletions(-) diff --git a/core/nextEdit/templating/instinct.ts b/core/nextEdit/templating/instinct.ts index b7e14f165..b2140d1da 100644 --- a/core/nextEdit/templating/instinct.ts +++ b/core/nextEdit/templating/instinct.ts @@ -67,56 +67,62 @@ export function currentFileContentBlock( } export function editHistoryBlock( - editDiffHistories: string, // unified diffs with Index headers + editDiffHistories: string[], // array of unified diffs with Index headers ) { - if (!editDiffHistories.trim()) { + if (!editDiffHistories.length) { return ""; } const blocks: string[] = []; - // Split on Index: lines to get the unified diff. - const diffSections = editDiffHistories - .split(/^Index: /m) - .filter((section) => section.trim()); + for (const editDiffHistory of editDiffHistories) { + if (!editDiffHistory.trim()) { + continue; + } - for (const section of diffSections) { - const lines = section.split("\n"); + // Split on Index: lines to get the unified diff. + const diffSections = editDiffHistory + .split(/^Index: /m) + .filter((section) => section.trim()); - // Extract filename from the first line (after "Index: " was split off). - const filename = lines[0]; + for (const section of diffSections) { + const lines = section.split("\n"); - // Find the start of the actual diff content (skip ---, +++, and === lines). - const diffLines = lines - .filter( + // Extract filename from the first line (after "Index: " was split off). + const filename = lines[0]; + + // Find the start of the actual diff content (skip ---, +++, and === lines). + const diffLines = lines + .filter( + (line) => + !line.startsWith("---") && + !line.startsWith("+++") && + !line.startsWith("===") && + line.trim() !== "", // remove empty lines from header section + ) + .slice(1); // remove the filename line + + // Only include lines that are actual diff content (@@, +, -, or context lines). + const actualDiffContent = diffLines.filter( (line) => - !line.startsWith("---") && - !line.startsWith("+++") && - !line.startsWith("===") && - line.trim() !== "", // remove empty lines from header section - ) - .slice(1); // remove the filename line + line.startsWith("@@") || + line.startsWith("+") || + line.startsWith("-") || + line.startsWith(" "), // context lines + ); - // Only include lines that are actual diff content (@@, +, -, or context lines). - const actualDiffContent = diffLines.filter( - (line) => - line.startsWith("@@") || - line.startsWith("+") || - line.startsWith("-") || - line.startsWith(" "), // context lines - ); + if (actualDiffContent.length === 0) continue; - if (actualDiffContent.length === 0) continue; + const diffBlock = [ + `User edited file "${filename}"`, + "", + "```diff", + actualDiffContent.join("\n"), + "```", + ].join("\n"); - const diffBlock = [ - `User edited file "${filename}"`, - "", - "```diff", - actualDiffContent.join("\n"), - "```", - ].join("\n"); - - blocks.push(diffBlock); + blocks.push(diffBlock); + } } return blocks.join("\n"); diff --git a/core/nextEdit/templating/instinct.vitest.ts b/core/nextEdit/templating/instinct.vitest.ts index aa15c2fcd..b7972dc5d 100644 --- a/core/nextEdit/templating/instinct.vitest.ts +++ b/core/nextEdit/templating/instinct.vitest.ts @@ -291,7 +291,7 @@ line 3`; describe("editHistoryBlock", () => { test("should format empty edit history", () => { - const result = editHistoryBlock(""); + const result = editHistoryBlock([]); expect(result).toBe(""); }); @@ -306,7 +306,7 @@ describe("editHistoryBlock", () => { + console.log("new"); }`; - const result = editHistoryBlock(diff); + const result = editHistoryBlock([diff]); const expected = `User edited file "test.js" \`\`\`diff @@ -337,7 +337,45 @@ Index: file2.js -let x = "old"; +let x = "new";`; - const result = editHistoryBlock(unifiedDiff); + const result = editHistoryBlock([unifiedDiff]); + const expected = `User edited file "file1.js" + +\`\`\`diff +@@ -1 +1 @@ +-const old = 1; ++const new = 1; +\`\`\` +User edited file "file2.js" + +\`\`\`diff +@@ -1 +1 @@ +-let x = "old"; ++let x = "new"; +\`\`\``; + + expect(result).toBe(expected); + }); + + test("should format multiple diff history entries", () => { + // Multiple diffs should be concatenated into a single string + const unifiedDiffs = [ + `Index: file1.js +=================================================================== +--- a/file1.js 2023-01-01 10:00:00.000000000 +0000 ++++ b/file1.js 2023-01-01 10:01:00.000000000 +0000 +@@ -1 +1 @@ +-const old = 1; ++const new = 1;`, + `Index: file2.js +=================================================================== +--- a/file2.js 2023-01-01 10:02:00.000000000 +0000 ++++ b/file2.js 2023-01-01 10:03:00.000000000 +0000 +@@ -1 +1 @@ +-let x = "old"; ++let x = "new";`, + ]; + + const result = editHistoryBlock(unifiedDiffs); const expected = `User edited file "file1.js" \`\`\`diff @@ -366,7 +404,7 @@ User edited file "file2.js" -export const Button = () => ; +export const Button = () => ;`; - const result = editHistoryBlock(diff); + const result = editHistoryBlock([diff]); const expected = `User edited file "src/components/Button/Button.tsx" \`\`\`diff @@ -388,7 +426,7 @@ User edited file "file2.js" + return "hello world"; +}`; - const result = editHistoryBlock(diff); + const result = editHistoryBlock([diff]); const expected = `User edited file "newfile.js" \`\`\`diff @@ -411,7 +449,7 @@ User edited file "file2.js" - return "goodbye"; -}`; - const result = editHistoryBlock(diff); + const result = editHistoryBlock([diff]); const expected = `User edited file "deletedfile.js" \`\`\`diff @@ -431,7 +469,7 @@ User edited file "file2.js" -old text +new text`; - const result = editHistoryBlock(diff); + const result = editHistoryBlock([diff]); const expected = `User edited file "simple.txt" \`\`\`diff diff --git a/core/nextEdit/templating/mercuryCoderNextEdit.ts b/core/nextEdit/templating/mercuryCoderNextEdit.ts index 1d7950e96..80c465fc1 100644 --- a/core/nextEdit/templating/mercuryCoderNextEdit.ts +++ b/core/nextEdit/templating/mercuryCoderNextEdit.ts @@ -50,12 +50,15 @@ export function currentFileContentBlock( } export function editHistoryBlock( - editDiffHistory: string, // could be a singe large unified diff + editDiffHistory: string[], // could be a singe large unified diff ) { // diffHistory is made from createDiff. // This uses createPatch from npm diff library, which includes an index line and a separator. // We get rid of these first two lines. - return editDiffHistory.split("\n").slice(2).join("\n"); + return editDiffHistory + .map((diff) => diff.split("\n").slice(2).join("\n")) + .join("\n"); + // return editDiffHistory.split("\n").slice(2).join("\n"); } function mercuryNextEditTemplateBuilder( diff --git a/core/nextEdit/templating/mercuryCoderNextEdit.vitest.ts b/core/nextEdit/templating/mercuryCoderNextEdit.vitest.ts index 6a1c35c74..24c1520e7 100644 --- a/core/nextEdit/templating/mercuryCoderNextEdit.vitest.ts +++ b/core/nextEdit/templating/mercuryCoderNextEdit.vitest.ts @@ -108,12 +108,12 @@ describe("mercuryCoderNextEdit", () => { it("should return the edit diff history unchanged", () => { const diffHistory = "diff --git a/file.ts b/file.ts\n==============================\n@@ -1,3 +1,4 @@"; - const result = editHistoryBlock(diffHistory); + const result = editHistoryBlock([diffHistory]); expect(result).toBe("@@ -1,3 +1,4 @@"); }); it("should handle empty diff history", () => { - const result = editHistoryBlock(""); + const result = editHistoryBlock([]); expect(result).toBe(""); }); }); From f249c23f8ada580243e73b03862eaa59458bcf0e Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Mon, 11 Aug 2025 19:19:30 -0700 Subject: [PATCH 063/174] fix: skip redundant calculation --- core/nextEdit/NextEditProvider.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index bd396cf7c..7cc7e8df6 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -572,19 +572,22 @@ export class NextEditProvider { helper.pos.line + 25, ); - // The editable region is defined as: cursor line - 1 to cursor line + 5 (inclusive). - const actualEditableStart = Math.max( - 0, - helper.pos.line - MODEL_WINDOW_SIZES["instinct"].topMargin, - ); - const actualEditableEnd = Math.min( - helper.fileLines.length - 1, - helper.pos.line + MODEL_WINDOW_SIZES["instinct"].bottomMargin, - ); + // // The editable region is defined as: cursor line - 1 to cursor line + 5 (inclusive). + // const actualEditableStart = Math.max( + // 0, + // helper.pos.line - MODEL_WINDOW_SIZES["instinct"].topMargin, + // ); + // const actualEditableEnd = Math.min( + // helper.fileLines.length - 1, + // helper.pos.line + MODEL_WINDOW_SIZES["instinct"].bottomMargin, + // ); // Ensure editable region boundaries are within the window. - const adjustedEditableStart = Math.max(windowStart, actualEditableStart); - const adjustedEditableEnd = Math.min(windowEnd, actualEditableEnd); + const adjustedEditableStart = Math.max( + windowStart, + editableRegionStartLine, + ); + const adjustedEditableEnd = Math.min(windowEnd, editableRegionEndLine); ctx = { contextSnippets: this.autocompleteContext, currentFileContent: helper.fileContents, From 56cf2abf20e1321b436adae6310b25e78c7c27be Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 11 Aug 2025 19:20:07 -0700 Subject: [PATCH 064/174] feat: Respect Org Policies (#7087) * fix: allow no selected org, respect policy * feat: respect policies in extension * fix: config handler test * fix: context providers test --- core/config/ConfigHandler.ts | 69 +++++++++++-------- core/config/ConfigHandler.vitest.ts | 2 +- core/config/ProfileLifecycleManager.ts | 2 + core/config/profile/doLoadConfig.ts | 15 +++- .../providers/_context-providers.vitest.ts | 3 +- core/control-plane/PolicySingleton.ts | 15 ++++ core/control-plane/client.ts | 21 ++++++ core/core.ts | 4 +- core/protocol/core.ts | 2 +- .../components/config/FatalErrorNotice.tsx | 8 +-- gui/src/pages/config/UserSettingsForm.tsx | 7 ++ packages/config-yaml/src/browser.ts | 1 + packages/config-yaml/src/schemas/policy.ts | 9 +++ 13 files changed, 120 insertions(+), 38 deletions(-) create mode 100644 core/control-plane/PolicySingleton.ts create mode 100644 packages/config-yaml/src/schemas/policy.ts diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 179e5fad4..9d977d071 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -17,6 +17,7 @@ import { ControlPlaneSessionInfo, } from "../control-plane/AuthTypes.js"; import { getControlPlaneEnv } from "../control-plane/env.js"; +import { PolicySingleton } from "../control-plane/PolicySingleton.js"; import { logger } from "../util/logger.js"; import { Telemetry } from "../util/posthog.js"; import { @@ -45,7 +46,7 @@ export class ConfigHandler { private organizations: OrgWithProfiles[] = []; currentProfile: ProfileLifecycleManager | null; - currentOrg: OrgWithProfiles; + currentOrg: OrgWithProfiles | null; totalConfigReloads: number = 0; public isInitialized: Promise; @@ -83,16 +84,9 @@ export class ConfigHandler { this.ide, ); - // Just to be safe, always force a default personal org with local profile manager - this.currentProfile = this.globalLocalProfileManager; - const personalOrg: OrgWithProfiles = { - currentProfile: this.globalLocalProfileManager, - profiles: [this.globalLocalProfileManager], - ...this.PERSONAL_ORG_DESC, - }; - - this.currentOrg = personalOrg; - this.organizations = [personalOrg]; + this.currentOrg = null; + this.currentProfile = null; + this.organizations = []; this.initter = new EventEmitter(); this.isInitialized = new Promise((resolve) => { @@ -132,10 +126,10 @@ export class ConfigHandler { const firstNonPersonal = orgs.find( (org) => org.id !== this.PERSONAL_ORG_DESC.id, ); - const fallback = firstNonPersonal ?? orgs[0]; - // note, ignoring case of zero orgs since should never happen + const fallback: OrgWithProfiles | null = + firstNonPersonal ?? orgs[0] ?? null; - let selectedOrg: OrgWithProfiles; + let selectedOrg: OrgWithProfiles | null; if (currentSelection) { const match = orgs.find((org) => org.id === currentSelection); if (match) { @@ -153,12 +147,12 @@ export class ConfigHandler { this.globalContext.update("lastSelectedOrgIdForWorkspace", { ...selectedOrgs, - [workspaceId]: selectedOrg.id, + [workspaceId]: selectedOrg?.id, }); this.organizations = orgs; this.currentOrg = selectedOrg; - this.currentProfile = selectedOrg.currentProfile; + this.currentProfile = selectedOrg?.currentProfile; await this.reloadConfig(reason, errors); } catch (e) { @@ -179,10 +173,27 @@ export class ConfigHandler { const isSignedIn = await this.controlPlaneClient.isSignedIn(); if (isSignedIn) { try { - const orgDescs = await this.controlPlaneClient.listOrganizations(); + // TODO use policy returned with org, not policy endpoint + const policyResponse = await this.controlPlaneClient.getPolicy(); + PolicySingleton.getInstance().policy = policyResponse; + const orgDescriptions = + await this.controlPlaneClient.listOrganizations(); + const orgsWithPolicy = orgDescriptions.map((d) => ({ + ...d, + policy: policyResponse?.policy, + })); + + if (policyResponse?.policy?.allowOtherOrgs === false) { + if (orgsWithPolicy.length === 0) { + return { orgs: [] }; + } else { + const firstOrg = await this.getNonPersonalHubOrg(orgsWithPolicy[0]); + return { orgs: [firstOrg] }; + } + } const orgs = await Promise.all([ this.getPersonalHubOrg(), - ...orgDescs.map((org) => this.getNonPersonalHubOrg(org)), + ...orgsWithPolicy.map((org) => this.getNonPersonalHubOrg(org)), ]); // TODO make try/catch more granular here, to catch specific org errors return { orgs }; @@ -426,7 +437,7 @@ export class ConfigHandler { // Org id: check id validity, save selection, switch and reload async setSelectedOrgId(orgId: string, profileId?: string) { - if (orgId === this.currentOrg.id) { + if (orgId === this.currentOrg?.id) { return; } const org = this.organizations.find((org) => org.id === orgId); @@ -454,6 +465,9 @@ export class ConfigHandler { // Profile id: check id validity, save selection, switch and reload async setSelectedProfileId(profileId: string) { + if (!this.currentOrg) { + throw new Error(`No org selected`); + } if ( this.currentProfile && profileId === this.currentProfile.profileDescription.id @@ -490,10 +504,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [ - { message: "Current profile not found", fatal: true }, - ...(injectErrors ?? []), - ], + errors: injectErrors, configLoadInterrupted: true, }; } @@ -562,7 +573,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [{ message: "Current profile not found", fatal: true }], + errors: undefined, configLoadInterrupted: true, }; } @@ -575,7 +586,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [{ message: "Current profile not found", fatal: true }], + errors: undefined, configLoadInterrupted: true, }; } @@ -598,11 +609,15 @@ export class ConfigHandler { if (!openProfileId) { return; } - const profile = this.currentOrg.profiles.find( + const profile = this.currentOrg?.profiles.find( (p) => p.profileDescription.id === openProfileId, ); + if (!profile) { + console.error(`Profile ${profileId} not found`); + return; + } - if (profile?.profileDescription.profileType === "local") { + if (profile.profileDescription.profileType === "local") { const configFile = element?.sourceFile ?? profile.profileDescription.uri; await this.ide.openFile(configFile); } else { diff --git a/core/config/ConfigHandler.vitest.ts b/core/config/ConfigHandler.vitest.ts index f58160044..1307ce6ab 100644 --- a/core/config/ConfigHandler.vitest.ts +++ b/core/config/ConfigHandler.vitest.ts @@ -10,7 +10,7 @@ import { defaultConfig } from "./default"; describe.skip("Test the ConfigHandler and E2E config loading", () => { test("should show only local profile", () => { - const profiles = testConfigHandler.currentOrg.profiles; + const profiles = testConfigHandler.currentOrg?.profiles; expect(profiles?.length).toBe(1); expect(profiles?.[0].profileDescription.id).toBe("local"); diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index f61908e32..e16bb7986 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -2,6 +2,7 @@ import { ConfigResult, ConfigValidationError, FullSlug, + Policy, } from "@continuedev/config-yaml"; import { @@ -30,6 +31,7 @@ export interface OrganizationDescription { iconUrl: string; name: string; slug: string | undefined; // TODO: This doesn't need to be undefined, just doing while transitioning the backend + policy?: Policy; } export type OrgWithProfiles = OrganizationDescription & { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index ea6b0bf51..d6528454b 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -26,6 +26,7 @@ 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"; +import { PolicySingleton } from "../../control-plane/PolicySingleton"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { getConfigDependentToolDefinitions } from "../../tools"; @@ -325,8 +326,18 @@ export default async function doLoadConfig(options: { } }); - newConfig.allowAnonymousTelemetry = - newConfig.allowAnonymousTelemetry && (await ide.isTelemetryEnabled()); + if (newConfig.allowAnonymousTelemetry !== false) { + if ((await ide.isTelemetryEnabled()) === false) { + newConfig.allowAnonymousTelemetry = false; + } + } + + if ( + PolicySingleton.getInstance().policy?.policy?.allowAnonymousTelemetry === + false + ) { + newConfig.allowAnonymousTelemetry = false; + } // Setup telemetry only after (and if) we know it is enabled await Telemetry.setup( diff --git a/core/context/providers/_context-providers.vitest.ts b/core/context/providers/_context-providers.vitest.ts index f7096bf87..bde33cec1 100644 --- a/core/context/providers/_context-providers.vitest.ts +++ b/core/context/providers/_context-providers.vitest.ts @@ -36,6 +36,7 @@ async function getContextProviderExtras( llmLogger, Promise.resolve(undefined), ); + await configHandler.isInitialized; const { config } = await configHandler.loadConfig(); if (!config) { throw new Error("Config not found"); @@ -54,7 +55,7 @@ async function getContextProviderExtras( }; } -describe.skip("Should successfully run all context providers", () => { +describe("Should successfully run all context providers", () => { afterAll(() => { tearDownTestDir(); }); diff --git a/core/control-plane/PolicySingleton.ts b/core/control-plane/PolicySingleton.ts new file mode 100644 index 000000000..705e67b49 --- /dev/null +++ b/core/control-plane/PolicySingleton.ts @@ -0,0 +1,15 @@ +import { PolicyResponse } from "./client.js"; + +export class PolicySingleton { + private static instance: PolicySingleton; + public policy: PolicyResponse | null = null; + + private constructor() {} + + public static getInstance(): PolicySingleton { + if (!PolicySingleton.instance) { + PolicySingleton.instance = new PolicySingleton(); + } + return PolicySingleton.instance; + } +} diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index ad6112aa9..d5f99a274 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -4,6 +4,7 @@ import { ConfigResult, FQSN, FullSlug, + Policy, SecretResult, SecretType, } from "@continuedev/config-yaml"; @@ -15,6 +16,11 @@ import { IdeInfo, IdeSettings, ModelDescription } from "../index.js"; import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js"; import { getControlPlaneEnv } from "./env.js"; +export interface PolicyResponse { + orgSlug?: string; + policy?: Policy; +} + export interface ControlPlaneWorkspace { id: string; name: string; @@ -215,6 +221,21 @@ export class ControlPlaneClient { } } + public async getPolicy(): Promise { + if (!(await this.isSignedIn())) { + return null; + } + + try { + const resp = await this.request(`ide/policy`, { + method: "GET", + }); + return (await resp.json()) as PolicyResponse; + } catch (e) { + return null; + } + } + public async getFreeTrialStatus(): Promise { if (!(await this.isSignedIn())) { return null; diff --git a/core/core.ts b/core/core.ts index 905151f07..aa558736c 100644 --- a/core/core.ts +++ b/core/core.ts @@ -184,7 +184,7 @@ export class Core { profileId: this.configHandler.currentProfile?.profileDescription.id || null, organizations: this.configHandler.getSerializedOrgs(), - selectedOrgId: this.configHandler.currentOrg.id, + selectedOrgId: this.configHandler.currentOrg?.id ?? null, }); // update additional submenu context providers registered via VSCode API @@ -465,7 +465,7 @@ export class Core { profileId: this.configHandler.currentProfile?.profileDescription.id ?? null, organizations: this.configHandler.getSerializedOrgs(), - selectedOrgId: this.configHandler.currentOrg.id, + selectedOrgId: this.configHandler.currentOrg?.id ?? null, }; }); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 85bca7242..258feaaa9 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -90,7 +90,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { result: ConfigResult; profileId: string | null; organizations: SerializedOrgWithProfiles[]; - selectedOrgId: string; + selectedOrgId: string | null; }, ]; "config/deleteModel": [{ title: string }, void]; diff --git a/gui/src/components/config/FatalErrorNotice.tsx b/gui/src/components/config/FatalErrorNotice.tsx index 8c0a346c2..3d528e810 100644 --- a/gui/src/components/config/FatalErrorNotice.tsx +++ b/gui/src/components/config/FatalErrorNotice.tsx @@ -32,10 +32,10 @@ export const FatalErrorIndicator = () => { return null; } - const displayName = - selectedProfile?.title ?? - `${selectedProfile?.fullSlug?.ownerSlug}/${selectedProfile?.fullSlug?.packageSlug}` ?? - "assistant"; + const displayName = selectedProfile + ? (selectedProfile.title ?? + `${selectedProfile.fullSlug?.ownerSlug}/${selectedProfile.fullSlug?.packageSlug}`) + : "agent"; return ( diff --git a/gui/src/pages/config/UserSettingsForm.tsx b/gui/src/pages/config/UserSettingsForm.tsx index 576a6d1c6..28ab1947a 100644 --- a/gui/src/pages/config/UserSettingsForm.tsx +++ b/gui/src/pages/config/UserSettingsForm.tsx @@ -20,6 +20,7 @@ import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { updateConfig } from "../../redux/slices/configSlice"; +import { selectCurrentOrg } from "../../redux/slices/profilesSlice"; import { setLocalStorage } from "../../util/localStorage"; import { ContinueFeaturesMenu } from "./ContinueFeaturesMenu"; @@ -28,6 +29,8 @@ export function UserSettingsForm() { const dispatch = useAppDispatch(); const ideMessenger = useContext(IdeMessengerContext); const config = useAppSelector((state) => state.config.config); + const currentOrg = useAppSelector(selectCurrentOrg); + const [showExperimental, setShowExperimental] = useState(false); const { session } = useAuth(); @@ -133,6 +136,9 @@ export function UserSettingsForm() { "@continue.dev", ); + const disableTelemetryToggle = + currentOrg?.policy?.allowAnonymousTelemetry === false; + return (
{/* {selectedProfile && isLocalProfile(selectedProfile) ? ( @@ -225,6 +231,7 @@ export function UserSettingsForm() { handleUpdate({ allowAnonymousTelemetry: !allowAnonymousTelemetry, diff --git a/packages/config-yaml/src/browser.ts b/packages/config-yaml/src/browser.ts index b8c5cca1b..9edef65aa 100644 --- a/packages/config-yaml/src/browser.ts +++ b/packages/config-yaml/src/browser.ts @@ -15,4 +15,5 @@ export * from "./modelName.js"; export * from "./schemas/data/index.js"; export * from "./schemas/index.js"; export * from "./schemas/models.js"; +export * from "./schemas/policy.js"; export * from "./validation.js"; diff --git a/packages/config-yaml/src/schemas/policy.ts b/packages/config-yaml/src/schemas/policy.ts new file mode 100644 index 000000000..c9b3d3a0b --- /dev/null +++ b/packages/config-yaml/src/schemas/policy.ts @@ -0,0 +1,9 @@ +import * as z from "zod"; + +export const policySchema = z.object({ + allowAnonymousTelemetry: z.boolean().optional(), + allowOtherOrgs: z.boolean().optional(), + // allowLocalConfigFile: z.boolean().optional(), +}); + +export type Policy = z.infer; From e39881a175fbd6536f638537ef61a003e06c7b84 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 11 Aug 2025 21:16:31 -0700 Subject: [PATCH 066/174] chore: bump versions (#7090) --- extensions/intellij/gradle.properties | 2 +- extensions/vscode/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 75b2d5bd8..6ca982585 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -1,6 +1,6 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginRepositoryUrl=https://github.com/continuedev/continue -pluginVersion=1.0.35 +pluginVersion=1.0.36 pluginSinceBuild=223 platformType=IC platformVersion=2022.3.3 diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9d15d1bb6..1282f2cd4 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.75", + "version": "1.1.76", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From cec4f0f4a3ed5fa35f09586dd3f4e932c27b4044 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 12 Aug 2025 13:05:42 +0530 Subject: [PATCH 067/174] abort controller should not be undefined --- core/indexing/CodebaseIndexer.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index b28ece8da..54e84bf17 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -56,7 +56,7 @@ export class CodebaseIndexer { // and only need to `await` it for tests. public initPromise: Promise; private config!: ContinueConfig; - private indexingCancellationController: AbortController | undefined; + private indexingCancellationController: AbortController; private codebaseIndexingState: IndexingProgressUpdate; private readonly pauseToken: PauseToken; @@ -97,6 +97,9 @@ export class CodebaseIndexer { this.pauseToken = new PauseToken(initialPaused); this.initPromise = this.init(configHandler); + + this.indexingCancellationController = new AbortController(); + this.indexingCancellationController.abort(); // initialize and abort so that a new one can be created } // Initialization - load config and attach config listener @@ -693,7 +696,7 @@ export class CodebaseIndexer { } public async refreshCodebaseIndex(paths: string[]) { - if (this.indexingCancellationController) { + if (!this.indexingCancellationController.signal.aborted) { this.indexingCancellationController.abort(); } const localController = new AbortController(); @@ -735,17 +738,13 @@ export class CodebaseIndexer { }); } if (this.indexingCancellationController === localController) { - this.indexingCancellationController.abort(); // abort before clearing to prevent race condition (multiple starts) - this.indexingCancellationController = undefined; + this.indexingCancellationController.abort(); } } public async refreshCodebaseIndexFiles(files: string[]) { // Can be cancelled by codebase index but not vice versa - if ( - this.indexingCancellationController && - !this.indexingCancellationController.signal.aborted - ) { + if (!this.indexingCancellationController.signal.aborted) { return; } const localController = new AbortController(); @@ -771,7 +770,7 @@ export class CodebaseIndexer { }); } if (this.indexingCancellationController === localController) { - this.indexingCancellationController = undefined; + this.indexingCancellationController.abort(); } } From 51c365c990904097a0c6e0a500cb789778795c0f Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:56:52 +0530 Subject: [PATCH 068/174] style: prevent text selection when double clicking tool policy --- .../mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index 97da69b99..09b64f2ed 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -118,7 +118,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
Date: Tue, 12 Aug 2025 07:50:53 -0700 Subject: [PATCH 069/174] Update cli-review.yaml --- .github/workflows/cli-review.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml index 8a6557be1..2deab2871 100644 --- a/.github/workflows/cli-review.yaml +++ b/.github/workflows/cli-review.yaml @@ -14,14 +14,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" - + - name: Install Continue CLI run: npm install -g @continuedev/cli@1.4.21 - + - name: Run Continue CLI Review run: | echo "Running Continue CLI with hardcoded prompt:" @@ -31,6 +31,6 @@ jobs: echo "" # Run the CLI with a hardcoded prompt and output text directly - echo "Review this pull request and provide feedback on code quality" | cn --config "${{ inputs.assistant }}" -p + echo "Review this pull request and provide feedback on code quality" | cn -p --org continuedev env: - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} \ No newline at end of file + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} From b04c6f62f37f0313499706be46e36065331c0801 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 07:57:40 -0700 Subject: [PATCH 070/174] Update cli-review.yaml --- .github/workflows/cli-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml index 2deab2871..9388bdeaf 100644 --- a/.github/workflows/cli-review.yaml +++ b/.github/workflows/cli-review.yaml @@ -20,7 +20,7 @@ jobs: node-version-file: ".nvmrc" - name: Install Continue CLI - run: npm install -g @continuedev/cli@1.4.21 + run: npm install -g @continuedev/cli@1.4.25 - name: Run Continue CLI Review run: | From 3de7baa8ff3f3646d9b8eeaf9e2fbd74030d7d86 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 08:35:31 -0700 Subject: [PATCH 071/174] feat: add continue-review.yaml --- .github/workflows/continue-review.yaml | 253 +++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 .github/workflows/continue-review.yaml diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml new file mode 100644 index 000000000..8bc8b1519 --- /dev/null +++ b/.github/workflows/continue-review.yaml @@ -0,0 +1,253 @@ +name: Continue CLI Code Review + +on: + workflow_call: + inputs: + assistant: + description: "Assistant configuration to use" + required: false + default: "nate/default-assistant" + type: string + prompt: + description: "Custom prompt to use instead of the default PR review" + required: false + type: string + secrets: + CONTINUE_API_KEY: + required: true + workflow_dispatch: + inputs: + assistant: + description: "Assistant configuration to use" + required: false + default: "nate/default-assistant" + type: string + prompt: + description: "Custom prompt to use instead of the default PR review" + required: false + type: string + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + code-review: + name: AI Code Review + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history for better context + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Continue CLI + run: npm install -g @continuedev/cli@1.4.25 + + - name: Build PR diff prompt + if: github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') + run: | + # Get PR number - different methods depending on trigger + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For workflow_call triggered by PR, we need to get it from context + PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") + fi + + if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then + # Get PR diff using GitHub CLI + gh pr diff $PR_NUMBER > pr_diff.txt + + # Create comprehensive prompt + cat > review_prompt.txt << 'EOF' + You are conducting a code review for a pull request. Below is the git diff showing all the changes: + + EOF + + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + + cat >> review_prompt.txt << 'EOF' + + Please analyze these changes and provide a comprehensive code review. Consider: + + 1. **Code Quality**: Are there any bugs, performance issues, or code smells? + 2. **Best Practices**: Does the code follow established patterns and conventions? + 3. **Security**: Are there any potential security vulnerabilities? + 4. **Testing**: Are appropriate tests included or updated? + 5. **Documentation**: Is documentation adequate for the changes? + 6. **Architecture**: Do the changes fit well with the existing codebase structure? + + You can use the available tools to explore the codebase and understand context better. + + Format your response as a markdown code review with the following structure: + + ## Code Review Summary + + ### βœ… Strengths + - [List positive aspects] + + ### ⚠️ Issues Found + - [List any problems with severity levels] + + ### πŸ’‘ Suggestions + - [List improvement recommendations] + + ### πŸš€ Overall Assessment + [Provide overall recommendation: APPROVE, REQUEST_CHANGES, or COMMENT] + + Only call the 'exit' tool if you find critical security vulnerabilities or bugs that would break production. + EOF + else + echo "Could not determine PR number, using generic prompt" + cat > review_prompt.txt << 'EOF' + Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. + + Format your response as a markdown code review. + EOF + fi + env: + GH_TOKEN: ${{ github.token }} + + - name: Build custom prompt + if: inputs.prompt != '' + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # Get PR number for custom prompts too + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For workflow_call triggered by PR, we need to get it from context + PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") + fi + + if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then + # Get PR diff using GitHub CLI + gh pr diff $PR_NUMBER > pr_diff.txt + + # Create custom prompt with diff included + echo "${{ inputs.prompt }}" > review_prompt.txt + echo "" >> review_prompt.txt + echo "Below is the git diff showing all the changes:" >> review_prompt.txt + echo "" >> review_prompt.txt + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + else + echo "${{ inputs.prompt }}" > review_prompt.txt + fi + + - name: Build default prompt for non-PR triggers + if: inputs.prompt == '' && github.event_name != 'pull_request' && (github.event_name != 'workflow_run' || github.event.workflow_run.event != 'pull_request') + run: | + cat > review_prompt.txt << 'EOF' + Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. You do not need to acknowledge what was done well. + + Format your response as a markdown code review with each comment having only a short description about the problem and suggested solution, each being separated by "\n\n---\n\n". + + EOF + + - name: Run Continue CLI Review + run: | + echo "Running Continue CLI with prompt:" + echo "==================================" + cat review_prompt.txt + echo "==================================" + echo "" + + # Run the CLI with the generated prompt and pipe output to code_review.md + cat review_prompt.txt | cn --auto --config "${{ inputs.assistant }}" -p > code_review.md + env: + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} + + - name: Upload Review Results + uses: actions/upload-artifact@v4 + if: always() + with: + name: code-review-results + path: | + code_review.md + review_prompt.txt + pr_diff.txt + retention-days: 30 + + - name: Comment PR with Review + if: always() && (github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request')) + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + + try { + let reviewContent = ''; + + if (fs.existsSync('code_review.md') && fs.statSync('code_review.md').size > 0) { + reviewContent = fs.readFileSync('code_review.md', 'utf8'); + } else { + reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; + } + + // Get PR number + let prNumber; + if (context.payload.pull_request) { + prNumber = context.payload.pull_request.number; + } else if (context.payload.workflow_run && context.payload.workflow_run.pull_requests && context.payload.workflow_run.pull_requests.length > 0) { + prNumber = context.payload.workflow_run.pull_requests[0].number; + } + + if (!prNumber) { + console.log('Could not determine PR number for commenting'); + return; + } + + // Unique identifier for our bot comments + const botSignature = ''; + const newComment = `${botSignature}\n${reviewContent}`; + + // Get all comments on the PR + const { data: comments } = await github.rest.issues.listComments({ per_page: 100, + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + }); + + // Find existing Continue CLI review comment + const existingComment = comments.find(comment => + comment.body.includes(botSignature) + ); + + if (existingComment) { + // Update existing comment + await github.rest.issues.updateComment({ + comment_id: existingComment.id, + owner: context.repo.owner, + repo: context.repo.repo, + body: newComment + }); + console.log(`Successfully updated existing comment #${existingComment.id} on PR #${prNumber}`); + } else { + // Create new comment + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: newComment + }); + console.log(`Successfully created new comment on PR #${prNumber}`); + } + } catch (error) { + console.log('Failed to post/update comment:', error.message); + console.log('Error details:', error); + } + env: + GITHUB_TOKEN: ${{ github.token }} From cb591bc577ca80947e7aa8ac9b9cd3f038b8c46d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:37:08 +0000 Subject: [PATCH 072/174] chore(deps): bump actions/checkout from 4 to 5 Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-release.yml | 4 ++-- .github/workflows/compliance.yaml | 4 ++-- .github/workflows/docs.yml | 2 +- .github/workflows/jetbrains-release.yaml | 12 +++++----- .github/workflows/label-merged-prs.yml | 2 +- .github/workflows/main-build.yaml | 2 +- .github/workflows/main.yaml | 8 +++---- .github/workflows/pr-build-upload-vsix.yaml | 2 +- .github/workflows/pr-checks.yaml | 22 +++++++++---------- .github/workflows/preview.yaml | 6 ++--- .github/workflows/reusable-release.yml | 2 +- .github/workflows/similar-issues.yml | 2 +- .../submit-github-dependency-graph.yml | 2 +- .github/workflows/vscode-version-bump.yml | 2 +- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 031ed1fbe..2e047b5d0 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -16,7 +16,7 @@ jobs: contents: write # Needed for creating releases steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Get version from package.json id: get_version @@ -45,7 +45,7 @@ jobs: contents: write # Needed for creating releases steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index 3b69c00cb..6ab98b27e 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -101,7 +101,7 @@ jobs: contents: read steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Node.js uses: actions/setup-node@v4 @@ -134,7 +134,7 @@ jobs: if: ${{ !github.event.pull_request.draft }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Check required files run: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b83567fca..589a8e2ed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 72bd84235..a0aa2d3f0 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -56,7 +56,7 @@ jobs: # steps: # # 0. Setup git # - name: Checkout - # uses: actions/checkout@v4 + # uses: actions/checkout@v5 # - name: Set up Git # run: | @@ -102,7 +102,7 @@ jobs: steps: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: ref: ${{ github.event.release.tag_name }} @@ -362,7 +362,7 @@ jobs: steps: # 1. Check-out repository - name: Check-out repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 # 2. Install npm dependencies - name: Use Node.js from .nvmrc @@ -429,7 +429,7 @@ jobs: steps: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v4 + uses: actions/checkout@v5 # Set up Java environment for the next steps - name: Setup Java @@ -482,7 +482,7 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v4 + uses: actions/checkout@v5 # Set up Java environment for the next steps - name: Setup Java @@ -513,7 +513,7 @@ jobs: # Check out current repository - name: Fetch Sources - uses: actions/checkout@v4 + uses: actions/checkout@v5 # Set up Java environment for the next steps - name: Setup Java diff --git a/.github/workflows/label-merged-prs.yml b/.github/workflows/label-merged-prs.yml index c3c034117..d6f83eba8 100644 --- a/.github/workflows/label-merged-prs.yml +++ b/.github/workflows/label-merged-prs.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Check if author is in tier list id: check-author diff --git a/.github/workflows/main-build.yaml b/.github/workflows/main-build.yaml index 75e4104ab..a04afb945 100644 --- a/.github/workflows/main-build.yaml +++ b/.github/workflows/main-build.yaml @@ -18,7 +18,7 @@ jobs: matrix: platform: [Linux, macOS] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 2 # Get the last 2 commits to find the merge commit diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 0a5845f6d..cf276f360 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -66,7 +66,7 @@ jobs: arch: arm64 npm_config_arch: arm64 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 @@ -92,7 +92,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 # This ensures all tags are fetched @@ -112,7 +112,7 @@ jobs: - build steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Git run: | @@ -145,7 +145,7 @@ jobs: steps: # 0. Setup git - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Git run: | diff --git a/.github/workflows/pr-build-upload-vsix.yaml b/.github/workflows/pr-build-upload-vsix.yaml index 6a8250a83..926855b7c 100644 --- a/.github/workflows/pr-build-upload-vsix.yaml +++ b/.github/workflows/pr-build-upload-vsix.yaml @@ -24,7 +24,7 @@ jobs: runner: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 63afde345..6aa1429a8 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -14,7 +14,7 @@ jobs: prettier-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -35,7 +35,7 @@ jobs: core-checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup packages uses: ./.github/actions/setup-packages - name: Setup core component @@ -71,7 +71,7 @@ jobs: gui-checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup packages uses: ./.github/actions/setup-packages - name: Setup core component @@ -101,7 +101,7 @@ jobs: binary-checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup packages uses: ./.github/actions/setup-packages - name: Setup core component @@ -123,7 +123,7 @@ jobs: vscode-checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup packages uses: ./.github/actions/setup-packages - name: Setup core component @@ -156,7 +156,7 @@ jobs: outputs: packages: ${{ steps.get-packages.outputs.packages }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Get package list id: get-packages run: | @@ -171,7 +171,7 @@ jobs: matrix: package: ${{ fromJson(needs.get-packages-matrix.outputs.packages) }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Setup packages uses: ./.github/actions/setup-packages @@ -197,7 +197,7 @@ jobs: outputs: test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -257,7 +257,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 @@ -289,7 +289,7 @@ jobs: test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }} command: ["e2e:ci:run", "e2e:ci:run-yaml"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Run VS Code E2E test uses: ./.github/actions/run-vscode-e2e-test with: @@ -303,7 +303,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Run JetBrains tests uses: ./.github/actions/run-jetbrains-tests with: diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 84e5399eb..b68a65efd 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -66,7 +66,7 @@ jobs: arch: arm64 npm_config_arch: arm64 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 @@ -96,7 +96,7 @@ jobs: - build steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Git run: | @@ -131,7 +131,7 @@ jobs: steps: # 0. Setup git - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Git run: | diff --git a/.github/workflows/reusable-release.yml b/.github/workflows/reusable-release.yml index 80d135e29..7cab0df2a 100644 --- a/.github/workflows/reusable-release.yml +++ b/.github/workflows/reusable-release.yml @@ -47,7 +47,7 @@ jobs: working-directory: ${{ inputs.package-path }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/.github/workflows/similar-issues.yml b/.github/workflows/similar-issues.yml index 13ebcf269..343982af8 100644 --- a/.github/workflows/similar-issues.yml +++ b/.github/workflows/similar-issues.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout deja-view - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: 'bdougie/deja-view' # Option 1: Pin to specific commit (most secure) diff --git a/.github/workflows/submit-github-dependency-graph.yml b/.github/workflows/submit-github-dependency-graph.yml index 50987cc2c..83611f4b7 100644 --- a/.github/workflows/submit-github-dependency-graph.yml +++ b/.github/workflows/submit-github-dependency-graph.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Java uses: actions/setup-java@v4 with: diff --git a/.github/workflows/vscode-version-bump.yml b/.github/workflows/vscode-version-bump.yml index a7aaee3d5..961fa50ba 100644 --- a/.github/workflows/vscode-version-bump.yml +++ b/.github/workflows/vscode-version-bump.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 # Fetch all history and tags From 2b384e7fb5f6b4bc695626bb06a1409505320dbd Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 08:45:44 -0700 Subject: [PATCH 073/174] Update continue-review.yaml --- .github/workflows/continue-review.yaml | 132 ++++--------------------- 1 file changed, 21 insertions(+), 111 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 8bc8b1519..c2d989175 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -1,31 +1,8 @@ name: Continue CLI Code Review on: - workflow_call: - inputs: - assistant: - description: "Assistant configuration to use" - required: false - default: "nate/default-assistant" - type: string - prompt: - description: "Custom prompt to use instead of the default PR review" - required: false - type: string - secrets: - CONTINUE_API_KEY: - required: true - workflow_dispatch: - inputs: - assistant: - description: "Assistant configuration to use" - required: false - default: "nate/default-assistant" - type: string - prompt: - description: "Custom prompt to use instead of the default PR review" - required: false - type: string + pull_request: + types: [opened, synchronize, reopened] permissions: contents: read @@ -51,32 +28,22 @@ jobs: - name: Install Continue CLI run: npm install -g @continuedev/cli@1.4.25 - - name: Build PR diff prompt - if: github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') + - name: Build PR Review Prompt run: | - # Get PR number - different methods depending on trigger - if [ "${{ github.event_name }}" = "pull_request" ]; then - PR_NUMBER="${{ github.event.number }}" - else - # For workflow_call triggered by PR, we need to get it from context - PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") - fi - - if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then - # Get PR diff using GitHub CLI - gh pr diff $PR_NUMBER > pr_diff.txt - - # Create comprehensive prompt - cat > review_prompt.txt << 'EOF' + # Get PR diff + gh pr diff ${{ github.event.number }} > pr_diff.txt + + # Create review prompt + cat > review_prompt.txt << 'EOF' You are conducting a code review for a pull request. Below is the git diff showing all the changes: EOF - - echo "--- PR DIFF START ---" >> review_prompt.txt - cat pr_diff.txt >> review_prompt.txt - echo "--- PR DIFF END ---" >> review_prompt.txt - - cat >> review_prompt.txt << 'EOF' + + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + + cat >> review_prompt.txt << 'EOF' Please analyze these changes and provide a comprehensive code review. Consider: @@ -107,56 +74,9 @@ jobs: Only call the 'exit' tool if you find critical security vulnerabilities or bugs that would break production. EOF - else - echo "Could not determine PR number, using generic prompt" - cat > review_prompt.txt << 'EOF' - Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. - - Format your response as a markdown code review. - EOF - fi env: GH_TOKEN: ${{ github.token }} - - name: Build custom prompt - if: inputs.prompt != '' - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - # Get PR number for custom prompts too - if [ "${{ github.event_name }}" = "pull_request" ]; then - PR_NUMBER="${{ github.event.number }}" - else - # For workflow_call triggered by PR, we need to get it from context - PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "") - fi - - if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then - # Get PR diff using GitHub CLI - gh pr diff $PR_NUMBER > pr_diff.txt - - # Create custom prompt with diff included - echo "${{ inputs.prompt }}" > review_prompt.txt - echo "" >> review_prompt.txt - echo "Below is the git diff showing all the changes:" >> review_prompt.txt - echo "" >> review_prompt.txt - echo "--- PR DIFF START ---" >> review_prompt.txt - cat pr_diff.txt >> review_prompt.txt - echo "--- PR DIFF END ---" >> review_prompt.txt - else - echo "${{ inputs.prompt }}" > review_prompt.txt - fi - - - name: Build default prompt for non-PR triggers - if: inputs.prompt == '' && github.event_name != 'pull_request' && (github.event_name != 'workflow_run' || github.event.workflow_run.event != 'pull_request') - run: | - cat > review_prompt.txt << 'EOF' - Please review the recent changes to this codebase and provide feedback on code quality, potential issues, and suggestions for improvement. You do not need to acknowledge what was done well. - - Format your response as a markdown code review with each comment having only a short description about the problem and suggested solution, each being separated by "\n\n---\n\n". - - EOF - - name: Run Continue CLI Review run: | echo "Running Continue CLI with prompt:" @@ -165,8 +85,8 @@ jobs: echo "==================================" echo "" - # Run the CLI with the generated prompt and pipe output to code_review.md - cat review_prompt.txt | cn --auto --config "${{ inputs.assistant }}" -p > code_review.md + # Run the CLI with hardcoded assistant and pipe output to code_review.md + cat review_prompt.txt | cn --auto --config "nate/default-assistant" -p > code_review.md env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} @@ -182,7 +102,7 @@ jobs: retention-days: 30 - name: Comment PR with Review - if: always() && (github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request')) + if: always() uses: actions/github-script@v7 with: script: | @@ -197,25 +117,15 @@ jobs: reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; } - // Get PR number - let prNumber; - if (context.payload.pull_request) { - prNumber = context.payload.pull_request.number; - } else if (context.payload.workflow_run && context.payload.workflow_run.pull_requests && context.payload.workflow_run.pull_requests.length > 0) { - prNumber = context.payload.workflow_run.pull_requests[0].number; - } - - if (!prNumber) { - console.log('Could not determine PR number for commenting'); - return; - } + const prNumber = context.payload.pull_request.number; // Unique identifier for our bot comments const botSignature = ''; const newComment = `${botSignature}\n${reviewContent}`; // Get all comments on the PR - const { data: comments } = await github.rest.issues.listComments({ per_page: 100, + const { data: comments } = await github.rest.issues.listComments({ + per_page: 100, issue_number: prNumber, owner: context.repo.owner, repo: context.repo.repo, @@ -250,4 +160,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file From 8b2686c903dd8cddee17cbdb9265548157116fb4 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 08:46:22 -0700 Subject: [PATCH 074/174] Update continue-review.yaml --- .github/workflows/continue-review.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index c2d989175..8e8e656c3 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -2,7 +2,7 @@ name: Continue CLI Code Review on: pull_request: - types: [opened, synchronize, reopened] + types: [opened, ready_for_review] permissions: contents: read @@ -29,6 +29,7 @@ jobs: run: npm install -g @continuedev/cli@1.4.25 - name: Build PR Review Prompt + if: github.event.pull_request.draft == false run: | # Get PR diff gh pr diff ${{ github.event.number }} > pr_diff.txt From ae028938a94cd3595df51022cd987cbeb0d9b514 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:01:35 -0700 Subject: [PATCH 075/174] improv: use org setup --- .github/workflows/continue-review.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 8e8e656c3..03f97b990 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -33,17 +33,17 @@ jobs: run: | # Get PR diff gh pr diff ${{ github.event.number }} > pr_diff.txt - + # Create review prompt cat > review_prompt.txt << 'EOF' You are conducting a code review for a pull request. Below is the git diff showing all the changes: EOF - + echo "--- PR DIFF START ---" >> review_prompt.txt cat pr_diff.txt >> review_prompt.txt echo "--- PR DIFF END ---" >> review_prompt.txt - + cat >> review_prompt.txt << 'EOF' Please analyze these changes and provide a comprehensive code review. Consider: @@ -87,7 +87,7 @@ jobs: echo "" # Run the CLI with hardcoded assistant and pipe output to code_review.md - cat review_prompt.txt | cn --auto --config "nate/default-assistant" -p > code_review.md + cat review_prompt.txt | cn --auto --org continuedev --config continuedev/review-bot -p > code_review.md env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} @@ -161,4 +161,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file + GITHUB_TOKEN: ${{ github.token }} From 7dec41f8af6916fed02d8de9a6f513d11f61ea70 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:16:33 -0700 Subject: [PATCH 076/174] Delete cli-review.yaml --- .github/workflows/cli-review.yaml | 36 ------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/cli-review.yaml diff --git a/.github/workflows/cli-review.yaml b/.github/workflows/cli-review.yaml deleted file mode 100644 index 9388bdeaf..000000000 --- a/.github/workflows/cli-review.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: CLI Review - -on: - pull_request: - branches: - - main - - push: - branches: - - main - -jobs: - cli-review: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Install Continue CLI - run: npm install -g @continuedev/cli@1.4.25 - - - name: Run Continue CLI Review - run: | - echo "Running Continue CLI with hardcoded prompt:" - echo "==================================" - echo "Review this pull request and provide feedback on code quality" - echo "==================================" - echo "" - - # Run the CLI with a hardcoded prompt and output text directly - echo "Review this pull request and provide feedback on code quality" | cn -p --org continuedev - env: - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} From f15c140d934328b56e8373e77fb53afcae1797ad Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:21:24 -0700 Subject: [PATCH 077/174] improv: always leave a new comment --- .github/workflows/continue-review.yaml | 38 ++++---------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 03f97b990..c269a3985 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -120,44 +120,16 @@ jobs: const prNumber = context.payload.pull_request.number; - // Unique identifier for our bot comments - const botSignature = ''; - const newComment = `${botSignature}\n${reviewContent}`; - - // Get all comments on the PR - const { data: comments } = await github.rest.issues.listComments({ - per_page: 100, + // Create new comment + await github.rest.issues.createComment({ issue_number: prNumber, owner: context.repo.owner, repo: context.repo.repo, + body: reviewContent }); - - // Find existing Continue CLI review comment - const existingComment = comments.find(comment => - comment.body.includes(botSignature) - ); - - if (existingComment) { - // Update existing comment - await github.rest.issues.updateComment({ - comment_id: existingComment.id, - owner: context.repo.owner, - repo: context.repo.repo, - body: newComment - }); - console.log(`Successfully updated existing comment #${existingComment.id} on PR #${prNumber}`); - } else { - // Create new comment - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: newComment - }); - console.log(`Successfully created new comment on PR #${prNumber}`); - } + console.log(`Successfully created new comment on PR #${prNumber}`); } catch (error) { - console.log('Failed to post/update comment:', error.message); + console.log('Failed to post comment:', error.message); console.log('Error details:', error); } env: From 7c2cb65ea1073b5965aa7ccaa4578671895f2ae9 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 09:25:17 -0700 Subject: [PATCH 078/174] Update continue-review.yaml --- .github/workflows/continue-review.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index c269a3985..53a68fb2a 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -13,6 +13,7 @@ jobs: code-review: name: AI Code Review runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout Repository From a7e2d6f520e386578c4e7e2b526e3c3fdb7bf510 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 10:11:37 -0700 Subject: [PATCH 079/174] feat: summon bot --- .github/workflows/continue-review.yaml | 35 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 53a68fb2a..225a3e351 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -3,6 +3,8 @@ name: Continue CLI Code Review on: pull_request: types: [opened, ready_for_review] + issue_comment: + types: [created] permissions: contents: read @@ -14,6 +16,12 @@ jobs: name: AI Code Review runs-on: ubuntu-latest timeout-minutes: 10 + # Only run if it's a PR event OR if it's a comment with @continue-review on a PR + if: | + github.event_name == 'pull_request' || + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains(github.event.comment.body, '@continue-review')) steps: - name: Checkout Repository @@ -30,10 +38,17 @@ jobs: run: npm install -g @continuedev/cli@1.4.25 - name: Build PR Review Prompt - if: github.event.pull_request.draft == false run: | + # Get PR number based on event type + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For issue_comment event on a PR + PR_NUMBER="${{ github.event.issue.number }}" + fi + # Get PR diff - gh pr diff ${{ github.event.number }} > pr_diff.txt + gh pr diff $PR_NUMBER > pr_diff.txt # Create review prompt cat > review_prompt.txt << 'EOF' @@ -119,7 +134,19 @@ jobs: reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; } - const prNumber = context.payload.pull_request.number; + // Get PR number based on event type + let prNumber; + if (context.eventName === 'pull_request') { + prNumber = context.payload.pull_request.number; + } else { + // For issue_comment event + prNumber = context.payload.issue.number; + } + + // Add a header if triggered by comment + if (context.eventName === 'issue_comment') { + reviewContent = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewContent}`; + } // Create new comment await github.rest.issues.createComment({ @@ -134,4 +161,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file From e623242d3cf06dbe2fb547968d014b13e5443783 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 10:23:52 -0700 Subject: [PATCH 080/174] improv: add temporary permissions checks --- .github/workflows/continue-review.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 225a3e351..f6f898bec 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -16,9 +16,14 @@ jobs: name: AI Code Review runs-on: ubuntu-latest timeout-minutes: 10 - # Only run if it's a PR event OR if it's a comment with @continue-review on a PR + # Only run if: + # - It's a PR event from a team member (with write/admin permissions) + # - OR it's a comment with @continue-review on a PR (from anyone) if: | - github.event_name == 'pull_request' || + (github.event_name == 'pull_request' && + (github.event.pull_request.author_association == 'OWNER' || + github.event.pull_request.author_association == 'MEMBER' || + github.event.pull_request.author_association == 'COLLABORATOR')) || (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@continue-review')) From 45c19fafdfd71a7b6950a951048b6a39b95653fa Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 10:25:49 -0700 Subject: [PATCH 081/174] improv: add AI code reviews --- .github/pull_request_template.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 348566cd8..62ec1fb89 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,6 +2,11 @@ [ What changed? Feel free to be brief. ] +## AI Code Review + +- **Team members**: AI review will run automatically when PR is opened or marked ready for review +- **Community contributors**: Request AI review by commenting `@continue-review` on your PR + ## Checklist - [] I've read the [contributing guide](https://github.com/continuedev/continue/blob/main/CONTRIBUTING.md) From fafea05500f447035901b4b6439f058545a9b9ca Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 11:09:49 -0700 Subject: [PATCH 082/174] improv: make it readonly and allow to summon by comment from members only --- .github/pull_request_template.md | 4 ++-- .github/workflows/continue-review.yaml | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 62ec1fb89..281f61c1f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,8 +4,8 @@ ## AI Code Review -- **Team members**: AI review will run automatically when PR is opened or marked ready for review -- **Community contributors**: Request AI review by commenting `@continue-review` on your PR +- **Team members only**: AI review runs automatically when PR is opened or marked ready for review +- Team members can also trigger a review by commenting `@continue-review` ## Checklist diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index f6f898bec..6c282ae57 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 # Only run if: # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-review on a PR (from anyone) + # - OR it's a comment with @continue-review on a PR from a team member if: | (github.event_name == 'pull_request' && (github.event.pull_request.author_association == 'OWNER' || @@ -26,7 +26,10 @@ jobs: github.event.pull_request.author_association == 'COLLABORATOR')) || (github.event_name == 'issue_comment' && github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-review')) + contains(github.event.comment.body, '@continue-review') && + (github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR')) steps: - name: Checkout Repository @@ -108,7 +111,7 @@ jobs: echo "" # Run the CLI with hardcoded assistant and pipe output to code_review.md - cat review_prompt.txt | cn --auto --org continuedev --config continuedev/review-bot -p > code_review.md + cat review_prompt.txt | cn --readonly --org continuedev --config continuedev/review-bot -p > code_review.md env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} From 9150b6f68028d02a62676448ef295b99f3cad33b Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 11:30:02 -0700 Subject: [PATCH 083/174] improv: prompt --- .github/workflows/continue-review.yaml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 6c282ae57..95a9c48ea 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -54,7 +54,7 @@ jobs: # For issue_comment event on a PR PR_NUMBER="${{ github.event.issue.number }}" fi - + # Get PR diff gh pr diff $PR_NUMBER > pr_diff.txt @@ -86,13 +86,27 @@ jobs: ## Code Review Summary ### βœ… Strengths - - [List positive aspects] + - **[Aspect]**: [Description of what was done well] ### ⚠️ Issues Found - - [List any problems with severity levels] + + Only include the severity subheaders below if you actually found issues at that level: + + #### Critical + - **[Issue Title]**: [Description of critical issues that must be fixed before merging] + + #### High + - **[Issue Title]**: [Description of high-priority issues that should be fixed] + + #### Medium + - **[Issue Title]**: [Description of issues that should be addressed] + + #### Low + - **[Issue Title]**: [Description of minor issues or nice-to-have improvements] + ### πŸ’‘ Suggestions - - [List improvement recommendations] + - **[Suggestion Title]**: [Description of improvement recommendations] ### πŸš€ Overall Assessment [Provide overall recommendation: APPROVE, REQUEST_CHANGES, or COMMENT] @@ -169,4 +183,4 @@ jobs: console.log('Error details:', error); } env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file + GITHUB_TOKEN: ${{ github.token }} From a18206baeed9379dd9c9344124bf96171f1b378c Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 13:00:10 -0700 Subject: [PATCH 084/174] feat: new review bot --- .github/workflows/continue-inline-review.yaml | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 .github/workflows/continue-inline-review.yaml diff --git a/.github/workflows/continue-inline-review.yaml b/.github/workflows/continue-inline-review.yaml new file mode 100644 index 000000000..2589f93d4 --- /dev/null +++ b/.github/workflows/continue-inline-review.yaml @@ -0,0 +1,239 @@ +name: Continue CLI Inline Code Review + +on: + pull_request: + types: [opened, ready_for_review] + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + inline-code-review: + name: AI Inline Code Review + runs-on: ubuntu-latest + timeout-minutes: 10 + # Only run if: + # - It's a PR event from a team member (with write/admin permissions) + # - OR it's a comment with @continue-inline-review on a PR from a team member + if: > + (github.event_name == 'pull_request' && + (github.event.pull_request.author_association == 'OWNER' || + github.event.pull_request.author_association == 'MEMBER' || + github.event.pull_request.author_association == 'COLLABORATOR')) || + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains(github.event.comment.body, '@continue-inline-review') && + (github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR')) + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history for better context + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Continue CLI + run: npm install -g @continuedev/cli@latest + + - name: Build Inline Review Prompt + run: | + # Get PR number based on event type + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For issue_comment event on a PR + PR_NUMBER="${{ github.event.issue.number }}" + fi + + # Get PR files with line numbers + gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files > pr_files.json + + # Get PR diff with context + gh pr diff $PR_NUMBER --color=never > pr_diff.txt + + # Create review prompt for inline comments + cat > inline_review_prompt.txt << 'EOF' + You are conducting a detailed inline code review for a pull request. + + Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. + + Below is the PR diff: + + EOF + + cat pr_diff.txt >> inline_review_prompt.txt + + cat >> inline_review_prompt.txt << 'EOF' + + Please analyze these changes and provide inline review comments in the following JSON format: + + { + "review_summary": "Overall assessment of the PR", + "comments": [ + { + "path": "path/to/file.js", + "line": 42, + "side": "RIGHT", + "body": "Brief, specific comment about this line or section" + } + ] + } + + Focus on: + 1. **Critical Issues**: Security vulnerabilities, bugs that will break functionality + 2. **High Priority**: Performance problems, incorrect logic, missing error handling + 3. **Medium Priority**: Code style violations, potential edge cases, unclear code + 4. **Low Priority**: Suggestions for improvement, refactoring opportunities + + Guidelines for comments: + - Be specific and actionable + - Reference the exact line number from the diff + - Keep comments concise but informative + - Suggest concrete improvements when pointing out issues + - Only comment on actual problems or important improvements + - Use "RIGHT" for new/modified lines, "LEFT" for context about removed lines + + Important: + - Output ONLY valid JSON, no additional text + - Ensure line numbers match the actual diff + - Comment on the most important issues first + - Limit to maximum 20 most relevant comments + EOF + env: + GH_TOKEN: ${{ github.token }} + + - name: Run Continue CLI Inline Review + run: | + echo "Running Continue CLI for inline review..." + + # Run the CLI and capture JSON output + cat inline_review_prompt.txt | cn --readonly --org continuedev --config continuedev/review-bot -p > inline_review.json + + # Validate JSON output + if ! jq empty inline_review.json 2>/dev/null; then + echo "Invalid JSON output from Continue CLI" + echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json + fi + env: + CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} + + - name: Post Inline Review Comments + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + + try { + // Read the review output + let reviewData; + try { + const reviewContent = fs.readFileSync('inline_review.json', 'utf8'); + reviewData = JSON.parse(reviewContent); + } catch (parseError) { + console.log('Failed to parse review JSON:', parseError); + reviewData = { + review_summary: 'AI review completed but failed to parse output', + comments: [] + }; + } + + // Get PR number + let prNumber; + if (context.eventName === 'pull_request') { + prNumber = context.payload.pull_request.number; + } else { + prNumber = context.payload.issue.number; + } + + // Get the latest commit SHA + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber + }); + + const commitSha = pr.head.sha; + + // Prepare review comments + const comments = reviewData.comments?.map(comment => ({ + path: comment.path, + line: comment.line || 1, + side: comment.side || 'RIGHT', + body: comment.body + })) || []; + + // Create the review + if (comments.length > 0) { + try { + await github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + commit_id: commitSha, + body: reviewData.review_summary || 'AI Code Review', + event: 'COMMENT', + comments: comments + }); + console.log(`Successfully created review with ${comments.length} inline comments`); + } catch (reviewError) { + console.log('Failed to create review:', reviewError.message); + + // Fallback: post as a regular comment if review creation fails + const fallbackBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n` + + `*Failed to post ${comments.length} inline comments. Please review the changes manually.*`; + + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: fallbackBody + }); + } + } else { + // No inline comments, just post the summary + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*` + }); + } + + // Add triggered by note if from comment + if (context.eventName === 'issue_comment') { + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: `*Inline review triggered by @${context.payload.comment.user.login}*` + }); + } + + } catch (error) { + console.log('Failed to post review:', error.message); + console.log('Error details:', error); + } + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Upload Review Artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: inline-review-results + path: | + inline_review.json + inline_review_prompt.txt + pr_files.json + pr_diff.txt + retention-days: 7 \ No newline at end of file From 9da29054f4506193a09c870e00d7df57c1a61131 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 13:17:36 -0700 Subject: [PATCH 085/174] improv: logs --- .github/workflows/continue-inline-review.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/continue-inline-review.yaml b/.github/workflows/continue-inline-review.yaml index 2589f93d4..29d1c1413 100644 --- a/.github/workflows/continue-inline-review.yaml +++ b/.github/workflows/continue-inline-review.yaml @@ -119,6 +119,10 @@ jobs: # Run the CLI and capture JSON output cat inline_review_prompt.txt | cn --readonly --org continuedev --config continuedev/review-bot -p > inline_review.json + # Log the output for debugging + echo "Continue CLI output:" + cat inline_review.json + # Validate JSON output if ! jq empty inline_review.json 2>/dev/null; then echo "Invalid JSON output from Continue CLI" From 2bf6034068a0a996a012c0a4601685aaa22b12a0 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 13:18:05 -0700 Subject: [PATCH 086/174] fix: add json flag --- .github/workflows/continue-inline-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continue-inline-review.yaml b/.github/workflows/continue-inline-review.yaml index 29d1c1413..a732b77f7 100644 --- a/.github/workflows/continue-inline-review.yaml +++ b/.github/workflows/continue-inline-review.yaml @@ -117,7 +117,7 @@ jobs: echo "Running Continue CLI for inline review..." # Run the CLI and capture JSON output - cat inline_review_prompt.txt | cn --readonly --org continuedev --config continuedev/review-bot -p > inline_review.json + cat inline_review_prompt.txt | cn --readonly --json --org continuedev --config continuedev/review-bot -p > inline_review.json # Log the output for debugging echo "Continue CLI output:" From 0153a73d77cad2622abd51cb521e894eb76d8c4b Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 12 Aug 2025 13:21:55 -0700 Subject: [PATCH 087/174] fix: format json --- .github/workflows/continue-inline-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continue-inline-review.yaml b/.github/workflows/continue-inline-review.yaml index a732b77f7..c18ed6092 100644 --- a/.github/workflows/continue-inline-review.yaml +++ b/.github/workflows/continue-inline-review.yaml @@ -117,7 +117,7 @@ jobs: echo "Running Continue CLI for inline review..." # Run the CLI and capture JSON output - cat inline_review_prompt.txt | cn --readonly --json --org continuedev --config continuedev/review-bot -p > inline_review.json + cat inline_review_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review.json # Log the output for debugging echo "Continue CLI output:" From d5860296fbea16c09f1c7b24eb48eebc9cf2280d Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Tue, 12 Aug 2025 13:41:44 -0700 Subject: [PATCH 088/174] feat: add debugging log method to peek first three --- core/nextEdit/NextEditPrefetchQueue.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/core/nextEdit/NextEditPrefetchQueue.ts b/core/nextEdit/NextEditPrefetchQueue.ts index 5cbb7ddc8..5123a841d 100644 --- a/core/nextEdit/NextEditPrefetchQueue.ts +++ b/core/nextEdit/NextEditPrefetchQueue.ts @@ -59,6 +59,11 @@ export class PrefetchQueue { !this.abortController.signal.aborted ) { const location = this.dequeueUnprocessed(); + console.log("processing:"); + console.log( + location?.range.start.line + " to " + location?.range.end.line, + ); + if (!location) break; try { @@ -70,12 +75,20 @@ export class PrefetchQueue { this.usingFullFileDiff, ); - if (!outcome) continue; + if (!outcome) { + console.log("outcome is undefined"); + continue; + } this.enqueueProcessed({ location, outcome, }); + + console.log( + "the length of processed queue after processing is:", + this.processedQueue.length, + ); } catch (error) { if (!this.abortController.signal.aborted) { // Handle error @@ -115,6 +128,16 @@ export class PrefetchQueue { return this.processedQueue[0]; } + peekThreeProcessed(): void { + const count = Math.min(3, this.processedQueue.length); + const firstThree = this.processedQueue.slice(0, count); + firstThree.forEach((item, index) => { + console.log( + `Item ${index + 1}: ${item.location.range.start.line} to ${item.location.range.end.line}`, + ); + }); + } + setPreetchLimit(limit: number): void { this.prefetchLimit = limit; } From e119ae1b6a61c8a060f849b37accae491b24092c Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Tue, 12 Aug 2025 13:43:01 -0700 Subject: [PATCH 089/174] feat: peek for better logs --- .../vscode/src/autocomplete/completionProvider.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index b81111e81..db420924c 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -261,18 +261,15 @@ export class ContinueCompletionProvider let outcome: AutocompleteOutcome | NextEditOutcome | undefined; - // console.log( - // "chain exists?", - // this.nextEditProvider.chainExists(), - // ", length:", - // this.nextEditProvider.getChainLength(), - // ", next regions queue:", - // this.nextEditProvider.getNextEditableRegionsInTheCurrentChainLength(), - // ); + // TODO: We can probably decide here if we want to do the jumping logic. + // If we aren't going to jump anyways, then we should be not be using the prefetch queue or the jump manager. + // It would simplify the logic quite substantially. // Determine why this method was triggered. const isJumping = this.jumpManager.isJumpInProgress(); const chainExists = this.nextEditProvider.chainExists(); + console.log("isJumping:", isJumping, "/ chainExists:", chainExists); + this.prefetchQueue.peekThreeProcessed(); if (isJumping && chainExists) { // Case 2: Jumping (chain exists, jump was taken) @@ -340,7 +337,6 @@ export class ContinueCompletionProvider if (isJumpSuggested) { // Store completion to be rendered after a jump. - // TODO: setCompletionAfterJump must have a 1-1 correspondence to the jump location. this.jumpManager.setCompletionAfterJump({ completionId: completionId, outcome, From db14da1cbe0f0fab2c7e2628ef1ef14ea24c0d25 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Tue, 12 Aug 2025 13:54:35 -0700 Subject: [PATCH 090/174] fix: update test using the latest editDiffHistory --- .../nextEdit/templating/NextEditPromptEngine.vitest.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.vitest.ts b/core/nextEdit/templating/NextEditPromptEngine.vitest.ts index 3df88e9f3..0b90ecda3 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.vitest.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.vitest.ts @@ -54,7 +54,7 @@ describe("NextEditPromptEngine", () => { { filepath: "/path/to/file1.ts", content: "const b = 2;" }, ], currentFileContent: "function test() {\n const a = 1;\n return a;\n}", - editDiffHistory: "diff --git a/file.ts b/file.ts\n@@ -1,3 +1,4 @@", + editDiffHistory: ["diff --git a/file.ts b/file.ts\n@@ -1,3 +1,4 @@"], editableRegionStartLine: 0, editableRegionEndLine: 3, userEdits: "Added constant a", @@ -91,8 +91,9 @@ describe("NextEditPromptEngine", () => { windowEnd: 3, // Math.min(helper.fileLines.length - 1, helper.pos.line + 25) editableRegionStartLine: 0, // Math.max(0, helper.pos.line - 1) within window editableRegionEndLine: 2, // Math.min(helper.pos.line + 5) within window - editDiffHistory: - "diff --git a/file.ts b/file.ts\nindex 123..456 789\n--- a/file.ts\n+++ b/file.ts\n@@ -1,3 +1,4 @@\n function test() {\n+ const a = 1;\n return a;\n }", // unified diff + editDiffHistory: [ + "diff --git a/file.ts b/file.ts\nindex 123..456 789\n--- a/file.ts\n+++ b/file.ts\n@@ -1,3 +1,4 @@\n function test() {\n+ const a = 1;\n return a;\n }", + ], // unified diff currentFilePath: "/path/to/file.ts", languageShorthand: "ts", }; @@ -106,7 +107,6 @@ describe("NextEditPromptEngine", () => { expect(result.prompt.content).toContain("### Context:"); expect(result.prompt.content).toContain("### User Edits:"); expect(result.prompt.content).toContain("### User Excerpts:"); - expect(result.prompt.content).toContain("```ts"); expect(result.userEdits).toBe(instinctCtx.editDiffHistory); expect(result.userExcerpts).toContain(INSTINCT_USER_CURSOR_IS_HERE_TOKEN); @@ -223,7 +223,7 @@ describe("NextEditPromptEngine", () => { { filepath: "/path/to/file1.ts", content: "const b = 2;" }, ], currentFileContent: "function test() {\n const a = 1;\n return a;\n}", - editDiffHistory: "diff --git a/file.ts b/file.ts\n@@ -1,3 +1,4 @@", + editDiffHistory: ["diff --git a/file.ts b/file.ts\n@@ -1,3 +1,4 @@"], editableRegionStartLine: 0, editableRegionEndLine: 3, userEdits: "Added constant a", From 308f685a6ed69811f5465e6d6804b46060e6b6c6 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 17:58:41 -0700 Subject: [PATCH 091/174] docs: clarify apiVersion usage in Azure YAML configuration (#7109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: clarify apiVersion usage in Azure YAML configuration - Add info box explaining apiVersion migration from JSON to YAML - Document env section parameters in YAML reference - Add Azure example showing proper apiVersion usage under env - Include link to complete YAML schema Fixes #7098 πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * docs: add apiVersion to Azure YAML examples - Add apiVersion parameter to chat model example - Add apiVersion parameter to embeddings model example - Shows proper placement under env section πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * remove docs --------- Co-authored-by: Claude --- .../customize/model-providers/top-level/azure.mdx | 15 +++++++-------- docs/reference.mdx | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/customize/model-providers/top-level/azure.mdx b/docs/customize/model-providers/top-level/azure.mdx index c91404df9..722a2fd97 100644 --- a/docs/customize/model-providers/top-level/azure.mdx +++ b/docs/customize/model-providers/top-level/azure.mdx @@ -5,12 +5,6 @@ slug: ../azure Azure AI Foundry is a cloud-based service that provides access to models from OpenAI, Mistral AI, and others, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure AI Foundry resource in the [Azure portal](https://portal.azure.com). - - -For details on OpenAI model setup, see [Azure OpenAI Service configuration](#azure-openai-service-configuration). - - - ## Chat model We recommend configuring **GPT-4o** as your chat model. @@ -27,6 +21,7 @@ We recommend configuring **GPT-4o** as your chat model. env: deployment: apiType: azure-foundry # Or "azure-openai" if using OpenAI models + apiVersion: 2023-07-01-preview # Azure API version ``` @@ -48,10 +43,13 @@ We recommend configuring **GPT-4o** as your chat model. ## Autocomplete model -We recommend configuring **Codestral** as your autocomplete model. +We recommend configuring **Codestral** as your autocomplete model. -**Note:** Azure AI Foundry does not provide the FIM (Fill-in-Middle) endpoint required for autocomplete functionality. To use Codestral for autocomplete, deploy it through **Azure Machine Learning Studio** instead, which provides the necessary `/v1/fim/completions` endpoint. + **Note:** Azure AI Foundry does not provide the FIM (Fill-in-Middle) endpoint + required for autocomplete functionality. To use Codestral for autocomplete, + deploy it through **Azure Machine Learning Studio** instead, which provides + the necessary `/v1/fim/completions` endpoint. If you use Azure Machine Learning Studio to deploy Codestral: @@ -100,6 +98,7 @@ We recommend configuring **text-embedding-3-large** as your embeddings model. env: deployment: apiType: azure + apiVersion: 2023-07-01-preview ``` diff --git a/docs/reference.mdx b/docs/reference.mdx index c96bd7d96..06393cc2d 100644 --- a/docs/reference.mdx +++ b/docs/reference.mdx @@ -175,11 +175,11 @@ The `models` section defines the language models used in your configuration. Mod - `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`. The default value is `[chat, edit, apply, summarize]`. Note that the `summarize` role is not currently used. - - `capabilities`: Array of strings denoting model capabilities, which will overwrite Continue's autodetection based on provider and model. See the [Model Capabilities guide](/customize/deep-dives/model-capabilities) for detailed information. Supported capabilities include: + - `tool_use`: Enables function/tool calling support (required for Agent mode) - `image_input`: Enables image upload and processing support - + Continue automatically detects these capabilities for most models, but you can override this when using custom deployments or if autodetection isn't working correctly. - `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists. From 3606665992bbb9ac1a2fa6eb1d7976f5bad407e6 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Tue, 12 Aug 2025 18:25:01 -0700 Subject: [PATCH 092/174] feat: add more next edit endpoints to protocol (#7110) * feat: add endpoint handlers in core * feat: export interface * feat: update protocol to support more next edit endpoints * feat: add new next edit endpoints to passthrough * feat: support new next edit endpoints to jetbrains --- core/core.ts | 69 ++++++++++++++++++- core/nextEdit/NextEditPrefetchQueue.ts | 2 +- core/protocol/core.ts | 39 ++++++++++- core/protocol/passThrough.ts | 8 +++ .../constants/MessageTypes.kt | 8 +++ 5 files changed, 121 insertions(+), 5 deletions(-) diff --git a/core/core.ts b/core/core.ts index aa558736c..d52a51e05 100644 --- a/core/core.ts +++ b/core/core.ts @@ -76,6 +76,7 @@ import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { OnboardingModes } from "./protocol/core"; import type { IMessenger, Message } from "./protocol/messenger"; import { getUriPathBasename } from "./util/uri"; +import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue"; const hasRulesFiles = (uris: string[]): boolean => { for (const uri of uris) { @@ -578,18 +579,80 @@ export class Core { // Next Edit on("nextEdit/predict", async (msg) => { const outcome = await this.nextEditProvider.provideInlineCompletionItems( - msg.data, + msg.data.input, undefined, - { withChain: false, usingFullFileDiff: true }, + { + withChain: msg.data.options?.withChain ?? false, + usingFullFileDiff: msg.data.options?.usingFullFileDiff ?? true, + }, ); - return outcome ? [outcome.completion, outcome.originalEditableRange] : []; + return outcome; + // ? [outcome.completion, outcome.originalEditableRange] }); on("nextEdit/accept", async (msg) => { + console.log("nextEdit/accept"); this.nextEditProvider.accept(msg.data.completionId); }); on("nextEdit/reject", async (msg) => { + console.log("nextEdit/reject"); this.nextEditProvider.reject(msg.data.completionId); }); + on("nextEdit/startChain", async (msg) => { + console.log("nextEdit/startChain"); + NextEditProvider.getInstance().startChain(); + return; + }); + + on("nextEdit/deleteChain", async (msg) => { + console.log("nextEdit/deleteChain"); + await NextEditProvider.getInstance().deleteChain(); + return; + }); + + on("nextEdit/isChainAlive", async (msg) => { + console.log("nextEdit/isChainAlive"); + return NextEditProvider.getInstance().chainExists(); + }); + + on("nextEdit/queue/getProcessedCount", async (msg) => { + console.log("nextEdit/queue/getProcessedCount"); + const queue = PrefetchQueue.getInstance(); + console.log(queue.processedCount); + return queue.processedCount; + }); + + on("nextEdit/queue/dequeueProcessed", async (msg) => { + console.log("nextEdit/queue/dequeueProcessed"); + const queue = PrefetchQueue.getInstance(); + return queue.dequeueProcessed() || null; + }); + + on("nextEdit/queue/processOne", async (msg) => { + console.log("nextEdit/queue/processOne"); + const { ctx, recentlyVisitedRanges, recentlyEditedRanges } = msg.data; + const queue = PrefetchQueue.getInstance(); + + await queue.process({ + ...ctx, + recentlyVisitedRanges, + recentlyEditedRanges, + }); + return; + }); + + on("nextEdit/queue/clear", async (msg) => { + console.log("nextEdit/queue/clear"); + const queue = PrefetchQueue.getInstance(); + queue.clear(); + return; + }); + + on("nextEdit/queue/abort", async (msg) => { + console.log("nextEdit/queue/abort"); + const queue = PrefetchQueue.getInstance(); + queue.abort(); + return; + }); on("streamDiffLines", async (msg) => { const { config } = await this.configHandler.loadConfig(); diff --git a/core/nextEdit/NextEditPrefetchQueue.ts b/core/nextEdit/NextEditPrefetchQueue.ts index 5123a841d..8e158d0fa 100644 --- a/core/nextEdit/NextEditPrefetchQueue.ts +++ b/core/nextEdit/NextEditPrefetchQueue.ts @@ -2,7 +2,7 @@ import { RangeInFile } from ".."; import { NextEditProvider } from "./NextEditProvider"; import { NextEditOutcome } from "./types"; -interface ProcessedItem { +export interface ProcessedItem { location: RangeInFile; outcome: NextEditOutcome; // Result from the model } diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 258feaaa9..ced0fb546 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -48,6 +48,8 @@ import { ControlPlaneSessionInfo, } from "../control-plane/AuthTypes"; import { FreeTrialStatus } from "../control-plane/client"; +import { NextEditOutcome } from "../nextEdit/types"; +import { ProcessedItem } from "../nextEdit/NextEditPrefetchQueue"; export enum OnboardingModes { API_KEY = "API Key", @@ -153,9 +155,44 @@ export type ToCoreFromIdeOrWebviewProtocol = { "context/indexDocs": [{ reIndex: boolean }, void]; "autocomplete/cancel": [undefined, void]; "autocomplete/accept": [{ completionId: string }, void]; - "nextEdit/predict": [AutocompleteInput, string[]]; + "nextEdit/predict": [ + { + input: AutocompleteInput; + options?: { + withChain?: boolean; + usingFullFileDiff?: boolean; + }; + }, + NextEditOutcome | undefined, + ]; "nextEdit/reject": [{ completionId: string }, void]; "nextEdit/accept": [{ completionId: string }, void]; + "nextEdit/startChain": [undefined, void]; + "nextEdit/deleteChain": [undefined, void]; + "nextEdit/isChainAlive": [undefined, boolean]; + "nextEdit/queue/getProcessedCount": [undefined, number]; + "nextEdit/queue/dequeueProcessed": [undefined, ProcessedItem | null]; + "nextEdit/queue/processOne": [ + { + ctx: { + completionId: string; + manuallyPassFileContents?: string; + manuallyPassPrefix?: string; + selectedCompletionInfo?: { + text: string; + range: Range; + }; + isUntitledFile: boolean; + recentlyVisitedRanges: AutocompleteCodeSnippet[]; + recentlyEditedRanges: RecentlyEditedRange[]; + }; + recentlyVisitedRanges: AutocompleteCodeSnippet[]; + recentlyEditedRanges: RecentlyEditedRange[]; + }, + void, + ]; + "nextEdit/queue/clear": [undefined, void]; + "nextEdit/queue/abort": [undefined, void]; "llm/complete": [ { prompt: string; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 967e0262e..7461e366e 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -40,6 +40,14 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "nextEdit/predict", "nextEdit/reject", "nextEdit/accept", + "nextEdit/startChain", + "nextEdit/deleteChain", + "nextEdit/isChainAlive", + "nextEdit/queue/getProcessedCount", + "nextEdit/queue/dequeueProcessed", + "nextEdit/queue/processOne", + "nextEdit/queue/clear", + "nextEdit/queue/abort", "tts/kill", "llm/complete", "llm/streamChat", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index 1945bf546..e8eb4332f 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -105,6 +105,14 @@ class MessageTypes { "nextEdit/predict", "nextEdit/reject", "nextEdit/accept", + "nextEdit/startChain", + "nextEdit/deleteChain", + "nextEdit/isChainAlive", + "nextEdit/queue/getProcessedCount", + "nextEdit/queue/dequeueProcessed", + "nextEdit/queue/processOne", + "nextEdit/queue/clear", + "nextEdit/queue/abort", "tts/kill", "llm/complete", "llm/streamChat", From c7fdfe497995cda7c43631a369d3d9eb62575c6c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 12 Aug 2025 20:22:43 -0700 Subject: [PATCH 093/174] feat: tool call status icon for search and replace UI (#7112) --- .../StepContainerPreToolbar/index.tsx | 30 ++++++++++ .../StyledMarkdownPreview/index.tsx | 3 + gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 5 ++ .../FunctionSpecificToolCallDiv.tsx | 3 + .../gui/ToolCallDiv/SimpleToolCallUI.tsx | 2 +- .../pages/gui/ToolCallDiv/ToolCallDisplay.tsx | 57 +++++++++---------- gui/src/pages/gui/ToolCallDiv/index.tsx | 14 +++-- 7 files changed, 76 insertions(+), 38 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx index 4679c232c..e97c13061 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx @@ -1,10 +1,13 @@ import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { inferResolvedUriFromRelativePath } from "core/util/ideUtils"; +import { renderContextItems } from "core/util/messageContent"; import { useContext, useEffect, useMemo, useState } from "react"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { useIdeMessengerRequest } from "../../../hooks/useIdeMessengerRequest"; import { useWebviewListener } from "../../../hooks/useWebviewListener"; +import { getStatusIcon } from "../../../pages/gui/ToolCallDiv/utils"; import { useAppSelector } from "../../../redux/hooks"; +import { selectToolCallById } from "../../../redux/selectors/selectToolCalls"; import { selectApplyStateByStreamId, selectApplyStateByToolCallId, @@ -21,6 +24,7 @@ import { InsertButton } from "./InsertButton"; import { RunInTerminalButton } from "./RunInTerminalButton"; export interface StepContainerPreToolbarProps { + showToolCallStatusIcon?: boolean; codeBlockContent: string; language: string | null; relativeFilepath?: string; @@ -37,6 +41,7 @@ export interface StepContainerPreToolbarProps { } export function StepContainerPreToolbar({ + showToolCallStatusIcon, codeBlockContent, language, relativeFilepath, @@ -81,6 +86,30 @@ export function StepContainerPreToolbar({ selectApplyStateByToolCallId(state, forceToolCallId), ); + const toolCallState = useAppSelector((state) => + forceToolCallId ? selectToolCallById(state, forceToolCallId) : undefined, + ); + + const toolCallStatusIcon = + showToolCallStatusIcon && + (toolCallState?.status === "canceled" || + toolCallState?.status === "errored" || + toolCallState?.status === "done") ? ( +
{ + if (toolCallState.output) { + ideMessenger.post("showVirtualFile", { + name: "Edit output", + content: renderContextItems(toolCallState.output), + }); + } + }} + > + {getStatusIcon(toolCallState.status)} +
+ ) : null; + /** * In the case where `relativeFilepath` is defined, this will just be `relativeFilepathUri`. * However, if no `relativeFilepath` is defined, then this will @@ -269,6 +298,7 @@ export function StepContainerPreToolbar({ style={{ fontSize: `${getFontSize() - 2}px` }} >
+ {toolCallStatusIcon} setIsExpanded(!isExpanded)} diff --git a/gui/src/components/StyledMarkdownPreview/index.tsx b/gui/src/components/StyledMarkdownPreview/index.tsx index 5b1249cd8..0ccab5df1 100644 --- a/gui/src/components/StyledMarkdownPreview/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/index.tsx @@ -123,6 +123,7 @@ const StyledMarkdown = styled.div<{ `; interface StyledMarkdownPreviewProps { + showToolCallStatusIcon?: boolean; source?: string; className?: string; isRenderingInStepContainer?: boolean; // Currently only used to control the rendering of codeblocks @@ -300,6 +301,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( return ( +
-
-
-
-
-
- {icon} -
- {tool?.faviconUrl && ( - - )} - -
-
- {!!toolCallState.output && ( - - )} - {!!args.length ? ( - - ) : null} +
+
+
+
+
+ {icon}
+ {tool?.faviconUrl && ( + + )} + +
+
+ {!!toolCallState.output && ( + + )} + {!!args.length ? ( + + ) : null}
- {argsExpanded && !!args.length && ( - - )}
-
{children}
+ {argsExpanded && !!args.length && ( + + )}
- +
{children}
+
); } diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx index ca99d8fdd..12556998e 100644 --- a/gui/src/pages/gui/ToolCallDiv/index.tsx +++ b/gui/src/pages/gui/ToolCallDiv/index.tsx @@ -56,10 +56,12 @@ export function ToolCallDiv({ // But we'd need a nicer place to put the truncate button and the X icon when tool call fails if (functionName === BuiltInToolNames.SearchAndReplaceInFile) { return ( - +
+ +
); } @@ -80,7 +82,7 @@ export function ToolCallDiv({ if (shouldShowGroupedUI) { return ( -
+
( -
+
{renderToolCall(toolCallState)}
)); From 4307010ab104bb800659f09e4abc16d371211a47 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 20:47:09 -0700 Subject: [PATCH 094/174] fix: standardize modelName and add missing modelProvider in dev data schemas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename modelTitle to modelName across all dev data schemas for consistency - Add missing modelProvider field to chatFeedback event schema - Fixes CON-3401 and CON-3400 πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- packages/config-yaml/src/schemas/data/chatFeedback/index.ts | 3 ++- packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts | 3 ++- packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts | 3 ++- packages/config-yaml/src/schemas/data/chatInteraction/index.ts | 2 +- .../config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts | 2 +- packages/config-yaml/src/schemas/data/editInteraction/index.ts | 2 +- .../config-yaml/src/schemas/data/editInteraction/v0.2.0.ts | 2 +- packages/config-yaml/src/schemas/data/editOutcome/index.ts | 2 +- packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts | 2 +- 9 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/config-yaml/src/schemas/data/chatFeedback/index.ts b/packages/config-yaml/src/schemas/data/chatFeedback/index.ts index 095b0af82..e42468a34 100644 --- a/packages/config-yaml/src/schemas/data/chatFeedback/index.ts +++ b/packages/config-yaml/src/schemas/data/chatFeedback/index.ts @@ -2,7 +2,8 @@ import { z } from "zod"; import { baseDevDataAllSchema } from "../base.js"; export const chatFeedbackEventAllSchema = baseDevDataAllSchema.extend({ - modelTitle: z.string(), + modelProvider: z.string(), + modelName: z.string(), completionOptions: z.object({}), prompt: z.string(), completion: z.string(), diff --git a/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts b/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts index c4acddd40..796a2f375 100644 --- a/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts +++ b/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts @@ -1,7 +1,8 @@ import { chatFeedbackEventAllSchema } from "./index.js"; export const chatFeedbackEventSchema_0_1_0 = chatFeedbackEventAllSchema.pick({ - modelTitle: true, + modelProvider: true, + modelName: true, completionOptions: true, prompt: true, completion: true, diff --git a/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts b/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts index fe0580dc5..2ec80fb0e 100644 --- a/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts @@ -12,7 +12,8 @@ export const chatFeedbackEventSchema_0_2_0 = chatFeedbackEventAllSchema.pick({ // other prompt: true, completion: true, - modelTitle: true, + modelProvider: true, + modelName: true, feedback: true, sessionId: true, }); diff --git a/packages/config-yaml/src/schemas/data/chatInteraction/index.ts b/packages/config-yaml/src/schemas/data/chatInteraction/index.ts index 14bb36ba9..b6a68f3e3 100644 --- a/packages/config-yaml/src/schemas/data/chatInteraction/index.ts +++ b/packages/config-yaml/src/schemas/data/chatInteraction/index.ts @@ -3,7 +3,7 @@ import { baseDevDataAllSchema } from "../base.js"; export const chatInteractionEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), - modelTitle: z.string(), + modelName: z.string(), prompt: z.string(), completion: z.string(), sessionId: z.string(), diff --git a/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts b/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts index ce0983a75..54999139a 100644 --- a/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts @@ -13,7 +13,7 @@ export const chatInteractionEventSchema_0_2_0 = // other prompt: true, completion: true, - modelTitle: true, + modelName: true, modelProvider: true, sessionId: true, tools: true, diff --git a/packages/config-yaml/src/schemas/data/editInteraction/index.ts b/packages/config-yaml/src/schemas/data/editInteraction/index.ts index 86613d762..d20ed39aa 100644 --- a/packages/config-yaml/src/schemas/data/editInteraction/index.ts +++ b/packages/config-yaml/src/schemas/data/editInteraction/index.ts @@ -6,7 +6,7 @@ import { baseDevDataAllSchema } from "../base.js"; */ export const editInteractionEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), - modelTitle: z.string(), + modelName: z.string(), prompt: z.string(), completion: z.string(), filepath: z.string(), diff --git a/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts b/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts index ef0b0c952..b96c9c0a1 100644 --- a/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts @@ -13,7 +13,7 @@ export const editInteractionEventSchema_0_2_0 = // other prompt: true, completion: true, - modelTitle: true, + modelName: true, modelProvider: true, filepath: true, }); diff --git a/packages/config-yaml/src/schemas/data/editOutcome/index.ts b/packages/config-yaml/src/schemas/data/editOutcome/index.ts index 32c34632c..15a8cab35 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/index.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/index.ts @@ -3,7 +3,7 @@ import { baseDevDataAllSchema } from "../base.js"; export const editOutcomeEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), - modelTitle: z.string(), + modelName: z.string(), prompt: z.string(), completion: z.string(), previousCode: z.string(), diff --git a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts index acd3be4bd..2050b3482 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts @@ -12,7 +12,7 @@ export const editOutcomeEventSchema_0_2_0 = editOutcomeEventAllSchema.pick({ // other prompt: true, completion: true, - modelTitle: true, + modelName: true, modelProvider: true, accepted: true, previousCode: true, From 217aa2d265322b0428fabed17eec84d09369d77b Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 20:50:15 -0700 Subject: [PATCH 095/174] fix: add missing modelProvider and modelName to nextEditWithHistory event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds missing modelProvider and modelName fields to make the schema consistent with other dev data events. Fixes CON-3402 πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../config-yaml/src/schemas/data/nextEditWithHistory/index.ts | 2 ++ .../config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts b/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts index 16f4a1746..b74f873f5 100644 --- a/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts +++ b/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts @@ -15,4 +15,6 @@ export const nextEditEventAllSchema = baseDevDataAllSchema.extend({ beforeCursorPos: z.object({ line: z.number(), character: z.number() }), afterCursorPos: z.object({ line: z.number(), character: z.number() }), context: z.string(), + modelProvider: z.string(), + modelName: z.string(), }); diff --git a/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts b/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts index ec2e6bb80..4267abd88 100644 --- a/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts @@ -18,6 +18,8 @@ export const nextEditEventSchema_0_2_0 = nextEditEventAllSchema.pick({ beforeCursorPos: true, afterCursorPos: true, context: true, + modelProvider: true, + modelName: true, }); export const nextEditEventSchema_0_2_0_noCode = nextEditEventSchema_0_2_0.omit({ From b8e4e95487e2472b89227546af1a7a893722ae06 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 21:00:51 -0700 Subject: [PATCH 096/174] fix: resolve TypeScript errors after dev data schema changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update test data to use modelName instead of modelTitle in log.vitest.ts - Add missing modelProvider and modelName to nextEditWithHistory event logging Resolves CI failures from schema standardization changes. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- core/data/log.vitest.ts | 2 +- core/nextEdit/context/processNextEditData.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/data/log.vitest.ts b/core/data/log.vitest.ts index f79e05130..44af63358 100644 --- a/core/data/log.vitest.ts +++ b/core/data/log.vitest.ts @@ -34,7 +34,7 @@ const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = { prompt: "Hello, world!", completion: "Hello, world!", modelProvider: "openai", - modelTitle: "gpt-4", + modelName: "gpt-4", sessionId: "1234", tools: ["test-tool1"], }, diff --git a/core/nextEdit/context/processNextEditData.ts b/core/nextEdit/context/processNextEditData.ts index 0cecfe33e..1c3245669 100644 --- a/core/nextEdit/context/processNextEditData.ts +++ b/core/nextEdit/context/processNextEditData.ts @@ -61,6 +61,7 @@ export const processNextEditData = async ({ // undefined; const modelName = "Codestral"; + const modelProvider = "mistral"; const maxPromptTokens = randomNumberBetween(500, 12000); const autocompleteContext = await getAutocompleteContext( @@ -124,6 +125,8 @@ export const processNextEditData = async ({ beforeCursorPos: cursorPosBeforeEdit, afterCursorPos: cursorPosAfterPrevEdit, context: autocompleteContext, + modelProvider, + modelName, }, }); } From 76d2c4035a6e4841e62c3dc3e4be21adae766a8d Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 21:09:01 -0700 Subject: [PATCH 097/174] Update similar-issues.yml --- .github/workflows/similar-issues.yml | 80 ++++++++++++++-------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/.github/workflows/similar-issues.yml b/.github/workflows/similar-issues.yml index 343982af8..9873a0585 100644 --- a/.github/workflows/similar-issues.yml +++ b/.github/workflows/similar-issues.yml @@ -7,6 +7,8 @@ on: jobs: analyze: + # Disabling for now due to bugs + if: false runs-on: ubuntu-latest permissions: issues: write @@ -16,28 +18,28 @@ jobs: - name: Checkout deja-view uses: actions/checkout@v5 with: - repository: 'bdougie/deja-view' + repository: "bdougie/deja-view" # Option 1: Pin to specific commit (most secure) - ref: '45e7696' # Pin to specific commit for stability - + ref: "45e7696" # Pin to specific commit for stability + # Option 2: Use a tag (recommended after creating releases) # ref: 'v1.0.0' - + # Option 3: Use main branch (least secure, gets latest changes) # ref: 'main' - + path: deja-view - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: "3.11" - name: Install dependencies run: | cd deja-view pip install -r requirements.txt - + - name: Index repository if needed env: CHROMA_API_KEY: ${{ secrets.CHROMA_CLOUD_API_KEY }} @@ -46,10 +48,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd deja-view - + # Index the repository (this will update existing index) python cli.py index "${{ github.repository }}" --max-issues 200 || true - + - name: Search for similar issues id: search env: @@ -59,7 +61,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd deja-view - + # Determine if this is an issue or PR if [ "${{ github.event_name }}" = "pull_request" ]; then ISSUE_URL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}" @@ -70,26 +72,26 @@ jobs: THRESHOLD="0.7" TOP_K="5" fi - + # Create a Python script to search and format as JSON cat << 'PYTHON_SCRIPT' > search_similar.py import sys import json import os from github_similarity_service import SimilarityService - + issue_url = sys.argv[1] threshold = float(sys.argv[2]) top_k = int(sys.argv[3]) - + # Parse issue number from URL issue_number = int(issue_url.split('/')[-1]) repo_parts = issue_url.split('/') owner = repo_parts[3] repo = repo_parts[4] - + service = SimilarityService() - + # Find similar issues similar = service.find_similar_issues( owner=owner, @@ -98,26 +100,26 @@ jobs: top_k=top_k, min_similarity=threshold ) - + # Format as JSON print(json.dumps(similar)) PYTHON_SCRIPT - + # Search for similar issues SIMILAR_ISSUES=$(python search_similar.py "$ISSUE_URL" "$THRESHOLD" "$TOP_K") - + # Save to output echo "similar_issues<> $GITHUB_OUTPUT echo "$SIMILAR_ISSUES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - + # Check if any similar issues found if [ "$(echo "$SIMILAR_ISSUES" | jq '. | length')" -gt 0 ]; then echo "has_similar=true" >> $GITHUB_OUTPUT else echo "has_similar=false" >> $GITHUB_OUTPUT fi - + - name: Check if issue should be a discussion id: discussion_check if: github.event_name == 'issues' @@ -128,19 +130,19 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd deja-view - + # Create a Python script to analyze the issue cat << 'PYTHON_SCRIPT' > check_discussion.py import os import json import re from github_similarity_service import SimilarityService - + # Get issue details from environment issue_title = os.environ.get('ISSUE_TITLE', '') issue_body = os.environ.get('ISSUE_BODY', '') issue_labels = json.loads(os.environ.get('ISSUE_LABELS', '[]')) - + # Mock Issue object for analysis class MockIssue: def __init__(self): @@ -152,41 +154,41 @@ jobs: self.created_at = '' self.updated_at = '' self.url = '' - + service = SimilarityService() issue = MockIssue() - + score, reasons = service._calculate_discussion_score(issue) - + result = { 'score': score, 'reasons': reasons, 'should_be_discussion': score >= 0.5, 'confidence': 'high' if score >= 0.7 else 'medium' if score >= 0.5 else 'low' } - + print(json.dumps(result)) PYTHON_SCRIPT - + # Run the analysis DISCUSSION_ANALYSIS=$(ISSUE_TITLE="${{ github.event.issue.title }}" \ ISSUE_BODY='${{ github.event.issue.body }}' \ ISSUE_LABELS='${{ toJson(github.event.issue.labels.*.name) }}' \ ISSUE_NUMBER="${{ github.event.issue.number }}" \ python check_discussion.py) - + echo "analysis<> $GITHUB_OUTPUT echo "$DISCUSSION_ANALYSIS" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - + # Extract whether it should be a discussion SHOULD_BE_DISCUSSION=$(echo "$DISCUSSION_ANALYSIS" | jq -r '.should_be_discussion') echo "should_be_discussion=$SHOULD_BE_DISCUSSION" >> $GITHUB_OUTPUT - + # Extract confidence level CONFIDENCE=$(echo "$DISCUSSION_ANALYSIS" | jq -r '.confidence') echo "confidence=$CONFIDENCE" >> $GITHUB_OUTPUT - + - name: Comment with analysis uses: actions/github-script@v7 with: @@ -195,7 +197,7 @@ jobs: const hasSimilar = '${{ steps.search.outputs.has_similar }}' === 'true'; const isPR = '${{ github.event_name }}' === 'pull_request'; const shouldBeDiscussion = !isPR && '${{ steps.discussion_check.outputs.should_be_discussion }}' === 'true'; - + // Add similar issues section if found if (hasSimilar) { const similarIssues = JSON.parse(`${{ steps.search.outputs.similar_issues }}`); @@ -243,7 +245,7 @@ jobs: comment += '\n'; } } - + // Add discussion suggestion if applicable if (shouldBeDiscussion) { const analysis = JSON.parse(`${{ steps.discussion_check.outputs.analysis }}`); @@ -280,7 +282,7 @@ jobs: comment += '_Consider converting this to a discussion if it\'s not a bug report or actionable task._\n'; } - + // Only comment if we have something to say if (comment) { comment += '\n---\n'; @@ -302,14 +304,14 @@ jobs: }); } } - + - name: Add labels if: github.event_name == 'issues' uses: actions/github-script@v7 with: script: | const labels = []; - + // Check for duplicate if ('${{ steps.search.outputs.has_similar }}' === 'true') { const similarIssues = JSON.parse(`${{ steps.search.outputs.similar_issues }}`); @@ -319,7 +321,7 @@ jobs: labels.push('potential-duplicate'); } } - + // Check for discussion suggestion if ('${{ steps.discussion_check.outputs.should_be_discussion }}' === 'true') { const confidence = '${{ steps.discussion_check.outputs.confidence }}'; @@ -330,7 +332,7 @@ jobs: labels.push('discussion'); } } - + // Add labels if any if (labels.length > 0) { await github.rest.issues.addLabels({ From ca3c8f288ce25916a8faf534e96c4f7568e34725 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 21:13:26 -0700 Subject: [PATCH 098/174] fix: resolve GUI TypeScript errors after dev data schema changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update FeedbackButtons to transform modelTitle to modelName and add modelProvider - Update streamNormalInput to use modelName instead of modelTitle - Update editOutcomeLogger to use modelName throughout function signatures and return values All dev data logs now consistently use modelName as required by CON-3401. Resolves remaining CI failures from schema standardization changes. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- gui/src/components/FeedbackButtons.tsx | 5 ++++- gui/src/redux/thunks/streamNormalInput.ts | 2 +- gui/src/util/editOutcomeLogger.ts | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gui/src/components/FeedbackButtons.tsx b/gui/src/components/FeedbackButtons.tsx index 009666859..4d1284d9a 100644 --- a/gui/src/components/FeedbackButtons.tsx +++ b/gui/src/components/FeedbackButtons.tsx @@ -21,10 +21,13 @@ export function FeedbackButtons({ item }: FeedbackButtonsProps) { setFeedback(feedback); if (item.promptLogs?.length) { for (const promptLog of item.promptLogs) { + const { modelTitle, ...logData } = promptLog; ideMessenger.post("devdata/log", { name: "chatFeedback", data: { - ...promptLog, + ...logData, + modelProvider: "unknown", + modelName: modelTitle, feedback, sessionId, }, diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index e2f645858..26a02f846 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -274,7 +274,7 @@ export const streamNormalInput = createAsyncThunk< prompt: next.value.prompt, completion: next.value.completion, modelProvider: selectedChatModel.underlyingProviderName, - modelTitle: selectedChatModel.title, + modelName: selectedChatModel.title, sessionId: state.session.id, ...(!!activeTools.length && { tools: activeTools.map((tool) => tool.function.name), diff --git a/gui/src/util/editOutcomeLogger.ts b/gui/src/util/editOutcomeLogger.ts index 3c1c75935..ef7883353 100644 --- a/gui/src/util/editOutcomeLogger.ts +++ b/gui/src/util/editOutcomeLogger.ts @@ -7,7 +7,7 @@ import { store } from "../redux/store"; */ function extractModelInfo(toolCallState: ToolCallState): { modelProvider: string; - modelTitle: string; + modelName: string; } { // Get the conversation history to find the model info const history = store.getState().session.history; @@ -28,7 +28,7 @@ function extractModelInfo(toolCallState: ToolCallState): { const modelParts = String(assistantMessage.message.model).split("::"); return { modelProvider: modelParts[0] || "unknown", - modelTitle: modelParts[1] || String(assistantMessage.message.model), + modelName: modelParts[1] || String(assistantMessage.message.model), }; } @@ -38,7 +38,7 @@ function extractModelInfo(toolCallState: ToolCallState): { return { modelProvider: chatModel?.provider || "unknown", - modelTitle: chatModel?.model || "unknown", + modelName: chatModel?.model || "unknown", }; } @@ -153,7 +153,7 @@ export function assembleEditOutcomeData( streamId: applyState.streamId, timestamp: new Date().toISOString(), modelProvider: modelInfo.modelProvider, - modelTitle: modelInfo.modelTitle, + modelName: modelInfo.modelName, prompt: promptAndCompletion.prompt, completion: promptAndCompletion.completion, previousCode: codeChanges.previousCode, From 4d328f9e390e95a8111b71260aa46b7180ff3c4e Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 21:21:45 -0700 Subject: [PATCH 099/174] Update streamResponse.test.ts --- gui/src/redux/thunks/streamResponse.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/redux/thunks/streamResponse.test.ts b/gui/src/redux/thunks/streamResponse.test.ts index 401c12e7d..f0c29c835 100644 --- a/gui/src/redux/thunks/streamResponse.test.ts +++ b/gui/src/redux/thunks/streamResponse.test.ts @@ -461,7 +461,7 @@ describe("streamResponseThunk", () => { prompt: "Hello", completion: "Hi there!", modelProvider: "anthropic", - modelTitle: "Claude 3.5 Sonnet", + modelName: "Claude 3.5 Sonnet", sessionId: "session-123", }, }); From 1d9a711b4cb6c5bd952809655504e767dc48bdd9 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 12 Aug 2025 21:26:08 -0700 Subject: [PATCH 100/174] fix: standardize modelTitle to modelName in VS Code extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete the dev data schema standardization by fixing remaining references to modelTitle in the VS Code extension: - VsCodeMessenger.ts: Update editInteraction logging to use modelName - vertical/manager.ts: Update edit tracking to use modelName - EditOutcomeTracker.ts: Update interface and logging to use modelName - QuickEditQuickPick.ts: Fix misleading variable name for consistency All dev data schemas now consistently use modelName instead of modelTitle across the entire codebase. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- extensions/vscode/src/diff/vertical/manager.ts | 2 +- extensions/vscode/src/extension/EditOutcomeTracker.ts | 4 ++-- extensions/vscode/src/extension/VsCodeMessenger.ts | 2 +- extensions/vscode/src/quickEdit/QuickEditQuickPick.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index efa4725da..7d832b596 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -536,7 +536,7 @@ export class VerticalDiffManager { streamId: EDIT_MODE_STREAM_ID, timestamp: new Date().toISOString(), modelProvider: model.underlyingProviderName, - modelTitle: model.title ?? "", + modelName: model.title ?? "", prompt: stripImages(prompt), completion: newCode, previousCode, diff --git a/extensions/vscode/src/extension/EditOutcomeTracker.ts b/extensions/vscode/src/extension/EditOutcomeTracker.ts index 69ac452fa..1b793d73b 100644 --- a/extensions/vscode/src/extension/EditOutcomeTracker.ts +++ b/extensions/vscode/src/extension/EditOutcomeTracker.ts @@ -6,7 +6,7 @@ export interface PendingEditData { streamId: string; timestamp: string; modelProvider: string; - modelTitle: string; + modelName: string; prompt: string; completion: string; previousCode: string; @@ -56,7 +56,7 @@ class EditOutcomeTracker { name: "editOutcome", data: { modelProvider: pendingEdit.modelProvider, - modelTitle: pendingEdit.modelTitle, + modelName: pendingEdit.modelName, prompt: pendingEdit.prompt, completion: pendingEdit.completion, previousCode: pendingEdit.previousCode, diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 2ecd1c205..488b1f55a 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -240,7 +240,7 @@ export class VsCodeMessenger { prompt: stripImages(prompt), completion: fileAfterEdit ?? "", modelProvider: model.underlyingProviderName, - modelTitle: model.title ?? "", + modelName: model.title ?? "", filepath: msg.data.range.filepath, }, }); diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 30af51cd1..c3a02beb7 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -352,9 +352,9 @@ export class QuickEdit { label: QuickEditInitialItemLabels | undefined; value: string | undefined; }> { - const modelTitle = await this.getCurModel(); + const model = await this.getCurModel(); - if (!modelTitle) { + if (!model) { this.ide.showToast("error", "Please configure a model to use Quick Edit"); return { label: undefined, value: undefined }; } From 8b38340e56bea7e508d0c256ff5a97198f060929 Mon Sep 17 00:00:00 2001 From: 44cort44 <122188075+44cort44@users.noreply.github.com> Date: Tue, 12 Aug 2025 23:27:57 -0500 Subject: [PATCH 101/174] Update reranking.mdx the yaml doesn't validate without model specified. based on the source code for this provider the default is supposed to be tei anyway, so calling it out here just so the yaml has valid syntax --- docs/customize/model-roles/reranking.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/customize/model-roles/reranking.mdx b/docs/customize/model-roles/reranking.mdx index 101550f18..52f1524a0 100644 --- a/docs/customize/model-roles/reranking.mdx +++ b/docs/customize/model-roles/reranking.mdx @@ -131,6 +131,7 @@ The `"modelTitle"` field must match one of the models in your "models" array in models: - name: Huggingface-tei Reranker provider: huggingface-tei + model: tei apiBase: http://localhost:8080 apiKey: roles: From e03a0b25f90838d2e80425936eae7b8c5cec12ca Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:05:14 +0530 Subject: [PATCH 102/174] style: remove space between terminal command and output --- .../pages/gui/ToolCallDiv/RunTerminalCommand.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx b/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx index 2ff0adf9a..14485a56f 100644 --- a/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx +++ b/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx @@ -117,17 +117,11 @@ export function RunTerminalCommand(props: RunTerminalCommandToolCallProps) { - {processedTerminalContent.limitedContent} -
- } - expandedContent={ -
- {processedTerminalContent.fullContent} -
+ {processedTerminalContent.limitedContent} } + expandedContent={{processedTerminalContent.fullContent}} /> )} @@ -142,7 +136,7 @@ export function RunTerminalCommand(props: RunTerminalCommandToolCallProps) { onClick={(e) => { e.preventDefault(); // Dispatch the action to move the command to the background - dispatch( + void dispatch( moveTerminalProcessToBackground({ toolCallId: props.toolCallId as string, }), From d2645f9e5f50d1f0f68a12c90b554adcb63d74b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:05:02 +0000 Subject: [PATCH 103/174] chore(deps): bump actions/checkout from 4 to 5 Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/continue-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-review.yaml index 95a9c48ea..3ca4ffab4 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-review.yaml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 # Fetch full history for better context From 29f9e8588da51544d731c0d96a2f507a92f6e7d2 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 11:04:48 -0700 Subject: [PATCH 104/174] update front page of docs --- docs/home.mdx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/home.mdx b/docs/home.mdx index 7e2dcc7cb..d5d4416d6 100644 --- a/docs/home.mdx +++ b/docs/home.mdx @@ -2,9 +2,16 @@ title: "Introduction" --- -**Continue enables developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)** +**Continue enables developers to ship faster with Continuous AI.** -- [Chat](/features/chat/quick-start) to understand and iterate on code in the sidebar -- [Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type -- [Edit](/features/edit/quick-start) to modify code without leaving your current file +**You can use Continue to build and run custom agents across your IDE, terminal, and CI.** + +1. Get started with Continue in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions: - [Agent](/features/agent/quick-start) to make more substantial changes to your codebase +- [Chat](/features/chat/quick-start) to understand and iterate on code in the sidebar +- [Edit](/features/edit/quick-start) to modify code without leaving your current file +- [Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type + +2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback. + +3. Discover the models, rules, and MCP tools you need to create a custom AI coding agent on [Continue Hub](https://hub.continue.dev/) From 6226f175835e49ee2f17a5ebf83d427e31d68eac Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 11:07:50 -0700 Subject: [PATCH 105/174] remove period --- docs/home.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/home.mdx b/docs/home.mdx index d5d4416d6..d9f81befd 100644 --- a/docs/home.mdx +++ b/docs/home.mdx @@ -12,6 +12,6 @@ title: "Introduction" - [Edit](/features/edit/quick-start) to modify code without leaving your current file - [Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type -2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback. +2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback 3. Discover the models, rules, and MCP tools you need to create a custom AI coding agent on [Continue Hub](https://hub.continue.dev/) From 0f15e036f0539f325bdd6b976826f5ba5e76d9a1 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 11:20:35 -0700 Subject: [PATCH 106/174] better agent / chat distinction --- docs/home.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/home.mdx b/docs/home.mdx index d9f81befd..a24548999 100644 --- a/docs/home.mdx +++ b/docs/home.mdx @@ -7,9 +7,9 @@ title: "Introduction" **You can use Continue to build and run custom agents across your IDE, terminal, and CI.** 1. Get started with Continue in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions: -- [Agent](/features/agent/quick-start) to make more substantial changes to your codebase -- [Chat](/features/chat/quick-start) to understand and iterate on code in the sidebar -- [Edit](/features/edit/quick-start) to modify code without leaving your current file +- [Agent](/features/agent/quick-start) to work on development tasks together with AI +- [Chat](/features/chat/quick-start) to ask general questions and clarify code sections +- [Edit](/features/edit/quick-start) to modify code section without leaving your current file - [Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type 2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback From 7f335007e46acf52d13eff2b6ed98e1f3ecf2f4e Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 11:25:10 -0700 Subject: [PATCH 107/174] improv: use hardcoded version of the cli --- .github/workflows/continue-inline-review.yaml | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/continue-inline-review.yaml b/.github/workflows/continue-inline-review.yaml index c18ed6092..470f70866 100644 --- a/.github/workflows/continue-inline-review.yaml +++ b/.github/workflows/continue-inline-review.yaml @@ -43,7 +43,7 @@ jobs: node-version: 20 - name: Install Continue CLI - run: npm install -g @continuedev/cli@latest + run: npm install -g @continuedev/cli@1.4.25 - name: Build Inline Review Prompt run: | @@ -54,29 +54,29 @@ jobs: # For issue_comment event on a PR PR_NUMBER="${{ github.event.issue.number }}" fi - + # Get PR files with line numbers gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files > pr_files.json - + # Get PR diff with context gh pr diff $PR_NUMBER --color=never > pr_diff.txt - + # Create review prompt for inline comments cat > inline_review_prompt.txt << 'EOF' You are conducting a detailed inline code review for a pull request. - + Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. - + Below is the PR diff: - + EOF - + cat pr_diff.txt >> inline_review_prompt.txt - + cat >> inline_review_prompt.txt << 'EOF' - + Please analyze these changes and provide inline review comments in the following JSON format: - + { "review_summary": "Overall assessment of the PR", "comments": [ @@ -88,13 +88,13 @@ jobs: } ] } - + Focus on: 1. **Critical Issues**: Security vulnerabilities, bugs that will break functionality 2. **High Priority**: Performance problems, incorrect logic, missing error handling 3. **Medium Priority**: Code style violations, potential edge cases, unclear code 4. **Low Priority**: Suggestions for improvement, refactoring opportunities - + Guidelines for comments: - Be specific and actionable - Reference the exact line number from the diff @@ -102,7 +102,7 @@ jobs: - Suggest concrete improvements when pointing out issues - Only comment on actual problems or important improvements - Use "RIGHT" for new/modified lines, "LEFT" for context about removed lines - + Important: - Output ONLY valid JSON, no additional text - Ensure line numbers match the actual diff @@ -115,14 +115,14 @@ jobs: - name: Run Continue CLI Inline Review run: | echo "Running Continue CLI for inline review..." - + # Run the CLI and capture JSON output cat inline_review_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review.json - + # Log the output for debugging echo "Continue CLI output:" cat inline_review.json - + # Validate JSON output if ! jq empty inline_review.json 2>/dev/null; then echo "Invalid JSON output from Continue CLI" @@ -136,7 +136,7 @@ jobs: with: script: | const fs = require('fs'); - + try { // Read the review output let reviewData; @@ -240,4 +240,4 @@ jobs: inline_review_prompt.txt pr_files.json pr_diff.txt - retention-days: 7 \ No newline at end of file + retention-days: 7 From 39413d8903805e2dcea0619bef65168a95940715 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 11:29:50 -0700 Subject: [PATCH 108/174] change readme to continuous ai --- README.md | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 580dbf2a3..1e4915ca8 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,6 @@
-**[Continue](https://docs.continue.dev) enables developers to create, share, and use custom AI code assistants with our -open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) -and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions -and [hub of models, rules, and MCP tools](https://hub.continue.dev)** - -
- -
- @@ -32,38 +23,42 @@ and [hub of models, rules, and MCP tools](https://hub.continue.dev)**

+
+ +**Ship faster with Continuous AI** + +**Build and run custom agents across your IDE, terminal, and CI** + +
+ +Get started in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue), [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension), or [CLI](https://docs.continue.dev/guides/cli) + ## Agent -[Agent](https://continue.dev/docs/agent/how-to-use-it) enables you to make more substantial changes to your codebase +[Agent](/features/agent/quick-start) to work on development tasks together with AI ![agent](docs/images/agent.gif) ## Chat -[Chat](https://continue.dev/docs/chat/how-to-use-it) makes it easy to ask for help from an LLM without needing to leave -the IDE +[Chat](/features/chat/quick-start) to ask general questions and clarify code sections ![chat](docs/images/chat.gif) ## Edit -[Edit](https://continue.dev/docs/edit/how-to-use-it) is a convenient way to modify code without leaving your current -file +[Edit](/features/edit/quick-start) to modify code section without leaving your current file ![edit](docs/images/edit.gif) ## Autocomplete -[Autocomplete](https://continue.dev/docs/autocomplete/how-to-use-it) provides inline code suggestions as you type +[Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type ![autocomplete](docs/images/autocomplete.gif)
-## Getting Started - -Learn about how to install and use Continue in the docs [here](https://continue.dev/docs/getting-started/install) - ## Contributing Read the [contributing guide](https://github.com/continuedev/continue/blob/main/CONTRIBUTING.md), and From d4990ac70c90ce8f3a1ff25380ec0934a5b2c823 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 13:31:24 -0700 Subject: [PATCH 109/174] docs: update the real front page of the docs --- docs/index.mdx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/index.mdx b/docs/index.mdx index af5107f5a..b38c881aa 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -7,7 +7,15 @@ icon: book-open -**Continue enables developers to create, share, and use custom AI code assistants with our open-source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)** +**Continue enables developers to ship faster with Continuous AI.** + +**You can use Continue to build and run custom agents across your IDE, terminal, and CI.** + +1. Get started with Continue in [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions + +2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback + +3. Discover the models, rules, and MCP tools you need to create a custom AI coding agent on [Continue Hub](https://hub.continue.dev/) Date: Wed, 13 Aug 2025 13:48:38 -0700 Subject: [PATCH 110/174] improv: naming --- .github/pull_request_template.md | 2 +- ...nue-inline-review.yaml => continue-detailed-review.yaml} | 6 +++--- .../{continue-review.yaml => continue-general-review.yaml} | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename .github/workflows/{continue-inline-review.yaml => continue-detailed-review.yaml} (97%) rename .github/workflows/{continue-review.yaml => continue-general-review.yaml} (97%) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 281f61c1f..d8b354440 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,7 +5,7 @@ ## AI Code Review - **Team members only**: AI review runs automatically when PR is opened or marked ready for review -- Team members can also trigger a review by commenting `@continue-review` +- Team members can also trigger a review by commenting `@continue-general-review` or `@continue-detailed-review` ## Checklist diff --git a/.github/workflows/continue-inline-review.yaml b/.github/workflows/continue-detailed-review.yaml similarity index 97% rename from .github/workflows/continue-inline-review.yaml rename to .github/workflows/continue-detailed-review.yaml index 470f70866..a28b03eac 100644 --- a/.github/workflows/continue-inline-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -1,4 +1,4 @@ -name: Continue CLI Inline Code Review +name: Continue Detailed Review on: pull_request: @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 # Only run if: # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-inline-review on a PR from a team member + # - OR it's a comment with @continue-detailed-review on a PR from a team member if: > (github.event_name == 'pull_request' && (github.event.pull_request.author_association == 'OWNER' || @@ -26,7 +26,7 @@ jobs: github.event.pull_request.author_association == 'COLLABORATOR')) || (github.event_name == 'issue_comment' && github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-inline-review') && + contains(github.event.comment.body, '@continue-detailed-review') && (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) diff --git a/.github/workflows/continue-review.yaml b/.github/workflows/continue-general-review.yaml similarity index 97% rename from .github/workflows/continue-review.yaml rename to .github/workflows/continue-general-review.yaml index 3ca4ffab4..d714c8574 100644 --- a/.github/workflows/continue-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -1,4 +1,4 @@ -name: Continue CLI Code Review +name: Continue General Review on: pull_request: @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 # Only run if: # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-review on a PR from a team member + # - OR it's a comment with @continue-general-review on a PR from a team member if: | (github.event_name == 'pull_request' && (github.event.pull_request.author_association == 'OWNER' || @@ -26,7 +26,7 @@ jobs: github.event.pull_request.author_association == 'COLLABORATOR')) || (github.event_name == 'issue_comment' && github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-review') && + contains(github.event.comment.body, '@continue-general-review') && (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) From dd8931e19ce985c4b7c168f58f63884f6c5b3b46 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 13:53:58 -0700 Subject: [PATCH 111/174] adding jetbrains + vscode changes --- README.md | 2 +- docs/index.mdx | 35 +++++++++++++------------- extensions/intellij/README.md | 46 ++++++++++++++++++----------------- extensions/vscode/README.md | 32 ++++++++++++------------ 4 files changed, 59 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 1e4915ca8..ab1a56899 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Get started in [VS Code](https://marketplace.visualstudio.com/items?itemName=Con ## Edit -[Edit](/features/edit/quick-start) to modify code section without leaving your current file +[Edit](/features/edit/quick-start) to modify a code section without leaving your current file ![edit](docs/images/edit.gif) diff --git a/docs/index.mdx b/docs/index.mdx index b38c881aa..67699df74 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -18,13 +18,29 @@ icon: book-open 3. Discover the models, rules, and MCP tools you need to create a custom AI coding agent on [Continue Hub](https://hub.continue.dev/) + + to work on development tasks together with AI + - to understand and iterate on code in the sidebar + to ask general questions and clarify code sections + + + to modify a code section without leaving your current file to receive inline code suggestions as you type - - to modify code without leaving your current file - - - to make more substantial changes to your codebase - + diff --git a/extensions/intellij/README.md b/extensions/intellij/README.md index ae56a541c..20a8adaf8 100644 --- a/extensions/intellij/README.md +++ b/extensions/intellij/README.md @@ -4,35 +4,37 @@
-[**Continue**](https://docs.continue.dev) enables developers to create, share, and use custom AI code assistants with our open-source [JetBrains extension](https://plugins.jetbrains.com/plugin/22707-continue-extension) and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev). + + + + + + + + + -
+

-
+**Ship faster with Continuous AI** -## Chat - -[Chat](https://continue.dev/docs/chat/how-to-use-it) makes it easy to ask for help from an LLM without needing to leave the IDE. - -You send it a task, including any relevant information, and it replies with the text / code most likely to complete the task. If it does not give you what you want, then you can send follow up messages to clarify and adjust its approach until the task is completed. - -## Autocomplete - -[Autocomplete](https://continue.dev/docs/autocomplete/how-to-use-it) provides inline code suggestions as you type. - -To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings. - -## Edit - -[Edit](https://continue.dev/docs/edit/how-to-use-it) is a convenient way to modify code without leaving your current file. - -Highlight a block of code, describe your code changes, and a diff will be streamed inline to your file which you can accept or reject. +**Build and run custom agents across your IDE, terminal, and CI** ## Agent -[Agent](https://continue.dev/docs/agent/how-to-use-it) enables you to make more substantial changes to your codebase +[Agent](/features/agent/quick-start) to work on development tasks together with AI -Agent equips the Chat model with the tools needed to handle a wide range of coding tasks, allowing the model to make decisions and save you the work of manually finding context and performing actions. +## Chat + +[Chat](/features/chat/quick-start) to ask general questions and clarify code sections + +## Edit + +[Edit](/features/edit/quick-start) to modify a code section without leaving your current file + +## Autocomplete + +[Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type
diff --git a/extensions/vscode/README.md b/extensions/vscode/README.md index 585f7caf9..dc9c211c2 100644 --- a/extensions/vscode/README.md +++ b/extensions/vscode/README.md @@ -2,16 +2,6 @@ ![Continue logo](media/readme.png) -
- -

Continue

- -
- -**[Continue](https://docs.continue.dev) enables developers to create, share, and use custom AI code assistants with our open-source [VS Code extension](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)** - -
- + +

Continue

+ +
+ +**Ship faster with Continuous AI** + +**Build and run custom agents across your IDE, terminal, and CI** + +
+ ## Agent -[Agent](https://continue.dev/docs/agent/how-to-use-it) enables you to make more substantial changes to your codebase +[Agent](/features/agent/quick-start) to work on development tasks together with AI ![agent](docs/images/agent.gif) ## Chat -[Chat](https://continue.dev/docs/chat/how-to-use-it) makes it easy to ask for help from an LLM without needing to leave -the IDE +[Chat](/features/chat/quick-start) to ask general questions and clarify code sections ![chat](docs/images/chat.gif) ## Edit -[Edit](https://continue.dev/docs/edit/how-to-use-it) is a convenient way to modify code without leaving your current -file +[Edit](/features/edit/quick-start) to modify a code section without leaving your current file ![edit](docs/images/edit.gif) ## Autocomplete -[Autocomplete](https://continue.dev/docs/autocomplete/how-to-use-it) provides inline code suggestions as you type +[Autocomplete](/features/autocomplete/quick-start) to receive inline code suggestions as you type ![autocomplete](docs/images/autocomplete.gif) From 1a91a2d4a3de21d48f155f07f24a1f62b0993f53 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 14:04:07 -0700 Subject: [PATCH 112/174] improv: comment handling --- .../workflows/continue-detailed-review.yaml | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index a28b03eac..279b75b97 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -82,8 +82,7 @@ jobs: "comments": [ { "path": "path/to/file.js", - "line": 42, - "side": "RIGHT", + "position": 42, "body": "Brief, specific comment about this line or section" } ] @@ -97,15 +96,14 @@ jobs: Guidelines for comments: - Be specific and actionable - - Reference the exact line number from the diff + - Reference the exact position in the diff (position is the line number in the diff, not the file) - Keep comments concise but informative - Suggest concrete improvements when pointing out issues - Only comment on actual problems or important improvements - - Use "RIGHT" for new/modified lines, "LEFT" for context about removed lines Important: - Output ONLY valid JSON, no additional text - - Ensure line numbers match the actual diff + - Position numbers should correspond to lines in the diff output (starting from 1) - Comment on the most important issues first - Limit to maximum 20 most relevant comments EOF @@ -168,13 +166,19 @@ jobs: const commitSha = pr.head.sha; - // Prepare review comments - const comments = reviewData.comments?.map(comment => ({ + // Prepare review comments - filter out comments without valid positions + const allComments = reviewData.comments || []; + const validComments = allComments.filter(comment => comment.position && comment.path && comment.body); + + if (validComments.length < allComments.length) { + console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing position, path, or body`); + } + + const comments = validComments.map(comment => ({ path: comment.path, - line: comment.line || 1, - side: comment.side || 'RIGHT', + position: comment.position, body: comment.body - })) || []; + })); // Create the review if (comments.length > 0) { From ae723c23485aad5dbfc51c554e2bcc8f489aed57 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 14:12:20 -0700 Subject: [PATCH 113/174] fix: naming --- .github/workflows/continue-detailed-review.yaml | 4 ++-- .github/workflows/continue-general-review.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 279b75b97..266565bfa 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -12,8 +12,8 @@ permissions: issues: write jobs: - inline-code-review: - name: AI Inline Code Review + detailed-code-review: + name: Continue Detailed Review runs-on: ubuntu-latest timeout-minutes: 10 # Only run if: diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index d714c8574..54f8a84b6 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -12,8 +12,8 @@ permissions: issues: write jobs: - code-review: - name: AI Code Review + general-code-review: + name: Continue General Review runs-on: ubuntu-latest timeout-minutes: 10 # Only run if: From 7fcc42a4730a15efa33b7e337c386035f76b7248 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 14:20:31 -0700 Subject: [PATCH 114/174] fix: use line numbers --- .github/workflows/continue-detailed-review.yaml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 266565bfa..c8b24e5f3 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -82,7 +82,8 @@ jobs: "comments": [ { "path": "path/to/file.js", - "position": 42, + "line": 42, + "side": "RIGHT", "body": "Brief, specific comment about this line or section" } ] @@ -96,14 +97,15 @@ jobs: Guidelines for comments: - Be specific and actionable - - Reference the exact position in the diff (position is the line number in the diff, not the file) + - Reference the exact line number from the file - Keep comments concise but informative - Suggest concrete improvements when pointing out issues - Only comment on actual problems or important improvements + - Use "RIGHT" for new/modified lines, "LEFT" for context about removed lines Important: - Output ONLY valid JSON, no additional text - - Position numbers should correspond to lines in the diff output (starting from 1) + - Line numbers should match the actual line numbers in the files - Comment on the most important issues first - Limit to maximum 20 most relevant comments EOF @@ -166,17 +168,18 @@ jobs: const commitSha = pr.head.sha; - // Prepare review comments - filter out comments without valid positions + // Prepare review comments - filter out comments without required fields const allComments = reviewData.comments || []; - const validComments = allComments.filter(comment => comment.position && comment.path && comment.body); + const validComments = allComments.filter(comment => comment.line && comment.path && comment.body && comment.side); if (validComments.length < allComments.length) { - console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing position, path, or body`); + console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing line, path, body, or side`); } const comments = validComments.map(comment => ({ path: comment.path, - position: comment.position, + line: comment.line, + side: comment.side, body: comment.body })); From 628da4605367f87c17e125ef373e0532c52b63c0 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Wed, 13 Aug 2025 14:23:10 -0700 Subject: [PATCH 115/174] shorten hub description --- docs/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.mdx b/docs/index.mdx index 67699df74..f6094964c 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -15,7 +15,7 @@ icon: book-open 2. Try out [Continue CLI (cn)](https://docs.continue.dev/guides/cli) and give us feedback -3. Discover the models, rules, and MCP tools you need to create a custom AI coding agent on [Continue Hub](https://hub.continue.dev/) +3. Discover models, rules, and MCP tools on [Continue Hub](https://hub.continue.dev/) Date: Wed, 13 Aug 2025 14:26:37 -0700 Subject: [PATCH 116/174] fix: prompt --- .github/workflows/continue-detailed-review.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index c8b24e5f3..d22fe55f2 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -97,7 +97,7 @@ jobs: Guidelines for comments: - Be specific and actionable - - Reference the exact line number from the file + - Reference the exact line number from the diff - Keep comments concise but informative - Suggest concrete improvements when pointing out issues - Only comment on actual problems or important improvements @@ -105,7 +105,7 @@ jobs: Important: - Output ONLY valid JSON, no additional text - - Line numbers should match the actual line numbers in the files + - Ensure line numbers match the actual diff - Comment on the most important issues first - Limit to maximum 20 most relevant comments EOF From c920368413c71c2c471b85c85798b8adfaff4363 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 14:28:33 -0700 Subject: [PATCH 117/174] improv: use commit SHA for security --- .github/workflows/continue-detailed-review.yaml | 2 +- .github/workflows/continue-general-review.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index d22fe55f2..bf20a1dcd 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v4 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 # Fetch full history for better context diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index 54f8a84b6..b78a8c810 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v5 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 # Fetch full history for better context From 928aacc0f664a17b73a7ce465363f11321f08311 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 14:41:56 -0700 Subject: [PATCH 118/174] fix: handle positions --- .../workflows/continue-detailed-review.yaml | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index bf20a1dcd..69c6a5659 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -67,6 +67,29 @@ jobs: Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. + CRITICAL: Understanding "position" for GitHub PR comments: + The "position" field is the line number within the diff, NOT the file line number. + + Example diff and position counting: + ``` + diff --git a/src/app.js b/src/app.js + index abc123..def456 100644 + --- a/src/app.js + +++ b/src/app.js + @@ -10,4 +10,6 @@ function example() { <-- This is the @@ header, not counted + console.log("context"); <-- position 1 (first line after @@) + - const old = "remove this"; <-- position 2 + + const new = "add this"; <-- position 3 + + const risky = eval(userInput); <-- position 4 (comment here about security issue!) + return result; <-- position 5 + + console.log("done"); <-- position 6 + @@ -20,3 +22,4 @@ function another() { <-- New @@ header, restart counting! + let x = 1; <-- position 1 (for this hunk) + + let y = 2; <-- position 2 (for this hunk) + ``` + + To comment on the risky eval line above, use: {"path": "src/app.js", "position": 4, "body": "Avoid using eval..."} + Below is the PR diff: EOF @@ -82,8 +105,7 @@ jobs: "comments": [ { "path": "path/to/file.js", - "line": 42, - "side": "RIGHT", + "position": 4, "body": "Brief, specific comment about this line or section" } ] @@ -97,15 +119,17 @@ jobs: Guidelines for comments: - Be specific and actionable - - Reference the exact line number from the diff + - Count position starting from 1 after each @@ header line + - Include ALL lines in count: context lines, additions (+), and deletions (-) + - Reset position count to 1 after each new @@ header - Keep comments concise but informative - Suggest concrete improvements when pointing out issues - Only comment on actual problems or important improvements - - Use "RIGHT" for new/modified lines, "LEFT" for context about removed lines Important: - Output ONLY valid JSON, no additional text - - Ensure line numbers match the actual diff + - Position is counted within the diff, NOT the file line number + - Only comment on changed lines (+ or - prefix) - Comment on the most important issues first - Limit to maximum 20 most relevant comments EOF @@ -170,16 +194,23 @@ jobs: // Prepare review comments - filter out comments without required fields const allComments = reviewData.comments || []; - const validComments = allComments.filter(comment => comment.line && comment.path && comment.body && comment.side); + const validComments = allComments.filter(comment => + comment.position && + comment.path && + comment.body && + typeof comment.position === 'number' && + comment.position > 0 + ); if (validComments.length < allComments.length) { - console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing line, path, body, or side`); + console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing/invalid position, path, or body`); + const invalidComments = allComments.filter(c => !validComments.includes(c)); + console.log('Invalid comments:', JSON.stringify(invalidComments, null, 2)); } const comments = validComments.map(comment => ({ path: comment.path, - line: comment.line, - side: comment.side, + position: comment.position, body: comment.body })); From 98c2bf3e148da0e4e4e6b34ec71483ead70e8453 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 14:53:15 -0700 Subject: [PATCH 119/174] improv: add position fixing second pass --- .../workflows/continue-detailed-review.yaml | 60 +++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 69c6a5659..bcba06ba5 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -141,16 +141,66 @@ jobs: echo "Running Continue CLI for inline review..." # Run the CLI and capture JSON output - cat inline_review_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review.json + cat inline_review_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review_raw.json # Log the output for debugging - echo "Continue CLI output:" - cat inline_review.json + echo "Initial Continue CLI output:" + cat inline_review_raw.json # Validate JSON output - if ! jq empty inline_review.json 2>/dev/null; then + if ! jq empty inline_review_raw.json 2>/dev/null; then echo "Invalid JSON output from Continue CLI" echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json + else + # Second pass: Fix positions using Continue CLI + echo "Running second pass to fix comment positions..." + + # Create position fixing prompt + cat > fix_positions_prompt.txt << 'EOF' + You are a position calculator for GitHub PR review comments. Your ONLY job is to calculate the correct position values for inline comments. + + Here is the PR diff with line numbers added for reference: + EOF + + # Add line numbers to the diff for clarity + cat pr_diff.txt | nl -ba -v 1 >> fix_positions_prompt.txt + + cat >> fix_positions_prompt.txt << 'EOF' + + Here are the review comments that need position fixing: + EOF + + cat inline_review_raw.json >> fix_positions_prompt.txt + + cat >> fix_positions_prompt.txt << 'EOF' + + For each comment, find the exact line in the numbered diff above and return the CORRECT position. + Remember: Position is the line number in the diff (the number shown at the start of each line above). + + Return ONLY valid JSON in this exact format: + { + "review_summary": [copy the original review_summary], + "comments": [ + { + "path": [original path], + "position": [the line number from the numbered diff above], + "body": [original body] + } + ] + } + + Important: + - Use the line numbers shown in the numbered diff above + - Only include comments where you can find the exact matching line + - If you cannot find a good match for a comment, skip it + - Output ONLY valid JSON + EOF + + # Run the position fixer + cat fix_positions_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review.json + + echo "Fixed positions output:" + cat inline_review.json fi env: CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} @@ -274,7 +324,9 @@ jobs: with: name: inline-review-results path: | + inline_review_raw.json inline_review.json + fix_positions_prompt.txt inline_review_prompt.txt pr_files.json pr_diff.txt From a6c0469c00c1b110126761c938094045b7d576a5 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 15:14:19 -0700 Subject: [PATCH 120/174] improv: position calculation --- .../workflows/continue-detailed-review.yaml | 117 +++++++----------- 1 file changed, 47 insertions(+), 70 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index bcba06ba5..488856df3 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -61,40 +61,57 @@ jobs: # Get PR diff with context gh pr diff $PR_NUMBER --color=never > pr_diff.txt + # Annotate diff with position numbers for easy reference + awk ' + /^@@/ { + pos = 0 + print + next + } + /^diff --git/ || /^index / || /^--- / || /^\+\+\+ / { + print + next + } + { + pos++ + printf "[POS:%d] %s\n", pos, $0 + } + ' pr_diff.txt > pr_diff_annotated.txt + # Create review prompt for inline comments cat > inline_review_prompt.txt << 'EOF' You are conducting a detailed inline code review for a pull request. Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. - CRITICAL: Understanding "position" for GitHub PR comments: - The "position" field is the line number within the diff, NOT the file line number. + IMPORTANT: The diff below has been annotated with [POS:N] markers showing the exact position for each line. - Example diff and position counting: + Example of how to use the position markers: ``` diff --git a/src/app.js b/src/app.js index abc123..def456 100644 --- a/src/app.js +++ b/src/app.js - @@ -10,4 +10,6 @@ function example() { <-- This is the @@ header, not counted - console.log("context"); <-- position 1 (first line after @@) - - const old = "remove this"; <-- position 2 - + const new = "add this"; <-- position 3 - + const risky = eval(userInput); <-- position 4 (comment here about security issue!) - return result; <-- position 5 - + console.log("done"); <-- position 6 - @@ -20,3 +22,4 @@ function another() { <-- New @@ header, restart counting! - let x = 1; <-- position 1 (for this hunk) - + let y = 2; <-- position 2 (for this hunk) + @@ -10,4 +10,6 @@ function example() { + [POS:1] console.log("context"); + [POS:2] - const old = "remove this"; + [POS:3] + const new = "add this"; + [POS:4] + const risky = eval(userInput); <-- To comment here, use position: 4 + [POS:5] return result; + [POS:6] + console.log("done"); + @@ -20,3 +22,4 @@ function another() { + [POS:1] let x = 1; + [POS:2] + let y = 2; <-- To comment here, use position: 2 ``` - To comment on the risky eval line above, use: {"path": "src/app.js", "position": 4, "body": "Avoid using eval..."} + To comment on a line, simply use the number from its [POS:N] marker as the position value. + For example: {"path": "src/app.js", "position": 4, "body": "Avoid using eval with user input"} - Below is the PR diff: + Below is the annotated PR diff: EOF - cat pr_diff.txt >> inline_review_prompt.txt + cat pr_diff_annotated.txt >> inline_review_prompt.txt cat >> inline_review_prompt.txt << 'EOF' @@ -119,17 +136,15 @@ jobs: Guidelines for comments: - Be specific and actionable - - Count position starting from 1 after each @@ header line - - Include ALL lines in count: context lines, additions (+), and deletions (-) - - Reset position count to 1 after each new @@ header + - Use the [POS:N] number shown in the diff as the position value - Keep comments concise but informative - Suggest concrete improvements when pointing out issues - Only comment on actual problems or important improvements Important: - Output ONLY valid JSON, no additional text - - Position is counted within the diff, NOT the file line number - - Only comment on changed lines (+ or - prefix) + - Use the exact number from [POS:N] markers as the position + - Only comment on changed lines (lines with + or - prefix) - Comment on the most important issues first - Limit to maximum 20 most relevant comments EOF @@ -139,6 +154,13 @@ jobs: - name: Run Continue CLI Inline Review run: | echo "Running Continue CLI for inline review..." + + # Log the prompt for debugging + echo "===== START REVIEW PROMPT =====" + head -n 50 inline_review_prompt.txt + echo "... [diff content] ..." + tail -n 20 inline_review_prompt.txt + echo "===== END REVIEW PROMPT =====" # Run the CLI and capture JSON output cat inline_review_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review_raw.json @@ -152,54 +174,9 @@ jobs: echo "Invalid JSON output from Continue CLI" echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json else - # Second pass: Fix positions using Continue CLI - echo "Running second pass to fix comment positions..." - - # Create position fixing prompt - cat > fix_positions_prompt.txt << 'EOF' - You are a position calculator for GitHub PR review comments. Your ONLY job is to calculate the correct position values for inline comments. - - Here is the PR diff with line numbers added for reference: - EOF - - # Add line numbers to the diff for clarity - cat pr_diff.txt | nl -ba -v 1 >> fix_positions_prompt.txt - - cat >> fix_positions_prompt.txt << 'EOF' - - Here are the review comments that need position fixing: - EOF - - cat inline_review_raw.json >> fix_positions_prompt.txt - - cat >> fix_positions_prompt.txt << 'EOF' - - For each comment, find the exact line in the numbered diff above and return the CORRECT position. - Remember: Position is the line number in the diff (the number shown at the start of each line above). - - Return ONLY valid JSON in this exact format: - { - "review_summary": [copy the original review_summary], - "comments": [ - { - "path": [original path], - "position": [the line number from the numbered diff above], - "body": [original body] - } - ] - } - - Important: - - Use the line numbers shown in the numbered diff above - - Only include comments where you can find the exact matching line - - If you cannot find a good match for a comment, skip it - - Output ONLY valid JSON - EOF - - # Run the position fixer - cat fix_positions_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review.json - - echo "Fixed positions output:" + # Use the output directly since positions are already correct + cp inline_review_raw.json inline_review.json + echo "Review output:" cat inline_review.json fi env: @@ -326,8 +303,8 @@ jobs: path: | inline_review_raw.json inline_review.json - fix_positions_prompt.txt inline_review_prompt.txt pr_files.json pr_diff.txt + pr_diff_annotated.txt retention-days: 7 From 4740bd83628a7fbc609a52cff901f7fce1dac8a0 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 17:24:57 -0700 Subject: [PATCH 121/174] feat: custom gh action --- pr-review-action/README.md | 152 +++++++++++++++++++++++++++ pr-review-action/action.yml | 204 ++++++++++++++++++++++++++++++++++++ 2 files changed, 356 insertions(+) create mode 100644 pr-review-action/README.md create mode 100644 pr-review-action/action.yml diff --git a/pr-review-action/README.md b/pr-review-action/README.md new file mode 100644 index 000000000..2eea13d41 --- /dev/null +++ b/pr-review-action/README.md @@ -0,0 +1,152 @@ +# Continue PR Review Action + +A GitHub Action that provides automated code review for pull requests using Continue CLI. + +## Usage + +Add this workflow to your repository at `.github/workflows/pr-review.yml`: + +```yaml +name: PR Review +on: + pull_request: + types: [opened, ready_for_review] + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + review: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: continuedev/continue/pr-review-action@v1 + with: + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'your-org-name' + continue-config: 'your-org-name/review-bot' +``` + +The action automatically handles authorization checks and only runs for: +- PRs opened or marked ready by team members (OWNER, MEMBER, COLLABORATOR) +- Comments containing `@continue-review` from team members + +## Inputs + +| Input | Description | Required | +|-------|-------------|----------| +| `continue-api-key` | API key for Continue service | Yes | +| `continue-org` | Organization for Continue config | Yes | +| `continue-config` | Config path (e.g., "myorg/review-bot") | Yes | + +## Setup Requirements + +### 1. Continue API Key +Add your Continue API key as a secret named `CONTINUE_API_KEY` in your repository: +1. Go to your repository's Settings +2. Navigate to Secrets and variables β†’ Actions +3. Click "New repository secret" +4. Name: `CONTINUE_API_KEY` +5. Value: Your Continue API key + +### 2. Continue Configuration +Set up your review bot configuration in Continue: +1. Create a configuration for your organization +2. Configure the review bot settings +3. Note your organization name and config path + +### 3. Workflow Permissions +The workflow requires these permissions: +- `contents: read` - To checkout and read repository code +- `pull-requests: write` - To post review comments on PRs +- `issues: write` - To respond to comment triggers + +## Triggering Reviews + +The action can be triggered in two ways: + +### Automatic Triggers +- When a PR is opened by a team member (OWNER, MEMBER, or COLLABORATOR) +- When a PR is marked as "ready for review" by a team member + +### Manual Trigger +Team members can trigger a review by commenting `@continue-review` on any pull request. + +## Versioning + +This action follows semantic versioning. We recommend using the major version tag for automatic updates: + +- `@v1` - Automatically uses the latest v1.x.x release (recommended) +- `@v1.0.0` - Pins to a specific version +- `@main` - Uses the latest code from the main branch (not recommended for production) + +## Minimal Example + +This is the simplest possible configuration: + +```yaml +name: PR Review +on: [pull_request, issue_comment] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: continuedev/continue/pr-review-action@v1 + with: + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'acme-corp' + continue-config: 'acme-corp/review-bot' +``` + +## How It Works + +1. The action checks out your repository code +2. Installs the Continue CLI (v1.4.25) +3. Fetches the PR diff using GitHub CLI +4. Generates a comprehensive review prompt +5. Runs the Continue CLI with your specified configuration +6. Posts the review as a comment on the PR + +## Review Output + +The action generates a structured code review that includes: + +- **Strengths**: What was done well in the PR +- **Issues Found**: Categorized by severity (Critical, High, Medium, Low) +- **Suggestions**: Improvement recommendations +- **Overall Assessment**: Final recommendation (APPROVE, REQUEST_CHANGES, or COMMENT) + +## Troubleshooting + +### Review not triggering +- Ensure the PR author or commenter has appropriate permissions (OWNER, MEMBER, or COLLABORATOR) +- Check that the workflow file is in the default branch +- Verify the Continue API key is correctly set as a repository secret + +### No review output generated +- Check the action logs for any errors +- Verify your Continue configuration is correct +- Ensure your Continue API key is valid + +## Support + +For issues or questions: +- [Continue Documentation](https://docs.continue.dev) +- [GitHub Issues](https://github.com/continuedev/continue/issues) +- [Discord Community](https://discord.gg/vapESyrFmJ) \ No newline at end of file diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml new file mode 100644 index 000000000..7b9d0bc43 --- /dev/null +++ b/pr-review-action/action.yml @@ -0,0 +1,204 @@ +name: 'Continue PR Review' +description: 'Automated code review for pull requests using Continue CLI' +author: 'Continue Dev, Inc.' + +inputs: + continue-api-key: + description: 'API key for Continue service' + required: true + continue-org: + description: 'Organization for Continue config' + required: true + continue-config: + description: 'Config path to use (e.g., "myorg/review-bot")' + required: true + +runs: + using: 'composite' + steps: + - name: Check Authorization + shell: bash + run: | + # Check if this action should run based on event type and user permissions + SHOULD_RUN="false" + + if [ "${{ github.event_name }}" = "pull_request" ]; then + # Check PR author association + AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" + if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + fi + elif [ "${{ github.event_name }}" = "issue_comment" ]; then + # Check if it's a PR comment with the trigger phrase + if [ "${{ github.event.issue.pull_request }}" != "" ] && [[ "${{ github.event.comment.body }}" == *"@continue-review"* ]]; then + COMMENTER_ASSOC="${{ github.event.comment.author_association }}" + if [ "$COMMENTER_ASSOC" = "OWNER" ] || [ "$COMMENTER_ASSOC" = "MEMBER" ] || [ "$COMMENTER_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - Commenter is not a team member (association: $COMMENTER_ASSOC)" + fi + else + echo "::notice::Skipping review - Comment does not contain @continue-review trigger or is not on a PR" + fi + else + echo "::notice::Skipping review - Unsupported event type: ${{ github.event_name }}" + fi + + echo "SHOULD_RUN=$SHOULD_RUN" >> $GITHUB_ENV + + - name: Setup Node.js + if: env.SHOULD_RUN == 'true' + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Continue CLI + if: env.SHOULD_RUN == 'true' + shell: bash + run: npm install -g @continuedev/cli@1.4.25 + + - name: Build PR Review Prompt + if: env.SHOULD_RUN == 'true' + shell: bash + run: | + # Get PR number based on event type + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For issue_comment event on a PR + PR_NUMBER="${{ github.event.issue.number }}" + fi + + # Get PR diff + gh pr diff $PR_NUMBER > pr_diff.txt + + # Create review prompt + cat > review_prompt.txt << 'EOF' + You are conducting a code review for a pull request. Below is the git diff showing all the changes: + + EOF + + echo "--- PR DIFF START ---" >> review_prompt.txt + cat pr_diff.txt >> review_prompt.txt + echo "--- PR DIFF END ---" >> review_prompt.txt + + cat >> review_prompt.txt << 'EOF' + + Please analyze these changes and provide a comprehensive code review. Consider: + + 1. **Code Quality**: Are there any bugs, performance issues, or code smells? + 2. **Best Practices**: Does the code follow established patterns and conventions? + 3. **Security**: Are there any potential security vulnerabilities? + 4. **Testing**: Are appropriate tests included or updated? + 5. **Documentation**: Is documentation adequate for the changes? + 6. **Architecture**: Do the changes fit well with the existing codebase structure? + + You can use the available tools to explore the codebase and understand context better. + + Format your response as a markdown code review with the following structure: + + ## Code Review Summary + + ### βœ… Strengths + - **[Aspect]**: [Description of what was done well] + + ### ⚠️ Issues Found + + Only include the severity subheaders below if you actually found issues at that level: + + #### Critical + - **[Issue Title]**: [Description of critical issues that must be fixed before merging] + + #### High + - **[Issue Title]**: [Description of high-priority issues that should be fixed] + + #### Medium + - **[Issue Title]**: [Description of issues that should be addressed] + + #### Low + - **[Issue Title]**: [Description of minor issues or nice-to-have improvements] + + + ### πŸ’‘ Suggestions + - **[Suggestion Title]**: [Description of improvement recommendations] + + ### πŸš€ Overall Assessment + [Provide overall recommendation: APPROVE, REQUEST_CHANGES, or COMMENT] + + Only call the 'exit' tool if you find critical security vulnerabilities or bugs that would break production. + EOF + + - name: Run Continue CLI Review + if: env.SHOULD_RUN == 'true' + shell: bash + run: | + echo "Running Continue CLI with prompt:" + echo "==================================" + cat review_prompt.txt + echo "==================================" + echo "" + + # Run the CLI with provided config + cat review_prompt.txt | cn --readonly --org ${{ inputs.continue-org }} --config ${{ inputs.continue-config }} -p > code_review.md + env: + CONTINUE_API_KEY: ${{ inputs.continue-api-key }} + + - name: Upload Review Results + if: env.SHOULD_RUN == 'true' && always() + uses: actions/upload-artifact@v4 + with: + name: code-review-results + path: | + code_review.md + review_prompt.txt + pr_diff.txt + retention-days: 30 + + - name: Comment PR with Review + if: env.SHOULD_RUN == 'true' && always() + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + + try { + let reviewContent = ''; + + if (fs.existsSync('code_review.md') && fs.statSync('code_review.md').size > 0) { + reviewContent = fs.readFileSync('code_review.md', 'utf8'); + } else { + reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; + } + + // Get PR number based on event type + let prNumber; + if (context.eventName === 'pull_request') { + prNumber = context.payload.pull_request.number; + } else { + // For issue_comment event + prNumber = context.payload.issue.number; + } + + // Add a header if triggered by comment + if (context.eventName === 'issue_comment') { + reviewContent = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewContent}`; + } + + // Create new comment + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: reviewContent + }); + console.log(`Successfully created new comment on PR #${prNumber}`); + } catch (error) { + console.log('Failed to post comment:', error.message); + console.log('Error details:', error); + } + +branding: + icon: 'code' + color: 'blue' \ No newline at end of file From 076dd68c1d88b4da5d604af361e40e6396c4a11f Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 17:31:23 -0700 Subject: [PATCH 122/174] feat: general review action --- .../workflows/continue-general-review.yaml | 168 +----------------- pr-review-action/README.md | 4 +- pr-review-action/action.yml | 4 +- 3 files changed, 10 insertions(+), 166 deletions(-) diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index b78a8c810..8bdb309a0 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -16,171 +16,15 @@ jobs: name: Continue General Review runs-on: ubuntu-latest timeout-minutes: 10 - # Only run if: - # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-general-review on a PR from a team member - if: | - (github.event_name == 'pull_request' && - (github.event.pull_request.author_association == 'OWNER' || - github.event.pull_request.author_association == 'MEMBER' || - github.event.pull_request.author_association == 'COLLABORATOR')) || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-general-review') && - (github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'COLLABORATOR')) - steps: - name: Checkout Repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch full history for better context - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Run Continue PR Review Action + uses: ./pr-review-action # Using local action since we're in the same repo with: - node-version: 20 - - - name: Install Continue CLI - run: npm install -g @continuedev/cli@1.4.25 - - - name: Build PR Review Prompt - run: | - # Get PR number based on event type - if [ "${{ github.event_name }}" = "pull_request" ]; then - PR_NUMBER="${{ github.event.number }}" - else - # For issue_comment event on a PR - PR_NUMBER="${{ github.event.issue.number }}" - fi - - # Get PR diff - gh pr diff $PR_NUMBER > pr_diff.txt - - # Create review prompt - cat > review_prompt.txt << 'EOF' - You are conducting a code review for a pull request. Below is the git diff showing all the changes: - - EOF - - echo "--- PR DIFF START ---" >> review_prompt.txt - cat pr_diff.txt >> review_prompt.txt - echo "--- PR DIFF END ---" >> review_prompt.txt - - cat >> review_prompt.txt << 'EOF' - - Please analyze these changes and provide a comprehensive code review. Consider: - - 1. **Code Quality**: Are there any bugs, performance issues, or code smells? - 2. **Best Practices**: Does the code follow established patterns and conventions? - 3. **Security**: Are there any potential security vulnerabilities? - 4. **Testing**: Are appropriate tests included or updated? - 5. **Documentation**: Is documentation adequate for the changes? - 6. **Architecture**: Do the changes fit well with the existing codebase structure? - - You can use the available tools to explore the codebase and understand context better. - - Format your response as a markdown code review with the following structure: - - ## Code Review Summary - - ### βœ… Strengths - - **[Aspect]**: [Description of what was done well] - - ### ⚠️ Issues Found - - Only include the severity subheaders below if you actually found issues at that level: - - #### Critical - - **[Issue Title]**: [Description of critical issues that must be fixed before merging] - - #### High - - **[Issue Title]**: [Description of high-priority issues that should be fixed] - - #### Medium - - **[Issue Title]**: [Description of issues that should be addressed] - - #### Low - - **[Issue Title]**: [Description of minor issues or nice-to-have improvements] - - - ### πŸ’‘ Suggestions - - **[Suggestion Title]**: [Description of improvement recommendations] - - ### πŸš€ Overall Assessment - [Provide overall recommendation: APPROVE, REQUEST_CHANGES, or COMMENT] - - Only call the 'exit' tool if you find critical security vulnerabilities or bugs that would break production. - EOF - env: - GH_TOKEN: ${{ github.token }} - - - name: Run Continue CLI Review - run: | - echo "Running Continue CLI with prompt:" - echo "==================================" - cat review_prompt.txt - echo "==================================" - echo "" - - # Run the CLI with hardcoded assistant and pipe output to code_review.md - cat review_prompt.txt | cn --readonly --org continuedev --config continuedev/review-bot -p > code_review.md - env: - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} - - - name: Upload Review Results - uses: actions/upload-artifact@v4 - if: always() - with: - name: code-review-results - path: | - code_review.md - review_prompt.txt - pr_diff.txt - retention-days: 30 - - - name: Comment PR with Review - if: always() - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - - try { - let reviewContent = ''; - - if (fs.existsSync('code_review.md') && fs.statSync('code_review.md').size > 0) { - reviewContent = fs.readFileSync('code_review.md', 'utf8'); - } else { - reviewContent = '⚠️ AI review completed but no review output was generated. Check the action logs for details.'; - } - - // Get PR number based on event type - let prNumber; - if (context.eventName === 'pull_request') { - prNumber = context.payload.pull_request.number; - } else { - // For issue_comment event - prNumber = context.payload.issue.number; - } - - // Add a header if triggered by comment - if (context.eventName === 'issue_comment') { - reviewContent = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewContent}`; - } - - // Create new comment - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: reviewContent - }); - console.log(`Successfully created new comment on PR #${prNumber}`); - } catch (error) { - console.log('Failed to post comment:', error.message); - console.log('Error details:', error); - } - env: - GITHUB_TOKEN: ${{ github.token }} + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'continuedev' + continue-config: 'continuedev/review-bot' \ No newline at end of file diff --git a/pr-review-action/README.md b/pr-review-action/README.md index 2eea13d41..4d139ee41 100644 --- a/pr-review-action/README.md +++ b/pr-review-action/README.md @@ -36,7 +36,7 @@ jobs: The action automatically handles authorization checks and only runs for: - PRs opened or marked ready by team members (OWNER, MEMBER, COLLABORATOR) -- Comments containing `@continue-review` from team members +- Comments containing `@continue-general-review` from team members ## Inputs @@ -77,7 +77,7 @@ The action can be triggered in two ways: - When a PR is marked as "ready for review" by a team member ### Manual Trigger -Team members can trigger a review by commenting `@continue-review` on any pull request. +Team members can trigger a review by commenting `@continue-general-review` on any pull request. ## Versioning diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml index 7b9d0bc43..5b2b4a0a1 100644 --- a/pr-review-action/action.yml +++ b/pr-review-action/action.yml @@ -32,7 +32,7 @@ runs: fi elif [ "${{ github.event_name }}" = "issue_comment" ]; then # Check if it's a PR comment with the trigger phrase - if [ "${{ github.event.issue.pull_request }}" != "" ] && [[ "${{ github.event.comment.body }}" == *"@continue-review"* ]]; then + if [ "${{ github.event.issue.pull_request }}" != "" ] && [[ "${{ github.event.comment.body }}" == *"@continue-general-review"* ]]; then COMMENTER_ASSOC="${{ github.event.comment.author_association }}" if [ "$COMMENTER_ASSOC" = "OWNER" ] || [ "$COMMENTER_ASSOC" = "MEMBER" ] || [ "$COMMENTER_ASSOC" = "COLLABORATOR" ]; then SHOULD_RUN="true" @@ -40,7 +40,7 @@ runs: echo "::notice::Skipping review - Commenter is not a team member (association: $COMMENTER_ASSOC)" fi else - echo "::notice::Skipping review - Comment does not contain @continue-review trigger or is not on a PR" + echo "::notice::Skipping review - Comment does not contain @continue-general-review trigger, or is not on a PR" fi else echo "::notice::Skipping review - Unsupported event type: ${{ github.event_name }}" From 51da968ec83a46ab59a5de9759c56ce64fdd307c Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Wed, 13 Aug 2025 17:35:06 -0700 Subject: [PATCH 123/174] feat: review action --- .github/workflows/continue-general-review.yaml | 7 +------ pr-review-action/README.md | 8 +------- pr-review-action/action.yml | 5 +++++ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index 8bdb309a0..6a8a337f9 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -17,13 +17,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch full history for better context - - name: Run Continue PR Review Action - uses: ./pr-review-action # Using local action since we're in the same repo + uses: continuedev/continue/pr-review-action@main with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'continuedev' diff --git a/pr-review-action/README.md b/pr-review-action/README.md index 4d139ee41..78dffb120 100644 --- a/pr-review-action/README.md +++ b/pr-review-action/README.md @@ -24,9 +24,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: continuedev/continue/pr-review-action@v1 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} @@ -104,9 +101,6 @@ jobs: review: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: continuedev/continue/pr-review-action@v1 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} @@ -116,7 +110,7 @@ jobs: ## How It Works -1. The action checks out your repository code +1. The action automatically checks out your repository code 2. Installs the Continue CLI (v1.4.25) 3. Fetches the PR diff using GitHub CLI 4. Generates a comprehensive review prompt diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml index 5b2b4a0a1..2550e0324 100644 --- a/pr-review-action/action.yml +++ b/pr-review-action/action.yml @@ -16,6 +16,11 @@ inputs: runs: using: 'composite' steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history for better context + - name: Check Authorization shell: bash run: | From 61af1a48a9ed43525f8751e6de45e256872ff036 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 13 Aug 2025 20:08:32 -0700 Subject: [PATCH 124/174] chore: bump versions --- extensions/intellij/gradle.properties | 2 +- extensions/vscode/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 6ca982585..5a06294db 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -1,6 +1,6 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginRepositoryUrl=https://github.com/continuedev/continue -pluginVersion=1.0.36 +pluginVersion=1.0.37 pluginSinceBuild=223 platformType=IC platformVersion=2022.3.3 diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 1282f2cd4..531e97ea7 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.76", + "version": "1.1.77", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From d9bb7953e1ee1f4161cfd0df0c273e733fef23cd Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 13 Aug 2025 20:35:23 -0700 Subject: [PATCH 125/174] Update auto-assign-issue.yaml --- .github/workflows/auto-assign-issue.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-assign-issue.yaml b/.github/workflows/auto-assign-issue.yaml index 1e62ae399..6643520da 100644 --- a/.github/workflows/auto-assign-issue.yaml +++ b/.github/workflows/auto-assign-issue.yaml @@ -14,7 +14,7 @@ jobs: uses: pozil/auto-assign-issue@v2 with: repo-token: ${{ secrets.CI_GITHUB_TOKEN }} - assignees: Patrick-Erichsen,tomasz-stefaniak,RomneyDa,tingwai + assignees: Patrick-Erichsen,tomasz-stefaniak,RomneyDa,tingwai,uinstinct numOfAssignee: 1 # - name: "Add default labels" # uses: actions-ecosystem/action-add-labels@v1 From ee5adeba51ff416ec0dead2ffc973e6bc1bc1643 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 13 Aug 2025 21:06:26 -0700 Subject: [PATCH 126/174] Update editOutcomeLogger.ts --- gui/src/util/editOutcomeLogger.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/src/util/editOutcomeLogger.ts b/gui/src/util/editOutcomeLogger.ts index ef7883353..531bb5da3 100644 --- a/gui/src/util/editOutcomeLogger.ts +++ b/gui/src/util/editOutcomeLogger.ts @@ -154,6 +154,7 @@ export function assembleEditOutcomeData( timestamp: new Date().toISOString(), modelProvider: modelInfo.modelProvider, modelName: modelInfo.modelName, + modelTitle: modelInfo.modelName, prompt: promptAndCompletion.prompt, completion: promptAndCompletion.completion, previousCode: codeChanges.previousCode, From 3253c1182128f662858c5310db7301d9ffad7905 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 13 Aug 2025 22:06:01 -0700 Subject: [PATCH 127/174] add modelProvider to PromptLog --- core/config/types.ts | 1 + core/index.d.ts | 1 + core/llm/index.ts | 2 ++ core/llm/llm-pre-fetch.vitest.ts | 1 + core/llm/streamChat.ts | 1 + core/nextEdit/context/processNextEditData.ts | 1 + extensions/vscode/src/diff/vertical/manager.ts | 1 + extensions/vscode/src/extension/EditOutcomeTracker.ts | 2 ++ extensions/vscode/src/extension/VsCodeMessenger.ts | 2 ++ extensions/vscode/src/quickEdit/QuickEditQuickPick.ts | 6 +++--- gui/src/components/FeedbackButtons.tsx | 5 +++-- gui/src/redux/thunks/streamNormalInput.ts | 4 ++-- gui/src/redux/thunks/streamResponse.test.ts | 1 + gui/src/util/editOutcomeLogger.ts | 3 +++ packages/config-yaml/src/schemas/data/chatFeedback/index.ts | 1 + .../config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts | 1 - .../config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts | 1 + .../config-yaml/src/schemas/data/chatInteraction/index.ts | 1 + .../config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts | 1 + .../config-yaml/src/schemas/data/editInteraction/index.ts | 1 + .../config-yaml/src/schemas/data/editInteraction/v0.2.0.ts | 1 + packages/config-yaml/src/schemas/data/editOutcome/index.ts | 1 + packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts | 1 + .../src/schemas/data/nextEditWithHistory/index.ts | 1 + .../src/schemas/data/nextEditWithHistory/v0.2.0.ts | 1 + 25 files changed, 34 insertions(+), 8 deletions(-) diff --git a/core/config/types.ts b/core/config/types.ts index b9be2b209..6048cf4d3 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -387,6 +387,7 @@ declare global { export interface PromptLog { modelTitle: string; + modelProvider: string; completionOptions: CompletionOptions; prompt: string; completion: string; diff --git a/core/index.d.ts b/core/index.d.ts index f26b72b58..0962c212b 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -455,6 +455,7 @@ export type FileSymbolMap = Record; export interface PromptLog { modelTitle: string; + modelProvider: string; completionOptions: CompletionOptions; prompt: string; completion: string; diff --git a/core/llm/index.ts b/core/llm/index.ts index f280eedd4..a8c4fafc6 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -779,6 +779,7 @@ export abstract class BaseLLM implements ILLM { return { modelTitle: this.title ?? completionOptions.model, + modelProvider: this.underlyingProviderName, prompt, completion, completionOptions, @@ -1094,6 +1095,7 @@ export abstract class BaseLLM implements ILLM { return { modelTitle: this.title ?? completionOptions.model, + modelProvider: this.underlyingProviderName, prompt, completion, completionOptions, diff --git a/core/llm/llm-pre-fetch.vitest.ts b/core/llm/llm-pre-fetch.vitest.ts index 3db39fc3e..3ba86ffa1 100644 --- a/core/llm/llm-pre-fetch.vitest.ts +++ b/core/llm/llm-pre-fetch.vitest.ts @@ -23,6 +23,7 @@ async function dudLLMCall(llm: ILLM, messages: ChatMessage[]) { model: "", }, modelTitle: "", + modelProvider: "", prompt: "", }); abortController.abort(); diff --git a/core/llm/streamChat.ts b/core/llm/streamChat.ts index 2692195e2..fd26b96f0 100644 --- a/core/llm/streamChat.ts +++ b/core/llm/streamChat.ts @@ -40,6 +40,7 @@ export async function* llmStreamChat( // Log to return in case of error const errorPromptLog = { modelTitle: model?.title ?? model?.model, + modelProvider: model?.underlyingProviderName ?? "unknown", completion: "", prompt: "", completionOptions: { diff --git a/core/nextEdit/context/processNextEditData.ts b/core/nextEdit/context/processNextEditData.ts index 1c3245669..2aa4adb79 100644 --- a/core/nextEdit/context/processNextEditData.ts +++ b/core/nextEdit/context/processNextEditData.ts @@ -127,6 +127,7 @@ export const processNextEditData = async ({ context: autocompleteContext, modelProvider, modelName, + modelTitle: modelName, }, }); } diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index 7d832b596..e30f898c0 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -537,6 +537,7 @@ export class VerticalDiffManager { timestamp: new Date().toISOString(), modelProvider: model.underlyingProviderName, modelName: model.title ?? "", + modelTitle: model.title ?? "", prompt: stripImages(prompt), completion: newCode, previousCode, diff --git a/extensions/vscode/src/extension/EditOutcomeTracker.ts b/extensions/vscode/src/extension/EditOutcomeTracker.ts index 1b793d73b..ab691ae7a 100644 --- a/extensions/vscode/src/extension/EditOutcomeTracker.ts +++ b/extensions/vscode/src/extension/EditOutcomeTracker.ts @@ -7,6 +7,7 @@ export interface PendingEditData { timestamp: string; modelProvider: string; modelName: string; + modelTitle: string; prompt: string; completion: string; previousCode: string; @@ -57,6 +58,7 @@ class EditOutcomeTracker { data: { modelProvider: pendingEdit.modelProvider, modelName: pendingEdit.modelName, + modelTitle: pendingEdit.modelName, prompt: pendingEdit.prompt, completion: pendingEdit.completion, previousCode: pendingEdit.previousCode, diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 488b1f55a..516e47983 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -30,6 +30,7 @@ import { showTutorial } from "../util/tutorial"; import { getExtensionUri } from "../util/vscode"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; + import { VsCodeExtension } from "./VsCodeExtension"; type ToIdeOrWebviewFromCoreProtocol = ToIdeFromCoreProtocol & @@ -241,6 +242,7 @@ export class VsCodeMessenger { completion: fileAfterEdit ?? "", modelProvider: model.underlyingProviderName, modelName: model.title ?? "", + modelTitle: model.title ?? "", filepath: msg.data.range.filepath, }, }); diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index c3a02beb7..af3b3f882 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -238,15 +238,15 @@ export class QuickEdit { prompt: string, path: string | undefined, ) => { - const model = await this.getCurModel(); - if (!model) { + const modelTitle = await this.getCurModel(); + if (!modelTitle) { throw new Error("No model selected"); } const { config } = await this.configHandler.loadConfig(); const rules = config?.rules ?? []; // no need to error - getCurModel above will handle - await this._streamEditWithInputAndContext(prompt, model, rules); + await this._streamEditWithInputAndContext(prompt, modelTitle, rules); this.openAcceptRejectMenu(prompt, path); }; diff --git a/gui/src/components/FeedbackButtons.tsx b/gui/src/components/FeedbackButtons.tsx index 4d1284d9a..f03c02f2c 100644 --- a/gui/src/components/FeedbackButtons.tsx +++ b/gui/src/components/FeedbackButtons.tsx @@ -21,13 +21,14 @@ export function FeedbackButtons({ item }: FeedbackButtonsProps) { setFeedback(feedback); if (item.promptLogs?.length) { for (const promptLog of item.promptLogs) { - const { modelTitle, ...logData } = promptLog; + const { modelTitle, modelProvider, ...logData } = promptLog; ideMessenger.post("devdata/log", { name: "chatFeedback", data: { ...logData, - modelProvider: "unknown", + modelProvider: modelProvider || "unknown", modelName: modelTitle, + modelTitle: modelTitle, feedback, sessionId, }, diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 26a02f846..543f3273f 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -3,7 +3,6 @@ import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; import { getRuleId } from "core/llm/rules/getSystemMessageWithRules"; import { ToCoreProtocol } from "core/protocol"; import { BuiltInToolNames } from "core/tools/builtIn"; -import posthog from "posthog-js"; import { selectActiveTools } from "../selectors/selectActiveTools"; import { selectUseSystemMessageTools } from "../selectors/selectUseSystemMessageTools"; import { selectSelectedChatModel } from "../slices/configSlice"; @@ -27,9 +26,9 @@ import { addSystemMessageToolsToSystemMessage } from "core/tools/systemMessageTo import { interceptSystemToolCalls } from "core/tools/systemMessageTools/interceptSystemToolCalls"; import { SystemMessageToolCodeblocksFramework } from "core/tools/systemMessageTools/toolCodeblocks"; import { selectCurrentToolCalls } from "../selectors/selectToolCalls"; +import { DEFAULT_TOOL_SETTING } from "../slices/uiSlice"; import { getBaseSystemMessage } from "../util/getBaseSystemMessage"; import { callToolById } from "./callToolById"; -import { DEFAULT_TOOL_SETTING } from "../slices/uiSlice"; /** * Handles the execution of tool calls that may be automatically accepted. * Sets all tools as generated first, then executes auto-approved tool calls. @@ -275,6 +274,7 @@ export const streamNormalInput = createAsyncThunk< completion: next.value.completion, modelProvider: selectedChatModel.underlyingProviderName, modelName: selectedChatModel.title, + modelTitle: selectedChatModel.title, sessionId: state.session.id, ...(!!activeTools.length && { tools: activeTools.map((tool) => tool.function.name), diff --git a/gui/src/redux/thunks/streamResponse.test.ts b/gui/src/redux/thunks/streamResponse.test.ts index f0c29c835..db4613b08 100644 --- a/gui/src/redux/thunks/streamResponse.test.ts +++ b/gui/src/redux/thunks/streamResponse.test.ts @@ -462,6 +462,7 @@ describe("streamResponseThunk", () => { completion: "Hi there!", modelProvider: "anthropic", modelName: "Claude 3.5 Sonnet", + modelTitle: "Claude 3.5 Sonnet", sessionId: "session-123", }, }); diff --git a/gui/src/util/editOutcomeLogger.ts b/gui/src/util/editOutcomeLogger.ts index 531bb5da3..124f11ed3 100644 --- a/gui/src/util/editOutcomeLogger.ts +++ b/gui/src/util/editOutcomeLogger.ts @@ -8,6 +8,7 @@ import { store } from "../redux/store"; function extractModelInfo(toolCallState: ToolCallState): { modelProvider: string; modelName: string; + modelTitle: string; } { // Get the conversation history to find the model info const history = store.getState().session.history; @@ -29,6 +30,7 @@ function extractModelInfo(toolCallState: ToolCallState): { return { modelProvider: modelParts[0] || "unknown", modelName: modelParts[1] || String(assistantMessage.message.model), + modelTitle: modelParts[1] || String(assistantMessage.message.model), }; } @@ -39,6 +41,7 @@ function extractModelInfo(toolCallState: ToolCallState): { return { modelProvider: chatModel?.provider || "unknown", modelName: chatModel?.model || "unknown", + modelTitle: chatModel?.model || "unknown", }; } diff --git a/packages/config-yaml/src/schemas/data/chatFeedback/index.ts b/packages/config-yaml/src/schemas/data/chatFeedback/index.ts index e42468a34..d68648fe7 100644 --- a/packages/config-yaml/src/schemas/data/chatFeedback/index.ts +++ b/packages/config-yaml/src/schemas/data/chatFeedback/index.ts @@ -4,6 +4,7 @@ import { baseDevDataAllSchema } from "../base.js"; export const chatFeedbackEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), modelName: z.string(), + modelTitle: z.string(), completionOptions: z.object({}), prompt: z.string(), completion: z.string(), diff --git a/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts b/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts index 796a2f375..f3ea4408e 100644 --- a/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts +++ b/packages/config-yaml/src/schemas/data/chatFeedback/v0.1.0.ts @@ -1,7 +1,6 @@ import { chatFeedbackEventAllSchema } from "./index.js"; export const chatFeedbackEventSchema_0_1_0 = chatFeedbackEventAllSchema.pick({ - modelProvider: true, modelName: true, completionOptions: true, prompt: true, diff --git a/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts b/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts index 2ec80fb0e..3b71754d6 100644 --- a/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/chatFeedback/v0.2.0.ts @@ -14,6 +14,7 @@ export const chatFeedbackEventSchema_0_2_0 = chatFeedbackEventAllSchema.pick({ completion: true, modelProvider: true, modelName: true, + modelTitle: true, feedback: true, sessionId: true, }); diff --git a/packages/config-yaml/src/schemas/data/chatInteraction/index.ts b/packages/config-yaml/src/schemas/data/chatInteraction/index.ts index b6a68f3e3..8b4208a0a 100644 --- a/packages/config-yaml/src/schemas/data/chatInteraction/index.ts +++ b/packages/config-yaml/src/schemas/data/chatInteraction/index.ts @@ -4,6 +4,7 @@ import { baseDevDataAllSchema } from "../base.js"; export const chatInteractionEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), modelName: z.string(), + modelTitle: z.string(), prompt: z.string(), completion: z.string(), sessionId: z.string(), diff --git a/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts b/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts index 54999139a..dd7ef4bda 100644 --- a/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts @@ -14,6 +14,7 @@ export const chatInteractionEventSchema_0_2_0 = prompt: true, completion: true, modelName: true, + modelTitle: true, modelProvider: true, sessionId: true, tools: true, diff --git a/packages/config-yaml/src/schemas/data/editInteraction/index.ts b/packages/config-yaml/src/schemas/data/editInteraction/index.ts index d20ed39aa..ce0f875a2 100644 --- a/packages/config-yaml/src/schemas/data/editInteraction/index.ts +++ b/packages/config-yaml/src/schemas/data/editInteraction/index.ts @@ -7,6 +7,7 @@ import { baseDevDataAllSchema } from "../base.js"; export const editInteractionEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), modelName: z.string(), + modelTitle: z.string(), prompt: z.string(), completion: z.string(), filepath: z.string(), diff --git a/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts b/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts index b96c9c0a1..7ef121b68 100644 --- a/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/editInteraction/v0.2.0.ts @@ -14,6 +14,7 @@ export const editInteractionEventSchema_0_2_0 = prompt: true, completion: true, modelName: true, + modelTitle: true, modelProvider: true, filepath: true, }); diff --git a/packages/config-yaml/src/schemas/data/editOutcome/index.ts b/packages/config-yaml/src/schemas/data/editOutcome/index.ts index 15a8cab35..096e6cdb3 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/index.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/index.ts @@ -4,6 +4,7 @@ import { baseDevDataAllSchema } from "../base.js"; export const editOutcomeEventAllSchema = baseDevDataAllSchema.extend({ modelProvider: z.string(), modelName: z.string(), + modelTitle: z.string(), prompt: z.string(), completion: z.string(), previousCode: z.string(), diff --git a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts index 2050b3482..c2c283a9c 100644 --- a/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/editOutcome/v0.2.0.ts @@ -13,6 +13,7 @@ export const editOutcomeEventSchema_0_2_0 = editOutcomeEventAllSchema.pick({ prompt: true, completion: true, modelName: true, + modelTitle: true, modelProvider: true, accepted: true, previousCode: true, diff --git a/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts b/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts index b74f873f5..11f23011b 100644 --- a/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts +++ b/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts @@ -17,4 +17,5 @@ export const nextEditEventAllSchema = baseDevDataAllSchema.extend({ context: z.string(), modelProvider: z.string(), modelName: z.string(), + modelTitle: z.string(), }); diff --git a/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts b/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts index 4267abd88..70c3546ca 100644 --- a/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts @@ -20,6 +20,7 @@ export const nextEditEventSchema_0_2_0 = nextEditEventAllSchema.pick({ context: true, modelProvider: true, modelName: true, + modelTitle: true, }); export const nextEditEventSchema_0_2_0_noCode = nextEditEventSchema_0_2_0.omit({ From 9a2b36ff6e3b87406d08483d739be13b6266b317 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 13 Aug 2025 22:12:33 -0700 Subject: [PATCH 128/174] fix types --- core/data/log.vitest.ts | 1 + core/edit/recursiveStream.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/core/data/log.vitest.ts b/core/data/log.vitest.ts index 44af63358..25defe504 100644 --- a/core/data/log.vitest.ts +++ b/core/data/log.vitest.ts @@ -35,6 +35,7 @@ const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = { completion: "Hello, world!", modelProvider: "openai", modelName: "gpt-4", + modelTitle: "gpt-4", sessionId: "1234", tools: ["test-tool1"], }, diff --git a/core/edit/recursiveStream.ts b/core/edit/recursiveStream.ts index d249755f4..35678c892 100644 --- a/core/edit/recursiveStream.ts +++ b/core/edit/recursiveStream.ts @@ -7,6 +7,7 @@ const INFINITE_STREAM_SAFETY = 0.9; const DUD_PROMPT_LOG: PromptLog = { modelTitle: "", + modelProvider: "", completionOptions: { model: "" }, prompt: "", completion: "", From fee2a15d115d5b5af70cadae28e16f89ed20f6ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 09:23:39 +0000 Subject: [PATCH 129/174] chore(deps): bump JetBrains/qodana-action from 2025.1.1 to 2025.2.1 Bumps [JetBrains/qodana-action](https://github.com/jetbrains/qodana-action) from 2025.1.1 to 2025.2.1. - [Release notes](https://github.com/jetbrains/qodana-action/releases) - [Commits](https://github.com/jetbrains/qodana-action/compare/v2025.1.1...v2025.2.1) --- updated-dependencies: - dependency-name: JetBrains/qodana-action dependency-version: 2025.2.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index a0aa2d3f0..ab2465f52 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -493,7 +493,7 @@ jobs: # Run Qodana inspections - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2025.1.1 + uses: JetBrains/qodana-action@v2025.2.1 with: cache-default-branch-only: true From 10b9e06994d3c62e91f05835a64e4cca42613600 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Thu, 14 Aug 2025 17:34:00 +0530 Subject: [PATCH 130/174] reduce separation by a thin line margin --- gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx b/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx index 14485a56f..dfdcfb5ca 100644 --- a/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx +++ b/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx @@ -117,7 +117,9 @@ export function RunTerminalCommand(props: RunTerminalCommandToolCallProps) { {processedTerminalContent.limitedContent} } From b53e6326d213c1ff9ceb2cb7d964cf80d3f89897 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Thu, 14 Aug 2025 17:48:16 +0530 Subject: [PATCH 131/174] chore: add premature close to telemetry --- core/llm/streamChat.ts | 224 ++++++++++++++++++++++------------------- 1 file changed, 123 insertions(+), 101 deletions(-) diff --git a/core/llm/streamChat.ts b/core/llm/streamChat.ts index 2692195e2..b09cf9ce0 100644 --- a/core/llm/streamChat.ts +++ b/core/llm/streamChat.ts @@ -48,114 +48,136 @@ export async function* llmStreamChat( }, }; - if (legacySlashCommandData) { - const { command, contextItems, historyIndex, input, selectedCode } = - legacySlashCommandData; - const slashCommand = config.slashCommands?.find( - (sc) => sc.name === command.name, - ); - if (!slashCommand) { - throw new Error(`Unknown slash command ${command.name}`); - } - void Telemetry.capture( - "useSlashCommand", - { - name: command.name, - }, - true, - ); - if (!slashCommand.run) { - console.error( - `Slash command ${command.name} (${command.source}) has no run function`, + try { + if (legacySlashCommandData) { + const { command, contextItems, historyIndex, input, selectedCode } = + legacySlashCommandData; + const slashCommand = config.slashCommands?.find( + (sc) => sc.name === command.name, ); - throw new Error(`Slash command not found`); - } - - const gen = slashCommand.run({ - input, - history: messages, - llm: model, - contextItems, - params: command.params, - ide, - addContextItem: (item) => { - void messenger.request("addContextItem", { - item, - historyIndex, - }); - }, - selectedCode, - config, - fetch: (url, init) => - fetchwithRequestOptions( - url, - { - ...init, - signal: abortController.signal, - }, - config.requestOptions, - ), - completionOptions, - abortController, - }); - let next = await gen.next(); - while (!next.done) { - if (abortController.signal.aborted) { - next = await gen.return(errorPromptLog); - break; + if (!slashCommand) { + throw new Error(`Unknown slash command ${command.name}`); } - if (next.value) { - yield { - role: "assistant", - content: next.value, - }; - } - next = await gen.next(); - } - if (!next.done) { - throw new Error("Will never happen"); - } - - return next.value; - } else { - const gen = model.streamChat( - messages, - abortController.signal, - completionOptions, - messageOptions, - ); - let next = await gen.next(); - while (!next.done) { - if (abortController.signal.aborted) { - next = await gen.return(errorPromptLog); - break; + void Telemetry.capture( + "useSlashCommand", + { + name: command.name, + }, + true, + ); + if (!slashCommand.run) { + console.error( + `Slash command ${command.name} (${command.source}) has no run function`, + ); + throw new Error(`Slash command not found`); } - const chunk = next.value; + const gen = slashCommand.run({ + input, + history: messages, + llm: model, + contextItems, + params: command.params, + ide, + addContextItem: (item) => { + void messenger.request("addContextItem", { + item, + historyIndex, + }); + }, + selectedCode, + config, + fetch: (url, init) => + fetchwithRequestOptions( + url, + { + ...init, + signal: abortController.signal, + }, + config.requestOptions, + ), + completionOptions, + abortController, + }); + let next = await gen.next(); + while (!next.done) { + if (abortController.signal.aborted) { + next = await gen.return(errorPromptLog); + break; + } + if (next.value) { + yield { + role: "assistant", + content: next.value, + }; + } + next = await gen.next(); + } + if (!next.done) { + throw new Error("Will never happen"); + } - yield chunk; - next = await gen.next(); + return next.value; + } else { + const gen = model.streamChat( + messages, + abortController.signal, + completionOptions, + messageOptions, + ); + let next = await gen.next(); + while (!next.done) { + if (abortController.signal.aborted) { + next = await gen.return(errorPromptLog); + break; + } + + const chunk = next.value; + + yield chunk; + next = await gen.next(); + } + if (config.experimental?.readResponseTTS && "completion" in next.value) { + void TTS.read(next.value?.completion); + } + + void Telemetry.capture( + "chat", + { + model: model.model, + provider: model.providerName, + }, + true, + ); + + void checkForFreeTrialExceeded(configHandler, messenger); + + if (!next.done) { + throw new Error("Will never happen"); + } + + return next.value; } - if (config.experimental?.readResponseTTS && "completion" in next.value) { - void TTS.read(next.value?.completion); + } catch (error) { + if ( + error instanceof Error && + error.message.toLowerCase().includes("premature close") + ) { + void Telemetry.capture( + "stream_premature_close_error", + { + model: model.model, + provider: model.providerName, + errorMessage: error.message, + context: legacySlashCommandData ? "slash_command" : "regular_chat", + ...(legacySlashCommandData && { + command: legacySlashCommandData.command.name, + }), + }, + false, + ); } - - void Telemetry.capture( - "chat", - { - model: model.model, - provider: model.providerName, - }, - true, - ); - - void checkForFreeTrialExceeded(configHandler, messenger); - - if (!next.done) { - throw new Error("Will never happen"); - } - - return next.value; + throw error; } } From 3ebdbcc37c05dbfd3c6c14c21fdf17e02d286731 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 07:08:24 -0700 Subject: [PATCH 132/174] test: use current branch for gh action --- .github/workflows/continue-general-review.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index 6a8a337f9..bbe4f5ff6 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Continue PR Review Action - uses: continuedev/continue/pr-review-action@main + uses: continuedev/continue/pr-review-action@tomasz/con-3480 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'continuedev' From b241ad67a8ca0d8171e975b41c7d39fef16e8d55 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 07:13:29 -0700 Subject: [PATCH 133/174] improv: remove unnecessary fetch-depth --- .github/workflows/continue-detailed-review.yaml | 8 +++----- pr-review-action/action.yml | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 488856df3..275b1cc70 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -34,8 +34,6 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - fetch-depth: 0 # Fetch full history for better context - name: Setup Node.js uses: actions/setup-node@v4 @@ -85,7 +83,7 @@ jobs: Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. IMPORTANT: The diff below has been annotated with [POS:N] markers showing the exact position for each line. - + Example of how to use the position markers: ``` diff --git a/src/app.js b/src/app.js @@ -103,7 +101,7 @@ jobs: [POS:1] let x = 1; [POS:2] + let y = 2; <-- To comment here, use position: 2 ``` - + To comment on a line, simply use the number from its [POS:N] marker as the position value. For example: {"path": "src/app.js", "position": 4, "body": "Avoid using eval with user input"} @@ -154,7 +152,7 @@ jobs: - name: Run Continue CLI Inline Review run: | echo "Running Continue CLI for inline review..." - + # Log the prompt for debugging echo "===== START REVIEW PROMPT =====" head -n 50 inline_review_prompt.txt diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml index 2550e0324..1e1d4141e 100644 --- a/pr-review-action/action.yml +++ b/pr-review-action/action.yml @@ -18,8 +18,6 @@ runs: steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch full history for better context - name: Check Authorization shell: bash From 833443cacfb9941fa5f34edcc78044568542dec7 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 07:15:31 -0700 Subject: [PATCH 134/174] fix: add missing token --- pr-review-action/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml index 1e1d4141e..783b20d8b 100644 --- a/pr-review-action/action.yml +++ b/pr-review-action/action.yml @@ -65,6 +65,8 @@ runs: - name: Build PR Review Prompt if: env.SHOULD_RUN == 'true' shell: bash + env: + GH_TOKEN: ${{ github.token }} run: | # Get PR number based on event type if [ "${{ github.event_name }}" = "pull_request" ]; then From d6ff7dae2d523499cd1b496d98b0ed16a089852b Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 10:05:10 -0700 Subject: [PATCH 135/174] fix: diff calculations --- .../workflows/continue-detailed-review.yaml | 21 +---- pr-review-action/scripts/annotate-diff.js | 83 +++++++++++++++++++ 2 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 pr-review-action/scripts/annotate-diff.js diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 275b1cc70..26e2530ae 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -59,22 +59,8 @@ jobs: # Get PR diff with context gh pr diff $PR_NUMBER --color=never > pr_diff.txt - # Annotate diff with position numbers for easy reference - awk ' - /^@@/ { - pos = 0 - print - next - } - /^diff --git/ || /^index / || /^--- / || /^\+\+\+ / { - print - next - } - { - pos++ - printf "[POS:%d] %s\n", pos, $0 - } - ' pr_diff.txt > pr_diff_annotated.txt + # Annotate diff with GitHub API positions + node ${{ github.workspace }}/pr-review-action/scripts/annotate-diff.js pr_diff.txt > pr_diff_annotated.txt # Create review prompt for inline comments cat > inline_review_prompt.txt << 'EOF' @@ -172,7 +158,7 @@ jobs: echo "Invalid JSON output from Continue CLI" echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json else - # Use the output directly since positions are already correct + # Positions are already correct from our annotation cp inline_review_raw.json inline_review.json echo "Review output:" cat inline_review.json @@ -302,7 +288,6 @@ jobs: inline_review_raw.json inline_review.json inline_review_prompt.txt - pr_files.json pr_diff.txt pr_diff_annotated.txt retention-days: 7 diff --git a/pr-review-action/scripts/annotate-diff.js b/pr-review-action/scripts/annotate-diff.js new file mode 100644 index 000000000..0c3d5f969 --- /dev/null +++ b/pr-review-action/scripts/annotate-diff.js @@ -0,0 +1,83 @@ +#!/usr/bin/env node + +/** + * Annotates a git diff with GitHub API positions + * + * Takes a raw diff and adds [POS:N] markers with the correct + * GitHub API positions (cumulative, with +1 between hunks) + */ + +const fs = require('fs'); + +function annotateDiff(diffContent) { + const lines = diffContent.split('\n'); + const output = []; + let githubPos = 0; + let inHunk = false; + + for (const line of lines) { + // Pass through git headers unchanged + if (line.startsWith('diff --git') || + line.startsWith('index ') || + line.startsWith('---') || + line.startsWith('+++') || + line.startsWith('rename ') || + line.startsWith('similarity ') || + line.startsWith('new file') || + line.startsWith('deleted file') || + line.startsWith('old mode') || + line.startsWith('new mode')) { + output.push(line); + continue; + } + + // Handle hunk headers + if (line.startsWith('@@')) { + if (inHunk) { + githubPos++; // GitHub's +1 between hunks + } + inHunk = true; + output.push(line); + continue; + } + + // Skip "no newline" marker + if (line.startsWith('\\ No newline')) { + output.push(line); + continue; + } + + // Annotate actual diff lines with GitHub positions + if (inHunk) { + githubPos++; + output.push(`[POS:${githubPos}] ${line}`); + } else { + output.push(line); + } + } + + return output.join('\n'); +} + +// Main +function main() { + // Read diff from stdin or file + let input = ''; + + if (process.argv.length > 2) { + // Read from file + input = fs.readFileSync(process.argv[2], 'utf8'); + } else { + // Read from stdin + input = fs.readFileSync(0, 'utf8'); + } + + const annotated = annotateDiff(input); + console.log(annotated); +} + +if (require.main === module) { + main(); +} + +module.exports = { annotateDiff }; \ No newline at end of file From bb6f936414fc894086e076bd0ea46e79b2e4794f Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 10:18:39 -0700 Subject: [PATCH 136/174] fix: position calculations --- .github/workflows/continue-detailed-review.yaml | 11 +++++++++++ pr-review-action/scripts/annotate-diff.js | 13 ++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 26e2530ae..bbad06f21 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -61,6 +61,11 @@ jobs: # Annotate diff with GitHub API positions node ${{ github.workspace }}/pr-review-action/scripts/annotate-diff.js pr_diff.txt > pr_diff_annotated.txt + + # Debug: Show sample of annotated diff + echo "=== SAMPLE OF ANNOTATED DIFF ===" + head -100 pr_diff_annotated.txt | grep -E "^\[POS:|^@@|^diff --git" || head -50 pr_diff_annotated.txt + echo "=== END SAMPLE ===" # Create review prompt for inline comments cat > inline_review_prompt.txt << 'EOF' @@ -225,6 +230,12 @@ jobs: body: comment.body })); + // Debug: Log the positions we're trying to use + console.log('Attempting to post comments with positions:'); + comments.forEach(c => { + console.log(` ${c.path}: position ${c.position}`); + }); + // Create the review if (comments.length > 0) { try { diff --git a/pr-review-action/scripts/annotate-diff.js b/pr-review-action/scripts/annotate-diff.js index 0c3d5f969..16f434d09 100644 --- a/pr-review-action/scripts/annotate-diff.js +++ b/pr-review-action/scripts/annotate-diff.js @@ -16,9 +16,16 @@ function annotateDiff(diffContent) { let inHunk = false; for (const line of lines) { - // Pass through git headers unchanged - if (line.startsWith('diff --git') || - line.startsWith('index ') || + // Handle new file - reset position counter + if (line.startsWith('diff --git')) { + githubPos = 0; + inHunk = false; + output.push(line); + continue; + } + + // Pass through other git headers unchanged + if (line.startsWith('index ') || line.startsWith('---') || line.startsWith('+++') || line.startsWith('rename ') || From 2f4a4f90ee247e4b52994d25ba5c6c73eb529804 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 10:31:19 -0700 Subject: [PATCH 137/174] fix: security --- pr-review-action/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml index 783b20d8b..7a9da5f5c 100644 --- a/pr-review-action/action.yml +++ b/pr-review-action/action.yml @@ -21,6 +21,9 @@ runs: - name: Check Authorization shell: bash + env: + # Only move the dangerous check to env to prevent shell injection + HAS_TRIGGER_PHRASE: ${{ contains(github.event.comment.body, '@continue-general-review') }} run: | # Check if this action should run based on event type and user permissions SHOULD_RUN="false" @@ -35,7 +38,7 @@ runs: fi elif [ "${{ github.event_name }}" = "issue_comment" ]; then # Check if it's a PR comment with the trigger phrase - if [ "${{ github.event.issue.pull_request }}" != "" ] && [[ "${{ github.event.comment.body }}" == *"@continue-general-review"* ]]; then + if [ "${{ github.event.issue.pull_request }}" != "" ] && [ "$HAS_TRIGGER_PHRASE" = "true" ]; then COMMENTER_ASSOC="${{ github.event.comment.author_association }}" if [ "$COMMENTER_ASSOC" = "OWNER" ] || [ "$COMMENTER_ASSOC" = "MEMBER" ] || [ "$COMMENTER_ASSOC" = "COLLABORATOR" ]; then SHOULD_RUN="true" From 7198b08aaacc6a3f44e9f5d90bd1aae02ad29865 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 10:36:25 -0700 Subject: [PATCH 138/174] test: hunks --- .github/workflows/pr-checks.yaml | 27 ++ .../scripts/annotate-diff.test.js | 239 ++++++++++++++++++ pr-review-action/scripts/package.json | 19 ++ 3 files changed, 285 insertions(+) create mode 100644 pr-review-action/scripts/annotate-diff.test.js create mode 100644 pr-review-action/scripts/package.json diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 6aa1429a8..cc208b26e 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -312,6 +312,32 @@ jobs: # GitHub does not have a way of requiring that all checks pass (you must manually select each job) # This action at least lets us manage the list of required tests via source control + pr-review-action-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Cache PR review action node modules + uses: actions/cache@v4 + id: pr-review-cache + with: + path: pr-review-action/scripts/node_modules + key: ${{ runner.os }}-pr-review-action-${{ hashFiles('pr-review-action/scripts/package.json') }} + + - name: Install dependencies + if: steps.pr-review-cache.outputs.cache-hit != 'true' + run: | + cd pr-review-action/scripts + npm install + + - name: Run tests + run: | + cd pr-review-action/scripts + npm test + # so that creators of new jobs can add them to this list require-all-checks-to-pass: if: always() @@ -328,6 +354,7 @@ jobs: - vscode-package-extension-linux - vscode-e2e-tests - jetbrains-tests + - pr-review-action-tests steps: - name: Decide whether the needed jobs succeeded or failed diff --git a/pr-review-action/scripts/annotate-diff.test.js b/pr-review-action/scripts/annotate-diff.test.js new file mode 100644 index 000000000..bc8d927cb --- /dev/null +++ b/pr-review-action/scripts/annotate-diff.test.js @@ -0,0 +1,239 @@ +const { annotateDiff } = require('./annotate-diff.js'); + +describe('annotateDiff', () => { + test('single file, single hunk', () => { + const diff = `diff --git a/file.js b/file.js +index abc123..def456 100644 +--- a/file.js ++++ b/file.js +@@ -1,3 +1,4 @@ + line1 + line2 ++added line + line3`; + + const result = annotateDiff(diff); + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] line2'); + expect(result).toContain('[POS:3] +added line'); + expect(result).toContain('[POS:4] line3'); + }); + + test('single file, multiple hunks with +1 between', () => { + const diff = `diff --git a/file.js b/file.js +index abc123..def456 100644 +--- a/file.js ++++ b/file.js +@@ -1,3 +1,3 @@ + line1 +-old line ++new line + line3 +@@ -10,3 +10,3 @@ + line10 +-old line 11 ++new line 11 + line12`; + + const result = annotateDiff(diff); + + // First hunk + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] -old line'); + expect(result).toContain('[POS:3] +new line'); + expect(result).toContain('[POS:4] line3'); + + // Second hunk (should start at 6, because 4 lines + 1 for between hunks) + expect(result).toContain('[POS:6] line10'); + expect(result).toContain('[POS:7] -old line 11'); + expect(result).toContain('[POS:8] +new line 11'); + expect(result).toContain('[POS:9] line12'); + }); + + test('multiple files reset position counter', () => { + const diff = `diff --git a/file1.js b/file1.js +index abc123..def456 100644 +--- a/file1.js ++++ b/file1.js +@@ -1,2 +1,2 @@ + line1 +-old ++new +diff --git a/file2.js b/file2.js +index abc123..def456 100644 +--- a/file2.js ++++ b/file2.js +@@ -1,2 +1,2 @@ + first +-old2 ++new2`; + + const result = annotateDiff(diff); + + // File 1 + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] -old'); + expect(result).toContain('[POS:3] +new'); + + // File 2 - positions should reset + const file2Section = result.split('diff --git a/file2.js')[1]; + expect(file2Section).toContain('[POS:1] first'); + expect(file2Section).toContain('[POS:2] -old2'); + expect(file2Section).toContain('[POS:3] +new2'); + }); + + test('handles new file', () => { + const diff = `diff --git a/newfile.js b/newfile.js +new file mode 100644 +index 0000000..abc123 +--- /dev/null ++++ b/newfile.js +@@ -0,0 +1,3 @@ ++line1 ++line2 ++line3`; + + const result = annotateDiff(diff); + expect(result).toContain('new file mode 100644'); + expect(result).toContain('[POS:1] +line1'); + expect(result).toContain('[POS:2] +line2'); + expect(result).toContain('[POS:3] +line3'); + }); + + test('handles deleted file', () => { + const diff = `diff --git a/deleted.js b/deleted.js +deleted file mode 100644 +index abc123..0000000 +--- a/deleted.js ++++ /dev/null +@@ -1,3 +0,0 @@ +-line1 +-line2 +-line3`; + + const result = annotateDiff(diff); + expect(result).toContain('deleted file mode 100644'); + expect(result).toContain('[POS:1] -line1'); + expect(result).toContain('[POS:2] -line2'); + expect(result).toContain('[POS:3] -line3'); + }); + + test('handles renamed file with changes', () => { + const diff = `diff --git a/old-name.js b/new-name.js +similarity index 95% +rename from old-name.js +rename to new-name.js +index abc123..def456 100644 +--- a/old-name.js ++++ b/new-name.js +@@ -1,3 +1,3 @@ + line1 +-old line ++new line + line3`; + + const result = annotateDiff(diff); + expect(result).toContain('rename from old-name.js'); + expect(result).toContain('rename to new-name.js'); + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] -old line'); + expect(result).toContain('[POS:3] +new line'); + }); + + test('handles no newline at end of file', () => { + const diff = `diff --git a/file.js b/file.js +index abc123..def456 100644 +--- a/file.js ++++ b/file.js +@@ -1,2 +1,2 @@ + line1 +-old line +\\ No newline at end of file ++new line +\\ No newline at end of file`; + + const result = annotateDiff(diff); + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] -old line'); + expect(result).toContain('\\ No newline at end of file'); + expect(result).toContain('[POS:3] +new line'); + expect(result).toContain('\\ No newline at end of file'); + // No newline markers should not get position numbers + expect(result).not.toContain('[POS:4] \\'); + }); + + test('handles file mode changes', () => { + const diff = `diff --git a/script.sh b/script.sh +old mode 100644 +new mode 100755 +index abc123..def456 100644 +--- a/script.sh ++++ b/script.sh +@@ -1,2 +1,2 @@ + #!/bin/bash +-echo "old" ++echo "new"`; + + const result = annotateDiff(diff); + expect(result).toContain('old mode 100644'); + expect(result).toContain('new mode 100755'); + expect(result).toContain('[POS:1] #!/bin/bash'); + expect(result).toContain('[POS:2] -echo "old"'); + expect(result).toContain('[POS:3] +echo "new"'); + }); + + test('empty diff returns empty', () => { + const diff = ''; + const result = annotateDiff(diff); + expect(result).toBe(''); + }); + + test('complex multi-file, multi-hunk diff', () => { + const diff = `diff --git a/src/app.js b/src/app.js +index abc123..def456 100644 +--- a/src/app.js ++++ b/src/app.js +@@ -10,4 +10,5 @@ function example() { + console.log("start"); + const x = 1; +- const y = 2; ++ const y = 3; ++ const z = 4; + return x + y; +@@ -20,3 +21,4 @@ function another() { + let a = 1; + let b = 2; ++ let c = 3; + return a + b; +diff --git a/src/util.js b/src/util.js +index 111111..222222 100644 +--- a/src/util.js ++++ b/src/util.js +@@ -1,2 +1,3 @@ ++import fs from 'fs'; + export function util() { + return true;`; + + const result = annotateDiff(diff); + + // src/app.js - first hunk + expect(result).toContain('[POS:1] console.log("start");'); + expect(result).toContain('[POS:2] const x = 1;'); + expect(result).toContain('[POS:3] - const y = 2;'); + expect(result).toContain('[POS:4] + const y = 3;'); + expect(result).toContain('[POS:5] + const z = 4;'); + expect(result).toContain('[POS:6] return x + y;'); + + // src/app.js - second hunk (7 = 6 + 1 for between hunks) + expect(result).toContain('[POS:8] let a = 1;'); + expect(result).toContain('[POS:9] let b = 2;'); + expect(result).toContain('[POS:10] + let c = 3;'); + expect(result).toContain('[POS:11] return a + b;'); + + // src/util.js - new file, positions reset + const utilSection = result.split('diff --git a/src/util.js')[1]; + expect(utilSection).toContain('[POS:1] +import fs from \'fs\';'); + expect(utilSection).toContain('[POS:2] export function util() {'); + expect(utilSection).toContain('[POS:3] return true;'); + }); +}); \ No newline at end of file diff --git a/pr-review-action/scripts/package.json b/pr-review-action/scripts/package.json new file mode 100644 index 000000000..2fe6f122b --- /dev/null +++ b/pr-review-action/scripts/package.json @@ -0,0 +1,19 @@ +{ + "name": "@continue/pr-review-scripts", + "version": "1.0.0", + "private": true, + "description": "Scripts for Continue PR Review Action", + "scripts": { + "test": "jest", + "test:watch": "jest --watch" + }, + "devDependencies": { + "jest": "^29.7.0" + }, + "jest": { + "testEnvironment": "node", + "testMatch": [ + "**/*.test.js" + ] + } +} \ No newline at end of file From 8072c7131c4452670bede36306f66ad28137b548 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 14 Aug 2025 10:43:52 -0700 Subject: [PATCH 139/174] Update MCP context provider description to "MCP Resources" --- core/context/providers/MCPContextProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/context/providers/MCPContextProvider.ts b/core/context/providers/MCPContextProvider.ts index 0336c2ec3..ce27eb458 100644 --- a/core/context/providers/MCPContextProvider.ts +++ b/core/context/providers/MCPContextProvider.ts @@ -18,7 +18,7 @@ class MCPContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { title: "mcp", displayTitle: "MCP", - description: "Model Context Protocol", + description: "MCP Resources", type: "submenu", renderInlineAs: "", }; @@ -29,7 +29,7 @@ class MCPContextProvider extends BaseContextProvider { ? `${this.options["serverName"]} resources` : "MCP", renderInlineAs: "", - description: "Model Context Protocol", + description: "MCP Resources", type: "submenu", }; } From ccf1990f2d97f344d75ebe9ca67cd934da685415 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 10:46:54 -0700 Subject: [PATCH 140/174] improv: handle edge cases --- pr-review-action/scripts/annotate-diff.js | 10 +- .../scripts/annotate-diff.test.js | 126 +++++++++++++++++- 2 files changed, 130 insertions(+), 6 deletions(-) diff --git a/pr-review-action/scripts/annotate-diff.js b/pr-review-action/scripts/annotate-diff.js index 16f434d09..54b651ceb 100644 --- a/pr-review-action/scripts/annotate-diff.js +++ b/pr-review-action/scripts/annotate-diff.js @@ -33,7 +33,8 @@ function annotateDiff(diffContent) { line.startsWith('new file') || line.startsWith('deleted file') || line.startsWith('old mode') || - line.startsWith('new mode')) { + line.startsWith('new mode') || + line.startsWith('Binary files')) { output.push(line); continue; } @@ -48,9 +49,12 @@ function annotateDiff(diffContent) { continue; } - // Skip "no newline" marker + // Handle "no newline" marker - it counts as a position but isn't annotated if (line.startsWith('\\ No newline')) { - output.push(line); + if (inHunk) { + githubPos++; // GitHub counts this as a position + } + output.push(line); // Don't annotate it continue; } diff --git a/pr-review-action/scripts/annotate-diff.test.js b/pr-review-action/scripts/annotate-diff.test.js index bc8d927cb..28a527a2c 100644 --- a/pr-review-action/scripts/annotate-diff.test.js +++ b/pr-review-action/scripts/annotate-diff.test.js @@ -155,11 +155,14 @@ index abc123..def456 100644 const result = annotateDiff(diff); expect(result).toContain('[POS:1] line1'); expect(result).toContain('[POS:2] -old line'); + // Position 3 is the first "No newline" marker (not annotated but counted) expect(result).toContain('\\ No newline at end of file'); - expect(result).toContain('[POS:3] +new line'); + expect(result).toContain('[POS:4] +new line'); // Position 4 due to "No newline" at position 3 + // Position 5 is the second "No newline" marker (not annotated but counted) expect(result).toContain('\\ No newline at end of file'); - // No newline markers should not get position numbers - expect(result).not.toContain('[POS:4] \\'); + // No newline markers should not get [POS:N] annotations + expect(result).not.toContain('[POS:3] \\'); + expect(result).not.toContain('[POS:5] \\'); }); test('handles file mode changes', () => { @@ -188,6 +191,123 @@ index abc123..def456 100644 expect(result).toBe(''); }); + test('handles binary files - modified', () => { + const diff = `diff --git a/image.png b/image.png +index abc123..def456 100644 +Binary files a/image.png and b/image.png differ`; + + const result = annotateDiff(diff); + expect(result).toContain('diff --git a/image.png b/image.png'); + expect(result).toContain('Binary files a/image.png and b/image.png differ'); + // Binary files line should not be annotated + expect(result).not.toContain('[POS:'); + }); + + test('handles binary files - added', () => { + const diff = `diff --git a/newimage.png b/newimage.png +new file mode 100644 +index 0000000..abc123 +Binary files /dev/null and b/newimage.png differ`; + + const result = annotateDiff(diff); + expect(result).toContain('diff --git a/newimage.png b/newimage.png'); + expect(result).toContain('new file mode 100644'); + expect(result).toContain('Binary files /dev/null and b/newimage.png differ'); + // Binary files line should not be annotated + expect(result).not.toContain('[POS:'); + }); + + test('handles binary files - deleted', () => { + const diff = `diff --git a/oldimage.png b/oldimage.png +deleted file mode 100644 +index abc123..0000000 +Binary files a/oldimage.png and /dev/null differ`; + + const result = annotateDiff(diff); + expect(result).toContain('diff --git a/oldimage.png b/oldimage.png'); + expect(result).toContain('deleted file mode 100644'); + expect(result).toContain('Binary files a/oldimage.png and /dev/null differ'); + // Binary files line should not be annotated + expect(result).not.toContain('[POS:'); + }); + + test('handles mixed text and binary files', () => { + const diff = `diff --git a/text.js b/text.js +index abc123..def456 100644 +--- a/text.js ++++ b/text.js +@@ -1,2 +1,2 @@ + line1 +-old ++new +diff --git a/image.png b/image.png +index 111111..222222 100644 +Binary files a/image.png and b/image.png differ +diff --git a/another.js b/another.js +index 333333..444444 100644 +--- a/another.js ++++ b/another.js +@@ -1,1 +1,1 @@ +-foo ++bar`; + + const result = annotateDiff(diff); + + // First file (text) + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] -old'); + expect(result).toContain('[POS:3] +new'); + + // Second file (binary) - no positions + expect(result).toContain('Binary files a/image.png and b/image.png differ'); + + // Third file (text) - positions reset + const lastFileSection = result.split('diff --git a/another.js')[1]; + expect(lastFileSection).toContain('[POS:1] -foo'); + expect(lastFileSection).toContain('[POS:2] +bar'); + }); + + test('multiple no newline markers accumulate positions', () => { + const diff = `diff --git a/file.js b/file.js +index abc123..def456 100644 +--- a/file.js ++++ b/file.js +@@ -1,3 +1,3 @@ + line1 +-old1 +\\ No newline at end of file ++new1 +\\ No newline at end of file +@@ -10,3 +10,3 @@ + line10 +-old2 +\\ No newline at end of file ++new2 +\\ No newline at end of file`; + + const result = annotateDiff(diff); + + // First hunk + expect(result).toContain('[POS:1] line1'); + expect(result).toContain('[POS:2] -old1'); + // Position 3 is the first "No newline" marker + expect(result).toContain('[POS:4] +new1'); + // Position 5 is the second "No newline" marker + + // Second hunk (starts at position 7 = 5 + 1 for between hunks + 1) + expect(result).toContain('[POS:7] line10'); + expect(result).toContain('[POS:8] -old2'); + // Position 9 is the third "No newline" marker + expect(result).toContain('[POS:10] +new2'); + // Position 11 is the fourth "No newline" marker + + // Verify "No newline" markers are not annotated + expect(result).not.toContain('[POS:3] \\'); + expect(result).not.toContain('[POS:5] \\'); + expect(result).not.toContain('[POS:9] \\'); + expect(result).not.toContain('[POS:11] \\'); + }); + test('complex multi-file, multi-hunk diff', () => { const diff = `diff --git a/src/app.js b/src/app.js index abc123..def456 100644 From 2129089da821ba31d246e4637edc634ac26f5e77 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 14 Aug 2025 10:54:18 -0700 Subject: [PATCH 141/174] improv: security and validation --- pr-review-action/action.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pr-review-action/action.yml b/pr-review-action/action.yml index 7a9da5f5c..ac9c992a5 100644 --- a/pr-review-action/action.yml +++ b/pr-review-action/action.yml @@ -141,6 +141,10 @@ runs: - name: Run Continue CLI Review if: env.SHOULD_RUN == 'true' shell: bash + env: + CONTINUE_API_KEY: ${{ inputs.continue-api-key }} + CONTINUE_ORG: ${{ inputs.continue-org }} + CONTINUE_CONFIG: ${{ inputs.continue-config }} run: | echo "Running Continue CLI with prompt:" echo "==================================" @@ -148,10 +152,19 @@ runs: echo "==================================" echo "" - # Run the CLI with provided config - cat review_prompt.txt | cn --readonly --org ${{ inputs.continue-org }} --config ${{ inputs.continue-config }} -p > code_review.md - env: - CONTINUE_API_KEY: ${{ inputs.continue-api-key }} + # Validate inputs to prevent command injection + if [[ ! "$CONTINUE_ORG" =~ ^[a-zA-Z0-9_-]+$ ]]; then + echo "Error: Invalid organization name. Must contain only alphanumeric characters, hyphens, and underscores." + exit 1 + fi + + if [[ ! "$CONTINUE_CONFIG" =~ ^[a-zA-Z0-9_/-]+$ ]]; then + echo "Error: Invalid config path. Must contain only alphanumeric characters, hyphens, underscores, and forward slashes." + exit 1 + fi + + # Run the CLI with validated config + cat review_prompt.txt | cn --readonly --org "$CONTINUE_ORG" --config "$CONTINUE_CONFIG" -p > code_review.md - name: Upload Review Results if: env.SHOULD_RUN == 'true' && always() From c0e9cfd5567928ca8a3048b329571d0aefbf4b01 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 14 Aug 2025 12:00:52 -0700 Subject: [PATCH 142/174] feat: use s/r for gpt-5 (#7153) --- gui/src/redux/thunks/streamNormalInput.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index e2f645858..e5f7ef2e9 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -3,7 +3,6 @@ import { LLMFullCompletionOptions, ModelDescription, Tool } from "core"; import { getRuleId } from "core/llm/rules/getSystemMessageWithRules"; import { ToCoreProtocol } from "core/protocol"; import { BuiltInToolNames } from "core/tools/builtIn"; -import posthog from "posthog-js"; import { selectActiveTools } from "../selectors/selectActiveTools"; import { selectUseSystemMessageTools } from "../selectors/selectUseSystemMessageTools"; import { selectSelectedChatModel } from "../slices/configSlice"; @@ -27,9 +26,9 @@ import { addSystemMessageToolsToSystemMessage } from "core/tools/systemMessageTo import { interceptSystemToolCalls } from "core/tools/systemMessageTools/interceptSystemToolCalls"; import { SystemMessageToolCodeblocksFramework } from "core/tools/systemMessageTools/toolCodeblocks"; import { selectCurrentToolCalls } from "../selectors/selectToolCalls"; +import { DEFAULT_TOOL_SETTING } from "../slices/uiSlice"; import { getBaseSystemMessage } from "../util/getBaseSystemMessage"; import { callToolById } from "./callToolById"; -import { DEFAULT_TOOL_SETTING } from "../slices/uiSlice"; /** * Handles the execution of tool calls that may be automatically accepted. * Sets all tools as generated first, then executes auto-approved tool calls. @@ -126,8 +125,8 @@ function filterToolsForModel( * Determines whether to use search and replace tool instead of edit file * Right now we only know that this is reliable with Claude models */ -function shouldUseFindReplaceEdits(model: ModelDescription): boolean { - return model.model.includes("claude"); +function shouldUseFindReplaceEdits({ model }: ModelDescription): boolean { + return model.includes("claude") || model.includes("gpt-5"); } export const streamNormalInput = createAsyncThunk< From 1704df4f1e8a3fbe91e6433b75a94fd2b1445fdb Mon Sep 17 00:00:00 2001 From: BekahHW <34313413+BekahHW@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:20:59 -0400 Subject: [PATCH 143/174] feat: GEO updates for docs (#7083) --- .../rules/documentation-description-rule.md | 8 + docs/README.md | 2 +- docs/autocomplete/how-to-use-it.mdx | 5 +- docs/chat/how-to-use-it.mdx | 21 +-- docs/customization/mcp-tools.mdx | 8 +- docs/customization/models.mdx | 4 +- docs/customization/overview.mdx | 34 +++- docs/customization/rules.mdx | 2 +- docs/customize/context/codebase.mdx | 31 ++-- docs/customize/context/documentation.mdx | 46 +++--- docs/customize/custom-providers.mdx | 72 ++++----- docs/customize/deep-dives/autocomplete.mdx | 62 ++++---- docs/customize/deep-dives/configuration.mdx | 19 +-- .../customize/deep-dives/development-data.mdx | 5 +- docs/customize/deep-dives/mcp.mdx | 23 +-- .../deep-dives/model-capabilities.mdx | 41 ++--- docs/customize/deep-dives/prompts.mdx | 13 +- docs/customize/deep-dives/rules.mdx | 25 +-- docs/customize/deep-dives/slash-commands.mdx | 17 +- docs/customize/deep-dives/vscode-actions.mdx | 18 +-- .../customize/model-providers/_category_.json | 6 +- .../model-providers/more/SambaNova.mdx | 1 + .../model-providers/more/asksage.mdx | 1 + .../model-providers/more/cerebras.mdx | 1 + .../model-providers/more/cloudflare.mdx | 1 + .../customize/model-providers/more/cohere.mdx | 3 +- .../model-providers/more/deepinfra.mdx | 1 + .../model-providers/more/flowise.mdx | 1 + .../model-providers/more/function-network.mdx | 8 +- docs/customize/model-providers/more/groq.mdx | 4 +- .../more/huggingfaceinferenceapi.mdx | 1 + .../model-providers/more/ipex_llm.mdx | 1 + docs/customize/model-providers/more/kindo.mdx | 1 + .../model-providers/more/llamacpp.mdx | 1 + .../model-providers/more/llamafile.mdx | 1 + .../model-providers/more/lmstudio.mdx | 1 + .../model-providers/more/moonshot.mdx | 1 + docs/customize/model-providers/more/morph.mdx | 1 + docs/customize/model-providers/more/msty.mdx | 1 + .../model-providers/more/ncompass.mdx | 1 + .../customize/model-providers/more/nebius.mdx | 1 + .../customize/model-providers/more/novita.mdx | 1 + .../customize/model-providers/more/nvidia.mdx | 7 +- .../model-providers/more/openrouter.mdx | 11 +- .../more/openvino_model_server.mdx | 1 + .../model-providers/more/ovhcloud.mdx | 5 +- .../customize/model-providers/more/relace.mdx | 1 + .../model-providers/more/replicatellm.mdx | 1 + .../model-providers/more/sagemaker.mdx | 1 + .../model-providers/more/scaleway.mdx | 7 +- .../model-providers/more/siliconflow.mdx | 5 +- .../model-providers/more/textgenwebui.mdx | 1 + .../model-providers/more/together.mdx | 4 +- .../customize/model-providers/more/venice.mdx | 5 +- docs/customize/model-providers/more/vllm.mdx | 5 +- .../model-providers/more/watsonx.mdx | 1 + docs/customize/model-providers/overview.mdx | 85 ++++++++++ .../model-providers/top-level/anthropic.mdx | 16 +- .../model-providers/top-level/azure.mdx | 16 +- .../model-providers/top-level/bedrock.mdx | 20 +-- .../model-providers/top-level/deepseek.mdx | 12 +- .../model-providers/top-level/gemini.mdx | 14 +- .../model-providers/top-level/inception.mdx | 12 +- .../model-providers/top-level/mistral.mdx | 12 +- .../model-providers/top-level/ollama.mdx | 21 +-- .../model-providers/top-level/openai.mdx | 20 ++- .../model-providers/top-level/vertexai.mdx | 14 +- .../model-providers/top-level/xAI.mdx | 14 +- docs/customize/model-roles.mdx | 1 + docs/customize/model-roles/00-intro.mdx | 2 +- docs/customize/model-roles/autocomplete.mdx | 7 +- docs/customize/model-roles/chat.mdx | 14 +- docs/customize/model-roles/embeddings.mdx | 12 +- docs/customize/model-roles/reranking.mdx | 2 +- docs/customize/overview.mdx | 6 +- docs/customize/telemetry.mdx | 1 + docs/docs.json | 5 + docs/features/agent/context-selection.mdx | 5 + docs/features/agent/how-it-works.mdx | 17 +- docs/features/agent/how-to-customize.mdx | 14 +- docs/features/agent/model-setup.mdx | 16 +- docs/features/agent/plan-mode.mdx | 21 ++- docs/features/agent/quick-start.mdx | 64 +++++--- .../autocomplete/context-selection.mdx | 13 +- docs/features/autocomplete/how-it-works.mdx | 20 +-- .../autocomplete/how-to-customize.mdx | 7 +- docs/features/autocomplete/model-setup.mdx | 10 +- docs/features/autocomplete/quick-start.mdx | 16 +- docs/features/chat/context-selection.mdx | 26 ++-- docs/features/chat/how-it-works.mdx | 18 +-- docs/features/chat/how-to-customize.mdx | 7 + docs/features/chat/model-setup.mdx | 10 +- docs/features/chat/quick-start.mdx | 18 ++- docs/features/edit/context-selection.mdx | 12 +- docs/features/edit/how-it-works.mdx | 8 +- docs/features/edit/how-to-customize.mdx | 8 +- docs/features/edit/model-setup.mdx | 12 +- docs/features/edit/quick-start.mdx | 17 +- docs/features/plan/how-it-works.mdx | 5 +- docs/features/plan/quick-start.mdx | 12 +- docs/getting-started/extensions.mdx | 2 +- docs/getting-started/overview.mdx | 1 - .../build-your-own-context-provider.mdx | 17 +- docs/guides/cli.mdx | 27 ++-- docs/guides/custom-code-rag.mdx | 18 +-- docs/guides/how-to-self-host-a-model.mdx | 6 +- docs/guides/llama3.1.mdx | 18 +-- docs/guides/ollama-guide.mdx | 40 ++--- docs/guides/overview.mdx | 9 +- docs/guides/plan-mode-guide.mdx | 14 +- .../running-continue-without-internet.mdx | 6 +- docs/guides/set-up-codestral.mdx | 1 + docs/guides/understanding-assistants.mdx | 44 ++++-- docs/home.mdx | 7 +- docs/hub/assistants/create-an-assistant.mdx | 36 +++-- docs/hub/assistants/edit-an-assistant.mdx | 2 +- docs/hub/assistants/use-an-assistant.mdx | 13 +- docs/hub/blocks/block-types.mdx | 9 +- docs/hub/blocks/bundles.mdx | 8 +- docs/hub/blocks/create-a-block.mdx | 10 +- docs/hub/blocks/intro.mdx | 4 +- docs/hub/blocks/use-a-block.mdx | 6 +- docs/hub/governance/pricing.mdx | 1 + docs/hub/introduction.mdx | 1 + docs/index.mdx | 1 + docs/migrate-i18n.md | 72 --------- docs/reference.mdx | 9 +- docs/reference/json-reference.mdx | 38 ++--- docs/reference/yaml-migration.mdx | 1 + docs/replace-custom-plugins.md | 147 ------------------ docs/telemetry.mdx | 1 + docs/troubleshooting.mdx | 4 +- 132 files changed, 961 insertions(+), 824 deletions(-) create mode 100644 .continue/rules/documentation-description-rule.md create mode 100644 docs/customize/model-providers/overview.mdx delete mode 100644 docs/migrate-i18n.md delete mode 100644 docs/replace-custom-plugins.md diff --git a/.continue/rules/documentation-description-rule.md b/.continue/rules/documentation-description-rule.md new file mode 100644 index 000000000..17f62d2d0 --- /dev/null +++ b/.continue/rules/documentation-description-rule.md @@ -0,0 +1,8 @@ +--- +globs: docs/**/*.{md,mdx} +description: This rule applies to all documentation files to ensure consistent + SEO optimization and improve discoverability. It helps users and search + engines understand the content of each page before reading it. +--- + +Every file in the docs folder must include a 'description' field in its frontmatter that accurately summarizes the content of the page in 100-160 characters. The description should be concise, keyword-rich, and explain what users will learn or accomplish from the page. diff --git a/docs/README.md b/docs/README.md index ac4767e1e..b86adaf52 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Mintlify Starter Kit +## Mintlify Starter Kit Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including diff --git a/docs/autocomplete/how-to-use-it.mdx b/docs/autocomplete/how-to-use-it.mdx index 2f6eee23d..36a54ff6d 100644 --- a/docs/autocomplete/how-to-use-it.mdx +++ b/docs/autocomplete/how-to-use-it.mdx @@ -1,14 +1,15 @@ --- title: "Autocomplete" -sidebarTitle: "How To Use It" +sidebarTitle: "How To Use AI Autocomplete" icon: "circle-question" +description: "Learn how to use Continue's AI-powered code autocomplete feature with keyboard shortcuts for accepting, rejecting, or partially accepting inline suggestions as you type" --- -## How to use it +## How to Use AI Code Autocomplete in Continue Autocomplete provides inline code suggestions as you type. To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings. diff --git a/docs/chat/how-to-use-it.mdx b/docs/chat/how-to-use-it.mdx index 670edf6fb..3acf5f1b5 100644 --- a/docs/chat/how-to-use-it.mdx +++ b/docs/chat/how-to-use-it.mdx @@ -1,39 +1,40 @@ --- title: "Chat" -sidebarTitle: "How To Use It" +sidebarTitle: "How To Use AI Chat" icon: "circle-question" +description: "Learn how to use Continue's AI chat assistant to solve coding problems without leaving your IDE, including code context sharing, applying generated solutions, and switching between models" --- -## How to use it +## How to Use AI Chat in Continue for Coding Help Chat makes it easy to ask for help from an LLM without needing to leave the IDE. You send it a task, including any relevant information, and it replies with the text / code most likely to complete the task. If it does not give you what you want, then you can send follow up messages to clarify and adjust its approach until the task is completed. Chat is best used to understand and iterate on code or as a replacement for search engine queries. -## Type a request and press enter +## Send a Coding Question or Task to AI Chat -You send it a question, and it replies with an answer. You tell it to solve a problem, and it provides you a solution. You ask for some code, and it generates it. +To send a question, add it to the input box in the extention and press enter. You send it a question, and it replies with an answer. You tell it to solve a problem, and it provides you a solution. You ask for some code, and it generates it. -## Highlight a code section to include as context +## Add Code Context to AI Chat by Highlighting Code You select a code section with your mouse, press `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) to send it to the LLM, and then ask for it to be explained to you or request it to be refactored in some way. -## Reference context with the @ symbol +## Use @ to Include Project Context in AI Chat Responses -If there is information from the codebase, documentation, IDE, or other tools that you want to include as context, you can type @ to select and include it as context. You can learn more about how to use this in [Chat context selection](/features/chat/quick-start#3-use--for-additional-context). +If there is information from the codebase, documentation, IDE, or other tools that you want to include as context, you can type @ to select and include it as context. You can learn more about how to use this in [Chat context selection](/features/chat/quick-start#how-to-use-%40-for-additional-context). -## Apply generated code to your file +## Insert AI-Generated Code Changes Directly into Your File When the LLM replies with edits to a file, you can click the β€œApply” button. This will update the existing code in the editor to reflect the suggested changes. -## Start a fresh session for a new task +## How to Begin a New AI Chat Session for a Different Coding Task Once you complete a task and want to start a new one, press `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) to begin a new session, ensuring only relevant context for the next task is provided to the LLM. -## Switch between different models +## Change AI Models in Continue Chat for Different Coding Needs If you have configured multiple models, you can switch between models using the dropdown or by pressing `cmd/ctrl` + `’` diff --git a/docs/customization/mcp-tools.mdx b/docs/customization/mcp-tools.mdx index a23f7f840..8494b1384 100644 --- a/docs/customization/mcp-tools.mdx +++ b/docs/customization/mcp-tools.mdx @@ -1,8 +1,12 @@ --- title: "MCP Blocks" -description: "Model Context Protocol servers provide specialized functionality:" +description: "Learn how to use Model Context Protocol (MCP) blocks in Continue to integrate external tools, connect databases, and extend your development environment." --- +Model Context Protocol (MCP) blocks let Continue connect to external tools, systems, and databases by running MCP servers. + +These blocks make it possible to: + - **Enable integration** with external tools and systems - **Create extensible interfaces** for custom capabilities - **Support complex interactions** with your development environment @@ -11,6 +15,6 @@ description: "Model Context Protocol servers provide specialized functionality:" ![MCP Blocks Overview](/images/customization/images/mcp-blocks-overview-c9a104f9b586779c156f9cf34da197c2.png) -## Learn More +## Learn More About MCP Blocks Learn more in the [MCP deep dive](/customize/deep-dives/mcp), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. diff --git a/docs/customization/models.mdx b/docs/customization/models.mdx index 0c1e2cba3..9e9e2ffe0 100644 --- a/docs/customization/models.mdx +++ b/docs/customization/models.mdx @@ -12,8 +12,8 @@ description: "These blocks form the foundation of the entire assistant experienc ![Model Blocks Overview](/images/customization/images/model-blocks-overview-36c30e7e01928d7a9b5b26ff1639c34b.png) -## Learn More +## Learn More About Model Blocks -Continue supports [many model providers](/customization/models#openai), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have various roles like `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. +Continue supports [many model providers](/customize/model-providers/top-level/openai), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have various roles like `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](/customize/model-roles) and view [`models`](/reference#models) in the YAML Reference. diff --git a/docs/customization/overview.mdx b/docs/customization/overview.mdx index ad86194af..c96ece782 100644 --- a/docs/customization/overview.mdx +++ b/docs/customization/overview.mdx @@ -1,21 +1,39 @@ --- -title: "Overview" -description: "Continue can be deeply customized. For example you might:" +title: "Customization Overview" +description: "Learn how to customize Continue with model providers, context providers, slash commands, and tools to create your perfect AI coding assistant" --- -- **Change your Model Provider**. Continue allows you to choose your favorite or even add multiple model providers. This allows you to use different models for different tasks, or to try another model if you're not happy with the results from your current model. Continue supports all of the popular model providers, including OpenAI, Anthropic, Microsoft/Azure, Mistral, and more. You can even self host your own model provider if you'd like. Learn more about [model providers](/customize/model-providers/top-level/openai). -- **Select different models for specific tasks**. Different Continue features can use different models. We call these _model roles_. For example, you can use a different model for chat than you do for autocomplete. Learn more about [model roles](/customize/model-roles). -- **Add a Context Provider**. Context providers allow you to add information to your prompts, giving your LLM additional context to work with. Context providers allow you to reference snippets from your codebase, or lookup relevant documentation, or use a search engine to find information and much more. Learn more about [context providers](/customize/custom-providers). -- **Create a Slash Command**. Slash commands allow you to easily add custom functionality to Continue. You can use a slash command that allows you to generate a shell command from natural language, or perhaps generate a commit message, or create your own custom command to do whatever you want. Learn more about [slash commands](/customize/deep-dives/slash-commands). -- **Call external tools and functions**. Unchain your LLM with the power of tools using [Agent](/features/agent/quick-start). Add custom tools using [MCP Servers](/customization/mcp-tools) +Continue can be deeply customized to fit your specific development workflow and preferences. This guide covers the main ways you can customize Continue to enhance your coding experience. + +## Change Your Model Provider + +Continue allows you to choose your favorite or even add multiple model providers. This allows you to use different models for different tasks, or to try another model if you're not happy with the results from your current model. Continue supports all of the popular model providers, including OpenAI, Anthropic, Microsoft/Azure, Mistral, and more. You can even self host your own model provider if you'd like. Learn more about [model providers](/customize/model-providers/top-level/openai). + +## Select Different Models for Specific Tasks + +Different Continue features can use different models. We call these _model roles_. For example, you can use a different model for chat than you do for autocomplete. Learn more about [model roles](/customize/model-roles). + +## Add a Context Provider + +Context providers allow you to add information to your prompts, giving your LLM additional context to work with. Context providers allow you to reference snippets from your codebase, or lookup relevant documentation, or use a search engine to find information and much more. Learn more about [context providers](/customize/custom-providers). + +## Create a Slash Command + +Slash commands allow you to easily add custom functionality to Continue. You can use a slash command that allows you to generate a shell command from natural language, or perhaps generate a commit message, or create your own custom command to do whatever you want. Learn more about [slash commands](/customize/deep-dives/slash-commands). + +## Call External Tools and Functions + +Unchain your LLM with the power of tools using [Agent](/features/agent/quick-start). Add custom tools using [MCP Servers](/customization/mcp-tools) Whatever you choose, you'll probably start by editing your Assistant. -## Editing your assistant +## Edit Your Assistant You can easily access your assistant configuration from the Continue Chat sidebar. Open the sidebar by pressing `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) and click the Assistant selector above the main chat input. Then, you can hover over an assistant and click the `new window` (hub assistants) or `gear` (local assistants) icon. ![configure an assistant](/images/customization/images/configure-continue-a5c8c79f3304c08353f3fc727aa5da7e.png) +## Manage Your Assistant + - See [Editing Hub Assistants](/hub/assistants/edit-an-assistant) for more details on managing your hub assistant - See the [Config Deep Dive](/reference) for more details on configuring local assistants. diff --git a/docs/customization/rules.mdx b/docs/customization/rules.mdx index e0b405dd4..c3c153fb6 100644 --- a/docs/customization/rules.mdx +++ b/docs/customization/rules.mdx @@ -11,7 +11,7 @@ Think of these as the guardrails for your AI coding assistants: By implementing rules, you transform the AI from a generic coding assistant into a knowledgeable team member that understands your project's unique requirements and constraints. -### How Rules Work +## How Rules Work Your assistant detects rule blocks and applies the specified rules while in [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) modes. diff --git a/docs/customize/context/codebase.mdx b/docs/customize/context/codebase.mdx index 5cad74c59..13b147dd0 100644 --- a/docs/customize/context/codebase.mdx +++ b/docs/customize/context/codebase.mdx @@ -1,7 +1,8 @@ --- -title: "@Codebase" -description: Talk to your codebase +title: "How to Set Up @Codebase Context Provider in Continue" +description: Retrieve relevant context and answers from your codebase using embeddings and keyword search. keywords: [talk, embeddings, reranker, codebase, experimental] +sidebarTitle: "@Codebase" --- Continue indexes your codebase so that it can later automatically pull in the most relevant context from throughout your workspace. This is done via a combination of embeddings-based retrieval and keyword search. By default, all embeddings are calculated locally using `transformers.js` and stored locally in `~/.continue/index`. @@ -9,35 +10,41 @@ Continue indexes your codebase so that it can later automatically pull in the mo **Note:** `transformers.js` cannot be used in JetBrains IDEs. However, you can select a different embeddings model from [the list - here](../model-roles/embeddings.mdx). + here](../model-roles/embeddings). +## How to Use @Codebase and @Folder Context Providers + Currently, the codebase retrieval feature is available as the "codebase" and "folder" context providers. You can use them by typing `@Codebase` or `@Folder` in the input box, and then asking a question. The contents of the input box will be compared with the embeddings from the rest of the codebase (or folder) to determine relevant files. +### When @Codebase Context Provider Is Useful + Here are some common use cases where it can be useful: -- Asking high-level questions about your codebase +- **Asking high-level questions about your codebase** - "How do I add a new endpoint to the server?" - "Do we use VS Code's CodeLens feature anywhere?" - "Is there any code written already to convert HTML to markdown?" -- Generate code using existing samples as reference +- **Generate code using existing samples as reference** - "Generate a new React component with a date picker, using the same patterns as existing components" - "Write a draft of a CLI application for this project using Python's argparse" - "Implement the `foo` method in the `bar` class, following the patterns seen in other subclasses of `baz`. -- Use `@Folder` to ask questions about a specific folder, increasing the likelihood of relevant results +- **Use `@Folder` to ask questions about a specific folder, increasing the likelihood of relevant results** - "What is the main purpose of this folder?" - "How do we use VS Code's CodeLens API?" - Or any of the above examples, but with `@Folder` instead of `@Codebase` +### When @Codebase Context Provider Is Not Useful + Here are use cases where it is not useful: -- When you need the LLM to see _literally every_ file in your codebase +- **When you need the LLM to see _literally every_ file in your codebase** - "Find everywhere where the `foo` function is called" - "Review our codebase and find any spelling mistakes" -- Refactoring +- **Refactoring tasks** - "Add a new parameter to the `bar` function and update usages" -## Configuration +## How to Configure @Codebase Context Provider Settings There are a few options that let you configure the behavior of the `@codebase` context provider, which are the same for the `@folder` context provider: @@ -82,7 +89,7 @@ Final number of results to use after re-ranking (default: 5) Whether to use re-ranking, which will allow initial selection of `nRetrieve` results, then will use an LLM to select the top `nFinal` results (default: true) -## Ignore files during indexing +## How to Ignore Files During Indexing Continue respects `.gitignore` files in order to determine which files should not be indexed. If you'd like to exclude additional files, you can add them to a `.continueignore` file, which follows the exact same rules as `.gitignore`. @@ -92,6 +99,6 @@ If you want to see exactly what files Continue has indexed, the metadata is stor If you need to force a refresh of the index, reload the VS Code window with cmd/ctrl + shift + p + "Reload Window". -## Repository map +## How Repository Map Enhances Codebase Understanding -Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](../custom-providers#repository-map) during codebase retrieval, which allows the model to understand the structure of your codebase and use it to answer questions. Currently, the repository map only contains the filepaths in the codebase. +Models in the Claude 3, Llama 3.1/3.2, Gemini 1.5, and GPT-4o families will automatically use a [repository map](/customize/context/codebase#repository-map) during codebase retrieval, which allows the model to understand the structure of your codebase and use it to answer questions. Currently, the repository map only contains the filepaths in the codebase. diff --git a/docs/customize/context/documentation.mdx b/docs/customize/context/documentation.mdx index 76f0218c3..70bd47e02 100644 --- a/docs/customize/context/documentation.mdx +++ b/docs/customize/context/documentation.mdx @@ -1,5 +1,5 @@ --- -title: "@Docs" +title: "How to Set Up @Docs Context Provider in Continue" description: Learn how to access and search your project's documentation directly within Continue keywords: [ @@ -13,11 +13,12 @@ keywords: documentation, ] toc_max_heading_level: 5 +sidebarTitle: "@Docs" --- -The [`@Docs` context provider](../custom-providers#docs) allows you to efficiently reference documentation directly within Continue. +The `@Docs` context provider allows you to efficiently reference documentation directly within Continue. -## Enabling the `@Docs` context provider +## How to Enable the @Docs Context Provider To enable the `@Docs` context provider, add it to the list of context providers in your `config.json` file. @@ -41,7 +42,7 @@ To enable the `@Docs` context provider, add it to the list of context providers -## How It Works +## How the @Docs Context Provider Works The `@Docs` context provider works by @@ -50,13 +51,13 @@ The `@Docs` context provider works by 3. Storing the embeddings locally on your machine 4. Embedding chat input to include similar documentation chunks as context -## Indexing Your Own Documentation +## How to Index Your Own Documentation -### Hub `docs` Blocks +### Using Hub `docs` Blocks @Docs uses [`docs` blocks](../../hub/blocks/block-types#docs) in Assistants from the hub. Visit the hub to [explore `docs` blocks](https://hub.continue.dev/explore/docs) or [create your own](https://hub.continue.dev/new?type=block&blockType=docs). -### Through the `@Docs` Context Provider +### How to Add Documentation Through the @Docs Context Provider To add a single documentation site, we recommend using the **Add Documentation** Form within the GUI. This can be accessed @@ -79,7 +80,7 @@ Documentation sources may be suggested based on package files in your repo. This ![Add documentation form](/images/docs-form.png) -### In a configuration file +### How to Add Documentation in Configuration Files For bulk documentation site adds or edits, we recommend editing your global configuration file directly. Documentation sites are stored in an array within `docs` in your global configuration, as follows: @@ -111,13 +112,13 @@ See [the config reference](/reference) for all documentation site configuration Indexing will re-sync upon saving the configuration file. -## Configuration +## How to Configure @Docs Advanced Settings -### Using Your Embeddings Provider +### How to Use Your Custom Embeddings Provider If you have set up an [embeddings provider](../model-roles/embeddings.mdx), @docs will use your embeddings provider. Switching embeddings providers will trigger a re-index of all documentation sites in your configuration. -### Reranking +### How to Configure Reranking for Better Results As with [@Codebase context provider configuration](./codebase#configuration), you can adjust the reranking behavior of the `@Docs` context provider with the `nRetrieve`, `nFinal`, and `useReranking`. @@ -150,7 +151,7 @@ As with [@Codebase context provider configuration](./codebase#configuration), yo -### GitHub +### How to Set Up GitHub Token for GitHub Documentation The GitHub API rate limits public requests to 60 per hour. If you want to reliably index GitHub repos, you can add a github token to your config file: @@ -179,7 +180,7 @@ The GitHub API rate limits public requests to 60 per hour. If you want to reliab -### Local Crawling +### How to Enable Local Crawling for Private Documentation By default, Continue crawls documentation sites using a specialized crawling service that provides the best experience for most users and documentation sites. @@ -212,9 +213,12 @@ If your documentation is private, you can skip the default crawler and use a loc - The default local crawler is a lightweight tool that cannot render sites that are dynamically generated using JavaScript. If your sites need to be rendered, you can enable the experimental `Use Chromium for Docs Crawling` feature from your [User Settings Page](../settings) This will download and install Chromium to `~/.continue/.utils`, and use it as the local crawler. - - **Note:** Chromium crawling support is being deprecated and may be removed in future versions. + The default local crawler is a lightweight tool that cannot render sites that + are dynamically generated using JavaScript. If your sites need to be rendered, + you can enable the experimental `Use Chromium for Docs Crawling` feature from + your [User Settings Page](../settings) This will download and install Chromium + to `~/.continue/.utils`, and use it as the local crawler. **Note:** Chromium + crawling support is being deprecated and may be removed in future versions. Further notes: @@ -222,7 +226,7 @@ Further notes: - If the site is only locally accessible, the default crawler will fail anyways and fall back to the local crawler. `useLocalCrawling` is especially useful if the URL itself is confidential. - For GitHub Repos this has no effect because only the GitHub Crawler will be used, and if the repo is private it can only be accessed with a priveleged GitHub token anyways. -## Managing your docs indexes +## How to Manage Your Documentation Indexes You can view indexing statuses and manage your documentation sites from the `@docs indexes` section of the `More` page (three dots) @@ -239,9 +243,9 @@ You can also view the overall status of currently indexing docs from a hideable You can also use the following IDE command to force a re-index of all docs: `Continue: Docs Force Re-Index`. -## Examples +## Configuration Examples for Different Setups -### VS Code minimal setup +### How to Set Up @Docs in VS Code (Minimal Configuration) The following configuration example works out of the box for VS Code. This uses the built-in embeddings provider with no reranking. @@ -275,7 +279,7 @@ The following configuration example works out of the box for VS Code. This uses -### Jetbrains minimal setup +### How to Set Up @Docs in JetBrains IDEs (Minimal Configuration) Here is the equivalent minimal example for Jetbrains, which requires setting up an [embeddings provider](../model-roles/embeddings.mdx). @@ -318,7 +322,7 @@ Here is the equivalent minimal example for Jetbrains, which requires setting up -### Full-power setup (VS Code or Jetbrains) +### How to Set Up @Docs with Advanced Features (VS Code or JetBrains) The following configuration example includes: diff --git a/docs/customize/custom-providers.mdx b/docs/customize/custom-providers.mdx index 263f596b1..8e19b4359 100644 --- a/docs/customize/custom-providers.mdx +++ b/docs/customize/custom-providers.mdx @@ -7,7 +7,7 @@ As an example, say you are working on solving a new GitHub Issue. You type '@Iss ![Context Items](/images/customize/images/context-provider-example-0c96ff77286fa970b23dddfdc1fa986a.png) -## Context blocks +## How Do Context Blocks Work? You can add context providers to assistants using [`context` blocks](/hub/blocks/block-types#context). Explore available context blocks in [the hub](https://hub.continue.dev/explore/context). @@ -15,7 +15,7 @@ You can add context providers to assistants using [`context` blocks](/hub/blocks You can add any built-in context-providers in your config file as shown below: -### `@File` +### @File Context Provider – Reference Files in Your Workspace Reference any file in your current workspace. @@ -34,7 +34,7 @@ config.json { "contextProviders": [{ "name": "file" }] } ``` -### `@Code` +### @Code Context Provider – Reference Functions and Classes Reference specific functions or classes from throughout your project. @@ -53,7 +53,7 @@ config.json { "contextProviders": [{ "name": "code" }] } ``` -### `@Git Diff` +### @Git Diff Context Provider – Reference Branch Changes Reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing. @@ -72,7 +72,7 @@ config.json { "contextProviders": [{ "name": "diff" }] } ``` -### `@Current File` +### @Current File Context Provider – Reference the Active File Reference the currently open file. @@ -91,7 +91,7 @@ config.json { "contextProviders": [{ "name": "currentFile" }] } ``` -### `@Terminal` +### @Terminal Context Provider – Reference Last Terminal Command and Output Reference the last command you ran in your IDE's terminal and its output. @@ -110,7 +110,7 @@ config.json { "contextProviders": [{ "name": "terminal" }] } ``` -### `@Docs` +### @Docs Context Provider – Reference Documentation Site Content Reference the contents from any documentation site. @@ -131,9 +131,9 @@ config.json Note that this will only enable the `@Docs` context provider. -To use it, you need to add a documentation site to your config file. See the [docs](/customization/overview#documentation-context) page for more information. +To use it, you need to add a documentation site to your config file. See the [docs](/customize/overview#documentation-context) page for more information. -### `@Open` +### @Open Context Provider – Reference All Open Files or Pinned Files Reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files. @@ -155,7 +155,7 @@ config.json { "contextProviders": [{ "name": "open", "params": { "onlyPinned": true } }] } ``` -### `@Web` +### @Web Context Provider – Reference Relevant Web Pages Reference relevant pages from across the web, automatically determined from your input. @@ -179,7 +179,7 @@ config.json { "contextProviders": [{ "name": "web", "params": { "n": 5 } }] } ``` -### `@Codebase` +### @Codebase Context Provider – Reference Relevant Codebase Snippets Reference the most relevant snippets from your codebase. @@ -199,9 +199,9 @@ config.json { "contextProviders": [{ "name": "codebase" }] } ``` -Read more about indexing and retrieval [here](/customization/overview#codebase-context). +Read more about indexing and retrieval [here](/customize/overview#codebase-context). -### `@Folder` +### @Folder Context Provider – Reference Code from a Specific Folder Uses the same retrieval mechanism as `@Codebase`, but only on a single folder. @@ -220,7 +220,7 @@ config.json { "contextProviders": [{ "name": "folder" }] } ``` -### `@Search` +### @Search Context Provider – Reference Code Search Results Reference the results of codebase search, just like the results you would get from VS Code search. @@ -244,7 +244,7 @@ config.json This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep). -### `@Url` +### @Url Context Provider – Reference Content from a URL Reference the markdown converted contents of a given URL. @@ -264,7 +264,7 @@ config.json { "contextProviders": [{ "name": "url" }] } ``` -### `@Clipboard` +### @Clipboard Context Provider – Reference Clipboard Items Reference recent clipboard items @@ -284,7 +284,7 @@ config.json { "contextProviders": [{ "name": "clipboard" }] } ``` -### `@Tree` +### @Tree Context Provider – Reference Workspace File Structure Reference the structure of your current workspace. @@ -304,7 +304,7 @@ config.json { "contextProviders": [{ "name": "tree" }] } ``` -### `@Problems` +### @Problems Context Provider – Reference Problems in the Current File Get Problems from the current file. @@ -324,7 +324,7 @@ config.json { "contextProviders": [{ "name": "problems" }] } ``` -### `@Debugger` +### @Debugger Context Provider – Reference Debugger Local Variables Reference the contents of the local variables in the debugger. Currently only available in VS Code. @@ -348,7 +348,7 @@ config.json Uses the top _n_ levels (defaulting to 3) of the call stack for that thread. -### `@Repository Map` +### @Repository Map Context Provider – Reference Codebase Outline and Signatures Reference the outline of your codebase. By default, signatures are included along with file in the repo map. @@ -374,11 +374,11 @@ config.json Provides a list of files and the call signatures of top-level classes, functions, and methods in those files. This helps the model better understand how a particular piece of code relates to the rest of the codebase. -In the submenu that appears, you can select either `Entire codebase`, or specify a subfolder to generate the repostiory map from. +In the submenu that appears, you can select either `Entire codebase`, or specify a subfolder to generate the repository map from. -This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html). +This context provider is inspired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html). -### `@Operating System` +### @Operating System Context Provider – Reference System Architecture and Platform Reference the architecture and platform of your current operating system. @@ -398,7 +398,7 @@ config.json { "contextProviders": [{ "name": "os" }] } ``` -### Model Context Protocol +### Using the Model Context Protocol (MCP) in Continue The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports any MCP server with the MCP context provider. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then set up your configuration like this: @@ -437,7 +437,7 @@ config.json You'll then be able to type "@" and see "MCP" in the context providers dropdown. -### `@Issue` +### @Issue Context Provider – Reference GitHub Issue Conversations Reference the conversation in a GitHub issue. @@ -474,7 +474,7 @@ config.json Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited. -### `@Database` +### @Database Context Provider – Reference Database Table Schemas Reference table schemas from Sqlite, Postgres, MSSQL, and MySQL databases. @@ -559,7 +559,7 @@ Available connection types: - `mysql` - `sqlite` -### `@Google` +### @Google Context Provider – Reference Google Search Results Reference the results of a Google search. @@ -592,7 +592,7 @@ For example, type "@Google python tutorial" if you want to search and discuss wa Note: You can get an API key for free at [serper.dev](https://serper.dev). -### `@Gitlab Merge Request` +### @Gitlab Merge Request Context Provider – Reference GitLab Merge Requests Reference an open MR for this branch on GitLab. @@ -616,7 +616,7 @@ config.json You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope. -#### Using Self-Hosted GitLab +#### How to Use Self-Hosted GitLab You can specify the domain to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`. @@ -646,11 +646,11 @@ config.json } ``` -#### Filtering Comments +#### How to Provide Context by Filtering Comments If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`. -### `@Jira` +### @Jira Context Provider – Reference Jira Issues Reference the conversation in a Jira issue. @@ -718,7 +718,7 @@ You can override this query by setting the `issueQuery` parameter. You can set the `maxResults` parameter to limit the number of results returned. The default is `50`. -### `@Discord` +### @Discord Context Provider – Reference Messages in Discord Channels Reference the messages in a Discord channel. @@ -762,7 +762,7 @@ config.json Make sure to include your own [Bot Token](https://discord.com/developers/applications), and join it to your related server . If you want more granular control over which channels are searched, you can specify a list of channel IDs to search in. If you don't want to specify any channels, just include the guild id(Server ID) and all channels will be included. The provider only reads text channels. -### `@HTTP` +### @HTTP Context Provider – Reference Data from an HTTP Request The HttpContextProvider makes a POST request to the url passed in the configuration. The server must return 200 OK with a ContextItem object or an array of ContextItems. @@ -804,7 +804,7 @@ Response [ { "name": "", "description": "", "content": "" }]// OR{ "name": "", "description": "", "content": ""} ``` -### `@Commits` +### @Commits Context Provider – Reference Git Commit Metadata and Diffs Reference specific git commit metadata and diff or all of the recent commits. @@ -833,7 +833,7 @@ config.json The depth is how many commits will be loaded into the submenu, defaults to 50. The LastXCommitsDepth is how many recent commits will be included, defaults to 10. -### `@Greptile` +### @Greptile Context Provider – Query Greptile Index of Repo/Branch Query a [Greptile](https://www.greptile.com/) index of the current repo/branch. @@ -863,6 +863,6 @@ config.json } ``` -### Requesting Context Providers +### How to Request a New Context Provider in Continue Not seeing what you want? Create an issue [here](https://github.com/continuedev/continue/issues/new?assignees=TyDunn&labels=enhancement&projects=&template=feature-request-%F0%9F%92%AA.md&title=) to request a new Context Provider. diff --git a/docs/customize/deep-dives/autocomplete.mdx b/docs/customize/deep-dives/autocomplete.mdx index 818261ac5..893712dae 100644 --- a/docs/customize/deep-dives/autocomplete.mdx +++ b/docs/customize/deep-dives/autocomplete.mdx @@ -1,10 +1,11 @@ --- -title: "Autocomplete" -description: "Deep dive into Continue's autocomplete functionality and configuration" +title: "Continue Autocomplete Setup and Configuration Guide" +description: "Step-by-step guide to setting up and configuring autocomplete in Continue, including Codestral, Ollama, and IDE settings." keywords: [autocomplete] +sidebarTitle: Autocomplete --- -### Setting up with Codestral (recommended) +## How to Set Up Autocomplete in Continue with Codestral (Recommended) If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your config: @@ -45,7 +46,7 @@ If you want to have the best autocomplete experience, we recommend using Codestr "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`. -### Setting up with Ollama (default) +## How to Set Up Autocomplete in Continue with Ollama (Local Model) If you'd like to run your autocomplete model locally, we recommend using Ollama. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model: @@ -84,37 +85,42 @@ Then, add the model to your configuration: Once the model has been downloaded, you should begin to see completions in VS Code. -NOTE: Typically, thinking-type models are not recommended as they generate more slowly and are not suitable for scenarios that require speed. + + Typically, thinking-type models are not recommended as they generate more + slowly and are not suitable for scenarios that require speed. + However, if you use any thinking-switchable models, you can configure these models for autocomplete functions by turning off the thinking mode. For example: - + + ```yaml title="config.yaml" - models: - - name: Qwen3 without Thinking for Autocomplete - provider: ollama - model: qwen3:4b # qwen3 is a thinking-switchable model - roles: - - autocomplete - requestOptions: - extraBodyProperties: - think: false # turning off the thinking - ``` - +models: + - name: Qwen3 without Thinking for Autocomplete + provider: ollama + model: qwen3:4b # qwen3 is a thinking-switchable model + roles: + - autocomplete + requestOptions: + extraBodyProperties: + think: false # turning off the thinking +``` + + Then, in the continue panel, select this model as the default model for autocomplete. -## Configuration Options +## Autocomplete Configuration Options in Continue -### Hub Autocomplete models +### Autocomplete Models Available on the Continue Hub Explore autocomplete model configurations on [the hub](https://hub.continue.dev/explore/models?roles=autocomplete) -### Autocomplete User Settings +### Customize Autocomplete User Settings in the Continue Extension {/* - `Use autocomplete cache`: If on, caches completions */} The following settings can be configured for autocompletion in the IDE extension [User Settings Page](../settings.md): @@ -122,7 +128,7 @@ The following settings can be configured for autocompletion in the IDE extension - `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto` - `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt" -### Autocomplete Configuration +### How to Configure Autocomplete with `config.json` (Deprecated Format) #### YAML Configuration @@ -149,13 +155,13 @@ models: The `config.json` configuration format offers configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference/json-reference#tabautocomplete-options) for more details. -## FAQs +## Autocomplete FAQs and Troubleshooting in Continue ### I want better completions, should I use GPT-4? Perhaps surprisingly, the answer is no. The models that we suggest for autocomplete are trained with a highly specific prompt format, which allows them to respond to requests for completing code (see examples of these prompts [here](https://github.com/continuedev/continue/blob/main/core/autocomplete/templating/AutocompleteTemplate.ts)). Some of the best commercial models like GPT-4 or Claude are not trained with this prompt format, which means that they won't generate useful completions. Luckily, a huge model is not required for great autocomplete. Most of the state-of-the-art autocomplete models are no more than 10b parameters, and increasing beyond this does not significantly improve performance. -### I'm not seeing any completions +### Autocomplete Not Working – How to Fix It Follow these steps to ensure that everything is set up correctly: @@ -167,13 +173,13 @@ Follow these steps to ensure that everything is set up correctly: 6. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use cmd/ctrl + , then search for this and check the box) 7. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible. -### Completions are only ever single-line +### Why Are My Completions Only Single-Line? To ensure that you receive multi-line completions, you can set `"multilineCompletions": "always"` in `tabAutocompleteOptions`. By default, it is `"auto"`. If you still find that you are only seeing single-line completions, this may be because some models tend to produce shorter completions when starting in the middle of a file. You can try temporarily moving text below your cursor out of your active file, or switching to a larger model. -### Can I configure a "trigger key" for autocomplete? +### How to Set a Trigger Key for Autocomplete Suggestions -Yes, in VS Code, if you don't want to be shown suggestions automatically you can: +In VS Code, if you don't want to be shown suggestions automatically you can: 1. Set `"editor.inlineSuggest.enabled": false` in VS Code settings to disable automatic suggestions 2. Open "Keyboard Shortcuts" (cmd/ctrl+k, cmd/ctrl+s) and search for `editor.action.inlineSuggest.trigger` @@ -181,7 +187,7 @@ Yes, in VS Code, if you don't want to be shown suggestions automatically you can 4. Press the key combination you want to use to trigger suggestions (e.g. cmd/ctrl + space) 5. Now whenever you want to see a suggestion, you can press your key binding (e.g. cmd/ctrl + space) to trigger suggestions manually -### Is there a shortcut to accept one line at a time? +### Shortcut for Accepting One Line at a Time in Autocomplete This is a built-in feature of VS Code, but it's just a bit hidden. Follow these settings to reassign the keyboard shortcuts in VS Code: @@ -192,7 +198,7 @@ This is a built-in feature of VS Code, but it's just a bit hidden. Follow these This will make multi-line completion (including continue and from VS Code built-in or other plugin snippets) still work, and you will see multi-line completion. However, Tab will only fill in one line at a time. Any unnecessary code can be canceled with Esc. If you need to apply all the code, just press Tab multiple times. -### How to turn off autocomplete +### How to Turn Off Autocomplete in Continue (VS Code and JetBrains) #### VS Code diff --git a/docs/customize/deep-dives/configuration.mdx b/docs/customize/deep-dives/configuration.mdx index 666d3f27b..4291dfbd8 100644 --- a/docs/customize/deep-dives/configuration.mdx +++ b/docs/customize/deep-dives/configuration.mdx @@ -1,18 +1,19 @@ --- -title: "Configuration" +title: "How to Configure Continue Assistants" description: Learn how to access and manage Continue assistant configurations through Hub or local YAML files keywords: [config, settings, customize] +sidebarTitle: "Assistant Configuration" --- You can easily access your assistant configuration from the Continue Chat sidebar. Open the sidebar by pressing cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains) and click the Assistant selector above the main chat input. Then, you can hover over an assistant and click the `new window` (hub assistants) or `gear` (local assistants) icon. ![configure an assistant](/images/configure-continue.png) -## Hub Assistants +## How to Manage Hub Assistants Hub Assistants can be managed in [the Hub](https://hub.continue.dev). See [Editing an Assistant](../../hub/assistants/edit-an-assistant.md) -## YAML Config +## How to Configure Local Assistants with YAML Local user-level configuration is stored and can be edited in your home directory in `config.yaml`: @@ -27,19 +28,19 @@ When editing this file, you can see the available options suggested as you type, See the full reference for `config.yaml` [here](/reference). -## Deprecated configuration methods +## Legacy Configuration Methods (Deprecated) - View the `config.json` migration guide [here](../yaml-migration.mdx) + View the `config.json` migration guide [here](../yaml-migration) - [`config.json`](/reference) - The original configuration format which is stored in a file at the same location as `config.yaml` -- [`.continuerc.json`](#continuercjson) - Workspace-level configuration -- [`config.ts`](#configts) - Advanced configuration (probably unnecessary) - a TypeScript file in your home directory that can be used to programmatically modify (_merged_) the `config.json` schema: +- [`.continuerc.json`](#how-to-use-continuercjson-for-workspace-configuration) - Workspace-level configuration +- [`config.ts`](#how-to-use-configts-for-advanced-configuration) - Advanced configuration (probably unnecessary) - a TypeScript file in your home directory that can be used to programmatically modify (_merged_) the `config.json` schema: - `~/.continue/config.ts` (MacOS / Linux) - `%USERPROFILE%\.continue\config.ts` (Windows) -### `.continuerc.json` +### How to Use `.continuerc.json` for Workspace Configuration The format of `.continuerc.json` is the same as `config.json`, plus one _additional_ property `mergeBehavior`, which can be set to either "merge" or "overwrite". If set to "merge" (the default), `.continuerc.json` will be applied on top of `config.json` (arrays and objects are merged). If set to "overwrite", then every top-level property of `.continuerc.json` will overwrite that property from `config.json`. @@ -54,7 +55,7 @@ Example } ``` -### `config.ts` +### How to Use `config.ts` for Advanced Configuration `config.yaml` or `config.json` can handle the vast majority of necessary configuration, so we recommend using it whenever possible. However, if you need to programmatically extend Continue configuration, you can use a `config.ts` file, placed at `~/.continue/config.ts` (MacOS / Linux) or `%USERPROFILE%\.continue\config.ts` (Windows). diff --git a/docs/customize/deep-dives/development-data.mdx b/docs/customize/deep-dives/development-data.mdx index 9adaaa9c0..93e69e482 100644 --- a/docs/customize/deep-dives/development-data.mdx +++ b/docs/customize/deep-dives/development-data.mdx @@ -1,14 +1,15 @@ --- -title: Development Data +title: "How to Collect and Manage Development Data in Continue" description: Collecting data on how you build software keywords: [development data, dev data, LLM-aided development] +sidebarTitle: "Development Data" --- When you use Continue, you automatically collect data on how you build software. By default, this development data is saved to `.continue/dev_data` on your local machine. You can read more about how development data is generated as a byproduct of LLM-aided development and why we believe that you should start collecting it now: [It’s time to collect data on how you build software](https://blog.continue.dev/its-time-to-collect-data-on-how-you-build-software) -## Custom Data Destinations +## How to Configure Custom Data Destinations You can also configure custom destinations for your data, including remote HTTP endpoints and local file directories. diff --git a/docs/customize/deep-dives/mcp.mdx b/docs/customize/deep-dives/mcp.mdx index 6156b1f63..7b6230923 100644 --- a/docs/customize/deep-dives/mcp.mdx +++ b/docs/customize/deep-dives/mcp.mdx @@ -1,7 +1,8 @@ --- -title: MCP +title: "How to Set Up Model Context Protocol (MCP) in Continue" description: MCP use and customization keywords: [tool, use, function calling, claude, automatic] +sidebarTitle: "Model Context Protocol (MCP)" --- As AI systems get better, they're still held back by their training data and @@ -13,7 +14,7 @@ the wider digital world. This standard, created by Anthropic to bring together prompts, context, and tool use, is key for building truly useful AI experiences that can be set up with custom tools. -## How it works +## How MCP Works in Continue Currently custom tools can be configured using the Model Context Protocol standard to unify prompts, context, and tool use. @@ -24,7 +25,7 @@ explore available MCP server blocks MCP can only be used in the **agent** mode. -## Quick Start +## Quick Start: How to Set Up Your First MCP Server Below is a quick example of setting up a new MCP server for use in your assistant: @@ -53,13 +54,13 @@ The result will be a generated file called `hn.txt` in the current working direc ![playwright mcp](/images/mcp-playwright.png) -## Continue Documentation Search +## How to Set Up Continue Documentation Search with MCP You can set up an MCP server to search the Continue documentation directly from your agent. This is particularly useful for getting help with Continue configuration and features. For complete setup instructions, troubleshooting, and usage examples, see the [Continue MCP Reference](/reference/continue-mcp). -## Using MCP Servers +## How to Configure MCP Servers To set up your own MCP server, read the [MCP quickstart](https://modelcontextprotocol.io/quickstart) and then [create an @@ -100,7 +101,7 @@ server block to your [config file](./configuration.md): -### Syntax +### How to Configure MCP Server Properties MCP blocks follow the established syntax for blocks, with a few additional properties specific to MCP servers. @@ -110,11 +111,11 @@ MCP blocks follow the established syntax for blocks, with a few additional prope - `args`: Arguments to pass to the command. - `env`: Secrets to be injected into the command as environment variables. -### Transport Types +### How to Choose MCP Transport Types MCP now supports remote server connections through HTTP-based transports, expanding beyond the traditional local stdio transport method. This enables integration with cloud-hosted MCP servers and distributed architectures. -#### Server-Sent Events Transport (`sse`) +#### How to Use Server-Sent Events Transport (`sse`) For real-time streaming communication, use the SSE transport: @@ -125,7 +126,7 @@ mcpServers: url: https://.... ``` -#### Standard Input/Output (`stdio`) +#### How to Use Standard Input/Output (`stdio`) For local MCP servers that communicate via standard input and output: @@ -139,7 +140,7 @@ mcpServers: - "/path/to/your/database.db" ``` -#### Streamable HTTP Transport (`streamable-http`) +#### How to Use Streamable HTTP Transport For standard HTTP-based communication with streaming capabilities: @@ -154,7 +155,7 @@ These remote transport options allow you to connect to MCP servers hosted on rem For detailed information about transport mechanisms and their use cases, refer to the official MCP documentation on [transports](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse). -### Working with Secrets +### How to Work with Secrets in MCP Servers With some MCP servers you will need to use API keys or other secrets. You can leverage locally stored environments secrets as well as access hosted secrets in the Continue Hub. To leverage Hub secrets, you can use the `inputs` property in your MCP env block instead of `secrets`. diff --git a/docs/customize/deep-dives/model-capabilities.mdx b/docs/customize/deep-dives/model-capabilities.mdx index df1daefc5..3e8a998eb 100644 --- a/docs/customize/deep-dives/model-capabilities.mdx +++ b/docs/customize/deep-dives/model-capabilities.mdx @@ -1,12 +1,13 @@ --- -title: Model Capabilities +title: "How to Configure Model Capabilities in Continue" description: Understanding and configuring model capabilities for tools and image support keywords: [capabilities, tools, function calling, image input, config] +sidebarTitle: "Model Capabilities" --- Continue needs to know what features your models support to provide the best experience. This guide explains how model capabilities work and how to configure them. -## What are Model Capabilities? +## What Are Model Capabilities? Model capabilities tell Continue what features a model supports: @@ -19,11 +20,11 @@ Without proper capability configuration, you may encounter issues like: - Tools not working at all - Image uploads being disabled -## How Continue Detects Capabilities +## How Continue Detects Model Capabilities Continue uses a two-tier system for determining model capabilities: -### 1. Automatic Detection (Default) +### How Automatic Detection Works (Default) Continue automatically detects capabilities based on your provider and model name. For example: @@ -39,12 +40,14 @@ For implementation details, see: - [toolSupport.ts](https://github.com/continuedev/continue/blob/main/core/llm/toolSupport.ts) - Tool capability detection logic - [@continuedev/llm-info](https://www.npmjs.com/package/@continuedev/llm-info) - Image support detection -### 2. Manual Configuration +### How to Configure Capabilities Manually You can add capabilities to models that Continue doesn't automatically detect in your `config.yaml`. -You cannot override autodetection - you can only add capabilities. Continue will always use its built-in knowledge about your model in addition to any capabilities you specify. + You cannot override autodetection - you can only add capabilities. Continue + will always use its built-in knowledge about your model in addition to any + capabilities you specify. ```yaml @@ -58,7 +61,7 @@ models: - image_input ``` -## When to Add Capabilities +## When to Add Capabilities Manually Add capabilities when: @@ -67,9 +70,9 @@ Add capabilities when: 3. **Experiencing issues** - Autodetection isn't working correctly for your setup 4. **Using proxy services** - Some proxy services modify model capabilities -## Configuration Examples +## How to Configure Model Capabilities (Examples) -### Basic Configuration +### How to Add Basic Tool Support Add tool support for a model that Continue doesn't recognize: @@ -88,13 +91,13 @@ models: - **Experimental**: System message tools are available as an experimental feature - for models without native tool support. These are not automatically used as a - fallback and must be explicitly configured. Most models are trained for native - tools, so system message tools may not work as well. + **Experimental**: System message tools are available as an experimental + feature for models without native tool support. These are not automatically + used as a fallback and must be explicitly configured. Most models are trained + for native tools, so system message tools may not work as well. -### Disable Capabilities +### How to Handle Models with Limited Capabilities Explicitly set no capabilities (autodetection will still apply): @@ -113,7 +116,7 @@ models: features. -### Multiple Capabilities +### How to Enable Multiple Capabilities Enable both tools and image support: @@ -127,7 +130,7 @@ models: - image_input ``` -## Common Scenarios +## Common Configuration Scenarios Some providers and custom deployments may require explicit capability configuration: @@ -148,11 +151,11 @@ models: - image_input # If supports vision ``` -## Troubleshooting +## How to Troubleshoot Capability Issues -For troubleshooting capability-related issues like Agent mode being unavailable or tools not working, see the [Troubleshooting guide](/troubleshooting#agent-mode-is-unavailable-or-tools-arent-working). +For troubleshooting capability-related issues like Agent mode being unavailable or tools not working, see the [Troubleshooting guide](/troubleshooting#agent-mode-is-unavailable-or-tools-aren’t-working). -## Best Practices +## Best Practices for Model Capabilities 1. **Start with autodetection** - Only override if you experience issues 2. **Test after changes** - Verify tools and images work as expected diff --git a/docs/customize/deep-dives/prompts.mdx b/docs/customize/deep-dives/prompts.mdx index ec541cc01..d80466da7 100644 --- a/docs/customize/deep-dives/prompts.mdx +++ b/docs/customize/deep-dives/prompts.mdx @@ -1,5 +1,6 @@ --- -title: Prompts +title: "Creating Custom Prompts in Continue" +description: "Learn how to create reusable prompt files in Continue to streamline repetitive tasks, including examples for code reviews, security checks, and entity generation" --- Prompts are reusable instructions that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. @@ -7,11 +8,11 @@ Prompts are reusable instructions that can be referenced at any time during chat Prompts were previously defined in a `.prompt` file format, but for consistency we now recommend using the same Markdown format as - [rules](./rules.mdx) and adding `alwaysApply: false` to the frontmatter so + [rules](./rules) and adding `alwaysApply: false` to the frontmatter so that they are manually triggered. -### Quick Start +## Quick Start: How to Create Your First Prompt File Below is a quick example of setting up a prompt file: @@ -30,11 +31,11 @@ Review the currently open file for adherence to Redux best practices, as explain Now to use this prompt, you can open Chat, type /, select the prompt, and type out any additional instructions you'd like to add. -## Further Examples +## Example Prompt Templates for Common Use Cases Below are more examples to get you started. You can also visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts). -### Security review +### How to Create a Security Review Prompt ```md title="security-review.md" --- @@ -49,7 +50,7 @@ Review the changes in the current git diff for these security best practices: - Is sensitive data handled appropriately throughout the lifecycle? ``` -### Pull in commonly used files for tasks +### How to Create a Prompt That References Existing Files ```md title="typeorm-entity-generator.md" --- diff --git a/docs/customize/deep-dives/rules.mdx b/docs/customize/deep-dives/rules.mdx index f313ad9cf..2f9411bc9 100644 --- a/docs/customize/deep-dives/rules.mdx +++ b/docs/customize/deep-dives/rules.mdx @@ -1,25 +1,26 @@ --- -title: "Rules" +title: "How to Create and Manage Rules in Continue" description: "Rules are used to provide instructions to the model for Agent, Chat, and Edit requests." keywords: [rules, .continuerules, system, prompt, message] +sidebarTitle: "Rules" --- Rules provide instructions to the model for [Agent](../../features/agent/quick-start), [Chat](../../features/chat/quick-start), and [Edit](../../features/edit/quick-start) requests. - Rules are not included in [autocomplete](./autocomplete.mdx) or - [apply](../model-roles/apply.mdx). + Rules are not included in [autocomplete](./autocomplete) or + [apply](../model-roles/apply). -## How it works +## How Rules Work in Continue You can view the current rules by clicking the pen icon above the main toolbar: ![rules input toolbar section](/images/notch-rules.png) -To form the system message, rules are joined with new lines, in the order they appear in the toolbar. This includes the base chat system message ([see below](#chat-system-message)). +To form the system message, rules are joined with new lines, in the order they appear in the toolbar. This includes the base chat system message ([see below](#how-to-customize-chat-system-message)). -## Quick Start +## Quick Start: How to Create Your First Rule File Below is a quick example of setting up a new rule file: @@ -39,7 +40,7 @@ Now test your rules by asking a question about a file in chat. ![pirate rule test](/images/pirate-rule-test.png) -## Creating rules blocks +## How to Create Rules Blocks Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules. @@ -56,7 +57,7 @@ Rules can also be added to an Assistant on the Continue Hub. Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. -### Syntax +### How to Configure Rule Properties and Syntax Rules were originally defined in YAML format (demonstrated below), but we @@ -125,13 +126,13 @@ rules: -### `.continue/rules` folder +### How to Set Up Project-Specific Rules You can create project-specific rules by adding a `.continue/rules` folder to the root of your project and adding new rule files. Rules files are loaded in lexicographical order, so you can prefix them with numbers to control the order in which they are applied. For example: `01-general.md`, `02-frontend.md`, `03-backend.md`. -### Example: TypeScript Rules +### Example: How to Create TypeScript-Specific Rules ```md title=".continue/rules/typescript.md" --- @@ -149,7 +150,7 @@ globs: ["**/*.ts", "**/*.tsx"] - modularize components into smaller, reusable pieces ``` -### Chat System Message +### How to Customize Chat System Message Continue includes a simple default system message for [Agent](../../features/agent/quick-start) and [Chat](../../features/chat/quick-start) requests, to help the model provide reliable codeblock formats in its output. @@ -157,7 +158,7 @@ This can be viewed in the rules section of the toolbar (see above), or in the so Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](/reference#models). -### `.continuerules` +### Legacy: .continuerules File (Deprecated) `.continuerules` will be deprecated in a future release. Please use the diff --git a/docs/customize/deep-dives/slash-commands.mdx b/docs/customize/deep-dives/slash-commands.mdx index f62725f54..4059ef25e 100644 --- a/docs/customize/deep-dives/slash-commands.mdx +++ b/docs/customize/deep-dives/slash-commands.mdx @@ -1,7 +1,8 @@ --- -title: Slash commands -description: Shortcuts that can be activated by prefacing your input with '/' +title: "Using Slash Commands in Continue" +description: "Learn how to use and create Slash Commands in Continue to run custom prompts, access context providers, and speed up coding tasks." keywords: [slash command, custom commands, step] +sidebarTitle: "Slash Commands" --- ![actions](/images/actions.gif) @@ -18,18 +19,18 @@ Slash commands can be combined with additional instructions, including [context commands. -## Prompts +## Ways to Create Slash Commands in Continue -### Assistant prompt blocks +### Assistant Prompt Blocks -The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your assistant, which show up as slash commands in [Chat](../../features/chat/how-it-works.mdx). +The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your assistant, which show up as slash commands in [Chat](../../features/chat/how-it-works). -### Prompt files +### Prompt Files It is also possible to write your own slash command by defining a β€œ.prompt file.” Prompt files can be as simple as a text file, but also include templating so that you can refer to files, URLs, highlighted code, and more. Learn more about prompt files [here](./prompts). -### MCP Server prompts +### MCP Server Prompts -Any prompts provided by [Model Context Protocol](https://modelcontextprotocol.io/introduction) servers are also accessible in chat as Slash Commands. See the [MCP Server Deep Dive](./mcp.mdx) for more details. +Any prompts provided by [Model Context Protocol](https://modelcontextprotocol.io/introduction) servers are also accessible in chat as Slash Commands. See the [MCP Server Deep Dive](./mcp) for more details. diff --git a/docs/customize/deep-dives/vscode-actions.mdx b/docs/customize/deep-dives/vscode-actions.mdx index 433255135..91ca32d59 100644 --- a/docs/customize/deep-dives/vscode-actions.mdx +++ b/docs/customize/deep-dives/vscode-actions.mdx @@ -1,15 +1,15 @@ --- -title: VS Code Actions +title: "How to Use Continue's VS Code Actions and Quick Features" keywords: [vscode, quick actions, quick, actions] +description: "Learn about Continue's VS Code-specific actions including quick actions buttons, right-click context menu options, debug shortcuts, and quick fixes for errors in your code" +sidebarTitle: "VS Code Actions" --- -### Other triggers for Actions (VS Code) - Currently all of these are only available in VS Code To make common use cases even more accessible, we provide a handful of other ways to invoke actions in VS Code. -## Quick actions +## How to Use Quick Actions Quick Actions are displayed as buttons above top-level classes and functions in your source code, letting you invoke actions with one click. They will edit that class or function, but nothing outside of it. They can also be customized with [.prompt files](./prompts.md) to perform custom actions. @@ -17,17 +17,17 @@ Quick Actions are displayed as buttons above top-level classes and functions in By default, quick actions are disabled, but can be enabled with the β€œContinue: Enable Quick Actions” in VS Code settings. -## Right click actions +## How to Use Right Click Actions Right click actions let you highlight a desired region of code, right click, and then select an action from the dropdown menu. The highlighted code you’ve selected will be included in your prompt alongside a pre-written set of instructions depending on the selected action. This is the only section of code that the model will attempt to edit. -Right click actions that generate inline diffs use the same prompt and response processing logic as [Edit](../../features/edit/how-it-works.mdx). +Right click actions that generate inline diffs use the same prompt and response processing logic as [Edit](../../features/edit/how-it-works). ![context-menu](/images/context-menu.png) -## Debug action +## How to Use the Debug Action Shortcut The debug action is a special built-in keyboard shortcut in the VS Code extension. Use cmd/ctrl + shift + R to instantly copy the contents of the most recent terminal output into the chat sidebar and get debugging advice. There is no additional, non-visible information sent to the language model. @@ -37,10 +37,8 @@ I got the following error, can you please help explain how to fix it? [ERROR_MESSAGE] ``` -## Quick fixes +## How to Use Quick Fixes for Code Errors Whenever you see red/yellow underlines in your code indicating errors, you can place your cursor nearby and VS Code will display a lightbulb icon. Either clicking the lightbulb or using the keyboard shortcut cmd/ctrl + . will show a dropdown menu of quick fixes. One of these will be the β€œAsk Continue” action. Either click or use cmd/ctrl + . again and Continue will attempt to help solve the problem. Similarly to the debug action, quick actions transparently inject a prompt into the chat window. When you select β€œAsk Continue”, the 3 lines above and below the error are sent to the chat followed by the question β€œHow do I fix the following problem in the above code?: [ERROR_MESSAGE]”. - -![ask-continue](/images/ask-continue.png) diff --git a/docs/customize/model-providers/_category_.json b/docs/customize/model-providers/_category_.json index c710357e6..31562c78a 100644 --- a/docs/customize/model-providers/_category_.json +++ b/docs/customize/model-providers/_category_.json @@ -1,4 +1,8 @@ { "label": "Model Providers", - "position": 4 + "position": 1, + "link": { + "type": "doc", + "id": "customize/model-providers/overview" + } } diff --git a/docs/customize/model-providers/more/SambaNova.mdx b/docs/customize/model-providers/more/SambaNova.mdx index 072ac2429..acd83a682 100644 --- a/docs/customize/model-providers/more/SambaNova.mdx +++ b/docs/customize/model-providers/more/SambaNova.mdx @@ -1,5 +1,6 @@ --- title: "SambaNova" +description: "Configure SambaNova Cloud with Continue to access their high-performance platform for running large AI models, including Llama 4 Scout with world record open source model performance" --- The SambaNova Cloud is a cloud platform for running large AI models with the world record open source models performance. You can follow the instructions in [this blog post](https://sambanova.ai/blog/accelerating-coding-with-sambanova-cloud?ref=blog.continue.dev) to configure your setup. diff --git a/docs/customize/model-providers/more/asksage.mdx b/docs/customize/model-providers/more/asksage.mdx index abb0cbc98..03ad0e3ca 100644 --- a/docs/customize/model-providers/more/asksage.mdx +++ b/docs/customize/model-providers/more/asksage.mdx @@ -1,5 +1,6 @@ --- title: "AskSage" +description: "Configure AskSage with Continue to access a wide range of models including government-compliant versions of GPT and Claude models, supporting chat and edit functionalities" --- diff --git a/docs/customize/model-providers/more/cerebras.mdx b/docs/customize/model-providers/more/cerebras.mdx index e2f2fabf5..c8d28888d 100644 --- a/docs/customize/model-providers/more/cerebras.mdx +++ b/docs/customize/model-providers/more/cerebras.mdx @@ -1,5 +1,6 @@ --- title: "Cerebras" +description: "Configure Cerebras Inference with Continue for fast model inference using specialized silicon, including setup instructions for Llama 3.1 70B model" --- Cerebras Inference uses specialized silicon to provides fast inference. diff --git a/docs/customize/model-providers/more/cloudflare.mdx b/docs/customize/model-providers/more/cloudflare.mdx index 0964bba8e..1373b637f 100644 --- a/docs/customize/model-providers/more/cloudflare.mdx +++ b/docs/customize/model-providers/more/cloudflare.mdx @@ -1,5 +1,6 @@ --- title: "Cloudflare" +description: "Configure Cloudflare Workers AI with Continue to access various models for chat and autocomplete, including Llama 3 8B and DeepSeek Coder through Cloudflare's serverless AI platform" --- Cloudflare Workers AI can be used for both chat and tab autocompletion in Continue. Here is an example of Cloudflare Workers AI configuration: diff --git a/docs/customize/model-providers/more/cohere.mdx b/docs/customize/model-providers/more/cohere.mdx index 5162fd5ac..117465918 100644 --- a/docs/customize/model-providers/more/cohere.mdx +++ b/docs/customize/model-providers/more/cohere.mdx @@ -1,5 +1,6 @@ --- title: "Cohere" +description: "Configure Cohere's AI models with Continue, including setup for Command A for chat, embed-v4.0 for embeddings, and rerank-v3.5 for reranking capabilities" --- Before using Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key. @@ -38,7 +39,7 @@ We recommend configuring **Command A** as your chat model. Cohere currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. ## Embeddings model diff --git a/docs/customize/model-providers/more/deepinfra.mdx b/docs/customize/model-providers/more/deepinfra.mdx index 238508333..83150bc56 100644 --- a/docs/customize/model-providers/more/deepinfra.mdx +++ b/docs/customize/model-providers/more/deepinfra.mdx @@ -1,5 +1,6 @@ --- title: "DeepInfra" +description: "Configure DeepInfra with Continue to access low-cost inference for open-source models like Mixtral-8x7B-Instruct, including API setup instructions" --- [DeepInfra](https://deepinfra.com) provides inference for open-source models at very low cost. To get started with DeepInfra, obtain your API key [here](https://deepinfra.com/dash). Then, find the model you want to use [here](https://deepinfra.com/models?type=text-generation) and copy the name of the model. Continue can then be configured to use the `DeepInfra` LLM class, like the example here: diff --git a/docs/customize/model-providers/more/flowise.mdx b/docs/customize/model-providers/more/flowise.mdx index cdbeafa4c..fb504628f 100644 --- a/docs/customize/model-providers/more/flowise.mdx +++ b/docs/customize/model-providers/more/flowise.mdx @@ -1,5 +1,6 @@ --- title: "Flowise" +description: "Configure Flowise with Continue to integrate with this low-code/no-code drag & drop tool for building and visualizing LLM applications" --- [Flowise](https://flowiseai.com/) is a low-code/no-code drag & drop tool with the aim to make it easy for people to visualize and build LLM apps. Continue can then be configured to use the `Flowise` LLM class, like the example here: diff --git a/docs/customize/model-providers/more/function-network.mdx b/docs/customize/model-providers/more/function-network.mdx index 48641487c..b83f5aa40 100644 --- a/docs/customize/model-providers/more/function-network.mdx +++ b/docs/customize/model-providers/more/function-network.mdx @@ -1,12 +1,6 @@ --- title: "Function Network" ---- - ---- - -title: Function Network -slug: ../function-network - +description: "Configure Function Network with Continue to access private and affordable AI models, including Llama 3.1, Qwen2.5-Coder, and various embedding models for a user-owned AI experience" --- > Private, Affordable User-Owned AI diff --git a/docs/customize/model-providers/more/groq.mdx b/docs/customize/model-providers/more/groq.mdx index 22d67aa97..ae674b1e5 100644 --- a/docs/customize/model-providers/more/groq.mdx +++ b/docs/customize/model-providers/more/groq.mdx @@ -1,5 +1,7 @@ --- -title: "Groq" +title: "How to Configure Groq with Continue" +description: "Configure Groq with Continue to access their ultra-fast inference platform for open-source language models, including the entire Llama 3.1 and 3.3 family with industry-leading speeds" +sidebarTitle: "Groq" --- diff --git a/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx b/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx index 980a125a2..99426f80b 100644 --- a/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx +++ b/docs/customize/model-providers/more/huggingfaceinferenceapi.mdx @@ -1,5 +1,6 @@ --- title: "HuggingFace Inference Endpoints" +description: "Configure HuggingFace Inference Endpoints with Continue to deploy and access open-source language models on any cloud, including setup instructions for models like WizardCoder" --- Hugging Face Inference Endpoints are an easy way to setup instances of open-source language models on any cloud. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on β€œNew endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking β€œCreate Endpoint”. Change `~/.continue/config.json` to look like this: diff --git a/docs/customize/model-providers/more/ipex_llm.mdx b/docs/customize/model-providers/more/ipex_llm.mdx index 0b5f37fd2..e82fd2f34 100644 --- a/docs/customize/model-providers/more/ipex_llm.mdx +++ b/docs/customize/model-providers/more/ipex_llm.mdx @@ -1,5 +1,6 @@ --- title: "Intel Extension for PyTorch" +description: "Configure Intel Extension for PyTorch (IPEX-LLM) with Continue to run language models with very low latency on Intel CPUs and GPUs, leveraging accelerated Ollama backend" --- diff --git a/docs/customize/model-providers/more/kindo.mdx b/docs/customize/model-providers/more/kindo.mdx index a798247b6..2c0a87c6c 100644 --- a/docs/customize/model-providers/more/kindo.mdx +++ b/docs/customize/model-providers/more/kindo.mdx @@ -1,5 +1,6 @@ --- title: "Kindo" +description: "Configure Kindo with Continue to centralize control over your organization's AI operations with support for commercial and open-source models while ensuring data protection and policy compliance" --- Kindo offers centralized control over your organization's AI operations, ensuring data protection and compliance with internal policies while supporting various commercial and open-source models. To get started, sign up [here](https://app.kindo.ai/), create an API key in [Settings > API > API Keys](https://app.kindo.ai/settings/api), and choose a model from the list of supported models in the "Available Models" tab or copy and paste the config in [Plugins > Your Configuration](https://app.kindo.ai/plugins). diff --git a/docs/customize/model-providers/more/llamacpp.mdx b/docs/customize/model-providers/more/llamacpp.mdx index 30f95a13e..e12d22cd8 100644 --- a/docs/customize/model-providers/more/llamacpp.mdx +++ b/docs/customize/model-providers/more/llamacpp.mdx @@ -1,5 +1,6 @@ --- title: "Llama.cpp" +description: "Configure Llama.cpp with Continue to run local language models using high-performance C++ inference, including setup instructions for the server and client configuration" --- Run the llama.cpp server binary to start the API server. If running on a remote server, be sure to set host to 0.0.0.0: diff --git a/docs/customize/model-providers/more/llamafile.mdx b/docs/customize/model-providers/more/llamafile.mdx index 495d5a9e8..1bf4b534e 100644 --- a/docs/customize/model-providers/more/llamafile.mdx +++ b/docs/customize/model-providers/more/llamafile.mdx @@ -1,5 +1,6 @@ --- title: "Llamafile" +description: "Configure Llamafile with Continue to use self-contained binary files that can run open-source language models like Mistral without additional setup" --- A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contained binary that can run an open-source LLM. You can configure this provider in your config.json as follows: diff --git a/docs/customize/model-providers/more/lmstudio.mdx b/docs/customize/model-providers/more/lmstudio.mdx index 6fdaf9e7d..60226686f 100644 --- a/docs/customize/model-providers/more/lmstudio.mdx +++ b/docs/customize/model-providers/more/lmstudio.mdx @@ -1,5 +1,6 @@ --- title: "LM Studio" +description: "Configure LM Studio with Continue to run open-source models locally, including setup for Llama3.1 8B for chat, embedding models, and instructions for connecting to remote instances" --- [LM Studio](https://lmstudio.ai) is an application for Mac, Windows, and Linux that makes it easy to locally run open-source models and comes with a great UI. To get started with LM Studio, download from the website, use the UI to download a model, and then start the local inference server. Continue can then be configured to use the `LMStudio` LLM class: diff --git a/docs/customize/model-providers/more/moonshot.mdx b/docs/customize/model-providers/more/moonshot.mdx index 335665c1d..73f7927ed 100644 --- a/docs/customize/model-providers/more/moonshot.mdx +++ b/docs/customize/model-providers/more/moonshot.mdx @@ -1,5 +1,6 @@ --- title: "Moonshot AI" +description: "Configure Moonshot AI's language models with Continue, including setup instructions for their 8K, 32K, and 128K context window models with competitive pricing" --- [Moonshot AI](https://platform.moonshot.cn/) provides high-quality large language model services with competitive pricing and excellent performance. diff --git a/docs/customize/model-providers/more/morph.mdx b/docs/customize/model-providers/more/morph.mdx index 41724c56d..30ef1efec 100644 --- a/docs/customize/model-providers/more/morph.mdx +++ b/docs/customize/model-providers/more/morph.mdx @@ -1,5 +1,6 @@ --- title: "Morph" +description: "Configure Morph with Continue to access their optimized models for code application, embeddings, and reranking, designed for fast and accurate integration of AI-generated code changes" --- Morph provides a fast apply model that helps you quickly and accurately apply code changes from chat suggestions to your files. It's optimized for speed and precision when integrating generated code into your existing codebase. You can sign up for Morph's generous free tier [here](https://morphllm.com/dashboard). Then, update your configuration file as follows: diff --git a/docs/customize/model-providers/more/msty.mdx b/docs/customize/model-providers/more/msty.mdx index d8ec28b08..9d889bd0d 100644 --- a/docs/customize/model-providers/more/msty.mdx +++ b/docs/customize/model-providers/more/msty.mdx @@ -1,5 +1,6 @@ --- title: "Msty" +description: "Configure Msty with Continue to easily run both online and local open-source models like Llama-2 and DeepSeek Coder through their user-friendly application for Windows, Mac, and Linux" --- [Msty](https://msty.app/) is an application for Windows, Mac, and Linux that makes it really easy to run online as well as local open-source models, including Llama-2, DeepSeek Coder, etc. No need to fidget with your terminal, run a command, or anything. Just download the app from the website, click a button, and you are up and running. Continue can then be configured to use the `Msty` LLM class: diff --git a/docs/customize/model-providers/more/ncompass.mdx b/docs/customize/model-providers/more/ncompass.mdx index 21cb01e1e..e1e0a03a8 100644 --- a/docs/customize/model-providers/more/ncompass.mdx +++ b/docs/customize/model-providers/more/ncompass.mdx @@ -1,5 +1,6 @@ --- title: "NCompass" +description: "Configure NCompass Technologies with Continue to access their fast inference engine for open-source models like Google's Gemma 3 Coder" --- The nCompass Technologies API exposes an extremely fast inference engine for open-source language models. You can sign up [here](https://app.ncompass.tech/api-settings), copy your API key on the initial welcome screen, and then hit the play button on any model from the [nCompass Models list](https://ncompass.tech/models). Change `~/.continue/config.json` to look like this: diff --git a/docs/customize/model-providers/more/nebius.mdx b/docs/customize/model-providers/more/nebius.mdx index 860f114fd..b3491908c 100644 --- a/docs/customize/model-providers/more/nebius.mdx +++ b/docs/customize/model-providers/more/nebius.mdx @@ -1,5 +1,6 @@ --- title: "Nebius" +description: "Configure Nebius AI Studio with Continue to access their language model offerings, including DeepSeek R1 for chat and BAAI embeddings models" --- You can get an API key from the [Nebius AI Studio API keys page](https://studio.nebius.ai/settings/api-keys) diff --git a/docs/customize/model-providers/more/novita.mdx b/docs/customize/model-providers/more/novita.mdx index 0370c8999..bb01ef77a 100644 --- a/docs/customize/model-providers/more/novita.mdx +++ b/docs/customize/model-providers/more/novita.mdx @@ -1,5 +1,6 @@ --- title: "Novita" +description: "Configure Novita AI with Continue to access their affordable and reliable inference platform for language models like Llama 3.1, offering scalable LLM API services" --- [Novita AI](https://novita.ai?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) offers an affordable, reliable, and simple inference platform with scalable [LLM API](https://novita.ai/docs/model-api/reference/introduction.html), empowering developers to build AI applications. Try the [Novita AI Llama 3 API Demo](https://novita.ai/model-api/product/llm-api/playground/meta-llama-llama-3.1-70b-instruct?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link) today!. You can sign up [here](https://novita.ai/user/login?&redirect=/&utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link), copy your API key on the [Key Management](https://novita.ai/settings/key-management?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link), and then hit the play button on any model from the [Novita AI Models list](https://novita.ai/llm-api?utm_source=github_continuedev&utm_medium=github_readme&utm_campaign=github_link). Change `~/.continue/config.json` to look like this: diff --git a/docs/customize/model-providers/more/nvidia.mdx b/docs/customize/model-providers/more/nvidia.mdx index bfbce696f..4f149738b 100644 --- a/docs/customize/model-providers/more/nvidia.mdx +++ b/docs/customize/model-providers/more/nvidia.mdx @@ -1,11 +1,8 @@ --- title: "NVIDIA" +description: "Configure NVIDIA AI models with Continue, including setup for Nemotron-4-340B-Instruct for chat and NVIDIA Retrieval QA Mistral 7B for embeddings" --- ---- - -## title: NVIDIA - [View the docs](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog) @@ -46,7 +43,7 @@ We recommend configuring **Nemotron-4-340B-Instruct** as your chat model. NVIDIA currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. ## Embeddings model diff --git a/docs/customize/model-providers/more/openrouter.mdx b/docs/customize/model-providers/more/openrouter.mdx index f1be54017..a6369364c 100644 --- a/docs/customize/model-providers/more/openrouter.mdx +++ b/docs/customize/model-providers/more/openrouter.mdx @@ -1,5 +1,7 @@ --- -title: "OpenRouter" +title: "How to Configure OpenRouter with Continue" +sidebarTitle: "OpenRouter" +description: "Configure OpenRouter with Continue to access various commercial and open-source models through a unified interface, including model capability configuration and advanced request options" --- OpenRouter is a unified interface for commercial and open-source models, giving you access to the best models at the best prices. You can sign up [here](https://openrouter.ai/signup), create your API key on the [keys page](https://openrouter.ai/keys), and then choose a model from the [list of supported models](https://openrouter.ai/models). @@ -74,10 +76,13 @@ Learn more about available settings [here](https://openrouter.ai/docs). ## Model Capabilities -OpenRouter models may require explicit capability configuration because the proxy doesn't always preserve the original model's function calling support. +OpenRouter models may require explicit capability configuration because the proxy doesn't always preserve the original model's function calling support. - Continue automatically uses system message tools for models that don't support native function calling, so Agent mode should work even without explicit capability configuration. However, you can still override capabilities if needed. + Continue automatically uses system message tools for models that don't support + native function calling, so Agent mode should work even without explicit + capability configuration. However, you can still override capabilities if + needed. If you're experiencing issues with Agent mode or tools not working, you can add the capabilities field: diff --git a/docs/customize/model-providers/more/openvino_model_server.mdx b/docs/customize/model-providers/more/openvino_model_server.mdx index ceee689b3..8c7fc889a 100644 --- a/docs/customize/model-providers/more/openvino_model_server.mdx +++ b/docs/customize/model-providers/more/openvino_model_server.mdx @@ -1,5 +1,6 @@ --- title: "OpenVINO Model Server" +description: "Configure OpenVINO Model Server with Continue to use Intel-optimized models for CPU, iGPU, GPU and NPU via the OpenAI-compatible API, supporting code completion with models like CodeLlama and Qwen" --- diff --git a/docs/customize/model-providers/more/ovhcloud.mdx b/docs/customize/model-providers/more/ovhcloud.mdx index e3a255f99..3a7b00549 100644 --- a/docs/customize/model-providers/more/ovhcloud.mdx +++ b/docs/customize/model-providers/more/ovhcloud.mdx @@ -1,11 +1,8 @@ --- title: "OVHcloud" +description: "Configure OVHcloud AI Endpoints with Continue to access their GDPR-compliant serverless inference API for models like Qwen, Llama, Mistral, and Deepseek, with strong security and data privacy features" --- ---- - -## title: OVHcloud AI Endpoints - OVHcloud AI Endpoints is a serverless inference API that provides access to a curated selection of models (e.g., Llama, Mistral, Qwen, Deepseek). It is designed with security and data privacy in mind and is compliant with GDPR. diff --git a/docs/customize/model-providers/more/relace.mdx b/docs/customize/model-providers/more/relace.mdx index 072bc5fc6..3d46969f9 100644 --- a/docs/customize/model-providers/more/relace.mdx +++ b/docs/customize/model-providers/more/relace.mdx @@ -1,5 +1,6 @@ --- title: "Relace" +description: "Configure Relace with Continue to access their Fast Apply model, which helps you quickly and reliably apply chat suggestions to your codebase" --- Relace provides a fast apply model through their API that helps you reliably and almost instantly apply chat suggestions to your codebase. You can sign up and obtain an API key [here](https://app.relace.ai/settings/api-keys). Then, change your configuration file to look like this: diff --git a/docs/customize/model-providers/more/replicatellm.mdx b/docs/customize/model-providers/more/replicatellm.mdx index b4e173158..939072cf2 100644 --- a/docs/customize/model-providers/more/replicatellm.mdx +++ b/docs/customize/model-providers/more/replicatellm.mdx @@ -1,5 +1,6 @@ --- title: "Replicate" +description: "Configure Replicate with Continue to access newly released language models or deploy your own through their platform, with support for various models including CodeLLama" --- Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.json` to look like this: diff --git a/docs/customize/model-providers/more/sagemaker.mdx b/docs/customize/model-providers/more/sagemaker.mdx index 9c4d81ffd..ba1ab58c6 100644 --- a/docs/customize/model-providers/more/sagemaker.mdx +++ b/docs/customize/model-providers/more/sagemaker.mdx @@ -1,5 +1,6 @@ --- title: "Amazon SageMaker" +description: "Configure Amazon SageMaker with Continue to use deployed LLM endpoints for both chat and embedding models, supporting LMI and HuggingFace TEI deployments with AWS credentials" --- SageMaker can be used for both chat and embedding models. Chat models are supported for endpoints deployed with [LMI](https://docs.djl.ai/docs/serving/serving/docs/lmi/index.html), and embedding models are supported for endpoints deployed with [HuggingFace TEI](https://huggingface.co/blog/sagemaker-huggingface-embedding) diff --git a/docs/customize/model-providers/more/scaleway.mdx b/docs/customize/model-providers/more/scaleway.mdx index 5ba396389..5b840d1a1 100644 --- a/docs/customize/model-providers/more/scaleway.mdx +++ b/docs/customize/model-providers/more/scaleway.mdx @@ -1,11 +1,8 @@ --- title: "Scaleway" +description: "Configure Scaleway Generative APIs with Continue to access AI models hosted in European data centers, offering low latency, data privacy, and EU AI Act compliance with models like Qwen2.5-Coder and BGE-Multilingual-Gemma2" --- ---- - -## title: Scaleway - Scaleway Generative APIs give you instant access to leading AI models hosted in European data centers, ideal for developers requiring low latency, full @@ -50,7 +47,7 @@ We recommend configuring **Qwen2.5-Coder-32B-Instruct** as your chat model. Scaleway currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. ## Embeddings model diff --git a/docs/customize/model-providers/more/siliconflow.mdx b/docs/customize/model-providers/more/siliconflow.mdx index a3389382f..1b008dc6e 100644 --- a/docs/customize/model-providers/more/siliconflow.mdx +++ b/docs/customize/model-providers/more/siliconflow.mdx @@ -1,11 +1,8 @@ --- title: "SiliconFlow" +description: "Configure SiliconFlow with Continue to access their AI model platform, featuring Qwen's Coder models for chat and autocomplete, along with various embedding and reranking models" --- ---- - -## title: SiliconFlow - You can get an API key from the [Silicon Cloud](https://cloud.siliconflow.cn/account/ak). diff --git a/docs/customize/model-providers/more/textgenwebui.mdx b/docs/customize/model-providers/more/textgenwebui.mdx index 08c1c87fd..29ac9fa01 100644 --- a/docs/customize/model-providers/more/textgenwebui.mdx +++ b/docs/customize/model-providers/more/textgenwebui.mdx @@ -1,5 +1,6 @@ --- title: "Text Generation WebUI" +description: "Configure Text Generation WebUI with Continue to use its comprehensive open-source language model UI and local server through its OpenAI-compatible API" --- TextGenWebUI is a comprehensive, open-source language model UI and local server. You can set it up with an OpenAI-compatible server plugin, and then configure it like this: diff --git a/docs/customize/model-providers/more/together.mdx b/docs/customize/model-providers/more/together.mdx index e59dfc7b6..11a9c6107 100644 --- a/docs/customize/model-providers/more/together.mdx +++ b/docs/customize/model-providers/more/together.mdx @@ -1,5 +1,7 @@ --- -title: "Together AI" +title: "How to Configure Together AI with Continue" +description: "Configure the Together AI cloud platform for running large language models with Continue, including setup instructions and sample configuration for Qwen2.5 Coder" +sidebarTitle: "Together AI" --- The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/serverless-models). Change `~/.continue/config.json` to look like this: diff --git a/docs/customize/model-providers/more/venice.mdx b/docs/customize/model-providers/more/venice.mdx index 13247c418..1f48802cb 100644 --- a/docs/customize/model-providers/more/venice.mdx +++ b/docs/customize/model-providers/more/venice.mdx @@ -1,11 +1,8 @@ --- title: "Venice AI" +description: "Configure Venice AI with Continue to access this privacy-focused generative AI platform that supports open-source LLMs without storing private user data" --- ---- - -## title: "Venice AI" - Venice.AI is a privacy focused generative AI platform, allowing users to interact with open-source LLMs without storing any private user data. To get started with Venice's API, either purchase a pro account, stake $VVV to obtain daily inference allotments or fund your account with USD and head over to https://venice.ai/settings/api. Venice hosts state of the art open-source AI models and supports the OpenAI API standard, allowing users to easily interact with the platform. Learn more about the Venice API at https://venice.ai/api. Change `~/.continue/config.json` to look like the following. diff --git a/docs/customize/model-providers/more/vllm.mdx b/docs/customize/model-providers/more/vllm.mdx index ba86af790..3f3bdd643 100644 --- a/docs/customize/model-providers/more/vllm.mdx +++ b/docs/customize/model-providers/more/vllm.mdx @@ -1,5 +1,6 @@ --- title: "vLLM" +description: "Configure vLLM's high-performance inference library with Continue for chat, autocomplete, and embeddings, including setup instructions for Llama3.1, Qwen2.5-Coder, and Nomic Embed models" --- vLLM is an open-source library for fast LLM inference which typically is used to serve multiple users at the same time. It can also be used to run a large model on multiple GPU:s (e.g. when it doesnΒ΄t fit in a single GPU). Run their OpenAI-compatible server using `vllm serve`. See their [server documentation](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) and the [engine arguments documentation](https://docs.vllm.ai/en/latest/usage/engine_args.html). @@ -101,6 +102,6 @@ We recommend configuring **Nomic Embed Text** as your embeddings model. Continue automatically handles vLLM's response format (which uses `results` instead of `data`). -[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. +[Click here](../../model-roles/reranking) to see a list of reranking model providers. -The continue implementation uses [OpenAI](../top-level/openai.mdx) under the hood. [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Vllm.ts) +The continue implementation uses [OpenAI](../top-level/openai) under the hood. [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Vllm.ts) diff --git a/docs/customize/model-providers/more/watsonx.mdx b/docs/customize/model-providers/more/watsonx.mdx index 9db577a66..aafb45b1d 100644 --- a/docs/customize/model-providers/more/watsonx.mdx +++ b/docs/customize/model-providers/more/watsonx.mdx @@ -1,5 +1,6 @@ --- title: "IBM WatsonX" +description: "How to configure IBM's watsonx models in Continue, including authentication methods, deployment options, and support for chat, autocomplete, embeddings, and reranking models" --- watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks. diff --git a/docs/customize/model-providers/overview.mdx b/docs/customize/model-providers/overview.mdx new file mode 100644 index 000000000..c209544fd --- /dev/null +++ b/docs/customize/model-providers/overview.mdx @@ -0,0 +1,85 @@ +--- +title: "Model Providers Overview" +description: "Continue supports a wide range of AI model providers to power different features like chat, code editing, autocompletion, and embeddings. This overview helps you navigate through the available options and find the right provider for your needs." +--- + +## Popular Model Providers + +These are the most commonly used model providers that offer a wide range of capabilities: + +| Provider | Description | Capabilities | +| :------------------------------------------------------------- | :------------------------------------------------------------------------------ | :------------------------------------------ | +| [Anthropic](/customize/model-providers/top-level/anthropic) | Providers of Claude models, known for long context windows and strong reasoning | Chat, Edit, Apply, Embeddings | +| [OpenAI](/customize/model-providers/top-level/openai) | Creators of GPT models with strong coding capabilities | Chat, Edit, Apply, Embeddings | +| [Azure](/customize/model-providers/top-level/azure) | Microsoft's cloud platform offering OpenAI models | Chat, Edit, Apply, Embeddings | +| [Amazon Bedrock](/customize/model-providers/top-level/bedrock) | AWS service offering access to various foundation models | Chat, Edit, Apply, Embeddings | +| [Ollama](/customize/model-providers/top-level/ollama) | Run open-source models locally with a simple interface | Chat, Edit, Apply, Embeddings, Autocomplete | +| [Google Gemini](/customize/model-providers/top-level/gemini) | Google's multimodal AI models | Chat, Edit, Apply, Embeddings | +| [DeepSeek](/customize/model-providers/top-level/deepseek) | Specialized code models with strong performance | Chat, Edit, Apply | +| [Mistral](/customize/model-providers/top-level/mistral) | High-performance open models with commercial offerings | Chat, Edit, Apply, Embeddings | +| [xAI](/customize/model-providers/top-level/xAI) | Grok models from xAI | Chat, Edit, Apply | +| [Vertex AI](/customize/model-providers/top-level/vertexai) | Google Cloud's machine learning platform | Chat, Edit, Apply, Embeddings | +| [Inception](/customize/model-providers/top-level/inception) | On-premises open-source model runners | Chat, Edit, Apply | + +## Additional Model Providers + +Beyond the top-level providers, Continue supports many other options: + +### Hosted Services + +| Provider | Description | +| :--------------------------------------------------------------------- | :--------------------------------------------------------- | +| [Groq](/customize/model-providers/more/groq) | Ultra-fast inference for various open models | +| [Together AI](/customize/model-providers/more/together) | Platform for running a variety of open models | +| [DeepInfra](/customize/model-providers/more/deepinfra) | Hosting for various open source models | +| [OpenRouter](/customize/model-providers/more/openrouter) | Gateway to multiple model providers | +| [Cohere](/customize/model-providers/more/cohere) | Models specialized for semantic search and text generation | +| [NVIDIA](/customize/model-providers/more/nvidia) | GPU-accelerated model hosting | +| [Cloudflare](/customize/model-providers/more/cloudflare) | Edge-based AI inference services | +| [HuggingFace](/customize/model-providers/more/huggingfaceinferenceapi) | Platform for open source models | + +### Local Model Options + +| Provider | Description | +| :------------------------------------------------------- | :-------------------------------------------- | +| [LM Studio](/customize/model-providers/more/lmstudio) | Desktop app for running models locally | +| [llama.cpp](/customize/model-providers/more/llamacpp) | Optimized C++ implementation for running LLMs | +| [LlamaStack](/customize/model-providers/more/llamastack) | Stack for running Llama models locally | +| [llamafile](/customize/model-providers/more/llamafile) | Self-contained executable model files | + +### Enterprise Solutions + +| Provider | Description | +| :----------------------------------------------------- | :------------------------------------ | +| [SambaNova](/customize/model-providers/more/SambaNova) | Enterprise AI platform | +| [Watson x](/customize/model-providers/more/watsonx) | IBM's enterprise AI platform | +| [Sagemaker](/customize/model-providers/more/sagemaker) | AWS machine learning platform | +| [Nebius](/customize/model-providers/more/nebius) | Cloud-based machine learning platform | + +## How to Choose a Model Provider + +When selecting a model provider, consider: + +1. **Hosting preference**: Do you need local models for offline use or privacy, or are you comfortable with cloud services? +2. **Performance requirements**: Different providers offer varying levels of speed, quality, and context length. +3. **Specific capabilities**: Some models excel at code generation, others at embeddings or reasoning tasks. +4. **Pricing**: Costs vary significantly between providers, from free local options to premium cloud services. +5. **API key requirements**: Most cloud providers require API keys that you'll need to configure. + +## Configuration Format + +You can add models to your `config.yaml` file like this: + +```yaml +models: + - name: My Model + provider: openai # Choose provider from the lists above + model: gpt-4o # Specific model name + apiKey: ${{ secrets.OPENAI_API_KEY }} + roles: + - chat + - edit + - apply +``` + +For more detailed configuration, visit the specific provider pages linked above. diff --git a/docs/customize/model-providers/top-level/anthropic.mdx b/docs/customize/model-providers/top-level/anthropic.mdx index d0f925977..e3193e2bd 100644 --- a/docs/customize/model-providers/top-level/anthropic.mdx +++ b/docs/customize/model-providers/top-level/anthropic.mdx @@ -1,6 +1,8 @@ --- -title: Anthropic +title: "How to Configure Anthropic Claude Models with Continue" slug: ../anthropic +description: "Configure Anthropic's Claude models with Continue, including Claude 4 Sonnet with prompt caching capabilities to improve performance and reduce costs for chat applications" +sidebarTitle: "Anthropic" --- @@ -8,7 +10,7 @@ slug: ../anthropic console](https://console.anthropic.com/account/keys). -## Chat model +## How to Set Up Anthropic Chat Models We recommend configuring **Claude 4 Sonnet** as your chat model. @@ -38,25 +40,25 @@ We recommend configuring **Claude 4 Sonnet** as your chat model. -## Autocomplete model +## Anthropic Autocomplete Model Availability Anthropic currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. -## Embeddings model +## Anthropic Embeddings Model Availability Anthropic currently does not offer any embeddings models. [Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. -## Reranking model +## Anthropic Reranking Model Availability Anthropic currently does not offer any reranking models. [Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. -## Prompt caching +## How to Enable Prompt Caching with Claude Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching), which allows Claude models to cache system messages and conversation history between requests to improve performance and reduce costs. diff --git a/docs/customize/model-providers/top-level/azure.mdx b/docs/customize/model-providers/top-level/azure.mdx index 722a2fd97..b59c2071c 100644 --- a/docs/customize/model-providers/top-level/azure.mdx +++ b/docs/customize/model-providers/top-level/azure.mdx @@ -1,11 +1,19 @@ --- -title: Azure AI Foundry +title: "How to Configure Azure AI Foundry with Continue" slug: ../azure +description: "Configure Azure AI Foundry with Continue to access models from OpenAI and Mistral with Microsoft's enterprise security features, including setup for GPT-4o, Codestral, and embedding models" +sidebarTitle: "Azure AI Foundry" --- Azure AI Foundry is a cloud-based service that provides access to models from OpenAI, Mistral AI, and others, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure AI Foundry resource in the [Azure portal](https://portal.azure.com). -## Chat model + + +For details on OpenAI model setup, see [Azure OpenAI Service configuration](#how-to-configure-azure-openai-service). + + + +## How to Set Up Azure AI Foundry Chat Models We recommend configuring **GPT-4o** as your chat model. @@ -41,7 +49,7 @@ We recommend configuring **GPT-4o** as your chat model. -## Autocomplete model +## How to Set Up Azure AI Foundry Autocomplete Models We recommend configuring **Codestral** as your autocomplete model. @@ -82,7 +90,7 @@ If you use Azure Machine Learning Studio to deploy Codestral: -## Embeddings model +## How to Configure Azure AI Foundry Embeddings Models We recommend configuring **text-embedding-3-large** as your embeddings model. diff --git a/docs/customize/model-providers/top-level/bedrock.mdx b/docs/customize/model-providers/top-level/bedrock.mdx index 93ed96648..4de1f2b54 100644 --- a/docs/customize/model-providers/top-level/bedrock.mdx +++ b/docs/customize/model-providers/top-level/bedrock.mdx @@ -1,11 +1,13 @@ --- -title: Amazon Bedrock +title: "How to Configure Amazon Bedrock with Continue" slug: ../bedrock +description: "Configure Amazon Bedrock with Continue to access foundation models like Claude 3.7 Sonnet for chat, Titan for embeddings, and Cohere for reranking, with AWS credential authentication" +sidebarTitle: "Amazon Bedrock" --- Amazon Bedrock is a fully managed service on AWS that provides access to foundation models from various AI companies through a single API. -## Chat model +## How to Set Up Amazon Bedrock Chat Models We recommend configuring **Claude 3.7 Sonnet** as your chat model. @@ -75,13 +77,13 @@ We recommend configuring **Claude 3.7 Sonnet** as your chat model. -## Autocomplete model +## How to Set Up Amazon Bedrock Autocomplete Models Bedrock currently does not offer any autocomplete models. However, [Codestral from Mistral](https://mistral.ai/news/codestral-2501/) and [Point from Poolside](https://aws.amazon.com/bedrock/poolside/) will be supported in the near future. -In the meantime, you can view a list of autocomplete model providers [here](../../model-roles/autocomplete.md). +In the meantime, you can view a list of autocomplete model providers [here](../../model-roles/autocomplete). -## Embeddings model +## How to Configure Amazon Bedrock Embeddings Models We recommend configuring [`amazon.titan-embed-text-v2:0`](https://docs.aws.amazon.com/bedrock/latest/devguide/models.html#amazon.titan-embed-text-v2-0) as your embeddings model. @@ -112,7 +114,7 @@ We recommend configuring [`amazon.titan-embed-text-v2:0`](https://docs.aws.amazo -## Reranking model +## How to Configure Amazon Bedrock Reranking Models We recommend configuring `cohere.rerank-v3-5:0` as your reranking model, you may also use `amazon.rerank-v1:0`. @@ -144,7 +146,7 @@ We recommend configuring `cohere.rerank-v3-5:0` as your reranking model, you may -## Prompt caching +## How to Enable Prompt Caching with Amazon Bedrock Bedrock allows Claude models to cache tool payloads, system messages, and chat messages between requests. Enable this behavior by adding @@ -174,7 +176,7 @@ models: Prompt caching is not supported in JSON configuration files, so use the YAML syntax above to enable it. -## Authentication +## How to Set Up Authentication for Amazon Bedrock Authentication will be through temporary or long-term credentials in `~/.aws/credentials` under a configured profile (e.g. "bedrock"). @@ -221,7 +223,7 @@ You can also use an AWS `accessKeyId` and `secretAccessKey` for authentication i -## Custom Imported Models +## How to Configure Custom Imported Models with Amazon Bedrock To setup Bedrock using custom imported models, add the following to your config file: diff --git a/docs/customize/model-providers/top-level/deepseek.mdx b/docs/customize/model-providers/top-level/deepseek.mdx index ce60d8589..376a33173 100644 --- a/docs/customize/model-providers/top-level/deepseek.mdx +++ b/docs/customize/model-providers/top-level/deepseek.mdx @@ -1,13 +1,15 @@ --- -title: DeepSeek +title: "How to Configure DeepSeek with Continue" slug: ../deepseek +description: "Configure DeepSeek models with Continue, including DeepSeek Chat for general conversations and DeepSeek Coder specifically optimized for code autocomplete and programming tasks" +sidebarTitle: "DeepSeek" --- You can get an API key from the [DeepSeek console](https://www.deepseek.com/). -## Chat model +## How to Set Up DeepSeek Chat Models We recommend configuring **DeepSeek Chat** as your chat model. @@ -37,7 +39,7 @@ We recommend configuring **DeepSeek Chat** as your chat model. -## Autocomplete model +## How to Set Up DeepSeek Autocomplete Models We recommend configuring **DeepSeek Coder** as your autocomplete model. @@ -67,13 +69,13 @@ We recommend configuring **DeepSeek Coder** as your autocomplete model. -## Embeddings model +## How to Configure DeepSeek Embeddings Models DeepSeek currently does not offer any embeddings models. [Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. -## Reranking model +## How to Configure DeepSeek Reranking Models DeepSeek currently does not offer any reranking models. diff --git a/docs/customize/model-providers/top-level/gemini.mdx b/docs/customize/model-providers/top-level/gemini.mdx index e07acd332..2e85be425 100644 --- a/docs/customize/model-providers/top-level/gemini.mdx +++ b/docs/customize/model-providers/top-level/gemini.mdx @@ -1,6 +1,8 @@ --- -title: Gemini +title: "How to Configure Gemini with Continue" slug: ../gemini +description: "Configure Google's Gemini models with Continue to access Gemini 2.0 Flash for chat and text-embedding-004 for embeddings with simple API key authentication" +sidebarTitle: "Gemini" --- @@ -8,7 +10,7 @@ slug: ../gemini Studio](https://aistudio.google.com/). -## Chat model +## How to Set Up Gemini Chat Models We recommend configuring **Gemini 2.0 Flash** as your chat model. @@ -38,13 +40,13 @@ We recommend configuring **Gemini 2.0 Flash** as your chat model. -## Autocomplete model +## How to Set Up Gemini Autocomplete Models Gemini currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. -## Embeddings model +## How to Configure Gemini Embeddings Models We recommend configuring **text-embedding-004** as your embeddings model. @@ -73,7 +75,7 @@ We recommend configuring **text-embedding-004** as your embeddings model. -## Reranking model +## How to Configure Gemini Reranking Models Gemini currently does not offer any reranking models. diff --git a/docs/customize/model-providers/top-level/inception.mdx b/docs/customize/model-providers/top-level/inception.mdx index 7e36a8bf5..396921d76 100644 --- a/docs/customize/model-providers/top-level/inception.mdx +++ b/docs/customize/model-providers/top-level/inception.mdx @@ -1,6 +1,8 @@ --- -title: Inception +title: "How to Configure Inception with Continue" slug: ../inception +description: "Configure Inception Labs models with Continue, featuring Mercury Coder Small for both chat and autocomplete functions, optimized for programming and code generation tasks" +sidebarTitle: "Inception" --- @@ -8,7 +10,7 @@ slug: ../inception Dashboard](https://platform.inceptionlabs.ai/dashboard/api-keys). -## Chat model +## How to Set Up Inception Chat Models We recommend configuring **Mercury Coder Small** as your chat model. @@ -37,7 +39,7 @@ We recommend configuring **Mercury Coder Small** as your chat model. -## Autocomplete model +## How to Set Up Inception Autocomplete Models We also recommend configuring **Mercury Coder Small** as your autocomplete model. @@ -66,13 +68,13 @@ We also recommend configuring **Mercury Coder Small** as your autocomplete model -## Embeddings model +## How to Configure Inception Embeddings Models Inception currently does not offer any embeddings models. [Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. -## Reranking model +## How to Configure Inception Reranking Models Inception currently does not offer any reranking models. diff --git a/docs/customize/model-providers/top-level/mistral.mdx b/docs/customize/model-providers/top-level/mistral.mdx index 63fcc53cb..6b3619bc8 100644 --- a/docs/customize/model-providers/top-level/mistral.mdx +++ b/docs/customize/model-providers/top-level/mistral.mdx @@ -1,6 +1,8 @@ --- -title: Mistral +title: "How to Configure Mistral with Continue" slug: ../mistral +description: "Configure Mistral AI models with Continue, including Mistral Large for chat, Codestral for code autocomplete, and Mistral Embed for embeddings with separate API key options" +sidebarTitle: "Mistral" --- @@ -12,7 +14,7 @@ slug: ../mistral using `https://api.mistral.ai/v1`. -## Chat model +## How to Set Up Mistral Chat Models We recommend configuring **Mistral Large** as your chat model. @@ -44,7 +46,7 @@ We recommend configuring **Mistral Large** as your chat model. -## Autocomplete model +## How to Set Up Mistral Autocomplete Models We recommend configuring **Codestral** as your autocomplete model. @@ -74,7 +76,7 @@ We recommend configuring **Codestral** as your autocomplete model. -## Embeddings model +## How to Configure Mistral Embeddings Models We recommend configuring **Mistral Embed** as your embeddings model. @@ -105,7 +107,7 @@ We recommend configuring **Mistral Embed** as your embeddings model. -## Reranking model +## How to Configure Mistral Reranking Models Mistral currently does not offer any reranking models. diff --git a/docs/customize/model-providers/top-level/ollama.mdx b/docs/customize/model-providers/top-level/ollama.mdx index 6c2d4002f..cdc4fa720 100644 --- a/docs/customize/model-providers/top-level/ollama.mdx +++ b/docs/customize/model-providers/top-level/ollama.mdx @@ -1,11 +1,13 @@ --- -title: Ollama +title: "How to Configure Ollama with Continue" slug: ../ollama +description: "Configure Ollama with Continue to run powerful open source models locally including Llama3.1 for chat, Qwen2.5-Coder for autocomplete, and Nomic Embed Text for embeddings" +sidebarTitle: "Ollama" --- Ollama is an open-source tool that allows to run large language models (LLMs) locally on their own computers. To use Ollama, you can install it [here](https://ollama.ai/download) and download the model you want to run with the `ollama run` command. -## Chat model +## How to Set Up Ollama Chat Models We recommend configuring **Llama3.1 8B** as your chat model. @@ -33,7 +35,7 @@ We recommend configuring **Llama3.1 8B** as your chat model. -## Autocomplete model +## How to Configure Ollama Autocomplete Models We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model. @@ -61,7 +63,7 @@ We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model. -## Embeddings model +## How to Set Up Ollama Embeddings Models We recommend configuring **Nomic Embed Text** as your embeddings model. @@ -88,13 +90,13 @@ We recommend configuring **Nomic Embed Text** as your embeddings model. -## Reranking model +## Ollama Reranking Model Availability Ollama currently does not offer any reranking models. -[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. +[Click here](../../model-roles/reranking) to see a list of reranking model providers. -## Using a remote instance +## How to Configure Remote Ollama Instance To configure a remote instance of Ollama, add the `"apiBase"` property to your model in config.json: @@ -124,7 +126,7 @@ To configure a remote instance of Ollama, add the `"apiBase"` property to your m -## Model Capabilities +## How to Configure Model Capabilities in Ollama Ollama models usually have their capabilities auto-detected correctly. However, if you're using custom model names or experiencing issues with tools/images not working, you can explicitly set capabilities: @@ -160,5 +162,6 @@ Ollama models usually have their capabilities auto-detected correctly. However, -Most standard Ollama models (like llama3.1, mistral, etc.) support tool use by default. Vision models (like llava) also support image input. + Most standard Ollama models (like llama3.1, mistral, etc.) support tool use by + default. Vision models (like llava) also support image input. diff --git a/docs/customize/model-providers/top-level/openai.mdx b/docs/customize/model-providers/top-level/openai.mdx index b52ee1c08..96bd5a9ad 100644 --- a/docs/customize/model-providers/top-level/openai.mdx +++ b/docs/customize/model-providers/top-level/openai.mdx @@ -1,6 +1,8 @@ --- -title: OpenAI +title: "How to Configure OpenAI Models with Continue" slug: ../openai +description: "Configure OpenAI models with Continue, including GPT-4o for chat and text-embedding-3-large for embeddings, with support for OpenAI-compatible servers and APIs" +sidebarTitle: "OpenAI" --- @@ -8,7 +10,7 @@ slug: ../openai console](https://platform.openai.com/account/api-keys) -## Chat model +## How to Set Up OpenAI Chat Models We recommend configuring **GPT-4o** as your chat model. @@ -38,13 +40,13 @@ We recommend configuring **GPT-4o** as your chat model. -## Autocomplete model +## OpenAI Autocomplete Model Availability OpenAI currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. -## Embeddings model +## How to Configure OpenAI Embeddings Models We recommend configuring **text-embedding-3-large** as your embeddings model. @@ -73,13 +75,13 @@ We recommend configuring **text-embedding-3-large** as your embeddings model. -## Reranking model +## OpenAI Reranking Model Availability OpenAI currently does not offer any reranking models. [Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. -## OpenAI compatible servers / APIs +## How to Use OpenAI-Compatible Servers and APIs OpenAI compatible servers @@ -97,6 +99,8 @@ OpenAI compatible APIs - [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others) - [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) +### How to Configure Custom API Base for OpenAI-Compatible Services + If you are using an OpenAI compatible server / API, you can change the `apiBase` like this: @@ -127,6 +131,8 @@ If you are using an OpenAI compatible server / API, you can change the `apiBase` +### How to Force Legacy Completions Endpoint Usage + To force usage of `chat/completions` instead of `completions` endpoint you can set: diff --git a/docs/customize/model-providers/top-level/vertexai.mdx b/docs/customize/model-providers/top-level/vertexai.mdx index d1628d798..2e32f7deb 100644 --- a/docs/customize/model-providers/top-level/vertexai.mdx +++ b/docs/customize/model-providers/top-level/vertexai.mdx @@ -1,6 +1,8 @@ --- -title: Vertex AI +title: "How to Configure Vertex AI with Continue" slug: ../vertexai +description: "Configure Google Cloud's Vertex AI with Continue to access powerful models like Claude 3.5 Sonnet, Codestral, and text-embedding-004 for chat, autocomplete, and embeddings" +sidebarTitle: "Vertex AI" --- @@ -10,7 +12,7 @@ slug: ../vertexai Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc). -## Chat model +## How to Set Up Vertex AI Chat Models We recommend configuring **Claude 3.5 Sonnet** as your chat model. @@ -43,7 +45,7 @@ We recommend configuring **Claude 3.5 Sonnet** as your chat model. -## Autocomplete model +## How to Set Up Vertex AI Autocomplete Models We recommend configuring **Codestral** or **code-gecko** as your autocomplete model. @@ -77,7 +79,7 @@ We recommend configuring **Codestral** or **code-gecko** as your autocomplete mo -## Embeddings model +## How to Configure Vertex AI Embeddings Models We recommend configuring **text-embedding-004** as your embeddings model. @@ -109,13 +111,13 @@ We recommend configuring **text-embedding-004** as your embeddings model. -## Reranking model +## How to Configure Vertex AI Reranking Models Vertex AI currently does not offer any reranking models. [Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. -## Express mode +## How to Enable Vertex AI Express Mode You can use VertexAI in [express mode](https://cloud.google.com/vertex-ai/generative-ai/docs/start/express-mode/overview) by only providing an API Key. Only some Gemini models are supported in express mode for now. diff --git a/docs/customize/model-providers/top-level/xAI.mdx b/docs/customize/model-providers/top-level/xAI.mdx index c196cf801..f77638d25 100644 --- a/docs/customize/model-providers/top-level/xAI.mdx +++ b/docs/customize/model-providers/top-level/xAI.mdx @@ -1,13 +1,15 @@ --- -title: xAI +title: "How to Configure xAI with Continue" slug: ../xai +description: "Configure xAI's Grok 4 model with Continue for advanced chat capabilities, with easy API key setup from the xAI console" +sidebarTitle: "xAI" --- You can get an API key from the [xAI console](https://console.x.ai/) -## Chat model +## How to Set Up xAI Chat Models We recommend configuring **grok-4** as your chat model. For information on other available models, visit [xAI Documentation](https://docs.x.ai/docs/models). @@ -40,19 +42,19 @@ We recommend configuring **grok-4** as your chat model. For information on other -## Autocomplete model +## How to Set Up xAI Autocomplete Models xAI currently does not offer any autocomplete models. -[Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. +[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers. -## Embeddings model +## How to Configure xAI Embeddings Models xAI currently does not offer any embeddings models. [Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. -## Reranking model +## How to Configure xAI Reranking Models xAI currently does not offer any reranking models. diff --git a/docs/customize/model-roles.mdx b/docs/customize/model-roles.mdx index dbc065f1c..8db06d857 100644 --- a/docs/customize/model-roles.mdx +++ b/docs/customize/model-roles.mdx @@ -2,6 +2,7 @@ title: "Model roles" sidebarTitle: Overview icon: "circle-info" +description: "Learn about the different model roles in Continue including chat, autocomplete, edit, apply, embeddings, and reranking for customizing your AI coding assistant's capabilities" --- diff --git a/docs/customize/model-roles/00-intro.mdx b/docs/customize/model-roles/00-intro.mdx index 5ae734269..3722d08de 100644 --- a/docs/customize/model-roles/00-intro.mdx +++ b/docs/customize/model-roles/00-intro.mdx @@ -9,7 +9,7 @@ sidebar_label: Introduction Models in Continue can be configured to be used for various roles in the extension. - [`chat`](./chat.mdx): Used for chat conversations in the extension sidebar -- [`autocomplete`](./autocomplete.md): Used for autocomplete code suggestions in the editor +- [`autocomplete`](./autocomplete): Used for autocomplete code suggestions in the editor - [`edit`](./edit.mdx): Used to generate code based on edit prompts - [`apply`](./apply.mdx): Used to decide how to apply edits to a file - [`embed`](./embeddings.mdx): Used to generate embeddings used for vector search (@Codebase and @Docs context providers) diff --git a/docs/customize/model-roles/autocomplete.mdx b/docs/customize/model-roles/autocomplete.mdx index 621417805..dc7bbe58f 100644 --- a/docs/customize/model-roles/autocomplete.mdx +++ b/docs/customize/model-roles/autocomplete.mdx @@ -1,6 +1,7 @@ --- -title: Autocomplete Role -description: Autocomplete model role +title: "Autocomplete Role in Continue Models" +sidebarTitle: "Autocomplete Role" +description: "Learn how the autocomplete role works in Continue, which models to use, and how to customize prompt templates for inline code suggestions." keywords: [autocomplete, model, role] sidebar_position: 2 --- @@ -11,7 +12,7 @@ In Continue, autocomplete models are used to display inline [Autocomplete](../.. ## Recommended Autocomplete models -Visit the [Autocomplete Deep Dive](../deep-dives/autocomplete.mdx) for recommended models and more details. +Visit the [Autocomplete Deep Dive](../deep-dives/autocomplete) for recommended models and more details. ## Prompt templating diff --git a/docs/customize/model-roles/chat.mdx b/docs/customize/model-roles/chat.mdx index cd98dc307..300600a33 100644 --- a/docs/customize/model-roles/chat.mdx +++ b/docs/customize/model-roles/chat.mdx @@ -7,7 +7,7 @@ sidebar_position: 1 A "chat model" is an LLM that is trained to respond in a conversational format. Because they should be able to answer general questions and generate complex code, the best chat models are typically large, often 405B+ parameters. -In Continue, these models are used for normal [Chat](../../features/chat/quick-start) and [VS Code actions](../deep-dives/vscode-actions.md). The selected chat model will also be used for [Edit](../../features/edit/quick-start) and [Apply](./apply.mdx) if no `edit` or `apply` models are specified, respectively. +In Continue, these models are used for normal [Chat](../../features/chat/quick-start) and [VS Code actions](../deep-dives/vscode-actions). The selected chat model will also be used for [Edit](../../features/edit/quick-start) and [Apply](./apply) if no `edit` or `apply` models are specified, respectively. ## Recommended Chat models @@ -17,7 +17,7 @@ For the best overall Chat experience, you will want to use a 400B+ parameter mod ### Claude Sonnet 3.7 from Anthropic -Our current top recommendation is Claude 3.7 Sonnet from [Anthropic](../model-providers/top-level/anthropic.mdx). +Our current top recommendation is Claude 3.7 Sonnet from [Anthropic](../model-providers/top-level/anthropic). @@ -50,7 +50,7 @@ Our current top recommendation is Claude 3.7 Sonnet from [Anthropic](../model-pr ### Gemma from Google DeepMind -If you prefer to use an open-weight model, then the Gemma family of Models from Google DeepMind is a good choice. You will need to decide if you use it through a SaaS model provider, e.g. [Together](../model-providers/more/together.mdx), or self-host it, e.g. [Ollama](../model-providers/top-level/ollama.mdx). +If you prefer to use an open-weight model, then the Gemma family of Models from Google DeepMind is a good choice. You will need to decide if you use it through a SaaS model provider, e.g. [Together](../model-providers/more/together), or self-host it, e.g. [Ollama](../model-providers/top-level/ollama). @@ -119,7 +119,7 @@ If you prefer to use an open-weight model, then the Gemma family of Models from ### GPT-4o from OpenAI -If you prefer to use a model from [OpenAI](../model-providers/top-level/openai.mdx), then we recommend GPT-4o. +If you prefer to use a model from [OpenAI](../model-providers/top-level/openai), then we recommend GPT-4o. @@ -152,7 +152,7 @@ If you prefer to use a model from [OpenAI](../model-providers/top-level/openai.m ### Grok-2 from xAI -If you prefer to use a model from [xAI](../model-providers/top-level/xAI.mdx), then we recommend Grok-2. +If you prefer to use a model from [xAI](../model-providers/top-level/xAI), then we recommend Grok-2. @@ -185,7 +185,7 @@ If you prefer to use a model from [xAI](../model-providers/top-level/xAI.mdx), t ### Gemini 2.0 Flash from Google -If you prefer to use a model from [Google](../model-providers/top-level/gemini.mdx), then we recommend Gemini 2.0 Flash. +If you prefer to use a model from [Google](../model-providers/top-level/gemini), then we recommend Gemini 2.0 Flash. @@ -222,7 +222,7 @@ For the best local, offline Chat experience, you will want to use a model that i ### Llama 3.1 8B -If your local machine can run an 8B parameter model, then we recommend running Llama 3.1 8B on your machine (e.g. using [Ollama](../model-providers/top-level/ollama.mdx) or [LM Studio](../model-providers/more/lmstudio.mdx)). +If your local machine can run an 8B parameter model, then we recommend running Llama 3.1 8B on your machine (e.g. using [Ollama](../model-providers/top-level/ollama) or [LM Studio](../model-providers/more/lmstudio)). diff --git a/docs/customize/model-roles/embeddings.mdx b/docs/customize/model-roles/embeddings.mdx index feb7f675d..df6806189 100644 --- a/docs/customize/model-roles/embeddings.mdx +++ b/docs/customize/model-roles/embeddings.mdx @@ -7,7 +7,7 @@ sidebar_position: 5 An "embeddings model" is trained to convert a piece of text into a vector, which can later be rapidly compared to other vectors to determine similarity between the pieces of text. Embeddings models are typically much smaller than LLMs, and will be extremely fast and cheap in comparison. -In Continue, embeddings are generated during indexing and then used by [@Codebase](../context/codebase.mdx) to perform similarity search over your codebase. +In Continue, embeddings are generated during indexing and then used by [@Codebase](../context/codebase) to perform similarity search over your codebase. You can add `embed` to a model's `roles` to specify that it can be used to embed. @@ -118,7 +118,7 @@ See [here](../model-providers/top-level/ollama#embeddings-model) for instruction ### OpenAI -See [here](../model-providers/top-level/openai#embeddings-model) for instructions on how to use OpenAI for embeddings. +See [here](../model-providers/top-level/openai#how-to-configure-openai-embeddings-models) for instructions on how to use OpenAI for embeddings. ### Cohere @@ -126,15 +126,15 @@ See [here](../model-providers/more/cohere#embeddings-model) for instructions on ### Gemini -See [here](../model-providers/top-level/gemini#embeddings-model) for instructions on how to use Gemini for embeddings. +See [here](../model-providers/top-level/gemini#how-to-configure-gemini-embeddings-models) for instructions on how to use Gemini for embeddings. ### Vertex -See [here](../model-providers/top-level/vertexai#embeddings-model) for instructions on how to use Vertex for embeddings. +See [here](../model-providers/top-level/vertexai#how-to-configure-vertex-ai-embeddings-models) for instructions on how to use Vertex for embeddings. ### Mistral -See [here](../model-providers/top-level/mistral#embeddings-model) for instructions on how to use Mistral for embeddings. +See [here](../model-providers/top-level/mistral#how-to-configure-mistral-embeddings-models) for instructions on how to use Mistral for embeddings. ### NVIDIA @@ -142,7 +142,7 @@ See [here](../model-providers/more/nvidia#embeddings-model) for instructions on ### Bedrock -See [here](../model-providers/top-level/bedrock#embeddings-model) for instructions on how to use Bedrock for embeddings. +See [here](../model-providers/top-level/bedrock#how-to-configure-amazon-bedrock-embeddings-models) for instructions on how to use Bedrock for embeddings. ### WatsonX diff --git a/docs/customize/model-roles/reranking.mdx b/docs/customize/model-roles/reranking.mdx index 52f1524a0..e9210e0eb 100644 --- a/docs/customize/model-roles/reranking.mdx +++ b/docs/customize/model-roles/reranking.mdx @@ -7,7 +7,7 @@ sidebar_position: 6 A "reranking model" is trained to take two pieces of text (often a user question and a document) and return a relevancy score between 0 and 1, estimating how useful the document will be in answering the question. Rerankers are typically much smaller than LLMs, and will be extremely fast and cheap in comparison. -In Continue, rerankers are designated using the `rerank` role and used by [@Codebase](../context/codebase.mdx) in order to select the most relevant code snippets after vector search. +In Continue, rerankers are designated using the `rerank` role and used by [@Codebase](../context/codebase) in order to select the most relevant code snippets after vector search. ## Recommended reranking models diff --git a/docs/customize/overview.mdx b/docs/customize/overview.mdx index 38479b71c..4d9061799 100644 --- a/docs/customize/overview.mdx +++ b/docs/customize/overview.mdx @@ -13,19 +13,19 @@ Master how Continue understands your codebase with powerful context providers fo Specialized context features for codebase understanding and documentation integration. -[Browse Context Features β†’](/customization/overview#codebase-context) +[Browse Context Features β†’](customize/context/codebase) ## Deep Dives Detailed technical explanations of Continue's internal workings and advanced configuration options. -[Read Deep Dives β†’](/customization/overview#configuration) +[Read Deep Dives β†’](/customize/deep-dives/configuration) ## Model Providers Configure and optimize different AI model providers for your specific needs and infrastructure. -[Configure Providers β†’](/customization/models#openai) +[Configure Providers β†’](/customize/model-providers/overview) ## Model Roles diff --git a/docs/customize/telemetry.mdx b/docs/customize/telemetry.mdx index 3d5952b14..8522cd447 100644 --- a/docs/customize/telemetry.mdx +++ b/docs/customize/telemetry.mdx @@ -1,5 +1,6 @@ --- title: "Telemetry" +description: "Learn about Continue's anonymous telemetry collection practices, what usage data is collected, and how to opt out if you prefer not to share your usage information" --- ## Overview diff --git a/docs/docs.json b/docs/docs.json index a98c84f49..12edfb25c 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -102,6 +102,7 @@ "group": "Model Providers", "icon": "server", "pages": [ + "customize/model-providers/overview", { "group": "Popular Providers", "pages": [ @@ -1008,6 +1009,10 @@ { "source": "/customization/overview#documentation-context", "destination": "/customize/context/documentation" + }, + { + "source": "/customize/model-providers", + "destination": "/customize/model-providers/overview" } ] } diff --git a/docs/features/agent/context-selection.mdx b/docs/features/agent/context-selection.mdx index 57efd4711..8d43ad2d3 100644 --- a/docs/features/agent/context-selection.mdx +++ b/docs/features/agent/context-selection.mdx @@ -1,3 +1,8 @@ +--- +title: "Context Selection" +description: "Learn how Continue's agent mode selects relevant code context using file content, language server definitions, imports, and recent file history." +--- + You can use the same methods to manually add context as [Chat](/features/chat/context-selection). Tool call responses are automatically included as context items. This enables Agent mode to see the result of the previous action and decide what to do next. diff --git a/docs/features/agent/how-it-works.mdx b/docs/features/agent/how-it-works.mdx index eaca170b7..d24557d78 100644 --- a/docs/features/agent/how-it-works.mdx +++ b/docs/features/agent/how-it-works.mdx @@ -1,9 +1,9 @@ --- -title: "How Agent Works" +title: "How Agent Mode Works" description: "Agent offers the same functionality as Chat, while also including tools in the request to the model and an interface for handling tool calls and responses." --- -## The tool handshake +## How the Tool Handshake Works Tools provide a flexible, powerful way for models to interface with the external world. They are provided to the model as a JSON object with a name and an arguments schema. For example, a `read_file` tool with a `filepath` argument will give the model the ability to request the contents of a specific file. @@ -17,19 +17,18 @@ The following handshake describes how Agent uses tools: 6. The model responds, potentially with another tool call and step 2 begins again - Tool availability varies by mode: - - **Chat mode**: No tools included - - **Plan mode**: Only read-only tools included - - **Agent mode**: All tools included + Tool availability varies by mode: - **Chat mode**: No tools included - **Plan + mode**: Only read-only tools included - **Agent mode**: All tools included -## Built-in tools +## What Built-in Tools Are Available Continue includes several built-in tools which provide the model access to IDE functionality. -### Plan mode tools (read-only) +### What Tools Are Available in Plan Mode (Read-Only) In Plan mode, only these read-only tools are available: + - **Read file** (`read_file`) - **Read currently open file** (`read_currently_open_file`) - **List directory** (`ls`) @@ -42,7 +41,7 @@ In Plan mode, only these read-only tools are available: - **View subdirectory** (`view_subdirectory`) - **Codebase tool** (`codebase_tool`) -### Agent mode tools (all tools) +### What Tools Are Available in Agent Mode (All Tools) In Agent mode, all tools are available including the read-only tools above plus: diff --git a/docs/features/agent/how-to-customize.mdx b/docs/features/agent/how-to-customize.mdx index 7e5fd634b..b26994906 100644 --- a/docs/features/agent/how-to-customize.mdx +++ b/docs/features/agent/how-to-customize.mdx @@ -1,8 +1,14 @@ -## Add Rules Blocks +--- +title: "How to Customize Agent Mode" +description: "Learn how to customize Agent Mode in Continue to better fit your workflow and coding style." +sidebarTitle: "Customize Agent" +--- + +## How to Add Rules Blocks Adding Rules can be done in your assistant locally or in the Hub. You can explore Rules on the Continue Hub and refer to the [Rules deep dive](/customize/deep-dives/rules) for more details. -## Customize System Messages +## How to Customize System Messages You can customize the system messages for Chat, Agent, and Plan modes using model-level configuration: @@ -17,11 +23,11 @@ models: basePlanSystemMessage: "You are a planning assistant. Create clear, actionable steps." ``` -## Add MCP Tools +## How to Add MCP Tools You can add MCP servers to your assistant to give Agent access to more tools. Explore [MCP Servers on the Hub](https://hub.continue.dev) and consult the [MCP guide](/customize/deep-dives/mcp) for more details. -## Tool Policies +## How to Configure Tool Policies You can adjust the Agent's tool usage behavior to three options: diff --git a/docs/features/agent/model-setup.mdx b/docs/features/agent/model-setup.mdx index 88a22aa55..e38ce1c5e 100644 --- a/docs/features/agent/model-setup.mdx +++ b/docs/features/agent/model-setup.mdx @@ -1,6 +1,12 @@ +--- +title: "Model Setup for Agent Mode" +description: "Learn how to set up models for Agent Mode in Continue, including recommended models and configuration options for optimal performance" +sidebarTitle: "Model Setup" +--- + The models you set up for Chat mode will be used with Agent mode if the model supports tool calling. The recommended models and how to set them up can be found [here](/features/chat/model-setup). -## System Message Tools +## How System Message Tools Work System message tools are experimental and may change in future releases. @@ -8,7 +14,7 @@ The models you set up for Chat mode will be used with Agent mode if the model su Continue implements an innovative approach called **system message tools** that ensures consistent tool functionality across all models, regardless of their native capabilities. This allows Agent mode to work seamlessly with a wider range of models and providers. -### How It Works +### How System Message Tools Function Instead of relying solely on native tool calling APIs (which vary between providers), Continue converts tools into XML format and includes them in the system message. The model generates tool calls as structured XML within its response, which Continue then parses and executes. This approach provides: @@ -17,21 +23,23 @@ Instead of relying solely on native tool calling APIs (which vary between provid - **Better reliability** - Models that struggle with native tools often perform better with system message tools - **Seamless switching** - Change between providers without modifying your workflow -### Recommended Models +### What Models Are Recommended for Agent Mode For the best Agent mode experience, we recommend models with strong reasoning and instruction-following capabilities: **Premium Models:** + - **Claude Sonnet 4** (Anthropic) - Our top recommendation for its exceptional tool use and reasoning - **GPT-4** models (OpenAI) - Excellent native tool support - **DeepSeek** models - Strong performance with competitive pricing **Local Models:** While more limited in capabilities, these models can work with system message tools: + - Qwen2.5-Coder 32B - Best local option for Agent mode - Devstral 27B - Good for code-specific tasks - Smaller models (7B-13B) - May struggle with complex tool interactions -### Configuration +### How to Configure Agent Mode Agent mode automatically determines whether to use native or system message tools based on the model's capabilities. No additional configuration is required - simply select your model and Continue handles the rest. diff --git a/docs/features/agent/plan-mode.mdx b/docs/features/agent/plan-mode.mdx index 104b73d37..474c3fbd9 100644 --- a/docs/features/agent/plan-mode.mdx +++ b/docs/features/agent/plan-mode.mdx @@ -1,6 +1,7 @@ --- -title: "Plan Mode" -description: "Explore and understand code safely with read-only tools" +title: "Plan Mode in Continue – Safe, Read-Only Code Exploration" +sidebarTitle: "Plan Mode" +description: "Learn how to use Plan Mode in Continue to explore and understand codebases safely with read-only tools, search, and analysis before making changes" --- ## What is Plan mode? @@ -9,16 +10,17 @@ Plan mode is a restricted environment that provides read-only access to your cod ![Plan mode in action](/images/plan-mode.gif) -### Key features +### What Are the Key Features of Plan Mode? - **Read-only tools**: Access files, search, and analyze without risk - **Safe exploration**: Perfect for understanding unfamiliar codebases - **Planning focus**: Develop implementation strategies before execution - **MCP support**: Works with all MCP tools alongside built-in read-only tools -### How it works +### How Plan Mode Works Plan mode filters the available tools to only include read-only operations. This means you can: + - Read any file in your project - Search through code with grep and glob patterns - View repository structure and diffs @@ -26,11 +28,12 @@ Plan mode filters the available tools to only include read-only operations. This - Use all MCP tools But you cannot: + - Create, edit, or delete files - Run terminal commands - Make any system changes -### Getting started +### How to Get Started with Plan Mode Select "Plan" from the mode selector below the chat input, or use `Cmd/Ctrl + .` to cycle through modes. @@ -38,12 +41,14 @@ Select "Plan" from the mode selector below the chat input, or use `Cmd/Ctrl + .` For detailed information about tools and usage, see the [Agent documentation](/features/agent/how-it-works), which covers both Agent and Plan modes. -### Common workflow +### What Is the Common Workflow for Plan Mode? 1. **Start in Plan mode** to explore and understand 2. **Develop your approach** with the model's help 3. **Switch to Agent mode** when ready to implement - Plan mode shares the same interface and context features as Chat and Agent modes. You can use `@` context providers and highlight code just like in other modes. - \ No newline at end of file + Plan mode shares the same interface and context features as Chat and Agent + modes. You can use `@` context providers and highlight code just like in other + modes. + diff --git a/docs/features/agent/quick-start.mdx b/docs/features/agent/quick-start.mdx index 91f2e6297..32d99869a 100644 --- a/docs/features/agent/quick-start.mdx +++ b/docs/features/agent/quick-start.mdx @@ -1,28 +1,46 @@ --- title: "Quick Start" +description: "Get started with Continue's Agent mode to automatically implement code changes, fix bugs, and run commands using AI-powered tools that can modify your codebase based on natural language instructions" --- -## How to use it - Agent equips the Chat model with the tools needed to handle a wide range of coding tasks, allowing the model to make decisions and save you the work of manually finding context and performing actions. -### When to use each mode + + + + *Learn and discuss without changing code.* -- **Plan mode**: Use when you want to explore code, understand systems, or plan changes without making modifications. Perfect for: - - Understanding unfamiliar codebases - - Planning complex refactors - - Debugging and investigation - - Creating implementation strategies - -- **Agent mode**: Use when you're ready to make changes. Ideal for: - - Implementing features - - Fixing bugs - - Running tests and commands - - Executing plans developed in Plan mode + **Mental Model:** Talking to a knowledgeable colleague -### Use Agent + **Best For:** Explaining concepts, comparing approaches, code review discussions. + + + + + *Safely explore and plan with read-only tools.* + + **Mental Model:** Architect surveying before renovation + + **Best For:** Understanding a codebase, bug investigation, planning implementations. + + + + + *Make actual changes with full tool access.* + + **Mental Model:** Contractor executing approved blueprints + + **Best For:** Implementing features, fixing bugs, running tests and commands. + + + + + + +### How to Use Agent Mode You can switch to `Agent` in the mode selector below the chat input box. The mode selector offers three options: + - **Chat**: No tools available, pure conversation - **Plan**: Read-only tools for safe exploration and planning - **Agent**: All tools available for making changes @@ -30,20 +48,20 @@ You can switch to `Agent` in the mode selector below the chat input box. The mod ![How to select agent mode](/images/mode-select-agent.png) - If Agent or Plan is disabled with a `Not Supported` message, the selected model or - provider doesn't support tools, or Continue doesn't yet support tools with it. - See [Model Blocks](/customization/models) for more information. + If Agent or Plan is disabled with a `Not Supported` message, the selected + model or provider doesn't support tools, or Continue doesn't yet support tools + with it. See [Model Blocks](/customization/models) for more information. Use the keyboard shortcut `Cmd/Ctrl + .` to quickly cycle between modes. -### Chat with Agent +### How to Chat with Agent -Agent lives within the same interface as [Chat](/features/chat/how-it-works), so the same [input](/features/chat/quick-start#1-start-a-conversation) is used to send messages and you can still use the same manual methods of providing context, such as [`@` context providers](/features/chat/quick-start#3-use--for-additional-context) or adding [highlighted code from the editor](/features/chat/quick-start#2-include-code-context). +Agent lives within the same interface as [Chat](/features/chat/how-it-works), so the same [input](/features/chat/quick-start#how-to-start-a-conversation) is used to send messages and you can still use the same manual methods of providing context, such as [`@` context providers](/features/chat/quick-start#how-to-use--for-additional-context) or adding [highlighted code from the editor](/features/chat/quick-start#how-to-include-code-context). -#### Use natural language +#### How to Use Natural Language with Agent With Agent, you can provide natural language instruction and let the model do the work. As an example, you might say @@ -51,7 +69,7 @@ With Agent, you can provide natural language instruction and let the model do th Agent will then decide which tools to use to get the job done. -## Give Agent permission +## How to Give Agent Permission By default, Agent will ask permission when it wants to use a tool. Click `Continue` to allow Agent mode to proceed with the tool call or `Cancel` to reject it. @@ -59,7 +77,7 @@ By default, Agent will ask permission when it wants to use a tool. Click `Contin You can use tool policies to exclude or make usage automatic for specific tools. See [MCP Tools](/customization/mcp-tools) for more background. -## View Tool Responses +## How to View Tool Responses Any data returned from a tool call is automatically fed back into the model as a context item. Most errors are also caught and returned, so that Agent mode can decide how to proceed. diff --git a/docs/features/autocomplete/context-selection.mdx b/docs/features/autocomplete/context-selection.mdx index 9507ee439..28775a229 100644 --- a/docs/features/autocomplete/context-selection.mdx +++ b/docs/features/autocomplete/context-selection.mdx @@ -1,17 +1,22 @@ +--- +title: "Context Selection" +description: "Learn how Continue's autocomplete selects relevant code context using file content, language server definitions, imports, and recent file history." +--- + Autocomplete will automatically determine context based on the current cursor position. We use the following techniques to determine what to include in the prompt: -## File prefix/suffix +## File Prefix and Suffix Context We will always include the code from your file prior to and after the cursor position. -## Definitions from the Language Server Protocol +## Language Server Protocol (LSP) Definitions Similar to how you can use cmd/ctrl + click in your editor, we use the same tool (the LSP) to power "go to definition". For example, if you are typing out a function call, we will include the function definition. Or, if you are writing code inside of a method, we will include the type definitions for any parameters or the return type. -## Imported files +## Imported File Context Because there are often many imports, we can't include all of them. Instead, we look for symbols around your cursor that have matching imports and use that as context. -## Recent files +## Recent File Context We automatically consider recently opened or edited files and include snippets that are relevant to the current completion. diff --git a/docs/features/autocomplete/how-it-works.mdx b/docs/features/autocomplete/how-it-works.mdx index 7f0e73d3f..c0c0fddee 100644 --- a/docs/features/autocomplete/how-it-works.mdx +++ b/docs/features/autocomplete/how-it-works.mdx @@ -1,27 +1,27 @@ --- -title: "How Autocomplete Works" -description: "Autocomplete is a that uses a combination of retrieval methods and response processing techniques. The system can be understood in roughly three parts." +title: "How Autocomplete Works in Continue" +sidebarTitle: "How Autocomplete Works" +description: "Understand how Continue's autocomplete works, including timing optimization, context retrieval from your codebase, and filtering to improve AI code suggestions." --- -## Timing +## Timing Optimization for Autocomplete In order to display suggestions quickly, without sending too many requests, we do the following: - Debouncing: If you are typing quickly, we won't make a request on each keystroke. Instead, we wait until you have finished. - Caching: If your cursor is in a position that we've already generated a completion for, this completion is reused. For example, if you backspace, we'll be able to immediately show the suggestion you saw before. -## Context +## Context Retrieval from Your Codebase Continue uses a number of retrieval methods to find relevant snippets from your codebase to include in the prompt. -## Filtering +## Filtering and Post-Processing AI Suggestions Language models aren't perfect, but can be made much closer by adjusting their output. We do extensive post-processing on responses before displaying a suggestion, including: -- filtering out special tokens -- stopping early when re-generating code -- fixing indentation - -We will also occasionally entirely filter out responses if they are bad. This is often due to extreme repetition. +- Removing special tokens +- Stopping early when regenerating code to avoid long, irrelevant output +- Fixing indentation for proper formatting +- Occasionally discarding low-quality responses, such as those with excessive repetition You can learn more about how it works in the [Autocomplete deep dive](/customization/models#autocomplete). diff --git a/docs/features/autocomplete/how-to-customize.mdx b/docs/features/autocomplete/how-to-customize.mdx index 8a7f0f968..854be157e 100644 --- a/docs/features/autocomplete/how-to-customize.mdx +++ b/docs/features/autocomplete/how-to-customize.mdx @@ -1,3 +1,8 @@ -Continue offers a handful of settings to customize autocomplete behavior. Visit the [User Settings Page](/customize/deep-dives/settings/) to manage these settings. +--- +title: β€œCustomize Autocomplete Settings in Continue” +description: β€œLearn how to customize autocomplete behavior in Continue, including user settings, configuration options, and adjustments to improve AI code suggestions in your IDE.” +--- + +Continue offers a handful of settings to customize autocomplete behavior. Visit the [User Settings Page](/customize/settings) to manage these settings. For a comprehensive guide on all configuration options and their impacts, see the [Autocomplete deep dive](/customize/deep-dives/autocomplete). diff --git a/docs/features/autocomplete/model-setup.mdx b/docs/features/autocomplete/model-setup.mdx index 6f5b1d799..0325b7fd2 100644 --- a/docs/features/autocomplete/model-setup.mdx +++ b/docs/features/autocomplete/model-setup.mdx @@ -1,6 +1,12 @@ +--- +title: "Recommended Models for Autocomplete in Continue" +description: "Choose the best autocomplete model for Continue, including hosted high-performance options, fast speed/quality tradeoffs, and local privacy-first models." +sidebarTitle: "Recommended Autocomplete Models" +--- + Setting up the right model for autocomplete is crucial for a smooth coding experience. Here are our top recommendations: -## Recommended Models +## Recommended Models for Autocomplete in Continue ### Hosted (Best Performance) @@ -46,4 +52,4 @@ If you're not seeing any completions or need more detailed configuration options ## Model Compatibility -To see a complete list of models and their capabilities, visit our [Model Capabilities guide](/customize/deep-dives/model-capabilities#model-compatibility-matrix). +To see a complete list of models and their capabilities, visit our [Model Capabilities guide](/customize/deep-dives/model-capabilities). diff --git a/docs/features/autocomplete/quick-start.mdx b/docs/features/autocomplete/quick-start.mdx index 5a03c9671..8a08e553f 100644 --- a/docs/features/autocomplete/quick-start.mdx +++ b/docs/features/autocomplete/quick-start.mdx @@ -1,23 +1,27 @@ --- -title: "Quick Start" +title: "Quick Start with Continue Autocomplete" +description: "Learn how to quickly start using Continue's AI autocomplete in your IDE, including enabling inline code suggestions and keyboard shortcuts for accepting, rejecting, or partially accepting completions." +sidebarTitle: "Autocomplete Quick Start" --- -## How to use it +## How to Enable and Use Continue Autocomplete Autocomplete provides inline code suggestions as you type. To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings. -### Accepting a full suggestion +## Keyboard Shortcuts for Autocomplete + +### Accept a Full Suggestion Accept a full suggestion by pressing `Tab` -### Rejecting a full suggestion +### Reject a Full Suggestion Reject a full suggestion with `Esc` -### Partially accepting a suggestion +### Partially Accept a Suggestion For more granular control, use `cmd/ctrl` + `β†’` to accept parts of the suggestion word-by-word. -### Forcing a suggestion (VS Code) +### Force a Suggestion (VS Code) If you want to trigger a suggestion immediately without waiting, or if you've dismissed a suggestion and want a new one, you can force it by using the keyboard shortcut **`cmd/ctrl` + `alt` + `space`**. diff --git a/docs/features/chat/context-selection.mdx b/docs/features/chat/context-selection.mdx index 04041b689..b9354ac5a 100644 --- a/docs/features/chat/context-selection.mdx +++ b/docs/features/chat/context-selection.mdx @@ -1,39 +1,45 @@ -## Input +--- +title: "Chat Mode Context Selection" +sidebarTitle: "Context Selection" +description: "Learn how Continue selects relevant context for your chat requests, including text input, highlighted code, active files." +--- + +## How to Use Text Input Typing a question or instructions into the input box is the only required context. -## Highlighted Code +## How to Include Highlighted Code The highlighted code you've selected by pressing cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains) will be included in your prompt. -## Active File +## How to Include the Active File You can include the currently open file as context by pressing opt/alt + enter when you send your request. -## Specific File +## How to Include a Specific File You can include a specific file in your current workspace by typing '@Files' and selecting the file. -## Specific Folder +## How to Include a Specific Folder You can include a folder in your current workspace by typing '@Folder' and selecting the directory. -## Codebase Search +## How to Use Codebase Search You can automatically include relevant files from your codebase by typing '@Codebase'. -## Documentation Site +## How to Include Documentation Sites You can include a documentation site as context by typing '@Docs' and selecting the site. -## Terminal Contents +## How to Include Terminal Contents You can include the contents of the terminal in your IDE by typing '@Terminal'. -## Git Diff +## How to Include Git Diff You can include all of the changes you've made to your current branch by typing '@Git Diff'. -## Other Context +## How to Use Other Context Providers You can see a full list of built-in context providers [here](/customize/custom-providers) and learn about how to create your own context provider [here](/guides/build-your-own-context-provider). diff --git a/docs/features/chat/how-it-works.mdx b/docs/features/chat/how-it-works.mdx index eeb35276f..d807ca5c4 100644 --- a/docs/features/chat/how-it-works.mdx +++ b/docs/features/chat/how-it-works.mdx @@ -3,7 +3,7 @@ title: "How Chat Works" description: "Continue's Chat feature provides a conversational interface with AI models directly in your IDE sidebar." --- -## Core Functionality +## How Chat Core Functionality Works When you start a chat conversation, Continue: @@ -12,22 +12,22 @@ When you start a chat conversation, Continue: 3. **Sends to Model**: Prompts the configured AI model for a response 4. **Streams Response**: Returns the AI response in real-time to the sidebar -## Context Management +## How Context Management Works -### Automatic Context +### What Context Is Automatically Included - Selected code in your editor - Current file context when relevant - Previous conversation history in the session -### Manual Context +### How to Add Manual Context - `@Codebase` - Search and include relevant code from your project - `@Docs` - Include documentation context - `@Files` - Reference specific files - Custom context providers -## Response Handling +## How Response Handling Works Each code section in the AI response includes action buttons: @@ -35,19 +35,19 @@ Each code section in the AI response includes action buttons: - **Insert at cursor** - Add code at cursor position - **Copy** - Copy code to clipboard -## Session Management +## How Session Management Works - Use `Cmd/Ctrl + L` (VS Code) or `Cmd/Ctrl + J` (JetBrains) to start a new session - Clears all previous context for a fresh start - Helpful for switching between different tasks -## Advanced Features +## What Advanced Features Are Available -### Prompt Inspection +### How to Use Prompt Inspection View the exact prompt sent to the AI model in the [prompt logs](/troubleshooting) for debugging and optimization. -### Context Providers +### How to Learn More About Context Providers Learn more about how context providers work: diff --git a/docs/features/chat/how-to-customize.mdx b/docs/features/chat/how-to-customize.mdx index 2692f7837..cf7fe0b62 100644 --- a/docs/features/chat/how-to-customize.mdx +++ b/docs/features/chat/how-to-customize.mdx @@ -1,3 +1,10 @@ +--- +title: "How to Customize Chat" +description: "Learn how to customize the Chat feature in Continue to better suit your workflow." +--- + +## How to Customize Chat + There are a number of different ways to customize Chat: - Add a `rules` block to give the model persistent instructions through the system prompt diff --git a/docs/features/chat/model-setup.mdx b/docs/features/chat/model-setup.mdx index 06d61fc6d..da46671b0 100644 --- a/docs/features/chat/model-setup.mdx +++ b/docs/features/chat/model-setup.mdx @@ -3,7 +3,7 @@ The model you use for for Chat mode will be - used with Edit mode by default but can be switched - always used with Agent mode if the model supports tool calling -## Recommended Models +## What Models Are Recommended for Chat? Our strong recommendation is to use [Claude Sonnet 4](https://hub.continue.dev/anthropic/claude-4-sonnet) from Anthropic. @@ -14,7 +14,7 @@ Its strong tool calling and reasoning capabilities make it the best model for Ag 3. Add `ANTHROPIC_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets) 4. Click `Reload config` in the assistant selector in the Continue IDE extension -#### Other hosted models +### What Other Hosted Models Are Available? These models have varying tool calling and reasoning capabilities. @@ -67,7 +67,7 @@ These models have varying tool calling and reasoning capabilities. 3. Add `TOGETHER_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets) 4. Click `Reload config` in the assistant selector in the Continue IDE extension -#### Local models +### What Local Models Are Available? These models can be run on your computer if you have enough VRAM. @@ -99,6 +99,6 @@ Their limited tool calling and reasoning capabilities will make it challenging t For more detailed setup instructions, see [here](/getting-started/install#setup-your-first-model). -## Model Compatibility +## How to Check Model Compatibility -To see which models support specific features like tool use (for Agent mode) and image input, check out our [Model Capabilities guide](/customize/deep-dives/model-capabilities#model-compatibility-matrix). +To see which models support specific features like tool use (for Agent mode) and image input, check out our [Model Capabilities guide](/customize/deep-dives/model-capabilities). diff --git a/docs/features/chat/quick-start.mdx b/docs/features/chat/quick-start.mdx index 58b3e0a36..7871cef90 100644 --- a/docs/features/chat/quick-start.mdx +++ b/docs/features/chat/quick-start.mdx @@ -1,12 +1,14 @@ --- -title: "Quick Start" +title: "Chat Mode Quick Start" +sidebarTitle: "Quick Start" +description: "Get started with Continue's AI chat assistant to solve coding problems directly in your IDE, with features for code context sharing, codebase search, and applying generated solutions to your files" --- Chat makes it easy to ask for help from an AI without leaving your IDE. Get explanations, generate code, and iterate on solutions conversationally. -## Basic Usage +## How to Use Chat - Basic Usage -### 1. Start a Conversation +### How to Start a Conversation Type your question or request in the chat input and press Enter. @@ -16,7 +18,7 @@ Type your question or request in the chat input and press Enter. - "How do I handle errors in this code?" - "Generate a test for this component" -### 2. Include Code Context +### How to Include Code Context Select code in your editor, then use the keyboard shortcut to include it in your chat: @@ -27,7 +29,7 @@ Press `Cmd/Ctrl + L` to send selected code to chat Press `Cmd/Ctrl + J` to send selected code to chat -### 3. Use @ for Additional Context +### How to Use @ for Additional Context Type `@` to include specific context: @@ -36,7 +38,7 @@ Type `@` to include specific context: - `@Files` - Reference specific files - `@Terminal` - Include terminal output -## Working with Responses +## How to Work with Responses When the AI provides code in its response, you'll see action buttons: @@ -44,7 +46,7 @@ When the AI provides code in its response, you'll see action buttons: - **Insert at cursor** - Add code at your cursor position - **Copy** - Copy code to clipboard -## Pro Tips +## What Are the Pro Tips for Chat ### Start Fresh @@ -66,7 +68,7 @@ If the first response isn't perfect: - Request modifications - Provide additional context -## Common Use Cases +## What Are Common Use Cases for Chat ### Code Explanation diff --git a/docs/features/edit/context-selection.mdx b/docs/features/edit/context-selection.mdx index 0cbff11c5..beb01ce88 100644 --- a/docs/features/edit/context-selection.mdx +++ b/docs/features/edit/context-selection.mdx @@ -1,7 +1,13 @@ -## Input +--- +title: "Context Selection in Edit Mode" +sidebarTitle: "Context Selection" +description: "Learn how Continue's Edit mode selects relevant code context using file content, language server" +--- -The input you provide is included in the prompt. +## How to Use Text Input -## Code to Edit +Typing a question or instructions into the input box is the only required context. + +## What Context is Included in Edit Mode The **entire contents** of the current file are included in the prompt for context. The model will only attempt to edit the highlighted/specified ranges. diff --git a/docs/features/edit/how-it-works.mdx b/docs/features/edit/how-it-works.mdx index b8dd95d37..ba8969691 100644 --- a/docs/features/edit/how-it-works.mdx +++ b/docs/features/edit/how-it-works.mdx @@ -3,7 +3,13 @@ title: "How Edit Works" description: "Using the highlighted code, the contents of the current file containing your highlight, and your input instructions, we prompt the model to edit the code according to your instructions. No other additional context is provided to the model." --- -The model response is then streamed directly back to the highlighted range in your code, where we apply a diff formatting to show the proposed changes. +## How Edit Functionality Works + +When you start an edit session, Continue: + +1. **Gathers Context**: Uses the highlighted code and the current file contents +2. **Prompts the Model**: Sends the gathered context and your input instructions to the model +3. **Applies Changes**: The model response is then streamed directly back to the highlighted range in your code, where we apply a diff formatting to show the proposed changes. If you accept the diff, we remove the previously highlighted lines, and if you reject the diff, we remove the proposed changes. diff --git a/docs/features/edit/how-to-customize.mdx b/docs/features/edit/how-to-customize.mdx index 74f06a549..b200e2e67 100644 --- a/docs/features/edit/how-to-customize.mdx +++ b/docs/features/edit/how-to-customize.mdx @@ -1,4 +1,10 @@ -## Setting active Edit/Apply model +--- +title: "How to Customize Edit Functionality" +description: "Learn how to customize the Edit functionality in Continue to better suit your workflow." +sidebarTitle: "Customize Edit" +--- + +## How to Set Active Edit/Apply Model You can configure particular models from your Assistant to be used for Edit and Apply requests. diff --git a/docs/features/edit/model-setup.mdx b/docs/features/edit/model-setup.mdx index 8442015c9..d7b839a13 100644 --- a/docs/features/edit/model-setup.mdx +++ b/docs/features/edit/model-setup.mdx @@ -1,8 +1,14 @@ +--- +title: "How to Set Up Edit Models" +sidebarTitle: "Set Up Edit Models" +description: "Learn how to set up and customize models for Edit functionality in Continue." +--- + The model you set up for Chat mode will be used for Edit mode by default. The recommended models and how to set them up can be found [here](/features/chat/model-setup). -## Apply Model +## How to Set Up an Apply Model We also recommend setting up an Apply model for the best Edit experience. @@ -11,6 +17,6 @@ We also recommend setting up an Apply model for the best Edit experience. - [Morph v3](https://hub.continue.dev/morphllm/morph-v2) - [Relace Instant Apply](https://hub.continue.dev/relace/instant-apply) -## Model Compatibility +## How to Determine Model Compatibility -For a complete overview of which models support various features, see our [Model Capabilities guide](/customize/deep-dives/model-capabilities#model-compatibility-matrix). +For a complete overview of which models support various features, see our [Model Capabilities guide](/customize/deep-dives/model-capabilities). diff --git a/docs/features/edit/quick-start.mdx b/docs/features/edit/quick-start.mdx index aa2d9b5d4..365009c46 100644 --- a/docs/features/edit/quick-start.mdx +++ b/docs/features/edit/quick-start.mdx @@ -1,8 +1,10 @@ --- -title: "Quick Start" +title: "Quick Start with Continue Edit" +sideBarTitle: "Quick Start" +description: "Get started with Continue's Edit feature for making quick, targeted code changes directly in your file using AI suggestions, with keyboard shortcuts for accepting or rejecting modifications" --- -## How to use it +## How to Continue Edit Edit is a convenient way to make quick changes to specific code and files. Select code, describe your code changes, and a diff will be streamed inline to your file which you can accept or reject. @@ -12,15 +14,17 @@ Edit is recommended for small, targeted changes, such as - Generating unit tests - Refactoring functions or methods -## Highlight code and activate +## How to Activate Edit Highlight the block of code you would like to modify and press `Cmd+I` (Mac) or `Ctrl+I` (Windows/Linux) to activate Edit mode. You can also press `Cmd/Ctrl+I` with no code highlighted, which will default to inserting code at the current cursor location. -## Describe code changes +Once you've activated Edit, you're ready to provide instructions. + +### How to Provide Instructions Describe the changes you would like the model to make to your highlighted code. For edits, a good prompt should be relatively short and concise. For longer, more complex tasks, we recommend using [Chat](/features/chat/quick-start). -## Accept or reject changes +### How to Accept or Reject Changes Proposed changes appear as inline diffs within your highlighted text. @@ -30,7 +34,6 @@ You can also accept or reject all changes at once using `Cmd+Shift+Enter` (Mac) If you want to request a new suggestion for the same highlighted code section, you can use `Cmd+I` (Mac) or `Ctrl+I` (Windows/Linux) to re-prompt the model. - -## Jetbrains +## How to Use Edit in Jetbrains In Jetbrains, Edit is implemented as an inline popup. See the header GIF example. diff --git a/docs/features/plan/how-it-works.mdx b/docs/features/plan/how-it-works.mdx index c19bb2080..cb608f182 100644 --- a/docs/features/plan/how-it-works.mdx +++ b/docs/features/plan/how-it-works.mdx @@ -46,7 +46,10 @@ Plan mode includes these read-only built-in tools: In addition to built-in read-only tools, Plan mode also supports all MCP (Model Context Protocol) tools. This allows integration with external services that provide additional context or analysis capabilities without modifying your local environment. - While Plan mode restricts built-in tools to read-only operations, MCP tools are not filtered by Continue. Some MCP tools may have write capabilities that could modify your system or external services. Always verify what actions your MCP tools can perform before using them in Plan mode. + While Plan mode restricts built-in tools to read-only operations, MCP tools + are not filtered by Continue. Some MCP tools may have write capabilities that + could modify your system or external services. Always verify what actions your + MCP tools can perform before using them in Plan mode. ## The planning workflow diff --git a/docs/features/plan/quick-start.mdx b/docs/features/plan/quick-start.mdx index 988376dc0..40bbc80d0 100644 --- a/docs/features/plan/quick-start.mdx +++ b/docs/features/plan/quick-start.mdx @@ -1,5 +1,6 @@ --- title: "Quick Start" +description: "Get started with Continue's Plan mode to safely explore codebases, plan refactors, debug issues, and develop implementation strategies without modifying code before switching to execution" --- ## How to use it @@ -14,17 +15,18 @@ You can switch to `Plan` in the mode selector below the chat input box. If Plan is disabled with a `Not Supported` message, the selected model or - provider doesn't support tools. See [Model Setup](/features/plan/model-setup) + provider doesn't support tools. See [Model Setup](/features/agent/model-setup) for more information. ### Chat with Plan -Plan mode lives within the same interface as [Chat](/features/chat/how-it-works) and [Agent](/features/agent/how-it-works), so the same [input](/features/chat/quick-start#1-start-a-conversation) is used to send messages and you can still use the same manual methods of providing context, such as [`@` context providers](/features/chat/quick-start#3-use--for-additional-context) or adding [highlighted code from the editor](/features/chat/quick-start#2-include-code-context). +Plan mode lives within the same interface as [Chat](/features/chat/how-it-works) and [Agent](/features/agent/how-it-works), so the same [input](/features/chat/quick-start#how-to-start-a-conversation) is used to send messages and you can still use the same manual methods of providing context, such as [`@` context providers](/features/chat/quick-start#how-to-use--for-additional-context) or adding [highlighted code from the editor](/features/chat/quick-start#how-to-include-code-context). #### What makes Plan different Unlike Agent mode, Plan mode: + - Only uses read-only tools (file reading, searching, analysis) - Cannot modify, create, or delete files - Focuses on understanding and planning rather than execution @@ -33,6 +35,7 @@ Unlike Agent mode, Plan mode: ### Common use cases Plan mode is ideal for: + - **Code exploration**: Understanding how a codebase works - **Planning refactors**: Analyzing impact before making changes - **Debugging**: Investigating issues without modifying code @@ -56,5 +59,6 @@ Plan mode will analyze the existing code, understand the current implementation, When you're ready to implement your plan, simply switch to Agent mode using the mode selector or keyboard shortcut (`Cmd/Ctrl + .`). The conversation context carries over, so Agent mode can immediately start implementing the plan you developed. - Use the keyboard shortcut `Cmd/Ctrl + .` to quickly cycle between Agent, Chat, and Plan modes. - \ No newline at end of file + Use the keyboard shortcut `Cmd/Ctrl + .` to quickly cycle between Agent, Chat, + and Plan modes. + diff --git a/docs/getting-started/extensions.mdx b/docs/getting-started/extensions.mdx index 995ac79a5..1904b97bc 100644 --- a/docs/getting-started/extensions.mdx +++ b/docs/getting-started/extensions.mdx @@ -3,4 +3,4 @@ title: "Understanding Assistants" description: "Continue offers two ways to configure your AI assistants" --- -This content has moved to our comprehensive guide: [Understanding Assistants: Hub vs Local Configuration](/guides/understanding-assistants) \ No newline at end of file +This content has moved to our comprehensive guide: [Understanding Assistants: Hub vs Local Configuration](/guides/understanding-assistants) diff --git a/docs/getting-started/overview.mdx b/docs/getting-started/overview.mdx index a24d5585f..18d8b67f3 100644 --- a/docs/getting-started/overview.mdx +++ b/docs/getting-started/overview.mdx @@ -57,7 +57,6 @@ description: "To quickly understand what you can do with Continue, check out eac - ## AI Coding Assistants Continue offers flexible AI assistants that enhance your development workflow. You can choose between cloud-managed **Hub Assistants** for easy setup and synchronization, or **Local Assistants** for complete control and privacy. Learn more about [understanding and configuring assistants](/guides/understanding-assistants). diff --git a/docs/guides/build-your-own-context-provider.mdx b/docs/guides/build-your-own-context-provider.mdx index 57dd2e577..84a47fb2c 100644 --- a/docs/guides/build-your-own-context-provider.mdx +++ b/docs/guides/build-your-own-context-provider.mdx @@ -1,9 +1,9 @@ --- -title: "Build Your Own Context Provider" -description: "Continue offers several way to provide your custom context to the extension." +title: "How to Build Your Own Context Provider" +description: "Learn how to create custom context providers for Continue using HTTP servers, CustomContextProvider API, or VSCode extensions to provide tailored context to your AI assistant" --- -## HTTP Context Provider +## How to Create an HTTP Context Provider Continue can retrieve context from a custom HTTP server that you create and serve. Add the `@HTTP` context provider to your configuration like this: @@ -42,11 +42,11 @@ The `"options"` property can be used to send additional parameters to your endpo The following methods for creating custom context providers are deprecated. We recommend using HTTP context providers, [MCP - Servers](/customization/mcp-tools), and [Prompts](/customization/prompts) + Servers](/customize/deep-dives/mcp), and [Prompts](/customize/deep-dives/prompts) where possible. -## Using CustomContextProvider +## How to Use CustomContextProvider Custom context providers can be implemented in a `config.ts` placed in your Continue global directory (`~/.continue` for MacOS, `%USERPROFILE%/.continue` for Windows). You can implement the `CustomContextProvider` interface in your `config.ts` @@ -76,7 +76,7 @@ export function modifyConfig(config: Config): Config { if (!config.contextProvi This is automatically appended to your configuration. -### Custom Context Providers with Submenu or Query +### How to Create Custom Context Providers with Submenu or Query There are 3 types of context providers: "normal", "query", and "submenu". The "normal" type is the default, and is what we've seen so far. @@ -97,7 +97,7 @@ The flow of information in the above example is as follows: 3. The `id` of the chosen `ContextSubmenuItem` is passed to `getContextItems` as the `query` argument. In this case it is the filepath of the README. 4. The `getContextItems` function can then use the `query` to retrieve the full contents of the README and format the content before returning the context item which will be included in the prompt. -### Importing outside modules +### How to Import Outside Modules To include outside Node modules in your config.ts, run `npm install ` from the `~/.continue` directory, and then import them in config.ts. @@ -116,6 +116,7 @@ Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.t - `renderInlineAs` (optional): The string that will be rendered inline at the top of the prompt. If no value is provided, the `displayTitle` will be used. An empty string can be provided to prevent rendering the default `displayTitle`. - `getContextItems`: A function that returns the documents to include in the prompt. It should return a list of `ContextItem`s, and is given access to the following arguments: + - `extras.fullInput`: A string representing the user's full input to the text box. This can be used for example to generate an embedding to compare against a set of other embedded documents - `extras.embeddingsProvider`: The embeddings provider has an `embed` function that will convert text (such as `fullInput`) to an embedding - `extras.llm`: The current default LLM, which you can use to make completion requests @@ -124,7 +125,7 @@ Continue will use [esbuild](https://esbuild.github.io/) to bundle your `config.t - `loadSubmenuItems` (optional): A function that returns a list of `ContextSubmenuItem`s to display in a submenu. It is given access to an `IDE`, the same that is passed to `getContextItems`. . -## Extension API for VSCode +## How to Use Extension API for VSCode Continue exposes an API for registering context providers from a 3rd party VSCode extension. This is useful if you have a VSCode extension that provides some additional context that you would like to use in Continue. To use this API, add the following to your `package.json`: diff --git a/docs/guides/cli.mdx b/docs/guides/cli.mdx index dcdea9d28..6438bde46 100644 --- a/docs/guides/cli.mdx +++ b/docs/guides/cli.mdx @@ -1,6 +1,7 @@ --- -title: "Continue CLI (cn)" -description: "Context engineering on the command line" +title: "How to Use Continue CLI (cn)" +sidebarTitle: "Continue CLI (cn)" +description: "Learn how to use Continue's command-line interface for context engineering, automated coding tasks, and headless development workflows with customizable models, rules, and tools" --- Continue CLI (cn) is currently in Alpha @@ -29,7 +30,7 @@ cn cn -p "Generate a conventional commit name for the current git changes" ``` -## Basic usage +## How to Use Continue CLI - Basic Usage Out of the box, `cn` comes with tools that let it understand your codebase, edit files, run terminal commands, and more (if you approve). You can ask `cn` to: @@ -43,7 +44,7 @@ Use '@' to give it file context, or '/' to run slash commands. If you want to resume a previous conversation, run `cn --resume`. -## Headless mode (`-p` flag) +## How to Use Headless Mode (`-p` flag) In headless mode, `cn` will only output its final response, making it perfect for Unix Philosophy-style scripting and automation. For example, you could pipe your git diff into `cn` to generate a commit message, and write this to a file: @@ -51,25 +52,25 @@ In headless mode, `cn` will only output its final response, making it perfect fo echo "$(git diff) Generate a conventional commit name for the current git changes" | cn -p > commit-message.txt ``` -## Configuration +## How to Configure Continue CLI -`cn` uses [`config.yaml`](./reference.mdx), the exact same configuration file as Continue. This means that you can log in to [Continue Hub](./hub/introduction.mdx) or use your existing local configuration. +`cn` uses [`config.yaml`](/reference), the exact same configuration file as Continue. This means that you can log in to [Continue Hub](/hub/introduction) or use your existing local configuration. To switch between configurations, you can use the `/config` slash command in `cn`, or you can start it with the `--config` flag (e.g. `cn --config continuedev/default-agent` or `cn --config ~/.continue/config.yaml`). -### Models +### How to Add Custom Models -Learn how to add custom models [here](./customization/models.mdx). Then, you can use the `/model` slash command to switch between them in `cn`. +Learn how to add custom models [here](/customize/overview). Then, you can use the `/model` slash command to switch between them in `cn`. -### Rules +### How to Configure Rules -`cn` supports [rules](./customize/deep-dives/rules.mdx) in the same way as the Continue IDE extensions. You can also use the `--rule` flag to manually include a rule from the hub. For example, `cn --rule nate/spanish` will tell `cn` to use [this rule](https://hub.continue.dev/nate/spanish) to always speak in Spanish. +`cn` supports [rules](/customize/deep-dives/rules) in the same way as the Continue IDE extensions. You can also use the `--rule` flag to manually include a rule from the hub. For example, `cn --rule nate/spanish` will tell `cn` to use [this rule](https://hub.continue.dev/nate/spanish) to always speak in Spanish. -### Tools +### How to Configure Tools -`cn` supports MCP tools, which can be configured in the [same way](./customize/deep-dives/mcp.mdx) as with the Continue IDE extensions. +`cn` supports MCP tools, which can be configured in the [same way](/customize/deep-dives/mcp) as with the Continue IDE extensions. -#### Tool Permissions +#### How to Set Tool Permissions `cn` includes a tool permission system to make sure you approve of the agent's actions. It will begin with minimal permissions but as you approve tool calls, it will add policies to `~/.continue/permissions.yaml` to remember your preferences. diff --git a/docs/guides/custom-code-rag.mdx b/docs/guides/custom-code-rag.mdx index 24e4ff91f..462bc81ef 100644 --- a/docs/guides/custom-code-rag.mdx +++ b/docs/guides/custom-code-rag.mdx @@ -1,19 +1,19 @@ --- -title: "Custom code RAG" -description: "While Continue comes with out of the box, you might wish to set up your own vector database and build a custom retrieval-augmented generation (RAG) system. This can allow you to access code that is not available locally, to index code a single time across all users, or to include custom logic. In this guide, we'll walk you through the steps it takes to build this." +title: "How to Build Custom Code RAG" +description: "Learn how to build a custom retrieval-augmented generation (RAG) system for code using vector databases like LanceDB, embeddings models like voyage-code-3, and chunking strategies for better code search and context" --- -## Step 1: Choose an embeddings model +## Step 1: How to Choose an Embeddings Model If possible, we recommend using [`voyage-code-3`](https://docs.voyageai.com/docs/embeddings), which will give the most accurate answers of any existing embeddings model for code. You can obtain an API key [here](https://dash.voyageai.com/api-keys). Because their API is [OpenAI-compatible](https://docs.voyageai.com/reference/embeddings-api), you can use any OpenAI client by swapping out the URL. -## Step 2: Choose a vector database +## Step 2: How to Choose a Vector Database There are a number of available vector databases, but because most vector databases will be able to performantly handle large codebases, we would recommend choosing one for ease of setup and experimentation. [LanceDB](https://lancedb.github.io/lancedb/basic/) is a good choice for this because it can run in-memory with libraries for both Python and Node.js. This means that in the beginning you can focus on writing code rather than setting up infrastructure. If you have already chosen a vector database, then using this instead of LanceDB is also a fine choice. -## Step 3: Choose a "chunking" strategy +## Step 3: How to Choose a "Chunking" Strategy Most embeddings models can only handle a limited amount of text at once. To get around this, we "chunk" our code into smaller pieces. @@ -25,7 +25,7 @@ If you use `voyage-code-3`, it has a maximum context length of 16,000 tokens, wh As usual in this guide, we recommend starting with the strategy that gives 80% of the benefit with 20% of the effort. -## Step 4: Put together an indexing script +## Step 4: How to Put Together an Indexing Script Indexing, in which we will insert your code into the vector database in a retrievable format, happens in three steps: @@ -48,7 +48,7 @@ from lancedb.pydantic import LanceModel, Vectorfrom lancedb.embeddings import ge Regardless of which database or model you have chosen, your script should iterate over all of the files that you wish to index, chunk them, generate embeddings for each chunk, and then insert all of the chunks into your vector database. -## Step 5: Run your indexing script +## Step 5: How to Run Your Indexing Script In a perfect production version, you would want to build "automatic, incremental indexing", so that you whenever a file changes, that file and nothing else is automatically re-indexed. This has the benefits of perfectly up-to-date embeddings and lower cost. @@ -61,7 +61,7 @@ At this point, you've written your indexing script and tested that you can make In the beginning, you should probably run it by hand. Once you are confident that your custom RAG is providing value and is ready for the long-term, then you can set up a cron job to run it periodically. Because codebases are largely unchanged in short time frames, you won't want to re-index more than once a day. Once per week or month is probably even sufficient. -## Step 6: Set up your server +## Step 6: How to Set Up Your Server In order for the Continue extension to access your custom RAG system, you'll need to set up a server. This server is responsible for recieving a query from the extension, querying the vector database, and returning the results in the format expected by Continue. @@ -106,7 +106,7 @@ config.json } ``` -## Step 7 (Bonus): Set up reranking +## Step 7 (Bonus): How to Set Up Reranking If you'd like to improve the quality of your results, a great first step is to add reranking. This involves retrieving a larger initial pool of results from the vector database, and then using a reranking model to order them from most to least relevant. This works because the reranking model can perform a slightly more expensive calculation on the small set of top results, and so can give a more accurate ordering than similarity search, which has to search over all entries in the database. diff --git a/docs/guides/how-to-self-host-a-model.mdx b/docs/guides/how-to-self-host-a-model.mdx index ddad69551..3126b349e 100644 --- a/docs/guides/how-to-self-host-a-model.mdx +++ b/docs/guides/how-to-self-host-a-model.mdx @@ -1,6 +1,6 @@ --- title: "How to Self-Host a Model" -description: "You can deploy a model in your , , , , or using:" +description: "Learn how to deploy and self-host open-source language models using HuggingFace TGI, vLLM, SkyPilot, Anyscale Private Endpoints, or Lambda for use with Continue" --- - [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi) @@ -9,13 +9,13 @@ description: "You can deploy a model in your , , , , or using:" - [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API) - [Lambda](https://github.com/continuedev/deploy-os-code-llm#lambda) -## Self-hosting an open-source model +## How to Self-Host an Open-Source Model For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server. However, if neither of these are the case, you will need to wire up a new LLM object. -## Authentication +## How to Set Up Authentication Basic authentication can be done with any provider using the `apiKey` field: diff --git a/docs/guides/llama3.1.mdx b/docs/guides/llama3.1.mdx index a79644343..5462430bc 100644 --- a/docs/guides/llama3.1.mdx +++ b/docs/guides/llama3.1.mdx @@ -1,13 +1,13 @@ --- -title: "Using Llama 3.1 with Continue" -description: "Continue makes it easy to code with the latest open-source models, including the entire Llama 3.1 family of models. Llama 3.2 models are also supported but not recommended for chat, because they are specifically designed to be small or multi-modal." +title: "How to Use Llama 3.1 with Continue" +description: "Learn how to set up and use Llama 3.1 models with Continue using Ollama, Groq, Together AI, Replicate, SambaNova, or Cerebras Inference for local and cloud-based development" --- -If you haven't already installed Continue, you can do that [here for VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [here for JetBrains](https://plugins.jetbrains.com/plugin/22707-continue). For more general information on customizing Continue, read [our customization docs](/customization/overview). +If you haven't already installed Continue, you can do that [here for VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [here for JetBrains](https://plugins.jetbrains.com/plugin/22707-continue). For more general information on customizing Continue, read [our customization docs](/customize/overview). Below we share some of the easiest ways to get up and running, depending on your use-case. -## Ollama +## How to Use Llama 3.1 with Ollama Ollama is the fastest way to get up and running with local language models. We recommend trying Llama 3.1 8b, which is impressive for its size and will perform well on most hardware. @@ -37,7 +37,7 @@ config.json } ``` -## Groq +## How to Use Llama 3.1 with Groq Check if your chosen model is still supported by referring to the [model @@ -78,7 +78,7 @@ config.json } ``` -## Together AI +## How to Use Llama 3.1 with Together AI Together AI provides fast and reliable inference of open-source models. You'll be able to run the 405b model with good speed. @@ -114,7 +114,7 @@ config.json } ``` -## Replicate +## How to Use Llama 3.1 with Replicate Replicate makes it easy to host and run open-source AI with an API. @@ -149,7 +149,7 @@ config.json } ``` -## SambaNova +## How to Use Llama 3.1 with SambaNova SambaNova Cloud provides world record Llama3.1 70B/405B serving. @@ -185,7 +185,7 @@ config.json } ``` -## Cerebras Inference +## How to Use Llama 3.1 with Cerebras Inference Cerebras Inference uses specialized silicon to provides fast inference for the Llama3.1 8B/70B. diff --git a/docs/guides/ollama-guide.mdx b/docs/guides/ollama-guide.mdx index 5ded49934..51bcd3e10 100644 --- a/docs/guides/ollama-guide.mdx +++ b/docs/guides/ollama-guide.mdx @@ -1,9 +1,9 @@ --- title: "Using Ollama with Continue: A Developer's Guide" -description: "This comprehensive guide will walk you through setting up Ollama with Continue for powerful local AI development. Ollama allows you to run large language models locally on your machine, providing privacy, control, and offline capabilities for AI-assisted coding." +description: "Complete guide to setting up Ollama with Continue for local AI development. Learn installation, configuration, model selection, performance optimization, and troubleshooting for privacy-focused offline coding assistance" --- -## Prerequisites +## What Are the Prerequisites for Using Ollama Before getting started, ensure your system meets these requirements: @@ -12,9 +12,9 @@ Before getting started, ensure your system meets these requirements: - Storage: At least 10GB free space - Continue extension installed -## Installation Steps +## How to Install Ollama - Step-by-Step -### Step 1: Install Ollama +### Step 1: How to Install Ollama Choose the installation method for your operating system: @@ -29,7 +29,7 @@ curl -fsSL https://ollama.ai/install.sh | sh # Download from ollama.ai ``` -### Step 2: Download Models +### Step 2: How to Download Models After installing Ollama, download the models you want to use. Here are some popular options: @@ -40,11 +40,11 @@ ollama pull qwen2.5-coder:1.5b-base ollama pull nomic-embed-text:latest ``` -## Configuration +## How to Configure Ollama with Continue Configure Continue to work with your local Ollama instance: -### Continue Configuration +### How to Set Up Continue Configuration ```yaml models: @@ -70,9 +70,9 @@ models: - embed ``` -You can update `apiBase` with the IP address of a remote machine serving Ollama. +You can update `apiBase` with the IP address of a remote machine serving Ollama. -### Advanced Settings +### How to Configure Advanced Settings For optimal performance, consider these advanced configuration options: @@ -81,9 +81,9 @@ For optimal performance, consider these advanced configuration options: - Custom model parameters - Performance tuning -## Best Practices +## What Are the Best Practices for Ollama -### Model Selection +### How to Choose the Right Model Choose models based on your specific needs: @@ -91,7 +91,7 @@ Choose models based on your specific needs: 2. **Chat**: Llama2 or Mistral 3. **Specialized Tasks**: Domain-specific models -### Performance Optimization +### How to Optimize Performance To get the best performance from Ollama: @@ -100,25 +100,25 @@ To get the best performance from Ollama: - Use appropriate model sizes - Enable GPU acceleration when available -## Troubleshooting +## How to Troubleshoot Ollama Issues -### Common Issues +### What Are Common Issues Here are solutions to common problems you might encounter: -#### Connection Problems +#### How to Fix Connection Problems - Check Ollama service status - Verify port availability - Review firewall settings -#### Performance Issues +#### How to Resolve Performance Issues - Insufficient RAM - Model too large for system - GPU compatibility -### Solutions +### How to Apply Solutions Try these solutions in order: @@ -127,15 +127,15 @@ Try these solutions in order: 3. Update to latest version 4. Check system requirements -## Example Workflows +## What Are Example Workflows with Ollama -### Code Generation +### How to Use Ollama for Code Generation ``` # Example: Generate a FastAPI endpointdef create_user_endpoint(): # Continue will help generate the implementation pass ``` -### Code Review +### How to Use Ollama for Code Review Use Continue with Ollama to: diff --git a/docs/guides/overview.mdx b/docs/guides/overview.mdx index c4e95006b..b62df80c4 100644 --- a/docs/guides/overview.mdx +++ b/docs/guides/overview.mdx @@ -1,8 +1,9 @@ --- -title: "Overview" +title: "How to Use Continue Guides" +description: "Comprehensive collection of practical guides for Continue including model setup, local development with Ollama, offline usage, self-hosting, custom context providers, and advanced customization tutorials" --- -## Model & Setup Guides +## What Model & Setup Guides Are Available - [Using Ollama with Continue](/guides/ollama-guide) - Local AI development with Ollama - [Setting up Codestral](/guides/set-up-codestral) - Configure Mistral's Codestral model @@ -10,11 +11,11 @@ title: "Overview" - [Running Continue Without Internet](/guides/running-continue-without-internet) - Offline development setup - [Llama 3.1 Setup](/guides/llama3.1) - Getting started with Llama 3.1 -## Advanced Tutorials +## What Advanced Tutorials Are Available - [Build Your Own Context Provider](/guides/build-your-own-context-provider) - Create custom context providers - [Custom Code RAG](/guides/custom-code-rag) - Implement custom retrieval-augmented generation -## Contributing +## How to Contribute to Guides Have a guide idea or found an issue? We welcome contributions! Check our [GitHub repository](https://github.com/continuedev/continue) to get involved. diff --git a/docs/guides/plan-mode-guide.mdx b/docs/guides/plan-mode-guide.mdx index 304a37eaf..fdaca3db3 100644 --- a/docs/guides/plan-mode-guide.mdx +++ b/docs/guides/plan-mode-guide.mdx @@ -33,7 +33,7 @@ Plan Mode prevents unintentional file modifications, letting you think through s -## Use Cases +## What Are the Use Cases for Plan Mode Plan Mode excels in four key scenarios where understanding before acting prevents expensive mistakes: @@ -65,14 +65,14 @@ Plan Mode excels in four key scenarios where understanding before acting prevent -## Best Practices +## What Are the Best Practices for Plan Mode? -### For Faster Planning +### How to Plan Faster 1. **Scope your requests**: `Focus analysis on the user authentication module only, ignore the admin features` 2. **Use targeted context**: `Analyze @Files and its direct imports for security issues` -### For Higher Quality Plans +### How to Create Higher Quality Plans 1. **Provide business context**: `This feature needs to handle Black Friday traffic (10x normal load). Plan accordingly.` 2. **Share technical constraints**: `We're on AWS with strict security requirements. Plan a file upload system that meets SOC2 compliance.` @@ -85,7 +85,7 @@ You can switch to `Plan` in the mode selector below the chat input box. ![How to select plan mode](../images/plan-mode-selector.png) -## Available Tools in Plan Mode +## What Tools Are Available in Plan Mode? | Tool | Available | Description | | :-------------------------------- | :-------- | :--------------------------------------------------- | @@ -104,7 +104,7 @@ You can switch to `Plan` in the mode selector below the chat input box. | **Git commits/pushes** | ❌ | Making changes to version control | | **Database modifications** | ❌ | Altering database data or structure | -## Context Integration in Plan Mode +## How Context Integration Works in Plan Mode Context is the foundation of effective planning. Without proper context, AI models fall back on generic patterns, leading to plans that don't fit your specific system. Continue's [context system](/features/chat/context-selection) transforms broad suggestions into actionable strategies: @@ -256,7 +256,7 @@ Context is the foundation of effective planning. Without proper context, AI mode -## From Plan to Execution +## How to Transition From Plan to Execution ### When to Transition to Agent Mode diff --git a/docs/guides/running-continue-without-internet.mdx b/docs/guides/running-continue-without-internet.mdx index 0c2799032..6f3da06ff 100644 --- a/docs/guides/running-continue-without-internet.mdx +++ b/docs/guides/running-continue-without-internet.mdx @@ -1,9 +1,9 @@ --- -title: "Running Continue without Internet" -description: "Continue can be run even on an air-gapped computer if you use a local model. Only a few adjustments are required for this to work." +title: "How to Run Continue Without Internet" +description: "Learn how to set up Continue for air-gapped or offline environments using local models, including steps to disable telemetry and configure local model providers" --- 1. Download the latest .vsix file from the [Open VSX Registry](https://open-vsx.org/extension/Continue/continue) and [install it to VS Code](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). 2. Open the [User Settings Page](/customize/settings) and turn off "Allow Anonymous Telemetry". This will stop Continue from attempting requests to PostHog for [anonymous telemetry](/customize/telemetry). -3. Also in `config.json`, set the default model to a local model. You can available options [here](/customization/models#openai). +3. Also in `config.json`, set the default model to a local model. You can find available options [here](/customize/model-providers/overview). 4. Restart VS Code to ensure that the changes to `config.json` or `config.yaml` take effect. diff --git a/docs/guides/set-up-codestral.mdx b/docs/guides/set-up-codestral.mdx index 06c7c01ca..eb700ad3a 100644 --- a/docs/guides/set-up-codestral.mdx +++ b/docs/guides/set-up-codestral.mdx @@ -1,5 +1,6 @@ --- title: "How to Set Up Codestral" +description: "Step-by-step guide for configuring Mistral's Codestral model with Continue for both chat and autocomplete functionality using your Mistral AI API key" --- **Here is a step-by-step guide on how to set up Codestral with Continue using the Mistral AI API:** diff --git a/docs/guides/understanding-assistants.mdx b/docs/guides/understanding-assistants.mdx index 7dfad68e9..4bc35693b 100644 --- a/docs/guides/understanding-assistants.mdx +++ b/docs/guides/understanding-assistants.mdx @@ -1,15 +1,17 @@ --- -title: "Understanding Assistants: Hub vs Local Configuration" -description: "Master the two approaches to configuring AI assistants in Continue - choosing the right path for your development workflow" +title: "How to Understand Assistants: Hub vs Local Configuration" +description: "Learn how to choose between cloud-managed Hub assistants and local configuration for AI development assistance in Continue, including setup, management, and best practices for each approach" --- Every developer has unique needs when it comes to AI assistance. Some prefer the convenience of cloud-managed configurations, while others need the control and privacy of local setups. Continue offers both paths, and this guide will help you choose the right one for your workflow. -## The Two Paths to AI Assistance +## What Are the Two Paths to AI Assistance? + +Continue provides two distinct ways to configure your AI assistant: Think of Continue's configuration options like choosing between a managed service and self-hosting. Both get you to the same destinationβ€”powerful AI assistance in your IDEβ€”but the journey and control level differ significantly. -### Accessing Your Assistant Configuration +### How to Access Your Assistant Configuration Before we dive into the specifics, let's understand how to access your configuration: @@ -21,13 +23,14 @@ Before we dive into the specifics, let's understand how to access your configura ![configure an assistant](/images/configure-continue.png) -## Hub Assistants: The Managed Experience +## What Are Hub Assistants: The Managed Experience Hub Assistants represent the "it just works" philosophy. When you [sign in to Continue Hub](https://auth.continue.dev/), you gain access to a curated ecosystem of pre-configured assistants that sync seamlessly across all your development environments. -### Why Choose Hub Assistants? +### Why Should You Choose Hub Assistants? **The Power of Simplicity** + - **Instant Setup**: Browse the [assistant marketplace](https://hub.continue.dev/explore/assistants) and add any assistant to your account with a single click - **Web-Based Management**: Configure models, add secrets, and customize settings through an intuitive web interfaceβ€”no JSON editing required - **Automatic Synchronization**: Make a change on the hub, and it reflects immediately across all your IDE instances @@ -35,7 +38,7 @@ Hub Assistants represent the "it just works" philosophy. When you [sign in to Co ![nextjs assistant](/images/nextjs-assistant.png) -### Getting Started with Hub Assistants +### How to Get Started with Hub Assistants The journey from zero to AI-powered coding takes just four steps: @@ -46,31 +49,34 @@ The journey from zero to AI-powered coding takes just four steps: Pro tip: Hub Assistants are perfect for teams. Create a custom assistant with your team's coding standards, preferred models, and context sources, then share it with a simple link. -### Managing Hub Assistants +### How to Manage Hub Assistants All Hub Assistant management happens through [the Hub](https://hub.continue.dev). For detailed customization, see our guide on [Editing an Assistant](/hub/assistants/edit-an-assistant). -## Local Assistants: The Power User's Choice +## What Are Local Assistants: The Power User's Choice Local Assistants put you in the driver's seat. Using a `config.yaml` file, you have complete control over every aspect of your AI assistant's behavior, with all configuration stored directly on your machine. -### Why Choose Local Assistants? +### Why Should You Choose Local Assistants? **Complete Control and Privacy** + - **Your Data, Your Rules**: All configuration stays on your machineβ€”perfect for air-gapped environments or strict data policies - **Version Control Integration**: Check your `config.yaml` into git alongside your code, ensuring reproducible environments - **Offline Capability**: Once configured, no internet connection needed (assuming you're using local models) - **Unlimited Customization**: Access every configuration option, experimental feature, and advanced setting -### Setting Up Local Assistants +### How to Set Up Local Assistants Local configuration lives in a single YAML file in your home directory: **File Locations:** + - macOS/Linux: `~/.continue/config.yaml` - Windows: `%USERPROFILE%\.continue\config.yaml` **Quick Access Method:** + 1. Open the assistants dropdown in your IDE 2. Click the gear icon next to "Local Assistant" 3. The `config.yaml` file opens in your editor @@ -85,24 +91,27 @@ The first time you use Continue, it generates a `config.yaml` with sensible defa For the complete configuration reference, see our [config.yaml documentation](/reference). -## Making the Right Choice +## How to Make the Right Choice The decision between Hub and Local assistants often comes down to your specific needs and constraints. Here's a framework to help you decide: ### Choose Hub Assistants When You: **Value Convenience Over Control** + - Want to start coding with AI assistance in under 60 seconds - Prefer visual interfaces over editing configuration files - Need to switch between multiple machines frequently - Work in a team that needs standardized AI assistance **Need Advanced Collaboration** + - Want to share custom assistants with teammates - Need centralized API key management - Require quick updates across your entire organization **Are Getting Started** + - New to AI-powered development - Want to experiment with different models and configurations - Prefer guided setup experiences @@ -110,21 +119,24 @@ The decision between Hub and Local assistants often comes down to your specific ### Choose Local Assistants When You: **Require Maximum Control** + - Need to version control your exact configuration - Want to customize every aspect of the AI behavior - Require reproducible development environments **Have Privacy Requirements** + - Work with sensitive code that requires air-gapped environments - Need to ensure all configuration data stays local - Have strict compliance requirements about data storage **Are a Power User** + - Comfortable editing YAML/JSON files - Want access to experimental features - Need to integrate with local tools and scripts -## The Hybrid Approach +## How to Use the Hybrid Approach Here's a secret: you don't have to choose just one. Many developers use both approaches: @@ -154,22 +166,26 @@ You can switch between them seamlessly using the assistant selector in your IDE. ### Hub Assistant Issues **Changes Not Reflecting?** + - Click "Reload config" in your IDE - Check your internet connection - Ensure you're signed in to the correct account **Assistant Not Available?** + - Verify it's added to your account on the hub - Check if it requires specific API keys ### Local Assistant Issues **Config Not Loading?** + - Verify file location matches your OS - Check YAML syntax (Continue will show errors) - Ensure file permissions allow reading **Autocomplete Not Working?** + - Update to the latest Continue version - Check that you're editing the correct file @@ -183,4 +199,4 @@ Now that you understand both configuration approaches, you're ready to dive deep Remember, the best configuration is the one that helps you code more effectively. Start simple, experiment freely, and gradually refine your setup as you discover what works best for your workflow. -Happy coding with Continue! πŸš€ \ No newline at end of file +Happy coding with Continue! πŸš€ diff --git a/docs/home.mdx b/docs/home.mdx index a24548999..e2c79a939 100644 --- a/docs/home.mdx +++ b/docs/home.mdx @@ -1,8 +1,13 @@ --- title: "Introduction" +description: "Learn how Continue enables developers to embrace continuous AI, enabling them to build custom AI code assistants with open source VS Code and JetBrains extensions featuring chat, autocomplete, edit, and agent capabilities" --- -**Continue enables developers to ship faster with Continuous AI.** +## What is Continue? + +**Continue enables developers to create, share, and use custom AI code assistants with our open source [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension) extensions and [hub of models, rules, prompts, docs, and other building blocks](https://hub.continue.dev)** + +## Key Features **You can use Continue to build and run custom agents across your IDE, terminal, and CI.** diff --git a/docs/hub/assistants/create-an-assistant.mdx b/docs/hub/assistants/create-an-assistant.mdx index 83d7feff3..dd7ee9678 100644 --- a/docs/hub/assistants/create-an-assistant.mdx +++ b/docs/hub/assistants/create-an-assistant.mdx @@ -1,23 +1,10 @@ --- -title: "Create an assistant" +title: "How to Create an AI Assistant" +description: "Learn how to create custom AI coding assistants in Continue Hub by remixing existing assistants or building new ones from scratch with reusable blocks and YAML configuration." +sidebarTitle: "Create an AI Assistant" --- -## Remix an assistant - -You should remix an assistant if you want to use it after some modifications. - -By clicking the β€œremix” button, you’ll be taken to the β€œCreate a remix” page. - -![Remix Assistant Button](/images/hub/assistants/images/assistant-remix-button-728ececa73983140eeab42e33cc3903b.png) - -Once here, you’ll be able to - -1. add or remove blocks in YAML configuration -2. change the name, description, icon, etc. - -Clicking β€œCreate assistant” will make this assistant available for use. - -## Create an assistant from scratch +## How to Create an AI Assistant from Scratch To create an assistant from scratch, select β€œNew assistant” in the top bar. @@ -30,3 +17,18 @@ The easiest way to create an assistant is to click "Create assistant" with the d Alternatively, you can edit the assistant YAML directly before clicking "Create assistant". Refer to examples of assistants on [hub.continue.dev](https://hub.continue.dev/explore/assistants) and visit the [YAML Reference](/reference#complete-yaml-config-example) docs for more details. ![New assistant YAML](/images/hub/assistants/images/assistant-create-yaml-a991e5a81506f1c3ba611a664a50734c.png) + +## How to Remix an Assistant + +You can also create an assistant by remixing an existing one. This is useful if you want to start with a pre-configured assistant and make modifications. + +By clicking the β€œremix” button, you’ll be taken to the β€œCreate a remix” page. + +![Remix Assistant Button](/images/hub/assistants/images/assistant-remix-button-728ececa73983140eeab42e33cc3903b.png) + +Once here, you’ll be able to + +1. add or remove blocks in YAML configuration +2. change the name, description, icon, etc. + +Clicking β€œCreate assistant” will make this assistant available for use. diff --git a/docs/hub/assistants/edit-an-assistant.mdx b/docs/hub/assistants/edit-an-assistant.mdx index b7fa9c2ed..235b01358 100644 --- a/docs/hub/assistants/edit-an-assistant.mdx +++ b/docs/hub/assistants/edit-an-assistant.mdx @@ -1,5 +1,5 @@ --- -title: "Edit an Assistant" +title: "How to Edit an Assistant" description: "New versions of an assistant can be created and published using the sidebar." --- diff --git a/docs/hub/assistants/use-an-assistant.mdx b/docs/hub/assistants/use-an-assistant.mdx index 92f28760a..85257d250 100644 --- a/docs/hub/assistants/use-an-assistant.mdx +++ b/docs/hub/assistants/use-an-assistant.mdx @@ -1,14 +1,19 @@ --- -title: "Use an assistant" -description: "To use an existing assistant, you can explore other assistants ." +title: "How to Use an Assistant" +description: "Learn how to add, configure, and use an AI assistant in Continue, including setting required inputs and selecting it in your IDE extension." --- -Once you've found the assistant you want to use +## Steps to Use an AI Assistant in Continue + +Once you've found the assistant you want to use on Continue Hub: 1. Click β€œAdd Assistant” on its page 2. Add any required inputs (e.g. secrets like API keys) 3. Select β€œSave changes” in assistant sidebar on the right hand side -After this, you can then go to your IDE extension and begin using the assistant by selecting it from the assistant dropdown. +After saving, open your IDE extension and: + +- Select the assistant from the **assistant dropdown** in the Continue extension. +- Begin using it for chat, code generation, or other configured capabilities. [Extension Assistant Selector](/images/assistant-extension-select-319492a06d6249e5389747687341dfdb.png) diff --git a/docs/hub/blocks/block-types.mdx b/docs/hub/blocks/block-types.mdx index 235d0bd7e..bbcb34f02 100644 --- a/docs/hub/blocks/block-types.mdx +++ b/docs/hub/blocks/block-types.mdx @@ -1,12 +1,14 @@ --- -title: "Block Types" +title: "Block Types in Continue Hub: Models, Context Providers, Prompts, and More" +sideBarTitle: "Block Types" +description: "Explore the different types of reusable blocks in Continue Hub including models, context providers, documentation, MCP servers, rules, prompts, and data components" --- ## Models Models are blocks that let you specify Large Language Models (LLMs) and other deep learning models to be used for various roles in the open-source IDE extension like Chat, Autocomplete, Edit, Embed, Rerank, etc. You can explore available models on [the hub](https://hub.continue.dev/explore/models). -Continue supports [many model providers](/customization/models#openai), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](/customize/model-roles). View [`models`](/reference#models) in the YAML Reference for more details. +Continue supports [many model providers](/customize/model-providers), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](/customize/model-roles). View [`models`](/reference#models) in the YAML Reference for more details. ## Context @@ -36,7 +38,8 @@ Learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rul Prompts blocks are pre-written, reusable prompts that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. [Explore prompts](https://hub.continue.dev/explore/prompts) on the hub. -Prompt blocks have the same syntax as [prompt files](/customization/prompts). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). +Prompt blocks are pre-written, reusable prompts that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. [Explore prompts](https://hub.continue.dev/explore/prompts) on the hub. +Prompt blocks have the same syntax as [prompt files](/customize/deep-dives/prompts). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). ## Data diff --git a/docs/hub/blocks/bundles.mdx b/docs/hub/blocks/bundles.mdx index 1ac5cf1cb..681c5c1d7 100644 --- a/docs/hub/blocks/bundles.mdx +++ b/docs/hub/blocks/bundles.mdx @@ -3,9 +3,9 @@ title: "Bundles" description: "Bundles are collections of blocks that are commonly used together. You can use them to add multiple building blocks to your custom AI code assistants at once. They are only a concept on , so they are not represented in ." --- -## Use a bundle +## How to Use a Bundle -Once you know which bundle you want to use, you’ll need to +Once you know which bundle you want to use, you’ll need to: 1. Make sure the correct assistant is in the sidebar 2. Click β€œAdd all blocks". This adds the individual blocks to your assistant. @@ -14,7 +14,7 @@ Once you know which bundle you want to use, you’ll need to After this, you can then go to your IDE extension using the "Open VS Code" or "Open Jetbrains" buttons and begin using the new blocks. -## Create a bundle +## How to Create a Bundle To create a bundle, click β€œNew bundle” in the header. @@ -28,6 +28,6 @@ Then, search blocks using the "Search blocks" input and add them to your bundle. Once you have added all the blocks you want in your bundle, click "Create Bundle" to save it and make it available for use. -## Remix a bundle +## How to Remix a Bundle It is not currently possible to remix a bundle. diff --git a/docs/hub/blocks/create-a-block.mdx b/docs/hub/blocks/create-a-block.mdx index cbf1eca05..2c5dc58fb 100644 --- a/docs/hub/blocks/create-a-block.mdx +++ b/docs/hub/blocks/create-a-block.mdx @@ -1,8 +1,10 @@ --- -title: "Create a block" +title: "How to Create a Block" +sidebarTitle: "Create a Block" +description: "Learn how to create and remix reusable blocks in Continue Hub for sharing configuration components like models, prompts, and tools with customizable inputs and template variables" --- -## Remix a block +## How to Remix a Block You should remix a block if you want to use it after some modifications. @@ -12,7 +14,7 @@ By clicking the β€œremix” button, you’ll be taken to the β€œCreate a remix Once here, you’ll be able to 1) edit YAML configuration for the block and 2) change name, description, icon, etc. Clicking β€œCreate block” will make this block available for use in an assistant. -## Create a block from scratch +## How to Create a Block from Scratch To create a block from scratch, you will need to click β€œNew block” in the top bar. @@ -22,6 +24,6 @@ After filling out information on the block, you will want to create a block foll ![New block page](/images/hub/blocks/images/block-new-page-2d7faf71739d0f062d555b5d7257fb56.png) -### Block inputs +### Block Inputs Blocks can receive values, including secrets, as inputs through templating. For values that the user of the block needs to set, you can use template variables (e.g. `${{ inputs.API_KEY}}`). Then, the user can set `API_KEY: ${{ secrets.MY_API_KEY }}` in the `with` clause of their assistant. diff --git a/docs/hub/blocks/intro.mdx b/docs/hub/blocks/intro.mdx index 0015b415f..d94f45c77 100644 --- a/docs/hub/blocks/intro.mdx +++ b/docs/hub/blocks/intro.mdx @@ -1,6 +1,6 @@ --- -title: "Introduction" -description: "Blocks are the components you use to build a custom AI code assistant. These include , , , , , , and ." +title: "Introduction to Continue Blocks" +description: "Blocks are the components you use to build a custom AI code assistant. These include models, prompts, tools, context, and more." --- Blocks follow the [`config.yaml`](/reference) format. When combined with other blocks into a complete `config.yaml`, they form a custom AI code assistant. diff --git a/docs/hub/blocks/use-a-block.mdx b/docs/hub/blocks/use-a-block.mdx index 753e8c085..3971dbc63 100644 --- a/docs/hub/blocks/use-a-block.mdx +++ b/docs/hub/blocks/use-a-block.mdx @@ -1,8 +1,10 @@ --- -title: "Use a block" -description: "Blocks can be used by adding them to assistants:" +title: "How to Use a Block" +description: "Learn how to use blocks in Continue Hub to enhance your AI code assistant." --- +Blocks are used to build custom AI code assistants in Continue Hub. Learn more: + - [Create an assistant](/hub/assistants/create-an-assistant) - [Edit an assistant](/hub/assistants/edit-an-assistant) diff --git a/docs/hub/governance/pricing.mdx b/docs/hub/governance/pricing.mdx index 69158b334..3dace0e4b 100644 --- a/docs/hub/governance/pricing.mdx +++ b/docs/hub/governance/pricing.mdx @@ -1,5 +1,6 @@ --- title: "Pricing" +description: "Continue Hub pricing plans for individuals, teams, and enterprises, including the Models Add-On that provides access to frontier AI models for a flat monthly fee" --- ## Solo diff --git a/docs/hub/introduction.mdx b/docs/hub/introduction.mdx index 4bc0c7da4..f10d567cd 100644 --- a/docs/hub/introduction.mdx +++ b/docs/hub/introduction.mdx @@ -1,5 +1,6 @@ --- title: "Introduction" +description: "Continue Hub provides a central registry for creating, managing, and sharing AI coding assistants and their reusable building blocks with organization-level governance and configuration" --- [Continue Hub](https://hub.continue.dev) makes it simple to create custom AI code [assistants](/hub/assistants/intro), providing a registry for defining, managing, and sharing assistant [building blocks](/hub/blocks/intro). diff --git a/docs/index.mdx b/docs/index.mdx index f6094964c..4df6c30cc 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -1,6 +1,7 @@ --- title: "Introduction" icon: book-open +description: "Continue is an open source platform for building AI-powered coding assistants with customizable components for chat, autocomplete, edit, and agent workflows in VS Code and JetBrains IDEs" --- diff --git a/docs/migrate-i18n.md b/docs/migrate-i18n.md deleted file mode 100644 index cdf0d6eb2..000000000 --- a/docs/migrate-i18n.md +++ /dev/null @@ -1,72 +0,0 @@ -# Internationalization (i18n) Migration Plan - -## Current State - -- Docusaurus has complete Chinese (zh-CN) translations but they're **commented out** in config -- 79 translated markdown files exist in `/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/` -- Theme translations exist in `/docs/i18n/zh-CN/code.json` - -## Mintlify Pro i18n Approach - -- Uses `versions` array in `mint.json` with `locale` values -- Supports Chinese as `cn` locale -- Auto-translates fixed UI text ("Was this page helpful?", etc.) -- Built-in internationalization feature in Mintlify Pro -- Requires manual content translation (which we already have) - -## Migration Steps - -### 1. Add Chinese Version to mint.json - -```json -"versions": [ - { - "name": "English", - "locale": "en" - }, - { - "name": "δΈ­ζ–‡", - "locale": "cn" - } -] -``` - -### 2. Create Chinese Content Structure - -- Create `/docs2/cn/` directory -- Copy translated content from `/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/` -- Update paths and frontmatter for Mintlify format - -### 3. Update Navigation for Chinese - -- Add version specification to navigation groups -- Ensure proper routing for Chinese pages - -### 4. Content Format Migration - -- Convert Docusaurus-specific syntax to Mintlify format -- Update image paths from `/img/` to `/images/` -- Convert components (Info, Warning, Tabs, etc.) - -## Implementation Decision - -For Phase 4, we have two options: - -1. **Enable Chinese translations** - Full migration of existing Chinese content -2. **Document for future** - Create migration plan but defer implementation - -Given that Chinese translations are currently disabled in production, **Option 2** is recommended for Phase 4 to avoid scope creep. The Chinese content is ready and can be migrated when needed. - -## Files to Migrate (if enabled) - -- `/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/` β†’ `/docs2/cn/` -- 79 translated markdown files -- Navigation structure adaptation -- Theme translations (handled automatically by Mintlify) - -## Next Steps - -1. Document the migration approach -2. Create helper scripts for content conversion -3. Test with a small subset of Chinese pages -4. Full migration when Chinese localization is prioritized diff --git a/docs/reference.mdx b/docs/reference.mdx index 06393cc2d..e941beaf7 100644 --- a/docs/reference.mdx +++ b/docs/reference.mdx @@ -1,5 +1,6 @@ --- title: "config.yaml Reference" +description: "Comprehensive guide to the config.yaml format used by Continue.dev for building custom coding assistants. Learn how to define models, context providers, rules, prompts, and more using reusable blocks and YAML configuration." --- ## Introduction @@ -14,7 +15,7 @@ Continue hub assistants are defined using the `config.yaml` specification. Assis Config YAML replaces `config.json`, which is deprecated. View the **[Migration - Guide](/customize/yaml-migration)**. + Guide](/reference/yaml-migration)**. An assistant is made up of: @@ -184,7 +185,7 @@ The `models` section defines the language models used in your configuration. Mod - `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists. -- `promptTemplates`: Can be used to override the default prompt templates for different model roles. Valid values are `chat`, [`edit`](/customize/model-roles#edit-prompt-templating), [`apply`](/customize/model-roles#apply-prompt-templating) and [`autocomplete`](/customize/model-roles#autocomplete-prompt-templating). The `chat` property must be a valid template name, such as `llama3` or `anthropic`. +- `promptTemplates`: Can be used to override the default prompt templates for different model roles. Valid values are [`chat`](), [`edit`](/customize/model-roles/edit#edit-prompt-templating), [`apply`](/customize/model-roles/apply#apply-prompt-templating) and [`autocomplete`](/customize/model-roles/autocomplete#autocomplete-prompt-templating). The `chat` property must be a valid template name, such as `llama3` or `anthropic`. - `chatOptions`: If the model includes role `chat`, these settings apply for Agent and Chat mode: @@ -316,7 +317,7 @@ context: ### `rules` -List of rules that the LLM should follow. These are concatenated into the system message for all [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) requests. See the [rules deep dive](/customization/rules) for details. +List of rules that the LLM should follow. These are concatenated into the system message for all [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) requests. See the [rules deep dive](/customize/deep-dives/rules) for details. Explicit rules can either be simple text or an object with the following properties: @@ -411,7 +412,7 @@ mcpServers: ### `data` -Destinations to which [development data](/customize/overview#development-data) will be sent. +Destinations to which [development data](/customize/deep-dives/development-data) will be sent. **Properties:** diff --git a/docs/reference/json-reference.mdx b/docs/reference/json-reference.mdx index 54fa4d64a..fa57ed5a8 100644 --- a/docs/reference/json-reference.mdx +++ b/docs/reference/json-reference.mdx @@ -18,9 +18,9 @@ Below are details for each property that can be set in `config.json`. The config **All properties at all levels are optional unless explicitly marked required** -### `models` +## `models` -Your **chat** models are defined here, which are used for [Chat](/features/chat/how-it-works), [Edit](/features/edit/how-it-works) and [VS Code actions](/customization/overview#vscode-actions). +Your **chat** models are defined here, which are used for [Chat](/features/chat/how-it-works), [Edit](/features/edit/how-it-works) and [VS Code actions](/customize/overview#vscode-actions). Each model has specific configuration options tailored to its provider and functionality, which can be seen as suggestions while editing the json. @@ -85,7 +85,7 @@ config.json } ``` -### `tabAutocompleteModel` +## `tabAutocompleteModel` Specifies the model or models for tab autocompletion, defaulting to an Ollama instance. This property uses the same format as `models`. Can be an array of models or an object for one model. @@ -137,7 +137,7 @@ config.json } ``` -### `embeddingsProvider` +## `embeddingsProvider` Embeddings model settings - the model used for @Codebase and @docs. @@ -172,7 +172,7 @@ config.json } ``` -### `completionOptions` +## `completionOptions` Parameters that control the behavior of text generation and completion settings. Top-level `completionOptions` apply to all models, _unless overridden at the model level_. @@ -202,7 +202,7 @@ config.json { "completionOptions": { "stream": false, "temperature": 0.5 } } ``` -### `requestOptions` +## `requestOptions` Default HTTP request options that apply to all models and context providers, unless overridden at the model level. @@ -261,7 +261,7 @@ config.json } ``` -### `docs` +## `docs` List of documentation sites to index. @@ -282,7 +282,7 @@ config.json "docs": [ { "title": "Continue", "startUrl": "https://docs.continue.dev/intro", "faviconUrl": "https://docs.continue.dev/favicon.ico", }] ``` -### `slashCommands` +## `slashCommands` Custom commands initiated by typing "/" in the sidebar. Commands include predefined functionality or may be user-defined. @@ -295,7 +295,7 @@ Custom commands initiated by typing "/" in the sidebar. Commands include predefi The following commands are built-in and can be added to `config.json` to make them visible: -#### `/share` +### `/share` Generate a shareable markdown transcript of your current chat history. @@ -315,7 +315,7 @@ config.json Use the `outputDir` parameter to specify where you want to the markdown file to be saved. -#### `/cmd` +### `/cmd` Generate a shell command from natural language and (only in VS Code) automatically paste it into the terminal. @@ -329,7 +329,7 @@ config.json } ``` -#### `/commit` +### `/commit` Shows the LLM your current git diff and asks it to generate a commit message. @@ -346,7 +346,7 @@ config.json } ``` -#### `/http` +### `/http` Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup. The endpoint should return a sequence of string updates, which will be streamed to the Continue sidebar. See our basic [FastAPI example](https://github.com/continuedev/continue/blob/74002369a5e435735b83278fb965e004ae38a97d/core/context/providers/context_provider_server.py#L34-L45) for reference. @@ -364,7 +364,7 @@ config.json } ``` -#### `/issue` +### `/issue` Describe the issue you'd like to generate, and Continue will turn into a well-formatted title and body, then give you a link to the draft so you can submit. Make sure to set the URL of the repository you want to generate issues for. @@ -382,7 +382,7 @@ config.json } ``` -#### `/onboard` +### `/onboard` The onboard slash command helps to familiarize yourself with a new project by analyzing the project structure, READMEs, and dependency files. It identifies key folders, explains their purpose, and highlights popular packages used. Additionally, it offers insights into the project's architecture. @@ -463,15 +463,15 @@ config.json } ``` -### `userToken` +## `userToken` An optional token that identifies the user, primarily for authenticated services. -### `systemMessage` +## `systemMessage` Defines a system message that appears before every response from the language model, providing guidance or context. -### `experimental` +## `experimental` Several experimental config parameters are available, as described below: @@ -498,7 +498,7 @@ Several experimental config parameters are available, as described below: - `fix`: Prompt for fixing code. - `optimize`: Prompt for optimizing code. -- `modelContextProtocolServers`: See [Model Context Protocol](/customization/mcp-tools) +- `modelContextProtocolServers`: See [Model Context Protocol](/customize/deep-dives/mcp) Example @@ -531,7 +531,7 @@ config.json } ``` -### Fully deprecated settings +## Fully deprecated settings Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the [User Settings Page](/customize/settings). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. diff --git a/docs/reference/yaml-migration.mdx b/docs/reference/yaml-migration.mdx index 1e585b0a0..4b214f2d2 100644 --- a/docs/reference/yaml-migration.mdx +++ b/docs/reference/yaml-migration.mdx @@ -321,6 +321,7 @@ The following top-level fields from `config.json` still work when using `config. - top-level `completionOptions` - `tabAutocompleteOptions` + - `disable` - `maxPromptTokens` - `debounceDelay` diff --git a/docs/replace-custom-plugins.md b/docs/replace-custom-plugins.md deleted file mode 100644 index 4fd3acc1b..000000000 --- a/docs/replace-custom-plugins.md +++ /dev/null @@ -1,147 +0,0 @@ -# Custom Plugin Replacement Plan - -## Overview - -This document outlines how to replace custom Docusaurus plugins and functionality with Mintlify Pro equivalents. - -## Custom Plugins Analysis - -### 1. Custom LLMs.txt Plugin βœ… BUILT-IN (Mintlify Pro) - -**Current functionality:** - -- Scans HTML files post-build -- Extracts titles, descriptions, URLs from all pages -- Organizes content by sections (Getting Started, Features, Guides, etc.) -- Generates structured `/llms.txt` file for AI model consumption - -**Mintlify Pro replacement:** - -- **Automatic `/llms.txt`** - Lists all available pages automatically -- **Automatic `/llms-full.txt`** - Combines entire documentation into single file -- **AI-optimized** - Specifically designed for LLM consumption -- **No custom code required** - Built-in feature - -**Status:** βœ… Complete - No migration needed - -### 2. Analytics Configuration βœ… BUILT-IN - -**Current:** - -- Google Analytics: `G-M3JWW8N2XQ` -- Custom Reo.dev script - -**Mintlify replacement:** - -- Native Google Analytics support in mint.json -- Custom scripts can be added via mint.json - -### 3. Search Configuration βœ… BUILT-IN - -**Current:** - -- Algolia search (App ID: `0OMUMCQZVV`, Index: `continue`) - -**Mintlify replacement:** - -- Native search functionality built-in -- Can configure Algolia if needed - -### 4. URL Redirects βœ… COMPLETE - -**Status:** Already migrated (145 redirects) in mint.json - -## Implementation Plan - -### Phase 4A: Replace LLMs.txt Plugin - -1. Create `generate-llms-txt.js` script -2. Adapt to work with Mintlify's build structure -3. Test with current docs2 content -4. Add to build process - -### Phase 4B: Add Analytics - -1. Add Google Analytics to mint.json -2. Migrate custom Reo.dev script if needed - -### Phase 4C: Configure Search - -1. Verify Mintlify search works -2. Configure Algolia if required - -## Custom LLMs.txt Script for Mintlify - -```javascript -// generate-llms-txt.js - Adapted for Mintlify -const fs = require("fs"); -const path = require("path"); - -function generateLLMsTxt(buildDir) { - const sections = { - "Getting Started": [], - Features: [], - Guides: [], - Customization: [], - Customize: [], - Hub: [], - Reference: [], - }; - - // Read mint.json to get page structure - const mintJson = JSON.parse(fs.readFileSync("mint.json", "utf8")); - - // Extract page info from navigation - function extractPages(navItems, sectionName = "") { - navItems.forEach((item) => { - if (typeof item === "string") { - // Direct page reference - const pageInfo = getPageInfo(item); - if (pageInfo) { - categorizeContent(pageInfo, sections); - } - } else if (item.group && item.pages) { - // Group with pages - extractPages(item.pages, item.group); - } - }); - } - - extractPages(mintJson.navigation); - - // Generate llms.txt content - generateContent(sections); -} -``` - -## Files to Create - -1. **`/docs2/scripts/generate-llms-txt.js`** - LLMs.txt generator -2. **`/docs2/scripts/build-hooks.js`** - Post-build automation -3. **Update mint.json** - Add analytics and search config - -## Success Criteria - -- [ ] LLMs.txt generated correctly from Mintlify build -- [ ] Analytics tracking matches current setup -- [ ] Search functionality works as expected -- [ ] All redirects function properly -- [ ] No loss of functionality compared to Docusaurus - -## Risk Assessment - -**Low Risk:** - -- Analytics migration (built-in support) -- Search configuration (native functionality) - -**Medium Risk:** - -- LLMs.txt generation (requires custom script) -- Custom JavaScript integration - -**Mitigation:** - -- Test scripts thoroughly before deployment -- Keep Docusaurus version running during transition -- Monitor analytics and search metrics post-migration diff --git a/docs/telemetry.mdx b/docs/telemetry.mdx index 54eca8490..b44bd7e00 100644 --- a/docs/telemetry.mdx +++ b/docs/telemetry.mdx @@ -1,6 +1,7 @@ --- title: "Telemetry" icon: "chart-line" +description: "Learn about Continue's anonymous telemetry collection practices, what usage data is tracked, and how to opt out of data collection to maintain your privacy preferences" --- ## Overview diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdx index d14f282d3..ad44fd0f2 100644 --- a/docs/troubleshooting.mdx +++ b/docs/troubleshooting.mdx @@ -1,5 +1,6 @@ --- title: "Troubleshooting" +description: "Comprehensive guide to resolving common issues with Continue, including logging, keyboard shortcuts, networking problems, model capabilities, and extension configuration troubleshooting" --- 1. [Check the logs](#check-the-logs) @@ -140,7 +141,8 @@ This can be accomplished using the following command: `Continue: Rebuild codebas If Agent mode is grayed out or tools aren't functioning properly, this is likely due to model capability configuration issues. - Continue uses system message tools as a fallback for models without native tool support, so most models should work with Agent mode automatically. + Continue uses system message tools as a fallback for models without native + tool support, so most models should work with Agent mode automatically. #### Check if your model has tool support From 7a5843c415636fe29f0a898bc68085fa3d3aedaa Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 14 Aug 2025 13:28:39 -0700 Subject: [PATCH 144/174] feat: add salvage functionality for security-sensitive values in GlobalContext --- core/util/GlobalContext.test.ts | 152 +++++++++++++++++++++++++++++++- core/util/GlobalContext.ts | 50 ++++++----- 2 files changed, 177 insertions(+), 25 deletions(-) diff --git a/core/util/GlobalContext.test.ts b/core/util/GlobalContext.test.ts index 6fdcda7e7..babbe82d8 100644 --- a/core/util/GlobalContext.test.ts +++ b/core/util/GlobalContext.test.ts @@ -115,7 +115,7 @@ describe("GlobalContext", () => { expect(consoleWarnMock).toHaveBeenCalledWith( expect.stringContaining( - "Error updating global context, deleting corrupted file", + "Error updating global context, attempting to salvage security-sensitive values", ), ); @@ -174,4 +174,154 @@ describe("GlobalContext", () => { it("should not crash or throw when getting a key that hasn't been set", () => { expect(globalContext.get("hasAlreadyCreatedAPromptFile")).toBeUndefined(); }); + + describe("salvage functionality", () => { + it("should salvage allowAnonymousTelemetry from corrupted sharedConfig", () => { + // Create a file with partially corrupted JSON that contains salvageable sharedConfig + const corruptedContent = `{ + "indexingPaused": true, + "sharedConfig": {"allowAnonymousTelemetry": false}, + "corrupted": { invalid json +}`; + fs.writeFileSync(globalContextFilePath, corruptedContent); + + const consoleWarnMock = jest + .spyOn(console, "warn") + .mockImplementation(() => {}); + + // Try to update - this should salvage the allowAnonymousTelemetry value + globalContext.update("indexingPaused", false); + + expect(consoleWarnMock).toHaveBeenCalledWith( + expect.stringContaining( + "Error updating global context, attempting to salvage security-sensitive values", + ), + ); + + // Should have the new value + expect(globalContext.get("indexingPaused")).toBe(false); + + // Should have salvaged the sharedConfig with allowAnonymousTelemetry + const salvaged = globalContext.get("sharedConfig"); + expect(salvaged).toEqual({ allowAnonymousTelemetry: false }); + + consoleWarnMock.mockRestore(); + }); + + it("should handle salvage when no sharedConfig is present", () => { + const corruptedContent = `{ + "indexingPaused": true, + "corrupted": { invalid json +}`; + fs.writeFileSync(globalContextFilePath, corruptedContent); + + const consoleWarnMock = jest + .spyOn(console, "warn") + .mockImplementation(() => {}); + + globalContext.update("hasAlreadyCreatedAPromptFile", true); + + expect(consoleWarnMock).toHaveBeenCalledWith( + expect.stringContaining( + "Error updating global context, attempting to salvage security-sensitive values", + ), + ); + + // Should have the new value + expect(globalContext.get("hasAlreadyCreatedAPromptFile")).toBe(true); + + // Should not have any sharedConfig since none was salvageable + expect(globalContext.get("sharedConfig")).toBeUndefined(); + + consoleWarnMock.mockRestore(); + }); + + it("should handle salvage when sharedConfig has invalid allowAnonymousTelemetry", () => { + const corruptedContent = `{ + "indexingPaused": true, + "sharedConfig": {"allowAnonymousTelemetry": "not-a-boolean"}, + "corrupted": { invalid json +}`; + fs.writeFileSync(globalContextFilePath, corruptedContent); + + const consoleWarnMock = jest + .spyOn(console, "warn") + .mockImplementation(() => {}); + + globalContext.update("indexingPaused", false); + + // Should not have salvaged an invalid boolean value + const salvaged = globalContext.get("sharedConfig"); + expect(salvaged).toBeUndefined(); + + consoleWarnMock.mockRestore(); + }); + + it("should handle salvage with valid allowAnonymousTelemetry set to true", () => { + const corruptedContent = `{ + "indexingPaused": true, + "sharedConfig": {"allowAnonymousTelemetry": true, "otherField": "value"}, + "corrupted": { invalid json +}`; + fs.writeFileSync(globalContextFilePath, corruptedContent); + + const consoleWarnMock = jest + .spyOn(console, "warn") + .mockImplementation(() => {}); + + globalContext.update("hasAlreadyCreatedAPromptFile", true); + + // Should have salvaged only the allowAnonymousTelemetry value + const salvaged = globalContext.get("sharedConfig"); + expect(salvaged).toEqual({ allowAnonymousTelemetry: true }); + + consoleWarnMock.mockRestore(); + }); + + it("should handle completely unparseable content gracefully", () => { + fs.writeFileSync( + globalContextFilePath, + "complete garbage not json at all", + ); + + const consoleWarnMock = jest + .spyOn(console, "warn") + .mockImplementation(() => {}); + + globalContext.update("indexingPaused", true); + + // Should still work and create a new file + expect(globalContext.get("indexingPaused")).toBe(true); + expect(globalContext.get("sharedConfig")).toBeUndefined(); + + consoleWarnMock.mockRestore(); + }); + + it("should preserve multiple salvageable values when updating different key", () => { + const corruptedContent = `{ + "indexingPaused": true, + "sharedConfig": {"allowAnonymousTelemetry": false}, + "hasAlreadyCreatedAPromptFile": true, + "corrupted": { invalid json +}`; + fs.writeFileSync(globalContextFilePath, corruptedContent); + + const consoleWarnMock = jest + .spyOn(console, "warn") + .mockImplementation(() => {}); + + // Update a different key - should salvage and preserve existing data + globalContext.update("showConfigUpdateToast", false); + + // Should have the new value + expect(globalContext.get("showConfigUpdateToast")).toBe(false); + + // Should have salvaged the security-sensitive value + expect(globalContext.get("sharedConfig")).toEqual({ + allowAnonymousTelemetry: false, + }); + + consoleWarnMock.mockRestore(); + }); + }); }); diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index 714467402..db3899b76 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -9,10 +9,6 @@ import { SharedConfigSchema, } from "../config/sharedConfig"; -import { - OAuthClientInformationFull, - OAuthTokens, -} from "@modelcontextprotocol/sdk/shared/auth.js"; import { getGlobalContextFilePath } from "./paths"; export type GlobalContextModelSelections = Partial< @@ -43,14 +39,6 @@ export type GlobalContextType = { isSupportedLanceDbCpuTargetForLinux: boolean; sharedConfig: SharedConfigSchema; failedDocs: SiteIndexingConfig[]; - mcpOauthStorage: Record< - string, - { - clientInformation?: OAuthClientInformationFull; - tokens?: OAuthTokens; - codeVerifier?: string; - } - >; shownDeprecatedProviderWarnings: { [providerTitle: string]: boolean; }; @@ -84,8 +72,25 @@ export class GlobalContext { parsed = JSON.parse(data); } catch (e: any) { console.warn( - `Error updating global context, deleting corrupted file: ${e}`, + `Error updating global context, attempting to salvage security-sensitive values: ${e}`, ); + + // Attempt to salvage security-sensitive values before deleting + let salvaged: Partial = {}; + try { + // Try to partially parse the corrupted data to extract sharedConfig + const match = data.match(/"sharedConfig"\s*:\s*({[^}]*})/); + if (match) { + const sharedConfigObj = JSON.parse(match[1]); + const salvagedSharedConfig = salvageSharedConfig(sharedConfigObj); + if (Object.keys(salvagedSharedConfig).length > 0) { + salvaged.sharedConfig = salvagedSharedConfig; + } + } + } catch { + // If salvage fails, continue with empty salvaged object + } + // Delete the corrupted file and recreate it fresh try { fs.unlinkSync(filepath); @@ -94,17 +99,14 @@ export class GlobalContext { `Error deleting corrupted global context file: ${deleteError}`, ); } - // Recreate the file with just the new value - fs.writeFileSync( - filepath, - JSON.stringify( - { - [key]: value, - }, - null, - 2, - ), - ); + + // Recreate the file with salvaged values plus the new value + const newData = { + ...salvaged, + [key]: value, + }; + + fs.writeFileSync(filepath, JSON.stringify(newData, null, 2)); return; } From f1e1f6f4f7d48c55638b2f0d53e4fe7fff701512 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 14 Aug 2025 13:37:51 -0700 Subject: [PATCH 145/174] Update GlobalContext.ts --- core/util/GlobalContext.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index db3899b76..ab4d507fe 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -1,6 +1,10 @@ import fs from "node:fs"; import { ModelRole } from "@continuedev/config-yaml"; +import { + OAuthClientInformationFull, + OAuthTokens, +} from "@modelcontextprotocol/sdk/shared/auth.js"; import { SiteIndexingConfig } from ".."; import { @@ -42,6 +46,13 @@ export type GlobalContextType = { shownDeprecatedProviderWarnings: { [providerTitle: string]: boolean; }; + mcpOauthStorage: { + [serverUrl: string]: { + clientInformation?: OAuthClientInformationFull; + tokens?: OAuthTokens; + codeVerifier?: string; + }; + }; }; /** From 103a98cb90b510b5315879c8d6138a729fa2dd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20B=C5=82ach?= Date: Thu, 14 Aug 2025 23:51:27 +0200 Subject: [PATCH 146/174] fix: add Enter Enterprise License Key action (#7159) * fix: add Enter Enterprise License Key action Solves CON-3473 Notes: * I don't have a license key, so I haven't fully tested this, but looking at the TypeScript: true in the response means it's valid, and false means it's not * Extra: I added Try Again because I noticed that searching for the action every time the key is invalid is inconvenient * I wasn't sure if restarting the IDE is safe without more testing, so I ended with Restart IDE action (it was much faster to implement) * fix: review * fix: review --- .../license/AddLicenseKey.kt | 68 +++++++++++++++++++ .../license/AddLicenseKeyDialog.kt | 35 ++++++++++ 2 files changed, 103 insertions(+) create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKey.kt create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKey.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKey.kt new file mode 100644 index 000000000..2402ff6c4 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKey.kt @@ -0,0 +1,68 @@ +package com.github.continuedev.continueintellijextension.license + +import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.github.continuedev.continueintellijextension.utils.castNestedOrNull +import com.intellij.notification.NotificationAction +import com.intellij.notification.NotificationGroupManager +import com.intellij.notification.NotificationType +import com.intellij.openapi.actionSystem.ActionManager +import com.intellij.openapi.actionSystem.ActionPlaces +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.service +import com.intellij.openapi.ui.DialogWrapper + +class AddLicenseKey : AnAction() { + + override fun actionPerformed(e: AnActionEvent) { + val dialog = AddLicenseKeyDialog(e.project) + dialog.show() + if (dialog.exitCode != DialogWrapper.OK_EXIT_CODE) + return + val messenger = e.project?.service()?.coreMessenger + ?: return + messenger.request("mdm/setLicenseKey", mapOf("licenseKey" to dialog.licenseKey), null) { response -> + val isValid = response.castNestedOrNull("content") ?: false + val notification = if (isValid) + createSuccessAction() + else + createErrorAction() + notification.notify(e.project) + } + } + + private fun createSuccessAction() = + getContinueNotifications().createNotification( + "License key is valid. A restart is required for it to take effect.", + NotificationType.INFORMATION + ).addAction( + NotificationAction.create("Restart IDE") { event, notification -> + ApplicationManager.getApplication().restart() + } + ) + + private fun createErrorAction() = + getContinueNotifications().createNotification( + "License key is invalid.", + NotificationType.ERROR + ).addAction( + NotificationAction.create("Try again") { event, notification -> + notification.expire() + val action = this@AddLicenseKey + action.actionPerformed( + AnActionEvent( + null, + event.dataContext, + ActionPlaces.UNKNOWN, + action.templatePresentation.clone(), + ActionManager.getInstance(), + 0 + ) + ) + } + ) + + private fun getContinueNotifications() = + NotificationGroupManager.getInstance().getNotificationGroup("Continue") +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt new file mode 100644 index 000000000..9d6a13334 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt @@ -0,0 +1,35 @@ +package com.github.continuedev.continueintellijextension.license + +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.DialogWrapper +import com.intellij.openapi.ui.ValidationInfo +import com.intellij.ui.dsl.builder.bindText +import com.intellij.ui.dsl.builder.panel +import com.intellij.ui.dsl.gridLayout.HorizontalAlign +import javax.swing.JComponent + +class AddLicenseKeyDialog(project: Project?) : DialogWrapper(project) { + + var licenseKey: String = "" + private set + + init { + title = "Enterprise License Key" + init() + } + + override fun createCenterPanel(): JComponent? = + panel { + row { + textField().bindText(::licenseKey) + .horizontalAlign(HorizontalAlign.FILL) + .focused() + .validation { + if (it.text.isBlank()) + ValidationInfo("License key cannot be empty") + else + null + } + } + } +} \ No newline at end of file From 4752d7ab96f63be4c2aaf3abd64a659acf9abb18 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 14 Aug 2025 15:05:45 -0700 Subject: [PATCH 147/174] fix: Object object in profile URI (#7156) --- core/config/profile/PlatformProfileLoader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index fd622bdd1..01de0066d 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -109,7 +109,7 @@ export default class PlatformProfileLoader implements IProfileLoader { title: configResult.config?.name ?? `${ownerSlug}/${packageSlug}`, errors: configResult.errors, iconUrl: iconUrl, - uri: `${controlPlaneEnv}${ownerSlug}/${packageSlug}`, + uri: `${controlPlaneEnv.APP_URL}${ownerSlug}/${packageSlug}`, rawYaml, }; From 9b77b52caf109e32798befac0539aebfb436bb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20B=C5=82ach?= Date: Fri, 15 Aug 2025 00:10:24 +0200 Subject: [PATCH 148/174] fix: migrate FileUtils to VFS (#6866) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: migrate FileUtils to VFS I replicated the original behavior, for example, writeFile should automatically create dirs + overwrite the file (if exists), readText normalizes line endings + limits the output to 10k chars, etc. All those details should be covered by unit test. Also, I removed some usages of UriUtils because if we treat "file URIs" as URLs, we can use refreshAndFindFileByUrl. It works, but we should keep that in mind. ### Extra: Manual testing (I did it myself on top of the unit tests, but I’m posting the instructions here in case someone wants to reproduce it) * writeFile - run Continue in agentic mode and ask smth like: "create scss/test.scss" * listDir (+ getFileStats) - ask: "list files in project root" * openFile/showFile - edit a rule using the toolbar (pen icon) * fileExists - is invoked on startup multiple times * readFile - is invoked on startup multiple times (put some files into .continue/*) * fix: remove params in FileUtils * fix: read from documents if possible --- .../continue/IntelliJIde.kt | 43 ++--- .../continue/file/FileUtils.kt | 155 +++++++++++------- .../unit/FileUtilsTest.kt | 151 +++++++++++++---- 3 files changed, 232 insertions(+), 117 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt index d377cb3b1..9affb4c2d 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt @@ -47,7 +47,7 @@ class IntelliJIDE( ) : IDE { private val gitService = GitService(project, continuePluginService) - private val fileUtils = FileUtils() + private val fileUtils = FileUtils(project) private val ripgrep: String = getRipgrepPath() init { @@ -183,7 +183,9 @@ class IntelliJIDE( fileUtils.fileExists(filepath) override suspend fun writeFile(path: String, contents: String) = - fileUtils.writeFile(path, contents) + withContext(Dispatchers.EDT) { + fileUtils.writeFile(path, contents) + } override suspend fun showVirtualFile(title: String, contents: String) { val virtualFile = LightVirtualFile(title, contents) @@ -196,20 +198,8 @@ class IntelliJIDE( return getContinueGlobalPath() } - override suspend fun openFile(path: String) { - // Convert URI path to absolute file path - val filePath = UriUtils.uriToFile(path).absolutePath - // Find the file using the absolute path - val file = withContext(Dispatchers.IO) { - LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath) - } - - file?.let { - ApplicationManager.getApplication().invokeLater { - FileEditorManager.getInstance(project).openFile(it, true) - } - } - } + override suspend fun openFile(path: String) = + fileUtils.openFile(path) override suspend fun openUrl(url: String) { withContext(Dispatchers.IO) { @@ -278,18 +268,10 @@ class IntelliJIDE( } } - override suspend fun saveFile(filepath: String) { - ApplicationManager.getApplication().invokeLater { - val file = - LocalFileSystem.getInstance().findFileByPath(UriUtils.parseUri(filepath).path) ?: return@invokeLater - val fileDocumentManager = FileDocumentManager.getInstance() - val document = fileDocumentManager.getDocument(file) - - document?.let { - fileDocumentManager.saveDocument(it) - } + override suspend fun saveFile(filepath: String) = + withContext(Dispatchers.EDT) { + fileUtils.saveFile(filepath) } - } override suspend fun readFile(filepath: String): String = fileUtils.readFile(filepath) @@ -604,11 +586,8 @@ class IntelliJIDE( override suspend fun listDir(dir: String): List> = fileUtils.listDir(dir) - override suspend fun getFileStats(files: List): Map { - return files.associateWith { file -> - FileStats(UriUtils.uriToFile(file).lastModified(), UriUtils.uriToFile(file).length()) - } - } + override suspend fun getFileStats(files: List): Map = + fileUtils.getFileStats(files) override suspend fun gotoDefinition(location: Location): List { throw NotImplementedError("gotoDefinition not implemented yet") diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/file/FileUtils.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/file/FileUtils.kt index bfd60dfe2..ba351ab02 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/file/FileUtils.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/file/FileUtils.kt @@ -1,69 +1,110 @@ package com.github.continuedev.continueintellijextension.`continue`.file +import com.github.continuedev.continueintellijextension.FileStats import com.github.continuedev.continueintellijextension.FileType -import com.github.continuedev.continueintellijextension.`continue`.UriUtils -import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.application.runReadAction +import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.vfs.LocalFileSystem -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import java.io.FileInputStream -import java.nio.charset.Charset +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.TextRange +import com.intellij.openapi.vfs.VfsUtil +import com.intellij.openapi.vfs.VfsUtilCore +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.openapi.vfs.VirtualFileManager +import kotlin.math.min -class FileUtils { - // todo: use VFS (it's moved from IntellijIde) - fun fileExists(uri: String): Boolean { - val file = UriUtils.uriToFile(uri) - return file.exists() - } +class FileUtils( + private val project: Project, +) { + fun fileExists(fileUri: String): Boolean = + findFile(fileUri) != null - fun writeFile(uri: String, contents: String) { - val file = UriUtils.uriToFile(uri) - file.parentFile?.mkdirs() - file.writeText(contents) - } - - fun listDir(dir: String): List> { - val files = UriUtils.uriToFile(dir).listFiles()?.map { - listOf(it.name, if (it.isDirectory) FileType.DIRECTORY.value else FileType.FILE.value) - } ?: emptyList() - - return files - } - - fun readFile(uri: String): String { - return try { - val content = ApplicationManager.getApplication().runReadAction { - val virtualFile = LocalFileSystem.getInstance().findFileByPath(UriUtils.parseUri(uri).path) - if (virtualFile != null && FileDocumentManager.getInstance().isFileModified(virtualFile)) { - return@runReadAction FileDocumentManager.getInstance().getDocument(virtualFile)?.text - } - return@runReadAction null - } - - if (content != null) { - content - } else { - val file = UriUtils.uriToFile(uri) - if (!file.exists() || file.isDirectory) return "" - FileInputStream(file).use { fis -> - val sizeToRead = minOf(100000, file.length()).toInt() - val buffer = ByteArray(sizeToRead) - val bytesRead = fis.read(buffer, 0, sizeToRead) - if (bytesRead <= 0) return@use "" - val content = String(buffer, 0, bytesRead, Charset.forName("UTF-8")) - // Remove `\r` characters but preserve trailing newlines to prevent line count discrepancies - val contentWithoutCR = content.replace("\r\n", "\n").replace("\r", "\n") - contentWithoutCR - } - } - } catch (e: Exception) { - e.printStackTrace() - "" + fun writeFile(fileUri: String, content: String) { + val path = VfsUtilCore.urlToPath(fileUri) + val pathDirectory = VfsUtil.getParentDir(path) + ?: return + val vfsDirectory = VfsUtil.createDirectories(pathDirectory) + val pathFilename = VfsUtil.extractFileName(path) + ?: return + runWriteAction { + val newFile = vfsDirectory.createChildData(this, pathFilename) + VfsUtil.saveText(newFile, content) } - } + fun listDir(fileUri: String): List> { + val found = findFile(fileUri) + ?: return emptyList() + if (!found.isDirectory) + return emptyList() + return found.children.map { file -> + val fileType = if (file.isDirectory) + FileType.DIRECTORY.value + else + FileType.FILE.value + listOf(file.name, fileType) + } + } + fun readFile(fileUri: String, maxLength: Int = 100_000): String { + val found = findFile(fileUri) + ?: return "" + val text = runReadAction { + // note: document (if exists) is more up-to-date than VFS + readDocument(found, maxLength) ?: VfsUtil.loadText(found, maxLength) + } + return normalizeLineEndings(text) + } + + fun openFile(fileUri: String) { + val found = findFile(fileUri) + ?: return + FileEditorManager.getInstance(project).openFile(found, true) + } + + fun saveFile(fileUri: String) { + val found = findFile(fileUri) + ?: return + val manager = FileDocumentManager.getInstance() + val document = manager.getDocument(found) + ?: return + manager.saveDocument(document) + } + + fun getFileStats(fileUris: List): Map = + fileUris.mapNotNull { fileUri -> + val file = findFile(fileUri) + ?: return@mapNotNull null + fileUri to FileStats(file.timeStamp, file.length) + }.toMap() + + private fun findFile(fileUri: String): VirtualFile? { + val noParams = fileUri.substringBefore("?") + val normalizedAuthority = normalizeWindowsAuthority(noParams) + return VirtualFileManager.getInstance() + .refreshAndFindFileByUrl(normalizedAuthority) + } + + private fun readDocument(file: VirtualFile, maxLength: Int): String? { + val document = FileDocumentManager.getInstance().getDocument(file) + ?: return "" + val length = min(document.textLength, maxLength) + return document.getText(TextRange(0, length)) + } + + private fun normalizeLineEndings(text: String) = + text.replace("\r\n", "\n") + .replace("\r", "\n") + + private fun normalizeWindowsAuthority(fileUri: String): String { + val authorityPrefix = "file://" + val noAuthorityPrefix = "file:///" + if (fileUri.startsWith(authorityPrefix) && !fileUri.startsWith(noAuthorityPrefix)) { + val path = fileUri.substringAfter(authorityPrefix) + return "$noAuthorityPrefix$path" + } + return fileUri + } } \ No newline at end of file diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/FileUtilsTest.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/FileUtilsTest.kt index 3ec25afba..338cb6fda 100644 --- a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/FileUtilsTest.kt +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/FileUtilsTest.kt @@ -2,54 +2,95 @@ package com.github.continuedev.continueintellijextension.unit import com.github.continuedev.continueintellijextension.FileType import com.github.continuedev.continueintellijextension.`continue`.file.FileUtils +import com.intellij.openapi.application.runWriteAction +import com.intellij.openapi.fileEditor.FileDocumentManager +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.vfs.VfsUtil import com.intellij.testFramework.UsefulTestCase import com.intellij.testFramework.fixtures.CodeInsightTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory class FileUtilsTest : UsefulTestCase() { - val fileUtils = FileUtils() - val myFixture = setupRealFilesFixture() - val tmpFixture get() = myFixture.tempDirFixture - val tmpDir get() = myFixture.tempDirPath + private val myFixture = setupRealFilesFixture() + private lateinit var fileUtils: FileUtils + private val tmp get() = myFixture.tempDirPath - override fun setUp() = + override fun setUp() { myFixture.setUp() + fileUtils = FileUtils(myFixture.project) + } override fun tearDown() = myFixture.tearDown() fun `test fileExists`() { - val file = tmpFixture.createFile("test.txt", "") - val uri = "file://${file.path}" - assertTrue(fileUtils.fileExists(uri)) + myFixture.createTempFile("file.txt") + assertTrue(fileUtils.fileExists("file://$tmp/file.txt")) } - fun `test fileExists inside directory`() { - val file = tmpFixture.createFile("dir/dir2/file.txt", "") - val uri = "file://${file.path}" - assertTrue(fileUtils.fileExists(uri)) + fun `test fileExists with dir`() { + myFixture.createTempFile("dir/dir/file.txt") + assertTrue(fileUtils.fileExists("file://$tmp/dir/dir/file.txt")) } - fun `test fileExists fails when file doesn't exists`() { - val uri = "file:///tmp/aaaa.txt" - assertFalse(fileUtils.fileExists(uri)) + fun `test fileExists fails when file is missing`() { + assertFalse(fileUtils.fileExists("file://missing.txt")) + } + + fun `test fileExists fails when file and dir are missing`() { + assertFalse(fileUtils.fileExists("file://dir/missing.txt")) + } + + fun `test writeFile creates missing file`() { + fileUtils.writeFile("file://$tmp/file.txt", "text") + assertEquals("text", myFixture.readTempFile("file.txt")) + } + + fun `test writeFile creates missing file and missing dirs`() { + fileUtils.writeFile("file://$tmp/missing/dir/to/file.txt", "text") + assertEquals("text", myFixture.readTempFile("missing/dir/to/file.txt")) + } + + fun `test writeFile overwrites existing file`() { + myFixture.createTempFile("file.txt", "old_text") + fileUtils.writeFile("file://$tmp/overwrite.txt", "new_text") + assertEquals("new_text", myFixture.readTempFile("overwrite.txt")) } fun `test readFile`() { - val uri = "file://$tmpDir/bbbb.txt" - tmpFixture.createFile("bbbb.txt", "contents") - val text = fileUtils.readFile(uri) - assertEquals("contents", text) + myFixture.createTempFile("file.txt", "text") + assertEquals("text", fileUtils.readFile("file://$tmp/file.txt")) + } + + fun `test readFile limits the output to specified length`() { + myFixture.createTempFile("limited.txt", "text") + val text = fileUtils.readFile("file://$tmp/limited.txt", maxLength = 3) + assertEquals("tex", text) + } + + fun `test readFile inside dir`() { + myFixture.createTempFile("dir/dir/file.txt", "text") + assertEquals("text", fileUtils.readFile("file://$tmp/dir/dir/file.txt")) + } + + fun `test readFile fails when file is missing`() { + assertEmpty(fileUtils.readFile("file://missing.txt")) + } + + fun `test readFile normalizes line endings`() { + myFixture.createTempFile("file.txt", "line\r\nline\rline\nline") + val normalized = fileUtils.readFile("file://$tmp/file.txt") + assertEquals("line\nline\nline\nline", normalized) } fun `test listDir`() { - tmpFixture.createFile("a.txt", "a") - tmpFixture.createFile("b.txt", "b") - tmpFixture.createFile("c.txt", "c") - tmpFixture.createFile("dir/invisibleA.txt", "d") - tmpFixture.createFile("dir/invisibleB.txt", "e") + myFixture.createTempFile("a.txt", "a") + myFixture.createTempFile("b.txt", "b") + myFixture.createTempFile("c.txt", "c") + myFixture.createTempFile("dir/invisibleA.txt", "d") + myFixture.createTempFile("dir/invisibleB.txt", "e") - val result = fileUtils.listDir("file://$tmpDir") + val result = fileUtils.listDir("file://$tmp") assertTrue(result.any { it[0] == "a.txt" && it[1] == FileType.FILE.value }) assertTrue(result.any { it[0] == "b.txt" && it[1] == FileType.FILE.value }) @@ -61,10 +102,57 @@ class FileUtilsTest : UsefulTestCase() { assertEquals(4, result.size) } - private companion object { + fun `test listDir works with empty dir`() { + val result = fileUtils.listDir("file://$tmp") + assertEmpty(result) + } + fun `test listDir invalid usage with file instead of dir results in empty list`() { + myFixture.createTempFile("file.txt") + val invalid = fileUtils.listDir("file://$tmp/file.txt") + assertEmpty(invalid) + } + + fun `test openFile opens editor`() { + myFixture.createTempFile("file.txt", "text") + fileUtils.openFile("file://$tmp/file.txt") + val virtualFile = myFixture.tempDirFixture.getFile("file.txt")!! + assertTrue(FileEditorManager.getInstance(myFixture.project).isFileOpen(virtualFile)) + } + + fun `test openFile ignores non-existing file`() { + fileUtils.openFile("file://$tmp/invalid.txt") + } + + fun `test saveFile`() { + val manager = FileDocumentManager.getInstance() + val modified = myFixture.createTempFile("modified.txt") + val document = manager.getDocument(modified)!! + runWriteAction { + document.setText("modified content") + } + assertTrue(manager.isDocumentUnsaved(document)) + fileUtils.saveFile("file://$tmp/modified.txt") + assertFalse(manager.isDocumentUnsaved(document)) + } + + fun `test getFileStats`() { + myFixture.createTempFile("a.txt", "aa") + myFixture.createTempFile("b.txt", "bbbbb") + + val stats = fileUtils.getFileStats(listOf("file://$tmp/a.txt", "file://$tmp/b.txt")) + + assertTrue(stats.any { (fileUri, stats) -> fileUri == "file://$tmp/a.txt" && stats.size == 2L }) + assertTrue(stats.any { (fileUri, stats) -> fileUri == "file://$tmp/b.txt" && stats.size == 5L }) + } + + fun `test getFileStats ignores non-existing file`() { + assertTrue(fileUtils.getFileStats(listOf("file://invalid.txt")).isEmpty()) + } + + private companion object { // note: with this, files will actually exist inside /tmp/unitTest/ dir, otherwise it's virtual - fun setupRealFilesFixture(): CodeInsightTestFixture { + private fun setupRealFilesFixture(): CodeInsightTestFixture { val factory = IdeaTestFixtureFactory.getFixtureFactory() return factory.createCodeInsightFixture( factory.createLightFixtureBuilder("my_continue_project").fixture, @@ -72,6 +160,13 @@ class FileUtilsTest : UsefulTestCase() { ) } - } + private fun CodeInsightTestFixture.createTempFile(path: String, content: String = "") = + tempDirFixture.createFile(path, content) + private fun CodeInsightTestFixture.readTempFile(path: String): String { + val file = tempDirFixture.getFile(path)!! + VfsUtil.markDirtyAndRefresh(false, false, false, file) + return VfsUtil.loadText(file) + } + } } \ No newline at end of file From 190a1d13658f5e012e6ae61a2a354a52dfd77a97 Mon Sep 17 00:00:00 2001 From: Aditya Mitra <61635505+uinstinct@users.noreply.github.com> Date: Fri, 15 Aug 2025 03:52:12 +0530 Subject: [PATCH 149/174] fix: remove clipboard buffer action (#7117) * deprecate clipboard context provider * remove registercopybufferservice - use vscode clipboard text * remove clipboardcache from core protocol --------- Co-authored-by: Patrick Erichsen Co-authored-by: Claude --- .../providers/ClipboardContextProvider.ts | 4 ++ core/core.ts | 12 +--- extensions/vscode/src/VsCodeIde.ts | 8 +-- extensions/vscode/src/commands.ts | 55 ------------------- 4 files changed, 9 insertions(+), 70 deletions(-) diff --git a/core/context/providers/ClipboardContextProvider.ts b/core/context/providers/ClipboardContextProvider.ts index 86e64d619..0eac4e305 100644 --- a/core/context/providers/ClipboardContextProvider.ts +++ b/core/context/providers/ClipboardContextProvider.ts @@ -18,6 +18,10 @@ class ClipboardContextProvider extends BaseContextProvider { type: "submenu", }; + get deprecationMessage() { + return "The clipboard context provider is deprecated as it is not used. It will be removed in a future version."; + } + async getContextItems( query: string, extras: ContextProviderExtras, diff --git a/core/core.ts b/core/core.ts index 1a21821aa..3c05e6666 100644 --- a/core/core.ts +++ b/core/core.ts @@ -23,7 +23,6 @@ import { EditAggregator } from "./nextEdit/context/aggregateEdits"; import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile"; import { callTool } from "./tools/callTool"; import { ChatDescriber } from "./util/chatDescriber"; -import { clipboardCache } from "./util/clipboardCache"; import { compactConversation } from "./util/conversationCompaction"; import { GlobalContext } from "./util/GlobalContext"; import historyManager from "./util/history"; @@ -72,12 +71,12 @@ import { RULES_MARKDOWN_FILENAME } from "./llm/rules/constants"; import { llmStreamChat } from "./llm/streamChat"; import { BeforeAfterDiff } from "./nextEdit/context/diffFormatting"; import { processSmallEdit } from "./nextEdit/context/processSmallEdit"; +import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue"; import { NextEditProvider } from "./nextEdit/NextEditProvider"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { OnboardingModes } from "./protocol/core"; import type { IMessenger, Message } from "./protocol/messenger"; import { getUriPathBasename } from "./util/uri"; -import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue"; const hasRulesFiles = (uris: string[]): boolean => { for (const uri of uris) { @@ -484,15 +483,6 @@ export class Core { }; }); - on("clipboardCache/add", (msg) => { - const added = clipboardCache.add(uuidv4(), msg.data.content); - if (added) { - this.messenger.send("refreshSubmenuItems", { - providers: ["clipboard"], - }); - } - }); - on("llm/streamChat", (msg) => { const abortController = this.addMessageAbortController(msg.messageId); return llmStreamChat( diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index bc1f8c2da..f8773f1ff 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -262,10 +262,10 @@ class VsCodeIde implements IDE { } async getClipboardContent() { - return this.context.workspaceState.get("continue.copyBuffer", { - text: "", - copiedAt: new Date("1900-01-01").toISOString(), - }); + return { + text: await vscode.env.clipboard.readText(), + copiedAt: new Date().toISOString(), + }; } async getTerminalContents(): Promise { diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 3b247f88b..cd75d24bd 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -8,7 +8,6 @@ import { EXTENSION_NAME } from "core/control-plane/env"; import { Core } from "core/core"; import { walkDirAsync } from "core/indexing/walkDir"; import { isModelInstaller } from "core/llm"; -import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo"; import { startLocalOllama } from "core/util/ollamaHelper"; import { getConfigJsonPath, getConfigYamlPath } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; @@ -808,44 +807,6 @@ const getCommandsMap: ( }; }; -const registerCopyBufferService = ( - context: vscode.ExtensionContext, - core: Core, -) => { - const typeDisposable = vscode.commands.registerCommand( - "editor.action.clipboardCopyAction", - async (arg) => doCopy(typeDisposable), - ); - - async function doCopy(typeDisposable: any) { - typeDisposable.dispose(); // must dispose to avoid endless loops - - await vscode.commands.executeCommand("editor.action.clipboardCopyAction"); - - const clipboardText = await vscode.env.clipboard.readText(); - - if (clipboardText) { - core.invoke("clipboardCache/add", { - content: clipboardText, - }); - } - - await context.workspaceState.update("continue.copyBuffer", { - text: clipboardText, - copiedAt: new Date().toISOString(), - }); - - // re-register to continue intercepting copy commands - typeDisposable = vscode.commands.registerCommand( - "editor.action.clipboardCopyAction", - async () => doCopy(typeDisposable), - ); - context.subscriptions.push(typeDisposable); - } - - context.subscriptions.push(typeDisposable); -}; - async function installModelWithProgress( modelName: string, modelInstaller: ModelInstaller, @@ -916,20 +877,4 @@ export function registerAllCommands( vscode.commands.registerCommand(command, callback), ); } - - try { - registerCopyBufferService(context, core); - } catch (e: any) { - //Non-critical error, it needs to be intercepted and not prevent the extension from starting - console.log("Error registering CopyBufferService: ", e); - Telemetry.capture( - "vscode_extension_copy_buffer_failure", - { - stack: extractMinimalStackTraceInfo(e.stack), - message: e.message, - }, - false, - true, - ); - } } From 85994118e89ae647275887e9df25827a354f3de2 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 14 Aug 2025 16:54:21 -0700 Subject: [PATCH 150/174] feat: implement Sentry error tracking with privacy-first anonymization (#6881) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add sentry to core * feat: implement comprehensive Sentry error tracking with privacy-first anonymization - Add Sentry ErrorBoundary components following React best practices - Implement shared anonymization logic between core and GUI environments - Create organized sentry directory structure with clean exports - Add Continue team member access control (@continue.dev email check) - Preserve node_modules package names for debugging while anonymizing user paths - Include comprehensive test coverage for all anonymization scenarios - Set up source maps for readable production error stack traces - Add browser-compatible hashing without crypto module dependency πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * feat: complete Sentry integration with GUI components and tests - Add GUI TelemetryProviders with Sentry ErrorBoundary - Create shared isContinueTeamMember utilities for both core and GUI - Update all imports and dependencies for new sentry structure - Add comprehensive test coverage and fix all TypeScript issues πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * prettier * fix: resolve GUI build errors by removing sentry index.ts and using specific imports - Remove problematic index.ts that was pulling Node.js-specific Sentry code into browser bundle - Update GUI to import specifically from anonymization.ts and constants.ts files - Update core imports to use specific SentryLogger.ts import path - GUI build now succeeds with proper source map upload to Sentry πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * fix: move TelemetryProviders inside AuthProvider to fix test failures - Move TelemetryProviders from main.tsx to Layout.tsx inside AuthProvider - Fixes "useAuth must be used within an AuthProvider" error in tests - TelemetryProviders now has access to auth context for Continue team member check - GUI build and functionality remain working correctly πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * prettier * merge main * Update package.json * fix tests * fix errors * Update extension.ts * disable sentry in tests/local dev * add additional error handling * Update SentryLogger.ts * remove global try/catch * remove test code * linting * Update SentryLogger.ts * more logs * Update core.ts * lower sampling rate * fix tests * feat: use `Logger` * Update logger.ts * Update logger.ts Co-Authored-By: Claude * lint fixes Co-Authored-By: Claude * fix: rename logger.ts to Logger.ts for case sensitivity This fixes TypeScript compilation errors in CI where the file was tracked as lowercase logger.ts but referenced as Logger.ts in imports. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * address ting-wai's feedback * Update core.ts --------- Co-authored-by: Claude --- core/.gitignore | 4 +- core/config/ConfigHandler.ts | 4 +- core/config/ProfileLifecycleManager.ts | 6 + core/config/profile/doLoadConfig.ts | 19 + core/control-plane/client.ts | 20 + core/core.ts | 232 +-- core/indexing/CodebaseIndexer.ts | 9 + core/llm/index.ts | 45 + core/package-lock.json | 1328 ++++++++++++++++- core/package.json | 10 +- core/protocol/messenger/index.ts | 63 +- core/tsconfig.json | 9 +- core/util/Logger.ts | 86 ++ core/util/isContinueTeamMember.ts | 7 + core/util/logger.ts | 16 - core/util/sentry/SentryLogger.test.ts | 886 +++++++++++ core/util/sentry/SentryLogger.ts | 263 ++++ core/util/sentry/anonymization.test.ts | 174 +++ core/util/sentry/anonymization.ts | 132 ++ core/util/sentry/constants.ts | 5 + extensions/vscode/package.json | 2 +- extensions/vscode/src/extension.ts | 4 +- .../vscode/src/stubs/WorkOsAuthProvider.ts | 45 +- gui/.gitignore | 4 +- gui/package-lock.json | 643 ++++++-- gui/package.json | 6 +- gui/src/components/Layout.tsx | 77 +- gui/src/hooks/CustomPostHogProvider.tsx | 31 - gui/src/hooks/TelemetryProviders.test.tsx | 306 ++++ gui/src/hooks/TelemetryProviders.tsx | 126 ++ gui/src/main.tsx | 12 +- gui/src/pages/config/UserSettingsForm.tsx | 5 +- gui/src/util/isContinueTeamMember.ts | 7 + gui/vite.config.ts | 12 +- 34 files changed, 4201 insertions(+), 397 deletions(-) create mode 100644 core/util/Logger.ts create mode 100644 core/util/isContinueTeamMember.ts delete mode 100644 core/util/logger.ts create mode 100644 core/util/sentry/SentryLogger.test.ts create mode 100644 core/util/sentry/SentryLogger.ts create mode 100644 core/util/sentry/anonymization.test.ts create mode 100644 core/util/sentry/anonymization.ts create mode 100644 core/util/sentry/constants.ts delete mode 100644 gui/src/hooks/CustomPostHogProvider.tsx create mode 100644 gui/src/hooks/TelemetryProviders.test.tsx create mode 100644 gui/src/hooks/TelemetryProviders.tsx create mode 100644 gui/src/util/isContinueTeamMember.ts diff --git a/core/.gitignore b/core/.gitignore index b34a983de..86f55b19c 100644 --- a/core/.gitignore +++ b/core/.gitignore @@ -4,4 +4,6 @@ target npm-debug.log* .env test/.continue-test -coverage \ No newline at end of file +coverage +# Sentry Config File +.sentryclirc diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 9d977d071..db8628cde 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -18,7 +18,7 @@ import { } from "../control-plane/AuthTypes.js"; import { getControlPlaneEnv } from "../control-plane/env.js"; import { PolicySingleton } from "../control-plane/PolicySingleton.js"; -import { logger } from "../util/logger.js"; +import { Logger } from "../util/Logger.js"; import { Telemetry } from "../util/posthog.js"; import { ASSISTANTS, @@ -596,7 +596,7 @@ export class ConfigHandler { ); if (config.errors?.length) { - logger.warn("Errors loading config: ", config.errors); + Logger.error("Errors loading config: ", config.errors); } return config; } diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index e16bb7986..d4aa5b5f6 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -12,6 +12,7 @@ import { IDE, } from "../index.js"; +import { Logger } from "../util/Logger.js"; import { finalToBrowserConfig } from "./load.js"; import { IProfileLoader } from "./profile/IProfileLoader.js"; @@ -98,6 +99,11 @@ export class ProfileLifecycleManager { try { result = await this.profileLoader.doLoadConfig(); } catch (e) { + // Capture config loading system failures to Sentry + Logger.error(e, { + context: "profile_config_loading", + }); + const message = e instanceof Error ? `${e.message}\n${e.stack ? e.stack : ""}` diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index d6528454b..48da9934d 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -36,6 +36,7 @@ import { GlobalContext } from "../../util/GlobalContext"; import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths"; import { localPathOrUriToPath } from "../../util/pathToUri"; import { Telemetry } from "../../util/posthog"; +import { SentryLogger } from "../../util/sentry/SentryLogger"; import { TTS } from "../../util/tts"; import { getWorkspaceContinueRuleDotFiles } from "../getWorkspaceContinueRuleDotFiles"; import { loadContinueConfigFromJson } from "../load"; @@ -346,6 +347,24 @@ export default async function doLoadConfig(options: { ideInfo, ); + // Setup Sentry logger with same telemetry settings + // TODO: Remove Continue team member check once Sentry is ready for all users + let userEmail: string | undefined; + try { + // Access the session info to get user email for Continue team member check + const sessionInfo = await (controlPlaneClient as any).sessionInfoPromise; + userEmail = sessionInfo?.account?.id; + } catch (error) { + // Ignore errors getting session info, will default to no Sentry + } + + await SentryLogger.setup( + newConfig.allowAnonymousTelemetry ?? false, + await ide.getUniqueId(), + ideInfo, + userEmail, + ); + // TODO: pass config to pre-load non-system TTS models await TTS.setup(); diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index d5f99a274..1f049e1fd 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -12,6 +12,7 @@ import fetch, { RequestInit, Response } from "node-fetch"; import { OrganizationDescription } from "../config/ProfileLifecycleManager.js"; import { IdeInfo, IdeSettings, ModelDescription } from "../index.js"; +import { Logger } from "../util/Logger.js"; import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js"; import { getControlPlaneEnv } from "./env.js"; @@ -146,6 +147,11 @@ export class ControlPlaneClient { }); return (await resp.json()) as any; } catch (e) { + // Capture control plane API failures to Sentry + Logger.error(e, { + context: "control_plane_list_assistants", + organizationId, + }); return []; } } @@ -217,6 +223,11 @@ export class ControlPlaneClient { const { fullSlugs } = (await resp.json()) as any; return fullSlugs; } catch (e) { + // Capture control plane API failures to Sentry + Logger.error(e, { + context: "control_plane_list_assistant_slugs", + organizationId, + }); return null; } } @@ -247,6 +258,10 @@ export class ControlPlaneClient { }); return (await resp.json()) as FreeTrialStatus; } catch (e) { + // Capture control plane API failures to Sentry + Logger.error(e, { + context: "control_plane_free_trial_status", + }); return null; } } @@ -281,6 +296,11 @@ export class ControlPlaneClient { ); return (await resp.json()) as { url: string }; } catch (e) { + // Capture control plane API failures to Sentry + Logger.error(e, { + context: "control_plane_models_checkout_url", + vsCodeUriScheme, + }); return null; } } diff --git a/core/core.ts b/core/core.ts index 3c05e6666..1e5b2a74b 100644 --- a/core/core.ts +++ b/core/core.ts @@ -76,6 +76,7 @@ import { NextEditProvider } from "./nextEdit/NextEditProvider"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { OnboardingModes } from "./protocol/core"; import type { IMessenger, Message } from "./protocol/messenger"; +import { Logger } from "./util/Logger.js"; import { getUriPathBasename } from "./util/uri"; const hasRulesFiles = (uris: string[]): boolean => { @@ -131,114 +132,143 @@ export class Core { private readonly messenger: IMessenger, private readonly ide: IDE, ) { - // Ensure .continue directory is created - migrateV1DevDataFiles(); + try { + // Ensure .continue directory is created + migrateV1DevDataFiles(); - const ideInfoPromise = messenger.request("getIdeInfo", undefined); - const ideSettingsPromise = messenger.request("getIdeSettings", undefined); - const sessionInfoPromise = messenger.request("getControlPlaneSessionInfo", { - silent: true, - useOnboarding: false, - }); - - this.configHandler = new ConfigHandler( - this.ide, - ideSettingsPromise, - this.llmLogger, - sessionInfoPromise, - ); - - this.docsService = DocsService.createSingleton( - this.configHandler, - this.ide, - this.messenger, - ); - - MCPManagerSingleton.getInstance().onConnectionsRefreshed = () => { - void this.configHandler.reloadConfig("MCP Connections refreshed"); - - // Refresh @mention dropdown submenu items for MCP providers - const mcpManager = MCPManagerSingleton.getInstance(); - const mcpProviderNames = Array.from(mcpManager.connections.keys()).map( - (mcpId) => `mcp-${mcpId}`, + const ideInfoPromise = messenger.request("getIdeInfo", undefined); + const ideSettingsPromise = messenger.request("getIdeSettings", undefined); + const sessionInfoPromise = messenger.request( + "getControlPlaneSessionInfo", + { + silent: true, + useOnboarding: false, + }, ); - if (mcpProviderNames.length > 0) { - this.messenger.send("refreshSubmenuItems", { - providers: mcpProviderNames, - }); - } - }; + this.configHandler = new ConfigHandler( + this.ide, + ideSettingsPromise, + this.llmLogger, + sessionInfoPromise, + ); - this.codeBaseIndexer = new CodebaseIndexer( - this.configHandler, - this.ide, - this.messenger, - this.globalContext.get("indexingPaused"), - ); + this.docsService = DocsService.createSingleton( + this.configHandler, + this.ide, + this.messenger, + ); - this.configHandler.onConfigUpdate((result) => { - void (async () => { - const serializedResult = await this.configHandler.getSerializedConfig(); - this.messenger.send("configUpdate", { - result: serializedResult, - profileId: - this.configHandler.currentProfile?.profileDescription.id || null, - organizations: this.configHandler.getSerializedOrgs(), - selectedOrgId: this.configHandler.currentOrg?.id ?? null, - }); + MCPManagerSingleton.getInstance().onConnectionsRefreshed = () => { + void this.configHandler.reloadConfig("MCP Connections refreshed"); - // update additional submenu context providers registered via VSCode API - const additionalProviders = - this.configHandler.getAdditionalSubmenuContextProviders(); - if (additionalProviders.length > 0) { + // Refresh @mention dropdown submenu items for MCP providers + const mcpManager = MCPManagerSingleton.getInstance(); + const mcpProviderNames = Array.from(mcpManager.connections.keys()).map( + (mcpId) => `mcp-${mcpId}`, + ); + + if (mcpProviderNames.length > 0) { this.messenger.send("refreshSubmenuItems", { - providers: additionalProviders, + providers: mcpProviderNames, }); } - })(); - }); + }; - // Dev Data Logger - const dataLogger = DataLogger.getInstance(); - dataLogger.core = this; - dataLogger.ideInfoPromise = ideInfoPromise; - dataLogger.ideSettingsPromise = ideSettingsPromise; + this.configHandler.onConfigUpdate((result) => { + void (async () => { + const serializedResult = + await this.configHandler.getSerializedConfig(); + this.messenger.send("configUpdate", { + result: serializedResult, + profileId: + this.configHandler.currentProfile?.profileDescription.id || null, + organizations: this.configHandler.getSerializedOrgs(), + selectedOrgId: this.configHandler.currentOrg?.id ?? null, + }); - const getLlm = async () => { - const { config } = await this.configHandler.loadConfig(); - if (!config) { - return undefined; - } - return config.selectedModelByRole.autocomplete ?? undefined; - }; - this.completionProvider = new CompletionProvider( - this.configHandler, - ide, - getLlm, - (e) => {}, - (..._) => Promise.resolve([]), - ); - - const codebaseRulesCache = CodebaseRulesCache.getInstance(); - void codebaseRulesCache - .refresh(ide) - .catch((e) => console.error("Failed to initialize colocated rules cache")) - .then(() => { - void this.configHandler.reloadConfig( - "Initial codebase rules post-walkdir/load reload", - ); + // update additional submenu context providers registered via VSCode API + const additionalProviders = + this.configHandler.getAdditionalSubmenuContextProviders(); + if (additionalProviders.length > 0) { + this.messenger.send("refreshSubmenuItems", { + providers: additionalProviders, + }); + } + })(); }); - this.nextEditProvider = NextEditProvider.initialize( - this.configHandler, - ide, - getLlm, - (e) => {}, - (..._) => Promise.resolve([]), - "fineTuned", - ); - this.registerMessageHandlers(ideSettingsPromise); + this.codeBaseIndexer = new CodebaseIndexer( + this.configHandler, + this.ide, + this.messenger, + this.globalContext.get("indexingPaused"), + ); + + // Dev Data Logger + const dataLogger = DataLogger.getInstance(); + dataLogger.core = this; + dataLogger.ideInfoPromise = ideInfoPromise; + dataLogger.ideSettingsPromise = ideSettingsPromise; + + void ideSettingsPromise.then((ideSettings) => { + // Index on initialization + void this.ide.getWorkspaceDirs().then(async (dirs) => { + // Respect pauseCodebaseIndexOnStart user settings + if (ideSettings.pauseCodebaseIndexOnStart) { + this.codeBaseIndexer.paused = true; + void this.messenger.request("indexProgress", { + progress: 0, + desc: "Initial Indexing Skipped", + status: "paused", + }); + return; + } + + void this.codeBaseIndexer.refreshCodebaseIndex(dirs); + }); + }); + + const getLlm = async () => { + const { config } = await this.configHandler.loadConfig(); + if (!config) { + return undefined; + } + return config.selectedModelByRole.autocomplete ?? undefined; + }; + this.completionProvider = new CompletionProvider( + this.configHandler, + ide, + getLlm, + (e) => {}, + (..._) => Promise.resolve([]), + ); + + const codebaseRulesCache = CodebaseRulesCache.getInstance(); + void codebaseRulesCache + .refresh(ide) + .catch((e) => + Logger.error("Failed to initialize colocated rules cache"), + ) + .then(() => { + void this.configHandler.reloadConfig( + "Initial codebase rules post-walkdir/load reload", + ); + }); + this.nextEditProvider = NextEditProvider.initialize( + this.configHandler, + ide, + getLlm, + (e) => {}, + (..._) => Promise.resolve([]), + "fineTuned", + ); + + this.registerMessageHandlers(ideSettingsPromise); + } catch (error) { + Logger.error(error); + throw error; // Re-throw to prevent partially initialized core + } } /* eslint-disable max-lines-per-function */ @@ -461,7 +491,7 @@ export class Core { }); return items || []; } catch (e) { - console.error(e); + Logger.error(e); return []; } }); @@ -559,7 +589,7 @@ export class Core { }); return undefined; } catch (error) { - console.error("Error compacting conversation:", error); + Logger.error(`Error compacting conversation: ${error}`); return undefined; } }); @@ -829,7 +859,7 @@ export class Core { prevFilepaths.filepaths = filepaths; } } catch (e) { - console.error( + Logger.error( `didChangeVisibleTextEditors: failed to update openedFilesLruCache`, ); } @@ -854,7 +884,7 @@ export class Core { openedFilesLruCache.set(filepath, filepath); } } catch (e) { - console.error( + Logger.error( `files/opened: failed to update openedFiles cache for ${filepath}`, ); } @@ -1134,7 +1164,7 @@ export class Core { void this.configHandler.reloadConfig("Codebase rule update"); }); } catch (e) { - console.error("Failed to update codebase rule", e); + Logger.error(`Failed to update codebase rule: ${e}`); } } else if ( uri.endsWith(".continueignore") || @@ -1211,7 +1241,7 @@ export class Core { break; default: - console.error(`Invalid mode: ${mode}`); + Logger.error(`Invalid mode: ${mode}`); editConfigYamlCallback = (config) => config; } diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 54e84bf17..3b6c22599 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -10,6 +10,7 @@ import { import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; import type { IMessenger } from "../protocol/messenger"; import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js"; +import { Logger } from "../util/Logger.js"; import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js"; import { Telemetry } from "../util/posthog.js"; import { findUriInDirs, getUriPathBasename } from "../util/uri.js"; @@ -126,12 +127,20 @@ export class CodebaseIndexer { try { await fs.unlink(sqliteFilepath); } catch (error) { + // Capture indexer system failures to Sentry + Logger.error(error, { + filepath: sqliteFilepath, + }); console.error(`Error deleting ${sqliteFilepath} folder: ${error}`); } try { await fs.rm(lanceDbFolder, { recursive: true, force: true }); } catch (error) { + // Capture indexer system failures to Sentry + Logger.error(error, { + folderPath: lanceDbFolder, + }); console.error(`Error deleting ${lanceDbFolder}: ${error}`); } } diff --git a/core/llm/index.ts b/core/llm/index.ts index a8c4fafc6..edbfecbdb 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -9,6 +9,7 @@ import { import Handlebars from "handlebars"; import { DevDataSqliteDb } from "../data/devdataSqlite.js"; +import { Logger } from "../util/Logger.js"; import { DataLogger } from "../data/log.js"; import { CacheBehavior, @@ -471,6 +472,15 @@ export abstract class BaseLLM implements ILLM { return resp; } catch (e: any) { + // Capture all fetch errors to Sentry for monitoring + Logger.error(e, { + context: "llm_fetch", + url: String(input), + method: init?.method || "GET", + model: this.model, + provider: this.providerName, + }); + // Errors to ignore if (e.message.includes("/api/tags")) { throw new Error(`Error fetching tags: ${e.message}`); @@ -635,6 +645,14 @@ export abstract class BaseLLM implements ILLM { undefined, ); } catch (e) { + // Capture FIM (Fill-in-the-Middle) completion failures to Sentry + Logger.error(e as Error, { + context: "llm_stream_fim", + model: completionOptions.model, + provider: this.providerName, + useOpenAIAdapter: this.shouldUseOpenAIAdapter("streamFim"), + }); + status = this._logEnd( completionOptions.model, fimLog, @@ -753,6 +771,15 @@ export abstract class BaseLLM implements ILLM { undefined, ); } catch (e) { + // Capture streaming completion failures to Sentry + Logger.error(e as Error, { + context: "llm_stream_complete", + model: completionOptions.model, + provider: this.providerName, + useOpenAIAdapter: this.shouldUseOpenAIAdapter("streamComplete"), + streamEnabled: completionOptions.stream !== false, + }); + status = this._logEnd( completionOptions.model, prompt, @@ -851,6 +878,14 @@ export abstract class BaseLLM implements ILLM { undefined, ); } catch (e) { + // Capture completion failures to Sentry + Logger.error(e as Error, { + context: "llm_complete", + model: completionOptions.model, + provider: this.providerName, + useOpenAIAdapter: this.shouldUseOpenAIAdapter("complete"), + }); + status = this._logEnd( completionOptions.model, prompt, @@ -1060,6 +1095,16 @@ export abstract class BaseLLM implements ILLM { usage, ); } catch (e) { + // Capture chat streaming failures to Sentry + Logger.error(e as Error, { + context: "llm_stream_chat", + model: completionOptions.model, + provider: this.providerName, + useOpenAIAdapter: this.shouldUseOpenAIAdapter("streamChat"), + streamEnabled: completionOptions.stream !== false, + templateMessages: !!this.templateMessages, + }); + status = this._logEnd( completionOptions.model, prompt, diff --git a/core/package-lock.json b/core/package-lock.json index bb018d8f9..cf77facb0 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -20,6 +20,11 @@ "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", + "@sentry/cli": "^2.50.2", + "@sentry/core": "^9.43.0", + "@sentry/esbuild-plugin": "^4.0.2", + "@sentry/node": "^9.43.0", + "@sentry/vite-plugin": "^4.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -255,7 +260,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" @@ -1271,7 +1275,6 @@ "version": "7.26.3", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -1280,7 +1283,6 @@ "version": "7.26.0", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", - "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.0", @@ -1310,7 +1312,6 @@ "version": "7.26.3", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", - "dev": true, "dependencies": { "@babel/parser": "^7.26.3", "@babel/types": "^7.26.3", @@ -1338,7 +1339,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", - "dev": true, "dependencies": { "@babel/compat-data": "^7.25.9", "@babel/helper-validator-option": "^7.25.9", @@ -1354,7 +1354,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, "dependencies": { "yallist": "^3.0.2" } @@ -1362,8 +1361,7 @@ "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/@babel/helper-create-class-features-plugin": { "version": "7.25.9", @@ -1436,7 +1434,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", - "dev": true, "dependencies": { "@babel/traverse": "^7.25.9", "@babel/types": "^7.25.9" @@ -1449,7 +1446,6 @@ "version": "7.26.0", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", - "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9", @@ -1534,7 +1530,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -1551,7 +1546,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -1574,7 +1568,6 @@ "version": "7.26.0", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", - "dev": true, "dependencies": { "@babel/template": "^7.25.9", "@babel/types": "^7.26.0" @@ -1587,7 +1580,6 @@ "version": "7.26.3", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", - "dev": true, "dependencies": { "@babel/types": "^7.26.3" }, @@ -2842,7 +2834,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", - "dev": true, "dependencies": { "@babel/code-frame": "^7.25.9", "@babel/parser": "^7.25.9", @@ -2856,7 +2847,6 @@ "version": "7.26.4", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", - "dev": true, "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/generator": "^7.26.3", @@ -2874,7 +2864,6 @@ "version": "7.26.3", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", - "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" @@ -4079,7 +4068,6 @@ "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -4093,7 +4081,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, "engines": { "node": ">=6.0.0" } @@ -4102,7 +4089,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, "engines": { "node": ">=6.0.0" } @@ -4110,14 +4096,12 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -4401,6 +4385,633 @@ "@octokit/openapi-types": "^24.2.0" } }, + "node_modules/@opentelemetry/api": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@opentelemetry/api-logs": { + "version": "0.57.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.57.2.tgz", + "integrity": "sha512-uIX52NnTM0iBh84MShlpouI7UKqkZ7MrUszTmaypHBu4r7NofznSnQRfJ+uUeDtQDj6w8eFGg5KBLDAwAPz1+A==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api": "^1.3.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/context-async-hooks": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.30.1.tgz", + "integrity": "sha512-s5vvxXPVdjqS3kTLKMeBMvop9hbWkwzBpu+mUO2M7sZtlkyDJGwFe33wRKnbaYDo8ExRVBIIdwIGrqpxHuKttA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/core": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.30.1.tgz", + "integrity": "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/core/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", + "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/instrumentation": { + "version": "0.57.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.57.2.tgz", + "integrity": "sha512-BdBGhQBh8IjZ2oIIX6F2/Q3LKm/FDDKi6ccYKcBTeilh6SNdNKveDOLk73BkSJjQLJk6qe4Yh+hHw1UPhCDdrg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api-logs": "0.57.2", + "@types/shimmer": "^1.2.0", + "import-in-the-middle": "^1.8.1", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2", + "shimmer": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-amqplib": { + "version": "0.46.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-amqplib/-/instrumentation-amqplib-0.46.1.tgz", + "integrity": "sha512-AyXVnlCf/xV3K/rNumzKxZqsULyITJH6OVLiW6730JPRqWA7Zc9bvYoVNpN6iOpTU8CasH34SU/ksVJmObFibQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-connect": { + "version": "0.43.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-connect/-/instrumentation-connect-0.43.1.tgz", + "integrity": "sha512-ht7YGWQuV5BopMcw5Q2hXn3I8eG8TH0J/kc/GMcW4CuNTgiP6wCu44BOnucJWL3CmFWaRHI//vWyAhaC8BwePw==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0", + "@types/connect": "3.4.38" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-dataloader": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-dataloader/-/instrumentation-dataloader-0.16.1.tgz", + "integrity": "sha512-K/qU4CjnzOpNkkKO4DfCLSQshejRNAJtd4esgigo/50nxCB6XCyi1dhAblUHM9jG5dRm8eu0FB+t87nIo99LYQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-express": { + "version": "0.47.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-express/-/instrumentation-express-0.47.1.tgz", + "integrity": "sha512-QNXPTWteDclR2B4pDFpz0TNghgB33UMjUt14B+BZPmtH1MwUFAfLHBaP5If0Z5NZC+jaH8oF2glgYjrmhZWmSw==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-fs": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-fs/-/instrumentation-fs-0.19.1.tgz", + "integrity": "sha512-6g0FhB3B9UobAR60BGTcXg4IHZ6aaYJzp0Ki5FhnxyAPt8Ns+9SSvgcrnsN2eGmk3RWG5vYycUGOEApycQL24A==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-generic-pool": { + "version": "0.43.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-generic-pool/-/instrumentation-generic-pool-0.43.1.tgz", + "integrity": "sha512-M6qGYsp1cURtvVLGDrPPZemMFEbuMmCXgQYTReC/IbimV5sGrLBjB+/hANUpRZjX67nGLdKSVLZuQQAiNz+sww==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-graphql": { + "version": "0.47.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-graphql/-/instrumentation-graphql-0.47.1.tgz", + "integrity": "sha512-EGQRWMGqwiuVma8ZLAZnExQ7sBvbOx0N/AE/nlafISPs8S+QtXX+Viy6dcQwVWwYHQPAcuY3bFt3xgoAwb4ZNQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-hapi": { + "version": "0.45.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-hapi/-/instrumentation-hapi-0.45.2.tgz", + "integrity": "sha512-7Ehow/7Wp3aoyCrZwQpU7a2CnoMq0XhIcioFuKjBb0PLYfBfmTsFTUyatlHu0fRxhwcRsSQRTvEhmZu8CppBpQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-http": { + "version": "0.57.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-http/-/instrumentation-http-0.57.2.tgz", + "integrity": "sha512-1Uz5iJ9ZAlFOiPuwYg29Bf7bJJc/GeoeJIFKJYQf67nTVKFe8RHbEtxgkOmK4UGZNHKXcpW4P8cWBYzBn1USpg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1", + "@opentelemetry/instrumentation": "0.57.2", + "@opentelemetry/semantic-conventions": "1.28.0", + "forwarded-parse": "2.1.2", + "semver": "^7.5.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-http/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", + "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/instrumentation-http/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@opentelemetry/instrumentation-ioredis": { + "version": "0.47.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-ioredis/-/instrumentation-ioredis-0.47.1.tgz", + "integrity": "sha512-OtFGSN+kgk/aoKgdkKQnBsQFDiG8WdCxu+UrHr0bXScdAmtSzLSraLo7wFIb25RVHfRWvzI5kZomqJYEg/l1iA==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/redis-common": "^0.36.2", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-kafkajs": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-kafkajs/-/instrumentation-kafkajs-0.7.1.tgz", + "integrity": "sha512-OtjaKs8H7oysfErajdYr1yuWSjMAectT7Dwr+axIoZqT9lmEOkD/H/3rgAs8h/NIuEi2imSXD+vL4MZtOuJfqQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-knex": { + "version": "0.44.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-knex/-/instrumentation-knex-0.44.1.tgz", + "integrity": "sha512-U4dQxkNhvPexffjEmGwCq68FuftFK15JgUF05y/HlK3M6W/G2iEaACIfXdSnwVNe9Qh0sPfw8LbOPxrWzGWGMQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-koa": { + "version": "0.47.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-koa/-/instrumentation-koa-0.47.1.tgz", + "integrity": "sha512-l/c+Z9F86cOiPJUllUCt09v+kICKvT+Vg1vOAJHtHPsJIzurGayucfCMq2acd/A/yxeNWunl9d9eqZ0G+XiI6A==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-lru-memoizer": { + "version": "0.44.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-lru-memoizer/-/instrumentation-lru-memoizer-0.44.1.tgz", + "integrity": "sha512-5MPkYCvG2yw7WONEjYj5lr5JFehTobW7wX+ZUFy81oF2lr9IPfZk9qO+FTaM0bGEiymwfLwKe6jE15nHn1nmHg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-mongodb": { + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-mongodb/-/instrumentation-mongodb-0.52.0.tgz", + "integrity": "sha512-1xmAqOtRUQGR7QfJFfGV/M2kC7wmI2WgZdpru8hJl3S0r4hW0n3OQpEHlSGXJAaNFyvT+ilnwkT+g5L4ljHR6g==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-mongoose": { + "version": "0.46.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-mongoose/-/instrumentation-mongoose-0.46.1.tgz", + "integrity": "sha512-3kINtW1LUTPkiXFRSSBmva1SXzS/72we/jL22N+BnF3DFcoewkdkHPYOIdAAk9gSicJ4d5Ojtt1/HeibEc5OQg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-mysql": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-mysql/-/instrumentation-mysql-0.45.1.tgz", + "integrity": "sha512-TKp4hQ8iKQsY7vnp/j0yJJ4ZsP109Ht6l4RHTj0lNEG1TfgTrIH5vJMbgmoYXWzNHAqBH2e7fncN12p3BP8LFg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0", + "@types/mysql": "2.15.26" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-mysql2": { + "version": "0.45.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-mysql2/-/instrumentation-mysql2-0.45.2.tgz", + "integrity": "sha512-h6Ad60FjCYdJZ5DTz1Lk2VmQsShiViKe0G7sYikb0GHI0NVvApp2XQNRHNjEMz87roFttGPLHOYVPlfy+yVIhQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0", + "@opentelemetry/sql-common": "^0.40.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-pg": { + "version": "0.51.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-pg/-/instrumentation-pg-0.51.1.tgz", + "integrity": "sha512-QxgjSrxyWZc7Vk+qGSfsejPVFL1AgAJdSBMYZdDUbwg730D09ub3PXScB9d04vIqPriZ+0dqzjmQx0yWKiCi2Q==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.26.0", + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0", + "@opentelemetry/sql-common": "^0.40.1", + "@types/pg": "8.6.1", + "@types/pg-pool": "2.0.6" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-pg/node_modules/@types/pg": { + "version": "8.6.1", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.6.1.tgz", + "integrity": "sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "pg-protocol": "*", + "pg-types": "^2.2.0" + } + }, + "node_modules/@opentelemetry/instrumentation-pg/node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@opentelemetry/instrumentation-pg/node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@opentelemetry/instrumentation-pg/node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@opentelemetry/instrumentation-pg/node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@opentelemetry/instrumentation-pg/node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@opentelemetry/instrumentation-redis-4": { + "version": "0.46.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-redis-4/-/instrumentation-redis-4-0.46.1.tgz", + "integrity": "sha512-UMqleEoabYMsWoTkqyt9WAzXwZ4BlFZHO40wr3d5ZvtjKCHlD4YXLm+6OLCeIi/HkX7EXvQaz8gtAwkwwSEvcQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/redis-common": "^0.36.2", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-tedious": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-tedious/-/instrumentation-tedious-0.18.1.tgz", + "integrity": "sha512-5Cuy/nj0HBaH+ZJ4leuD7RjgvA844aY2WW+B5uLcWtxGjRZl3MNLuxnNg5DYWZNPO+NafSSnra0q49KWAHsKBg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.57.1", + "@opentelemetry/semantic-conventions": "^1.27.0", + "@types/tedious": "^4.0.14" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/instrumentation-undici": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation-undici/-/instrumentation-undici-0.10.1.tgz", + "integrity": "sha512-rkOGikPEyRpMCmNu9AQuV5dtRlDmJp2dK5sw8roVshAGoB6hH/3QjDtRhdwd75SsJwgynWUNRUYe0wAkTo16tQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.57.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.7.0" + } + }, + "node_modules/@opentelemetry/instrumentation/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@opentelemetry/redis-common": { + "version": "0.36.2", + "resolved": "https://registry.npmjs.org/@opentelemetry/redis-common/-/redis-common-0.36.2.tgz", + "integrity": "sha512-faYX1N0gpLhej/6nyp6bgRjzAKXn5GOEMYY7YhciSfCoITAktLUtQ36d24QEWNA1/WA1y6qQunCe0OhHRkVl9g==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/resources": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.30.1.tgz", + "integrity": "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1", + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/resources/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", + "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", + "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.30.1", + "@opentelemetry/resources": "1.30.1", + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", + "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/semantic-conventions": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.36.0.tgz", + "integrity": "sha512-TtxJSRD8Ohxp6bKkhrm27JRHAxPczQA7idtcTOMYI+wQRRrfgqxHv1cFbCApcSnNjtXkmzFozn6jQtFrOmbjPQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/sql-common": { + "version": "0.40.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sql-common/-/sql-common-0.40.1.tgz", + "integrity": "sha512-nSDlnHSqzC3pXn/wZEZVLuAuJ1MYMXPBwtv2qAbCa3847SaHItdE7SzUq/Jtb0KZmh1zfAbNi3AAMjztTT4Ugg==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^1.1.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -4410,6 +5021,18 @@ "node": ">=14" } }, + "node_modules/@prisma/instrumentation": { + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/@prisma/instrumentation/-/instrumentation-6.11.1.tgz", + "integrity": "sha512-mrZOev24EDhnefmnZX7WVVT7v+r9LttPRqf54ONvj6re4XMF7wFTpK2tLJi4XHB7fFp/6xhYbgRel8YV7gQiyA==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.8" + } + }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -4782,6 +5405,435 @@ "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", "peer": true }, + "node_modules/@sentry/babel-plugin-component-annotate": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-4.0.2.tgz", + "integrity": "sha512-Nr/VamvpQs6w642EI5t+qaCUGnVEro0qqk+S8XO1gc8qSdpc8kkZJFnUk7ozAr+ljYWGfVgWXrxI9lLiriLsRA==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/bundler-plugin-core": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/bundler-plugin-core/-/bundler-plugin-core-4.0.2.tgz", + "integrity": "sha512-LeARs8qHhEw19tk+KZd9DDV+Rh/UeapIH0+C09fTmff9p8Y82Cj89pEQ2a1rdUiF/oYIjQX45vnZscB7ra42yw==", + "license": "MIT", + "dependencies": { + "@babel/core": "^7.18.5", + "@sentry/babel-plugin-component-annotate": "4.0.2", + "@sentry/cli": "^2.49.0", + "dotenv": "^16.3.1", + "find-up": "^5.0.0", + "glob": "^9.3.2", + "magic-string": "0.30.8", + "unplugin": "1.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/glob": { + "version": "9.3.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz", + "integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "minimatch": "^8.0.2", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/magic-string": { + "version": "0.30.8", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", + "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/minimatch": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz", + "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@sentry/cli": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.50.2.tgz", + "integrity": "sha512-m1L9shxutF3WHSyNld6Y1vMPoXfEyQhoRh1V3SYSdl+4AB40U+zr2sRzFa2OPm7XP4zYNaWuuuHLkY/iHITs8Q==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.7", + "progress": "^2.0.3", + "proxy-from-env": "^1.1.0", + "which": "^2.0.2" + }, + "bin": { + "sentry-cli": "bin/sentry-cli" + }, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@sentry/cli-darwin": "2.50.2", + "@sentry/cli-linux-arm": "2.50.2", + "@sentry/cli-linux-arm64": "2.50.2", + "@sentry/cli-linux-i686": "2.50.2", + "@sentry/cli-linux-x64": "2.50.2", + "@sentry/cli-win32-arm64": "2.50.2", + "@sentry/cli-win32-i686": "2.50.2", + "@sentry/cli-win32-x64": "2.50.2" + } + }, + "node_modules/@sentry/cli-darwin": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.50.2.tgz", + "integrity": "sha512-0Pjpl0vQqKhwuZm19z6AlEF+ds3fJg1KWabv8WzGaSc/fwxMEwjFwOZj+IxWBJPV578cXXNvB39vYjjpCH8j7A==", + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.50.2.tgz", + "integrity": "sha512-jzFwg9AeeuFAFtoCcyaDEPG05TU02uOy1nAX09c1g7FtsyQlPcbhI94JQGmnPzdRjjDmORtwIUiVZQrVTkDM7w==", + "cpu": [ + "arm" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.50.2.tgz", + "integrity": "sha512-03Cj215M3IdoHAwevCxm5oOm9WICFpuLR05DQnODFCeIUsGvE1pZsc+Gm0Ky/ZArq2PlShBJTpbHvXbCUka+0w==", + "cpu": [ + "arm64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-i686": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.50.2.tgz", + "integrity": "sha512-J+POvB34uVyHbIYF++Bc/OCLw+gqKW0H/y/mY7rRZCiocgpk266M4NtsOBl6bEaurMx1D+BCIEjr4nc01I/rqA==", + "cpu": [ + "x86", + "ia32" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-x64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.50.2.tgz", + "integrity": "sha512-81yQVRLj8rnuHoYcrM7QbOw8ubA3weiMdPtTxTim1s6WExmPgnPTKxLCr9xzxGJxFdYo3xIOhtf5JFpUX/3j4A==", + "cpu": [ + "x64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-arm64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.50.2.tgz", + "integrity": "sha512-QjentLGvpibgiZlmlV9ifZyxV73lnGH6pFZWU5wLeRiaYKxWtNrrHpVs+HiWlRhkwQ0mG1/S40PGNgJ20DJ3gA==", + "cpu": [ + "arm64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-i686": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.50.2.tgz", + "integrity": "sha512-UkBIIzkQkQ1UkjQX8kHm/+e7IxnEhK6CdgSjFyNlxkwALjDWHJjMztevqAPz3kv4LdM6q1MxpQ/mOqXICNhEGg==", + "cpu": [ + "x86", + "ia32" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-x64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.50.2.tgz", + "integrity": "sha512-tE27pu1sRRub1Jpmemykv3QHddBcyUk39Fsvv+n4NDpQyMgsyVPcboxBZyby44F0jkpI/q3bUH2tfCB1TYDNLg==", + "cpu": [ + "x64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/@sentry/cli/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@sentry/cli/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/@sentry/cli/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/@sentry/cli/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/@sentry/cli/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/@sentry/core": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-9.43.0.tgz", + "integrity": "sha512-xuvERSUkSNBAldIlgihX3fz+JkcaAPvg0HulPtv3BH9qrKqvataeQ8TiTnqiRC7kWzF7EcxhQJ6WJRl/r3aH3w==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry/esbuild-plugin": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/esbuild-plugin/-/esbuild-plugin-4.0.2.tgz", + "integrity": "sha512-1N/zhilFT25+8JEYZnEnFDdCCL9jjgOzrMMx/+2SwVHUvXENIwa/GB5kGSy2DC/ueVxSuLdVKp8Eezszt+f40g==", + "license": "MIT", + "dependencies": { + "@sentry/bundler-plugin-core": "4.0.2", + "unplugin": "1.0.1", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/node": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-9.43.0.tgz", + "integrity": "sha512-cARRKL8QIeO8Rt80sXkpdYCD1wiV52iVk3pQp7fYMg7+T6xjmUArrYtORrgYFqNOc5jNfm9jo9ZZTjjKD8fP1A==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/context-async-hooks": "^1.30.1", + "@opentelemetry/core": "^1.30.1", + "@opentelemetry/instrumentation": "^0.57.2", + "@opentelemetry/instrumentation-amqplib": "^0.46.1", + "@opentelemetry/instrumentation-connect": "0.43.1", + "@opentelemetry/instrumentation-dataloader": "0.16.1", + "@opentelemetry/instrumentation-express": "0.47.1", + "@opentelemetry/instrumentation-fs": "0.19.1", + "@opentelemetry/instrumentation-generic-pool": "0.43.1", + "@opentelemetry/instrumentation-graphql": "0.47.1", + "@opentelemetry/instrumentation-hapi": "0.45.2", + "@opentelemetry/instrumentation-http": "0.57.2", + "@opentelemetry/instrumentation-ioredis": "0.47.1", + "@opentelemetry/instrumentation-kafkajs": "0.7.1", + "@opentelemetry/instrumentation-knex": "0.44.1", + "@opentelemetry/instrumentation-koa": "0.47.1", + "@opentelemetry/instrumentation-lru-memoizer": "0.44.1", + "@opentelemetry/instrumentation-mongodb": "0.52.0", + "@opentelemetry/instrumentation-mongoose": "0.46.1", + "@opentelemetry/instrumentation-mysql": "0.45.1", + "@opentelemetry/instrumentation-mysql2": "0.45.2", + "@opentelemetry/instrumentation-pg": "0.51.1", + "@opentelemetry/instrumentation-redis-4": "0.46.1", + "@opentelemetry/instrumentation-tedious": "0.18.1", + "@opentelemetry/instrumentation-undici": "0.10.1", + "@opentelemetry/resources": "^1.30.1", + "@opentelemetry/sdk-trace-base": "^1.30.1", + "@opentelemetry/semantic-conventions": "^1.34.0", + "@prisma/instrumentation": "6.11.1", + "@sentry/core": "9.43.0", + "@sentry/node-core": "9.43.0", + "@sentry/opentelemetry": "9.43.0", + "import-in-the-middle": "^1.14.2", + "minimatch": "^9.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry/node-core": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/node-core/-/node-core-9.43.0.tgz", + "integrity": "sha512-d8FuVwVPAFpSTIdAsENWk5adq1Etw14/r6clFIwa7G4zZ1ddu9lX1s9/dmrmgeT84Tm2nRlx+HOqrQ4IRPnJxw==", + "license": "MIT", + "dependencies": { + "@sentry/core": "9.43.0", + "@sentry/opentelemetry": "9.43.0", + "import-in-the-middle": "^1.14.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/context-async-hooks": "^1.30.1 || ^2.0.0", + "@opentelemetry/core": "^1.30.1 || ^2.0.0", + "@opentelemetry/instrumentation": ">=0.57.1 <1", + "@opentelemetry/resources": "^1.30.1 || ^2.0.0", + "@opentelemetry/sdk-trace-base": "^1.30.1 || ^2.0.0", + "@opentelemetry/semantic-conventions": "^1.34.0" + } + }, + "node_modules/@sentry/opentelemetry": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/opentelemetry/-/opentelemetry-9.43.0.tgz", + "integrity": "sha512-qVBedlEsMrZeBCAmWipBeB0usBNlGTHD/BJ4m6FfjAqeTD6QrpmIdPa9j6WSP74enB7Ok+juszFILvg6Z93kNg==", + "license": "MIT", + "dependencies": { + "@sentry/core": "9.43.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/context-async-hooks": "^1.30.1 || ^2.0.0", + "@opentelemetry/core": "^1.30.1 || ^2.0.0", + "@opentelemetry/sdk-trace-base": "^1.30.1 || ^2.0.0", + "@opentelemetry/semantic-conventions": "^1.34.0" + } + }, + "node_modules/@sentry/vite-plugin": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/vite-plugin/-/vite-plugin-4.0.2.tgz", + "integrity": "sha512-rStdvDGj0VcJBsl2NANE3OQF5m13VCJ+2Ovs5pb2LAqOW72/1GLmef9Mo3b9BwzCjWOQIcgtllwOfSV5Pse03w==", + "license": "MIT", + "dependencies": { + "@sentry/bundler-plugin-core": "4.0.2", + "unplugin": "1.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/@shikijs/colorized-brackets": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/@shikijs/colorized-brackets/-/colorized-brackets-3.7.0.tgz", @@ -5575,6 +6627,15 @@ "integrity": "sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==", "peer": true }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/diff": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@types/diff/-/diff-7.0.1.tgz", @@ -5710,6 +6771,15 @@ "integrity": "sha512-PLwiVvTBg59tGFL/8VpcGvqOu3L4OuveNvPi0EYbWchRdEVP++yRUXJPFl+CApKEq13017/4Nf7aQ5lTtHUNsA==", "dev": true }, + "node_modules/@types/mysql": { + "version": "2.15.26", + "resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.26.tgz", + "integrity": "sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/node": { "version": "20.3.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz", @@ -5743,13 +6813,21 @@ "version": "8.11.10", "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.10.tgz", "integrity": "sha512-LczQUW4dbOQzsH2RQ5qoeJ6qJPdrcM/DcMLoqWQkMLMsq83J5lAX3LXjdkWdpscFy67JSOWDnh7Ny/sPFykmkg==", - "dev": true, "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" } }, + "node_modules/@types/pg-pool": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/pg-pool/-/pg-pool-2.0.6.tgz", + "integrity": "sha512-TaAUE5rq2VQYxab5Ts7WZhKNmuN78Q6PiFonTDdpbx8a1H0M1vhy3rhiMjl+e2iHmogyMw7jZF4FrE6eJUy5HQ==", + "license": "MIT", + "dependencies": { + "@types/pg": "*" + } + }, "node_modules/@types/plist": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz", @@ -5801,6 +6879,12 @@ "node": ">= 0.12" } }, + "node_modules/@types/shimmer": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.2.0.tgz", + "integrity": "sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==", + "license": "MIT" + }, "node_modules/@types/sizzle": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.9.tgz", @@ -5823,6 +6907,15 @@ "minipass": "^4.0.0" } }, + "node_modules/@types/tedious": { + "version": "4.0.14", + "resolved": "https://registry.npmjs.org/@types/tedious/-/tedious-4.0.14.tgz", + "integrity": "sha512-KHPsfX/FoVbUGbyYvk1q9MMQHLPeRZhRJZdO45Q4YjvFkv4hMNghCWTvy7rdKessBsmtz4euWCWAB6/tVpI1Iw==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/tough-cookie": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", @@ -6297,6 +7390,15 @@ "acorn-walk": "^8.0.2" } }, + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^8" + } + }, "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -6413,7 +7515,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -6998,6 +8099,18 @@ "node": "*" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", @@ -7084,7 +8197,6 @@ "version": "4.24.2", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", - "dev": true, "funding": [ { "type": "opencollective", @@ -7337,7 +8449,6 @@ "version": "1.0.30001687", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", - "dev": true, "funding": [ { "type": "opencollective", @@ -7497,6 +8608,42 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -7544,8 +8691,7 @@ "node_modules/cjs-module-lexer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", - "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", - "dev": true + "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==" }, "node_modules/clean-stack": { "version": "2.2.0", @@ -7791,8 +8937,7 @@ "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, "node_modules/cookie": { "version": "0.7.2", @@ -8450,8 +9595,7 @@ "node_modules/electron-to-chromium": { "version": "1.5.72", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.72.tgz", - "integrity": "sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==", - "dev": true + "integrity": "sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==" }, "node_modules/emittery": { "version": "0.13.1", @@ -10143,6 +11287,12 @@ "node": ">= 0.6" } }, + "node_modules/forwarded-parse": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/forwarded-parse/-/forwarded-parse-2.1.2.tgz", + "integrity": "sha512-alTFZZQDKMporBH77856pXgzhEzaUVmLCDk+egLgIgHst3Tpndzz8MnKe+GzRJRfvVdn69HhpW7cmXzvtLvJAw==", + "license": "MIT" + }, "node_modules/fresh": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", @@ -10187,7 +11337,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -10339,7 +11488,6 @@ "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -10515,7 +11663,6 @@ "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, "engines": { "node": ">=4" } @@ -11030,6 +12177,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/import-in-the-middle": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.14.2.tgz", + "integrity": "sha512-5tCuY9BV8ujfOpwtAGgsTx9CGUapcFMEEyByLv1B+v2+6DhAcw+Zr0nhQT7uwaZ7DiourxFEscghOR8e1aPLQw==", + "license": "Apache-2.0", + "dependencies": { + "acorn": "^8.14.0", + "acorn-import-attributes": "^1.9.5", + "cjs-module-lexer": "^1.2.2", + "module-details-from-path": "^1.0.3" + } + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -11177,6 +12336,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-boolean-object": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.0.tgz", @@ -12695,7 +13866,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", - "dev": true, "bin": { "jsesc": "bin/jsesc" }, @@ -12754,7 +13924,6 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, "bin": { "json5": "lib/cli.js" }, @@ -13505,7 +14674,6 @@ "version": "4.2.8", "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==", - "dev": true, "engines": { "node": ">=8" } @@ -13687,6 +14855,12 @@ "obliterator": "^2.0.1" } }, + "node_modules/module-details-from-path": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.4.tgz", + "integrity": "sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==", + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -14004,8 +15178,7 @@ "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", - "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", - "dev": true + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==" }, "node_modules/nopt": { "version": "5.0.0", @@ -14026,7 +15199,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -14217,8 +15389,7 @@ "node_modules/obuf": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" }, "node_modules/ollama": { "version": "0.4.9", @@ -14793,7 +15964,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", - "dev": true, "engines": { "node": ">=4" } @@ -14815,7 +15985,6 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz", "integrity": "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng==", - "dev": true, "dependencies": { "pg-int8": "1.0.1", "pg-numeric": "1.0.2", @@ -15052,7 +16221,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", - "dev": true, "engines": { "node": ">=12" } @@ -15061,7 +16229,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", - "dev": true, "dependencies": { "obuf": "~1.1.2" }, @@ -15073,7 +16240,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz", "integrity": "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==", - "dev": true, "engines": { "node": ">=12" } @@ -15082,7 +16248,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", - "dev": true, "engines": { "node": ">=12" } @@ -15090,8 +16255,7 @@ "node_modules/postgres-range": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz", - "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==", - "dev": true + "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==" }, "node_modules/posthog-node": { "version": "3.6.3", @@ -15650,6 +16814,18 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/reflect.getprototypeof": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.8.tgz", @@ -15880,6 +17056,20 @@ "node": ">=0.10.0" } }, + "node_modules/require-in-the-middle": { + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-7.5.2.tgz", + "integrity": "sha512-gAZ+kLqBdHarXB64XpAe2VCjB7rIRv+mU8tfRWziHRJ5umKsIHN2tLLv6EtMw7WCdP19S0ERVMldNvxYCHnhSQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "module-details-from-path": "^1.0.3", + "resolve": "^1.22.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -16320,6 +17510,12 @@ "@types/hast": "^3.0.4" } }, + "node_modules/shimmer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", + "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==", + "license": "BSD-2-Clause" + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -17970,11 +19166,22 @@ "node": ">= 0.8" } }, + "node_modules/unplugin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz", + "integrity": "sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==", + "license": "MIT", + "dependencies": { + "acorn": "^8.8.1", + "chokidar": "^3.5.3", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.5.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", - "dev": true, "funding": [ { "type": "opencollective", @@ -18434,6 +19641,21 @@ "node": ">=12" } }, + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-virtual-modules": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", + "integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==", + "license": "MIT" + }, "node_modules/whatwg-encoding": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", diff --git a/core/package.json b/core/package.json index cebf2c189..cf895f0fa 100644 --- a/core/package.json +++ b/core/package.json @@ -7,9 +7,10 @@ "vitest": "vitest run", "test:coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage && open ./coverage/lcov-report/index.html", "tsc:check": "tsc -p ./ --noEmit", - "build:npm": "tsc -p ./tsconfig.npm.json", + "build:npm": "tsc -p ./tsconfig.npm.json && npm run sentry:sourcemaps", "lint": "eslint . --ext ts", - "lint:fix": "eslint . --ext ts --fix" + "lint:fix": "eslint . --ext ts --fix", + "sentry:sourcemaps": "sentry-cli sourcemaps inject --org continue-xd --project continue ./dist && sentry-cli sourcemaps upload --org continue-xd --project continue ./dist" }, "type": "module", "author": "Continue Dev, Inc", @@ -60,6 +61,11 @@ "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", + "@sentry/cli": "^2.50.2", + "@sentry/core": "^9.43.0", + "@sentry/esbuild-plugin": "^4.0.2", + "@sentry/node": "^9.43.0", + "@sentry/vite-plugin": "^4.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", diff --git a/core/protocol/messenger/index.ts b/core/protocol/messenger/index.ts index fb2528ae2..6ccac89e2 100644 --- a/core/protocol/messenger/index.ts +++ b/core/protocol/messenger/index.ts @@ -1,5 +1,6 @@ import { v4 as uuidv4 } from "uuid"; +import { Logger } from "../../util/Logger.js"; import type { IProtocol } from "../index"; export interface Message { @@ -85,7 +86,19 @@ export class InProcessMessenger< data, messageId: messageId ?? uuidv4(), }; - return listener(msg); + + try { + return listener(msg); + } catch (error) { + // Capture message handling errors to Sentry + Logger.error(error, { + messageType: String(messageType), + messageId: msg.messageId, + }); + + // Re-throw the original error + throw error; + } } send( @@ -119,12 +132,24 @@ export class InProcessMessenger< if (!listener) { throw new Error(`No handler for message type "${String(messageType)}"`); } - const response = await listener({ - messageType: messageType as string, - data, - messageId, - }); - return response; + + try { + const response = await listener({ + messageType: messageType as string, + data, + messageId, + }); + return response; + } catch (error) { + // Capture message handling errors to Sentry + Logger.error(error, { + messageType: String(messageType), + messageId, + }); + + // Re-throw the original error + throw error; + } } externalOn( @@ -144,11 +169,23 @@ export class InProcessMessenger< if (!listener) { throw new Error(`No handler for message type "${String(messageType)}"`); } - const response = listener({ - messageType: messageType as string, - data, - messageId, - }); - return Promise.resolve(response); + + try { + const response = listener({ + messageType: messageType as string, + data, + messageId, + }); + return Promise.resolve(response); + } catch (error) { + // Capture message handling errors to Sentry + Logger.error(error, { + messageType: String(messageType), + messageId, + }); + + // Re-throw the original error + throw error; + } } } diff --git a/core/tsconfig.json b/core/tsconfig.json index 91c265d3a..f1f52fa87 100644 --- a/core/tsconfig.json +++ b/core/tsconfig.json @@ -18,7 +18,14 @@ "noEmitOnError": false, "experimentalDecorators": true, "emitDecoratorMetadata": true, - "types": ["jest", "node"] + "types": ["jest", "node"], + "sourceMap": true, + "inlineSources": true, + + // Set `sourceRoot` to "/" to strip the build path prefix + // from generated source code references. + // This improves issue grouping in Sentry. + "sourceRoot": "/" }, "include": ["./**/*.ts", "./**/*.js", "./**/*.d.ts"], "exclude": ["dist"] diff --git a/core/util/Logger.ts b/core/util/Logger.ts new file mode 100644 index 000000000..68538792d --- /dev/null +++ b/core/util/Logger.ts @@ -0,0 +1,86 @@ +import winston from "winston"; +import { captureException } from "./sentry/SentryLogger"; + +class LoggerClass { + private static instance: LoggerClass; + private winston: winston.Logger; + + private constructor() { + this.winston = winston.createLogger({ + level: "info", + format: winston.format.combine( + winston.format.colorize(), + winston.format.timestamp(), + winston.format.printf(({ level, message, timestamp, ...meta }) => { + const metaStr = Object.keys(meta).length + ? ` ${JSON.stringify(meta)}` + : ""; + return `[@continuedev] ${level}: ${message}${metaStr}`; + }), + ), + transports: [ + // Write all logs with importance level of `info` or higher to `info.log` + ...(process.env.NODE_ENV === "test" + ? [ + new winston.transports.File({ + filename: "e2e.log", + level: "info", + }), + ] + : []), + // Normal console.log behavior + new winston.transports.Console(), + ], + }); + } + + public static getInstance(): LoggerClass { + if (!LoggerClass.instance) { + LoggerClass.instance = new LoggerClass(); + } + return LoggerClass.instance; + } + + private shouldSendToSentry(): boolean { + return process.env.NODE_ENV !== "test" && process.env.NODE_ENV !== "e2e"; + } + + public log(message: string, meta?: any): void { + this.winston.info(message, meta); + } + + public debug(message: string, meta?: any): void { + this.winston.debug(message, meta); + } + + public info(message: string, meta?: any): void { + this.winston.info(message, meta); + } + + public warn(message: string, meta?: any): void { + this.winston.warn(message, meta); + } + + public error( + error: Error | string | unknown, + context?: Record, + ): void { + let errorMessage: string; + + if (error instanceof Error) { + errorMessage = error.message; + } else if (typeof error === "string") { + errorMessage = error; + } else { + errorMessage = "An unknown error occurred"; + } + + this.winston.error(errorMessage, context); + + if (this.shouldSendToSentry() && error instanceof Error) { + captureException(error, context); + } + } +} + +export const Logger = LoggerClass.getInstance(); diff --git a/core/util/isContinueTeamMember.ts b/core/util/isContinueTeamMember.ts new file mode 100644 index 000000000..1a6507154 --- /dev/null +++ b/core/util/isContinueTeamMember.ts @@ -0,0 +1,7 @@ +/** + * Utility to check if a user is a Continue team member + */ +export function isContinueTeamMember(email?: string): boolean { + if (!email) return false; + return email.endsWith("@continue.dev"); +} diff --git a/core/util/logger.ts b/core/util/logger.ts deleted file mode 100644 index ebd21199c..000000000 --- a/core/util/logger.ts +++ /dev/null @@ -1,16 +0,0 @@ -import winston from "winston"; - -console.log("NODE_ENV", process.env.NODE_ENV); - -export const logger = winston.createLogger({ - level: "info", - format: winston.format.json(), - transports: [ - // Write all logs with importance level of `info` or higher to `info.log` - ...(process.env.NODE_ENV === "test" - ? [new winston.transports.File({ filename: "e2e.log", level: "info" })] - : []), - // Normal console.log behavior - new winston.transports.Console(), - ], -}); diff --git a/core/util/sentry/SentryLogger.test.ts b/core/util/sentry/SentryLogger.test.ts new file mode 100644 index 000000000..d6c9cce63 --- /dev/null +++ b/core/util/sentry/SentryLogger.test.ts @@ -0,0 +1,886 @@ +import { IdeInfo } from "../../index.js"; +import { + SentryLogger, + captureException, + captureLog, + createSpan, + initializeSentry, +} from "./SentryLogger"; +import { anonymizeSentryEvent } from "./anonymization"; + +describe("SentryLogger Integration Tests", () => { + const mockIdeInfo: IdeInfo = { + extensionVersion: "1.0.0", + name: "vscode", + ideType: "vscode", + version: "1.0.0", + remoteName: "local", + isPrerelease: false, + }; + + beforeEach(() => { + // Reset SentryLogger state before each test + SentryLogger.client = undefined; + SentryLogger.scope = undefined; + SentryLogger.allowTelemetry = false; + SentryLogger.uniqueId = "NOT_UNIQUE"; + SentryLogger.ideInfo = undefined; + }); + + afterEach(() => { + // Clean up after each test + SentryLogger.shutdownSentryClient(); + }); + + describe("Telemetry Toggle Behavior", () => { + it("should not initialize when telemetry is disabled", async () => { + await SentryLogger.setup( + false, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + expect(SentryLogger.allowTelemetry).toBe(false); + expect(SentryLogger.client).toBeUndefined(); + expect(SentryLogger.scope).toBeUndefined(); + expect(SentryLogger.uniqueId).toBe("test-id"); + expect(SentryLogger.ideInfo).toBe(mockIdeInfo); + }); + + it("should not initialize in test environment even when telemetry is enabled", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "test"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + // In the updated implementation, the Continue team member check is used instead of NODE_ENV check + // so we're not setting allowTelemetry to false just because we're in test environment anymore + expect(SentryLogger.allowTelemetry).toBe(true); + // But client and scope should still be initialized + expect(SentryLogger.client).toBeDefined(); + expect(SentryLogger.scope).toBeDefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should initialize when telemetry is enabled in non-test environment", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + expect(SentryLogger.allowTelemetry).toBe(true); + expect(SentryLogger.uniqueId).toBe("test-id"); + expect(SentryLogger.ideInfo).toBe(mockIdeInfo); + expect(SentryLogger.client).toBeDefined(); + expect(SentryLogger.scope).toBeDefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should handle telemetry being disabled after being enabled", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + // Enable telemetry first + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + expect(SentryLogger.allowTelemetry).toBe(true); + expect(SentryLogger.client).toBeDefined(); + + // Then disable it + await SentryLogger.setup(false, "test-id-2", mockIdeInfo); + expect(SentryLogger.allowTelemetry).toBe(false); + expect(SentryLogger.client).toBeUndefined(); + expect(SentryLogger.scope).toBeUndefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should not reinitialize if client already exists", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + // First setup + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + const firstClient = SentryLogger.client; + const firstScope = SentryLogger.scope; + + // Second setup should not change the client + await SentryLogger.setup( + true, + "test-id-2", + mockIdeInfo, + "test@continue.dev", + ); + expect(SentryLogger.client).toBe(firstClient); + expect(SentryLogger.scope).toBe(firstScope); + expect(SentryLogger.uniqueId).toBe("test-id-2"); // ID should update + expect(SentryLogger.ideInfo).toBe(mockIdeInfo); // Info should update + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("Lazy Initialization", () => { + it("should initialize when accessing lazyClient if conditions are met", () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + // Set up conditions for lazy initialization + SentryLogger.allowTelemetry = true; + SentryLogger.ideInfo = mockIdeInfo; + + // Access lazy client should trigger initialization + const client = SentryLogger.lazyClient; + + expect(client).toBeDefined(); + expect(SentryLogger.client).toBe(client); + expect(SentryLogger.scope).toBeDefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should not initialize if telemetry is disabled", () => { + SentryLogger.allowTelemetry = false; + SentryLogger.ideInfo = mockIdeInfo; + + const client = SentryLogger.lazyClient; + + expect(client).toBeUndefined(); + expect(SentryLogger.client).toBeUndefined(); + expect(SentryLogger.scope).toBeUndefined(); + }); + + it("should not initialize if ideInfo is missing", () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + SentryLogger.allowTelemetry = true; + SentryLogger.ideInfo = undefined; + + const client = SentryLogger.lazyClient; + + expect(client).toBeUndefined(); + expect(SentryLogger.client).toBeUndefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("Shutdown Behavior", () => { + it("should properly shutdown when client exists", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + // Setup Sentry first + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + expect(SentryLogger.client).toBeDefined(); + + // Shutdown should clean up + SentryLogger.shutdownSentryClient(); + expect(SentryLogger.client).toBeUndefined(); + expect(SentryLogger.scope).toBeUndefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should handle shutdown gracefully when client is undefined", () => { + expect(() => SentryLogger.shutdownSentryClient()).not.toThrow(); + expect(SentryLogger.client).toBeUndefined(); + expect(SentryLogger.scope).toBeUndefined(); + }); + }); +}); + +describe("Sentry Utility Functions", () => { + const mockIdeInfo: IdeInfo = { + extensionVersion: "1.0.0", + name: "vscode", + ideType: "vscode", + version: "1.0.0", + remoteName: "local", + isPrerelease: false, + }; + + beforeEach(() => { + // Reset SentryLogger state + SentryLogger.client = undefined; + SentryLogger.scope = undefined; + SentryLogger.allowTelemetry = false; + }); + + afterEach(() => { + SentryLogger.shutdownSentryClient(); + }); + + describe("initializeSentry", () => { + it("should return undefined when telemetry is disabled", () => { + const result = initializeSentry(); + + expect(result.client).toBeUndefined(); + expect(result.scope).toBeUndefined(); + }); + + it("should return client and scope when telemetry is enabled", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + const result = initializeSentry(); + + expect(result.client).toBeDefined(); + expect(result.scope).toBeDefined(); + expect(result.client).toBe(SentryLogger.client); + expect(result.scope).toBe(SentryLogger.scope); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("createSpan", () => { + it("should execute callback normally when telemetry is disabled", () => { + const callback = jest.fn().mockReturnValue("test-result"); + + const result = createSpan("test.operation", "test span", callback); + + expect(result).toBe("test-result"); + expect(callback).toHaveBeenCalledTimes(1); + }); + + it("should execute callback with span when telemetry is enabled", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + const callback = jest.fn().mockReturnValue("test-result"); + const result = createSpan("test.operation", "test span", callback); + + expect(result).toBe("test-result"); + expect(callback).toHaveBeenCalledTimes(1); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should handle async callbacks", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + const asyncCallback = jest.fn().mockResolvedValue("async-result"); + const result = await createSpan( + "test.operation", + "test span", + asyncCallback, + ); + + expect(result).toBe("async-result"); + expect(asyncCallback).toHaveBeenCalledTimes(1); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("captureException", () => { + it("should not throw when telemetry is disabled", () => { + const error = new Error("test error"); + + expect(() => captureException(error)).not.toThrow(); + expect(() => captureException(error, { context: "test" })).not.toThrow(); + }); + + it("should not throw when telemetry is enabled", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + const error = new Error("test error"); + + expect(() => captureException(error)).not.toThrow(); + expect(() => captureException(error, { context: "test" })).not.toThrow(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should handle malformed context gracefully", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + const error = new Error("test error"); + + expect(() => captureException(error, null as any)).not.toThrow(); + expect(() => captureException(error, undefined)).not.toThrow(); + expect(() => captureException(error, { circular: {} })).not.toThrow(); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("captureLog", () => { + it("should not throw when telemetry is disabled", () => { + expect(() => captureLog("test message")).not.toThrow(); + expect(() => + captureLog("test message", "info", { context: "test" }), + ).not.toThrow(); + }); + + it("should not throw when telemetry is enabled", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + expect(() => captureLog("test message")).not.toThrow(); + expect(() => + captureLog("test message", "error", { context: "test" }), + ).not.toThrow(); + + process.env.NODE_ENV = originalNodeEnv; + }); + + it("should handle malformed context gracefully", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + expect(() => + captureLog("test message", "info", null as any), + ).not.toThrow(); + expect(() => + captureLog("test message", "warning", undefined), + ).not.toThrow(); + expect(() => + captureLog("test message", "error", { circular: {} }), + ).not.toThrow(); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("Integration Tests", () => { + it("should maintain consistent state across utility functions", async () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + // Start with telemetry disabled + expect(initializeSentry().client).toBeUndefined(); + + const callback = jest.fn().mockReturnValue("result"); + createSpan("test", "test", callback); + expect(callback).toHaveBeenCalled(); + + // Enable telemetry + await SentryLogger.setup( + true, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + + // Now utility functions should work with Sentry + const sentryResult = initializeSentry(); + expect(sentryResult.client).toBeDefined(); + expect(sentryResult.scope).toBeDefined(); + + // Functions should work without throwing + const callback2 = jest.fn().mockReturnValue("result2"); + const spanResult = createSpan("test2", "test2", callback2); + expect(spanResult).toBe("result2"); + expect(callback2).toHaveBeenCalled(); + + const error = new Error("test error"); + expect(() => captureException(error, { test: "context" })).not.toThrow(); + expect(() => + captureLog("test log message", "info", { test: "context" }), + ).not.toThrow(); + + // Disable telemetry again + await SentryLogger.setup( + false, + "test-id", + mockIdeInfo, + "test@continue.dev", + ); + expect(initializeSentry().client).toBeUndefined(); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); +}); + +describe("Sentry Data Anonymization Tests", () => { + describe("anonymizeSentryEvent", () => { + it("should anonymize user file paths in stack traces", () => { + const event: any = { + exception: { + values: [ + { + stacktrace: { + frames: [ + { + filename: "/Users/john/workspace/my-project/src/app.js", + abs_path: "/Users/john/workspace/my-project/src/app.js", + function: "myFunction", + lineno: 42, + vars: { secret: "password123" }, + pre_context: ["const secret = 'password123'"], + post_context: ["console.log(secret)"], + context_line: "throw new Error('test')", + }, + ], + }, + }, + ], + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.vars, + ).toBeUndefined(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.pre_context, + ).toBeUndefined(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.post_context, + ).toBeUndefined(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.context_line, + ).toBe(""); + }); + + it("should anonymize all absolute file paths equally", () => { + const event: any = { + exception: { + values: [ + { + stacktrace: { + frames: [ + { + filename: "/Users/dev/continue/core/util/sentry.js", + abs_path: "/Users/dev/continue/core/util/sentry.js", + function: "captureException", + lineno: 42, + vars: { secret: "password123" }, + pre_context: ["const secret = 'password123'"], + post_context: ["console.log(secret)"], + context_line: "throw new Error('test')", + }, + ], + }, + }, + ], + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.vars, + ).toBeUndefined(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.pre_context, + ).toBeUndefined(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.post_context, + ).toBeUndefined(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.context_line, + ).toBe(""); + }); + + it("should preserve node_modules package names for debugging", () => { + const event: any = { + exception: { + values: [ + { + stacktrace: { + frames: [ + { + filename: + "/Users/dev/project/node_modules/@sentry/node/index.js", + abs_path: + "/Users/dev/project/node_modules/@sentry/node/index.js", + function: "init", + lineno: 123, + }, + ], + }, + }, + ], + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename, + ).toBe("node_modules/@sentry/"); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path, + ).toBe(""); + }); + + it("should hash user IDs", () => { + const event: any = { + user: { + id: "real-machine-id-12345", + username: "john.doe", + email: "john@example.com", + ip_address: "192.168.1.100", + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect(result?.user?.id).not.toBe("real-machine-id-12345"); + expect(result?.user?.id).toMatch(/^[a-f0-9]{8}$/); // Should be 8-char hash + expect(result?.user?.username).toBeUndefined(); + expect(result?.user?.email).toBeUndefined(); + expect(result?.user?.ip_address).toBeUndefined(); + }); + + it("should preserve breadcrumbs unchanged", () => { + const event: any = { + breadcrumbs: [ + { + message: + "File opened: /Users/john/Documents/secret-project/config.js", + category: "file", + data: { + filename: "/Users/john/Documents/secret-project/config.js", + action: "open", + }, + }, + { + message: "Error in module initialization", + category: "error", + data: { + module: "auth", + error: "Connection failed", + }, + }, + ], + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + // Breadcrumbs are preserved as-is in our minimalist approach + expect(result?.breadcrumbs?.[0]?.message).toBe( + "File opened: /Users/john/Documents/secret-project/config.js", + ); + expect(result?.breadcrumbs?.[0]?.data?.filename).toBe( + "/Users/john/Documents/secret-project/config.js", + ); + expect(result?.breadcrumbs?.[0]?.data?.action).toBe("open"); + expect(result?.breadcrumbs?.[1]?.message).toBe( + "Error in module initialization", + ); + expect(result?.breadcrumbs?.[1]?.data?.module).toBe("auth"); + expect(result?.breadcrumbs?.[1]?.data?.error).toBe("Connection failed"); + }); + + it("should preserve tags unchanged", () => { + const event: any = { + tags: { + username: "john.doe", + user_id: "12345", + workspace: "/Users/john/workspace", + project_path: "/path/to/project", + environment: "production", + version: "1.2.3", + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + // Tags are preserved as-is in our minimalist approach + expect(result?.tags?.username).toBe("john.doe"); + expect(result?.tags?.user_id).toBe("12345"); + expect(result?.tags?.workspace).toBe("/Users/john/workspace"); + expect(result?.tags?.project_path).toBe("/path/to/project"); + expect(result?.tags?.environment).toBe("production"); + expect(result?.tags?.version).toBe("1.2.3"); + }); + + it("should preserve extra data unchanged", () => { + const event: any = { + extra: { + path: "/Users/john/secret-project", + filename: "config.js", + directory: "/home/user/workspace", + workspace: "/Users/john/workspace", + user: "john.doe", + home: "/Users/john", + config_file: "/some/long/path/to/config.json", + error_code: 500, + timestamp: "2023-01-01T00:00:00Z", + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + // Extra data is preserved as-is in our minimalist approach + expect(result?.extra?.path).toBe("/Users/john/secret-project"); + expect(result?.extra?.filename).toBe("config.js"); + expect(result?.extra?.directory).toBe("/home/user/workspace"); + expect(result?.extra?.workspace).toBe("/Users/john/workspace"); + expect(result?.extra?.user).toBe("john.doe"); + expect(result?.extra?.home).toBe("/Users/john"); + expect(result?.extra?.config_file).toBe("/some/long/path/to/config.json"); + expect(result?.extra?.error_code).toBe(500); + expect(result?.extra?.timestamp).toBe("2023-01-01T00:00:00Z"); + }); + + it("should anonymize thread stack traces", () => { + const event: any = { + threads: { + values: [ + { + id: "main", + name: "MainThread", + stacktrace: { + frames: [ + { + filename: "/Users/john/workspace/app.js", + abs_path: "/Users/john/workspace/app.js", + function: "main", + lineno: 1, + vars: { apiKey: "secret-key-123" }, + context_line: "const apiKey = 'secret-key-123'", + }, + ], + }, + }, + ], + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect( + result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.filename, + ).toBe(""); + expect( + result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path, + ).toBe(""); + expect( + result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.vars, + ).toBeUndefined(); + expect( + result?.threads?.values?.[0]?.stacktrace?.frames?.[0]?.context_line, + ).toBe(""); + }); + + it("should remove OS environment variables", () => { + const event: any = { + contexts: { + os: { + name: "macOS", + version: "12.6", + environment: { + HOME: "/Users/john", + USER: "john", + PATH: "/usr/local/bin:/usr/bin", + }, + }, + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect(result?.contexts?.os?.name).toBe("macOS"); + expect(result?.contexts?.os?.version).toBe("12.6"); + expect(result?.contexts?.os?.environment).toBeUndefined(); + }); + + it("should handle events with no sensitive data", () => { + const event: any = { + message: "Simple error message", + level: "error", + timestamp: 1234567890, + tags: { + component: "auth", + level: "error", + }, + extra: { + error_code: 404, + retry_count: 3, + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + expect(result?.message).toBe("Simple error message"); + expect(result?.level).toBe("error"); + expect(result?.timestamp).toBe(1234567890); + expect(result?.tags?.component).toBe("auth"); + expect(result?.extra?.error_code).toBe(404); + }); + + it("should handle malformed events gracefully", () => { + const malformedEvent: any = { + exception: { + values: null, + }, + user: null, + breadcrumbs: "not-an-array", + tags: null, + extra: null, + }; + + const result = anonymizeSentryEvent(malformedEvent); + expect(result).not.toBeNull(); + }); + + it("should handle anonymization errors by returning null", () => { + // Create a circular reference that would cause JSON serialization issues + const circularEvent: any = { + message: "Test event", + }; + circularEvent.circular = circularEvent; + + // Mock the anonymization to throw an error + const originalConsoleError = console.error; + console.error = jest.fn(); + + const result = anonymizeSentryEvent(circularEvent); + + // Should not throw, but should return null for safety + expect(result).not.toBeNull(); // Actually, our function might handle this case + + console.error = originalConsoleError; + }); + + it("should anonymize all absolute paths regardless of format", () => { + const event: any = { + exception: { + values: [ + { + stacktrace: { + frames: [ + { + filename: + "C:\\Users\\dev\\continue\\extensions\\vscode\\src\\extension.js", + abs_path: + "C:\\Users\\dev\\continue\\extensions\\vscode\\src\\extension.js", + }, + { + filename: "/home/dev/continue/core/util/sentry.js", + abs_path: "/home/dev/continue/core/util/sentry.js", + }, + { + filename: "relative/path/file.js", + abs_path: "/absolute/path/file.js", + }, + ], + }, + }, + ], + }, + }; + + const result = anonymizeSentryEvent(event); + expect(result).not.toBeNull(); + // All absolute paths get anonymized equally + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.filename, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[1]?.filename, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[2]?.filename, + ).toBe("relative/path/file.js"); // Relative path preserved + // All abs_path fields cleared + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[0]?.abs_path, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[1]?.abs_path, + ).toBe(""); + expect( + result?.exception?.values?.[0]?.stacktrace?.frames?.[2]?.abs_path, + ).toBe(""); + }); + }); +}); diff --git a/core/util/sentry/SentryLogger.ts b/core/util/sentry/SentryLogger.ts new file mode 100644 index 000000000..d10a62dc5 --- /dev/null +++ b/core/util/sentry/SentryLogger.ts @@ -0,0 +1,263 @@ +import { Extras } from "@sentry/core"; +import * as Sentry from "@sentry/node"; +import os from "node:os"; +import { IdeInfo } from "../../index.js"; +import { isContinueTeamMember } from "../isContinueTeamMember.js"; +import { anonymizeSentryEvent } from "./anonymization.js"; +import { SENTRY_DSN } from "./constants.js"; + +export class SentryLogger { + static client: Sentry.NodeClient | undefined = undefined; + static scope: Sentry.Scope | undefined = undefined; + static uniqueId = "NOT_UNIQUE"; + static os: string | undefined = undefined; + static ideInfo: IdeInfo | undefined = undefined; + static allowTelemetry: boolean = false; + + private static initializeSentryClient(release: string): { + client: Sentry.NodeClient | undefined; + scope: Sentry.Scope | undefined; + } { + try { + // For shared environments like VSCode extensions, we need to avoid global state pollution + // Filter out integrations that use global state + // See https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/ + + // Filter integrations that use the global variable + const integrations = Sentry.getDefaultIntegrations({}).filter( + (defaultIntegration) => { + // Remove integrations that might interfere with shared environments + return ![ + "OnUncaughtException", + "OnUnhandledRejection", + "ContextLines", + "LocalVariables", + ].includes(defaultIntegration.name); + }, + ); + + // Create client manually without polluting global state + const client = new Sentry.NodeClient({ + dsn: SENTRY_DSN, + release, + environment: process.env.NODE_ENV, + transport: Sentry.makeNodeTransport, + stackParser: Sentry.defaultStackParser, + + // For basic error tracking, a lower sample rate should be fine + sampleRate: 0.1, + tracesSampleRate: 0.1, + + // Privacy-conscious default + sendDefaultPii: false, + + // Strip sensitive data and add basic properties before sending events + beforeSend(event) { + // First apply anonymization + const anonymizedEvent = anonymizeSentryEvent(event); + if (!anonymizedEvent) return null; + + // Add basic properties similar to PostHog telemetry + if (!anonymizedEvent.tags) anonymizedEvent.tags = {}; + if (!anonymizedEvent.extra) anonymizedEvent.extra = {}; + + // Add OS information + if (SentryLogger.os) { + anonymizedEvent.tags.os = SentryLogger.os; + } + + // Add ideInfo properties spread out as top-level properties + if (SentryLogger.ideInfo) { + anonymizedEvent.tags.extensionVersion = + SentryLogger.ideInfo.extensionVersion; + anonymizedEvent.tags.ideName = SentryLogger.ideInfo.name; + anonymizedEvent.tags.ideType = SentryLogger.ideInfo.ideType; + anonymizedEvent.tags.ideVersion = SentryLogger.ideInfo.version; + anonymizedEvent.tags.remoteName = SentryLogger.ideInfo.remoteName; + anonymizedEvent.tags.isPrerelease = + SentryLogger.ideInfo.isPrerelease; + } + + return anonymizedEvent; + }, + + // Use filtered integrations for Node.js/VSCode shared environment + integrations, + + // Enable structured logging + _experiments: { + enableLogs: true, + }, + }); + + // Create a new scope and set the client + const scope = new Sentry.Scope(); + scope.setClient(client); + + // Initialize the client after setting it on the scope + client.init(); + + return { client, scope }; + } catch (error) { + console.error("Failed to initialize Sentry client:", error); + return { client: undefined, scope: undefined }; + } + } + + static async setup( + allowAnonymousTelemetry: boolean, + uniqueId: string, + ideInfo: IdeInfo, + userEmail?: string, + ) { + // TODO: Remove Continue team member check once Sentry is ready for all users + SentryLogger.allowTelemetry = + allowAnonymousTelemetry && isContinueTeamMember(userEmail); + SentryLogger.uniqueId = uniqueId; + SentryLogger.ideInfo = ideInfo; + SentryLogger.os = os.platform(); + + if (!SentryLogger.allowTelemetry) { + SentryLogger.client = undefined; + SentryLogger.scope = undefined; + } else if (!SentryLogger.client) { + const { client, scope } = SentryLogger.initializeSentryClient( + ideInfo.extensionVersion, + ); + SentryLogger.client = client; + SentryLogger.scope = scope; + } + } + + private static ensureInitialized(): void { + if (!SentryLogger.allowTelemetry || SentryLogger.client) { + return; + } + + if (SentryLogger.ideInfo) { + const { client, scope } = SentryLogger.initializeSentryClient( + SentryLogger.ideInfo.extensionVersion, + ); + SentryLogger.client = client; + SentryLogger.scope = scope; + } + } + + static get lazyClient(): Sentry.NodeClient | undefined { + SentryLogger.ensureInitialized(); + return SentryLogger.client; + } + + static get lazyScope(): Sentry.Scope | undefined { + SentryLogger.ensureInitialized(); + return SentryLogger.scope; + } + + static shutdownSentryClient() { + if (SentryLogger.client) { + void SentryLogger.client.close(); + SentryLogger.client = undefined; + SentryLogger.scope = undefined; + } + } +} + +/** + * Initialize Sentry for error tracking, performance monitoring, and structured logging. + * Returns the Sentry client and scope, or undefined objects if telemetry is disabled. + */ +export function initializeSentry(): { + client: Sentry.NodeClient | undefined; + scope: Sentry.Scope | undefined; +} { + return { + client: SentryLogger.lazyClient, + scope: SentryLogger.lazyScope, + }; +} + +// Export utility functions for using Sentry throughout the application + +/** + * Create a custom span for performance monitoring + * + * @param operation The operation category (e.g., "http.client", "ui.click", "db.query") + * @param name A descriptive name for the span + * @param callback The function to execute within the span + * @returns The result of the callback function + */ +export function createSpan( + operation: string, + name: string, + callback: () => T | Promise, +): T | Promise { + const client = SentryLogger.lazyClient; + if (!client) { + return callback(); + } + + // Use withScope from Sentry to isolate the span context + return Sentry.withScope((isolatedScope) => { + isolatedScope.setClient(client); + return Sentry.startSpan( + { + op: operation, + name, + }, + () => callback(), + ); + }); +} + +/** + * Capture an exception and send it to Sentry + * + * @param error The error to capture + * @param context Additional context information + */ +export function captureException(error: Error, context?: Record) { + const scope = SentryLogger.lazyScope; + if (!scope) { + return; + } + + try { + // Add context to scope if provided + if (context) { + scope.setExtras(context); + } + // Use scope's captureException to avoid global state + scope.captureException(error); + } catch (e) { + console.error(`Failed to capture exception to Sentry: ${e}`); + } +} + +/** + * Capture a structured log message and send it to Sentry + * + * @param message The log message + * @param level The severity level (default: 'info') + * @param context Additional context information + */ +export function captureLog( + message: string, + level: Sentry.SeverityLevel = "info", + context?: Extras, +) { + const scope = SentryLogger.lazyScope; + if (!scope) { + return; + } + + try { + // Add context to scope if provided + if (context) { + scope.setExtras(context); + } + // Use scope's captureMessage to avoid global state + scope.captureMessage(message, level); + } catch (e) { + console.error(`Failed to capture log to Sentry: ${e}`); + } +} diff --git a/core/util/sentry/anonymization.test.ts b/core/util/sentry/anonymization.test.ts new file mode 100644 index 000000000..db62a22ae --- /dev/null +++ b/core/util/sentry/anonymization.test.ts @@ -0,0 +1,174 @@ +import { + anonymizeFilePath, + anonymizeSentryEvent, + anonymizeStackTrace, + anonymizeUserInfo, +} from "./anonymization"; + +describe("Sentry Anonymization Utilities", () => { + describe("anonymizeFilePath", () => { + it("should anonymize absolute paths but preserve node_modules package names", () => { + expect(anonymizeFilePath("/Users/john/workspace/app.js")).toBe(""); + expect(anonymizeFilePath("/home/user/project/file.py")).toBe(""); + expect(anonymizeFilePath("C:\\Users\\john\\Documents\\code.go")).toBe( + "", + ); + expect(anonymizeFilePath("/project/node_modules/react/index.js")).toBe( + "node_modules/react/", + ); + }); + + it("should keep relative paths unchanged", () => { + expect(anonymizeFilePath("src/app.js")).toBe("src/app.js"); + expect(anonymizeFilePath("./utils/helper.py")).toBe("./utils/helper.py"); + expect(anonymizeFilePath("package/main.go")).toBe("package/main.go"); + }); + + it("should handle empty or undefined paths", () => { + expect(anonymizeFilePath("")).toBe(""); + expect(anonymizeFilePath(undefined as any)).toBe(undefined); + expect(anonymizeFilePath(null as any)).toBe(null); + }); + }); + + describe("anonymizeStackTrace", () => { + it("should anonymize stack frame filenames", () => { + const frames = [ + { + filename: "/Users/john/project/app.js", + abs_path: "/Users/john/project/app.js", + function: "myFunction", + lineno: 42, + vars: { secret: "password123" }, + pre_context: ['const secret = "password123"'], + post_context: ["console.log(secret)"], + context_line: 'throw new Error("test")', + }, + ]; + + const result = anonymizeStackTrace(frames); + + expect(result[0].filename).toBe(""); + expect(result[0].abs_path).toBe(""); // Always cleared like Rasa + expect(result[0].vars).toBeUndefined(); + expect(result[0].pre_context).toBeUndefined(); + expect(result[0].post_context).toBeUndefined(); + expect(result[0].context_line).toBe(""); + expect(result[0].function).toBe("myFunction"); // Preserve function name + expect(result[0].lineno).toBe(42); // Preserve line number + }); + + it("should handle non-array input", () => { + expect(anonymizeStackTrace(null as any)).toBe(null); + expect(anonymizeStackTrace(undefined as any)).toBe(undefined); + expect(anonymizeStackTrace("not-array" as any)).toBe("not-array"); + }); + }); + + describe("anonymizeUserInfo", () => { + it("should hash user ID and remove other info", () => { + const user = { + id: "real-machine-id-12345", + username: "john.doe", + email: "john@example.com", + ip_address: "192.168.1.100", + }; + + const result = anonymizeUserInfo(user); + + expect(result.id).not.toBe("real-machine-id-12345"); + expect(result.id).toMatch(/^[a-f0-9]{8}$/); // 8-char hash + expect(result.username).toBeUndefined(); + expect(result.email).toBeUndefined(); + expect(result.ip_address).toBeUndefined(); + }); + + it("should handle null/undefined user", () => { + expect(anonymizeUserInfo(null)).toBe(null); + expect(anonymizeUserInfo(undefined)).toBe(undefined); + }); + }); + + describe("anonymizeSentryEvent (integration)", () => { + it("should anonymize events with user file paths", () => { + const event: any = { + exception: { + values: [ + { + stacktrace: { + frames: [ + { + filename: "/Users/john/workspace/app.js", + abs_path: "/Users/john/workspace/app.js", + vars: { secret: "password" }, + context_line: 'throw new Error("test")', + }, + ], + }, + }, + ], + }, + user: { + id: "machine-id-12345", + username: "john", + }, + contexts: { + os: { + environment: { HOME: "/Users/john" }, + }, + }, + }; + + const result = anonymizeSentryEvent(event); + + expect(result).not.toBeNull(); + expect(result.exception.values[0].stacktrace.frames[0].filename).toBe( + "", + ); + expect(result.exception.values[0].stacktrace.frames[0].abs_path).toBe(""); + expect( + result.exception.values[0].stacktrace.frames[0].vars, + ).toBeUndefined(); + expect(result.exception.values[0].stacktrace.frames[0].context_line).toBe( + "", + ); + expect(result.user.id).toMatch(/^[a-f0-9]{8}$/); + expect(result.user.username).toBeUndefined(); + expect(result.contexts.os.environment).toBeUndefined(); + }); + + it("should handle malformed events gracefully", () => { + const malformedEvent: any = { + exception: { + values: null, + }, + user: null, + breadcrumbs: "not-an-array", + tags: null, + extra: null, + }; + + const result = anonymizeSentryEvent(malformedEvent); + expect(result).not.toBeNull(); // Should not crash + }); + + it("should return null on anonymization errors", () => { + // Create a circular reference that would cause issues + const circularEvent: any = { + message: "Test event", + }; + circularEvent.circular = circularEvent; + + // Mock console.error to avoid noise in tests + const originalConsoleError = console.error; + console.error = jest.fn(); + + const result = anonymizeSentryEvent(circularEvent); + + // Should handle gracefully without crashing + expect(result).not.toBeNull(); // Our implementation might handle this + + console.error = originalConsoleError; + }); + }); +}); diff --git a/core/util/sentry/anonymization.ts b/core/util/sentry/anonymization.ts new file mode 100644 index 000000000..7f18ab333 --- /dev/null +++ b/core/util/sentry/anonymization.ts @@ -0,0 +1,132 @@ +import { ErrorEvent } from "@sentry/core"; +/** + * Minimalist Sentry anonymization utilities + */ + +// Browser-compatible hash function (avoids Node.js crypto dependency) +function simpleHash(input: string): string { + let hash = 0; + for (let i = 0; i < input.length; i++) { + const char = input.charCodeAt(i); + hash = (hash << 5) - hash + char; + hash = hash & hash; // Convert to 32-bit integer + } + return Math.abs(hash).toString(16).substring(0, 8); +} + +/** + * Anonymize file paths - keep package names, remove user paths + */ +export function anonymizeFilePath(filePath: string): string { + if (!filePath) return filePath; + + const normalized = filePath.replace(/\\/g, "/"); + + // Keep node_modules package names for debugging + if (normalized.includes("node_modules")) { + const match = normalized.match(/node_modules\/([^\/]+)/); + if (match) { + return `node_modules/${match[1]}/`; + } + } + + // Replace absolute paths with generic identifier + if (normalized.startsWith("/") || normalized.match(/^[A-Za-z]:/)) { + return ""; + } + + return normalized; +} + +/** + * Clean stack trace frames - remove sensitive data but keep the event + */ +export function anonymizeStackTrace(frames: any[]): any[] { + if (!Array.isArray(frames)) return frames; + + return frames.map((frame) => ({ + ...frame, + filename: frame.filename + ? anonymizeFilePath(frame.filename) + : frame.filename, + abs_path: "", + // Remove local variables and source code context + vars: undefined, + pre_context: undefined, + post_context: undefined, + context_line: frame.context_line ? "" : frame.context_line, + })); +} + +/** + * Anonymize user information - hash ID, remove PII + */ +export function anonymizeUserInfo(user: any): any { + if (!user) return user; + + return { + id: user.id ? simpleHash(String(user.id)) : user.id, + username: undefined, + email: undefined, + ip_address: undefined, + }; +} + +/** + * Main anonymization function - minimalist approach like Rasa + */ +export function anonymizeSentryEvent(event: ErrorEvent): any | null { + try { + // Deep copy to avoid mutating the original event + const anonymized = structuredClone(event); + + // Clean exception stack traces + if (anonymized.exception?.values) { + anonymized.exception.values = anonymized.exception.values.map( + (exception: any) => ({ + ...exception, + stacktrace: exception.stacktrace + ? { + ...exception.stacktrace, + frames: exception.stacktrace.frames + ? anonymizeStackTrace(exception.stacktrace.frames) + : exception.stacktrace.frames, + } + : exception.stacktrace, + }), + ); + } + + // Clean thread stack traces + if (anonymized.threads?.values) { + anonymized.threads.values = anonymized.threads.values.map( + (thread: any) => ({ + ...thread, + stacktrace: thread.stacktrace + ? { + ...thread.stacktrace, + frames: thread.stacktrace.frames + ? anonymizeStackTrace(thread.stacktrace.frames) + : thread.stacktrace.frames, + } + : thread.stacktrace, + }), + ); + } + + // Anonymize user info + if (anonymized.user) { + anonymized.user = anonymizeUserInfo(anonymized.user); + } + + // Remove OS environment variables + if (anonymized.contexts?.os?.environment) { + anonymized.contexts.os.environment = undefined; + } + + return anonymized; + } catch (error) { + console.error("Error anonymizing Sentry event:", error); + return null; // Drop event if anonymization fails + } +} diff --git a/core/util/sentry/constants.ts b/core/util/sentry/constants.ts new file mode 100644 index 000000000..070d15605 --- /dev/null +++ b/core/util/sentry/constants.ts @@ -0,0 +1,5 @@ +/** + * Sentry configuration constants + */ +export const SENTRY_DSN = + "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016"; diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 531e97ea7..82e5e5036 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -695,7 +695,7 @@ "e2e:copy-vsix": "chmod +x ./e2e/get-latest-vsix.sh && bash ./e2e/get-latest-vsix.sh", "e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:install-extensions": "extest install-from-marketplace ms-vscode-remote.remote-ssh --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-containers --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-wsl --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", - "e2e:test": "extest run-tests ${TEST_FILE:-'./e2e/_output/tests/*.test.js'} --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", + "e2e:test": "NODE_ENV=e2e extest run-tests ${TEST_FILE:-'./e2e/_output/tests/*.test.js'} --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:clean": "rm -rf ./e2e/_output ./e2e/storage", "e2e:all": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:all-non-mac": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", diff --git a/extensions/vscode/src/extension.ts b/extensions/vscode/src/extension.ts index be2b12487..2b8114e5e 100644 --- a/extensions/vscode/src/extension.ts +++ b/extensions/vscode/src/extension.ts @@ -7,6 +7,7 @@ import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTrace import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; +import { SentryLogger } from "core/util/sentry/SentryLogger"; import { getExtensionVersion } from "./util/util"; export { default as buildTimestamp } from "./.buildTimestamp"; @@ -46,7 +47,7 @@ export function activate(context: vscode.ExtensionContext) { } export function deactivate() { - Telemetry.capture( + void Telemetry.capture( "deactivate", { extensionVersion: getExtensionVersion(), @@ -55,4 +56,5 @@ export function deactivate() { ); Telemetry.shutdownPosthogClient(); + SentryLogger.shutdownSentryClient(); } diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index fef0e4ba7..f0af9770d 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -1,4 +1,5 @@ import crypto from "crypto"; +import { EventEmitter as NodeEventEmitter } from "node:events"; import { AuthType, @@ -7,8 +8,8 @@ import { isHubEnv, } from "core/control-plane/AuthTypes"; import { getControlPlaneEnvSync } from "core/control-plane/env"; +import { Logger } from "core/util/Logger"; import fetch from "node-fetch"; -import { EventEmitter as NodeEventEmitter } from "node:events"; import { v4 as uuidv4 } from "uuid"; import { authentication, @@ -121,6 +122,13 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { ); return decodedToken; } catch (e: any) { + // Capture JWT decoding failures to Sentry (could indicate token corruption) + Logger.error(e, { + context: "workOS_auth_jwt_decode", + jwtLength: jwt.length, + jwtPrefix: jwt.substring(0, 20) + "...", // Safe prefix for debugging + }); + console.warn(`Error decoding JWT: ${e}`); return null; } @@ -162,6 +170,12 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { const value = JSON.parse(data) as ContinueAuthenticationSession[]; return value; } catch (e: any) { + // Capture session file parsing errors to Sentry + Logger.error(e, { + context: "workOS_sessions_json_parse", + dataLength: data.length, + }); + console.warn(`Error parsing sessions.json: ${e}`); return []; } @@ -200,6 +214,12 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { this._isRefreshing = true; await this._refreshSessions(); } catch (e) { + // Capture session refresh failures to Sentry + Logger.error(e, { + context: "workOS_auth_session_refresh", + authType: controlPlaneEnv.AUTH_TYPE, + }); + console.error(`Error refreshing sessions: ${e}`); } finally { this._isRefreshing = false; @@ -228,6 +248,12 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { expiresInMs: newSession.expiresInMs, }); } catch (e: any) { + // Capture individual session refresh failures to Sentry + Logger.error(e, { + context: "workOS_individual_session_refresh", + sessionId: session.id, + }); + // If refresh fails (after retries for valid tokens), drop the session console.debug(`Error refreshing session token: ${e.message}`); this._sessionChangeEmitter.fire({ @@ -258,6 +284,16 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { try { return await this._refreshSession(refreshToken); } catch (error: any) { + // Capture token refresh retry errors to Sentry + Logger.error(error, { + attempt, + errorMessage: error.message, + isAuthError: + error.message?.includes("401") || + error.message?.includes("Invalid refresh token") || + error.message?.includes("Unauthorized"), + }); + this.attemptEmitter.emit("attempted"); // Don't retry for auth errors if ( @@ -374,6 +410,13 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { return session; } catch (e) { + // Capture authentication failures to Sentry + Logger.error(e, { + context: "workOS_auth_session_creation", + scopes: scopes.join(","), + authType: controlPlaneEnv.AUTH_TYPE, + }); + void window.showErrorMessage(`Sign in failed: ${e}`); throw e; } diff --git a/gui/.gitignore b/gui/.gitignore index bc243e19d..2364947db 100644 --- a/gui/.gitignore +++ b/gui/.gitignore @@ -24,4 +24,6 @@ dist-ssr *.sw? # test result files -coverage \ No newline at end of file +coverage +# Sentry Config File +.env.sentry-build-plugin diff --git a/gui/package-lock.json b/gui/package-lock.json index ce7be87e5..e5ebbb9bb 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -12,6 +12,8 @@ "@heroicons/react": "^2.0.18", "@panzoom/panzoom": "^4.6.0", "@reduxjs/toolkit": "^2.3.0", + "@sentry/react": "^9.43.0", + "@sentry/vite-plugin": "^4.0.2", "@tiptap/core": "^2.3.2", "@tiptap/extension-document": "^2.3.2", "@tiptap/extension-dropcursor": "^2.1.16", @@ -73,8 +75,8 @@ "@swc/cli": "^0.3.14", "@swc/core": "^1.7.26", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.5.0", - "@testing-library/react": "^16.0.1", + "@testing-library/jest-dom": "^6.6.4", + "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^14.5.2", "@types/dompurify": "^3.2.0", "@types/lodash": "^4.17.6", @@ -122,6 +124,11 @@ "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", + "@sentry/cli": "^2.50.2", + "@sentry/core": "^9.43.0", + "@sentry/esbuild-plugin": "^4.0.2", + "@sentry/node": "^9.43.0", + "@sentry/vite-plugin": "^4.0.2", "@typescript-eslint/eslint-plugin": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", @@ -332,7 +339,6 @@ "version": "7.25.4", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz", "integrity": "sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -341,7 +347,6 @@ "version": "7.25.2", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz", "integrity": "sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==", - "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.24.7", @@ -371,7 +376,6 @@ "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "peer": true, "bin": { "semver": "bin/semver.js" } @@ -405,7 +409,6 @@ "version": "7.25.2", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz", "integrity": "sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==", - "peer": true, "dependencies": { "@babel/compat-data": "^7.25.2", "@babel/helper-validator-option": "^7.24.8", @@ -421,7 +424,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "peer": true, "dependencies": { "yallist": "^3.0.2" } @@ -430,7 +432,6 @@ "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "peer": true, "bin": { "semver": "bin/semver.js" } @@ -438,8 +439,7 @@ "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "peer": true + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/@babel/helper-module-imports": { "version": "7.24.7", @@ -457,7 +457,6 @@ "version": "7.25.2", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz", "integrity": "sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==", - "peer": true, "dependencies": { "@babel/helper-module-imports": "^7.24.7", "@babel/helper-simple-access": "^7.24.7", @@ -483,7 +482,6 @@ "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", - "peer": true, "dependencies": { "@babel/traverse": "^7.24.7", "@babel/types": "^7.24.7" @@ -514,7 +512,6 @@ "version": "7.24.8", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -524,7 +521,6 @@ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "license": "MIT", - "peer": true, "dependencies": { "@babel/template": "^7.26.9", "@babel/types": "^7.26.10" @@ -2327,6 +2323,398 @@ "win32" ] }, + "node_modules/@sentry-internal/browser-utils": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-9.43.0.tgz", + "integrity": "sha512-DLv10USYC0w+2ap5GlxlBYTe5dTylzFZB6WHi3kpuYpjUwdye8/G88K8ZDqdMFr73XUFDxRJbOihXOb0vDQNRQ==", + "license": "MIT", + "dependencies": { + "@sentry/core": "9.43.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry-internal/feedback": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-9.43.0.tgz", + "integrity": "sha512-yAZvSB/85jZT9bZf/NOXYh8+CkUIqPfPma4b3Kvq6QZE2Xp/WP80YvZHgoh+KA5gSK0d3uAqkSdj0cQF9wpGEg==", + "license": "MIT", + "dependencies": { + "@sentry/core": "9.43.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry-internal/replay": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-9.43.0.tgz", + "integrity": "sha512-I9kQfoSiVq8zzCzfJAlBGFZftIKZxFX9Hv4M+jskzoCQwTfcGWY5qmGyX+KEzLAI/39onV7S1p8x/iAVlSICuA==", + "license": "MIT", + "dependencies": { + "@sentry-internal/browser-utils": "9.43.0", + "@sentry/core": "9.43.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry-internal/replay-canvas": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-9.43.0.tgz", + "integrity": "sha512-cs1yClG5bwL1+lMn2i9v8UiuWiBbu7OS+pD9xePjNYNWywRU0JJ9mTNC2HPP7ic9kDr7vDZy2hRNaDd2IDgF4g==", + "license": "MIT", + "dependencies": { + "@sentry-internal/replay": "9.43.0", + "@sentry/core": "9.43.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry/babel-plugin-component-annotate": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-4.0.2.tgz", + "integrity": "sha512-Nr/VamvpQs6w642EI5t+qaCUGnVEro0qqk+S8XO1gc8qSdpc8kkZJFnUk7ozAr+ljYWGfVgWXrxI9lLiriLsRA==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/browser": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-9.43.0.tgz", + "integrity": "sha512-F+zMc+ratJ1MqV9YQqkrHqC+rED3meWHgO7+C6bYG5HPynCYqIGapJFNmFFC57pbU8lT191CiMgBWYT6DuMduw==", + "license": "MIT", + "dependencies": { + "@sentry-internal/browser-utils": "9.43.0", + "@sentry-internal/feedback": "9.43.0", + "@sentry-internal/replay": "9.43.0", + "@sentry-internal/replay-canvas": "9.43.0", + "@sentry/core": "9.43.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry/bundler-plugin-core": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/bundler-plugin-core/-/bundler-plugin-core-4.0.2.tgz", + "integrity": "sha512-LeARs8qHhEw19tk+KZd9DDV+Rh/UeapIH0+C09fTmff9p8Y82Cj89pEQ2a1rdUiF/oYIjQX45vnZscB7ra42yw==", + "license": "MIT", + "dependencies": { + "@babel/core": "^7.18.5", + "@sentry/babel-plugin-component-annotate": "4.0.2", + "@sentry/cli": "^2.49.0", + "dotenv": "^16.3.1", + "find-up": "^5.0.0", + "glob": "^9.3.2", + "magic-string": "0.30.8", + "unplugin": "1.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/glob": { + "version": "9.3.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz", + "integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "minimatch": "^8.0.2", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/magic-string": { + "version": "0.30.8", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", + "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/minimatch": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz", + "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@sentry/bundler-plugin-core/node_modules/minipass": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", + "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/cli": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.50.2.tgz", + "integrity": "sha512-m1L9shxutF3WHSyNld6Y1vMPoXfEyQhoRh1V3SYSdl+4AB40U+zr2sRzFa2OPm7XP4zYNaWuuuHLkY/iHITs8Q==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.7", + "progress": "^2.0.3", + "proxy-from-env": "^1.1.0", + "which": "^2.0.2" + }, + "bin": { + "sentry-cli": "bin/sentry-cli" + }, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@sentry/cli-darwin": "2.50.2", + "@sentry/cli-linux-arm": "2.50.2", + "@sentry/cli-linux-arm64": "2.50.2", + "@sentry/cli-linux-i686": "2.50.2", + "@sentry/cli-linux-x64": "2.50.2", + "@sentry/cli-win32-arm64": "2.50.2", + "@sentry/cli-win32-i686": "2.50.2", + "@sentry/cli-win32-x64": "2.50.2" + } + }, + "node_modules/@sentry/cli-darwin": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.50.2.tgz", + "integrity": "sha512-0Pjpl0vQqKhwuZm19z6AlEF+ds3fJg1KWabv8WzGaSc/fwxMEwjFwOZj+IxWBJPV578cXXNvB39vYjjpCH8j7A==", + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.50.2.tgz", + "integrity": "sha512-jzFwg9AeeuFAFtoCcyaDEPG05TU02uOy1nAX09c1g7FtsyQlPcbhI94JQGmnPzdRjjDmORtwIUiVZQrVTkDM7w==", + "cpu": [ + "arm" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.50.2.tgz", + "integrity": "sha512-03Cj215M3IdoHAwevCxm5oOm9WICFpuLR05DQnODFCeIUsGvE1pZsc+Gm0Ky/ZArq2PlShBJTpbHvXbCUka+0w==", + "cpu": [ + "arm64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-i686": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.50.2.tgz", + "integrity": "sha512-J+POvB34uVyHbIYF++Bc/OCLw+gqKW0H/y/mY7rRZCiocgpk266M4NtsOBl6bEaurMx1D+BCIEjr4nc01I/rqA==", + "cpu": [ + "x86", + "ia32" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-x64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.50.2.tgz", + "integrity": "sha512-81yQVRLj8rnuHoYcrM7QbOw8ubA3weiMdPtTxTim1s6WExmPgnPTKxLCr9xzxGJxFdYo3xIOhtf5JFpUX/3j4A==", + "cpu": [ + "x64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd", + "android" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-arm64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.50.2.tgz", + "integrity": "sha512-QjentLGvpibgiZlmlV9ifZyxV73lnGH6pFZWU5wLeRiaYKxWtNrrHpVs+HiWlRhkwQ0mG1/S40PGNgJ20DJ3gA==", + "cpu": [ + "arm64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-i686": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.50.2.tgz", + "integrity": "sha512-UkBIIzkQkQ1UkjQX8kHm/+e7IxnEhK6CdgSjFyNlxkwALjDWHJjMztevqAPz3kv4LdM6q1MxpQ/mOqXICNhEGg==", + "cpu": [ + "x86", + "ia32" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-x64": { + "version": "2.50.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.50.2.tgz", + "integrity": "sha512-tE27pu1sRRub1Jpmemykv3QHddBcyUk39Fsvv+n4NDpQyMgsyVPcboxBZyby44F0jkpI/q3bUH2tfCB1TYDNLg==", + "cpu": [ + "x64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/@sentry/cli/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@sentry/cli/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@sentry/core": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-9.43.0.tgz", + "integrity": "sha512-xuvERSUkSNBAldIlgihX3fz+JkcaAPvg0HulPtv3BH9qrKqvataeQ8TiTnqiRC7kWzF7EcxhQJ6WJRl/r3aH3w==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@sentry/react": { + "version": "9.43.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-9.43.0.tgz", + "integrity": "sha512-bDJ1piXH1IPzyPypxnw/hWUVKk5xgeOKVvYJEFO9ypACKDpitgsskl7QasAmxKd1ghvbULgYksyUy5Zpaiu2cg==", + "license": "MIT", + "dependencies": { + "@sentry/browser": "9.43.0", + "@sentry/core": "9.43.0", + "hoist-non-react-statics": "^3.3.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "react": "^16.14.0 || 17.x || 18.x || 19.x" + } + }, + "node_modules/@sentry/vite-plugin": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@sentry/vite-plugin/-/vite-plugin-4.0.2.tgz", + "integrity": "sha512-rStdvDGj0VcJBsl2NANE3OQF5m13VCJ+2Ovs5pb2LAqOW72/1GLmef9Mo3b9BwzCjWOQIcgtllwOfSV5Pse03w==", + "license": "MIT", + "dependencies": { + "@sentry/bundler-plugin-core": "4.0.2", + "unplugin": "1.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/@sindresorhus/is": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", @@ -2726,17 +3114,18 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.5.0.tgz", - "integrity": "sha512-xGGHpBXYSHUUr6XsKBfs85TWlYKpTc37cSBBVrXcib2MkHLboWlkClhWF37JKlDb9KEq3dHs+f2xR7XJEWGBxA==", + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.4.tgz", + "integrity": "sha512-xDXgLjVunjHqczScfkCJ9iyjdNOVHvvCdqHSSxwM9L0l/wHkTRum67SDc020uAlCoqktJplgO2AAQeLP1wgqDQ==", "dev": true, + "license": "MIT", "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", - "chalk": "^3.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "lodash": "^4.17.21", + "picocolors": "^1.1.1", "redent": "^3.0.0" }, "engines": { @@ -2745,84 +3134,18 @@ "yarn": ">=1" } }, - "node_modules/@testing-library/jest-dom/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@testing-library/jest-dom/node_modules/chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@testing-library/jest-dom/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@testing-library/jest-dom/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", "dev": true }, - "node_modules/@testing-library/jest-dom/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@testing-library/jest-dom/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@testing-library/react": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.0.1.tgz", - "integrity": "sha512-dSmwJVtJXmku+iocRhWOUFbrERC76TX2Mnf0ATODz8brzAZrMBbzLwQixlBSanZxR6LddK3eiwpSFZgDET1URg==", + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.0.tgz", + "integrity": "sha512-kFSyxiEDwv1WLl2fgsq6pPBbw5aWKrsY2/noi1Id0TK0UParSF62oFQFGHXIyaG4pp2tEub/Zlel+fjjZILDsw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5" }, @@ -2831,10 +3154,10 @@ }, "peerDependencies": { "@testing-library/dom": "^10.0.0", - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", - "react": "^18.0.0", - "react-dom": "^18.0.0" + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -4179,7 +4502,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -4460,8 +4782,7 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/bcp-47-match": { "version": "1.0.3", @@ -4641,7 +4962,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, "engines": { "node": ">=8" }, @@ -4658,7 +4978,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -4667,7 +4986,6 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, "dependencies": { "fill-range": "^7.1.1" }, @@ -4922,7 +5240,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -5028,8 +5345,7 @@ "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "peer": true + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, "node_modules/core": { "resolved": "../core", @@ -5909,6 +6225,18 @@ "@types/trusted-types": "^2.0.7" } }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/downshift": { "version": "7.6.2", "resolved": "https://registry.npmjs.org/downshift/-/downshift-7.6.2.tgz", @@ -6888,7 +7216,6 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -6900,7 +7227,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -7082,14 +7408,12 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -7139,7 +7463,6 @@ "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -7213,7 +7536,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -8182,7 +8504,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -8298,7 +8619,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -8345,7 +8665,6 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -8390,7 +8709,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, "engines": { "node": ">=0.12.0" } @@ -8580,8 +8898,7 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", @@ -8804,7 +9121,6 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "peer": true, "bin": { "json5": "lib/cli.js" }, @@ -8942,7 +9258,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -9928,7 +10243,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -10037,6 +10351,48 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "license": "MIT" }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/node-releases": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", @@ -10046,7 +10402,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -10291,7 +10646,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -10306,7 +10660,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -10386,7 +10739,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, "engines": { "node": ">=8" } @@ -10419,7 +10771,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" @@ -10434,8 +10785,7 @@ "node_modules/path-scurry/node_modules/lru-cache": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" }, "node_modules/pathe": { "version": "1.1.2", @@ -10772,6 +11122,15 @@ "node": ">=6" } }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -10972,6 +11331,12 @@ "prosemirror-transform": "^1.1.0" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -11654,7 +12019,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -13169,7 +13533,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -13619,6 +13982,18 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unplugin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz", + "integrity": "sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==", + "license": "MIT", + "dependencies": { + "acorn": "^8.8.1", + "chokidar": "^3.5.3", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.5.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", @@ -14956,6 +15331,21 @@ "node": ">=12" } }, + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-virtual-modules": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", + "integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==", + "license": "MIT" + }, "node_modules/whatwg-encoding": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", @@ -15322,7 +15712,6 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, "engines": { "node": ">=10" }, diff --git a/gui/package.json b/gui/package.json index ce5cbb29f..e39d0b658 100644 --- a/gui/package.json +++ b/gui/package.json @@ -21,6 +21,8 @@ "@heroicons/react": "^2.0.18", "@panzoom/panzoom": "^4.6.0", "@reduxjs/toolkit": "^2.3.0", + "@sentry/react": "^9.43.0", + "@sentry/vite-plugin": "^4.0.2", "@tiptap/core": "^2.3.2", "@tiptap/extension-document": "^2.3.2", "@tiptap/extension-dropcursor": "^2.1.16", @@ -82,8 +84,8 @@ "@swc/cli": "^0.3.14", "@swc/core": "^1.7.26", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.5.0", - "@testing-library/react": "^16.0.1", + "@testing-library/jest-dom": "^6.6.4", + "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^14.5.2", "@types/dompurify": "^3.2.0", "@types/lodash": "^4.17.6", diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 719b3edd5..05d21ba8c 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -6,6 +6,7 @@ import { CustomScrollbarDiv } from "."; import { AuthProvider } from "../context/Auth"; import { IdeMessengerContext } from "../context/IdeMessenger"; import { LocalStorageProvider } from "../context/LocalStorage"; +import TelemetryProviders from "../hooks/TelemetryProviders"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { setCodeToEdit } from "../redux/slices/editState"; @@ -26,6 +27,7 @@ import { } from "./OnboardingCard"; import OSRContextMenu from "./OSRContextMenu"; import PostHogPageView from "./PosthogPageView"; +import { FatalErrorIndicator } from "./config/FatalErrorNotice"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; @@ -245,45 +247,48 @@ const Layout = () => { return ( - - {showStagingIndicator && ( - - )} - - -
- { - dispatch(setShowDialog(false)); + + + {showStagingIndicator && ( + { - dispatch(setShowDialog(false)); - }} - message={dialogMessage} /> + )} + + +
+ { + dispatch(setShowDialog(false)); + }} + onClose={() => { + dispatch(setShowDialog(false)); + }} + message={dialogMessage} + /> - - - - -
-
- - + + + + + +
+
+ + + ); diff --git a/gui/src/hooks/CustomPostHogProvider.tsx b/gui/src/hooks/CustomPostHogProvider.tsx deleted file mode 100644 index 9f2c722b2..000000000 --- a/gui/src/hooks/CustomPostHogProvider.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import posthog from "posthog-js"; -import { PostHogProvider } from "posthog-js/react"; -import { PropsWithChildren, useEffect } from "react"; -import { useAppSelector } from "../redux/hooks"; - -const CustomPostHogProvider = ({ children }: PropsWithChildren) => { - const allowAnonymousTelemetry = useAppSelector( - (store) => store?.config?.config?.allowAnonymousTelemetry, - ); - - useEffect(() => { - if (allowAnonymousTelemetry) { - posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", { - api_host: "https://app.posthog.com", - disable_session_recording: true, - autocapture: false, - // // We need to manually track pageviews since we're a SPA - capture_pageleave: false, - capture_pageview: false, - }); - posthog.identify(window.vscMachineId); - posthog.opt_in_capturing(); - } else { - posthog.opt_out_capturing(); - } - }, [allowAnonymousTelemetry]); - - return {children}; -}; - -export default CustomPostHogProvider; diff --git a/gui/src/hooks/TelemetryProviders.test.tsx b/gui/src/hooks/TelemetryProviders.test.tsx new file mode 100644 index 000000000..62ec772b0 --- /dev/null +++ b/gui/src/hooks/TelemetryProviders.test.tsx @@ -0,0 +1,306 @@ +import { createStore } from "@reduxjs/toolkit"; +import * as Sentry from "@sentry/react"; +import { render, screen } from "@testing-library/react"; +import posthog from "posthog-js"; +import React from "react"; +import { Provider } from "react-redux"; +import { PersistGate } from "redux-persist/integration/react"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { AuthProvider } from "../context/Auth"; +import TelemetryProviders from "./TelemetryProviders"; + +// Mock Sentry +vi.mock("@sentry/react", () => ({ + init: vi.fn(), + setUser: vi.fn(), + getClient: vi.fn(), + getCurrentScope: vi.fn(() => ({ + clear: vi.fn(), + })), + browserTracingIntegration: vi.fn(() => ({ name: "BrowserTracing" })), + replayIntegration: vi.fn(() => ({ name: "Replay" })), + feedbackIntegration: vi.fn(() => ({ name: "Feedback" })), + contextLinesIntegration: vi.fn(() => ({ name: "ContextLines" })), + ErrorBoundary: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), +})); + +// Mock PostHog +vi.mock("posthog-js", () => ({ + default: { + init: vi.fn(), + identify: vi.fn(), + opt_in_capturing: vi.fn(), + opt_out_capturing: vi.fn(), + }, +})); + +// Mock PostHog React provider +vi.mock("posthog-js/react", () => ({ + PostHogProvider: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), +})); + +// Mock the Auth context +vi.mock("../context/Auth", () => ({ + AuthProvider: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), + useAuth: () => ({ + session: { + account: { + id: "test@continue.dev", // Mock Continue team member email + }, + }, + }), +})); + +// Mock isContinueTeamMember utility +vi.mock("../util/isContinueTeamMember", () => ({ + isContinueTeamMember: vi.fn(() => true), // Mock as Continue team member +})); + +// Mock window.vscMachineId +Object.defineProperty(window, "vscMachineId", { + value: "test-machine-id", + writable: true, +}); + +// Create a minimal Redux store for testing +const createTestStore = (allowAnonymousTelemetry: boolean) => { + return createStore( + ( + state = { + config: { + config: { + allowAnonymousTelemetry, + }, + }, + }, + ) => state, + ); +}; + +// Mock persistor +const mockPersistor = { + persist: vi.fn(), + purge: vi.fn(), + flush: vi.fn(), + pause: vi.fn(), + getState: vi.fn(() => ({ + bootstrapped: true, + registry: [], + })), + dispatch: vi.fn(), + subscribe: vi.fn(), +}; + +const TestWrapper: React.FC<{ + children: React.ReactNode; + allowAnonymousTelemetry: boolean; +}> = ({ children, allowAnonymousTelemetry }) => { + const store = createTestStore(allowAnonymousTelemetry); + + return ( + + + {children} + + + ); +}; + +describe("TelemetryProviders", () => { + const mockSentry = Sentry as any; + const mockPosthog = posthog as any; + + beforeEach(() => { + vi.clearAllMocks(); + // Reset NODE_ENV to test + process.env.NODE_ENV = "test"; + }); + + afterEach(() => { + vi.clearAllMocks(); + }); + + describe("when telemetry is enabled", () => { + it("should initialize both PostHog and Sentry", () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + render( + + +
Test Child
+
+
, + ); + + // Verify PostHog initialization + expect(mockPosthog.init).toHaveBeenCalledWith( + "phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", + expect.objectContaining({ + api_host: "https://app.posthog.com", + disable_session_recording: true, + autocapture: false, + capture_pageleave: false, + capture_pageview: false, + }), + ); + expect(mockPosthog.identify).toHaveBeenCalledWith("test-machine-id"); + expect(mockPosthog.opt_in_capturing).toHaveBeenCalled(); + + // Verify Sentry initialization + expect(mockSentry.init).toHaveBeenCalledWith( + expect.objectContaining({ + dsn: "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016", + environment: "development", + tracesSampleRate: 0.25, + }), + ); + expect(mockSentry.setUser).toHaveBeenCalledWith({ + id: expect.stringMatching(/^[a-f0-9]{8}$/), // Should be 8-char hash + email: undefined, + username: undefined, + ip_address: undefined, + }); + + // Verify children are rendered + expect(screen.getByTestId("test-child")).toBeInTheDocument(); + expect(screen.getByTestId("posthog-provider")).toBeInTheDocument(); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("when telemetry is disabled", () => { + it("should disable PostHog and clear Sentry scope", () => { + const mockClear = vi.fn(); + const mockClose = vi.fn(); + const mockClient = { close: mockClose }; + + mockSentry.getCurrentScope.mockReturnValue({ clear: mockClear }); + mockSentry.getClient.mockReturnValue(mockClient); + + render( + + +
Test Child
+
+
, + ); + + // Verify PostHog is disabled + expect(mockPosthog.opt_out_capturing).toHaveBeenCalled(); + expect(mockPosthog.init).not.toHaveBeenCalled(); + expect(mockPosthog.identify).not.toHaveBeenCalled(); + expect(mockPosthog.opt_in_capturing).not.toHaveBeenCalled(); + + // Verify Sentry is properly disabled + expect(mockSentry.getClient).toHaveBeenCalled(); + expect(mockClose).toHaveBeenCalled(); + expect(mockSentry.getCurrentScope).toHaveBeenCalled(); + expect(mockClear).toHaveBeenCalled(); + expect(mockSentry.init).not.toHaveBeenCalled(); + expect(mockSentry.setUser).not.toHaveBeenCalled(); + + // Verify children are still rendered + expect(screen.getByTestId("test-child")).toBeInTheDocument(); + expect(screen.getByTestId("posthog-provider")).toBeInTheDocument(); + }); + }); + + describe("provider structure", () => { + it("should wrap children with PostHogProvider", () => { + render( + + +
+ Deep content +
+
+
, + ); + + // Verify the provider structure is maintained + expect(screen.getByTestId("posthog-provider")).toBeInTheDocument(); + expect(screen.getByTestId("nested-child")).toBeInTheDocument(); + expect(screen.getByTestId("deeply-nested")).toBeInTheDocument(); + }); + + it("should handle missing vscMachineId gracefully", () => { + // Temporarily modify vscMachineId + const originalMachineId = window.vscMachineId; + (window as any).vscMachineId = undefined; + + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + render( + + +
Test Child
+
+
, + ); + + // Should still initialize but with anonymized ID (hashed "anonymous") + expect(mockSentry.setUser).toHaveBeenCalledWith({ + id: expect.stringMatching(/^[a-f0-9]{8}$/), // Should be 8-char hash + email: undefined, + username: undefined, + ip_address: undefined, + }); + + // Restore + (window as any).vscMachineId = originalMachineId; + process.env.NODE_ENV = originalNodeEnv; + }); + }); + + describe("telemetry toggle behavior", () => { + it("should maintain proper state when telemetry setting changes", () => { + const originalNodeEnv = process.env.NODE_ENV; + process.env.NODE_ENV = "development"; + + // First render with telemetry enabled + const { rerender } = render( + + +
Test Child
+
+
, + ); + + expect(mockSentry.init).toHaveBeenCalled(); + expect(mockPosthog.opt_in_capturing).toHaveBeenCalled(); + + // Clear mocks and rerender with telemetry disabled + vi.clearAllMocks(); + const mockClear = vi.fn(); + const mockClose = vi.fn(); + const mockClient = { close: mockClose }; + + mockSentry.getCurrentScope.mockReturnValue({ clear: mockClear }); + mockSentry.getClient.mockReturnValue(mockClient); + + rerender( + + +
Test Child
+
+
, + ); + + expect(mockPosthog.opt_out_capturing).toHaveBeenCalled(); + expect(mockClose).toHaveBeenCalled(); + expect(mockClear).toHaveBeenCalled(); + expect(mockSentry.init).not.toHaveBeenCalled(); + + process.env.NODE_ENV = originalNodeEnv; + }); + }); +}); diff --git a/gui/src/hooks/TelemetryProviders.tsx b/gui/src/hooks/TelemetryProviders.tsx new file mode 100644 index 000000000..1747ecd9b --- /dev/null +++ b/gui/src/hooks/TelemetryProviders.tsx @@ -0,0 +1,126 @@ +import * as Sentry from "@sentry/react"; +import { HubSessionInfo } from "core/control-plane/AuthTypes"; +import { + anonymizeSentryEvent, + anonymizeUserInfo, +} from "core/util/sentry/anonymization"; +import { SENTRY_DSN } from "core/util/sentry/constants"; +import posthog from "posthog-js"; +import { PostHogProvider } from "posthog-js/react"; +import { PropsWithChildren, useEffect } from "react"; +import { useAuth } from "../context/Auth"; +import { useAppSelector } from "../redux/hooks"; +import { isPrerelease } from "../util/index"; +import { isContinueTeamMember } from "../util/isContinueTeamMember"; +import { getLocalStorage } from "../util/localStorage"; + +const SAMPLE_REATE = 0.1; +const TRACES_SAMPLE_RATE = 0.25; + +const TelemetryProviders = ({ children }: PropsWithChildren) => { + const allowAnonymousTelemetry = useAppSelector( + (store) => store?.config?.config?.allowAnonymousTelemetry, + ); + const { session } = useAuth(); + + // TODO: Remove Continue team member check once Sentry is ready for all users + const hasContinueEmail = isContinueTeamMember( + (session as HubSessionInfo)?.account?.id, + ); + + useEffect(() => { + if (allowAnonymousTelemetry && hasContinueEmail) { + // Initialize PostHog (existing logic) + posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", { + api_host: "https://app.posthog.com", + disable_session_recording: true, + autocapture: false, + // We need to manually track pageviews since we're a SPA + capture_pageleave: false, + capture_pageview: false, + }); + posthog.identify(window.vscMachineId); + posthog.opt_in_capturing(); + + // Initialize Sentry (new for GUI - enhanced React setup) + Sentry.init({ + dsn: SENTRY_DSN, + environment: process.env.NODE_ENV, + integrations: [ + // Performance monitoring + Sentry.browserTracingIntegration(), + ], + + // For basic error tracking, a lower sample rate should be fine + sampleRate: SAMPLE_REATE, + tracesSampleRate: TRACES_SAMPLE_RATE, + + // Privacy-conscious default + sendDefaultPii: false, + + // Strip sensitive data and add basic properties + beforeSend(event) { + // Apply comprehensive anonymization using shared logic + const anonymizedEvent = anonymizeSentryEvent(event); + if (!anonymizedEvent) return null; + + // Add basic properties available in GUI environment + if (!anonymizedEvent.tags) anonymizedEvent.tags = {}; + + // Add environment information + anonymizedEvent.tags.environment = process.env.NODE_ENV; + + // Add ideInfo properties spread out as top-level properties (like PostHog) + const extensionVersion = getLocalStorage("extensionVersion"); + const ideType = getLocalStorage("ide"); + + if (extensionVersion) { + anonymizedEvent.tags.extensionVersion = extensionVersion; + } + + if (ideType) { + anonymizedEvent.tags.ideType = ideType; + } + + // Add isPrerelease information + anonymizedEvent.tags.isPrerelease = isPrerelease(); + + return anonymizedEvent; + }, + }); + + // Set anonymized user context for Sentry + const anonymizedUser = anonymizeUserInfo({ + id: window.vscMachineId || "anonymous", + }); + Sentry.setUser(anonymizedUser); + } else { + // Disable PostHog + posthog.opt_out_capturing(); + + // Disable Sentry properly - close the client to stop all network requests + try { + const client = Sentry.getClient(); + if (client) { + client.close(); + } + Sentry.getCurrentScope().clear(); + } catch (error) { + console.error("Error disabling Sentry:", error); + } + } + }, [allowAnonymousTelemetry, hasContinueEmail]); + + // Conditionally wrap with ErrorBoundary when telemetry is enabled and user is Continue team member + const content = + allowAnonymousTelemetry && hasContinueEmail ? ( + {children} + ) : ( + children + ); + + // Only PostHog needs a provider wrapper - Sentry works globally once initialized + return {content}; +}; + +export default TelemetryProviders; diff --git a/gui/src/main.tsx b/gui/src/main.tsx index f13e5fbbe..abe17875a 100644 --- a/gui/src/main.tsx +++ b/gui/src/main.tsx @@ -3,18 +3,20 @@ import ReactDOM from "react-dom/client"; import { Provider } from "react-redux"; import { PersistGate } from "redux-persist/integration/react"; import App from "./App"; -import CustomPostHogProvider from "./hooks/CustomPostHogProvider"; import "./index.css"; import { persistor, store } from "./redux/store"; (async () => { - ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( + const container = document.getElementById("root") as HTMLElement; + + // Create React root + const root = ReactDOM.createRoot(container); + + root.render( - - - + , diff --git a/gui/src/pages/config/UserSettingsForm.tsx b/gui/src/pages/config/UserSettingsForm.tsx index 28ab1947a..a27e58230 100644 --- a/gui/src/pages/config/UserSettingsForm.tsx +++ b/gui/src/pages/config/UserSettingsForm.tsx @@ -21,6 +21,7 @@ import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { updateConfig } from "../../redux/slices/configSlice"; import { selectCurrentOrg } from "../../redux/slices/profilesSlice"; +import { isContinueTeamMember } from "../../util/isContinueTeamMember"; import { setLocalStorage } from "../../util/localStorage"; import { ContinueFeaturesMenu } from "./ContinueFeaturesMenu"; @@ -132,8 +133,8 @@ export function UserSettingsForm() { }); }, [ideMessenger]); - const hasContinueEmail = (session as HubSessionInfo)?.account?.id.includes( - "@continue.dev", + const hasContinueEmail = isContinueTeamMember( + (session as HubSessionInfo)?.account?.id, ); const disableTelemetryToggle = diff --git a/gui/src/util/isContinueTeamMember.ts b/gui/src/util/isContinueTeamMember.ts new file mode 100644 index 000000000..19bacd471 --- /dev/null +++ b/gui/src/util/isContinueTeamMember.ts @@ -0,0 +1,7 @@ +/** + * Utility to check if a user is a Continue team member + */ +export function isContinueTeamMember(email?: string): boolean { + if (!email) return false; + return email.includes("@continue.dev"); +} diff --git a/gui/vite.config.ts b/gui/vite.config.ts index 7f54477ba..a8236ca99 100644 --- a/gui/vite.config.ts +++ b/gui/vite.config.ts @@ -1,3 +1,4 @@ +import { sentryVitePlugin } from "@sentry/vite-plugin"; import react from "@vitejs/plugin-react-swc"; import { resolve } from "path"; import tailwindcss from "tailwindcss"; @@ -5,8 +6,17 @@ import { defineConfig } from "vitest/config"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), tailwindcss()], + plugins: [ + react(), + tailwindcss(), + sentryVitePlugin({ + org: "continue-xd", + project: "continue", + }), + ], build: { + sourcemap: true, + // Change the output .js filename to not include a hash rollupOptions: { input: { From 82545990cb55307a7dfc24a563d19eba812f523a Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 08:19:10 -0700 Subject: [PATCH 151/174] fix: prompt --- .github/workflows/continue-detailed-review.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index bbad06f21..5822306c2 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -131,7 +131,8 @@ jobs: - Only comment on actual problems or important improvements Important: - - Output ONLY valid JSON, no additional text + - Output ONLY valid JSON, no markdown code blocks or backticks + - Start your response with { and end with } - Use the exact number from [POS:N] markers as the position - Only comment on changed lines (lines with + or - prefix) - Comment on the most important issues first From 8304a5e34f930127030e3cccc9294ea4176fd976 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 08:30:05 -0700 Subject: [PATCH 152/174] improv: use reusable gh action --- .../workflows/continue-detailed-review.yaml | 275 +------------- pr-review-action/detailed-review/action.yml | 354 ++++++++++++++++++ 2 files changed, 359 insertions(+), 270 deletions(-) create mode 100644 pr-review-action/detailed-review/action.yml diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 5822306c2..19c7a2722 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -32,274 +32,9 @@ jobs: github.event.comment.author_association == 'COLLABORATOR')) steps: - - name: Checkout Repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Run Detailed PR Review + uses: continuedev/continue/pr-review-action/detailed-review@tomasz/con-3480 with: - node-version: 20 - - - name: Install Continue CLI - run: npm install -g @continuedev/cli@1.4.25 - - - name: Build Inline Review Prompt - run: | - # Get PR number based on event type - if [ "${{ github.event_name }}" = "pull_request" ]; then - PR_NUMBER="${{ github.event.number }}" - else - # For issue_comment event on a PR - PR_NUMBER="${{ github.event.issue.number }}" - fi - - # Get PR files with line numbers - gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files > pr_files.json - - # Get PR diff with context - gh pr diff $PR_NUMBER --color=never > pr_diff.txt - - # Annotate diff with GitHub API positions - node ${{ github.workspace }}/pr-review-action/scripts/annotate-diff.js pr_diff.txt > pr_diff_annotated.txt - - # Debug: Show sample of annotated diff - echo "=== SAMPLE OF ANNOTATED DIFF ===" - head -100 pr_diff_annotated.txt | grep -E "^\[POS:|^@@|^diff --git" || head -50 pr_diff_annotated.txt - echo "=== END SAMPLE ===" - - # Create review prompt for inline comments - cat > inline_review_prompt.txt << 'EOF' - You are conducting a detailed inline code review for a pull request. - - Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. - - IMPORTANT: The diff below has been annotated with [POS:N] markers showing the exact position for each line. - - Example of how to use the position markers: - ``` - diff --git a/src/app.js b/src/app.js - index abc123..def456 100644 - --- a/src/app.js - +++ b/src/app.js - @@ -10,4 +10,6 @@ function example() { - [POS:1] console.log("context"); - [POS:2] - const old = "remove this"; - [POS:3] + const new = "add this"; - [POS:4] + const risky = eval(userInput); <-- To comment here, use position: 4 - [POS:5] return result; - [POS:6] + console.log("done"); - @@ -20,3 +22,4 @@ function another() { - [POS:1] let x = 1; - [POS:2] + let y = 2; <-- To comment here, use position: 2 - ``` - - To comment on a line, simply use the number from its [POS:N] marker as the position value. - For example: {"path": "src/app.js", "position": 4, "body": "Avoid using eval with user input"} - - Below is the annotated PR diff: - - EOF - - cat pr_diff_annotated.txt >> inline_review_prompt.txt - - cat >> inline_review_prompt.txt << 'EOF' - - Please analyze these changes and provide inline review comments in the following JSON format: - - { - "review_summary": "Overall assessment of the PR", - "comments": [ - { - "path": "path/to/file.js", - "position": 4, - "body": "Brief, specific comment about this line or section" - } - ] - } - - Focus on: - 1. **Critical Issues**: Security vulnerabilities, bugs that will break functionality - 2. **High Priority**: Performance problems, incorrect logic, missing error handling - 3. **Medium Priority**: Code style violations, potential edge cases, unclear code - 4. **Low Priority**: Suggestions for improvement, refactoring opportunities - - Guidelines for comments: - - Be specific and actionable - - Use the [POS:N] number shown in the diff as the position value - - Keep comments concise but informative - - Suggest concrete improvements when pointing out issues - - Only comment on actual problems or important improvements - - Important: - - Output ONLY valid JSON, no markdown code blocks or backticks - - Start your response with { and end with } - - Use the exact number from [POS:N] markers as the position - - Only comment on changed lines (lines with + or - prefix) - - Comment on the most important issues first - - Limit to maximum 20 most relevant comments - EOF - env: - GH_TOKEN: ${{ github.token }} - - - name: Run Continue CLI Inline Review - run: | - echo "Running Continue CLI for inline review..." - - # Log the prompt for debugging - echo "===== START REVIEW PROMPT =====" - head -n 50 inline_review_prompt.txt - echo "... [diff content] ..." - tail -n 20 inline_review_prompt.txt - echo "===== END REVIEW PROMPT =====" - - # Run the CLI and capture JSON output - cat inline_review_prompt.txt | cn --readonly --format json --org continuedev --config continuedev/review-bot -p > inline_review_raw.json - - # Log the output for debugging - echo "Initial Continue CLI output:" - cat inline_review_raw.json - - # Validate JSON output - if ! jq empty inline_review_raw.json 2>/dev/null; then - echo "Invalid JSON output from Continue CLI" - echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json - else - # Positions are already correct from our annotation - cp inline_review_raw.json inline_review.json - echo "Review output:" - cat inline_review.json - fi - env: - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} - - - name: Post Inline Review Comments - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - - try { - // Read the review output - let reviewData; - try { - const reviewContent = fs.readFileSync('inline_review.json', 'utf8'); - reviewData = JSON.parse(reviewContent); - } catch (parseError) { - console.log('Failed to parse review JSON:', parseError); - reviewData = { - review_summary: 'AI review completed but failed to parse output', - comments: [] - }; - } - - // Get PR number - let prNumber; - if (context.eventName === 'pull_request') { - prNumber = context.payload.pull_request.number; - } else { - prNumber = context.payload.issue.number; - } - - // Get the latest commit SHA - const { data: pr } = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: prNumber - }); - - const commitSha = pr.head.sha; - - // Prepare review comments - filter out comments without required fields - const allComments = reviewData.comments || []; - const validComments = allComments.filter(comment => - comment.position && - comment.path && - comment.body && - typeof comment.position === 'number' && - comment.position > 0 - ); - - if (validComments.length < allComments.length) { - console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing/invalid position, path, or body`); - const invalidComments = allComments.filter(c => !validComments.includes(c)); - console.log('Invalid comments:', JSON.stringify(invalidComments, null, 2)); - } - - const comments = validComments.map(comment => ({ - path: comment.path, - position: comment.position, - body: comment.body - })); - - // Debug: Log the positions we're trying to use - console.log('Attempting to post comments with positions:'); - comments.forEach(c => { - console.log(` ${c.path}: position ${c.position}`); - }); - - // Create the review - if (comments.length > 0) { - try { - await github.rest.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: prNumber, - commit_id: commitSha, - body: reviewData.review_summary || 'AI Code Review', - event: 'COMMENT', - comments: comments - }); - console.log(`Successfully created review with ${comments.length} inline comments`); - } catch (reviewError) { - console.log('Failed to create review:', reviewError.message); - - // Fallback: post as a regular comment if review creation fails - const fallbackBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n` + - `*Failed to post ${comments.length} inline comments. Please review the changes manually.*`; - - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: fallbackBody - }); - } - } else { - // No inline comments, just post the summary - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*` - }); - } - - // Add triggered by note if from comment - if (context.eventName === 'issue_comment') { - await github.rest.issues.createComment({ - issue_number: prNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: `*Inline review triggered by @${context.payload.comment.user.login}*` - }); - } - - } catch (error) { - console.log('Failed to post review:', error.message); - console.log('Error details:', error); - } - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Upload Review Artifacts - uses: actions/upload-artifact@v4 - if: always() - with: - name: inline-review-results - path: | - inline_review_raw.json - inline_review.json - inline_review_prompt.txt - pr_diff.txt - pr_diff_annotated.txt - retention-days: 7 + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: continuedev + continue-config: continuedev/review-bot \ No newline at end of file diff --git a/pr-review-action/detailed-review/action.yml b/pr-review-action/detailed-review/action.yml new file mode 100644 index 000000000..35ee9495f --- /dev/null +++ b/pr-review-action/detailed-review/action.yml @@ -0,0 +1,354 @@ +name: 'Continue Detailed PR Review' +description: 'Automated inline code review for pull requests using Continue CLI' +author: 'Continue Dev, Inc.' + +inputs: + continue-api-key: + description: 'API key for Continue service' + required: true + continue-org: + description: 'Organization for Continue config' + required: true + continue-config: + description: 'Config path to use (e.g., "myorg/review-bot")' + required: true + +runs: + using: 'composite' + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Check Authorization + shell: bash + env: + # Only move the dangerous check to env to prevent shell injection + HAS_TRIGGER_PHRASE: ${{ contains(github.event.comment.body, '@continue-detailed-review') }} + run: | + # Check if this action should run based on event type and user permissions + SHOULD_RUN="false" + + if [ "${{ github.event_name }}" = "pull_request" ]; then + # Check PR author association + AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}" + if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)" + fi + elif [ "${{ github.event_name }}" = "issue_comment" ]; then + # Check if it's a PR comment with the trigger phrase + if [ "${{ github.event.issue.pull_request }}" != "" ] && [ "$HAS_TRIGGER_PHRASE" = "true" ]; then + COMMENTER_ASSOC="${{ github.event.comment.author_association }}" + if [ "$COMMENTER_ASSOC" = "OWNER" ] || [ "$COMMENTER_ASSOC" = "MEMBER" ] || [ "$COMMENTER_ASSOC" = "COLLABORATOR" ]; then + SHOULD_RUN="true" + else + echo "::notice::Skipping review - Commenter is not a team member (association: $COMMENTER_ASSOC)" + fi + else + echo "::notice::Skipping review - Comment does not contain @continue-detailed-review trigger, or is not on a PR" + fi + else + echo "::notice::Skipping review - Event type ${{ github.event_name }} is not supported" + fi + + if [ "$SHOULD_RUN" != "true" ]; then + echo "SKIP_REVIEW=true" >> $GITHUB_ENV + exit 0 + fi + + echo "SKIP_REVIEW=false" >> $GITHUB_ENV + + - name: Setup Node.js + if: env.SKIP_REVIEW != 'true' + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Continue CLI + if: env.SKIP_REVIEW != 'true' + shell: bash + run: npm install -g @continuedev/cli@1.4.25 + + - name: Build Inline Review Prompt + if: env.SKIP_REVIEW != 'true' + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + # Get PR number based on event type + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NUMBER="${{ github.event.number }}" + else + # For issue_comment event on a PR + PR_NUMBER="${{ github.event.issue.number }}" + fi + + # Get PR files with line numbers + gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files > pr_files.json + + # Get PR diff with context + gh pr diff $PR_NUMBER --color=never > pr_diff.txt + + # Annotate diff with GitHub API positions + node ${{ github.action_path }}/../scripts/annotate-diff.js pr_diff.txt > pr_diff_annotated.txt + + # Debug: Show sample of annotated diff + echo "=== SAMPLE OF ANNOTATED DIFF ===" + head -100 pr_diff_annotated.txt | grep -E "^\[POS:|^@@|^diff --git" || head -50 pr_diff_annotated.txt + echo "=== END SAMPLE ===" + + # Create review prompt for inline comments + cat > inline_review_prompt.txt << 'EOF' + You are conducting a detailed inline code review for a pull request. + + Your task is to analyze the code changes and generate specific, actionable review comments for individual lines or small sections of code. + + IMPORTANT: The diff below has been annotated with [POS:N] markers showing the exact position for each line. + + Example of how to use the position markers: + ``` + diff --git a/src/app.js b/src/app.js + index abc123..def456 100644 + --- a/src/app.js + +++ b/src/app.js + @@ -10,4 +10,6 @@ function example() { + [POS:1] console.log("context"); + [POS:2] - const old = "remove this"; + [POS:3] + const new = "add this"; + [POS:4] + const risky = eval(userInput); <-- To comment here, use position: 4 + [POS:5] return result; + [POS:6] + console.log("done"); + @@ -20,3 +22,4 @@ function another() { + [POS:1] let x = 1; + [POS:2] + let y = 2; <-- To comment here, use position: 2 + ``` + + To comment on a line, simply use the number from its [POS:N] marker as the position value. + For example: {"path": "src/app.js", "position": 4, "body": "Avoid using eval with user input"} + + Below is the annotated PR diff: + + EOF + + cat pr_diff_annotated.txt >> inline_review_prompt.txt + + cat >> inline_review_prompt.txt << 'EOF' + + Please analyze these changes and provide inline review comments in the following JSON format: + + { + "review_summary": "Overall assessment of the PR", + "comments": [ + { + "path": "path/to/file.js", + "position": 4, + "body": "Brief, specific comment about this line or section" + } + ] + } + + Focus on: + 1. **Critical Issues**: Security vulnerabilities, bugs that will break functionality + 2. **High Priority**: Performance problems, incorrect logic, missing error handling + 3. **Medium Priority**: Code style violations, potential edge cases, unclear code + 4. **Low Priority**: Suggestions for improvement, refactoring opportunities + + Guidelines for comments: + - Be specific and actionable + - Use the [POS:N] number shown in the diff as the position value + - Keep comments concise but informative + - Suggest concrete improvements when pointing out issues + - Only comment on actual problems or important improvements + + Important: + - Output ONLY valid JSON, no markdown code blocks or backticks + - Start your response with { and end with } + - Use the exact number from [POS:N] markers as the position + - Only comment on changed lines (lines with + or - prefix) + - Comment on the most important issues first + - Limit to maximum 20 most relevant comments + EOF + + - name: Run Continue CLI Inline Review + if: env.SKIP_REVIEW != 'true' + shell: bash + env: + CONTINUE_API_KEY: ${{ inputs.continue-api-key }} + run: | + echo "Running Continue CLI for inline review..." + + # Validate required inputs + if [ -z "${{ inputs.continue-org }}" ]; then + echo "Error: continue-org input is required" + exit 1 + fi + + if [ -z "${{ inputs.continue-config }}" ]; then + echo "Error: continue-config input is required" + exit 1 + fi + + # Log the prompt for debugging + echo "===== START REVIEW PROMPT =====" + head -n 50 inline_review_prompt.txt + echo "... [diff content] ..." + tail -n 20 inline_review_prompt.txt + echo "===== END REVIEW PROMPT =====" + + # Run the CLI and capture JSON output + cat inline_review_prompt.txt | cn --readonly --format json --org "${{ inputs.continue-org }}" --config "${{ inputs.continue-config }}" -p > inline_review_raw.json + + # Log the output for debugging + echo "Initial Continue CLI output:" + cat inline_review_raw.json + + # Validate JSON output + if ! jq empty inline_review_raw.json 2>/dev/null; then + echo "Invalid JSON output from Continue CLI" + echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json + else + # Check if response is wrapped + if jq -e '.response' inline_review_raw.json > /dev/null 2>&1; then + # Extract JSON from wrapped response + jq -r '.response' inline_review_raw.json | sed 's/^```json//' | sed 's/```$//' > inline_review.json + else + # Use as-is if not wrapped + cp inline_review_raw.json inline_review.json + fi + echo "Review output:" + cat inline_review.json + fi + + - name: Post Inline Review Comments + if: env.SKIP_REVIEW != 'true' + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + + try { + // Read the review output + let reviewData; + try { + const reviewContent = fs.readFileSync('inline_review.json', 'utf8'); + reviewData = JSON.parse(reviewContent); + } catch (parseError) { + console.log('Failed to parse review JSON:', parseError); + reviewData = { + review_summary: 'AI review completed but failed to parse output', + comments: [] + }; + } + + // Get PR number + let prNumber; + if (context.eventName === 'pull_request') { + prNumber = context.payload.pull_request.number; + } else { + prNumber = context.payload.issue.number; + } + + // Get the latest commit SHA + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber + }); + + const commitSha = pr.head.sha; + + // Prepare review comments - filter out comments without required fields + const allComments = reviewData.comments || []; + const validComments = allComments.filter(comment => + comment.position && + comment.path && + comment.body && + typeof comment.position === 'number' && + comment.position > 0 + ); + + if (validComments.length < allComments.length) { + console.log(`Filtered out ${allComments.length - validComments.length} comments due to missing/invalid position, path, or body`); + const invalidComments = allComments.filter(c => !validComments.includes(c)); + console.log('Invalid comments:', JSON.stringify(invalidComments, null, 2)); + } + + const comments = validComments.map(comment => ({ + path: comment.path, + position: comment.position, + body: comment.body + })); + + // Debug: Log the positions we're trying to use + console.log('Attempting to post comments with positions:'); + comments.forEach(c => { + console.log(` ${c.path}: position ${c.position}`); + }); + + // Create the review + if (comments.length > 0) { + try { + await github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + commit_id: commitSha, + body: reviewData.review_summary || 'AI Code Review', + event: 'COMMENT', + comments: comments + }); + console.log(`Successfully created review with ${comments.length} inline comments`); + } catch (reviewError) { + console.log('Failed to create review:', reviewError.message); + + // Fallback: post as a regular comment if review creation fails + const fallbackBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n` + + `*Failed to post ${comments.length} inline comments. Please review the changes manually.*`; + + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: fallbackBody + }); + } + } else { + // No inline comments, just post the summary + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*` + }); + } + + // Add triggered by note if from comment + if (context.eventName === 'issue_comment') { + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: `*Inline review triggered by @${context.payload.comment.user.login}*` + }); + } + + } catch (error) { + console.log('Failed to post review:', error.message); + console.log('Error details:', error); + } + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Upload Review Artifacts + if: env.SKIP_REVIEW != 'true' && always() + uses: actions/upload-artifact@v4 + with: + name: inline-review-results + path: | + inline_review_raw.json + inline_review.json + inline_review_prompt.txt + pr_diff.txt + pr_diff_annotated.txt + retention-days: 7 \ No newline at end of file From 97c2f476bda3047c99b77b39c168f721fdd551a1 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 08:44:22 -0700 Subject: [PATCH 153/174] improv: remove redundant code --- .github/workflows/continue-detailed-review.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 19c7a2722..dcc8401c5 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -16,21 +16,6 @@ jobs: name: Continue Detailed Review runs-on: ubuntu-latest timeout-minutes: 10 - # Only run if: - # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-detailed-review on a PR from a team member - if: > - (github.event_name == 'pull_request' && - (github.event.pull_request.author_association == 'OWNER' || - github.event.pull_request.author_association == 'MEMBER' || - github.event.pull_request.author_association == 'COLLABORATOR')) || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-detailed-review') && - (github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'COLLABORATOR')) - steps: - name: Run Detailed PR Review uses: continuedev/continue/pr-review-action/detailed-review@tomasz/con-3480 From 63d453412b4c546733a254fa8da96d9e5575b768 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 08:50:45 -0700 Subject: [PATCH 154/174] Revert "improv: remove redundant code" This reverts commit 97c2f476bda3047c99b77b39c168f721fdd551a1. --- .github/workflows/continue-detailed-review.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index dcc8401c5..19c7a2722 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -16,6 +16,21 @@ jobs: name: Continue Detailed Review runs-on: ubuntu-latest timeout-minutes: 10 + # Only run if: + # - It's a PR event from a team member (with write/admin permissions) + # - OR it's a comment with @continue-detailed-review on a PR from a team member + if: > + (github.event_name == 'pull_request' && + (github.event.pull_request.author_association == 'OWNER' || + github.event.pull_request.author_association == 'MEMBER' || + github.event.pull_request.author_association == 'COLLABORATOR')) || + (github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains(github.event.comment.body, '@continue-detailed-review') && + (github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR')) + steps: - name: Run Detailed PR Review uses: continuedev/continue/pr-review-action/detailed-review@tomasz/con-3480 From a824a086f8e963fa299288e14b92e3a89e8c97be Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:12:54 -0700 Subject: [PATCH 155/174] fix: passing prompt --- pr-review-action/detailed-review/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr-review-action/detailed-review/action.yml b/pr-review-action/detailed-review/action.yml index 35ee9495f..4fdb7e6a6 100644 --- a/pr-review-action/detailed-review/action.yml +++ b/pr-review-action/detailed-review/action.yml @@ -197,7 +197,7 @@ runs: echo "===== END REVIEW PROMPT =====" # Run the CLI and capture JSON output - cat inline_review_prompt.txt | cn --readonly --format json --org "${{ inputs.continue-org }}" --config "${{ inputs.continue-config }}" -p > inline_review_raw.json + cn --readonly --format json --org "${{ inputs.continue-org }}" --config "${{ inputs.continue-config }}" -p "$(cat inline_review_prompt.txt)" > inline_review_raw.json # Log the output for debugging echo "Initial Continue CLI output:" From a9a674fee07f51039961f5becedb83f7ac975e40 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:15:24 -0700 Subject: [PATCH 156/174] Reapply "improv: remove redundant code" This reverts commit 63d453412b4c546733a254fa8da96d9e5575b768. --- .github/workflows/continue-detailed-review.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 19c7a2722..dcc8401c5 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -16,21 +16,6 @@ jobs: name: Continue Detailed Review runs-on: ubuntu-latest timeout-minutes: 10 - # Only run if: - # - It's a PR event from a team member (with write/admin permissions) - # - OR it's a comment with @continue-detailed-review on a PR from a team member - if: > - (github.event_name == 'pull_request' && - (github.event.pull_request.author_association == 'OWNER' || - github.event.pull_request.author_association == 'MEMBER' || - github.event.pull_request.author_association == 'COLLABORATOR')) || - (github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '@continue-detailed-review') && - (github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'COLLABORATOR')) - steps: - name: Run Detailed PR Review uses: continuedev/continue/pr-review-action/detailed-review@tomasz/con-3480 From 83b8a85bc7e0d35a5be3d001c229c0b76bd00c0d Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:19:18 -0700 Subject: [PATCH 157/174] improv: simplify --- pr-review-action/detailed-review/action.yml | 22 ++++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/pr-review-action/detailed-review/action.yml b/pr-review-action/detailed-review/action.yml index 4fdb7e6a6..301437f3f 100644 --- a/pr-review-action/detailed-review/action.yml +++ b/pr-review-action/detailed-review/action.yml @@ -203,22 +203,16 @@ runs: echo "Initial Continue CLI output:" cat inline_review_raw.json - # Validate JSON output + # Validate JSON output and use it directly if ! jq empty inline_review_raw.json 2>/dev/null; then - echo "Invalid JSON output from Continue CLI" - echo "{\"review_summary\": \"Failed to generate review\", \"comments\": []}" > inline_review.json - else - # Check if response is wrapped - if jq -e '.response' inline_review_raw.json > /dev/null 2>&1; then - # Extract JSON from wrapped response - jq -r '.response' inline_review_raw.json | sed 's/^```json//' | sed 's/```$//' > inline_review.json - else - # Use as-is if not wrapped - cp inline_review_raw.json inline_review.json - fi - echo "Review output:" - cat inline_review.json + echo "Error: Invalid JSON output from Continue CLI" + exit 1 fi + + # Use the JSON output directly + cp inline_review_raw.json inline_review.json + echo "Review output:" + cat inline_review.json - name: Post Inline Review Comments if: env.SKIP_REVIEW != 'true' From 0e001d585dfae9c0524da5c3edca416e99cc3c95 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:40:42 -0700 Subject: [PATCH 158/174] improv: organization --- .../workflows/continue-detailed-review.yaml | 2 +- .../workflows/continue-general-review.yaml | 2 +- actions/README.md | 224 ++++++++++++++++++ .../detailed-review/action.yml | 2 +- .../detailed-review}/annotate-diff.js | 0 .../detailed-review}/annotate-diff.test.js | 0 .../detailed-review}/package.json | 0 .../general-review}/action.yml | 0 pr-review-action/README.md | 146 ------------ 9 files changed, 227 insertions(+), 149 deletions(-) create mode 100644 actions/README.md rename {pr-review-action => actions}/detailed-review/action.yml (99%) rename {pr-review-action/scripts => actions/detailed-review}/annotate-diff.js (100%) rename {pr-review-action/scripts => actions/detailed-review}/annotate-diff.test.js (100%) rename {pr-review-action/scripts => actions/detailed-review}/package.json (100%) rename {pr-review-action => actions/general-review}/action.yml (100%) delete mode 100644 pr-review-action/README.md diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index dcc8401c5..66eab4635 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Detailed PR Review - uses: continuedev/continue/pr-review-action/detailed-review@tomasz/con-3480 + uses: continuedev/continue/actions/detailed-review@tomasz/con-3480 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: continuedev diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index bbe4f5ff6..4f4b8ed66 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Continue PR Review Action - uses: continuedev/continue/pr-review-action@tomasz/con-3480 + uses: continuedev/continue/actions/general-review@tomasz/con-3480 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'continuedev' diff --git a/actions/README.md b/actions/README.md new file mode 100644 index 000000000..4be910eca --- /dev/null +++ b/actions/README.md @@ -0,0 +1,224 @@ +# Continue PR Review Actions + +GitHub Actions that provide automated code reviews for pull requests using Continue CLI. + +## Available Actions + +This repository provides two GitHub Actions for different review styles: + +### 1. General Review Action +Provides high-level PR assessment with overall feedback and recommendations. + +- **Path:** `continuedev/continue/actions/general-review@v1` +- **Trigger:** `@continue-general-review` +- **Output:** Summary comment with strengths, issues, and recommendations + +### 2. Detailed Review Action +Provides line-by-line inline comments on specific code changes. + +- **Path:** `continuedev/continue/actions/detailed-review@v1` +- **Trigger:** `@continue-detailed-review` +- **Output:** Inline review comments on specific lines of code + +## Quick Start + +### Using Both Actions Together + +```yaml +name: PR Reviews +on: + pull_request: + types: [opened, ready_for_review] + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + general-review: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: continuedev/continue/actions/general-review@v1 + with: + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'your-org-name' + continue-config: 'your-org-name/review-bot' + + detailed-review: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: continuedev/continue/actions/detailed-review@v1 + with: + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'your-org-name' + continue-config: 'your-org-name/review-bot' +``` + +### General Review Only + +```yaml +name: PR General Review +on: + pull_request: + types: [opened, ready_for_review] + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + review: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: continuedev/continue/actions/general-review@v1 + with: + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'your-org-name' + continue-config: 'your-org-name/review-bot' +``` + +### Detailed Review Only + +```yaml +name: PR Detailed Review +on: + pull_request: + types: [opened, ready_for_review] + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + review: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: continuedev/continue/actions/detailed-review@v1 + with: + continue-api-key: ${{ secrets.CONTINUE_API_KEY }} + continue-org: 'your-org-name' + continue-config: 'your-org-name/review-bot' +``` + +## Inputs + +Both actions accept the same inputs: + +| Input | Description | Required | +|-------|-------------|----------| +| `continue-api-key` | API key for Continue service | Yes | +| `continue-org` | Organization for Continue config | Yes | +| `continue-config` | Config path (e.g., "myorg/review-bot") | Yes | + +## Setup Requirements + +### 1. Continue API Key +Add your Continue API key as a secret named `CONTINUE_API_KEY` in your repository: +1. Go to your repository's Settings +2. Navigate to Secrets and variables β†’ Actions +3. Click "New repository secret" +4. Name: `CONTINUE_API_KEY` +5. Value: Your Continue API key + +### 2. Continue Configuration +Set up your review bot configuration in Continue: +1. Create a configuration for your organization +2. Configure the review bot settings +3. Note your organization name and config path + +### 3. Workflow Permissions +The workflow requires these permissions: +- `contents: read` - To checkout and read repository code +- `pull-requests: write` - To post review comments on PRs +- `issues: write` - To respond to comment triggers + +## Triggering Reviews + +Both actions can be triggered in two ways: + +### Automatic Triggers +- When a PR is opened by a team member (OWNER, MEMBER, or COLLABORATOR) +- When a PR is marked as "ready for review" by a team member + +### Manual Triggers +Team members can trigger reviews by commenting on any pull request: +- `@continue-general-review` - Triggers a general review +- `@continue-detailed-review` - Triggers a detailed inline review + +## Review Outputs + +### General Review Output +The general review provides a structured comment that includes: +- **Strengths**: What was done well in the PR +- **Issues Found**: Categorized by severity (Critical, High, Medium, Low) +- **Suggestions**: Improvement recommendations +- **Overall Assessment**: Final recommendation (APPROVE, REQUEST_CHANGES, or COMMENT) + +### Detailed Review Output +The detailed review provides: +- **Inline Comments**: Specific feedback on individual lines of code +- **Position Markers**: Comments appear directly on the changed lines +- **Review Summary**: Overall assessment of the changes +- **Actionable Feedback**: Specific suggestions for each issue found + +## How It Works + +### General Review Process +1. Checks out repository code +2. Fetches PR diff using GitHub CLI +3. Generates a comprehensive review prompt +4. Runs Continue CLI with specified configuration +5. Posts review as a PR comment + +### Detailed Review Process +1. Checks out repository code +2. Fetches PR diff with GitHub API positions +3. Annotates diff with position markers +4. Generates inline review prompt +5. Runs Continue CLI for detailed analysis +6. Posts inline comments using GitHub's review API + +## Versioning + +This action follows semantic versioning. We recommend using the major version tag for automatic updates: + +- `@v1` - Automatically uses the latest v1.x.x release (recommended) +- `@v1.0.0` - Pins to a specific version +- `@main` - Uses the latest code from the main branch (not recommended for production) + +## Troubleshooting + +### Review not triggering +- Ensure the PR author or commenter has appropriate permissions (OWNER, MEMBER, or COLLABORATOR) +- Check that the workflow file is in the default branch +- Verify the Continue API key is correctly set as a repository secret + +### No review output generated +- Check the action logs for any errors +- Verify your Continue configuration is correct +- Ensure your Continue API key is valid + +### Inline comments not appearing (Detailed Review) +- Check that the PR has a valid diff +- Verify GitHub API permissions are correct +- Review action logs for position calculation errors + +## Support + +For issues or questions: +- [Continue Documentation](https://docs.continue.dev) +- [GitHub Issues](https://github.com/continuedev/continue/issues) +- [Discord Community](https://discord.gg/vapESyrFmJ) \ No newline at end of file diff --git a/pr-review-action/detailed-review/action.yml b/actions/detailed-review/action.yml similarity index 99% rename from pr-review-action/detailed-review/action.yml rename to actions/detailed-review/action.yml index 301437f3f..a697d451b 100644 --- a/pr-review-action/detailed-review/action.yml +++ b/actions/detailed-review/action.yml @@ -91,7 +91,7 @@ runs: gh pr diff $PR_NUMBER --color=never > pr_diff.txt # Annotate diff with GitHub API positions - node ${{ github.action_path }}/../scripts/annotate-diff.js pr_diff.txt > pr_diff_annotated.txt + node ${{ github.action_path }}/annotate-diff.js pr_diff.txt > pr_diff_annotated.txt # Debug: Show sample of annotated diff echo "=== SAMPLE OF ANNOTATED DIFF ===" diff --git a/pr-review-action/scripts/annotate-diff.js b/actions/detailed-review/annotate-diff.js similarity index 100% rename from pr-review-action/scripts/annotate-diff.js rename to actions/detailed-review/annotate-diff.js diff --git a/pr-review-action/scripts/annotate-diff.test.js b/actions/detailed-review/annotate-diff.test.js similarity index 100% rename from pr-review-action/scripts/annotate-diff.test.js rename to actions/detailed-review/annotate-diff.test.js diff --git a/pr-review-action/scripts/package.json b/actions/detailed-review/package.json similarity index 100% rename from pr-review-action/scripts/package.json rename to actions/detailed-review/package.json diff --git a/pr-review-action/action.yml b/actions/general-review/action.yml similarity index 100% rename from pr-review-action/action.yml rename to actions/general-review/action.yml diff --git a/pr-review-action/README.md b/pr-review-action/README.md deleted file mode 100644 index 78dffb120..000000000 --- a/pr-review-action/README.md +++ /dev/null @@ -1,146 +0,0 @@ -# Continue PR Review Action - -A GitHub Action that provides automated code review for pull requests using Continue CLI. - -## Usage - -Add this workflow to your repository at `.github/workflows/pr-review.yml`: - -```yaml -name: PR Review -on: - pull_request: - types: [opened, ready_for_review] - issue_comment: - types: [created] - -permissions: - contents: read - pull-requests: write - issues: write - -jobs: - review: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: continuedev/continue/pr-review-action@v1 - with: - continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'your-org-name' - continue-config: 'your-org-name/review-bot' -``` - -The action automatically handles authorization checks and only runs for: -- PRs opened or marked ready by team members (OWNER, MEMBER, COLLABORATOR) -- Comments containing `@continue-general-review` from team members - -## Inputs - -| Input | Description | Required | -|-------|-------------|----------| -| `continue-api-key` | API key for Continue service | Yes | -| `continue-org` | Organization for Continue config | Yes | -| `continue-config` | Config path (e.g., "myorg/review-bot") | Yes | - -## Setup Requirements - -### 1. Continue API Key -Add your Continue API key as a secret named `CONTINUE_API_KEY` in your repository: -1. Go to your repository's Settings -2. Navigate to Secrets and variables β†’ Actions -3. Click "New repository secret" -4. Name: `CONTINUE_API_KEY` -5. Value: Your Continue API key - -### 2. Continue Configuration -Set up your review bot configuration in Continue: -1. Create a configuration for your organization -2. Configure the review bot settings -3. Note your organization name and config path - -### 3. Workflow Permissions -The workflow requires these permissions: -- `contents: read` - To checkout and read repository code -- `pull-requests: write` - To post review comments on PRs -- `issues: write` - To respond to comment triggers - -## Triggering Reviews - -The action can be triggered in two ways: - -### Automatic Triggers -- When a PR is opened by a team member (OWNER, MEMBER, or COLLABORATOR) -- When a PR is marked as "ready for review" by a team member - -### Manual Trigger -Team members can trigger a review by commenting `@continue-general-review` on any pull request. - -## Versioning - -This action follows semantic versioning. We recommend using the major version tag for automatic updates: - -- `@v1` - Automatically uses the latest v1.x.x release (recommended) -- `@v1.0.0` - Pins to a specific version -- `@main` - Uses the latest code from the main branch (not recommended for production) - -## Minimal Example - -This is the simplest possible configuration: - -```yaml -name: PR Review -on: [pull_request, issue_comment] - -permissions: - contents: read - pull-requests: write - issues: write - -jobs: - review: - runs-on: ubuntu-latest - steps: - - uses: continuedev/continue/pr-review-action@v1 - with: - continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'acme-corp' - continue-config: 'acme-corp/review-bot' -``` - -## How It Works - -1. The action automatically checks out your repository code -2. Installs the Continue CLI (v1.4.25) -3. Fetches the PR diff using GitHub CLI -4. Generates a comprehensive review prompt -5. Runs the Continue CLI with your specified configuration -6. Posts the review as a comment on the PR - -## Review Output - -The action generates a structured code review that includes: - -- **Strengths**: What was done well in the PR -- **Issues Found**: Categorized by severity (Critical, High, Medium, Low) -- **Suggestions**: Improvement recommendations -- **Overall Assessment**: Final recommendation (APPROVE, REQUEST_CHANGES, or COMMENT) - -## Troubleshooting - -### Review not triggering -- Ensure the PR author or commenter has appropriate permissions (OWNER, MEMBER, or COLLABORATOR) -- Check that the workflow file is in the default branch -- Verify the Continue API key is correctly set as a repository secret - -### No review output generated -- Check the action logs for any errors -- Verify your Continue configuration is correct -- Ensure your Continue API key is valid - -## Support - -For issues or questions: -- [Continue Documentation](https://docs.continue.dev) -- [GitHub Issues](https://github.com/continuedev/continue/issues) -- [Discord Community](https://discord.gg/vapESyrFmJ) \ No newline at end of file From 9b6f2d262dce276aab273ad8e476976e853e62c7 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:43:27 -0700 Subject: [PATCH 159/174] fix: broken imports --- .github/workflows/pr-checks.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index cc208b26e..fb91e8d97 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -324,18 +324,18 @@ jobs: uses: actions/cache@v4 id: pr-review-cache with: - path: pr-review-action/scripts/node_modules - key: ${{ runner.os }}-pr-review-action-${{ hashFiles('pr-review-action/scripts/package.json') }} + path: actions/detailed-review/node_modules + key: ${{ runner.os }}-pr-review-action-${{ hashFiles('actions/detailed-review/package.json') }} - name: Install dependencies if: steps.pr-review-cache.outputs.cache-hit != 'true' run: | - cd pr-review-action/scripts + cd actions/detailed-review npm install - name: Run tests run: | - cd pr-review-action/scripts + cd actions/detailed-review npm test # so that creators of new jobs can add them to this list From 17fe39cc4f1760838ce4428aad0a984af13f8266 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:44:28 -0700 Subject: [PATCH 160/174] fix: prompt --- actions/general-review/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/general-review/action.yml b/actions/general-review/action.yml index ac9c992a5..ccf8417dc 100644 --- a/actions/general-review/action.yml +++ b/actions/general-review/action.yml @@ -164,7 +164,7 @@ runs: fi # Run the CLI with validated config - cat review_prompt.txt | cn --readonly --org "$CONTINUE_ORG" --config "$CONTINUE_CONFIG" -p > code_review.md + cn --readonly --org "$CONTINUE_ORG" --config "$CONTINUE_CONFIG" -p "$(cat review_prompt.txt)" > code_review.md - name: Upload Review Results if: env.SHOULD_RUN == 'true' && always() From 6f58e3c202ce7aaf81c23d1565a9373861e42119 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:52:29 -0700 Subject: [PATCH 161/174] improv: use commit sha --- .../workflows/continue-detailed-review.yaml | 2 +- .../workflows/continue-general-review.yaml | 2 +- actions/README.md | 25 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index 66eab4635..c4d54ab7b 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Detailed PR Review - uses: continuedev/continue/actions/detailed-review@tomasz/con-3480 + uses: continuedev/continue/actions/detailed-review@17fe39cc4f1760838ce4428aad0a984af13f8266 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: continuedev diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index 4f4b8ed66..7a4fb1483 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Continue PR Review Action - uses: continuedev/continue/actions/general-review@tomasz/con-3480 + uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'continuedev' diff --git a/actions/README.md b/actions/README.md index 4be910eca..beb67fbb6 100644 --- a/actions/README.md +++ b/actions/README.md @@ -9,14 +9,14 @@ This repository provides two GitHub Actions for different review styles: ### 1. General Review Action Provides high-level PR assessment with overall feedback and recommendations. -- **Path:** `continuedev/continue/actions/general-review@v1` +- **Path:** `continuedev/continue/actions/general-review@` - **Trigger:** `@continue-general-review` - **Output:** Summary comment with strengths, issues, and recommendations ### 2. Detailed Review Action Provides line-by-line inline comments on specific code changes. -- **Path:** `continuedev/continue/actions/detailed-review@v1` +- **Path:** `continuedev/continue/actions/detailed-review@` - **Trigger:** `@continue-detailed-review` - **Output:** Inline review comments on specific lines of code @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: continuedev/continue/actions/general-review@v1 + - uses: continuedev/continue/actions/general-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'your-org-name' @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: continuedev/continue/actions/detailed-review@v1 + - uses: continuedev/continue/actions/detailed-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'your-org-name' @@ -79,7 +79,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: continuedev/continue/actions/general-review@v1 + - uses: continuedev/continue/actions/general-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'your-org-name' @@ -106,7 +106,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: continuedev/continue/actions/detailed-review@v1 + - uses: continuedev/continue/actions/detailed-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: 'your-org-name' @@ -193,11 +193,16 @@ The detailed review provides: ## Versioning -This action follows semantic versioning. We recommend using the major version tag for automatic updates: +We recommend using a specific commit SHA for stability and predictability: -- `@v1` - Automatically uses the latest v1.x.x release (recommended) -- `@v1.0.0` - Pins to a specific version -- `@main` - Uses the latest code from the main branch (not recommended for production) +- `@` - Pins to a specific commit for maximum stability (recommended) +- `@main` - Uses the latest code from the main branch (for bleeding edge) +- `@v1` - Uses a version tag when available + +Example: +```yaml +uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266 +``` ## Troubleshooting From d3b9fc7c51b409e5a11060bda85a5079cabe4df1 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 09:55:19 -0700 Subject: [PATCH 162/174] fix: formatting --- actions/README.md | 50 ++-- actions/detailed-review/annotate-diff.js | 60 ++--- actions/detailed-review/annotate-diff.test.js | 236 +++++++++--------- actions/detailed-review/package.json | 2 +- 4 files changed, 188 insertions(+), 160 deletions(-) diff --git a/actions/README.md b/actions/README.md index beb67fbb6..464867658 100644 --- a/actions/README.md +++ b/actions/README.md @@ -7,6 +7,7 @@ GitHub Actions that provide automated code reviews for pull requests using Conti This repository provides two GitHub Actions for different review styles: ### 1. General Review Action + Provides high-level PR assessment with overall feedback and recommendations. - **Path:** `continuedev/continue/actions/general-review@` @@ -14,6 +15,7 @@ Provides high-level PR assessment with overall feedback and recommendations. - **Output:** Summary comment with strengths, issues, and recommendations ### 2. Detailed Review Action + Provides line-by-line inline comments on specific code changes. - **Path:** `continuedev/continue/actions/detailed-review@` @@ -45,8 +47,8 @@ jobs: - uses: continuedev/continue/actions/general-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'your-org-name' - continue-config: 'your-org-name/review-bot' + continue-org: "your-org-name" + continue-config: "your-org-name/review-bot" detailed-review: runs-on: ubuntu-latest @@ -55,8 +57,8 @@ jobs: - uses: continuedev/continue/actions/detailed-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'your-org-name' - continue-config: 'your-org-name/review-bot' + continue-org: "your-org-name" + continue-config: "your-org-name/review-bot" ``` ### General Review Only @@ -82,8 +84,8 @@ jobs: - uses: continuedev/continue/actions/general-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'your-org-name' - continue-config: 'your-org-name/review-bot' + continue-org: "your-org-name" + continue-config: "your-org-name/review-bot" ``` ### Detailed Review Only @@ -109,24 +111,26 @@ jobs: - uses: continuedev/continue/actions/detailed-review@ with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'your-org-name' - continue-config: 'your-org-name/review-bot' + continue-org: "your-org-name" + continue-config: "your-org-name/review-bot" ``` ## Inputs Both actions accept the same inputs: -| Input | Description | Required | -|-------|-------------|----------| -| `continue-api-key` | API key for Continue service | Yes | -| `continue-org` | Organization for Continue config | Yes | -| `continue-config` | Config path (e.g., "myorg/review-bot") | Yes | +| Input | Description | Required | +| ------------------ | -------------------------------------- | -------- | +| `continue-api-key` | API key for Continue service | Yes | +| `continue-org` | Organization for Continue config | Yes | +| `continue-config` | Config path (e.g., "myorg/review-bot") | Yes | ## Setup Requirements ### 1. Continue API Key + Add your Continue API key as a secret named `CONTINUE_API_KEY` in your repository: + 1. Go to your repository's Settings 2. Navigate to Secrets and variables β†’ Actions 3. Click "New repository secret" @@ -134,13 +138,17 @@ Add your Continue API key as a secret named `CONTINUE_API_KEY` in your repositor 5. Value: Your Continue API key ### 2. Continue Configuration + Set up your review bot configuration in Continue: + 1. Create a configuration for your organization 2. Configure the review bot settings 3. Note your organization name and config path ### 3. Workflow Permissions + The workflow requires these permissions: + - `contents: read` - To checkout and read repository code - `pull-requests: write` - To post review comments on PRs - `issues: write` - To respond to comment triggers @@ -150,25 +158,32 @@ The workflow requires these permissions: Both actions can be triggered in two ways: ### Automatic Triggers + - When a PR is opened by a team member (OWNER, MEMBER, or COLLABORATOR) - When a PR is marked as "ready for review" by a team member ### Manual Triggers + Team members can trigger reviews by commenting on any pull request: + - `@continue-general-review` - Triggers a general review - `@continue-detailed-review` - Triggers a detailed inline review ## Review Outputs ### General Review Output + The general review provides a structured comment that includes: + - **Strengths**: What was done well in the PR - **Issues Found**: Categorized by severity (Critical, High, Medium, Low) - **Suggestions**: Improvement recommendations - **Overall Assessment**: Final recommendation (APPROVE, REQUEST_CHANGES, or COMMENT) ### Detailed Review Output + The detailed review provides: + - **Inline Comments**: Specific feedback on individual lines of code - **Position Markers**: Comments appear directly on the changed lines - **Review Summary**: Overall assessment of the changes @@ -177,6 +192,7 @@ The detailed review provides: ## How It Works ### General Review Process + 1. Checks out repository code 2. Fetches PR diff using GitHub CLI 3. Generates a comprehensive review prompt @@ -184,6 +200,7 @@ The detailed review provides: 5. Posts review as a PR comment ### Detailed Review Process + 1. Checks out repository code 2. Fetches PR diff with GitHub API positions 3. Annotates diff with position markers @@ -200,6 +217,7 @@ We recommend using a specific commit SHA for stability and predictability: - `@v1` - Uses a version tag when available Example: + ```yaml uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266 ``` @@ -207,16 +225,19 @@ uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a98 ## Troubleshooting ### Review not triggering + - Ensure the PR author or commenter has appropriate permissions (OWNER, MEMBER, or COLLABORATOR) - Check that the workflow file is in the default branch - Verify the Continue API key is correctly set as a repository secret ### No review output generated + - Check the action logs for any errors - Verify your Continue configuration is correct - Ensure your Continue API key is valid ### Inline comments not appearing (Detailed Review) + - Check that the PR has a valid diff - Verify GitHub API permissions are correct - Review action logs for position calculation errors @@ -224,6 +245,7 @@ uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a98 ## Support For issues or questions: + - [Continue Documentation](https://docs.continue.dev) - [GitHub Issues](https://github.com/continuedev/continue/issues) -- [Discord Community](https://discord.gg/vapESyrFmJ) \ No newline at end of file +- [Discord Community](https://discord.gg/vapESyrFmJ) diff --git a/actions/detailed-review/annotate-diff.js b/actions/detailed-review/annotate-diff.js index 54b651ceb..b4bdb803e 100644 --- a/actions/detailed-review/annotate-diff.js +++ b/actions/detailed-review/annotate-diff.js @@ -2,45 +2,47 @@ /** * Annotates a git diff with GitHub API positions - * + * * Takes a raw diff and adds [POS:N] markers with the correct * GitHub API positions (cumulative, with +1 between hunks) */ -const fs = require('fs'); +const fs = require("fs"); function annotateDiff(diffContent) { - const lines = diffContent.split('\n'); + const lines = diffContent.split("\n"); const output = []; let githubPos = 0; let inHunk = false; - + for (const line of lines) { // Handle new file - reset position counter - if (line.startsWith('diff --git')) { + if (line.startsWith("diff --git")) { githubPos = 0; inHunk = false; output.push(line); continue; } - + // Pass through other git headers unchanged - if (line.startsWith('index ') || - line.startsWith('---') || - line.startsWith('+++') || - line.startsWith('rename ') || - line.startsWith('similarity ') || - line.startsWith('new file') || - line.startsWith('deleted file') || - line.startsWith('old mode') || - line.startsWith('new mode') || - line.startsWith('Binary files')) { + if ( + line.startsWith("index ") || + line.startsWith("---") || + line.startsWith("+++") || + line.startsWith("rename ") || + line.startsWith("similarity ") || + line.startsWith("new file") || + line.startsWith("deleted file") || + line.startsWith("old mode") || + line.startsWith("new mode") || + line.startsWith("Binary files") + ) { output.push(line); continue; } - + // Handle hunk headers - if (line.startsWith('@@')) { + if (line.startsWith("@@")) { if (inHunk) { githubPos++; // GitHub's +1 between hunks } @@ -48,16 +50,16 @@ function annotateDiff(diffContent) { output.push(line); continue; } - + // Handle "no newline" marker - it counts as a position but isn't annotated - if (line.startsWith('\\ No newline')) { + if (line.startsWith("\\ No newline")) { if (inHunk) { githubPos++; // GitHub counts this as a position } output.push(line); // Don't annotate it continue; } - + // Annotate actual diff lines with GitHub positions if (inHunk) { githubPos++; @@ -66,23 +68,23 @@ function annotateDiff(diffContent) { output.push(line); } } - - return output.join('\n'); + + return output.join("\n"); } // Main function main() { // Read diff from stdin or file - let input = ''; - + let input = ""; + if (process.argv.length > 2) { // Read from file - input = fs.readFileSync(process.argv[2], 'utf8'); + input = fs.readFileSync(process.argv[2], "utf8"); } else { // Read from stdin - input = fs.readFileSync(0, 'utf8'); + input = fs.readFileSync(0, "utf8"); } - + const annotated = annotateDiff(input); console.log(annotated); } @@ -91,4 +93,4 @@ if (require.main === module) { main(); } -module.exports = { annotateDiff }; \ No newline at end of file +module.exports = { annotateDiff }; diff --git a/actions/detailed-review/annotate-diff.test.js b/actions/detailed-review/annotate-diff.test.js index 28a527a2c..e13c66068 100644 --- a/actions/detailed-review/annotate-diff.test.js +++ b/actions/detailed-review/annotate-diff.test.js @@ -1,7 +1,7 @@ -const { annotateDiff } = require('./annotate-diff.js'); +const { annotateDiff } = require("./annotate-diff.js"); -describe('annotateDiff', () => { - test('single file, single hunk', () => { +describe("annotateDiff", () => { + test("single file, single hunk", () => { const diff = `diff --git a/file.js b/file.js index abc123..def456 100644 --- a/file.js @@ -13,13 +13,13 @@ index abc123..def456 100644 line3`; const result = annotateDiff(diff); - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] line2'); - expect(result).toContain('[POS:3] +added line'); - expect(result).toContain('[POS:4] line3'); + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] line2"); + expect(result).toContain("[POS:3] +added line"); + expect(result).toContain("[POS:4] line3"); }); - test('single file, multiple hunks with +1 between', () => { + test("single file, multiple hunks with +1 between", () => { const diff = `diff --git a/file.js b/file.js index abc123..def456 100644 --- a/file.js @@ -36,21 +36,21 @@ index abc123..def456 100644 line12`; const result = annotateDiff(diff); - + // First hunk - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] -old line'); - expect(result).toContain('[POS:3] +new line'); - expect(result).toContain('[POS:4] line3'); - + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] -old line"); + expect(result).toContain("[POS:3] +new line"); + expect(result).toContain("[POS:4] line3"); + // Second hunk (should start at 6, because 4 lines + 1 for between hunks) - expect(result).toContain('[POS:6] line10'); - expect(result).toContain('[POS:7] -old line 11'); - expect(result).toContain('[POS:8] +new line 11'); - expect(result).toContain('[POS:9] line12'); + expect(result).toContain("[POS:6] line10"); + expect(result).toContain("[POS:7] -old line 11"); + expect(result).toContain("[POS:8] +new line 11"); + expect(result).toContain("[POS:9] line12"); }); - test('multiple files reset position counter', () => { + test("multiple files reset position counter", () => { const diff = `diff --git a/file1.js b/file1.js index abc123..def456 100644 --- a/file1.js @@ -69,20 +69,20 @@ index abc123..def456 100644 +new2`; const result = annotateDiff(diff); - + // File 1 - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] -old'); - expect(result).toContain('[POS:3] +new'); - + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] -old"); + expect(result).toContain("[POS:3] +new"); + // File 2 - positions should reset - const file2Section = result.split('diff --git a/file2.js')[1]; - expect(file2Section).toContain('[POS:1] first'); - expect(file2Section).toContain('[POS:2] -old2'); - expect(file2Section).toContain('[POS:3] +new2'); + const file2Section = result.split("diff --git a/file2.js")[1]; + expect(file2Section).toContain("[POS:1] first"); + expect(file2Section).toContain("[POS:2] -old2"); + expect(file2Section).toContain("[POS:3] +new2"); }); - test('handles new file', () => { + test("handles new file", () => { const diff = `diff --git a/newfile.js b/newfile.js new file mode 100644 index 0000000..abc123 @@ -94,13 +94,13 @@ index 0000000..abc123 +line3`; const result = annotateDiff(diff); - expect(result).toContain('new file mode 100644'); - expect(result).toContain('[POS:1] +line1'); - expect(result).toContain('[POS:2] +line2'); - expect(result).toContain('[POS:3] +line3'); + expect(result).toContain("new file mode 100644"); + expect(result).toContain("[POS:1] +line1"); + expect(result).toContain("[POS:2] +line2"); + expect(result).toContain("[POS:3] +line3"); }); - test('handles deleted file', () => { + test("handles deleted file", () => { const diff = `diff --git a/deleted.js b/deleted.js deleted file mode 100644 index abc123..0000000 @@ -112,13 +112,13 @@ index abc123..0000000 -line3`; const result = annotateDiff(diff); - expect(result).toContain('deleted file mode 100644'); - expect(result).toContain('[POS:1] -line1'); - expect(result).toContain('[POS:2] -line2'); - expect(result).toContain('[POS:3] -line3'); + expect(result).toContain("deleted file mode 100644"); + expect(result).toContain("[POS:1] -line1"); + expect(result).toContain("[POS:2] -line2"); + expect(result).toContain("[POS:3] -line3"); }); - test('handles renamed file with changes', () => { + test("handles renamed file with changes", () => { const diff = `diff --git a/old-name.js b/new-name.js similarity index 95% rename from old-name.js @@ -133,14 +133,14 @@ index abc123..def456 100644 line3`; const result = annotateDiff(diff); - expect(result).toContain('rename from old-name.js'); - expect(result).toContain('rename to new-name.js'); - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] -old line'); - expect(result).toContain('[POS:3] +new line'); + expect(result).toContain("rename from old-name.js"); + expect(result).toContain("rename to new-name.js"); + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] -old line"); + expect(result).toContain("[POS:3] +new line"); }); - test('handles no newline at end of file', () => { + test("handles no newline at end of file", () => { const diff = `diff --git a/file.js b/file.js index abc123..def456 100644 --- a/file.js @@ -153,19 +153,19 @@ index abc123..def456 100644 \\ No newline at end of file`; const result = annotateDiff(diff); - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] -old line'); + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] -old line"); // Position 3 is the first "No newline" marker (not annotated but counted) - expect(result).toContain('\\ No newline at end of file'); - expect(result).toContain('[POS:4] +new line'); // Position 4 due to "No newline" at position 3 + expect(result).toContain("\\ No newline at end of file"); + expect(result).toContain("[POS:4] +new line"); // Position 4 due to "No newline" at position 3 // Position 5 is the second "No newline" marker (not annotated but counted) - expect(result).toContain('\\ No newline at end of file'); + expect(result).toContain("\\ No newline at end of file"); // No newline markers should not get [POS:N] annotations - expect(result).not.toContain('[POS:3] \\'); - expect(result).not.toContain('[POS:5] \\'); + expect(result).not.toContain("[POS:3] \\"); + expect(result).not.toContain("[POS:5] \\"); }); - test('handles file mode changes', () => { + test("handles file mode changes", () => { const diff = `diff --git a/script.sh b/script.sh old mode 100644 new mode 100755 @@ -178,60 +178,64 @@ index abc123..def456 100644 +echo "new"`; const result = annotateDiff(diff); - expect(result).toContain('old mode 100644'); - expect(result).toContain('new mode 100755'); - expect(result).toContain('[POS:1] #!/bin/bash'); + expect(result).toContain("old mode 100644"); + expect(result).toContain("new mode 100755"); + expect(result).toContain("[POS:1] #!/bin/bash"); expect(result).toContain('[POS:2] -echo "old"'); expect(result).toContain('[POS:3] +echo "new"'); }); - test('empty diff returns empty', () => { - const diff = ''; + test("empty diff returns empty", () => { + const diff = ""; const result = annotateDiff(diff); - expect(result).toBe(''); + expect(result).toBe(""); }); - test('handles binary files - modified', () => { + test("handles binary files - modified", () => { const diff = `diff --git a/image.png b/image.png index abc123..def456 100644 Binary files a/image.png and b/image.png differ`; const result = annotateDiff(diff); - expect(result).toContain('diff --git a/image.png b/image.png'); - expect(result).toContain('Binary files a/image.png and b/image.png differ'); + expect(result).toContain("diff --git a/image.png b/image.png"); + expect(result).toContain("Binary files a/image.png and b/image.png differ"); // Binary files line should not be annotated - expect(result).not.toContain('[POS:'); + expect(result).not.toContain("[POS:"); }); - test('handles binary files - added', () => { + test("handles binary files - added", () => { const diff = `diff --git a/newimage.png b/newimage.png new file mode 100644 index 0000000..abc123 Binary files /dev/null and b/newimage.png differ`; const result = annotateDiff(diff); - expect(result).toContain('diff --git a/newimage.png b/newimage.png'); - expect(result).toContain('new file mode 100644'); - expect(result).toContain('Binary files /dev/null and b/newimage.png differ'); + expect(result).toContain("diff --git a/newimage.png b/newimage.png"); + expect(result).toContain("new file mode 100644"); + expect(result).toContain( + "Binary files /dev/null and b/newimage.png differ", + ); // Binary files line should not be annotated - expect(result).not.toContain('[POS:'); + expect(result).not.toContain("[POS:"); }); - test('handles binary files - deleted', () => { + test("handles binary files - deleted", () => { const diff = `diff --git a/oldimage.png b/oldimage.png deleted file mode 100644 index abc123..0000000 Binary files a/oldimage.png and /dev/null differ`; const result = annotateDiff(diff); - expect(result).toContain('diff --git a/oldimage.png b/oldimage.png'); - expect(result).toContain('deleted file mode 100644'); - expect(result).toContain('Binary files a/oldimage.png and /dev/null differ'); + expect(result).toContain("diff --git a/oldimage.png b/oldimage.png"); + expect(result).toContain("deleted file mode 100644"); + expect(result).toContain( + "Binary files a/oldimage.png and /dev/null differ", + ); // Binary files line should not be annotated - expect(result).not.toContain('[POS:'); + expect(result).not.toContain("[POS:"); }); - test('handles mixed text and binary files', () => { + test("handles mixed text and binary files", () => { const diff = `diff --git a/text.js b/text.js index abc123..def456 100644 --- a/text.js @@ -252,22 +256,22 @@ index 333333..444444 100644 +bar`; const result = annotateDiff(diff); - + // First file (text) - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] -old'); - expect(result).toContain('[POS:3] +new'); - + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] -old"); + expect(result).toContain("[POS:3] +new"); + // Second file (binary) - no positions - expect(result).toContain('Binary files a/image.png and b/image.png differ'); - + expect(result).toContain("Binary files a/image.png and b/image.png differ"); + // Third file (text) - positions reset - const lastFileSection = result.split('diff --git a/another.js')[1]; - expect(lastFileSection).toContain('[POS:1] -foo'); - expect(lastFileSection).toContain('[POS:2] +bar'); + const lastFileSection = result.split("diff --git a/another.js")[1]; + expect(lastFileSection).toContain("[POS:1] -foo"); + expect(lastFileSection).toContain("[POS:2] +bar"); }); - test('multiple no newline markers accumulate positions', () => { + test("multiple no newline markers accumulate positions", () => { const diff = `diff --git a/file.js b/file.js index abc123..def456 100644 --- a/file.js @@ -286,29 +290,29 @@ index abc123..def456 100644 \\ No newline at end of file`; const result = annotateDiff(diff); - + // First hunk - expect(result).toContain('[POS:1] line1'); - expect(result).toContain('[POS:2] -old1'); + expect(result).toContain("[POS:1] line1"); + expect(result).toContain("[POS:2] -old1"); // Position 3 is the first "No newline" marker - expect(result).toContain('[POS:4] +new1'); + expect(result).toContain("[POS:4] +new1"); // Position 5 is the second "No newline" marker - + // Second hunk (starts at position 7 = 5 + 1 for between hunks + 1) - expect(result).toContain('[POS:7] line10'); - expect(result).toContain('[POS:8] -old2'); + expect(result).toContain("[POS:7] line10"); + expect(result).toContain("[POS:8] -old2"); // Position 9 is the third "No newline" marker - expect(result).toContain('[POS:10] +new2'); + expect(result).toContain("[POS:10] +new2"); // Position 11 is the fourth "No newline" marker - + // Verify "No newline" markers are not annotated - expect(result).not.toContain('[POS:3] \\'); - expect(result).not.toContain('[POS:5] \\'); - expect(result).not.toContain('[POS:9] \\'); - expect(result).not.toContain('[POS:11] \\'); + expect(result).not.toContain("[POS:3] \\"); + expect(result).not.toContain("[POS:5] \\"); + expect(result).not.toContain("[POS:9] \\"); + expect(result).not.toContain("[POS:11] \\"); }); - test('complex multi-file, multi-hunk diff', () => { + test("complex multi-file, multi-hunk diff", () => { const diff = `diff --git a/src/app.js b/src/app.js index abc123..def456 100644 --- a/src/app.js @@ -335,25 +339,25 @@ index 111111..222222 100644 return true;`; const result = annotateDiff(diff); - + // src/app.js - first hunk expect(result).toContain('[POS:1] console.log("start");'); - expect(result).toContain('[POS:2] const x = 1;'); - expect(result).toContain('[POS:3] - const y = 2;'); - expect(result).toContain('[POS:4] + const y = 3;'); - expect(result).toContain('[POS:5] + const z = 4;'); - expect(result).toContain('[POS:6] return x + y;'); - + expect(result).toContain("[POS:2] const x = 1;"); + expect(result).toContain("[POS:3] - const y = 2;"); + expect(result).toContain("[POS:4] + const y = 3;"); + expect(result).toContain("[POS:5] + const z = 4;"); + expect(result).toContain("[POS:6] return x + y;"); + // src/app.js - second hunk (7 = 6 + 1 for between hunks) - expect(result).toContain('[POS:8] let a = 1;'); - expect(result).toContain('[POS:9] let b = 2;'); - expect(result).toContain('[POS:10] + let c = 3;'); - expect(result).toContain('[POS:11] return a + b;'); - + expect(result).toContain("[POS:8] let a = 1;"); + expect(result).toContain("[POS:9] let b = 2;"); + expect(result).toContain("[POS:10] + let c = 3;"); + expect(result).toContain("[POS:11] return a + b;"); + // src/util.js - new file, positions reset - const utilSection = result.split('diff --git a/src/util.js')[1]; - expect(utilSection).toContain('[POS:1] +import fs from \'fs\';'); - expect(utilSection).toContain('[POS:2] export function util() {'); - expect(utilSection).toContain('[POS:3] return true;'); + const utilSection = result.split("diff --git a/src/util.js")[1]; + expect(utilSection).toContain("[POS:1] +import fs from 'fs';"); + expect(utilSection).toContain("[POS:2] export function util() {"); + expect(utilSection).toContain("[POS:3] return true;"); }); -}); \ No newline at end of file +}); diff --git a/actions/detailed-review/package.json b/actions/detailed-review/package.json index 2fe6f122b..4ca8aee1c 100644 --- a/actions/detailed-review/package.json +++ b/actions/detailed-review/package.json @@ -16,4 +16,4 @@ "**/*.test.js" ] } -} \ No newline at end of file +} From c1a47858f389efdfe900f88dd5011bf72a8d80c5 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 15 Aug 2025 10:00:17 -0700 Subject: [PATCH 163/174] fix: rule colocation uri logic (#7164) * fix: rule colocation uri logic * rename to `fileUri` * fix: type errors * fix test mocks * Update slugs.test.ts --- .../rules/bigger-picture-description-rules.md | 19 ++++++ .../bigger-picture-description-rules.yaml | 13 ---- .continue/rules/colors.md | 63 +++++++++++++++++++ .continue/rules/colors.yaml | 27 -------- .../rules/edit-aggregator-singleton-rule.md | 8 --- .../rules/intellij-plugin-test-execution.md | 20 ++++++ .../rules/intellij-plugin-test-execution.yaml | 15 ----- .continue/rules/intellij-test-standards.md | 20 ++++++ .continue/rules/intellij-test-standards.yaml | 10 --- .continue/rules/new-protocol-message.md | 1 + .continue/rules/unit-testing-rules.md | 37 +++++++++++ .continue/rules/unit-testing-rules.yaml | 28 --------- core/config/markdown/loadCodebaseRules.ts | 20 +++++- .../markdown/loadCodebaseRules.vitest.ts | 24 ++++++- core/config/markdown/loadMarkdownRules.ts | 7 ++- core/config/profile/LocalProfileLoader.ts | 3 +- core/config/profile/doLoadConfig.ts | 10 +-- core/config/yaml/loadLocalYamlBlocks.ts | 2 +- core/config/yaml/loadYaml.ts | 4 +- .../config-yaml/src/__tests__/index.test.ts | 12 ++-- .../config-yaml/src/interfaces/slugs.test.ts | 6 +- packages/config-yaml/src/interfaces/slugs.ts | 10 +-- packages/config-yaml/src/load/unroll.test.ts | 8 +-- packages/config-yaml/src/load/unroll.ts | 6 +- .../src/markdown/createMarkdownRule.test.ts | 2 +- .../src/markdown/markdownToRule.test.ts | 22 +++---- .../src/markdown/markdownToRule.ts | 7 ++- .../config-yaml/src/registryClient.test.ts | 2 +- packages/config-yaml/src/registryClient.ts | 2 +- 29 files changed, 255 insertions(+), 153 deletions(-) create mode 100644 .continue/rules/bigger-picture-description-rules.md delete mode 100644 .continue/rules/bigger-picture-description-rules.yaml create mode 100644 .continue/rules/colors.md delete mode 100644 .continue/rules/colors.yaml delete mode 100644 .continue/rules/edit-aggregator-singleton-rule.md create mode 100644 .continue/rules/intellij-plugin-test-execution.md delete mode 100644 .continue/rules/intellij-plugin-test-execution.yaml create mode 100644 .continue/rules/intellij-test-standards.md delete mode 100644 .continue/rules/intellij-test-standards.yaml create mode 100644 .continue/rules/unit-testing-rules.md delete mode 100644 .continue/rules/unit-testing-rules.yaml diff --git a/.continue/rules/bigger-picture-description-rules.md b/.continue/rules/bigger-picture-description-rules.md new file mode 100644 index 000000000..b1a759abe --- /dev/null +++ b/.continue/rules/bigger-picture-description-rules.md @@ -0,0 +1,19 @@ +--- +name: Bigger Picture Description Rules +description: Guidelines for explaining how code works in context +alwaysApply: false +--- + +When a user asks how a certain part of the code works: + +## 1. Describe what the code does in isolation + +Explain the functionality of the code without considering its interactions with other parts of the codebase. + +## 2. Describe interactions with other parts of the codebase + +If the code interacts with other parts of the codebase, describe how the code is imported and used in other parts of the codebase. + +## 3. Include parent function for clarity + +When describing each use-case, include the parent function for clarity. diff --git a/.continue/rules/bigger-picture-description-rules.yaml b/.continue/rules/bigger-picture-description-rules.yaml deleted file mode 100644 index 4e076e88a..000000000 --- a/.continue/rules/bigger-picture-description-rules.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: bigger-picture-description-rules -version: 0.0.1 -schema: v1 -rules: - - name: bigger-picture-description-rules - rule: >- - When a user asks how a certain part of the code works: - - 1. Describe what the code does in isolation. - - 2. If the code interacts with other parts of the codebase, describe how the code is imported and used in other parts of the codebase. - - 3. When describing each use-case, include the parent function for clarity. diff --git a/.continue/rules/colors.md b/.continue/rules/colors.md new file mode 100644 index 000000000..0d031cbd0 --- /dev/null +++ b/.continue/rules/colors.md @@ -0,0 +1,63 @@ +--- +name: Extension Color Themes +description: Guidelines for using theme colors in GUI components +alwaysApply: false +globs: "gui/**/*.tsx" +--- + +When adding colors to components, use tailwind color classes. +Do NOT use explicit colors like text-gray-400. Instead, use theme colors. + +## Available theme colors + +### Normal text + +- `foreground`, `description`, `description-muted` + +### Other text, icons, etc + +- `success`, `warning`, `error`, `accent`, `link` + +### General components + +- `background`, `border`, `border-focus` + +### Specific components + +#### Button + +- `primary`, `primary-foreground`, `primary-hover` +- `secondary`, `secondary-foreground`, `secondary-hover` + +#### Input + +- `input`, `input-foreground`, `input-border`, `input-placeholder` + +#### Badge + +- `badge`, `badge-foreground` + +#### List/Dropdown items + +- `list-hover`, `list-active`, `list-active-foreground` + +#### Code Editor + +- `editor`, `editor-foreground` + +## Usage examples + +Any of these colors can be used in tailwind classes: + +- `bg-primary` +- `text-success` +- `border-error` +- `hover:bg-list-hover` + +## Excluded colors + +The following less-used colors are excluded from this guide: + +- Command (only used by tip-tap): `command`, `command-foreground`, `command-border`, `command-border-focus` +- Find widget colors: `find-match`, `find-match-selected` +- `table-oddRow` diff --git a/.continue/rules/colors.yaml b/.continue/rules/colors.yaml deleted file mode 100644 index 8ca60672e..000000000 --- a/.continue/rules/colors.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: GUI -version: 0.0.1 -schema: v1 -rules: - - name: Extension Color Themes - rule: | - When adding colors to components, use tailwind color classes. - Do NOT use explicit colors like text-gray-400. Instead, use theme colors. - - The common available theme colors are: - - For normal text: foreground, description, description-muted - - For other text, icons, etc: success, warning, error, accent, link - - For general components background, border, border-focus - - For specific components: - - Button: primary, primary-foreground, primary-hover, secondary, secondary-foreground, secondary-hover - - Input: input, input-foreground, input-border, input-placeholder - - Badge: badge, badge-foreground - - List/Dropdown items: list-hover, list-active, list-active-foreground - - Code Editor: editor, editor-foreground - - Any of these colors can be used in tailwind e.g. bg-primary, text-success, border-error, hover:bg-list-hover, etc. - globs: "gui/**/*.tsx" -# Excluding the following less-used colors: -# Command (only used by tip-tap): command, command-foreground, command-border, command-border-focus -# Find widget colors: find-match, find-match-selected -# table-oddRow - diff --git a/.continue/rules/edit-aggregator-singleton-rule.md b/.continue/rules/edit-aggregator-singleton-rule.md deleted file mode 100644 index 05ad0917b..000000000 --- a/.continue/rules/edit-aggregator-singleton-rule.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -patterns: ["EditAggregator", "processEdit"] -glob: "**/*.tsx" -name: "Enforce EditAggregator Singleton" -description: "Ensure that EditAggregator is used as a singleton in the codebase." ---- - -When you encounter usage of EditAggregator, be sure that this is compatible with the singleton nature of the EditAggregator class. If you are creating a new instance of EditAggregator, you should instead use the existing singleton. Refer to the `aggregateEdits.ts` to examine how the singleton pattern is used. Do not create a new instance of EditAggregator. diff --git a/.continue/rules/intellij-plugin-test-execution.md b/.continue/rules/intellij-plugin-test-execution.md new file mode 100644 index 000000000..8b35745a6 --- /dev/null +++ b/.continue/rules/intellij-plugin-test-execution.md @@ -0,0 +1,20 @@ +--- +name: IntelliJ Plugin Test Execution +description: Guidelines for running IntelliJ plugin tests with Gradle +alwaysApply: false +globs: extensions/intellij/**/*Test.kt +--- + +Run IntelliJ plugin tests using Gradle with the fully qualified test class or method name: + +## Run test class + +```bash +./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest" +``` + +## Run specific test method + +```bash +./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest.should*" +``` diff --git a/.continue/rules/intellij-plugin-test-execution.yaml b/.continue/rules/intellij-plugin-test-execution.yaml deleted file mode 100644 index 386a72a2b..000000000 --- a/.continue/rules/intellij-plugin-test-execution.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: IntelliJ Plugin Test Execution -version: 0.0.1 -schema: v1 -rules: - - name: IntelliJ Plugin Test Execution - rule: |- - Run IntelliJ plugin tests using Gradle with the fully qualified test class or method name: - ```bash - # Run test class - ./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest" - - # Run specific test method - ./gradlew test --tests "com.github.continuedev.continueintellijextension.unit.ApplyToFileHandlerTest.should*" - ``` - globs: extensions/intellij/**/*Test.kt diff --git a/.continue/rules/intellij-test-standards.md b/.continue/rules/intellij-test-standards.md new file mode 100644 index 000000000..6e04518b6 --- /dev/null +++ b/.continue/rules/intellij-test-standards.md @@ -0,0 +1,20 @@ +--- +name: IntelliJ Test Standards +description: Standards for writing tests in the IntelliJ plugin +alwaysApply: false +globs: "**/test/**/*.kt" +--- + +When writing tests for the IntelliJ plugin: + +## Use mockk library for mocking + +Prefer mockk's idiomatic syntax for creating and verifying mocks. + +## Structure tests with clear patterns + +Always structure tests with clear Arrange-Act-Assert patterns. + +## Use descriptive test names + +Use descriptive test names that indicate the scenario being tested. diff --git a/.continue/rules/intellij-test-standards.yaml b/.continue/rules/intellij-test-standards.yaml deleted file mode 100644 index f706757e2..000000000 --- a/.continue/rules/intellij-test-standards.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: IntelliJ Test Standards -version: 0.0.1 -schema: v1 -rules: - - name: IntelliJ Test Standards - rule: When writing tests for the IntelliJ plugin, use the mockk library for - mocking. Prefer mockk's idiomatic syntax for creating and verifying mocks. - Always structure tests with clear Arrange-Act-Assert patterns and use - descriptive test names that indicate the scenario being tested. - globs: "**/test/**/*.kt" diff --git a/.continue/rules/new-protocol-message.md b/.continue/rules/new-protocol-message.md index 23c6ba638..b01961242 100644 --- a/.continue/rules/new-protocol-message.md +++ b/.continue/rules/new-protocol-message.md @@ -1,6 +1,7 @@ --- name: New protocol message description: Create a new protocol message from core/gui/ide to core/gui/ide +alwaysApply: false --- Create a new protocol message by taking the following steps: diff --git a/.continue/rules/unit-testing-rules.md b/.continue/rules/unit-testing-rules.md new file mode 100644 index 000000000..bd9fb0109 --- /dev/null +++ b/.continue/rules/unit-testing-rules.md @@ -0,0 +1,37 @@ +--- +name: Unit Testing Rules +description: Guidelines for unit testing in this project +alwaysApply: false +--- + +For unit testing in this project: + +## 1. Testing frameworks + +The project uses Vitest and Jest for testing. Prefer Vitest. + +## 2. Test execution location + +Run tests from within the specific package directory (e.g., `cd core && ..`). + +## 3. Vitest tests + +- Test files follow the pattern `*.vitest.ts` +- Run tests using `vitest` from within the specific package/module directory: + ```bash + cd [directory] && vitest -- [test file path] + ``` + +## 4. Jest tests + +- Test files follow the pattern `*.test.ts` +- Run tests using `npm test` from within the specific package/module directory: + ```bash + cd [directory] && npm test -- [test file path] + ``` +- The test script uses experimental VM modules via NODE_OPTIONS flag + +## 5. Test structure + +- Write tests as top-level `test()` functions - DO NOT use `describe()` blocks +- Include the function name being tested in the test description for clarity diff --git a/.continue/rules/unit-testing-rules.yaml b/.continue/rules/unit-testing-rules.yaml deleted file mode 100644 index f846986c2..000000000 --- a/.continue/rules/unit-testing-rules.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: unit-testing-rules -version: 0.0.1 -schema: v1 -rules: - - name: unit-testing-rules - rule: >- - For unit testing in this project: - - 1. The project uses Vitest and Jest for testing. Prefer Vitest - - 2. Run tests from within the specific package directory (e.g., `cd core && ..` - - 3. For vitest tests, - - Test files follow the pattern `*.vitest.ts` - - Run tests using `vitest` from within the specific package/module - directory: `cd [directory] && vitest -- [test file path]` - - 4. For jest tests, - - Test files follow the pattern `*.test.ts` - - Run tests using `npm test` from within the specific package/module - directory: `cd [directory] && npm test -- [test file path]` - - The test script uses experimental VM modules via NODE_OPTIONS flag - - 5. For both - - Write tests as top-level `test()` functions - DO NOT use `describe()` - blocks - - Include the function name being tested in the test description for - clarity diff --git a/core/config/markdown/loadCodebaseRules.ts b/core/config/markdown/loadCodebaseRules.ts index e0d76bfec..dc6696576 100644 --- a/core/config/markdown/loadCodebaseRules.ts +++ b/core/config/markdown/loadCodebaseRules.ts @@ -5,7 +5,7 @@ import { import { IDE, RuleWithSource } from "../.."; import { walkDirs } from "../../indexing/walkDir"; import { RULES_MARKDOWN_FILENAME } from "../../llm/rules/constants"; -import { getUriPathBasename } from "../../util/uri"; +import { findUriInDirs, getUriPathBasename } from "../../util/uri"; export class CodebaseRulesCache { private static instance: CodebaseRulesCache | null = null; @@ -26,7 +26,14 @@ export class CodebaseRulesCache { } async update(ide: IDE, uri: string) { const content = await ide.readFile(uri); - const rule = markdownToRule(content, { uriType: "file", filePath: uri }); + const { relativePathOrBasename } = findUriInDirs( + uri, + await ide.getWorkspaceDirs(), + ); + const rule = markdownToRule(content, { + uriType: "file", + fileUri: relativePathOrBasename, + }); const ruleWithSource: RuleWithSource = { ...rule, source: "colocated-markdown", @@ -68,7 +75,14 @@ export async function loadCodebaseRules(ide: IDE): Promise<{ for (const filePath of rulesMdFiles) { try { const content = await ide.readFile(filePath); - const rule = markdownToRule(content, { uriType: "file", filePath }); + const { relativePathOrBasename } = findUriInDirs( + filePath, + await ide.getWorkspaceDirs(), + ); + const rule = markdownToRule(content, { + uriType: "file", + fileUri: relativePathOrBasename, + }); rules.push({ ...rule, diff --git a/core/config/markdown/loadCodebaseRules.vitest.ts b/core/config/markdown/loadCodebaseRules.vitest.ts index f9c3972c8..74da02684 100644 --- a/core/config/markdown/loadCodebaseRules.vitest.ts +++ b/core/config/markdown/loadCodebaseRules.vitest.ts @@ -2,6 +2,7 @@ import { markdownToRule } from "@continuedev/config-yaml"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { IDE } from "../.."; import { walkDirs } from "../../indexing/walkDir"; +import { findUriInDirs, getUriPathBasename } from "../../util/uri"; import { loadCodebaseRules } from "./loadCodebaseRules"; // Mock dependencies @@ -13,12 +14,20 @@ vi.mock("@continuedev/config-yaml", () => ({ markdownToRule: vi.fn(), })); +vi.mock("../../util/uri", () => ({ + findUriInDirs: vi.fn(), + getUriPathBasename: vi.fn(), +})); + describe("loadCodebaseRules", () => { // Mock IDE with properly typed mock functions const mockIde = { readFile: vi.fn() as unknown as IDE["readFile"] & { mockImplementation: Function; }, + getWorkspaceDirs: vi.fn() as unknown as IDE["getWorkspaceDirs"] & { + mockImplementation: Function; + }, } as unknown as IDE; // Setup test files @@ -77,6 +86,19 @@ describe("loadCodebaseRules", () => { // Mock walkDirs to return our test files (walkDirs as any).mockResolvedValue(mockFiles); + // Mock getWorkspaceDirs to return a workspace directory + (mockIde.getWorkspaceDirs as any).mockResolvedValue(["/workspace"]); + + // Mock getUriPathBasename to return just the filename + (getUriPathBasename as any).mockImplementation((path: string) => { + return path.split("/").pop() || ""; + }); + + // Mock findUriInDirs to return relative path + (findUriInDirs as any).mockImplementation((uri: string) => { + return { relativePathOrBasename: uri }; + }); + // Mock readFile to return content based on path (mockIde.readFile as any).mockImplementation((path: string) => { return Promise.resolve(mockRuleContent[path] || ""); @@ -85,7 +107,7 @@ describe("loadCodebaseRules", () => { // Mock markdownToRule to return converted rules (markdownToRule as any).mockImplementation( (content: string, options: any) => { - return mockConvertedRules[options.filePath]; + return mockConvertedRules[options.fileUri]; }, ); }); diff --git a/core/config/markdown/loadMarkdownRules.ts b/core/config/markdown/loadMarkdownRules.ts index e3d32e237..1ee771c05 100644 --- a/core/config/markdown/loadMarkdownRules.ts +++ b/core/config/markdown/loadMarkdownRules.ts @@ -3,6 +3,7 @@ import { markdownToRule, } from "@continuedev/config-yaml"; import { IDE, RuleWithSource } from "../.."; +import { findUriInDirs } from "../../util/uri"; import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants"; /** @@ -29,9 +30,13 @@ export async function loadMarkdownRules(ide: IDE): Promise<{ // Process each markdown file for (const file of mdFiles) { try { + const { relativePathOrBasename } = findUriInDirs( + file.path, + await ide.getWorkspaceDirs(), + ); const rule = markdownToRule(file.content, { uriType: "file", - filePath: file.path, + fileUri: relativePathOrBasename, }); rules.push({ ...rule, source: "rules-block", ruleFile: file.path }); } catch (e) { diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index 466243b3f..56d416d0b 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -65,8 +65,7 @@ export default class LocalProfileLoader implements IProfileLoader { orgScopeId: null, packageIdentifier: { uriType: "file", - filePath: - this.overrideAssistantFile?.path ?? getPrimaryConfigFilePath(), + fileUri: this.overrideAssistantFile?.path ?? getPrimaryConfigFilePath(), }, }); diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 48da9934d..95db22eb9 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -62,6 +62,11 @@ async function loadRules(ide: IDE) { rules.unshift(...markdownRules); errors.push(...markdownRulesErrors); + // Add colocated rules from CodebaseRulesCache + const codebaseRulesCache = CodebaseRulesCache.getInstance(); + rules.unshift(...codebaseRulesCache.rules); + errors.push(...codebaseRulesCache.errors); + return { rules, errors }; } export default async function doLoadConfig(options: { @@ -182,11 +187,6 @@ export default async function doLoadConfig(options: { } }); - // Add rules from colocated rules.md files in the codebase - const codebaseRulesCache = CodebaseRulesCache.getInstance(); - newConfig.rules.unshift(...codebaseRulesCache.rules); - errors.push(...codebaseRulesCache.errors); - // Rectify model selections for each role newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId); diff --git a/core/config/yaml/loadLocalYamlBlocks.ts b/core/config/yaml/loadLocalYamlBlocks.ts index 8c3cde9cb..aa769eb0c 100644 --- a/core/config/yaml/loadLocalYamlBlocks.ts +++ b/core/config/yaml/loadLocalYamlBlocks.ts @@ -23,7 +23,7 @@ export async function unrollLocalYamlBlocks( const unrollResult = await unrollAssistantFromContent( { uriType: "file", - filePath: "", + fileUri: "", }, "name: FILLER\nschema: v1\nversion: 0.0.1", registryClient, diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 5b3bc17ca..6772a2d02 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -72,7 +72,7 @@ async function loadConfigYaml(options: { ); return localBlocks.map((b) => ({ uriType: "file" as const, - filePath: b.path, + fileUri: b.path, })); }); const localPackageIdentifiers: PackageIdentifier[] = ( @@ -87,7 +87,7 @@ async function loadConfigYaml(options: { const getRegistryClient = async () => { const rootPath = packageIdentifier.uriType === "file" - ? dirname(getCleanUriPath(packageIdentifier.filePath)) + ? dirname(getCleanUriPath(packageIdentifier.fileUri)) : undefined; return new RegistryClient({ accessToken: await controlPlaneClient.getAccessToken(), diff --git a/packages/config-yaml/src/__tests__/index.test.ts b/packages/config-yaml/src/__tests__/index.test.ts index 5e0a3cdb9..4ba87bb81 100644 --- a/packages/config-yaml/src/__tests__/index.test.ts +++ b/packages/config-yaml/src/__tests__/index.test.ts @@ -96,7 +96,7 @@ describe("E2E Scenarios", () => { const filePath = id.uriType === "slug" ? `./src/__tests__/packages/${slug}.yaml` - : id.filePath; + : id.fileUri; return fs.readFileSync(filePath).toString(); }, }; @@ -244,7 +244,7 @@ describe("E2E Scenarios", () => { }, { uriType: "file", - filePath: "./src/__tests__/local-files/rules.yaml", + fileUri: "./src/__tests__/local-files/rules.yaml", }, ], }, @@ -276,7 +276,7 @@ describe("E2E Scenarios", () => { const unrolledConfig = await unrollAssistant( { uriType: "file", - filePath: "./src/__tests__/local-files/duplicate-test-assistant.yaml", + fileUri: "./src/__tests__/local-files/duplicate-test-assistant.yaml", }, registry, { @@ -289,15 +289,15 @@ describe("E2E Scenarios", () => { injectBlocks: [ { uriType: "file", - filePath: "./src/__tests__/local-files/rules.yaml", + fileUri: "./src/__tests__/local-files/rules.yaml", }, { uriType: "file", - filePath: "./src/__tests__/local-files/mcpServer.yaml", + fileUri: "./src/__tests__/local-files/mcpServer.yaml", }, { uriType: "file", - filePath: "./src/__tests__/local-files/prompt.yaml", + fileUri: "./src/__tests__/local-files/prompt.yaml", }, ], }, diff --git a/packages/config-yaml/src/interfaces/slugs.test.ts b/packages/config-yaml/src/interfaces/slugs.test.ts index e07e6f700..423694dc6 100644 --- a/packages/config-yaml/src/interfaces/slugs.test.ts +++ b/packages/config-yaml/src/interfaces/slugs.test.ts @@ -117,7 +117,7 @@ describe("PackageIdentifier", () => { it("should encode/decode file-based package identifier with relative path", () => { const testIdentifier = { uriType: "file" as const, - filePath: "./path/to/package.yaml", + fileUri: "./path/to/package.yaml", }; const encoded = encodePackageIdentifier(testIdentifier); expect(encoded).toBe("./path/to/package.yaml"); @@ -129,7 +129,7 @@ describe("PackageIdentifier", () => { it("should encode/decode file-based package identifier with absolute path", () => { const testIdentifier = { uriType: "file" as const, - filePath: "/absolute/path/to/package.yaml", + fileUri: "/absolute/path/to/package.yaml", }; const encoded = encodePackageIdentifier(testIdentifier); expect(encoded).toBe("/absolute/path/to/package.yaml"); @@ -144,7 +144,7 @@ describe("PackageIdentifier", () => { expect(decoded).toEqual({ uriType: "file" as const, - filePath: "/path/to/package.yaml", + fileUri: "/path/to/package.yaml", }); }); diff --git a/packages/config-yaml/src/interfaces/slugs.ts b/packages/config-yaml/src/interfaces/slugs.ts index 5e1417982..2215468d2 100644 --- a/packages/config-yaml/src/interfaces/slugs.ts +++ b/packages/config-yaml/src/interfaces/slugs.ts @@ -20,7 +20,7 @@ interface FullSlugIdentifier extends BasePackageIdentifier { interface FileIdentifier extends BasePackageIdentifier { uriType: "file"; - filePath: string; + fileUri: string; } export type PackageIdentifier = FullSlugIdentifier | FileIdentifier; @@ -28,7 +28,7 @@ export type PackageIdentifier = FullSlugIdentifier | FileIdentifier; export function packageIdentifierToDisplayName(id: PackageIdentifier): string { switch (id.uriType) { case "file": - return id.filePath; + return id.fileUri; case "slug": return id.fullSlug.packageSlug; } @@ -40,7 +40,7 @@ export function encodePackageIdentifier(identifier: PackageIdentifier): string { return encodeFullSlug(identifier.fullSlug); case "file": // For file paths, just return the path directly without a prefix - return identifier.filePath; + return identifier.fileUri; default: throw new Error(`Unknown URI type: ${(identifier as any).uriType}`); } @@ -51,14 +51,14 @@ export function decodePackageIdentifier(identifier: string): PackageIdentifier { if (identifier.startsWith(".") || identifier.startsWith("/")) { return { uriType: "file", - filePath: identifier, + fileUri: identifier, }; } // Keep support for explicit file:// protocol else if (identifier.startsWith("file://")) { return { uriType: "file", - filePath: identifier.substring(7), + fileUri: identifier.substring(7), }; } // Otherwise, it's a slug diff --git a/packages/config-yaml/src/load/unroll.test.ts b/packages/config-yaml/src/load/unroll.test.ts index 83bec0cd0..5df66084b 100644 --- a/packages/config-yaml/src/load/unroll.test.ts +++ b/packages/config-yaml/src/load/unroll.test.ts @@ -5,7 +5,7 @@ describe("parseMarkdownRuleOrAssistantUnrolled tests", () => { it("parses valid YAML content as AssistantUnrolled", () => { const mockId: PackageIdentifier = { uriType: "file", - filePath: "./foo/bar.yaml", + fileUri: "./foo/bar.yaml", }; const yamlContent = ` name: Test Assistant @@ -26,7 +26,7 @@ models: it("parses markdown rule content as AssistantUnrolled", () => { const mockId: PackageIdentifier = { uriType: "file", - filePath: "./foo/bar.md", + fileUri: "./foo/bar.md", }; const markdownContent = ` --- @@ -55,7 +55,7 @@ This is the rule it("throws error for invalid content in yaml file", () => { const mockId: PackageIdentifier = { uriType: "file", - filePath: "./foo/bar.yaml", + fileUri: "./foo/bar.yaml", }; const invalidContent = ` name: Test Assistant @@ -74,7 +74,7 @@ model: # should be models it("Every non-YAML file is a rule", () => { const mockId: PackageIdentifier = { uriType: "file", - filePath: "./foo/bar", + fileUri: "./foo/bar", }; const dubiousContent = `This is not \nproper #YAML#`; const result = parseMarkdownRuleOrAssistantUnrolled(dubiousContent, mockId); diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 5225f79aa..21af99303 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -465,14 +465,14 @@ export async function unrollBlocks( resolvedBlock, source: injectBlock.uriType === "file" - ? injectBlock.filePath + ? injectBlock.fileUri : undefined, error: null, }; } catch (err) { let msg = ""; if (injectBlock.uriType === "file") { - msg = `${(err as Error).message}.\n> ${injectBlock.filePath}`; + msg = `${(err as Error).message}.\n> ${injectBlock.fileUri}`; } else { msg = `${(err as Error).message}.\n> ${injectBlock.fullSlug}`; } @@ -669,7 +669,7 @@ function parseYamlOrMarkdownRule( } catch (yamlError) { if ( id.uriType === "file" && - [".yaml", ".yml"].some((ext) => id.filePath.endsWith(ext)) + [".yaml", ".yml"].some((ext) => id.fileUri.endsWith(ext)) ) { throw yamlError; } diff --git a/packages/config-yaml/src/markdown/createMarkdownRule.test.ts b/packages/config-yaml/src/markdown/createMarkdownRule.test.ts index 982e823bf..169463953 100644 --- a/packages/config-yaml/src/markdown/createMarkdownRule.test.ts +++ b/packages/config-yaml/src/markdown/createMarkdownRule.test.ts @@ -9,7 +9,7 @@ import { markdownToRule } from "./markdownToRule.js"; // Mock package identifier for testing const mockPackageId: PackageIdentifier = { uriType: "file", - filePath: "/path/to/folder", + fileUri: "/path/to/folder", }; describe("sanitizeRuleName", () => { diff --git a/packages/config-yaml/src/markdown/markdownToRule.test.ts b/packages/config-yaml/src/markdown/markdownToRule.test.ts index 0d96ab19e..7103e3e2c 100644 --- a/packages/config-yaml/src/markdown/markdownToRule.test.ts +++ b/packages/config-yaml/src/markdown/markdownToRule.test.ts @@ -5,7 +5,7 @@ describe("markdownToRule", () => { // Use a mock PackageIdentifier for testing const mockId: PackageIdentifier = { uriType: "file", - filePath: "/path/to/file", + fileUri: "/path/to/file", }; it("should convert markdown with frontmatter to a rule", () => { @@ -115,7 +115,7 @@ name: glob pattern testing const result = markdownToRule(content, { uriType: "file", - filePath: "/", + fileUri: "/", }); expect(result.globs).toBe("/**/src/**/Dockerfile"); }); @@ -151,7 +151,7 @@ name: glob pattern testing const result = markdownToRule(content, { uriType: "file", - filePath: "/Documents/myproject/.continue/rules/rule1.md", + fileUri: "/Documents/myproject/.continue/rules/rule1.md", }); expect(result.globs).toBe(".git"); }); @@ -268,7 +268,7 @@ describe("getRuleName", () => { const frontmatter = { name: "Custom Rule Name" }; const id: PackageIdentifier = { uriType: "file", - filePath: "/path/to/my-rule.md", + fileUri: "/path/to/my-rule.md", }; const result = getRuleName(frontmatter, id); @@ -279,7 +279,7 @@ describe("getRuleName", () => { const frontmatter = {}; const id: PackageIdentifier = { uriType: "file", - filePath: "/long/path/to/rules/my-rule.md", + fileUri: "/long/path/to/rules/my-rule.md", }; const result = getRuleName(frontmatter, id); @@ -290,7 +290,7 @@ describe("getRuleName", () => { const frontmatter = {}; const id: PackageIdentifier = { uriType: "file", - filePath: "C:\\long\\path\\to\\rules\\my-rule.md", + fileUri: "C:\\long\\path\\to\\rules\\my-rule.md", }; const result = getRuleName(frontmatter, id); @@ -301,7 +301,7 @@ describe("getRuleName", () => { const frontmatter = {}; const id: PackageIdentifier = { uriType: "file", - filePath: "/path/to\\rules/my-rule.md", + fileUri: "/path/to\\rules/my-rule.md", }; const result = getRuleName(frontmatter, id); @@ -312,7 +312,7 @@ describe("getRuleName", () => { const frontmatter = {}; const id: PackageIdentifier = { uriType: "file", - filePath: "my-rule.md", + fileUri: "my-rule.md", }; const result = getRuleName(frontmatter, id); @@ -323,7 +323,7 @@ describe("getRuleName", () => { const frontmatter = {}; const id: PackageIdentifier = { uriType: "file", - filePath: "rules/my-rule.md", + fileUri: "rules/my-rule.md", }; const result = getRuleName(frontmatter, id); @@ -349,7 +349,7 @@ describe("getRuleName", () => { const frontmatter = { name: "Override Name" }; const id: PackageIdentifier = { uriType: "file", - filePath: "/very/long/path/to/rules/original-name.md", + fileUri: "/very/long/path/to/rules/original-name.md", }; const result = getRuleName(frontmatter, id); @@ -360,7 +360,7 @@ describe("getRuleName", () => { const frontmatter = { name: "" }; const id: PackageIdentifier = { uriType: "file", - filePath: "/path/to/rules/my-rule.md", + fileUri: "/path/to/rules/my-rule.md", }; const result = getRuleName(frontmatter, id); diff --git a/packages/config-yaml/src/markdown/markdownToRule.ts b/packages/config-yaml/src/markdown/markdownToRule.ts index f584a0549..f0489ced4 100644 --- a/packages/config-yaml/src/markdown/markdownToRule.ts +++ b/packages/config-yaml/src/markdown/markdownToRule.ts @@ -77,7 +77,10 @@ function getGlobPattern( if (id.uriType !== "file") { return globs; } - let dir = path.dirname(id.filePath); + let dir = path.dirname(id.fileUri); + + // TODO: This is likely causing bugs for Windows users. + // We can't access `core/util/uri.ts` from this package though. if (dir.includes(".continue")) { return globs; } @@ -112,6 +115,6 @@ export function markdownToRule( regex: frontmatter.regex, description: frontmatter.description, alwaysApply: frontmatter.alwaysApply, - sourceFile: id.uriType === "file" ? id.filePath : undefined, + sourceFile: id.uriType === "file" ? id.fileUri : undefined, }; } diff --git a/packages/config-yaml/src/registryClient.test.ts b/packages/config-yaml/src/registryClient.test.ts index bff0b9e84..d5875771a 100644 --- a/packages/config-yaml/src/registryClient.test.ts +++ b/packages/config-yaml/src/registryClient.test.ts @@ -95,7 +95,7 @@ describe("RegistryClient", () => { const id: PackageIdentifier = { uriType: "file", - filePath: testFilePath, + fileUri: testFilePath, }; const result = await client.getContent(id); diff --git a/packages/config-yaml/src/registryClient.ts b/packages/config-yaml/src/registryClient.ts index 3dab5e062..c027b31e8 100644 --- a/packages/config-yaml/src/registryClient.ts +++ b/packages/config-yaml/src/registryClient.ts @@ -26,7 +26,7 @@ export class RegistryClient implements Registry { async getContent(id: PackageIdentifier): Promise { switch (id.uriType) { case "file": - return this.getContentFromFilePath(id.filePath); + return this.getContentFromFilePath(id.fileUri); case "slug": return this.getContentFromSlug(id.fullSlug); default: From 99da93ac8035f5ef5853d2f2d7504b7c455ad440 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 15 Aug 2025 10:02:31 -0700 Subject: [PATCH 164/174] Delete .continue/rules/intellij-test-standards.md --- .continue/rules/intellij-test-standards.md | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .continue/rules/intellij-test-standards.md diff --git a/.continue/rules/intellij-test-standards.md b/.continue/rules/intellij-test-standards.md deleted file mode 100644 index 6e04518b6..000000000 --- a/.continue/rules/intellij-test-standards.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: IntelliJ Test Standards -description: Standards for writing tests in the IntelliJ plugin -alwaysApply: false -globs: "**/test/**/*.kt" ---- - -When writing tests for the IntelliJ plugin: - -## Use mockk library for mocking - -Prefer mockk's idiomatic syntax for creating and verifying mocks. - -## Structure tests with clear patterns - -Always structure tests with clear Arrange-Act-Assert patterns. - -## Use descriptive test names - -Use descriptive test names that indicate the scenario being tested. From 23d9260536372acf4eb57a41e6ab62bc5869b070 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 10:09:04 -0700 Subject: [PATCH 165/174] improv: add re-review instructions --- actions/detailed-review/action.yml | 8 +++++--- actions/general-review/action.yml | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/actions/detailed-review/action.yml b/actions/detailed-review/action.yml index a697d451b..e0280fa28 100644 --- a/actions/detailed-review/action.yml +++ b/actions/detailed-review/action.yml @@ -288,7 +288,7 @@ runs: repo: context.repo.repo, pull_number: prNumber, commit_id: commitSha, - body: reviewData.review_summary || 'AI Code Review', + body: `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*πŸ’‘ To request a new detailed review, comment \`@continue-detailed-review\`*`, event: 'COMMENT', comments: comments }); @@ -298,7 +298,8 @@ runs: // Fallback: post as a regular comment if review creation fails const fallbackBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n` + - `*Failed to post ${comments.length} inline comments. Please review the changes manually.*`; + `*Failed to post ${comments.length} inline comments. Please review the changes manually.*\n\n` + + `---\n*πŸ’‘ To request a new detailed review, comment \`@continue-detailed-review\`*`; await github.rest.issues.createComment({ issue_number: prNumber, @@ -313,7 +314,8 @@ runs: issue_number: prNumber, owner: context.repo.owner, repo: context.repo.repo, - body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*` + body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` + + `---\n*πŸ’‘ To request a new detailed review, comment \`@continue-detailed-review\`*` }); } diff --git a/actions/general-review/action.yml b/actions/general-review/action.yml index ccf8417dc..060494b94 100644 --- a/actions/general-review/action.yml +++ b/actions/general-review/action.yml @@ -207,6 +207,9 @@ runs: reviewContent = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewContent}`; } + // Add instructions for re-review + reviewContent += '\n\n---\n*πŸ’‘ To request a new review, comment `@continue-general-review`*'; + // Create new comment await github.rest.issues.createComment({ issue_number: prNumber, From 30c76644cf6d15095dbc93dd1f72dd158db4f5a4 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Fri, 15 Aug 2025 10:12:47 -0700 Subject: [PATCH 166/174] chore: update SHA --- .github/workflows/continue-detailed-review.yaml | 4 ++-- .github/workflows/continue-general-review.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index c4d54ab7b..3d314ff37 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -18,8 +18,8 @@ jobs: timeout-minutes: 10 steps: - name: Run Detailed PR Review - uses: continuedev/continue/actions/detailed-review@17fe39cc4f1760838ce4428aad0a984af13f8266 + uses: continuedev/continue/actions/detailed-review@23d9260536372acf4eb57a41e6ab62bc5869b070 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: continuedev - continue-config: continuedev/review-bot \ No newline at end of file + continue-config: continuedev/review-bot diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index 7a4fb1483..3030c6fdf 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -18,8 +18,8 @@ jobs: timeout-minutes: 10 steps: - name: Run Continue PR Review Action - uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266 + uses: continuedev/continue/actions/general-review@23d9260536372acf4eb57a41e6ab62bc5869b070 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} - continue-org: 'continuedev' - continue-config: 'continuedev/review-bot' \ No newline at end of file + continue-org: "continuedev" + continue-config: "continuedev/review-bot" From 6430a84c5c2edd7e5a683838e5423bca4a132087 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 15 Aug 2025 12:18:17 -0700 Subject: [PATCH 167/174] fix: next edit renders that should render decorations will render them properly (#7160) * fix: passing next edit requests will render things * chore: remove comment * feat: skip whitespace only deletions * feat: add a utility function for checking if a diff is a whitespace only deletion * feat: add test for next edit utils * feat: move filtering to NextEditProvider * fix: escape newline properly * feat: make jump decoration more visible * feat: remove redundant escapes * fix: undo the escapeSVG * fix: update tests * fix: use proper line heights * fix: place the SVG at the end of the line * fix: handle cases where the completion is a single line * feat: improve next edit UI (#7167) * fix: use proper line heights * fix: place the SVG at the end of the line * fix: handle cases where the completion is a single line * fix: allocate more memory for the GUI build step * fix: set flag as node options * fix: jump scrolls only after accepting * fix: update jump manager vitest --- .../actions/build-vscode-extension/action.yml | 6 +- core/codeRenderer/CodeRenderer.ts | 52 ++++-- core/nextEdit/NextEditProvider.ts | 49 +++--- core/nextEdit/utils.ts | 10 ++ core/nextEdit/utils.vitest.ts | 59 +++++++ .../vscode/src/activation/JumpManager.ts | 164 +++++++++++++++--- .../src/activation/JumpManager.vitest.ts | 101 +++++++++-- .../src/activation/NextEditWindowManager.ts | 26 ++- 8 files changed, 380 insertions(+), 87 deletions(-) create mode 100644 core/nextEdit/utils.vitest.ts diff --git a/.github/actions/build-vscode-extension/action.yml b/.github/actions/build-vscode-extension/action.yml index f9c17f31b..b465bf478 100644 --- a/.github/actions/build-vscode-extension/action.yml +++ b/.github/actions/build-vscode-extension/action.yml @@ -105,7 +105,9 @@ runs: shell: bash run: | cd gui - npm run build + npm run build --max-old-space-size=4096 + env: + NODE_OPTIONS: "--max-old-space-size=4096" - name: Prepackage the extension shell: bash @@ -156,4 +158,4 @@ runs: npx vsce package --pre-release --no-dependencies --target ${{ steps.set-target.outputs.target }} else npx vsce package --no-dependencies --target ${{ steps.set-target.outputs.target }} - fi \ No newline at end of file + fi diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index 057695405..e1ba99a53 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -243,7 +243,10 @@ export class CodeRenderer { ); const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); - const svg = ` + const lines = code.split("\n"); + const actualHeight = lines.length * options.lineHeight; + + const svg = ` - + ${lineBackgrounds} ${guts} @@ -317,29 +320,46 @@ export class CodeRenderer { const y = index * options.lineHeight; const isFirst = index === 0; const isLast = index === lines.length - 1; + const isSingleLine = isFirst && isLast; const radius = 10; + + // Handle single line case (both first and last) + if (isSingleLine) { + return ``; + } + // SVG notes: // By default SVGs have anti-aliasing on. // This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps. // Turning it off with 'shape-rendering="crispEdges"' solves the issue. return isFirst ? `` + L ${0} ${y + radius} + Q ${0} ${y} ${radius} ${y} + L ${options.dimensions.width - radius} ${y} + Q ${options.dimensions.width} ${y} ${options.dimensions.width} ${y + radius} + L ${options.dimensions.width} ${y + options.lineHeight} + Z" + fill="${bgColor}" />` : isLast ? `` + L ${0} ${y + options.lineHeight - radius} + Q ${0} ${y + options.lineHeight} ${radius} ${y + options.lineHeight} + L ${options.dimensions.width - radius} ${y + options.lineHeight} + Q ${options.dimensions.width} ${y + options.lineHeight} ${options.dimensions.width} ${y + options.lineHeight - 10} + L ${options.dimensions.width} ${y} + Z" + fill="${bgColor}" />` : ``; }) .join("\n"); diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 7cc7e8df6..0b525de4a 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -33,7 +33,6 @@ import { myersDiff } from "../diff/myers.js"; import { modelSupportsNextEdit } from "../llm/autodetect.js"; import { countTokens } from "../llm/countTokens.js"; import { localPathOrUriToPath } from "../util/pathToUri.js"; -import { replaceEscapedCharacters } from "../util/text.js"; import { INSTINCT_SYSTEM_PROMPT, MERCURY_CODE_TO_EDIT_OPEN, @@ -60,6 +59,7 @@ import { PromptMetadata, RecentlyEditedRange, } from "./types.js"; +import { isWhitespaceOnlyDeletion } from "./utils.js"; const autocompleteCache = AutocompleteLruCache.get(); @@ -685,13 +685,17 @@ export class NextEditProvider { return undefined; } - const nextCompletion = msg.content.split( - `${MERCURY_CODE_TO_EDIT_OPEN}\n`, - )[1] - ? replaceEscapedCharacters( - msg.content.split(`${MERCURY_CODE_TO_EDIT_OPEN}\n`)[1], - ).replace(/\n$/, "") - : replaceEscapedCharacters(msg.content); + // const nextCompletion = msg.content.split( + // `${MERCURY_CODE_TO_EDIT_OPEN}\n`, + // )[1] + // ? replaceEscapedCharacters( + // msg.content.split(`${MERCURY_CODE_TO_EDIT_OPEN}\n`)[1], + // ).replace(/\n$/, "") + // : replaceEscapedCharacters(msg.content); + const nextCompletion = + msg.content + .split(`${MERCURY_CODE_TO_EDIT_OPEN}\n`)[1] + .replace(/\n$/, "") ?? msg.content; if (opts?.usingFullFileDiff === false || !opts?.usingFullFileDiff) { return await this._handlePartialFileDiff( @@ -773,13 +777,16 @@ export class NextEditProvider { .slice(editableRegionStartLine, editableRegionEndLine + 1) .join("\n"); const diffLines = myersDiff(fileSlice, nextCompletion); - const diffGroups = groupDiffLines(diffLines, editableRegionStartLine, 5); + const diffGroups = groupDiffLines( + diffLines, + editableRegionStartLine, + 5, + ).filter((group) => !isWhitespaceOnlyDeletion(group.lines)); const currentLine = helper.pos.line; - let cursorLocalDiffGroup: DiffGroup | undefined; const prefetchQueue = PrefetchQueue.getInstance(); // Process diff groups and find the one containing the cursor - await this._processDiffGroups( + const cursorLocalDiffGroup = await this._processDiffGroups( diffGroups, currentLine, helper, @@ -798,16 +805,16 @@ export class NextEditProvider { helper.input.completionId, true, ); - } else if (diffGroups.length > 0) { - // Fallback to first diff group if cursor's group not found - return await this._createOutcomeFromDiffGroup( - diffGroups[0], - helper, - startTime, - llm, - helper.input.completionId, - false, - ); + // } else if (diffGroups.length > 0) { + // // Fallback to first diff group if cursor's group not found + // return await this._createOutcomeFromDiffGroup( + // diffGroups[0], + // helper, + // startTime, + // llm, + // helper.input.completionId, + // false, + // ); } return undefined; diff --git a/core/nextEdit/utils.ts b/core/nextEdit/utils.ts index bf1081ebe..07ec52a19 100644 --- a/core/nextEdit/utils.ts +++ b/core/nextEdit/utils.ts @@ -1,3 +1,5 @@ +import { DiffLine } from ".."; + export function isNextEditTest(): boolean { const enabled = process.env.NEXT_EDIT_TEST_ENABLED; @@ -11,3 +13,11 @@ export function isNextEditTest(): boolean { return false; } + +export function isWhitespaceOnlyDeletion(diffLines: DiffLine[]): boolean { + return diffLines.every( + (diff) => + diff.type === "old" && + (diff.line.trim() === "" || /^\s+$/.test(diff.line)), + ); +} diff --git a/core/nextEdit/utils.vitest.ts b/core/nextEdit/utils.vitest.ts new file mode 100644 index 000000000..b5494a525 --- /dev/null +++ b/core/nextEdit/utils.vitest.ts @@ -0,0 +1,59 @@ +import { describe, expect, test, vi } from "vitest"; +import { DiffLine } from ".."; +import { isNextEditTest, isWhitespaceOnlyDeletion } from "./utils"; + +describe("isNextEditTest", () => { + test("returns true when NEXT_EDIT_TEST_ENABLED is 'true'", () => { + vi.stubEnv("NEXT_EDIT_TEST_ENABLED", "true"); + expect(isNextEditTest()).toBe(true); + }); + + test("returns false when NEXT_EDIT_TEST_ENABLED is 'false'", () => { + vi.stubEnv("NEXT_EDIT_TEST_ENABLED", "false"); + expect(isNextEditTest()).toBe(false); + }); + + test("returns false when NEXT_EDIT_TEST_ENABLED is undefined", () => { + vi.stubEnv("NEXT_EDIT_TEST_ENABLED", undefined); + expect(isNextEditTest()).toBe(false); + }); +}); + +describe("isWhitespaceOnlyDeletion", () => { + test("returns true for whitespace-only deletions", () => { + const diffLines: DiffLine[] = [ + { type: "old", line: " " }, + { type: "old", line: "\t" }, + ]; + expect(isWhitespaceOnlyDeletion(diffLines)).toBe(true); + }); + + test("returns false for non-whitespace deletions", () => { + const diffLines: DiffLine[] = [ + { type: "old", line: "code" }, + { type: "old", line: " " }, + ]; + expect(isWhitespaceOnlyDeletion(diffLines)).toBe(false); + }); + + test("returns false for mixed content", () => { + const diffLines: DiffLine[] = [ + { type: "old", line: " " }, + { type: "old", line: "code" }, + ]; + expect(isWhitespaceOnlyDeletion(diffLines)).toBe(false); + }); + + test("returns false for mixed type", () => { + const diffLines: DiffLine[] = [ + { type: "old", line: " " }, + { type: "new", line: "" }, + ]; + expect(isWhitespaceOnlyDeletion(diffLines)).toBe(false); + }); + + test("returns true for empty array", () => { + const diffLines: DiffLine[] = []; + expect(isWhitespaceOnlyDeletion(diffLines)).toBe(true); + }); +}); diff --git a/extensions/vscode/src/activation/JumpManager.ts b/extensions/vscode/src/activation/JumpManager.ts index 65bffaa0a..e77e6a192 100644 --- a/extensions/vscode/src/activation/JumpManager.ts +++ b/extensions/vscode/src/activation/JumpManager.ts @@ -1,11 +1,65 @@ import { NextEditProvider } from "core/nextEdit/NextEditProvider"; import { NextEditOutcome } from "core/nextEdit/types"; +// @ts-ignore +import svgBuilder from "svg-builder"; import * as vscode from "vscode"; +import { getTheme } from "../util/getTheme"; import { HandlerPriority, SelectionChangeManager, } from "./SelectionChangeManager"; +// Instead of getters that execute immediately, use methods or lazy properties +const SVG_CONFIG = { + stroke: "#999998", + strokeWidth: 1, + shortcutColor: "#999998", + filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", + radius: 3, + leftMargin: 40, + debounceDelay: 500, + label: "πŸ“ Press Tab to jump, Esc to cancel", + + // Convert getters to methods that are called when needed + getFontSize(): number { + return Math.ceil( + (vscode.workspace.getConfiguration("editor").get("fontSize") ?? + 14) * 0.8, + ); + }, + + getFontFamily(): string { + return ( + vscode.workspace.getConfiguration("editor").get("fontFamily") || + "helvetica" + ); + }, + + getPaddingX(): number { + return Math.ceil(this.getEstimatedTextWidth(" ")); + }, + + getGap(): number { + return this.getFontSize() * 0.5; + }, + + getTipWidth(): number { + return this.getEstimatedTextWidth(this.label) + this.getPaddingX(); + }, + + getTipHeight(): number { + return this.getFontSize(); + }, + + getTextY(): number { + return (this.getTipHeight() + this.getFontSize()) / 2; + }, + + getEstimatedTextWidth(text: string): number { + return text.length * this.getFontSize() * 0.6; + }, +} as const; + export interface CompletionDataForAfterJump { completionId: string; outcome: NextEditOutcome; @@ -16,16 +70,29 @@ export class JumpManager { private static _instance: JumpManager | undefined; // Decoration state. + private _jumpIcon: vscode.Uri | undefined; private _jumpDecoration: vscode.TextEditorDecorationType | undefined; private _jumpDecorationVisible = false; private _disposables: vscode.Disposable[] = []; + private _theme = getTheme(); private _jumpInProgress: boolean = false; private _jumpAccepted: boolean = false; private _completionAfterJump: CompletionDataForAfterJump | null = null; private _oldCursorPosition: vscode.Position | undefined; - private constructor() {} + private constructor() { + // Build the first SVG icon + this._createSvgJumpIcon(); + + // Re‑build when the colour theme changes + vscode.workspace.onDidChangeConfiguration((e) => { + if (e.affectsConfiguration("workbench.colorTheme")) { + this._theme = getTheme(); + this._createSvgJumpIcon(); + } + }); + } initialize() {} @@ -51,6 +118,62 @@ export class JumpManager { this._disposables = []; } + private _createSvgJumpIcon() { + // if (!this._theme) { + // return; + // } + + const baseTextConfig = { + y: SVG_CONFIG.getTextY(), + "font-family": SVG_CONFIG.getFontFamily(), + "font-size": SVG_CONFIG.getFontSize(), + }; + + try { + const svgContent = svgBuilder + .width(SVG_CONFIG.getTipWidth()) + .height(SVG_CONFIG.getTipHeight()) + .text( + { + ...baseTextConfig, + x: 4, + fill: this._theme?.colors["editor.foreground"] ?? SVG_CONFIG.stroke, + }, + SVG_CONFIG.label, + ) + .render(); + + const dataUri = `data:image/svg+xml;base64,${Buffer.from( + svgContent, + ).toString("base64")}`; + this._jumpIcon = vscode.Uri.parse(dataUri); + + // Dispose the old decoration (if any) and create a fresh one. + if (this._jumpDecoration) { + this._jumpDecoration.dispose(); + } + this._jumpDecoration = this._createSvgJumpDecoration(); + } catch (err) { + console.error("Error creating SVG jump tooltip:", err); + } + } + + private _createSvgJumpDecoration(): vscode.TextEditorDecorationType { + const backgroundColour = + this._theme?.colors["editor.background"] ?? "#333333"; + + return vscode.window.createTextEditorDecorationType({ + after: { + contentIconPath: this._jumpIcon, + border: `;box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${SVG_CONFIG.getTipHeight()}px ${backgroundColour}; + border-radius: ${SVG_CONFIG.radius}px; + filter: ${SVG_CONFIG.filter}`, + margin: `0 0 0 ${SVG_CONFIG.leftMargin}px`, + width: `${SVG_CONFIG.getTipWidth()}px`, + }, + }); + } + public async suggestJump( currentPosition: vscode.Position, nextJumpLocation: vscode.Position, @@ -157,17 +280,6 @@ export class JumpManager { ); } - // Scroll to show the jump location. - editor.revealRange( - new vscode.Range(decorationLine, 0, decorationLine, 0), - vscode.TextEditorRevealType.InCenter, - ); - - // Clean up after timeout if no jump has been made. - // setTimeout(() => { - // this._jumpInProgress = false; - // }, 10000); - return true; } @@ -180,18 +292,22 @@ export class JumpManager { await this.clearJumpDecoration(); // Create a decoration for jump. - this._jumpDecoration = vscode.window.createTextEditorDecorationType({ - before: { - contentText: "πŸ“ Press Tab to jump, Esc to cancel", - color: new vscode.ThemeColor("editor.foreground"), - backgroundColor: new vscode.ThemeColor("editorInfo.background"), - margin: `0 0 0 4px`, - }, - }); + // this._jumpDecoration = vscode.window.createTextEditorDecorationType({ + // before: { + // contentText: "πŸ“ Press Tab to jump, Esc to cancel", + // color: new vscode.ThemeColor("editor.foreground"), + // backgroundColor: new vscode.ThemeColor("editorHover.background"), + // margin: `0 0 0 4px`, + // }, + // }); + + if (!this._jumpDecoration) { + this._createSvgJumpIcon(); // makes both the icon & decoration + } // Apply the decoration. const lastIndexOfLine = editor.document.lineAt(lineToRenderOn).text.length; - editor.setDecorations(this._jumpDecoration, [ + editor.setDecorations(this._jumpDecoration!, [ new vscode.Range( lineToRenderOn, lastIndexOfLine, @@ -240,6 +356,12 @@ export class JumpManager { if (this._jumpDecorationVisible) { this._jumpAccepted = true; + // Scroll to show the jump location. + editor.revealRange( + new vscode.Range(jumpPosition.line, 0, jumpPosition.line, 0), + vscode.TextEditorRevealType.InCenter, + ); + // Move cursor to the jump position. editor.selection = new vscode.Selection(jumpPosition, jumpPosition); await this.clearJumpDecoration(); diff --git a/extensions/vscode/src/activation/JumpManager.vitest.ts b/extensions/vscode/src/activation/JumpManager.vitest.ts index 796ab225f..e27f84381 100644 --- a/extensions/vscode/src/activation/JumpManager.vitest.ts +++ b/extensions/vscode/src/activation/JumpManager.vitest.ts @@ -36,6 +36,21 @@ vi.mock("vscode", () => { dispose: vi.fn(), }), }, + workspace: { + getConfiguration: vi.fn().mockImplementation((section?: string) => { + // Return a configuration object with a get method + return { + get: vi.fn().mockImplementation((key: string) => { + if (key === "fontSize") return 14; + if (key === "fontFamily") return "monaco"; + return undefined; + }), + }; + }), + onDidChangeConfiguration: vi.fn().mockReturnValue({ + dispose: vi.fn(), + }), + }, Position: class { constructor( public line: number, @@ -69,6 +84,32 @@ vi.mock("vscode", () => { dispose: vi.fn(), }), }, + Uri: { + parse: vi.fn().mockReturnValue({ toString: () => "mock-uri" }), + }, + }; +}); + +// Mock getTheme utility +vi.mock("../util/getTheme", () => ({ + getTheme: vi.fn().mockReturnValue({ + colors: { + "editor.foreground": "#ffffff", + "editor.background": "#1e1e1e", + }, + }), +})); + +// Mock svg-builder +vi.mock("svg-builder", () => { + const mockSvgBuilder = { + width: vi.fn().mockReturnThis(), + height: vi.fn().mockReturnThis(), + text: vi.fn().mockReturnThis(), + render: vi.fn().mockReturnValue("mock svg"), + }; + return { + default: mockSvgBuilder, }; }); @@ -152,20 +193,32 @@ describe("JumpManager", () => { let jumpManager: JumpManager; beforeEach(() => { - // Reset mocks - vi.resetAllMocks(); + // Clear mock history but keep implementations + vi.clearAllMocks(); - // Re-setup the lineAt mock after reset - const mockLineAt = vi.fn().mockReturnValue({ - text: "Sample line text", - lineNumber: 0, + // Create a proper TextLine mock + const createMockTextLine = (text: string, lineNumber: number) => ({ + text, + lineNumber, + range: new vscode.Range(lineNumber, 0, lineNumber, text.length), + rangeIncludingLineBreak: new vscode.Range( + lineNumber, + 0, + lineNumber + 1, + 0, + ), + firstNonWhitespaceCharacterIndex: text.search(/\S/), + isEmptyOrWhitespace: text.trim().length === 0, }); - // Ensure our mock is properly set up after reset - if (vscode.window.activeTextEditor?.document) { + // Reset lineAt mock with proper TextLine objects + if (vscode.window.activeTextEditor?.document.lineAt) { vi.mocked( vscode.window.activeTextEditor.document.lineAt, - ).mockImplementation(mockLineAt); + // @ts-ignore + ).mockImplementation((line: number) => + createMockTextLine("Sample line text", line), + ); } // Clear any existing instance @@ -240,7 +293,7 @@ describe("JumpManager", () => { // Decorations should not be created expect( vscode.window.createTextEditorDecorationType, - ).not.toHaveBeenCalled(); + ).toHaveBeenCalledOnce(); // only during setup }); it("should render decoration for jump location outside visible range (below)", async () => { @@ -293,8 +346,32 @@ describe("JumpManager", () => { // Should create decoration expect(vscode.window.createTextEditorDecorationType).toHaveBeenCalled(); - // Should reveal range - expect(vscode.window.activeTextEditor!.revealRange).toHaveBeenCalled(); + // Should not reveal range + expect( + vscode.window.activeTextEditor!.revealRange, + ).not.toHaveBeenCalled(); + }); + + it("should call revealRange when jump is accepted", async () => { + const currentPosition = new vscode.Position(1, 0); + const nextJumpLocation = new vscode.Position(8, 0); // Outside visible range + + await jumpManager.suggestJump(currentPosition, nextJumpLocation); + + // Find the acceptJump command handler. + const commandArgs = vi + .mocked(vscode.commands.registerCommand) + .mock.calls.find((call: any) => call[0] === "continue.acceptJump"); + expect(commandArgs).toBeDefined(); + const acceptJumpHandler = commandArgs![1]; + + await acceptJumpHandler(); + + // Should reveal the jump location range after jumping. + expect(vscode.window.activeTextEditor!.revealRange).toHaveBeenCalledWith( + new vscode.Range(nextJumpLocation.line, 0, nextJumpLocation.line, 0), + vscode.TextEditorRevealType.InCenter, + ); }); }); diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index 970494d33..e451d72dd 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -669,17 +669,9 @@ export class NextEditWindowManager { const offsetFromTop = (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight; - // Set the margin-left so that it's never covering code inside the editable region. - const marginLeft = - SVG_CONFIG.getTipWidth(originalCode) - - SVG_CONFIG.getTipWidth(originalCode.split("\n")[currLineOffsetFromTop]); + // Position the decoration with minimal left margin since it's already at line end + const marginLeft = SVG_CONFIG.paddingX; // Use consistent padding instead of complex calculation - // console.log(marginLeft); - // console.log(SVG_CONFIG.getTipWidth(originalCode)); - // console.log( - // SVG_CONFIG.getTipWidth(originalCode.split("\n")[currLineOffsetFromTop]), - // ); - // console.log(originalCode.split("\n")[currLineOffsetFromTop]); return vscode.window.createTextEditorDecorationType({ before: { contentIconPath: uri, @@ -770,12 +762,16 @@ export class NextEditWindowManager { ): vscode.Position { // Create a position that's offset spaces to the right of the cursor. + // const line = editor.document.lineAt(position.line); + // const offsetChar = Math.min( + // position.character + SVG_CONFIG.cursorOffset, + // line.text.length, + // ); + // return new vscode.Position(position.line, offsetChar); + + // Place decoration at the end of the current line const line = editor.document.lineAt(position.line); - const offsetChar = Math.min( - position.character + SVG_CONFIG.cursorOffset, - line.text.length, - ); - return new vscode.Position(position.line, offsetChar); + return new vscode.Position(position.line, line.text.length); } /** From 74287e8ca4f8fb7f7f74f3c67b8642a4aec2e806 Mon Sep 17 00:00:00 2001 From: Qian <71264725+QianKuang8@users.noreply.github.com> Date: Sat, 16 Aug 2025 04:39:36 +0800 Subject: [PATCH 168/174] fix: vscode apply error (#7168) fix: vscode apply --- extensions/vscode/src/apply/ApplyManager.ts | 48 ++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/extensions/vscode/src/apply/ApplyManager.ts b/extensions/vscode/src/apply/ApplyManager.ts index c12d6323a..e8384dac0 100644 --- a/extensions/vscode/src/apply/ApplyManager.ts +++ b/extensions/vscode/src/apply/ApplyManager.ts @@ -50,37 +50,45 @@ export class ApplyManager { toolCallId, }); - const hasExistingDocument = !!activeTextEditor.document.getText().trim(); + try { + const hasExistingDocument = !!activeTextEditor.document.getText().trim(); - if (hasExistingDocument) { - // Currently `isSearchAndReplace` will always provide a full file rewrite - // as the contents of `text`, so we can just instantly apply - if (isSearchAndReplace) { - const diffLinesGenerator = generateLines( - myersDiff(activeTextEditor.document.getText(), text), - ); + if (hasExistingDocument) { + // Currently `isSearchAndReplace` will always provide a full file rewrite + // as the contents of `text`, so we can just instantly apply + if (isSearchAndReplace) { + const diffLinesGenerator = generateLines( + myersDiff(activeTextEditor.document.getText(), text), + ); - await this.verticalDiffManager.streamDiffLines( - diffLinesGenerator, - true, - streamId, - toolCallId, - ); + await this.verticalDiffManager.streamDiffLines( + diffLinesGenerator, + true, + streamId, + toolCallId, + ); + } else { + await this.handleExistingDocument( + activeTextEditor, + text, + streamId, + toolCallId, + ); + } } else { - await this.handleExistingDocument( + await this.handleEmptyDocument( activeTextEditor, text, streamId, toolCallId, ); } - } else { - await this.handleEmptyDocument( - activeTextEditor, - text, + } finally { + await this.webviewProtocol.request("updateApplyState", { streamId, + status: "closed", toolCallId, - ); + }); } } From 4eeb34940fa7e8d66c147566174e47f1122e22ac Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 15 Aug 2025 14:03:32 -0700 Subject: [PATCH 169/174] chore: remove docs cache (#7108) * chore: remove docs cache * Update DocsService.ts --- core/indexing/docs/DocsCache.test.ts | 25 ----- core/indexing/docs/DocsCache.ts | 93 ------------------ core/indexing/docs/DocsService.ts | 137 --------------------------- 3 files changed, 255 deletions(-) delete mode 100644 core/indexing/docs/DocsCache.test.ts delete mode 100644 core/indexing/docs/DocsCache.ts diff --git a/core/indexing/docs/DocsCache.test.ts b/core/indexing/docs/DocsCache.test.ts deleted file mode 100644 index 341cd0229..000000000 --- a/core/indexing/docs/DocsCache.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import OpenAI from "../../llm/llms/OpenAI"; -import { DocsCache } from "./DocsCache"; // adjust import path as needed - -describe("DocsCache", () => { - let openAIEmbeddings: OpenAI; - - beforeAll(() => { - openAIEmbeddings = new OpenAI({ - apiKey: "", - model: "text-embedding-ada-002", - }); - }); - - test("normalizeEmbeddingId() produces a valid ID without constructor name", async () => { - // Get the embedding ID from OpenAI embeddings provider - const embeddingId = DocsCache.normalizeEmbeddingId( - openAIEmbeddings.embeddingId, - ); - - // The ID should not contain the constructor name (OpenAI) - expect(embeddingId).toEqual( - `${openAIEmbeddings.model}::${openAIEmbeddings.maxEmbeddingChunkSize}`, - ); - }); -}); diff --git a/core/indexing/docs/DocsCache.ts b/core/indexing/docs/DocsCache.ts deleted file mode 100644 index caa30139b..000000000 --- a/core/indexing/docs/DocsCache.ts +++ /dev/null @@ -1,93 +0,0 @@ -import request from "request"; -import { Chunk } from "../.."; - -export interface SiteIndexingResults { - chunks: (Chunk & { embedding: number[] })[]; - url: string; - title: string; -} - -/** - * Strip off the trailing forward slash from the given URL - * @param url The URL of the document - * @returns A sanitized URL without trailing forward slash - */ -const stripTrailingSlash = (url: string): string => { - return url.replace(/\/+$/, ""); -}; - -export class DocsCache { - static readonly AWS_REGION: string = "us-west-1"; - static readonly BUCKET_NAME: string = "continue-preindexed-docs"; - - /** - * Normalizes an embedding ID by stripping the constructor name part. - * This is done because we don't care about the provider, just the - * model and the max embedding chunk size. - */ - static normalizeEmbeddingId(embeddingId: string): string { - // Split by "::" and remove the first part (constructor name) - const parts = embeddingId.split("::"); - if (parts.length <= 1) return embeddingId; // Return original if no "::" found - - // Return everything except the first part, joining with "::" - return parts.slice(1).join("::"); - } - - /** - * Gets the filepath for a given embedding ID and URL - */ - static getFilepathForEmbeddingIdAndUrl( - embeddingId: string, - url: string, - ): string { - const normalizedEmbeddingId = DocsCache.normalizeEmbeddingId(embeddingId); - const sanitizedUrl = stripTrailingSlash(url); - const normalizedUrl = encodeURIComponent(sanitizedUrl.replace(/\//g, "_")); - return normalizedEmbeddingId + "/" + normalizedUrl; - } - - /** - * Gets the fully qualified S3 URL for a given filepath - */ - private static getS3Url(filepath: string): string { - const pathname = filepath.split("/").map(encodeURIComponent).join("/"); - return `https://${this.BUCKET_NAME}.s3.${this.AWS_REGION}.amazonaws.com/${pathname}`; - } - - /** - * Downloads cached site indexing results from S3 for a given embedding ID and URL - * @param embeddingId The embedding ID - * @param url The URL of the document - * @returns The downloaded data as a string - */ - static async getDocsCacheForUrl( - embeddingId: string, - url: string, - ): Promise { - const filepath = DocsCache.getFilepathForEmbeddingIdAndUrl( - embeddingId, - url, - ); - - return new Promise((resolve, reject) => { - let data = ""; - const url = this.getS3Url(filepath); - const download = request({ - url, - }); - - download.on("response", (response: any) => { - if (response.statusCode !== 200) { - reject( - new Error("There was an error retrieving the pre-indexed doc"), - ); - } - }); - - download.on("error", (err: any) => reject(err)); - download.on("data", (chunk: any) => (data += chunk)); - download.on("end", () => resolve(data)); - }); - } -} diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 22374f5dd..59ef36edf 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -37,7 +37,6 @@ import { runLanceMigrations, runSqliteMigrations } from "./migrations"; import type * as LanceType from "vectordb"; import { LLMError } from "../../llm"; -import { DocsCache, SiteIndexingResults } from "./DocsCache"; // Purposefully lowercase because lancedb converts export interface LanceDbDocsRow { @@ -433,60 +432,6 @@ export default class DocsService { } } - /** - * Attempt to load document embeddings from cache - * @returns true if cache was successfully loaded, false otherwise - */ - private async tryLoadFromCache( - startUrl: string, - embeddingId: string, - siteIndexingConfig: SiteIndexingConfig, - ): Promise { - try { - // Set a initial status when retrieving cache - this.handleStatusUpdate({ - type: "docs", - id: startUrl, - embeddingsProviderId: embeddingId, - isReindexing: false, - title: siteIndexingConfig.title, - debugInfo: "Loaded from cache", - icon: siteIndexingConfig.faviconUrl, - url: startUrl, - progress: 0, - description: "Try to retrieve cache", - status: "indexing", - }); - - const cacheHit = await this.tryFetchFromCache(startUrl, embeddingId); - - if (cacheHit) { - console.log(`Successfully loaded cached embeddings for ${startUrl}`); - // Update status to complete - this.handleStatusUpdate({ - type: "docs", - id: startUrl, - embeddingsProviderId: embeddingId, - isReindexing: false, - title: siteIndexingConfig.title, - debugInfo: "Loaded from cache", - icon: siteIndexingConfig.faviconUrl, - url: startUrl, - progress: 1, - description: "Complete", - status: "complete", - }); - - return true; - } - } catch (e) { - console.log(`Error trying to fetch from cache: ${e}`); - // Continue with regular indexing - } - - return false; - } - // eslint-disable-next-line max-statements async indexAndAdd( siteIndexingConfig: SiteIndexingConfig, @@ -508,19 +453,6 @@ export default class DocsService { return; } - // Try to fetch from cache first before crawling - if (!forceReindex) { - const cacheLoaded = await this.tryLoadFromCache( - startUrl, - provider.embeddingId, - siteIndexingConfig, - ); - - if (cacheLoaded) { - return; - } - } - const startedWithEmbedder = provider.embeddingId; // Check if doc has been successfully indexed with the given embedder @@ -811,52 +743,6 @@ export default class DocsService { } } - /** - * Try to fetch embeddings from the S3 cache for any document URL - * @param startUrl The URL of the documentation site - * @param embeddingsProviderId The ID of the embeddings provider - * @returns True if cache hit and successfully loaded, false otherwise - */ - private async tryFetchFromCache( - startUrl: string, - embeddingId: string, - ): Promise { - try { - const data = await DocsCache.getDocsCacheForUrl(embeddingId, startUrl); - - // Parse the cached data - const siteEmbeddings = JSON.parse(data) as SiteIndexingResults; - - // Try to get a favicon for the site - const favicon = - this.statuses.get(startUrl)?.icon || - (await fetchFavicon(new URL(startUrl))); - - // Always try to make the title match what users set in the config - const title = - this.statuses.get(startUrl)?.title || - siteEmbeddings.title || - new URL(startUrl).hostname; - - // Add the cached embeddings to our database - await this.add({ - favicon, - siteIndexingConfig: { - startUrl, - title, - }, - chunks: siteEmbeddings.chunks, - embeddings: siteEmbeddings.chunks.map((c) => c.embedding), - }); - - return true; - } catch (e) { - // Cache miss or error - silently fail - console.log(`Cache miss for ${startUrl} with provider ${embeddingId}`); - return false; - } - } - // Retrieve docs embeds based on user input async retrieveChunksFromQuery( query: string, @@ -940,7 +826,6 @@ export default class DocsService { } } // This function attempts to retrieve chunks by vector similarity - // It will also attempt to fetch from cache if no results are found async retrieveChunks( startUrl: string, vector: number[], @@ -970,28 +855,6 @@ export default class DocsService { console.warn("Error retrieving chunks from LanceDB", e); } - // If no docs are found and this isn't a retry, try fetching from cache - if (docs.length === 0 && !isRetry) { - try { - // Try to fetch the document from the S3 cache - const cacheHit = await this.tryFetchFromCache( - startUrl, - provider.embeddingId, - ); - - if (cacheHit) { - // If cache hit, refresh the submenu items for docs - this.messenger?.send("refreshSubmenuItems", { - providers: ["docs"], - }); - // If cache hit, retry the search once - return await this.retrieveChunks(startUrl, vector, nRetrieve, true); - } - } catch (e) { - console.warn("Error trying to fetch from cache:", e); - } - } - return docs.map(this.lanceDBRowToChunk); } From 6c9f66cd702c8be4a9c702e1a9dd045beffb6d38 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Fri, 15 Aug 2025 14:46:57 -0700 Subject: [PATCH 170/174] fix: unsupported themes will use dark-plus (#7187) * feat: create a helper function to handle theme strings * feat: add tests for kebabOfThemeStr * fix: unsupported themes are correctly using dark-plus --- core/codeRenderer/CodeRenderer.ts | 31 +++++++++-------- core/util/text.ts | 7 ++++ core/util/text.vitest.ts | 58 +++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 15 deletions(-) diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts index e1ba99a53..c61d2e3cb 100644 --- a/core/codeRenderer/CodeRenderer.ts +++ b/core/codeRenderer/CodeRenderer.ts @@ -20,7 +20,7 @@ import { Highlighter, } from "shiki"; import { DiffLine } from ".."; -import { escapeForSVG, kebabOfStr } from "../util/text"; +import { escapeForSVG, kebabOfThemeStr } from "../util/text"; interface CodeRendererOptions { themesDir?: string; @@ -70,28 +70,29 @@ export class CodeRenderer { public async setTheme(themeName: string): Promise { if ( - this.themeExists(kebabOfStr(themeName)) || + this.themeExists(kebabOfThemeStr(themeName)) || themeName === "Default Dark Modern" ) { this.currentTheme = themeName === "Default Dark Modern" ? "dark-plus" - : kebabOfStr(themeName); - - this.highlighter = await getSingletonHighlighter({ - langs: ["typescript"], - themes: [this.currentTheme], - }); - - const th = this.highlighter.getTheme(this.currentTheme); - - this.editorBackground = th.bg; - this.editorForeground = th.fg; - this.editorLineHighlight = - th.colors!["editor.lineHighlightBackground"] ?? "#000000"; + : kebabOfThemeStr(themeName); } else { + // Fallback to default theme for unsupported themes. this.currentTheme = "dark-plus"; } + + // Always initialize the highlighter with the current theme. + this.highlighter = await getSingletonHighlighter({ + langs: ["typescript"], + themes: [this.currentTheme], + }); + + const th = this.highlighter.getTheme(this.currentTheme); + this.editorBackground = th.bg; + this.editorForeground = th.fg; + this.editorLineHighlight = + th.colors!["editor.lineHighlightBackground"] ?? "#000000"; } async init(): Promise {} diff --git a/core/util/text.ts b/core/util/text.ts index 297bfd5c1..6b2b81d33 100644 --- a/core/util/text.ts +++ b/core/util/text.ts @@ -44,3 +44,10 @@ export function kebabOfStr(str: string): string { .replace(/[\s_]+/g, "-") // replace spaces and underscores with hyphens .toLowerCase(); } + +export function kebabOfThemeStr(str: string): string { + return str + .toLowerCase() + .replace(/[\s_]+/g, "-") // replace spaces and underscores with hyphens + .replace(/\(|\)/g, ""); // remove parentheses +} diff --git a/core/util/text.vitest.ts b/core/util/text.vitest.ts index d69ffa781..af5502cd6 100644 --- a/core/util/text.vitest.ts +++ b/core/util/text.vitest.ts @@ -3,6 +3,7 @@ import { capitalizeFirstLetter, escapeForSVG, kebabOfStr, + kebabOfThemeStr, replaceEscapedCharacters, } from "./text"; @@ -184,3 +185,60 @@ describe("kebabOfStr", () => { expect(kebabOfStr("MiXeD cAsE")).toBe("mi-xe-d-c-as-e"); }); }); + +describe("kebabOfThemeStr", () => { + it("should convert spaces to hyphens", () => { + expect(kebabOfThemeStr("hello world")).toBe("hello-world"); + expect(kebabOfThemeStr("multiple spaces")).toBe("multiple-spaces"); + }); + + it("should convert underscores to hyphens", () => { + expect(kebabOfThemeStr("snake_case")).toBe("snake-case"); + expect(kebabOfThemeStr("multiple___underscores")).toBe( + "multiple-underscores", + ); + }); + + it("should convert mixed spaces and underscores", () => { + expect(kebabOfThemeStr("mixed_ case")).toBe("mixed-case"); + expect(kebabOfThemeStr("theme name_variant")).toBe("theme-name-variant"); + }); + + it("should convert to lowercase", () => { + expect(kebabOfThemeStr("UPPERCASE")).toBe("uppercase"); + expect(kebabOfThemeStr("MiXeD CaSe")).toBe("mixed-case"); + }); + + it("should handle already kebab-case strings", () => { + expect(kebabOfThemeStr("already-kebab")).toBe("already-kebab"); + }); + + it("should handle empty strings", () => { + expect(kebabOfThemeStr("")).toBe(""); + }); + + it("should handle single characters", () => { + expect(kebabOfThemeStr("A")).toBe("a"); + expect(kebabOfThemeStr("a")).toBe("a"); + }); + + it("should preserve other special characters", () => { + expect(kebabOfThemeStr("hello@world")).toBe("hello@world"); + expect(kebabOfThemeStr("test.file.name")).toBe("test.file.name"); + }); + + it("should not convert camelCase (unlike kebabOfStr)", () => { + expect(kebabOfThemeStr("camelCase")).toBe("camelcase"); + expect(kebabOfThemeStr("PascalCase")).toBe("pascalcase"); + }); + + it("should handle strings with numbers", () => { + expect(kebabOfThemeStr("theme_v2 beta")).toBe("theme-v2-beta"); + expect(kebabOfThemeStr("version_123_FINAL")).toBe("version-123-final"); + }); + + it("should handle strings with parentheses", () => { + expect(kebabOfThemeStr("theme_v2 (beta)")).toBe("theme-v2-beta"); + expect(kebabOfThemeStr("Gruvbox Dark (Hard)")).toBe("gruvbox-dark-hard"); + }); +}); From 4d4d86ddd2aa88c2c75e1192b40bf2830cb742ad Mon Sep 17 00:00:00 2001 From: BekahHW <34313413+BekahHW@users.noreply.github.com> Date: Fri, 15 Aug 2025 20:10:07 -0400 Subject: [PATCH 171/174] feat: Add quickstart examples to docs (agent, chat, autocomplete, edit) (#7184) * Add quickstart * Add to sidebar --- docs/docs.json | 3 +- docs/getting-started/quick-start.mdx | 265 +++++++++++++++++++++++++++ 2 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 docs/getting-started/quick-start.mdx diff --git a/docs/docs.json b/docs/docs.json index 12edfb25c..5c88b72ce 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -19,7 +19,8 @@ "pages": [ "index", "getting-started/overview", - "getting-started/install" + "getting-started/install", + "getting-started/quick-start" ] }, { diff --git a/docs/getting-started/quick-start.mdx b/docs/getting-started/quick-start.mdx new file mode 100644 index 000000000..f27899dd7 --- /dev/null +++ b/docs/getting-started/quick-start.mdx @@ -0,0 +1,265 @@ +--- +title: "Quick Start Tutorial" +description: "Learn Continue's core features through hands-on exercises. Get started with Autocomplete, Edit, Chat, and Agent in minutes." +sidebarTitle: "Quick Start" +--- + +Welcome to Continue! This interactive tutorial will guide you through all four core features using practical examples. Follow along step-by-step to learn more about Continue's capabilities. + + + **Prerequisites**: Make sure you have [installed + Continue](/getting-started/install) and [signed + in](https://auth.continue.dev/) to get started. + + +--- + +## πŸ”„ Autocomplete + +**What it does**: Provides intelligent inline code suggestions as you type, powered by AI. + + + +Create a new file called `tutorial.js` (or use any language you prefer) in your IDE + + + +Copy this starter code and place your cursor at the end of the comment: + +```javascript +// TODO: Implement a sorting algorithm function +function sortingAlgorithm(arr) { + // Place cursor here and press Enter +} +``` + +Press **Enter** and watch Continue suggest code completions. Press **Tab** to accept suggestions. + + + + +Continue will intelligently suggest function implementations based on the context and comment. + + + + + Autocomplete works best when you provide clear function names, comments, or + type annotations that give context about your intent. + + +--- + +## ✏️ Edit + +**What it does**: Make quick, targeted changes to specific code sections using natural language instructions. + + + +Paste this bubble sort implementation in your file: + +```javascript +function sortingAlgorithm(x) { + for (let i = 0; i < x.length; i++) { + for (let j = 0; j < x.length - 1; j++) { + if (x[j] > x[j + 1]) { + let temp = x[j]; + x[j] = x[j + 1]; + x[j + 1] = temp; + } + } + } + return x; +} +``` + + +**Highlight** the entire function in your editor + + +Press **Cmd/Ctrl + I** to open Edit mode + + + Type: `"make this more readable and add TypeScript types"` + + + + Watch Continue refactor your code automatically! + + + +Continue will show you a diff of the proposed changes. Accept or reject individual changes as needed. + + + + + Edit is perfect for refactoring, adding documentation, fixing bugs, or + converting between languages/frameworks. + + +--- + +## πŸ’¬ Chat + +**What it does**: Interactive AI assistant that can analyze code, answer questions, and provide guidance without leaving your IDE. + + + +Add this second sorting function to your file: + +```javascript +function sortingAlgorithm2(x) { + for (let i = 0; i < x.length; i++) { + for (let j = 0; j < x.length - 1; j++) { + if (x[j] > x[j + 1]) { + let temp = x[j]; + x[j] = x[j + 1]; + x[j + 1] = temp; + } + } + } + return x; +} +``` + + + +1. **Highlight** the function +2. Use the keyboard shortcuts below to add it to Chat. +3. Ask: `"What sorting algorithm is this and how can I optimize it?"` + + + +Try these follow-up questions: +- `"Show me how to implement quicksort instead"` +- `"What's the time complexity of this algorithm?"` +- `"Can you write unit tests for this function?"` + + + +### Chat Keyboard Shortcuts + + + + +**Cmd/Ctrl + L** +New Chat / New Chat With Selected Code / Close Continue Sidebar If Chat Already In Focus + +**Cmd/Ctrl + Shift + L** +Focus Current Chat / Add Selected Code To Current Chat / Close Continue Sidebar If Chat Already In Focus + + + + +**Cmd/Ctrl + J** +New Chat / New Chat With Selected Code / Close Continue Sidebar If Chat Already In Focus + +**Cmd/Ctrl + Shift + J** +Focus Current Chat / Add Selected Code To Current Chat / Close Continue Sidebar If Chat Already In Focus + + + + + + Use Chat for code reviews, debugging help, learning new concepts, or + brainstorming solutions to complex problems. + + +--- + +## πŸ€– Agent + +**What it does**: An autonomous coding assistant that can read files, make changes, run commands, and handle complex multi-step tasks. + + + +1. Open the Continue panel +2. Click the **dropdown** in the bottom left of the input box +3. Select **"Agent"** mode + + + + Try this prompt: ``` "Write comprehensive unit tests for the sorting functions + in this file. Create the tests in a new file using Jest, and make sure to test + edge cases like empty arrays and single elements." ``` + + + +Agent will: +- βœ… Analyze your existing code +- βœ… Create a new test file +- βœ… Write comprehensive tests +- βœ… Handle setup and imports +- βœ… Explain what it's doing at each step + + + + + Agent has powerful capabilities including file creation and modification. + Always review Agent's changes before accepting them. + + +--- + +## πŸš€ Next Steps + +Congratulations! You've experienced all four core Continue features. Here's what to explore next: + + + + Configure models, add context providers, and personalize your workflow + + + Dive deeper into Agent capabilities and advanced use cases + + + Connect your preferred AI models and providers + + + Get help and share experiences with other Continue users + + + +--- + +## πŸ“š Feature Deep Dives + +Ready to master specific features? Check out these detailed guides: + + + + Learn about [configuring autocomplete + models](/customize/model-roles/autocomplete), [fine-tuning + suggestions](/customize/deep-dives/autocomplete), and [troubleshooting + common issues](/troubleshooting). + + + + Discover [effective prompting techniques](/customize/deep-dives/prompts), [hub + v. local assistants](/guides/understanding-assistants), and [custom slash + commands](/customize/deep-dives/slash-commands). + + + + Explore [Hub Assistants](/hub/assistants/intro), [organization + management](/hub/governance/creating-an-org), and [sharing + configurations](/hub/sharing). + + + + + **Need help?** Check our [troubleshooting guide](/troubleshooting) or ask a + question in our [community + discussions](https://github.com/continuedev/continue/discussions). + From a37f3730c50ab4f1f0f19c588e7317ca4aa3efc7 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 15 Aug 2025 17:38:35 -0700 Subject: [PATCH 172/174] chore: bump versions (#7191) --- extensions/intellij/gradle.properties | 2 +- extensions/vscode/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 5a06294db..ee83a99f4 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -1,6 +1,6 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginRepositoryUrl=https://github.com/continuedev/continue -pluginVersion=1.0.37 +pluginVersion=1.0.38 pluginSinceBuild=223 platformType=IC platformVersion=2022.3.3 diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 82e5e5036..5b7116451 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.77", + "version": "1.1.78", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From a3782529218188445a57f498e839d4f890595166 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Sat, 16 Aug 2025 20:04:45 +0200 Subject: [PATCH 173/174] fix: add the missing EP to add license action --- extensions/intellij/src/main/resources/META-INF/plugin.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index 0191d8f60..8e0ddfe29 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -106,6 +106,13 @@ + + + + Date: Sat, 16 Aug 2025 20:51:44 +0200 Subject: [PATCH 174/174] fix: use validation method that also works 2024.1 --- .../continueintellijextension/license/AddLicenseKeyDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt index 9d6a13334..4ba6f2e21 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/license/AddLicenseKeyDialog.kt @@ -24,7 +24,7 @@ class AddLicenseKeyDialog(project: Project?) : DialogWrapper(project) { textField().bindText(::licenseKey) .horizontalAlign(HorizontalAlign.FILL) .focused() - .validation { + .validationOnApply { if (it.text.isBlank()) ValidationInfo("License key cannot be empty") else