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

Function loadContinueConfigFromJson

core/config/load.ts:791–898  ·  view source on GitHub ↗
(
  ide: IDE,
  ideSettings: IdeSettings,
  ideInfo: IdeInfo,
  uniqueId: string,
  llmLogger: ILLMLogger,
  overrideConfigJson: SerializedContinueConfig | undefined,
)

Source from the content-addressed store, hash-verified

789}
790
791async function loadContinueConfigFromJson(
792 ide: IDE,
793 ideSettings: IdeSettings,
794 ideInfo: IdeInfo,
795 uniqueId: string,
796 llmLogger: ILLMLogger,
797 overrideConfigJson: SerializedContinueConfig | undefined,
798): Promise<ConfigResult<ContinueConfig>> {
799 const workspaceConfigs = await getWorkspaceRcConfigs(ide);
800 // Serialized config
801 let {
802 config: serialized,
803 errors,
804 configLoadInterrupted,
805 } = loadSerializedConfig(
806 workspaceConfigs,
807 ideSettings,
808 ideInfo.ideType,
809 overrideConfigJson,
810 ide,
811 );
812
813 if (!serialized || configLoadInterrupted) {
814 return { errors, config: undefined, configLoadInterrupted: true };
815 }
816
817 // Apply shared config
818 // TODO: override several of these values with user/org shared config
819 const sharedConfig = new GlobalContext().getSharedConfig();
820 const withShared = modifyAnyConfigWithSharedConfig(serialized, sharedConfig);
821
822 // Convert serialized to intermediate config
823 let intermediate = await serializedToIntermediateConfig(withShared, ide);
824
825 // Apply config.ts to modify intermediate config
826 const configJsContents = await buildConfigTsandReadConfigJs(
827 ide,
828 ideInfo.ideType,
829 );
830 if (configJsContents) {
831 try {
832 // Try config.ts first
833 const configJsPath = getConfigJsPath();
834 let module: any;
835
836 try {
837 module = await import(configJsPath);
838 } catch (e) {
839 console.log(e);
840 console.log(
841 "Could not load config.ts as absolute path, retrying as file url ...",
842 );
843 try {
844 module = await import(localPathToUri(configJsPath));
845 } catch (e) {
846 throw new Error("Could not load config.ts as file url either", {
847 cause: e,
848 });

Callers 1

doLoadConfigFunction · 0.90

Calls 11

getWorkspaceRcConfigsFunction · 0.90
getConfigJsPathFunction · 0.90
localPathToUriFunction · 0.90
getConfigJsPathForRemoteFunction · 0.90
loadSerializedConfigFunction · 0.85
getSharedConfigMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected