Skip to content
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c475874
feat: apply changes from local main
daniel-lxs May 3, 2025
13029ef
fix: add missing types
daniel-lxs May 3, 2025
2fd2248
feat: deduplicate code blocks coming out of parser
daniel-lxs May 4, 2025
40c3652
feat: implement a cache manager to improve cache handling
daniel-lxs May 5, 2025
7cdac9f
refactor: move code index service initialization to extension and rem…
daniel-lxs May 5, 2025
399dc2c
fix: return undefined instead of throwing if no workspace is detected
daniel-lxs May 5, 2025
0cf8369
feat: allow auto approve if it is active for read tools
daniel-lxs May 5, 2025
82d6625
refactor: improve UI of the results and allow opening the ranges dire…
daniel-lxs May 5, 2025
6cff73b
refactor: use dependency injection to improve performance
daniel-lxs May 6, 2025
4554ddc
feat: implement result filtering by directory path
daniel-lxs May 6, 2025
e8f8d47
refactor: centralize path normalization logic
daniel-lxs May 6, 2025
caa293a
refactor: remove unnecessary barrel file
daniel-lxs May 6, 2025
a2c770f
refactor: prevent restarting the service if no settings change
daniel-lxs May 6, 2025
a11cf15
fix: the indexing process should never be awaited
daniel-lxs May 6, 2025
0b19cff
refactor: cleanup unused method
daniel-lxs May 8, 2025
0cfa228
refactor: remove batch limits for ollama
daniel-lxs May 8, 2025
cb2accd
refactor(parser): simplify method signatures and improve chunking logic
daniel-lxs May 8, 2025
d64de40
fix(settings): make select inputs full width in CodeIndexSettings
daniel-lxs May 8, 2025
a2e656c
refactor: increase max list file limit
daniel-lxs May 9, 2025
6d1f08d
feat(ui): improve codebase search result display formatting
daniel-lxs May 9, 2025
5964551
test: add tests for cache and config managers
daniel-lxs May 9, 2025
247a27c
test: create unit tests for parser and scanner
daniel-lxs May 9, 2025
f2757fe
feat(parser): improve segment hash uniqueness
daniel-lxs May 9, 2025
28adab5
feat(file-watcher): add error logging and optional ignoreController i…
daniel-lxs May 10, 2025
bdf7309
fix: allow getting the state if the service is disabled
daniel-lxs May 10, 2025
c49bd95
fix: set the embedding models when cline provider is initialized
daniel-lxs May 14, 2025
d918817
feat: use zod to validate form
daniel-lxs May 14, 2025
8fb9766
feat(file-watcher): enhance file watcher for batched deletions and im…
daniel-lxs May 14, 2025
5741338
feat(CodeIndexSettings): move OpenAI key input to a conditional rende…
daniel-lxs May 14, 2025
b180ae8
feat(CodeIndexSettings): update button visibility based on indexing s…
daniel-lxs May 14, 2025
7cbde5f
feat(file-watcher): refactor vscode mock and enhance file watcher tests
daniel-lxs May 15, 2025
453af1c
fix(CodeIndexManager): do not await startIndexing on configuration ch…
daniel-lxs May 15, 2025
6e20aeb
feat(types): add codeIndexOpenAiKey and codeIndexQdrantApiKey to Prov…
daniel-lxs May 15, 2025
8fc6029
feat(FileWatcher): enhance file processing with batch operations and …
daniel-lxs May 16, 2025
23e0ae9
fix(webviewMessageHandler): handle errors during CodeIndexManager ini…
daniel-lxs May 16, 2025
342c70a
refactor(CodeIndexManager): streamline service creation by consolidat…
daniel-lxs May 16, 2025
8533a2f
feat(CodeIndex): implement minimum search score configuration and upd…
daniel-lxs May 16, 2025
84c5f91
refactor(CodeIndexSettings): replace ApiConfiguration with ProviderSe…
daniel-lxs May 16, 2025
d0e2314
refactor: move contants to centralized file
daniel-lxs May 16, 2025
6b94293
refactor(constants): rename CODEBASE_INDEX_SEARCH_MIN_SCORE to SEARCH…
daniel-lxs May 16, 2025
64dfc91
feat(QdrantVectorStore): enhance search functionality with new query …
daniel-lxs May 16, 2025
cfdc8eb
feat(FileWatcher): implement batch processing and retry logic for ups…
daniel-lxs May 17, 2025
33209bd
fix(CodeIndexSettings): rename setProviderSettingsField to setApiConf…
daniel-lxs May 20, 2025
dd063fe
fix(ChatRow): remove limit from search query messages
daniel-lxs May 20, 2025
9a75d70
refactor(CodebaseSearchResult): remove unused props from component
daniel-lxs May 20, 2025
6819e68
feat: implement batch processing for file events in FileWatcher
daniel-lxs May 21, 2025
f8cb597
feat(CodeIndex): implement batch processing and update progress repor…
daniel-lxs May 21, 2025
5f9c2d5
fix: define a default url for qdrant
daniel-lxs May 21, 2025
d826493
feat(CodeIndexManager): add initialization check and update startInde…
daniel-lxs May 21, 2025
523916b
feat(CodeIndexSettings): validate Qdrant URL and update settings comm…
daniel-lxs May 21, 2025
56109f4
feat: refactor progress calculation and update progress bar rendering
daniel-lxs May 21, 2025
a65f66d
refactor: remove webview provider and related methods
daniel-lxs May 21, 2025
cc38b4c
fix: simplify indexing status update by directly using update values
daniel-lxs May 21, 2025
a423823
feat: integrate .gitignore support into file processing and scanning …
daniel-lxs May 21, 2025
2f4f2e5
fix: update clearCacheFile method to write an empty object instead of…
daniel-lxs May 21, 2025
d28d020
Revert this
cte May 22, 2025
459c01f
Run prettier
cte May 22, 2025
12fbe3e
fix: add new dependencies for qdrant client and directory scanner
daniel-lxs May 22, 2025
e206c31
feat: add codebase search functionality to localization files
daniel-lxs May 22, 2025
ea479f1
feat: add localization strings for codebase indexing settings
daniel-lxs May 22, 2025
c658367
feat: integrate CodeIndexSettings into ExperimentalSettings and updat…
daniel-lxs May 23, 2025
c667d5a
refactor: remove console logs from various components for cleaner output
daniel-lxs May 23, 2025
8a6bad5
feat: enhance capabilities section and codebase search tool description
daniel-lxs May 23, 2025
9869a09
feat: add code indexing localization for multiple languages
daniel-lxs May 23, 2025
2331cf3
fix: correct indentation for CodeIndexSettings component in Experimen…
daniel-lxs May 23, 2025
c1b33a6
refactor: update unit tests to properly test current functionality
daniel-lxs May 23, 2025
3bccf74
feat: add mock implementation for p-limit and update Jest config
daniel-lxs May 23, 2025
77af4c1
feat: track file creation, change, and deletion events in accumulated…
daniel-lxs May 23, 2025
3589fe9
refactor: simplify file watcher tests by removing waitForFileProcessi…
daniel-lxs May 23, 2025
b5b0603
refactor: mock ContextProxy's getValue method to return current confi…
daniel-lxs May 24, 2025
0efff1d
refactor: mock missing properties required by codebase indexing manager
daniel-lxs May 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 29 additions & 31 deletions locales/ca/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/de/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/es/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/fr/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/hi/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/it/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/ja/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/ko/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/nl/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/pl/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/pt-BR/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/ru/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/tr/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/vi/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/zh-CN/README.md

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions locales/zh-TW/README.md

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { telemetryService } from "../services/telemetry/TelemetryService"

