File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818 Tool ,
1919} from "../../" ;
2020import { stringifyMcpPrompt } from "../../commands/slash/mcpSlashCommand" ;
21+ import { convertRuleBlockToSlashCommand } from "../../commands/slash/ruleBlockSlashCommand" ;
2122import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton" ;
2223import ContinueProxyContextProvider from "../../context/providers/ContinueProxyContextProvider" ;
2324import MCPContextProvider from "../../context/providers/MCPContextProvider" ;
@@ -155,6 +156,21 @@ export default async function doLoadConfig(options: {
155156 errors . push ( ...rulesErrors ) ;
156157 newConfig . rules . unshift ( ...rules ) ;
157158
159+ // Convert invokable rules to slash commands
160+ for ( const rule of newConfig . rules ) {
161+ if ( rule . invokable ) {
162+ try {
163+ const slashCommand = convertRuleBlockToSlashCommand ( rule ) ;
164+ ( newConfig . slashCommands ??= [ ] ) . push ( slashCommand ) ;
165+ } catch ( e ) {
166+ errors . push ( {
167+ message : `Error converting invokable rule ${ rule . name } to slash command: ${ e instanceof Error ? e . message : e } ` ,
168+ fatal : false ,
169+ } ) ;
170+ }
171+ }
172+ }
173+
158174 const proxyContextProvider = newConfig . contextProviders ?. find (
159175 ( cp ) => cp . description . title === "continue-proxy" ,
160176 ) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
2525
2626import { convertPromptBlockToSlashCommand } from "../../commands/slash/promptBlockSlashCommand" ;
2727import { slashCommandFromPromptFile } from "../../commands/slash/promptFileSlashCommand" ;
28- import { convertRuleBlockToSlashCommand } from "../../commands/slash/ruleBlockSlashCommand" ;
2928import { getControlPlaneEnvSync } from "../../control-plane/env" ;
3029import { PolicySingleton } from "../../control-plane/PolicySingleton" ;
3130import { getBaseToolDefinitions } from "../../tools" ;
@@ -209,19 +208,6 @@ export async function configYamlToContinueConfig(options: {
209208 for ( const rule of config . rules ?? [ ] ) {
210209 const convertedRule = convertYamlRuleToContinueRule ( rule ) ;
211210 continueConfig . rules . push ( convertedRule ) ;
212-
213- // Convert invokable rules to slash commands
214- if ( convertedRule . invokable ) {
215- try {
216- const slashCommand = convertRuleBlockToSlashCommand ( convertedRule ) ;
217- continueConfig . slashCommands ?. push ( slashCommand ) ;
218- } catch ( e ) {
219- localErrors . push ( {
220- message : `Error converting invokable rule ${ convertedRule . name } to slash command: ${ e instanceof Error ? e . message : e } ` ,
221- fatal : false ,
222- } ) ;
223- }
224- }
225211 }
226212
227213 continueConfig . data = config . data ?. map ( ( d ) => ( {
You can’t perform that action at this time.
0 commit comments