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

Method addToConfig

core/indexing/docs/DocsService.ts:1186–1219  ·  view source on GitHub ↗
(siteIndexingConfig: SiteIndexingConfig)

Source from the content-addressed store, hash-verified

1184 }
1185
1186 private addToConfig(siteIndexingConfig: SiteIndexingConfig) {
1187 // Handles the case where a user has manually added the doc to config.json
1188 // so it already exists in the file
1189 const doesEquivalentDocExist = this.config.docs?.some((doc) =>
1190 docConfigsAreEqual(doc, siteIndexingConfig),
1191 );
1192
1193 if (!doesEquivalentDocExist) {
1194 editConfigFile(
1195 (config) => ({
1196 ...config,
1197 docs: [
1198 ...(config.docs?.filter(
1199 (doc) => doc.startUrl !== siteIndexingConfig.startUrl,
1200 ) ?? []),
1201 siteIndexingConfig,
1202 ],
1203 }),
1204 (config) => ({
1205 ...config,
1206 docs: [
1207 ...(config.docs?.filter(
1208 (doc) => (doc as any).startUrl !== siteIndexingConfig.startUrl,
1209 ) ?? []),
1210 {
1211 name: siteIndexingConfig.title,
1212 faviconUrl: siteIndexingConfig.faviconUrl,
1213 startUrl: siteIndexingConfig.startUrl,
1214 },
1215 ],
1216 }),
1217 );
1218 }
1219 }
1220
1221 private async add(params: AddParams) {
1222 await this.addToLance(params);

Callers 1

indexAndAddMethod · 0.95

Calls 2

editConfigFileFunction · 0.90
docConfigsAreEqualFunction · 0.85

Tested by

no test coverage detected