import { registerHumanRelayCallback, unregisterHumanRelayCallback, handleHumanRelayResponse } from "./humanRelay"
import { handleNewTask } from "./handleTask"
import { CodeIndexManager } from "../services/code-index/manager"

/**
* Helper to get the visible ClineProvider instance or log if not found.
Expand Down Expand Up @@ -184,7 +185,8 @@ export const openClineInNewTab = async ({ context, outputChannel }: Omit<Registe
// don't need to use that event).
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
const contextProxy = await ContextProxy.getInstance(context)
const tabProvider = new ClineProvider(context, outputChannel, "editor", contextProxy)
const codeIndexManager = CodeIndexManager.getInstance(context)
const tabProvider = new ClineProvider(context, outputChannel, "editor", contextProxy, codeIndexManager)
const lastCol = Math.max(...vscode.window.visibleTextEditors.map((editor) => editor.viewColumn || 0))

// Check if there are any visible text editors, otherwise open a new group
Expand Down
6 changes: 6 additions & 0 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { checkpointSave } from "../checkpoints"
import { formatResponse } from "../prompts/responses"
import { validateToolUse } from "../tools/validateToolUse"
import { Task } from "../task/Task"
import { codebaseSearchTool } from "../tools/codebaseSearchTool"

/**
* Processes and presents assistant message content to the user interface.
Expand Down Expand Up @@ -185,6 +186,8 @@ export async function presentAssistantMessage(cline: Task) {
return `[${block.name}]`
case "switch_mode":
return `[${block.name} to '${block.params.mode_slug}'${block.params.reason ? ` because: ${block.params.reason}` : ""}]`
case "codebase_search": // Add case for the new tool
return `[${block.name} for '${block.params.query}']`
case "new_task": {
const mode = block.params.mode ?? defaultModeSlug
const message = block.params.message ?? "(no message)"
Expand Down Expand Up @@ -402,6 +405,9 @@ export async function presentAssistantMessage(cline: Task) {
case "list_files":
await listFilesTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
case "codebase_search":
await codebaseSearchTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
break
case "list_code_definition_names":
await listCodeDefinitionNamesTool(
cline,
Expand Down
12 changes: 11 additions & 1 deletion src/core/prompts/sections/capabilities.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { DiffStrategy } from "../../../shared/tools"
import { McpHub } from "../../../services/mcp/McpHub"
import { CodeIndexManager } from "../../../services/code-index/manager"

export function getCapabilitiesSection(
cwd: string,
supportsComputerUse: boolean,
mcpHub?: McpHub,
diffStrategy?: DiffStrategy,
codeIndexManager?: CodeIndexManager,
): string {
return `====

Expand All @@ -15,7 +17,15 @@ CAPABILITIES
supportsComputerUse ? ", use the browser" : ""
}, read and write files, and ask follow-up questions. These tools help you effectively accomplish a wide range of tasks, such as writing code, making edits or improvements to existing files, understanding the current state of a project, performing system operations, and much more.
- When the user initially gives you a task, a recursive list of all filepaths in the current workspace directory ('${cwd}') will be included in environment_details. This provides an overview of the project's file structure, offering key insights into the project from directory/file names (how developers conceptualize and organize their code) and file extensions (the language used). This can also guide decision-making on which files to explore further. If you need to further explore directories such as outside the current workspace directory, you can use the list_files tool. If you pass 'true' for the recursive parameter, it will list files recursively. Otherwise, it will list files at the top level, which is better suited for generic directories where you don't necessarily need the nested structure, like the Desktop.
- You can use search_files to perform regex searches across files in a specified directory, outputting context-rich results that include surrounding lines. This is particularly useful for understanding code patterns, finding specific implementations, or identifying areas that need refactoring.
- You can use search_files to perform regex searches across files in a specified directory, outputting context-rich results that include surrounding lines. This is particularly useful for understanding code patterns, finding specific implementations, or identifying areas that need refactoring.${
codeIndexManager &&
codeIndexManager.isFeatureEnabled &&
codeIndexManager.isFeatureConfigured &&
codeIndexManager.isInitialized
? `
- You can use the \`codebase_search\` tool to perform semantic searches across your entire codebase. This tool is powerful for finding functionally relevant code, even if you don't know the exact keywords or file names. It's particularly useful for understanding how features are implemented across multiple files, discovering usages of a particular API, or finding code examples related to a concept. This capability relies on a pre-built index of your code.`
: ""
}
- You can use the list_code_definition_names tool to get an overview of source code definitions for all files at the top level of a specified directory. This can be particularly useful when you need to understand the broader context and relationships between certain parts of the code. You may need to call this tool multiple times to understand various parts of the codebase related to the task.
- For example, when asked to make edits or improvements you might analyze the file structure in the initial environment_details to get an overview of the project, then use list_code_definition_names to get further insight using source code definitions for files located in relevant directories, then read_file to examine the contents of relevant files, analyze the code and suggest improvements or make necessary edits, then use ${diffStrategy ? "the apply_diff or write_to_file" : "the write_to_file"} tool to apply the changes. If you refactored code that could affect other parts of the codebase, you could use search_files to ensure you update other files as needed.
- You can use the execute_command tool to run commands on the user's computer whenever you feel it can help accomplish the user's task. When you need to execute a CLI command, you must provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, since they are more flexible and easier to run. Interactive and long-running commands are allowed, since the commands are run in the user's VSCode terminal. The user may keep commands running in the background and you will be kept updated on their status along the way. Each command you execute is run in a new terminal instance.${
Expand Down
6 changes: 5 additions & 1 deletion src/core/prompts/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
markdownFormattingSection,
} from "./sections"
import { formatLanguage } from "../../shared/language"
import { CodeIndexManager } from "../../services/code-index/manager"

async function generatePrompt(
context: vscode.ExtensionContext,
Expand Down Expand Up @@ -63,6 +64,8 @@ async function generatePrompt(
: Promise.resolve(""),
])

const codeIndexManager = CodeIndexManager.getInstance(context)

const basePrompt = `${roleDefinition}

${markdownFormattingSection()}
Expand All @@ -73,6 +76,7 @@ ${getToolDescriptionsForMode(
mode,
cwd,
supportsComputerUse,
codeIndexManager,
effectiveDiffStrategy,
browserViewportSize,
mcpHub,
Expand All @@ -84,7 +88,7 @@ ${getToolUseGuidelinesSection()}

${mcpServersSection}

${getCapabilitiesSection(cwd, supportsComputerUse, mcpHub, effectiveDiffStrategy)}
${getCapabilitiesSection(cwd, supportsComputerUse, mcpHub, effectiveDiffStrategy, codeIndexManager)}

${modesSection}

Expand Down
19 changes: 19 additions & 0 deletions src/core/prompts/tools/codebase-search.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export function getCodebaseSearchDescription(): string {
return `## codebase_search
Description: Find files most relevant to the search query.\nThis is a semantic search tool, so the query should ask for something semantically matching what is needed.\nIf it makes sense to only search in a particular directory, please specify it in the path parameter.\nUnless there is a clear reason to use your own search query, please just reuse the user's exact query with their wording.\nTheir exact wording/phrasing can often be helpful for the semantic search query. Keeping the same exact question format can also be helpful.
Parameters:
- query: (required) The search query to find relevant code. You should reuse the user's exact query/most recent message with their wording unless there is a clear reason not to.
- path: (optional) The path to the directory to search in relative to the current working directory. This parameter should only be a directory path, file paths are not supported. Defaults to the current working directory.
Usage:
<codebase_search>
<query>Your natural language query here</query>
<path>Path to the directory to search in (optional)</path>
</codebase_search>

Example: Searching for functions related to user authentication
<codebase_search>
<query>User login and password hashing</query>
<path>/path/to/directory</path>
</codebase_search>
`
}
Loading
Loading