diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 333e3d1c9..169ca8089 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -2,9 +2,11 @@ import fs from "node:fs"; import { AssistantUnrolled, + BLOCK_TYPES, ConfigResult, ConfigValidationError, ModelRole, + parseAssistantUnrolled, RegistryClient, unrollAssistantFromContent, validateConfigYaml, @@ -40,6 +42,7 @@ import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; import { getControlPlaneEnvSync } from "../../control-plane/env"; +import { getAllDotContinueYamlFiles } from "../loadLocalAssistants"; import { LocalPlatformClient } from "./LocalPlatformClient"; import { llmsFromModelConfig } from "./models"; @@ -433,6 +436,29 @@ export async function loadContinueConfigFromYaml( }; } + // Add local .continue blocks + for (const blockType of BLOCK_TYPES) { + const localBlocks = await getAllDotContinueYamlFiles( + ide, + { includeGlobal: true, includeWorkspace: true }, + blockType, + ); + + for (const block of localBlocks) { + const parsedYaml = parseAssistantUnrolled(block.content); + + const inlineBlock = parsedYaml[blockType]?.[0]; + if (inlineBlock) { + configYamlResult.config[blockType] = [ + ...(configYamlResult.config[blockType] ?? []), + inlineBlock as any, + ]; + } + } + + configYamlResult.config; + } + const { config: continueConfig, errors: localErrors } = await configYamlToContinueConfig( configYamlResult.config, diff --git a/core/package-lock.json b/core/package-lock.json index 81d4a5870..4f1c21ec8 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.777.0", "@aws-sdk/credential-providers": "^3.778.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.80", + "@continuedev/config-yaml": "^1.0.81", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.8", "@continuedev/openai-adapters": "^1.0.18", @@ -2977,9 +2977,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.80", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.80.tgz", - "integrity": "sha512-fHZLh04aThbgK80+B5O0CBBb0IgJbfM0trBWeDI4/MLpxpTJebxX4QY1RZBOdIULKMDMHnfyWNCe2gSGi/mt9Q==", + "version": "1.0.81", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.81.tgz", + "integrity": "sha512-KNk1n3hXJWL2PSflN9WXlClGVJMJNNSrkn6Fo3BcVu466MOr/vJsuA2In3ZolBMCpg2jNYKYbCC72N1JDFS6ww==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index 947aa6d56..3701bcb49 100644 --- a/core/package.json +++ b/core/package.json @@ -47,7 +47,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.777.0", "@aws-sdk/credential-providers": "^3.778.0", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.80", + "@continuedev/config-yaml": "^1.0.81", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.8", "@continuedev/openai-adapters": "^1.0.18", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 966a6289c..af76f1951 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.80", + "version": "1.0.81", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/load/getBlockType.ts b/packages/config-yaml/src/load/getBlockType.ts index a2cf56062..c46de0bd4 100644 --- a/packages/config-yaml/src/load/getBlockType.ts +++ b/packages/config-yaml/src/load/getBlockType.ts @@ -1,13 +1,17 @@ +import { z } from "zod"; import { ConfigYaml } from "../schemas/index.js"; -export type BlockType = - | "models" - | "context" - | "docs" - | "mcpServers" - | "data" - | "rules" - | "prompts"; +export const BLOCK_TYPES = [ + "models", + "context", + "data", + "mcpServers", + "rules", + "prompts", + "docs", +] as const; +export type BlockType = (typeof BLOCK_TYPES)[number]; +export const blockTypeSchema = z.enum(BLOCK_TYPES); export function getBlockType(block: ConfigYaml): BlockType | undefined { if (block.context?.length) {