Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/config/profile/doLoadConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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",
);
Expand Down
14 changes: 0 additions & 14 deletions core/config/yaml/loadYaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) => ({
Expand Down
Loading