diff --git a/core/context/providers/RepoMapContextProvider.ts b/core/context/providers/RepoMapContextProvider.ts index 1d629e9f5..90eadb964 100644 --- a/core/context/providers/RepoMapContextProvider.ts +++ b/core/context/providers/RepoMapContextProvider.ts @@ -20,7 +20,7 @@ class RepoMapContextProvider extends BaseContextProvider { REPO_MAX_CONTEXT_LENGTH_RATIO = 0.5; static description: ContextProviderDescription = { - title: "repo_map", + title: "repo-map", displayTitle: "Repository Map", description: "List of files and signatures", type: "normal", diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index c4b0cd18c..27a7e90cb 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -299,23 +299,30 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { for (let i = 0; i < results.removeTag.length; i++) { const removeTag = results.removeTag[i]; - const snippet = await db.get( + let snippets = await db.get( `SELECT id FROM code_snippets WHERE cacheKey = ? AND path = ?`, [removeTag.cacheKey, removeTag.path], ); + if (!Array.isArray(snippets)) { snippets = [snippets]; } - if (snippet) { + if (snippets) { + if (!Array.isArray(snippets)) { + snippets = [snippets]; + } + + const snippetIds = snippets.map((row: any) => row.id).join(","); + await db.run( ` DELETE FROM code_snippets_tags WHERE tag = ? - AND snippetId = ? + AND snippetId IN (${snippetIds}) `, - [tagString, snippet.id], + [tagString], ); } diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md index 610e272a9..7dfe6190c 100644 --- a/docs/docs/customization/context-providers.md +++ b/docs/docs/customization/context-providers.md @@ -301,6 +301,18 @@ Type `@locals` to reference the contents of the local variables with top n level } ``` +### Repository map + +Provides an overview of all files and the call signatures of top-level classes, functions, and methods. This helps the model better understand how a particular piece of code relates to the rest of the codebase. + +This context provider is inpsired by [Aider's repository map](https://aider.chat/2023/10/22/repomap.html). + +```json +{ + "name": "repo-map" +} +``` + ### Operating System Type `@os` to reference the architecture and platform of your current operating system.