MCPcopy
hub / github.com/continuedev/continue / loadConfigYaml

Function loadConfigYaml

core/config/yaml/loadYaml.ts:46–139  ·  view source on GitHub ↗
(options: {
  overrideConfigYaml: AssistantUnrolled | undefined;
  ideSettings: IdeSettings;
  ide: IDE;
  packageIdentifier: PackageIdentifier;
})

Source from the content-addressed store, hash-verified

44} from "./yamlToContinueConfig";
45
46async function loadConfigYaml(options: {
47 overrideConfigYaml: AssistantUnrolled | undefined;
48 ideSettings: IdeSettings;
49 ide: IDE;
50 packageIdentifier: PackageIdentifier;
51}): Promise<ConfigResult<AssistantUnrolled>> {
52 const { overrideConfigYaml, ideSettings, ide, packageIdentifier } = options;
53
54 // Add local .continue blocks
55 // Use "content" field to pass pre-read content directly, avoiding
56 // fs.readFileSync which fails for vscode-remote:// URIs in WSL (#6242, #7810)
57 const localBlockPromises = BLOCK_TYPES.map(async (blockType) => {
58 const localBlocks = await getAllDotContinueDefinitionFiles(
59 ide,
60 { includeGlobal: true, includeWorkspace: true, fileExtType: "yaml" },
61 blockType,
62 );
63 return localBlocks.map((b) => ({
64 uriType: "file" as const,
65 fileUri: b.path,
66 content: b.content,
67 }));
68 });
69 const localPackageIdentifiers: PackageIdentifier[] = (
70 await Promise.all(localBlockPromises)
71 ).flat();
72
73 // Registry client is only used if local blocks are present, but logic same for hub/local assistants
74 const getRegistryClient = async () => {
75 const rootPath =
76 packageIdentifier.uriType === "file"
77 ? dirname(getCleanUriPath(packageIdentifier.fileUri))
78 : undefined;
79 return new RegistryClient({
80 rootPath,
81 });
82 };
83
84 const errors: ConfigValidationError[] = [];
85
86 let config: AssistantUnrolled | undefined;
87
88 if (overrideConfigYaml) {
89 config = overrideConfigYaml;
90 if (localPackageIdentifiers.length > 0) {
91 const unrolledLocal = await unrollLocalYamlBlocks(
92 localPackageIdentifiers,
93 ide,
94 await getRegistryClient(),
95 );
96 if (unrolledLocal.errors) {
97 errors.push(...unrolledLocal.errors);
98 }
99 if (unrolledLocal.config) {
100 config = mergeUnrolledAssistants(config, unrolledLocal.config);
101 }
102 }
103 } else {

Callers 1

Calls 8

unrollLocalYamlBlocksFunction · 0.90
mergeUnrolledAssistantsFunction · 0.90
unrollAssistantFunction · 0.90
validateConfigYamlFunction · 0.90
getRegistryClientFunction · 0.85
nonNullifyConfigYamlFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected