From aa10c1902e5ffa6c9e23b1fdd36439871058034e Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 19 Sep 2025 21:09:48 -0700 Subject: [PATCH 1/2] Move rule-to-slash-command conversion from YAML loading to config loading --- core/config/profile/doLoadConfig.ts | 16 ++++++++++++++++ core/config/yaml/loadYaml.ts | 14 -------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 693fde2a297..77c14887c0a 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -18,6 +18,7 @@ import { Tool, } from "../../"; import { stringifyMcpPrompt } from "../../commands/slash/mcpSlashCommand"; +import { convertRuleBlockToSlashCommand } from "../../commands/slash/ruleBlockSlashCommand"; import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton"; import ContinueProxyContextProvider from "../../context/providers/ContinueProxyContextProvider"; import MCPContextProvider from "../../context/providers/MCPContextProvider"; @@ -155,6 +156,21 @@ export default async function doLoadConfig(options: { errors.push(...rulesErrors); newConfig.rules.unshift(...rules); + // Convert invokable rules to slash commands + for (const rule of newConfig.rules) { + if (rule.invokable) { + try { + const slashCommand = convertRuleBlockToSlashCommand(rule); + newConfig.slashCommands?.push(slashCommand); + } catch (e) { + errors.push({ + message: `Error converting invokable rule ${rule.name} to slash command: ${e instanceof Error ? e.message : e}`, + fatal: false, + }); + } + } + } + const proxyContextProvider = newConfig.contextProviders?.find( (cp) => cp.description.title === "continue-proxy", ); diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 915eb74f78d..1cfdb712035 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -25,7 +25,6 @@ import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; import { convertPromptBlockToSlashCommand } from "../../commands/slash/promptBlockSlashCommand"; import { slashCommandFromPromptFile } from "../../commands/slash/promptFileSlashCommand"; -import { convertRuleBlockToSlashCommand } from "../../commands/slash/ruleBlockSlashCommand"; import { getControlPlaneEnvSync } from "../../control-plane/env"; import { PolicySingleton } from "../../control-plane/PolicySingleton"; import { getBaseToolDefinitions } from "../../tools"; @@ -209,19 +208,6 @@ export async function configYamlToContinueConfig(options: { for (const rule of config.rules ?? []) { const convertedRule = convertYamlRuleToContinueRule(rule); continueConfig.rules.push(convertedRule); - - // Convert invokable rules to slash commands - if (convertedRule.invokable) { - try { - const slashCommand = convertRuleBlockToSlashCommand(convertedRule); - continueConfig.slashCommands?.push(slashCommand); - } catch (e) { - localErrors.push({ - message: `Error converting invokable rule ${convertedRule.name} to slash command: ${e instanceof Error ? e.message : e}`, - fatal: false, - }); - } - } } continueConfig.data = config.data?.map((d) => ({ From 99dd0009ae204e03cee237721466b050ec371884 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:31:58 -0700 Subject: [PATCH 2/2] Update core/config/profile/doLoadConfig.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- core/config/profile/doLoadConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 77c14887c0a..c213bcb6663 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -161,7 +161,7 @@ export default async function doLoadConfig(options: { if (rule.invokable) { try { const slashCommand = convertRuleBlockToSlashCommand(rule); - newConfig.slashCommands?.push(slashCommand); + (newConfig.slashCommands ??= []).push(slashCommand); } catch (e) { errors.push({ message: `Error converting invokable rule ${rule.name} to slash command: ${e instanceof Error ? e.message : e}`,